@draht/coding-agent 2026.10.4 → 2026.10.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +32 -6
- package/dist/bundle/chunks/anthropic.js +1 -1
- package/dist/bundle/chunks/{chunk-DPE4ALPU.js → chunk-2VAF4XJI.js} +1 -1
- package/dist/bundle/chunks/chunk-6APPDDHH.js +65 -0
- package/dist/bundle/chunks/{chunk-LDAOC5RB.js → chunk-JFDPOIUH.js} +1 -1
- package/dist/bundle/chunks/{chunk-COF5JT7R.js → chunk-KU5HAKZL.js} +1 -1
- package/dist/bundle/chunks/{chunk-Z2INEV2J.js → chunk-MIUVNYYW.js} +292 -153
- package/dist/bundle/chunks/{chunk-5VZWYVZB.js → chunk-NHTOADU6.js} +2 -2
- package/dist/bundle/chunks/{chunk-H6FT43VC.js → chunk-OWGSPJPZ.js} +4 -4
- package/dist/bundle/chunks/chunk-PGJAHC3R.js +107 -0
- package/dist/bundle/chunks/chunk-QVFELZW2.js +312 -0
- package/dist/bundle/chunks/{chunk-XKDTJ4YR.js → chunk-TJ3AW62W.js} +1 -1
- package/dist/bundle/chunks/{cli-SR5QBZH4.js → cli-U7Y4VNNI.js} +1 -1
- package/dist/bundle/chunks/execute-ZWB4PIQQ.js +18 -0
- package/dist/bundle/chunks/google-antigravity.js +1 -1
- package/dist/bundle/chunks/google-gemini-cli.js +1 -1
- package/dist/bundle/chunks/openai-chatgpt.js +1 -1
- package/dist/bundle/chunks/openai-codex.js +1 -1
- package/dist/bundle/chunks/openrouter.js +1 -1
- package/dist/bundle/chunks/radius.js +1 -1
- package/dist/bundle/chunks/runtime-363BOYEO.js +3 -0
- package/dist/bundle/chunks/{runtime-6YJPGSP7.js → runtime-PXJK4L7Y.js} +1 -1
- package/dist/bundle/chunks/{settings-manager-D2EG7WDO.js → settings-manager-GEOZJXFQ.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-BEJ4ZJ3D.js +2 -0
- package/dist/bundle/chunks/xai.js +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.js +3 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/core/builtins/duet.d.ts +5 -2
- package/dist/core/builtins/duet.d.ts.map +1 -1
- package/dist/core/builtins/duet.js +65 -27
- package/dist/core/builtins/duet.js.map +1 -1
- package/dist/core/builtins/index.d.ts.map +1 -1
- package/dist/core/builtins/index.js +2 -0
- package/dist/core/builtins/index.js.map +1 -1
- package/dist/core/builtins/polyphase.d.ts +15 -0
- package/dist/core/builtins/polyphase.d.ts.map +1 -0
- package/dist/core/builtins/polyphase.js +196 -0
- package/dist/core/builtins/polyphase.js.map +1 -0
- package/dist/core/builtins/subagent.d.ts +44 -34
- package/dist/core/builtins/subagent.d.ts.map +1 -1
- package/dist/core/builtins/subagent.js +827 -560
- package/dist/core/builtins/subagent.js.map +1 -1
- package/dist/core/extensions/types.d.ts +17 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/keybindings.d.ts +30 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +24 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-resolver.js +4 -4
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/multi-agent/permission-gate.d.ts.map +1 -1
- package/dist/core/multi-agent/permission-gate.js +4 -1
- package/dist/core/multi-agent/permission-gate.js.map +1 -1
- package/dist/core/polyphase/approval.d.ts +35 -0
- package/dist/core/polyphase/approval.d.ts.map +1 -0
- package/dist/core/polyphase/approval.js +184 -0
- package/dist/core/polyphase/approval.js.map +1 -0
- package/dist/core/polyphase/child-events.d.ts +107 -0
- package/dist/core/polyphase/child-events.d.ts.map +1 -0
- package/dist/core/polyphase/child-events.js +862 -0
- package/dist/core/polyphase/child-events.js.map +1 -0
- package/dist/core/polyphase/child-process.d.ts +65 -0
- package/dist/core/polyphase/child-process.d.ts.map +1 -0
- package/dist/core/polyphase/child-process.js +361 -0
- package/dist/core/polyphase/child-process.js.map +1 -0
- package/dist/core/polyphase/commands.d.ts +44 -0
- package/dist/core/polyphase/commands.d.ts.map +1 -0
- package/dist/core/polyphase/commands.js +244 -0
- package/dist/core/polyphase/commands.js.map +1 -0
- package/dist/core/polyphase/details.d.ts +40 -0
- package/dist/core/polyphase/details.d.ts.map +1 -0
- package/dist/core/polyphase/details.js +538 -0
- package/dist/core/polyphase/details.js.map +1 -0
- package/dist/core/polyphase/emitter.d.ts +20 -0
- package/dist/core/polyphase/emitter.d.ts.map +1 -0
- package/dist/core/polyphase/emitter.js +90 -0
- package/dist/core/polyphase/emitter.js.map +1 -0
- package/dist/core/polyphase/jsonl-reader.d.ts +31 -0
- package/dist/core/polyphase/jsonl-reader.d.ts.map +1 -0
- package/dist/core/polyphase/jsonl-reader.js +161 -0
- package/dist/core/polyphase/jsonl-reader.js.map +1 -0
- package/dist/core/polyphase/keyword.d.ts +27 -0
- package/dist/core/polyphase/keyword.d.ts.map +1 -0
- package/dist/core/polyphase/keyword.js +97 -0
- package/dist/core/polyphase/keyword.js.map +1 -0
- package/dist/core/polyphase/limiter.d.ts +38 -0
- package/dist/core/polyphase/limiter.d.ts.map +1 -0
- package/dist/core/polyphase/limiter.js +129 -0
- package/dist/core/polyphase/limiter.js.map +1 -0
- package/dist/core/polyphase/model-selection.d.ts +35 -0
- package/dist/core/polyphase/model-selection.d.ts.map +1 -0
- package/dist/core/polyphase/model-selection.js +72 -0
- package/dist/core/polyphase/model-selection.js.map +1 -0
- package/dist/core/polyphase/render/format.d.ts +52 -0
- package/dist/core/polyphase/render/format.d.ts.map +1 -0
- package/dist/core/polyphase/render/format.js +169 -0
- package/dist/core/polyphase/render/format.js.map +1 -0
- package/dist/core/polyphase/render/renderers.d.ts +63 -0
- package/dist/core/polyphase/render/renderers.d.ts.map +1 -0
- package/dist/core/polyphase/render/renderers.js +277 -0
- package/dist/core/polyphase/render/renderers.js.map +1 -0
- package/dist/core/polyphase/render/run-block.d.ts +45 -0
- package/dist/core/polyphase/render/run-block.d.ts.map +1 -0
- package/dist/core/polyphase/render/run-block.js +843 -0
- package/dist/core/polyphase/render/run-block.js.map +1 -0
- package/dist/core/polyphase/render/snapshot.d.ts +106 -0
- package/dist/core/polyphase/render/snapshot.d.ts.map +1 -0
- package/dist/core/polyphase/render/snapshot.js +292 -0
- package/dist/core/polyphase/render/snapshot.js.map +1 -0
- package/dist/core/polyphase/result-text.d.ts +41 -0
- package/dist/core/polyphase/result-text.d.ts.map +1 -0
- package/dist/core/polyphase/result-text.js +326 -0
- package/dist/core/polyphase/result-text.js.map +1 -0
- package/dist/core/polyphase/session.d.ts +33 -0
- package/dist/core/polyphase/session.d.ts.map +1 -0
- package/dist/core/polyphase/session.js +106 -0
- package/dist/core/polyphase/session.js.map +1 -0
- package/dist/core/polyphase/settings.d.ts +18 -0
- package/dist/core/polyphase/settings.d.ts.map +1 -0
- package/dist/core/polyphase/settings.js +93 -0
- package/dist/core/polyphase/settings.js.map +1 -0
- package/dist/core/polyphase/store.d.ts +197 -0
- package/dist/core/polyphase/store.d.ts.map +1 -0
- package/dist/core/polyphase/store.js +558 -0
- package/dist/core/polyphase/store.js.map +1 -0
- package/dist/core/polyphase/types.d.ts +371 -0
- package/dist/core/polyphase/types.d.ts.map +1 -0
- package/dist/core/polyphase/types.js +36 -0
- package/dist/core/polyphase/types.js.map +1 -0
- package/dist/core/polyphase/ui/controller.d.ts +28 -0
- package/dist/core/polyphase/ui/controller.d.ts.map +1 -0
- package/dist/core/polyphase/ui/controller.js +150 -0
- package/dist/core/polyphase/ui/controller.js.map +1 -0
- package/dist/core/polyphase/ui/dock.d.ts +27 -0
- package/dist/core/polyphase/ui/dock.d.ts.map +1 -0
- package/dist/core/polyphase/ui/dock.js +121 -0
- package/dist/core/polyphase/ui/dock.js.map +1 -0
- package/dist/core/polyphase/ui/inspector.d.ts +117 -0
- package/dist/core/polyphase/ui/inspector.d.ts.map +1 -0
- package/dist/core/polyphase/ui/inspector.js +1016 -0
- package/dist/core/polyphase/ui/inspector.js.map +1 -0
- package/dist/core/polyphase/ui/transcript-layout.d.ts +55 -0
- package/dist/core/polyphase/ui/transcript-layout.d.ts.map +1 -0
- package/dist/core/polyphase/ui/transcript-layout.js +210 -0
- package/dist/core/polyphase/ui/transcript-layout.js.map +1 -0
- package/dist/core/polyphase/update-pump.d.ts +18 -0
- package/dist/core/polyphase/update-pump.d.ts.map +1 -0
- package/dist/core/polyphase/update-pump.js +132 -0
- package/dist/core/polyphase/update-pump.js.map +1 -0
- package/dist/core/polyphase/workflow/agent-host.d.ts +26 -0
- package/dist/core/polyphase/workflow/agent-host.d.ts.map +1 -0
- package/dist/core/polyphase/workflow/agent-host.js +187 -0
- package/dist/core/polyphase/workflow/agent-host.js.map +1 -0
- package/dist/core/polyphase/workflow/guidance.d.ts +19 -0
- package/dist/core/polyphase/workflow/guidance.d.ts.map +1 -0
- package/dist/core/polyphase/workflow/guidance.js +119 -0
- package/dist/core/polyphase/workflow/guidance.js.map +1 -0
- package/dist/core/polyphase/workflow/launch.d.ts +41 -0
- package/dist/core/polyphase/workflow/launch.d.ts.map +1 -0
- package/dist/core/polyphase/workflow/launch.js +173 -0
- package/dist/core/polyphase/workflow/launch.js.map +1 -0
- package/dist/core/polyphase/workflow/meta.d.ts +43 -0
- package/dist/core/polyphase/workflow/meta.d.ts.map +1 -0
- package/dist/core/polyphase/workflow/meta.js +529 -0
- package/dist/core/polyphase/workflow/meta.js.map +1 -0
- package/dist/core/polyphase/workflow/prelude.d.ts +24 -0
- package/dist/core/polyphase/workflow/prelude.d.ts.map +1 -0
- package/dist/core/polyphase/workflow/prelude.js +93 -0
- package/dist/core/polyphase/workflow/prelude.js.map +1 -0
- package/dist/core/polyphase/workflow/runtime.d.ts +79 -0
- package/dist/core/polyphase/workflow/runtime.d.ts.map +1 -0
- package/dist/core/polyphase/workflow/runtime.js +217 -0
- package/dist/core/polyphase/workflow/runtime.js.map +1 -0
- package/dist/core/polyphase/workflow/runtime.lazy.d.ts +3 -0
- package/dist/core/polyphase/workflow/runtime.lazy.d.ts.map +1 -0
- package/dist/core/polyphase/workflow/runtime.lazy.js +3 -0
- package/dist/core/polyphase/workflow/runtime.lazy.js.map +1 -0
- package/dist/core/polyphase/workflow/saved.d.ts +55 -0
- package/dist/core/polyphase/workflow/saved.d.ts.map +1 -0
- package/dist/core/polyphase/workflow/saved.js +299 -0
- package/dist/core/polyphase/workflow/saved.js.map +1 -0
- package/dist/core/polyphase/workflow/structured-output.d.ts +22 -0
- package/dist/core/polyphase/workflow/structured-output.d.ts.map +1 -0
- package/dist/core/polyphase/workflow/structured-output.js +66 -0
- package/dist/core/polyphase/workflow/structured-output.js.map +1 -0
- package/dist/core/polyphase/workflow/tool.d.ts +24 -0
- package/dist/core/polyphase/workflow/tool.d.ts.map +1 -0
- package/dist/core/polyphase/workflow/tool.js +139 -0
- package/dist/core/polyphase/workflow/tool.js.map +1 -0
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +27 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/socket-server/permission-relay.js +4 -0
- package/dist/core/socket-server/permission-relay.js.map +1 -1
- package/dist/core/trust-manager.d.ts +3 -2
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +5 -2
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/experimental/micro/runtime.js +1 -1
- package/dist/experimental/micro/runtime.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +7 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +18 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +11 -2
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +9 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/prompts/commands/orchestrate.md +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +7 -1
- package/dist/utils/shell.js.map +1 -1
- package/docs/docs.json +4 -0
- package/docs/duet.md +3 -3
- package/docs/environment-variables.md +11 -0
- package/docs/json.md +7 -0
- package/docs/keybindings.md +20 -0
- package/docs/polyphase.md +391 -0
- package/docs/rpc-commands.md +9 -9
- package/docs/settings.md +12 -0
- package/docs/virtual-models.md +3 -3
- package/examples/extensions/preset.ts +3 -3
- package/examples/extensions/subagent/README.md +1 -1
- package/examples/extensions/subagent/agents/planner.md +1 -1
- package/examples/extensions/subagent/agents/reviewer.md +1 -1
- package/examples/extensions/subagent/agents/scout.md +1 -1
- package/examples/extensions/subagent/agents/worker.md +1 -1
- package/examples/extensions/summarize.ts +3 -3
- package/examples/sdk/02-custom-model.ts +1 -1
- package/examples/sdk/12-full-control.ts +1 -1
- package/examples/sdk/README.md +1 -1
- package/package.json +10 -10
- package/prompts/commands/orchestrate.md +1 -1
- package/dist/bundle/chunks/chunk-CEJJ5XF2.js +0 -170
- package/dist/bundle/chunks/execute-VCYDHEYA.js +0 -328
- package/dist/bundle/chunks/virtual-modules-JTCGDL2Z.js +0 -2
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
# Orchestrate agents with polyphase
|
|
2
|
+
|
|
3
|
+
Polyphase gives you live oversight of every agent draht fans out: `subagent` calls (single,
|
|
4
|
+
parallel, or chain) and model-written `workflow` scripts. In the TUI you get a live line per agent
|
|
5
|
+
in the tool row, a one-line dock above the editor, and a popup inspector (`alt+a`). Outside the
|
|
6
|
+
TUI, you get the same final text and bounded structured results, without the live views. Duet
|
|
7
|
+
triage (`duet_delegate`) shares the dock, the inspector, and the concurrency limiter, but keeps its
|
|
8
|
+
own, unrelated tool row.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
A `subagent` call, a duet triage batch, or a `workflow` script all spawn one child `draht` process
|
|
13
|
+
per agent, each running `--mode json -p --no-session`. Polyphase parses that child's JSON event
|
|
14
|
+
stream into live state (model, activity, transcript, usage, tool calls), coalesces updates through
|
|
15
|
+
one timer per session, and renders them into the dock and the inspector; `subagent` and `workflow`
|
|
16
|
+
calls additionally render into the tool row. All of this state is session-scoped: it is created on
|
|
17
|
+
first use and disposed when the session shuts down, so attached or multiplexed sessions never
|
|
18
|
+
share it.
|
|
19
|
+
|
|
20
|
+
The `subagent` tool, `duet_delegate` triage, and the `workflow` tool share one child-process
|
|
21
|
+
runner, one per-session concurrency limiter, and one live-view store feeding the dock and the
|
|
22
|
+
inspector. `duet_delegate` keeps its own tool-row renderer and result format — see
|
|
23
|
+
[Tool rows](#tool-rows).
|
|
24
|
+
|
|
25
|
+
## Tool rows
|
|
26
|
+
|
|
27
|
+
Each subagent or workflow tool call renders as a block in the transcript, one line per agent.
|
|
28
|
+
`duet_delegate` is not covered by this section: it renders its own, unchanged tool-row block (a
|
|
29
|
+
partial result shows only a `N/M teammates active` status; the finished result is plain text).
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
subagent parallel · 3 agents
|
|
33
|
+
◐ 1 running · ✓ 1 done · ◌ 1 queued (4/4 slots busy) 0:42 · 12.3k tok · $0.08
|
|
34
|
+
✓ investigator claude-sonnet-5 high 0:31 STATUS: DONE — 3 candidate files
|
|
35
|
+
◐ reviewer#1 claude-sonnet-5 high 0:12 thinking · The refresh path calls…
|
|
36
|
+
◌ reviewer#2 claude-sonnet-5 high queued
|
|
37
|
+
alt+a inspect agents · ctrl+o expand
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- **Glyphs:** `◐`/`◓`/`◑`/`◒` spinner or `●` (running), `◌` (queued), `·` (pending), `✓` (done),
|
|
41
|
+
`✗` (failed), `⊘` (cancelled), `–` (skipped), `⚠` (blocked tool call).
|
|
42
|
+
- **Only the focus row animates.** The focus row is the newest running tool-origin `subagent` or
|
|
43
|
+
`workflow` run. Every other row shows a static `●` glyph with no elapsed time, no live tokens,
|
|
44
|
+
and no "what it's doing now" text, so scrolling past a background run never forces a full
|
|
45
|
+
terminal redraw.
|
|
46
|
+
- **Expand/collapse** with `app.tools.expand` (`ctrl+o`, the existing key). The expanded view adds
|
|
47
|
+
per-agent task text, tool-call counts, and either the live transcript tail (thinking/text/tool
|
|
48
|
+
items) or, once finished, a head+tail preview of the output (up to 10 lines; longer output shows
|
|
49
|
+
the first 3 lines, an `… N lines omitted …` marker, and the last 6).
|
|
50
|
+
- **Chain** rows show one line per step with step numbers; not-yet-reached steps read
|
|
51
|
+
`waits for step N` and skipped steps read `not run`.
|
|
52
|
+
- **Workflow** rows show a phase tree instead of a flat agent list: one line per phase with a
|
|
53
|
+
`done/total` tally and elapsed time, the active phase's agents indented, the last `log(...)` line
|
|
54
|
+
prefixed `»`, and, once finished, the returned value prefixed `→`.
|
|
55
|
+
- **Resumed sessions** (after `/resume`, a crash, or a fork) render the final block from the
|
|
56
|
+
persisted `details` only — see [Non-TUI behavior and the details schema](#non-tui-behavior-and-the-details-schema).
|
|
57
|
+
Old sessions recorded before polyphase existed fall back to a legacy renderer.
|
|
58
|
+
|
|
59
|
+
## The dock
|
|
60
|
+
|
|
61
|
+
While any run is active, a one-line widget appears above the editor (`polyphase.dock`, default
|
|
62
|
+
on):
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
◐ polyphase · 2 runs · 3 running · 1 queued · 6 done · 1 failed · $0.69 · alt+a inspect
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
A running workflow started from a slash command (`/<name>` or `/workflow <name>`) additionally
|
|
69
|
+
shows its compact phase tree under the summary line, capped at 10 lines total for the whole dock.
|
|
70
|
+
The dock disappears again once nothing is running, and is skipped entirely when
|
|
71
|
+
`polyphase.dock` is `false` or there is no TUI (print, JSON, RPC).
|
|
72
|
+
|
|
73
|
+
## The agent inspector
|
|
74
|
+
|
|
75
|
+
Press `app.polyphase.inspector` (default `alt+a`) to open a full-screen overlay listing runs and
|
|
76
|
+
agents, and to follow any agent's live thinking, text, and tool calls. A second press — or
|
|
77
|
+
`escape` — closes it; `escape` from a detail or run view instead steps back one level.
|
|
78
|
+
|
|
79
|
+
### Views
|
|
80
|
+
|
|
81
|
+
- **Runs** — live runs, runs finished earlier in this session (recovered from the transcript),
|
|
82
|
+
and saved workflows; `enter` on a saved workflow inserts its run command (`/<name> ` or
|
|
83
|
+
`/workflow <name> `) into the editor and closes the inspector. Opens automatically when there
|
|
84
|
+
is no exactly-one live run, or on `/workflows`.
|
|
85
|
+
- **Run** — phase-grouped for workflows, a flat numbered list of steps for chains, a flat list of
|
|
86
|
+
agents otherwise. Opens automatically when exactly one run is live, with its first running
|
|
87
|
+
agent selected.
|
|
88
|
+
- **Agent detail** — the live transcript tail for one agent: tool calls with status and duration,
|
|
89
|
+
thinking and text, and a footer showing `◆ following` or `‖ paused · f to follow`.
|
|
90
|
+
- **Split view** — at 120 columns or more, the run view's agent list (left, 40 columns) and the
|
|
91
|
+
selected agent's detail (right) render side by side; `enter` switches to the full-width detail.
|
|
92
|
+
|
|
93
|
+
Archived (no-longer-live) runs render from their persisted summary only, with the note
|
|
94
|
+
"Live transcript is only kept while the run is in memory."
|
|
95
|
+
|
|
96
|
+
### Keys
|
|
97
|
+
|
|
98
|
+
All keys are configurable bindings (see [Keybindings Reference](keybindings.md)); none are
|
|
99
|
+
hardcoded.
|
|
100
|
+
|
|
101
|
+
| Action | Binding id | Default |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| Open / close the inspector | `app.polyphase.inspector` | `alt+a` |
|
|
104
|
+
| Move selection | `tui.select.up` / `tui.select.down` | up / down |
|
|
105
|
+
| Page | `tui.select.pageUp` / `tui.select.pageDown` | pageUp / pageDown |
|
|
106
|
+
| Open / drill in | `tui.select.confirm` | enter |
|
|
107
|
+
| Back / close | `tui.select.cancel` | escape, ctrl+c |
|
|
108
|
+
| Next / previous agent | `app.polyphase.nextAgent` / `app.polyphase.previousAgent` | tab / shift+tab |
|
|
109
|
+
| Toggle follow (detail view) | `app.polyphase.follow` | f |
|
|
110
|
+
| Cancel the selected agent | `app.polyphase.cancelAgent` | x |
|
|
111
|
+
| Cancel the selected run | `app.polyphase.cancelRun` | shift+x |
|
|
112
|
+
| Show / hide thinking | `app.thinking.toggle` (reused) | ctrl+t |
|
|
113
|
+
| Show / hide tool-result previews | `app.tools.expand` (reused) | ctrl+o |
|
|
114
|
+
|
|
115
|
+
Opening the inspector over an active permission or confirmation dialog is suppressed, so `alt+a`
|
|
116
|
+
never hides a prompt you still need to answer; conversely, the inspector closes itself right
|
|
117
|
+
before such a dialog opens, so it is never left covering one.
|
|
118
|
+
|
|
119
|
+
### Cancel semantics
|
|
120
|
+
|
|
121
|
+
Cancelling takes two presses of the same key, with no timer: the first press arms it and the
|
|
122
|
+
footer shows a `press the same key again to cancel <label>` (or `... to cancel the run`) prompt;
|
|
123
|
+
any other key disarms it; a second press of the same key confirms. Pressing cancel on an agent
|
|
124
|
+
that has already finished shows `already finished` and does not arm.
|
|
125
|
+
|
|
126
|
+
Cancelling an agent inside a running `workflow` script makes its `agent()` call return `null` to
|
|
127
|
+
the script (the script sees it exactly like a failed or budget-exhausted call — check for `null`).
|
|
128
|
+
Cancelling a run cancels every unfinished agent in it and stops the run.
|
|
129
|
+
|
|
130
|
+
## Model inheritance and per-task overrides
|
|
131
|
+
|
|
132
|
+
Model and thinking level for a child agent are resolved in this order, first match wins:
|
|
133
|
+
|
|
134
|
+
1. An explicit `model` (and `thinking`/`effort`) on the call itself — the `subagent` tool's
|
|
135
|
+
per-task `model`/`thinking` fields, or `agent(prompt, { model, effort })` in a workflow script.
|
|
136
|
+
2. A workflow phase's `model` from `meta.phases[n].model`.
|
|
137
|
+
3. The agent type's frontmatter `model:`, passed through to the child verbatim (so an invalid
|
|
138
|
+
pattern is still diagnosed by the child, as before).
|
|
139
|
+
4. The parent session's current model and thinking level ("inherited"). Subagents without an
|
|
140
|
+
explicit or frontmatter model now inherit the parent's model and thinking level, instead of
|
|
141
|
+
falling back to the child's own default.
|
|
142
|
+
5. The child's own default model, when nothing above resolved to a usable model.
|
|
143
|
+
|
|
144
|
+
When an inherited model turns out to be one the child process cannot resolve on its own (an
|
|
145
|
+
extension-registered or virtual model that only exists in the parent), the runner retries once
|
|
146
|
+
without `--model`/`--thinking` and the row shows `default model` instead. This fallback only
|
|
147
|
+
applies to inherited models; an invalid explicit override or frontmatter model is reported as a
|
|
148
|
+
failure, not silently swapped.
|
|
149
|
+
|
|
150
|
+
Model labels: collapsed rows show `id thinking` (e.g. `claude-sonnet-5 high`); expanded rows show
|
|
151
|
+
`provider/id thinking (source)`, with `(source)` shown only for `inherited` and `child-default`.
|
|
152
|
+
|
|
153
|
+
## Parent-model results
|
|
154
|
+
|
|
155
|
+
When a `subagent` or `workflow` tool call finishes, the text returned to the parent model is
|
|
156
|
+
capped and shaped so it stays informative without flooding context:
|
|
157
|
+
|
|
158
|
+
- **Single mode:** the full output, head+tail capped at 50,000 characters, keeping the last
|
|
159
|
+
`STATUS:` line even when the tail cut would otherwise drop it. A failure instead shows
|
|
160
|
+
`FAILED (exit 1, model <provider/id>)` with an 8,000-character output cap and the last 2,000
|
|
161
|
+
characters of stderr. A cancellation shows `CANCELLED by <reason> after <elapsed>` plus any
|
|
162
|
+
partial output.
|
|
163
|
+
- **Parallel mode:** a summary line (`Parallel: 2/3 succeeded, 1 failed`), then one block per
|
|
164
|
+
agent with its status, model, and elapsed time, and a per-agent output cap that divides a
|
|
165
|
+
shared budget (`polyphase.resultChars`, default 64,000) across all agents (2,000-16,000
|
|
166
|
+
characters per agent). Failed agents' blocks include a stderr tail.
|
|
167
|
+
- **Chain mode:** one status line per step, then the last step's output (50,000-character cap),
|
|
168
|
+
or — on failure or cancellation — `Chain failed|cancelled at step k (<label>)` with that step's
|
|
169
|
+
output and stderr.
|
|
170
|
+
- **Workflow:** a header line (status, agent counts, elapsed, tokens, cost), a `Phases:` tally,
|
|
171
|
+
the returned value as pretty JSON (or text) capped at 32,000 characters, the last 30 `log(...)`
|
|
172
|
+
lines, up to 8,000 characters of console output, and up to 100 per-agent summary lines, followed
|
|
173
|
+
by any budget notice, script error (with its source line), and blocked-call note.
|
|
174
|
+
|
|
175
|
+
Every mode appends, when applicable, a note about tool calls blocked inside subagents — see
|
|
176
|
+
[Permissions](#permissions) below.
|
|
177
|
+
|
|
178
|
+
Tokens and cost shown anywhere in polyphase (rows, dock, inspector, result text) are *billable*
|
|
179
|
+
tokens: input + output + cache-write tokens, excluding cache reads. The same measure drives token
|
|
180
|
+
budgets. Cost is shown in USD (`usage.cost.total`) but is never itself budgeted.
|
|
181
|
+
|
|
182
|
+
## Workflows
|
|
183
|
+
|
|
184
|
+
A workflow is a script the model writes (or you save to a file) that orchestrates one or more
|
|
185
|
+
subagents through a multi-phase task, with the same live oversight as a `subagent` call.
|
|
186
|
+
|
|
187
|
+
### The keyword
|
|
188
|
+
|
|
189
|
+
The `workflow` tool is not registered by default. Saying the configured keyword (default
|
|
190
|
+
`polyphase`, `polyphase.keyword`) anywhere in a prompt enables it for that prompt: draht registers
|
|
191
|
+
the tool, activates it, and — whenever the authoring guide is not already in context (the first
|
|
192
|
+
time, and again after each compaction) — sends the model a one-line visible message
|
|
193
|
+
(`◆ polyphase · workflow tool enabled · authoring guide sent to the model`, expandable to the full
|
|
194
|
+
script-authoring guide) so the model knows the API without a system-prompt change. The tool
|
|
195
|
+
deactivates again once the agent settles, unless it was activated some other way. An input
|
|
196
|
+
starting with `/` or `!` never triggers the keyword. Set `polyphase.workflowTool` to `"always"` to
|
|
197
|
+
keep it active for the whole session, or `"off"` to disable the keyword entirely (saved-workflow
|
|
198
|
+
commands still work either way).
|
|
199
|
+
|
|
200
|
+
### The script API
|
|
201
|
+
|
|
202
|
+
A workflow script is plain JavaScript with no imports, no filesystem access, and no network access
|
|
203
|
+
of its own — all real work happens inside the subagents it starts with `agent()`. It must start
|
|
204
|
+
with a `meta` block written as a pure literal (no identifiers, function calls, spreads, computed
|
|
205
|
+
keys, template interpolation, or regex literals):
|
|
206
|
+
|
|
207
|
+
```js
|
|
208
|
+
export const meta = {
|
|
209
|
+
name: "review-pr", // ^[a-z][a-z0-9-]{0,47}$, used for /review-pr if saved
|
|
210
|
+
description: "Review a change in parallel and synthesize findings", // 1-300 chars
|
|
211
|
+
whenToUse: "...", // optional, <= 300 chars
|
|
212
|
+
phases: [ // 1-20 entries
|
|
213
|
+
{ title: "Scan" },
|
|
214
|
+
{ title: "Review" },
|
|
215
|
+
{ title: "Synthesize", model: "anthropic/claude-opus-5-5" }, // optional per-phase model
|
|
216
|
+
],
|
|
217
|
+
};
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Unknown keys in `meta` are ignored, not errors. Validation errors report the exact field path
|
|
221
|
+
(e.g. `meta.phases[2].title`) and a 1-based line and column.
|
|
222
|
+
|
|
223
|
+
The async body after `meta` uses:
|
|
224
|
+
|
|
225
|
+
- `agent(prompt, opts)` — starts one subagent and returns its final text, or (with `opts.schema`
|
|
226
|
+
set) the schema-validated object. Returns `null` when the agent failed, was cancelled (by the
|
|
227
|
+
user or the token budget), the budget was already exhausted, or produced no valid structured
|
|
228
|
+
output when a schema was requested — always check for `null`. Throws for invalid options, an
|
|
229
|
+
unknown `agentType`/model, an invalid `effort`, or the per-run agent cap.
|
|
230
|
+
`opts`: `{ label, phase, schema, model, effort, isolation: "worktree", agentType }`.
|
|
231
|
+
- `parallel(thunks)` — runs an array of zero-argument thunks (each should call `agent()`) and
|
|
232
|
+
waits for all of them (a barrier). A throwing thunk becomes `null` in the result array, with a
|
|
233
|
+
warning logged. `parallel()` itself throws for invalid arguments: a non-array, a non-function
|
|
234
|
+
item, or more items than `polyphase.maxItemsPerCall`.
|
|
235
|
+
- `pipeline(items, ...stages)` — runs every item through the same stages in sequence, with **no**
|
|
236
|
+
barrier between stages: each stage `(prev, item, index)` receives the previous stage's result
|
|
237
|
+
(or the item itself for the first stage). A throwing stage makes that item `null` and skips its
|
|
238
|
+
later stages for that item only — other items keep advancing.
|
|
239
|
+
- `phase(title)` — groups the agents started after it under that phase for the live view. A title
|
|
240
|
+
not declared in `meta.phases` becomes a dynamic phase (logged once).
|
|
241
|
+
- `log(...parts)` — writes a narrator line visible in the dock and inspector.
|
|
242
|
+
- `args` — the verbatim string passed to this call (or to `/<name> ...`).
|
|
243
|
+
- `meta` — the frozen meta object, readable in the body.
|
|
244
|
+
- `budget` — `{ total, spent(), remaining() }`; `spent()` is this run's total billable tokens as
|
|
245
|
+
of the latest `agent()` reply.
|
|
246
|
+
|
|
247
|
+
Reserved names that a script must never redeclare: `agent`, `parallel`, `pipeline`, `phase`,
|
|
248
|
+
`log`, `args`, `budget`, `meta`.
|
|
249
|
+
|
|
250
|
+
### Determinism
|
|
251
|
+
|
|
252
|
+
The orchestrating script itself must be deterministic: `Math.random`, `Date.now()`, `Date()`,
|
|
253
|
+
`new Date()`, and `performance.now` all throw. `new Date(value)` still works. Non-determinism
|
|
254
|
+
inside an `agent()` call is fine — only the script around it is restricted.
|
|
255
|
+
|
|
256
|
+
### Caps and budget
|
|
257
|
+
|
|
258
|
+
- Up to `polyphase.maxAgentsPerRun` (default 200) `agent()` calls per run.
|
|
259
|
+
- Up to `polyphase.maxItemsPerCall` (default 1,024) items per `parallel()`/`pipeline()` call.
|
|
260
|
+
- Up to `polyphase.maxConcurrency` (default `clamp(cpuCount - 2, 2, 8)`) child processes running
|
|
261
|
+
at once across the whole session — shared with `subagent` and duet triage, so a workflow and a
|
|
262
|
+
concurrent `subagent` call compete for the same slots.
|
|
263
|
+
- A token budget (`budgetTokens` on the tool call, or `polyphase.defaultBudgetTokens`) is counted
|
|
264
|
+
in billable tokens. Once spent tokens reach the budget, every unfinished agent in the run is
|
|
265
|
+
cancelled and `agent()` starts returning `null`; a warning is logged once. Because output tokens
|
|
266
|
+
for an in-flight response often only arrive at that response's end, the actual spend can
|
|
267
|
+
overshoot the budget by up to one response per agent that was running at the moment the budget
|
|
268
|
+
was reached — this is a bound, not a guarantee of an exact stop.
|
|
269
|
+
- A workflow cannot start another workflow, and a workflow's agents are excluded from the
|
|
270
|
+
`duet_delegate` tool. See [Nesting depth](#nesting-depth).
|
|
271
|
+
- `polyphase.workflowTimeoutMs` (default `0`, no deadline) is a wall-clock deadline over the
|
|
272
|
+
whole run, including time spent waiting on `agent()` calls. On expiry the script fails with a
|
|
273
|
+
timeout and every agent still in flight is cancelled.
|
|
274
|
+
|
|
275
|
+
### Structured output
|
|
276
|
+
|
|
277
|
+
Set `opts.schema` on an `agent()` call to get a schema-validated object back instead of raw text.
|
|
278
|
+
Under the hood, the child process is told to call the `polyphase_result` tool (registered only in
|
|
279
|
+
that child, only for that call) with arguments matching the schema; its arguments are validated
|
|
280
|
+
against the schema back in the parent, and the validated value — unwrapped from a `{ value: ... }`
|
|
281
|
+
wrapper when the schema's root type isn't `object` — becomes `agent()`'s return value. The child
|
|
282
|
+
is instructed to call `polyphase_result` exactly once, as its last action; anything it says
|
|
283
|
+
afterward is not seen by the script. An agent that never calls it, or calls it with arguments that
|
|
284
|
+
fail validation, makes `agent()` return `null` and logs a notice.
|
|
285
|
+
|
|
286
|
+
## Saved workflows
|
|
287
|
+
|
|
288
|
+
A workflow saved as a `.js` file can be run directly with `/<name> [args]` or
|
|
289
|
+
`/workflow <name> [args]`, without the model writing it first.
|
|
290
|
+
|
|
291
|
+
- **Locations:** project workflows live in `.draht/workflows/*.js` (nearest ancestor directory,
|
|
292
|
+
only when the project is trusted — see [Permissions](#permissions)); user workflows live in
|
|
293
|
+
`<agent-dir>/workflows/*.js` (`~/.draht/agent/workflows` by default). A project workflow with the
|
|
294
|
+
same name overrides a user workflow of that name.
|
|
295
|
+
- **Naming:** the file's basename (without `.js`) must match the same pattern as `meta.name`
|
|
296
|
+
(`^[a-z][a-z0-9-]{0,47}$`); a file that doesn't is skipped with a warning. If `meta.name` doesn't
|
|
297
|
+
match the basename, the basename still wins, with an informational note.
|
|
298
|
+
- **Size:** files over 256 KiB are skipped.
|
|
299
|
+
- **Collisions.** `/<name>` is not registered when `<name>` collides with a built-in command, an
|
|
300
|
+
extension command or prompt template, a skill (`skill:<name>`), or a reserved polyphase name
|
|
301
|
+
(`workflow`, `workflows`, `polyphase`); the workflow is still runnable through
|
|
302
|
+
`/workflow <name>`, and one aggregated warning names every skipped workflow and its conflict.
|
|
303
|
+
- **`/workflow [name] [args]`** with no name opens a picker (TUI) or lists saved workflows and
|
|
304
|
+
diagnostics (non-TUI); choosing "Describe a new workflow…" fills the editor with the keyword so
|
|
305
|
+
the model can write one.
|
|
306
|
+
- **`/workflows [list]`** opens the inspector's runs view (TUI, no `list` argument) or lists live
|
|
307
|
+
and archived runs plus saved workflows as plain text.
|
|
308
|
+
|
|
309
|
+
### Command-run results
|
|
310
|
+
|
|
311
|
+
A workflow started from `/<name>` or `/workflow` is **host-side**: it runs independently of any
|
|
312
|
+
agent turn, is cancelled only from the inspector or on session shutdown, and never blocks on the
|
|
313
|
+
model. When it finishes, its result is appended to the conversation as a custom message (visible
|
|
314
|
+
in the transcript and to the model on its next turn) **without triggering a new model turn or
|
|
315
|
+
spending a paid request** — the model only sees it if and when it is prompted again.
|
|
316
|
+
|
|
317
|
+
In print mode, the same custom message is recorded, but nothing from it is written to the
|
|
318
|
+
process's stdout output: the final text a `draht -p` invocation prints is the model's own last
|
|
319
|
+
response, not a background command-run result that may finish after (or without) a model turn.
|
|
320
|
+
|
|
321
|
+
Command-run token and dollar cost are shown in the dock, the inspector, and the result message,
|
|
322
|
+
but are **not** added to the session footer's running totals (the footer has no API for an
|
|
323
|
+
extension to append usage outside a model turn).
|
|
324
|
+
|
|
325
|
+
## Permissions
|
|
326
|
+
|
|
327
|
+
Each `workflow` tool call and each `/<name>`/`/workflow` command run goes through the same
|
|
328
|
+
permission gate as every other tool call: an explicit `allow`/`deny` rule in `.draht/permissions.yml`
|
|
329
|
+
applies as written; otherwise the call needs approval, shown with the workflow's name, phases
|
|
330
|
+
(with any per-phase model), source, truncated args, and limits (concurrency, max agents, budget).
|
|
331
|
+
A `workflow` tool call with an invalid `meta` block still needs approval, but is described as such
|
|
332
|
+
and fails immediately once approved; a `/<name>`/`/workflow` command run instead rejects an
|
|
333
|
+
invalid `meta` block up front, before the gate. With no UI available (print or JSON, or any other
|
|
334
|
+
headless caller) and no matching rule, the call is blocked rather than left waiting; RPC mode has
|
|
335
|
+
a UI context, so it forwards the approval to the client as a `confirm` request instead.
|
|
336
|
+
|
|
337
|
+
Saved workflows under `.draht/workflows` require project trust, the same as `.draht/agents`: a
|
|
338
|
+
project that only contains a `workflows` directory under `.draht` still triggers the trust prompt,
|
|
339
|
+
because a saved workflow can start subagents just like a saved agent definition can.
|
|
340
|
+
|
|
341
|
+
**Blocked tool calls inside subagents.** A subagent process cannot show an approval prompt of its
|
|
342
|
+
own (there is no UI in a non-interactive child), so by default any of its tool calls that would
|
|
343
|
+
otherwise need approval are blocked instead, and surfaced with a warning line, a `⚠` glyph in the
|
|
344
|
+
row, and a note in the parent-model result text listing a few blocked samples. The note's own hint
|
|
345
|
+
names `/permissions auto` and `/yolo` as remedies, but typing either into the parent session only
|
|
346
|
+
changes that session's own permission mode — it never reaches an already-running or future
|
|
347
|
+
subagent, which reads its mode from the `DRAHT_PERMISSION_MODE` environment variable at startup
|
|
348
|
+
(inherited from whatever started the parent draht process; unset means `default`, the most
|
|
349
|
+
restrictive mode). The remedies that actually work are an explicit `allow` rule in
|
|
350
|
+
`permissions.yml`, or setting `DRAHT_PERMISSION_MODE` before launching draht.
|
|
351
|
+
|
|
352
|
+
## Nesting depth
|
|
353
|
+
|
|
354
|
+
`polyphase.maxDepth` (default 2) limits how many levels of subagent-starts-a-subagent are
|
|
355
|
+
possible: a child at that depth is spawned without the `subagent` tool at all, so it cannot start
|
|
356
|
+
grandchildren. Independently of depth, the `workflow` and `duet_delegate` tools are always
|
|
357
|
+
excluded from every child process — a subagent (or a workflow's agent) can never start a workflow
|
|
358
|
+
or a duet triage batch of its own, regardless of `maxDepth`.
|
|
359
|
+
|
|
360
|
+
## Non-TUI behavior and the details schema
|
|
361
|
+
|
|
362
|
+
Outside the TUI (print, JSON, RPC), there is no dock, no inspector, and no terminal-input
|
|
363
|
+
listener — polyphase's UI installer is inert in those modes. What still works:
|
|
364
|
+
|
|
365
|
+
- the keyword and `/workflow name` (and saved `/<name>` commands);
|
|
366
|
+
- `/workflows` as plain text instead of the inspector;
|
|
367
|
+
- the final parent-model result text (see [Parent-model results](#parent-model-results));
|
|
368
|
+
- in `json`/RPC-style streaming, `tool_execution_update` partial results carrying a short status
|
|
369
|
+
text (at most 20 lines of 120 characters) and the same bounded details object described below,
|
|
370
|
+
throttled to about once per second per run, with state transitions (an agent finishing, a tool
|
|
371
|
+
call getting blocked) emitted promptly instead of waiting out that interval.
|
|
372
|
+
|
|
373
|
+
**The persisted `details` schema.** Every `subagent` and `workflow` tool result, and every
|
|
374
|
+
command-run custom message, carries a `details` object with `v: 1`: a run summary (kind, status,
|
|
375
|
+
timing, phases for workflows), one entry per agent (model, status, token/cost totals, a bounded
|
|
376
|
+
output preview), and run totals. Final details are capped at 16 KiB; partial (in-progress)
|
|
377
|
+
details are capped at 8 KiB and additionally carry a `now` line per agent that final details omit.
|
|
378
|
+
When a run has far more agents or output than fits, successive levels of detail are dropped (long
|
|
379
|
+
agent output, then per-agent tool-call breakdowns, then low-priority agents entirely) rather than
|
|
380
|
+
truncating in a way that would hide a failure — failed, running, and queued agents are kept
|
|
381
|
+
preferentially over agents that finished cleanly. Resuming a session (`/resume`, a fork, or a
|
|
382
|
+
restart after a crash) rebuilds the final tool-row block from this persisted object only, so a
|
|
383
|
+
resumed row renders identically to how it looked when the run finished; sessions recorded before
|
|
384
|
+
polyphase existed have no (or an empty) `details` object and fall back to a legacy renderer.
|
|
385
|
+
|
|
386
|
+
## Settings and environment variables
|
|
387
|
+
|
|
388
|
+
All settings live under the `polyphase` key — see [Settings Reference](settings.md). The two
|
|
389
|
+
internal environment variables children use to coordinate with their parent
|
|
390
|
+
(`DRAHT_POLYPHASE_DEPTH`, `DRAHT_POLYPHASE_SCHEMA_FILE`) are listed in
|
|
391
|
+
[Environment Variables](environment-variables.md); you should not need to set either by hand.
|
package/docs/rpc-commands.md
CHANGED
|
@@ -212,7 +212,7 @@ Messages are `AgentMessage` objects (see [Message Types](message-types.md)).
|
|
|
212
212
|
Switch to a specific model.
|
|
213
213
|
|
|
214
214
|
```json
|
|
215
|
-
{"type": "set_model", "provider": "anthropic", "modelId": "claude-sonnet-
|
|
215
|
+
{"type": "set_model", "provider": "anthropic", "modelId": "claude-sonnet-5"}
|
|
216
216
|
```
|
|
217
217
|
|
|
218
218
|
Response contains the full [Model](#model-object) object:
|
|
@@ -839,20 +839,20 @@ Model commands return the complete configured model definition. Costs are in US
|
|
|
839
839
|
|
|
840
840
|
```json
|
|
841
841
|
{
|
|
842
|
-
"id": "claude-sonnet-
|
|
843
|
-
"name": "Claude Sonnet
|
|
842
|
+
"id": "claude-sonnet-5",
|
|
843
|
+
"name": "Claude Sonnet 5",
|
|
844
844
|
"api": "anthropic-messages",
|
|
845
845
|
"provider": "anthropic",
|
|
846
846
|
"baseUrl": "https://api.anthropic.com",
|
|
847
847
|
"reasoning": true,
|
|
848
848
|
"input": ["text", "image"],
|
|
849
|
-
"contextWindow":
|
|
850
|
-
"maxTokens":
|
|
849
|
+
"contextWindow": 1000000,
|
|
850
|
+
"maxTokens": 128000,
|
|
851
851
|
"cost": {
|
|
852
|
-
"input":
|
|
853
|
-
"output":
|
|
854
|
-
"cacheRead": 0.
|
|
855
|
-
"cacheWrite":
|
|
852
|
+
"input": 2.0,
|
|
853
|
+
"output": 10.0,
|
|
854
|
+
"cacheRead": 0.2,
|
|
855
|
+
"cacheWrite": 2.5
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
858
|
```
|
package/docs/settings.md
CHANGED
|
@@ -41,6 +41,18 @@ See [Choose a Model](models.md) for model selection and thinking controls.
|
|
|
41
41
|
| `defaultTools` | `string[]` | `read`, `bash`, `edit`, `write` | Tools enabled at startup. Plain names replace the defaults; `+name` adds a tool and `-name` removes one. An empty array disables all built-in tools but not extension or SDK tools. |
|
|
42
42
|
| `codemode.mode` | `"on"` \| `"only"` | `"on"` | How the `codemode` tool presents tools while it is active. `on`: declared tools get their `codemode` declaration appended to their description, and `codemode` lists only tools that are not declared. `only`: `codemode` lists every tool scripts can call, and active built-in and extension tools are hidden from the model, so it reaches them through `codemode`. |
|
|
43
43
|
| `codemode.inlineBudget` | number | `3000` | Estimated tokens (characters / 4) the `codemode` tool's description may spend on tool declarations. Tools that do not fit are left out and found with `searchTools()`. `0` lists only namespaces. |
|
|
44
|
+
| `polyphase.maxConcurrency` | number | `clamp(availableParallelism() - 2, 2, 8)` | Child agent processes at once across the session (`subagent`, `workflow`, duet). Range 1-16. |
|
|
45
|
+
| `polyphase.maxAgentsPerRun` | number | `200` | `agent()` calls allowed per workflow run. Range 1-1000. |
|
|
46
|
+
| `polyphase.maxItemsPerCall` | number | `1024` | Items allowed per `parallel()`/`pipeline()` call. Range 1-4096. |
|
|
47
|
+
| `polyphase.workflowTool` | `"keyword"` \| `"always"` \| `"off"` | `"keyword"` | When the `workflow` tool is available: on the keyword, always, or never. |
|
|
48
|
+
| `polyphase.keyword` | string | `"polyphase"` | Keyword that enables the `workflow` tool for one prompt. Must match `/^[A-Za-z][A-Za-z0-9_-]{2,31}$/`. |
|
|
49
|
+
| `polyphase.defaultBudgetTokens` | number | Unlimited | Token budget for workflow runs that set none. Minimum `1000`. |
|
|
50
|
+
| `polyphase.resultChars` | number | `64000` | Characters of agent output returned to the parent model for a parallel `subagent` call, split across agents (2,000-16,000 each). Single, chain, and `workflow` calls use fixed caps instead. Range 8000-400000. |
|
|
51
|
+
| `polyphase.dock` | boolean | `true` | Show the running-agents dock above the editor. |
|
|
52
|
+
| `polyphase.maxDepth` | number | `2` | Delegation depth. A child spawned at this depth gets no `subagent` tool. Range 1-4. |
|
|
53
|
+
| `polyphase.liveUpdateMs` | number | `250` | Live update interval for tool rows, in milliseconds. Range 100-2000. |
|
|
54
|
+
| `polyphase.retainRuns` | number | `20` | Finished runs kept in memory for the agent inspector. Range 1-100. |
|
|
55
|
+
| `polyphase.workflowTimeoutMs` | number | `0` | Wall-clock deadline for a workflow run, in milliseconds, including time spent waiting on agents. `0` means no deadline. |
|
|
44
56
|
|
|
45
57
|
Available built-in tools are `read`, `bash`, `powershell`, `edit`, `write`, `grep`, `find`, and `ls`. `defaultTools` can also name `codemode` and `tool_search`, which built-in extensions register inactive, and other extension tools registered inactive.
|
|
46
58
|
|
package/docs/virtual-models.md
CHANGED
|
@@ -10,7 +10,7 @@ A virtual model selects a model and a thinking level. A router maps that pair to
|
|
|
10
10
|
|
|
11
11
|
```
|
|
12
12
|
selected (virtual model, virtual level) -> dispatched (physical model, physical level)
|
|
13
|
-
jev/auto:low -> anthropic/claude-sonnet-
|
|
13
|
+
jev/auto:low -> anthropic/claude-sonnet-5:high
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
The virtual thinking level is an input to the router. Its meaning is up to the router; it need not correspond to a reasoning budget.
|
|
@@ -45,7 +45,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
45
45
|
if (request.reason !== "user" && sticky) {
|
|
46
46
|
return { model: sticky.model, thinkingLevel: sticky.thinkingLevel ?? "medium" };
|
|
47
47
|
}
|
|
48
|
-
const id = request.thinkingLevel === "high" ? "claude-sonnet-
|
|
48
|
+
const id = request.thinkingLevel === "high" ? "claude-sonnet-5" : "claude-haiku-4-5";
|
|
49
49
|
return { model: ctx.modelRegistry.find("anthropic", id)!, thinkingLevel: "medium" };
|
|
50
50
|
},
|
|
51
51
|
});
|
|
@@ -96,7 +96,7 @@ pi.registerVirtualModel<{ phase: "plan" | "build" }>({
|
|
|
96
96
|
name: "Phased",
|
|
97
97
|
route(request, ctx) {
|
|
98
98
|
const state = request.state ?? { phase: "plan" };
|
|
99
|
-
const id = state.phase === "plan" ? "claude-opus-
|
|
99
|
+
const id = state.phase === "plan" ? "claude-opus-5-5" : "claude-haiku-4-5";
|
|
100
100
|
return { model: ctx.modelRegistry.find("anthropic", id)!, thinkingLevel: "medium", state };
|
|
101
101
|
},
|
|
102
102
|
});
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
* {
|
|
15
15
|
* "plan": {
|
|
16
16
|
* "provider": "openai-codex",
|
|
17
|
-
* "model": "gpt-
|
|
17
|
+
* "model": "gpt-6.1-sol",
|
|
18
18
|
* "thinkingLevel": "high",
|
|
19
19
|
* "tools": ["read", "grep", "find", "ls"],
|
|
20
20
|
* "instructions": "You are in PLANNING MODE. Your job is to deeply understand the problem and create a detailed implementation plan.\n\nRules:\n- DO NOT make any changes. You cannot edit or write files.\n- Read files IN FULL (no offset/limit) to get complete context. Partial reads miss critical details.\n- Explore thoroughly: grep for related code, find similar patterns, understand the architecture.\n- Ask clarifying questions if requirements are ambiguous. Do not assume.\n- Identify risks, edge cases, and dependencies before proposing solutions.\n\nOutput:\n- Create a structured plan with numbered steps.\n- For each step: what to change, why, and potential risks.\n- List files that will be modified.\n- Note any tests that should be added or updated.\n\nWhen done, ask the user if they want you to:\n1. Write the plan to a markdown file (e.g., PLAN.md)\n2. Create a GitHub issue with the plan\n3. Proceed to implementation (they should switch to 'implement' preset)"
|
|
21
21
|
* },
|
|
22
22
|
* "implement": {
|
|
23
23
|
* "provider": "anthropic",
|
|
24
|
-
* "model": "claude-sonnet-
|
|
24
|
+
* "model": "claude-sonnet-5",
|
|
25
25
|
* "thinkingLevel": "high",
|
|
26
26
|
* "tools": ["read", "bash", "edit", "write"],
|
|
27
27
|
* "instructions": "You are in IMPLEMENTATION MODE. Your job is to make focused, correct changes.\n\nRules:\n- Keep scope tight. Do exactly what was asked, no more.\n- Read files before editing to understand current state.\n- Make surgical edits. Prefer edit over write for existing files.\n- Explain your reasoning briefly before each change.\n- Run tests or type checks after changes if the project has them (npm test, npm run check, etc.).\n- If you encounter unexpected complexity, STOP and explain the issue rather than hacking around it.\n\nIf no plan exists:\n- Ask clarifying questions before starting.\n- Propose what you'll do and get confirmation for non-trivial changes.\n\nAfter completing changes:\n- Summarize what was done.\n- Note any follow-up work or tests that should be added."
|
|
@@ -49,7 +49,7 @@ import { Container, Key, type SelectItem, SelectList, Text } from "@draht/tui";
|
|
|
49
49
|
interface Preset {
|
|
50
50
|
/** Provider name (e.g., "anthropic", "openai") */
|
|
51
51
|
provider?: string;
|
|
52
|
-
/** Model ID (e.g., "claude-sonnet-
|
|
52
|
+
/** Model ID (e.g., "claude-sonnet-5") */
|
|
53
53
|
model?: string;
|
|
54
54
|
/** Thinking level */
|
|
55
55
|
thinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
@@ -129,7 +129,7 @@ Agents are markdown files with YAML frontmatter:
|
|
|
129
129
|
name: my-agent
|
|
130
130
|
description: What this agent does
|
|
131
131
|
tools: read, grep, find, ls
|
|
132
|
-
model: claude-haiku-4-5
|
|
132
|
+
model: anthropic/claude-haiku-4-5
|
|
133
133
|
---
|
|
134
134
|
|
|
135
135
|
System prompt for the agent goes here.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: planner
|
|
3
3
|
description: Creates implementation plans from context and requirements
|
|
4
4
|
tools: read, grep, find, ls
|
|
5
|
-
model: claude-sonnet-
|
|
5
|
+
model: anthropic/claude-sonnet-5
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are a planning specialist. You receive context (from a scout) and requirements, then produce a clear implementation plan.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: reviewer
|
|
3
3
|
description: Code review specialist for quality and security analysis
|
|
4
4
|
tools: read, grep, find, ls, bash
|
|
5
|
-
model: claude-sonnet-
|
|
5
|
+
model: anthropic/claude-sonnet-5
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are a senior code reviewer. Analyze code for quality, security, and maintainability.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: scout
|
|
3
3
|
description: Fast codebase recon that returns compressed context for handoff to other agents
|
|
4
4
|
tools: read, grep, find, ls, bash
|
|
5
|
-
model: claude-haiku-4-5
|
|
5
|
+
model: anthropic/claude-haiku-4-5
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are a scout. Quickly investigate a codebase and return structured findings that another agent can use without re-reading everything.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: worker
|
|
3
3
|
description: General-purpose subagent with full capabilities, isolated context
|
|
4
|
-
model: claude-sonnet-
|
|
4
|
+
model: anthropic/claude-sonnet-5
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
You are a worker agent with full capabilities. You operate in an isolated context window to handle delegated tasks without polluting the main conversation.
|
|
@@ -160,13 +160,13 @@ export default function (pi: ExtensionAPI) {
|
|
|
160
160
|
ctx.ui.notify("Preparing summary...", "info");
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
const model = ctx.modelRegistry.find("openai", "gpt-
|
|
163
|
+
const model = ctx.modelRegistry.find("openai", "gpt-6.1-sol");
|
|
164
164
|
if (!model) {
|
|
165
|
-
if (ctx.hasUI) ctx.ui.notify("Model openai/gpt-
|
|
165
|
+
if (ctx.hasUI) ctx.ui.notify("Model openai/gpt-6.1-sol not found", "warning");
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
if (!ctx.modelRegistry.hasConfiguredAuth(model)) {
|
|
169
|
-
if (ctx.hasUI) ctx.ui.notify("No authentication configured for openai/gpt-
|
|
169
|
+
if (ctx.hasUI) ctx.ui.notify("No authentication configured for openai/gpt-6.1-sol", "warning");
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
172
|
|
|
@@ -9,7 +9,7 @@ import { createAgentSession, ModelRuntime } from "@draht/coding-agent";
|
|
|
9
9
|
const modelRuntime = await ModelRuntime.create();
|
|
10
10
|
|
|
11
11
|
// Option 1: Find a specific built-in model by provider/id
|
|
12
|
-
const opus = modelRuntime.getModel("anthropic", "claude-opus-
|
|
12
|
+
const opus = modelRuntime.getModel("anthropic", "claude-opus-5-5");
|
|
13
13
|
if (opus) {
|
|
14
14
|
console.log(`Found model: ${opus.provider}/${opus.id}`);
|
|
15
15
|
}
|
|
@@ -22,7 +22,7 @@ if (process.env.MY_ANTHROPIC_KEY) {
|
|
|
22
22
|
await modelRuntime.setRuntimeApiKey("anthropic", process.env.MY_ANTHROPIC_KEY);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const model = getModel("anthropic", "claude-sonnet-
|
|
25
|
+
const model = getModel("anthropic", "claude-sonnet-5");
|
|
26
26
|
if (!model) throw new Error("Model not found");
|
|
27
27
|
|
|
28
28
|
// In-memory settings with overrides
|
package/examples/sdk/README.md
CHANGED
|
@@ -53,7 +53,7 @@ const modelRegistry = ModelRegistry.create(authStorage);
|
|
|
53
53
|
const { session } = await createAgentSession({ authStorage, modelRegistry });
|
|
54
54
|
|
|
55
55
|
// Custom model
|
|
56
|
-
const model = getModel("anthropic", "claude-opus-
|
|
56
|
+
const model = getModel("anthropic", "claude-opus-5-5");
|
|
57
57
|
const { session } = await createAgentSession({ model, thinkingLevel: "high", authStorage, modelRegistry });
|
|
58
58
|
|
|
59
59
|
// Modify prompt
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draht/coding-agent",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.8",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"drahtConfig": {
|
|
@@ -47,16 +47,16 @@
|
|
|
47
47
|
"prepublishOnly": "node ../../scripts/sync-draht-tools.mjs && bun run clean && bun run build"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@draht/chord": "2026.10.
|
|
50
|
+
"@draht/chord": "2026.10.8",
|
|
51
51
|
"@mariozechner/jiti": "^2.6.2",
|
|
52
|
-
"@draht/agent-core": "2026.10.
|
|
53
|
-
"@draht/ai": "2026.10.
|
|
54
|
-
"@draht/codemode": "2026.10.
|
|
55
|
-
"@draht/mcp": "2026.10.
|
|
56
|
-
"@draht/rlm": "2026.10.
|
|
57
|
-
"@draht/router": "2026.10.
|
|
58
|
-
"@draht/tools": "2026.10.
|
|
59
|
-
"@draht/tui": "2026.10.
|
|
52
|
+
"@draht/agent-core": "2026.10.8",
|
|
53
|
+
"@draht/ai": "2026.10.8",
|
|
54
|
+
"@draht/codemode": "2026.10.8",
|
|
55
|
+
"@draht/mcp": "2026.10.8",
|
|
56
|
+
"@draht/rlm": "2026.10.8",
|
|
57
|
+
"@draht/router": "2026.10.8",
|
|
58
|
+
"@draht/tools": "2026.10.8",
|
|
59
|
+
"@draht/tui": "2026.10.8",
|
|
60
60
|
"@silvia-odwyer/photon-node": "^0.3.4",
|
|
61
61
|
"@sinclair/typebox": "^0.34.41",
|
|
62
62
|
"chalk": "^5.6.2",
|