跳到内容

Conductor reference

Paneflow Conductor 控制平面的 CLI verbs、JSON-RPC methods、fields、events、config keys 和 exit codes。

本页是 Conductor 的紧凑 reference。它定义公开 surface,以及脚本或 LLM 可以依赖的字段。

CLI verbs

VerbPrimary methodUse
ps [--json]fleet.list列出所有 workspace 中检测到的 agents
status <target> [--json]surface.status读取一个 pane 的 agent state
watch [--surface <sel>] [--type <event>]events.subscribe流式输出 lifecycle events 和 surface changes
read <target>surface.read读取 pane scrollback
send <target> <text>surface.send_text在 pane 中准备或提交 text
wait --match <sel>surface.read,idle mode 使用 event stream阻塞直到 idle state、regex 或两者都满足
up <file>workspace orchestration创建声明式 agent workspace
flow run <file>flow orchestration运行 multi-agent pipeline
ls, search, focus, keyscripting methods当 conductor state 不够时使用底层 pane automation

读取操作默认允许。send --submitkey 以及会提交文本的 flow step 等写入操作需要 scripting gate 或 AI free access mode。

Selectors

SelectorExampleNotes
Numeric idpaneflow status 42精确 pane id
Namepaneflow status backendconductor workflows 的最佳 selector
cmdline:<substr>paneflow read cmdline:claude有用,但不如 pane name 可移植
cwd:<path>paneflow read cwd:/home/me/app适合 repo-scoped scripts

如果 selector 没有匹配或匹配多个 pane,会以 code 3 退出。明确接受多个匹配的命令除外,例如 broadcast sends、wait --anywait --all

fleet.list

paneflow ps --json 返回 agents array。

FieldMeaning
pidagent process id,scan-only detection 时为 null
toolclaudecodexopencodegemini 等 agent family
statethinkingwaiting_for_inputfinishederroredstalledidleunknown_running
hookedPaneflow 收到 lifecycle hook events 时为 true
reasondetection reason,包括未 hooked 进程的 no_hook
surface_id已解析时的 pane id
surface_name存在时的 pane name
workspaceworkspace index
active_tool_nameagent 内当前运行的 tool,如果被报告
message等待中的 question 或 permission text,如果被报告
last_resulthook 提供时的 last turn summary
waiting_ms等待输入的毫秒数
idle_ms自上次观察到 activity 以来的毫秒数

空 fleet 是 exit code 0{"agents":[]}

surface.status

paneflow status <target> --json 返回一个 pane status。

FieldMeaning
surface_idpane id
statefleet.list 相同的 state vocabulary
hookedlifecycle tracking 是否活跃
tool检测到时的 agent family
active_tool_name当前运行的 tool,如果被报告
message等待中的 question 或 permission text,如果被报告
last_result可用时的 last turn summary
waiting_ms等待输入的毫秒数
idle_ms自上次观察到 activity 以来的毫秒数
output_generationpane output 改变时递增的 monotonic counter

没有 active agent 的 pane 会返回 idle state,而不是 error。

surface.read

paneflow read <target> 返回 terminal text。默认情况下,输出会被包在 <untrusted_terminal_output> 中,让 LLM 可以检查它,而不会把它当作指令。只有可信的人类脚本才应使用 --raw

JSON mode 中有用的 fields 包括 textlinestotal_lineseofoutput_generation

events.subscribewatch

paneflow watch 是 newline-delimited JSON。它可能 emit:

Event typeMeaning
ai.session_startagent session 开始
ai.prompt_submitprompt 被提交
ai.tool_useagent 调用 tool
ai.notificationagent 提问或请求 permission
ai.stopturn 结束
ai.exitagent process 退出
ai.session_endsession 关闭
surface_changedpane 的 output_generation 已推进

Control frames 也有效:

FrameMeaning
subscribedsubscription acknowledged
heartbeatkeepalive frame
droppedsubscriber 落后,events 被丢弃

client 收到 dropped 后,应通过 paneflow ps --jsonpaneflow status <target> --json 重新同步。

wait

wait --idle 在可用时使用 event stream,必要时安全 fallback。wait --pattern 每 500 ms 轮询最近的 scrollback,并扫描最新 500 行。

ModeExampleUse
Idlepaneflow wait --match reviewer --idle --timeout 600agent 停止工作后继续
Patternpaneflow wait --match backend --pattern '^DONE:' --timeout 300sentinel line 出现后继续
Idle plus patternpaneflow wait --match reviewer --idle --pattern '^REPORT_DONE' --timeout 600同时要求稳定 pane 和 marker
Any or allpaneflow wait --match 'cmdline:claude' --pattern 'tests passed' --all在 pattern mode 下协调多个 panes

Timeout 以 code 4 退出。

Config keys

KeyDefaultMeaning
ai_unrestrictedfalse启用后允许可信 AI automation submit
ai_injection_fencetrue把 peer terminal output 包装为 untrusted text
agent_stall_threshold_secsapp default把静默的 in-progress turns 标记为 stalled

Exit codes

CodeMeaning
0Success
1Runtime failure
2CLI usage error
3Target not found or ambiguous
4wait timeout