@esso0428/pi-subagents 0.17.5 → 0.17.7
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 +14 -0
- package/CONTRIBUTING.md +4 -0
- package/README.md +1 -1
- package/dist/abortable.d.ts +13 -0
- package/dist/abortable.d.ts.map +1 -0
- package/dist/abortable.js +43 -0
- package/dist/abortable.js.map +1 -0
- package/dist/agent-color.d.ts +36 -0
- package/dist/agent-color.d.ts.map +1 -0
- package/dist/agent-color.js +124 -0
- package/dist/agent-color.js.map +1 -0
- package/dist/agent-file-toggle.d.ts +126 -0
- package/dist/agent-file-toggle.d.ts.map +1 -0
- package/dist/agent-file-toggle.js +259 -0
- package/dist/agent-file-toggle.js.map +1 -0
- package/dist/agent-history.d.ts +4 -0
- package/dist/agent-history.d.ts.map +1 -1
- package/dist/agent-history.js +47 -1
- package/dist/agent-history.js.map +1 -1
- package/dist/agent-manager.d.ts +370 -56
- package/dist/agent-manager.d.ts.map +1 -1
- package/dist/agent-manager.js +1123 -409
- package/dist/agent-manager.js.map +1 -1
- package/dist/agent-runner.d.ts +100 -10
- package/dist/agent-runner.d.ts.map +1 -1
- package/dist/agent-runner.js +166 -21
- package/dist/agent-runner.js.map +1 -1
- package/dist/agent-types.d.ts +57 -5
- package/dist/agent-types.d.ts.map +1 -1
- package/dist/agent-types.js +164 -32
- package/dist/agent-types.js.map +1 -1
- package/dist/child-context.d.ts +3 -0
- package/dist/child-context.d.ts.map +1 -0
- package/dist/child-context.js +13 -0
- package/dist/child-context.js.map +1 -0
- package/dist/cross-extension-rpc.d.ts +23 -3
- package/dist/cross-extension-rpc.d.ts.map +1 -1
- package/dist/cross-extension-rpc.js +79 -17
- package/dist/cross-extension-rpc.js.map +1 -1
- package/dist/custom-agents.d.ts +38 -1
- package/dist/custom-agents.d.ts.map +1 -1
- package/dist/custom-agents.js +164 -12
- package/dist/custom-agents.js.map +1 -1
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1908 -495
- package/dist/index.js.map +1 -1
- package/dist/invocation-config.d.ts +87 -2
- package/dist/invocation-config.d.ts.map +1 -1
- package/dist/invocation-config.js +71 -3
- package/dist/invocation-config.js.map +1 -1
- package/dist/mention-clone.d.ts +88 -0
- package/dist/mention-clone.d.ts.map +1 -0
- package/dist/mention-clone.js +154 -0
- package/dist/mention-clone.js.map +1 -0
- package/dist/mention.d.ts +82 -0
- package/dist/mention.d.ts.map +1 -0
- package/dist/mention.js +132 -0
- package/dist/mention.js.map +1 -0
- package/dist/model-resolver.d.ts +17 -0
- package/dist/model-resolver.d.ts.map +1 -1
- package/dist/model-resolver.js +15 -0
- package/dist/model-resolver.js.map +1 -1
- package/dist/model-scope.d.ts +50 -0
- package/dist/model-scope.d.ts.map +1 -0
- package/dist/model-scope.js +49 -0
- package/dist/model-scope.js.map +1 -0
- package/dist/nested-tools.d.ts +57 -0
- package/dist/nested-tools.d.ts.map +1 -0
- package/dist/nested-tools.js +301 -0
- package/dist/nested-tools.js.map +1 -0
- package/dist/output-file.d.ts +22 -3
- package/dist/output-file.d.ts.map +1 -1
- package/dist/output-file.js +58 -7
- package/dist/output-file.js.map +1 -1
- package/dist/prompts.d.ts +23 -0
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +20 -2
- package/dist/prompts.js.map +1 -1
- package/dist/schedule.d.ts.map +1 -1
- package/dist/schedule.js +36 -15
- package/dist/schedule.js.map +1 -1
- package/dist/settings.d.ts +228 -2
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +94 -0
- package/dist/settings.js.map +1 -1
- package/dist/status-note.d.ts +49 -1
- package/dist/status-note.d.ts.map +1 -1
- package/dist/status-note.js +62 -1
- package/dist/status-note.js.map +1 -1
- package/dist/structured-output.d.ts +62 -0
- package/dist/structured-output.d.ts.map +1 -0
- package/dist/structured-output.js +113 -0
- package/dist/structured-output.js.map +1 -0
- package/dist/types.d.ts +176 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/agent-mention.d.ts +83 -0
- package/dist/ui/agent-mention.d.ts.map +1 -0
- package/dist/ui/agent-mention.js +188 -0
- package/dist/ui/agent-mention.js.map +1 -0
- package/dist/ui/agent-widget.d.ts +96 -75
- package/dist/ui/agent-widget.d.ts.map +1 -1
- package/dist/ui/agent-widget.js +397 -420
- package/dist/ui/agent-widget.js.map +1 -1
- package/dist/ui/conversation-blocks.d.ts.map +1 -1
- package/dist/ui/conversation-blocks.js +6 -0
- package/dist/ui/conversation-blocks.js.map +1 -1
- package/dist/ui/conversation-timeline.d.ts +10 -2
- package/dist/ui/conversation-timeline.d.ts.map +1 -1
- package/dist/ui/conversation-timeline.js +130 -23
- package/dist/ui/conversation-timeline.js.map +1 -1
- package/dist/ui/conversation-viewer.d.ts +20 -5
- package/dist/ui/conversation-viewer.d.ts.map +1 -1
- package/dist/ui/conversation-viewer.js +274 -73
- package/dist/ui/conversation-viewer.js.map +1 -1
- package/dist/ui/fleet-list.d.ts +198 -0
- package/dist/ui/fleet-list.d.ts.map +1 -0
- package/dist/ui/fleet-list.js +487 -0
- package/dist/ui/fleet-list.js.map +1 -0
- package/dist/ui/schedule-menu.d.ts.map +1 -1
- package/dist/ui/schedule-menu.js +6 -7
- package/dist/ui/schedule-menu.js.map +1 -1
- package/dist/ui/select-item.d.ts +28 -0
- package/dist/ui/select-item.d.ts.map +1 -0
- package/dist/ui/select-item.js +35 -0
- package/dist/ui/select-item.js.map +1 -0
- package/dist/ui/workflow-card.d.ts +176 -0
- package/dist/ui/workflow-card.d.ts.map +1 -0
- package/dist/ui/workflow-card.js +333 -0
- package/dist/ui/workflow-card.js.map +1 -0
- package/dist/ui/workflow-dialog.d.ts +306 -0
- package/dist/ui/workflow-dialog.d.ts.map +1 -0
- package/dist/ui/workflow-dialog.js +844 -0
- package/dist/ui/workflow-dialog.js.map +1 -0
- package/dist/ui/workflow-menu.d.ts +61 -0
- package/dist/ui/workflow-menu.d.ts.map +1 -0
- package/dist/ui/workflow-menu.js +148 -0
- package/dist/ui/workflow-menu.js.map +1 -0
- package/dist/usage.d.ts +86 -1
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +72 -1
- package/dist/usage.js.map +1 -1
- package/dist/workflow/collisions.d.ts +96 -0
- package/dist/workflow/collisions.d.ts.map +1 -0
- package/dist/workflow/collisions.js +89 -0
- package/dist/workflow/collisions.js.map +1 -0
- package/dist/workflow/entry.d.ts +33 -0
- package/dist/workflow/entry.d.ts.map +1 -0
- package/dist/workflow/entry.js +30 -0
- package/dist/workflow/entry.js.map +1 -0
- package/dist/workflow/host.d.ts +63 -0
- package/dist/workflow/host.d.ts.map +1 -0
- package/dist/workflow/host.js +363 -0
- package/dist/workflow/host.js.map +1 -0
- package/dist/workflow/journal.d.ts +98 -0
- package/dist/workflow/journal.d.ts.map +1 -0
- package/dist/workflow/journal.js +121 -0
- package/dist/workflow/journal.js.map +1 -0
- package/dist/workflow/json-schema.d.ts +52 -0
- package/dist/workflow/json-schema.d.ts.map +1 -0
- package/dist/workflow/json-schema.js +112 -0
- package/dist/workflow/json-schema.js.map +1 -0
- package/dist/workflow/meta.d.ts +68 -0
- package/dist/workflow/meta.d.ts.map +1 -0
- package/dist/workflow/meta.js +318 -0
- package/dist/workflow/meta.js.map +1 -0
- package/dist/workflow/progress.d.ts +225 -0
- package/dist/workflow/progress.d.ts.map +1 -0
- package/dist/workflow/progress.js +362 -0
- package/dist/workflow/progress.js.map +1 -0
- package/dist/workflow/runtime.d.ts +335 -0
- package/dist/workflow/runtime.d.ts.map +1 -0
- package/dist/workflow/runtime.js +831 -0
- package/dist/workflow/runtime.js.map +1 -0
- package/dist/workflow/saved.d.ts +91 -0
- package/dist/workflow/saved.d.ts.map +1 -0
- package/dist/workflow/saved.js +204 -0
- package/dist/workflow/saved.js.map +1 -0
- package/dist/workflow/task.d.ts +137 -0
- package/dist/workflow/task.d.ts.map +1 -0
- package/dist/workflow/task.js +208 -0
- package/dist/workflow/task.js.map +1 -0
- package/dist/workflow/tool-description.d.ts +39 -0
- package/dist/workflow/tool-description.d.ts.map +1 -0
- package/dist/workflow/tool-description.js +200 -0
- package/dist/workflow/tool-description.js.map +1 -0
- package/dist/workflow/worker-source.d.ts +48 -0
- package/dist/workflow/worker-source.d.ts.map +1 -0
- package/dist/workflow/worker-source.js +779 -0
- package/dist/workflow/worker-source.js.map +1 -0
- package/dist/worktree.d.ts +10 -3
- package/dist/worktree.d.ts.map +1 -1
- package/dist/worktree.js +58 -54
- package/dist/worktree.js.map +1 -1
- package/dist/xml.d.ts +11 -0
- package/dist/xml.d.ts.map +1 -0
- package/dist/xml.js +13 -0
- package/dist/xml.js.map +1 -0
- package/docs/rpc.md +183 -0
- package/docs/superpowers/plans/2026-09-30-conversation-viewer-scrollbar.md +216 -0
- package/docs/superpowers/plans/2026-09-30-upstream-event-workflow-partial-history.md +195 -0
- package/docs/superpowers/specs/2026-09-30-conversation-viewer-scrollbar-design.md +82 -0
- package/docs/superpowers/specs/2026-09-30-upstream-event-workflow-partial-history-design.md +49 -0
- package/docs/workflows.md +437 -0
- package/examples/agent-tool-description.md +7 -7
- package/examples/workflows/compose.js +51 -0
- package/examples/workflows/fan-out-audit.js +47 -0
- package/examples/workflows/gated-fix.js +60 -0
- package/examples/workflows/lib/count-child.js +27 -0
- package/examples/workflows/review-panel.js +63 -0
- package/examples/workflows/structured-findings.js +78 -0
- package/package.json +1 -1
- package/src/abortable.ts +43 -0
- package/src/agent-color.ts +161 -0
- package/src/agent-file-toggle.ts +269 -0
- package/src/agent-history.ts +54 -2
- package/src/agent-manager.ts +1263 -402
- package/src/agent-runner.ts +251 -27
- package/src/agent-types.ts +188 -32
- package/src/child-context.ts +15 -0
- package/src/cross-extension-rpc.ts +96 -20
- package/src/custom-agents.ts +170 -13
- package/src/index.ts +2024 -537
- package/src/invocation-config.ts +118 -3
- package/src/mention-clone.ts +196 -0
- package/src/mention.ts +141 -0
- package/src/model-resolver.ts +18 -0
- package/src/model-scope.ts +70 -0
- package/src/nested-tools.ts +424 -0
- package/src/output-file.ts +61 -6
- package/src/prompts.ts +45 -2
- package/src/schedule.ts +35 -14
- package/src/settings.ts +312 -2
- package/src/status-note.ts +66 -1
- package/src/structured-output.ts +130 -0
- package/src/types.ts +177 -10
- package/src/ui/agent-mention.ts +216 -0
- package/src/ui/agent-widget.ts +389 -441
- package/src/ui/conversation-blocks.ts +6 -0
- package/src/ui/conversation-timeline.ts +139 -25
- package/src/ui/conversation-viewer.ts +284 -69
- package/src/ui/fleet-list.ts +558 -0
- package/src/ui/schedule-menu.ts +9 -8
- package/src/ui/select-item.ts +45 -0
- package/src/ui/workflow-card.ts +470 -0
- package/src/ui/workflow-dialog.ts +1115 -0
- package/src/ui/workflow-menu.ts +193 -0
- package/src/usage.ts +109 -2
- package/src/workflow/collisions.ts +123 -0
- package/src/workflow/entry.ts +47 -0
- package/src/workflow/host.ts +403 -0
- package/src/workflow/journal.ts +164 -0
- package/src/workflow/json-schema.ts +128 -0
- package/src/workflow/meta.ts +325 -0
- package/src/workflow/progress.ts +550 -0
- package/src/workflow/runtime.ts +1219 -0
- package/src/workflow/saved.ts +217 -0
- package/src/workflow/task.ts +302 -0
- package/src/workflow/tool-description.ts +200 -0
- package/src/workflow/worker-source.ts +781 -0
- package/src/worktree.ts +69 -55
- package/src/xml.ts +13 -0
- package/vitest.config.ts +0 -18
package/dist/settings.d.ts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
import type { JoinMode, WidgetMode } from "./types.js";
|
|
1
|
+
import type { AgentMentionMode, JoinMode, ViewerMarkdownMode, WidgetMode } from "./types.js";
|
|
2
2
|
export interface SubagentsSettings {
|
|
3
3
|
maxConcurrent?: number;
|
|
4
|
+
/**
|
|
5
|
+
* Max concurrent FOREGROUND (blocking) agents — `0` = unlimited, the default,
|
|
6
|
+
* which preserves the behaviour that has always applied: nothing bounded
|
|
7
|
+
* foreground work, and pi dispatches a message's tool calls through
|
|
8
|
+
* `Promise.all`, so an unqualified fan-out of blocking `Agent` calls runs all
|
|
9
|
+
* at once. Set it to bound that (#253 — on local models, parallel agents
|
|
10
|
+
* thrash the prompt cache).
|
|
11
|
+
*
|
|
12
|
+
* Deliberately independent of `maxConcurrent` rather than folded into it: a
|
|
13
|
+
* foreground agent blocks the parent anyway, so charging it to the background
|
|
14
|
+
* pool would let a saturated pool starve the main session of work it could
|
|
15
|
+
* have done itself.
|
|
16
|
+
*
|
|
17
|
+
* Bounds only spawns a caller is blocking on inline. Nested children are
|
|
18
|
+
* exempt — their parent is blocked awaiting them, so queueing a child behind
|
|
19
|
+
* its own parent would deadlock — and so are detached spawns from
|
|
20
|
+
* cross-extension RPC or `@handle` mentions, which block nobody and are
|
|
21
|
+
* documented to start immediately. Foreground `resume` is also outside the
|
|
22
|
+
* pool: it reuses an existing session and never reaches the spawn path, so
|
|
23
|
+
* several blocking resumes in one message can still exceed the limit.
|
|
24
|
+
*/
|
|
25
|
+
maxConcurrentForeground?: number;
|
|
4
26
|
/**
|
|
5
27
|
* 0 = unlimited — the extension's single source of truth for that convention:
|
|
6
28
|
* `normalizeMaxTurns()` in agent-runner.ts treats 0 → `undefined`, and the
|
|
@@ -9,6 +31,23 @@ export interface SubagentsSettings {
|
|
|
9
31
|
defaultMaxTurns?: number;
|
|
10
32
|
graceTurns?: number;
|
|
11
33
|
defaultJoinMode?: JoinMode;
|
|
34
|
+
/**
|
|
35
|
+
* Whether a top-level `Agent` spawn that doesn't say runs detached.
|
|
36
|
+
* Defaults to `true`, following Claude Code, where the agent backgrounds
|
|
37
|
+
* unless the caller passes `run_in_background: false`. Set `false` to restore
|
|
38
|
+
* the previous behaviour, where an unqualified spawn blocked the turn and
|
|
39
|
+
* returned its result inline.
|
|
40
|
+
*
|
|
41
|
+
* Top-level only. Nested spawns (a subagent spawning its own) always default
|
|
42
|
+
* to foreground regardless of this setting — see `nested-tools.ts`, where a
|
|
43
|
+
* detached child would be killed by `abortOwnedChildren` when its parent
|
|
44
|
+
* settles, with no notification path to deliver its result.
|
|
45
|
+
*
|
|
46
|
+
* An explicit `run_in_background` on the call, or in the agent file's
|
|
47
|
+
* frontmatter, overrides this in both directions; the setting only decides
|
|
48
|
+
* what "unspecified" means.
|
|
49
|
+
*/
|
|
50
|
+
backgroundByDefault?: boolean;
|
|
12
51
|
/**
|
|
13
52
|
* Master switch for the schedule subagent feature. Defaults to `true`.
|
|
14
53
|
* When `false`: the `Agent` tool's `schedule` param + its guideline are
|
|
@@ -40,6 +79,18 @@ export interface SubagentsSettings {
|
|
|
40
79
|
* against. Defaults to false: subagents may use any model.
|
|
41
80
|
*/
|
|
42
81
|
scopeModels?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* When true, an unreadable or unparseable agent `.md` aborts extension load
|
|
84
|
+
* instead of being skipped with a warning — pi exits, naming the file.
|
|
85
|
+
*
|
|
86
|
+
* Startup only, by design. Mid-session reloads (one per `Agent` call) keep
|
|
87
|
+
* warning: a bad edit at 3pm should not kill the session on the next
|
|
88
|
+
* unrelated spawn, where the failure would look disconnected from its cause.
|
|
89
|
+
* For a checked-in `.pi/agents/`, failing at startup is the point — the
|
|
90
|
+
* alternative is running a *different* agent than the file names.
|
|
91
|
+
* Defaults to false.
|
|
92
|
+
*/
|
|
93
|
+
strictAgentFiles?: boolean;
|
|
43
94
|
/**
|
|
44
95
|
* When true, the three built-in default agents (general-purpose, Explore, Plan)
|
|
45
96
|
* are not registered at startup. User-defined agents from project/global custom
|
|
@@ -58,6 +109,40 @@ export interface SubagentsSettings {
|
|
|
58
109
|
* next pi session.
|
|
59
110
|
*/
|
|
60
111
|
toolDescriptionMode?: ToolDescriptionMode;
|
|
112
|
+
/**
|
|
113
|
+
* Whether the Claude Code-style FleetView (the navigable main+subagents list
|
|
114
|
+
* rendered below the editor) is shown. Defaults to `true`. Pure-UI: when off,
|
|
115
|
+
* the list never registers and the global key handler never captures input.
|
|
116
|
+
*/
|
|
117
|
+
fleetView?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Whether `@handle message` typed at the prompt is routed to that subagent
|
|
120
|
+
* instead of the main model, and whether `@` offers running agents alongside
|
|
121
|
+
* pi's file completion. Defaults to `model`. Applied live.
|
|
122
|
+
*
|
|
123
|
+
* - `model`: mentioning an agent that is not running asks the main model to
|
|
124
|
+
* spawn it with the `Agent` tool, Claude Code's behaviour. Costs a turn,
|
|
125
|
+
* and the model writes the agent's prompt rather than your text being it.
|
|
126
|
+
* - `direct`: that agent is started here instead, with the typed message as
|
|
127
|
+
* its prompt and no main-model turn spent.
|
|
128
|
+
* - `off`: the input hook falls straight through and the stacked
|
|
129
|
+
* autocomplete provider delegates everything back to pi's built-in one.
|
|
130
|
+
*
|
|
131
|
+
* Messaging a running agent and resuming a finished one are direct in both
|
|
132
|
+
* `model` and `direct`. The legacy booleans are still accepted: `true` reads
|
|
133
|
+
* as `model`, `false` as `off`.
|
|
134
|
+
*/
|
|
135
|
+
agentMentions?: AgentMentionMode;
|
|
136
|
+
/**
|
|
137
|
+
* Whether subagents persist their pi session by default, so `@handle` can
|
|
138
|
+
* reopen an agent's conversation long after its in-memory record is gone.
|
|
139
|
+
* Defaults to `true`. Per-agent `persist_session:` frontmatter overrides it
|
|
140
|
+
* in both directions. Turning it off restores the previous behaviour, where
|
|
141
|
+
* a handle stops resolving roughly ten minutes after the agent finishes and
|
|
142
|
+
* mentioning it starts a fresh run instead. Persisted sessions also appear
|
|
143
|
+
* nested under the spawning session in pi's `/resume`.
|
|
144
|
+
*/
|
|
145
|
+
rememberAgents?: boolean;
|
|
61
146
|
/**
|
|
62
147
|
* Display mode for the persistent above-editor agent widget:
|
|
63
148
|
* - `all`: show every agent (foreground + background).
|
|
@@ -65,7 +150,7 @@ export interface SubagentsSettings {
|
|
|
65
150
|
* Agent tool result, so the widget would otherwise double-render them
|
|
66
151
|
* (#118); everything else (background, queued, scheduled, RPC) stays.
|
|
67
152
|
* - `off`: hide the widget entirely.
|
|
68
|
-
* Defaults to `
|
|
153
|
+
* Defaults to `background`. Pure-UI and applied live (toggling refreshes the
|
|
69
154
|
* widget).
|
|
70
155
|
*/
|
|
71
156
|
widgetMode?: WidgetMode;
|
|
@@ -80,20 +165,161 @@ export interface SubagentsSettings {
|
|
|
80
165
|
* (`isolation: worktree`), or memory files.
|
|
81
166
|
*/
|
|
82
167
|
outputTranscript?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Whether `isolation: "worktree"` may create a worktree at all. Defaults to
|
|
170
|
+
* `true`. Set `false` on a repo where worktrees are too slow or too large to
|
|
171
|
+
* be worth it (#184): a requested worktree is then dropped and the agent runs
|
|
172
|
+
* in the main checkout.
|
|
173
|
+
*
|
|
174
|
+
* The drop is deliberately silent — there is no per-result note, because the
|
|
175
|
+
* setting exists for projects whose model asks for a worktree on every call,
|
|
176
|
+
* where a note would be noise on every result. What keeps the orchestrator
|
|
177
|
+
* from claiming a `pi-agent-*` branch anyway is that it is never told the
|
|
178
|
+
* capability exists: `isolationParam` (invocation-config.ts) drops the field
|
|
179
|
+
* from both tool schemas, and `isolationGuideline` (index.ts) drops the
|
|
180
|
+
* matching prose from the full and compact descriptions — a custom one opts
|
|
181
|
+
* in via the `{{isolationGuideline}}` placeholder. Anything that
|
|
182
|
+
* reintroduces the prose has to reintroduce a note with it.
|
|
183
|
+
*
|
|
184
|
+
* Deliberately a downgrade rather than an error. The fail-loud rule covers
|
|
185
|
+
* worktrees that *cannot* be created; this is the user declining one, and
|
|
186
|
+
* throwing would reject exactly the calls that the `isolation: "off"` value
|
|
187
|
+
* exists to tolerate. Enforced below the tool boundary, so it also covers the
|
|
188
|
+
* scheduler and the unvalidated cross-extension RPC path.
|
|
189
|
+
*/
|
|
190
|
+
worktreeIsolation?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Master switch for scripted workflows. Defaults to `true`.
|
|
193
|
+
*
|
|
194
|
+
* Off is not a soft hide: the `SubagentWorkflow` tool is never registered, so
|
|
195
|
+
* the model is not told it exists and cannot call it, the `/agents`
|
|
196
|
+
* Workflows entry is hidden, and `--subagents-workflow-file` is refused.
|
|
197
|
+
*
|
|
198
|
+
* Absent is not the same as `true`. Unset means *auto*: on, but yielding to
|
|
199
|
+
* another extension that already offers a workflow tool, because two
|
|
200
|
+
* orchestrators in one tool spec is a worse default than none — the model
|
|
201
|
+
* has to guess which to call, and pays for both descriptions to find out.
|
|
202
|
+
* Setting it explicitly pins the answer in both directions: `true` keeps
|
|
203
|
+
* ours whatever else is loaded, `false` is off regardless. See
|
|
204
|
+
* `resolveWorkflowCollisions` in index.ts.
|
|
205
|
+
*
|
|
206
|
+
* Read once at extension init, before registration, so flipping it in
|
|
207
|
+
* `/agents → Settings` takes effect on the next pi session — the same
|
|
208
|
+
* contract `schedulingEnabled` has, and for the same reason: a tool spec is
|
|
209
|
+
* fixed once pi has it.
|
|
210
|
+
*/
|
|
211
|
+
workflowsEnabled?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Hard ceiling on nested subagent delegation, counted from the main session:
|
|
214
|
+
* main = 0, its subagents = 1, their children = 2. Defaults to `2`; `0` or `1`
|
|
215
|
+
* disables nesting project-wide. Read when a subagent session is built, so a
|
|
216
|
+
* change applies to agents started after it.
|
|
217
|
+
*/
|
|
218
|
+
maxSubagentDepth?: number;
|
|
219
|
+
/**
|
|
220
|
+
* Agent type substituted when a caller-supplied `subagent_type` doesn't
|
|
221
|
+
* resolve to exactly one enabled agent (unknown, disabled, or ambiguous by
|
|
222
|
+
* case). Omitted keeps the historical `general-purpose` fallback; a type name
|
|
223
|
+
* routes those calls to that agent instead; `"none"` disables the fallback so
|
|
224
|
+
* dispatch fails closed with an error naming the available types.
|
|
225
|
+
*
|
|
226
|
+
* The boolean `false` is accepted as a spelling of `"none"`, because a boolean
|
|
227
|
+
* would otherwise be dropped as the wrong type and silently leave the
|
|
228
|
+
* PERMISSIVE default in place while the author believes strict dispatch is on
|
|
229
|
+
* — the wrong direction to fail for this setting. Every other value is an
|
|
230
|
+
* agent name, so a mistaken `"off"` fails loudly at dispatch rather than
|
|
231
|
+
* meaning one thing here and another in the resolver.
|
|
232
|
+
*/
|
|
233
|
+
fallbackSubagent?: string;
|
|
234
|
+
/**
|
|
235
|
+
* Whether this extension's tool results carry a `usage` field, so subagent
|
|
236
|
+
* spend reaches the parent session's own accounting. Defaults to `false`.
|
|
237
|
+
*
|
|
238
|
+
* Subagents run in their own pi sessions, so by default the parent's footer,
|
|
239
|
+
* statusline and `/cost` show only what the main model spent — a session that
|
|
240
|
+
* delegated most of its work reads as nearly free. Pi folds
|
|
241
|
+
* `toolResult.usage` into `getSessionStats()`, so attaching it makes those
|
|
242
|
+
* surfaces count subagents too, under `/cost`'s "Tools/summaries" bucket.
|
|
243
|
+
*
|
|
244
|
+
* Off by default because it changes numbers the user may already be tracking
|
|
245
|
+
* (a statusline reading session cost will step up), not because the numbers
|
|
246
|
+
* are wrong.
|
|
247
|
+
*
|
|
248
|
+
* Three properties of what gets reported:
|
|
249
|
+
* - Tokens exclude `cacheRead`, for the reason in `usage.ts` — the parent's
|
|
250
|
+
* token total therefore rises by billed tokens only.
|
|
251
|
+
* - Cost is pi's own per-message `usage.cost.total`; we price nothing, and
|
|
252
|
+
* a model pi has no rates for contributes 0.
|
|
253
|
+
* - The context-window percentage is untouched. Pi derives it from assistant
|
|
254
|
+
* messages alone (`getContextUsage`), so a delegating session's context
|
|
255
|
+
* does not appear to fill up faster.
|
|
256
|
+
*/
|
|
257
|
+
reportUsage?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Whether the subagent surfaces show an estimated dollar cost next to their
|
|
260
|
+
* token counts (widget, FleetView, conversation viewer, foreground results,
|
|
261
|
+
* completion notifications). Defaults to `false`. Applied live.
|
|
262
|
+
*
|
|
263
|
+
* Rendered as `~$0.0042` — the tilde marks it as pi's reported estimate
|
|
264
|
+
* rather than a billed figure, and it is omitted entirely when the model has
|
|
265
|
+
* no pricing data, so a local model shows tokens and no dollars.
|
|
266
|
+
*
|
|
267
|
+
* Independent of `reportUsage`: this one is what a human reads, that one is
|
|
268
|
+
* what the parent session counts.
|
|
269
|
+
*/
|
|
270
|
+
showCost?: boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Whether the widget's running rows name the model driving each agent and the
|
|
273
|
+
* thinking level it is running at.
|
|
274
|
+
*
|
|
275
|
+
* Off by default, unlike the tool result and the conversation viewer, which
|
|
276
|
+
* show the pair unconditionally: those have a line to themselves, while the
|
|
277
|
+
* widget row already carries the description, turns, tool uses, tokens and
|
|
278
|
+
* elapsed time, and every character it gains is one the description loses on a
|
|
279
|
+
* narrow terminal.
|
|
280
|
+
*/
|
|
281
|
+
showModel?: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* How much of the conversation viewer's transcript renders as Markdown.
|
|
284
|
+
* Defaults to `assistant`. Applied live — the viewer's `m` key cycles this
|
|
285
|
+
* same setting, so a choice made in the overlay persists like one made in
|
|
286
|
+
* `/agents → Settings`.
|
|
287
|
+
*
|
|
288
|
+
* Scoped rather than all-or-nothing because the two kinds of content have
|
|
289
|
+
* different contracts: assistant text is authored as Markdown, while a tool
|
|
290
|
+
* result is whatever bytes the tool produced. Rendering the latter as
|
|
291
|
+
* Markdown is lossy in ways that look like the tool misbehaved — see
|
|
292
|
+
* `ViewerMarkdownMode` for the specific rewrites — so `all` is opt-in.
|
|
293
|
+
*/
|
|
294
|
+
viewerMarkdown?: ViewerMarkdownMode;
|
|
83
295
|
}
|
|
84
296
|
export type ToolDescriptionMode = "full" | "compact" | "custom";
|
|
85
297
|
/** Setter hooks used by applySettings to wire persisted values into in-memory state. */
|
|
86
298
|
export interface SettingsAppliers {
|
|
87
299
|
setMaxConcurrent: (n: number) => void;
|
|
300
|
+
setMaxConcurrentForeground: (n: number) => void;
|
|
88
301
|
setDefaultMaxTurns: (n: number) => void;
|
|
89
302
|
setGraceTurns: (n: number) => void;
|
|
90
303
|
setDefaultJoinMode: (mode: JoinMode) => void;
|
|
304
|
+
setBackgroundByDefault: (b: boolean) => void;
|
|
91
305
|
setSchedulingEnabled: (b: boolean) => void;
|
|
92
306
|
setScopeModels: (enabled: boolean) => void;
|
|
307
|
+
setStrictAgentFiles: (b: boolean) => void;
|
|
93
308
|
setDisableDefaultAgents: (b: boolean) => void;
|
|
94
309
|
setToolDescriptionMode: (mode: ToolDescriptionMode) => void;
|
|
310
|
+
setFleetView: (b: boolean) => void;
|
|
311
|
+
setAgentMentions: (mode: AgentMentionMode) => void;
|
|
312
|
+
setRememberAgents: (b: boolean) => void;
|
|
95
313
|
setWidgetMode: (mode: WidgetMode) => void;
|
|
96
314
|
setOutputTranscript: (b: boolean) => void;
|
|
315
|
+
setWorktreeIsolation: (b: boolean) => void;
|
|
316
|
+
setWorkflowsEnabled: (b: boolean) => void;
|
|
317
|
+
setMaxSubagentDepth: (n: number) => void;
|
|
318
|
+
setFallbackSubagent: (v: string | undefined) => void;
|
|
319
|
+
setReportUsage: (b: boolean) => void;
|
|
320
|
+
setShowCost: (b: boolean) => void;
|
|
321
|
+
setShowModel: (b: boolean) => void;
|
|
322
|
+
setViewerMarkdown: (mode: ViewerMarkdownMode) => void;
|
|
97
323
|
}
|
|
98
324
|
/** Emit callback — a subset of `pi.events.emit` to keep helpers testable. */
|
|
99
325
|
export type SettingsEmit = (event: string, payload: unknown) => void;
|
package/dist/settings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7F,MAAM,WAAW,iBAAiB;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,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,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,YAAY,EAClB,GAAG,GAAE,MAAsB,GAC1B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAIhD"}
|
package/dist/settings.js
CHANGED
|
@@ -4,15 +4,19 @@
|
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { NO_FALLBACK } from "./agent-types.js";
|
|
7
8
|
const VALID_JOIN_MODES = new Set(["async", "group", "smart"]);
|
|
8
9
|
const VALID_TOOL_DESCRIPTION_MODES = new Set(["full", "compact", "custom"]);
|
|
9
10
|
const VALID_WIDGET_MODES = new Set(["all", "background", "off"]);
|
|
11
|
+
const VALID_VIEWER_MARKDOWN_MODES = new Set(["off", "assistant", "all"]);
|
|
12
|
+
const VALID_AGENT_MENTION_MODES = new Set(["model", "direct", "off"]);
|
|
10
13
|
// Sanity ceilings — prevent hand-edited configs from asking for values that
|
|
11
14
|
// make no operational sense (e.g. 1e6 concurrent subagents). Permissive enough
|
|
12
15
|
// that any realistic power-user setting passes through.
|
|
13
16
|
const MAX_CONCURRENT_CEILING = 1024;
|
|
14
17
|
const MAX_TURNS_CEILING = 10_000;
|
|
15
18
|
const GRACE_TURNS_CEILING = 1_000;
|
|
19
|
+
const SUBAGENT_DEPTH_CEILING = 16;
|
|
16
20
|
/** Drop fields that don't match the expected shape. Silent — garbage becomes absent. */
|
|
17
21
|
function sanitize(raw) {
|
|
18
22
|
if (!raw || typeof raw !== "object")
|
|
@@ -24,6 +28,13 @@ function sanitize(raw) {
|
|
|
24
28
|
r.maxConcurrent <= MAX_CONCURRENT_CEILING) {
|
|
25
29
|
out.maxConcurrent = r.maxConcurrent;
|
|
26
30
|
}
|
|
31
|
+
// Floor 0, not 1 like maxConcurrent above: 0 is the documented "unlimited"
|
|
32
|
+
// value and the default, so dropping it would silently be unrepresentable.
|
|
33
|
+
if (Number.isInteger(r.maxConcurrentForeground) &&
|
|
34
|
+
r.maxConcurrentForeground >= 0 &&
|
|
35
|
+
r.maxConcurrentForeground <= MAX_CONCURRENT_CEILING) {
|
|
36
|
+
out.maxConcurrentForeground = r.maxConcurrentForeground;
|
|
37
|
+
}
|
|
27
38
|
if (Number.isInteger(r.defaultMaxTurns) &&
|
|
28
39
|
r.defaultMaxTurns >= 0 &&
|
|
29
40
|
r.defaultMaxTurns <= MAX_TURNS_CEILING) {
|
|
@@ -34,27 +45,81 @@ function sanitize(raw) {
|
|
|
34
45
|
r.graceTurns <= GRACE_TURNS_CEILING) {
|
|
35
46
|
out.graceTurns = r.graceTurns;
|
|
36
47
|
}
|
|
48
|
+
if (Number.isInteger(r.maxSubagentDepth) &&
|
|
49
|
+
r.maxSubagentDepth >= 0 &&
|
|
50
|
+
r.maxSubagentDepth <= SUBAGENT_DEPTH_CEILING) {
|
|
51
|
+
out.maxSubagentDepth = r.maxSubagentDepth;
|
|
52
|
+
}
|
|
37
53
|
if (typeof r.defaultJoinMode === "string" && VALID_JOIN_MODES.has(r.defaultJoinMode)) {
|
|
38
54
|
out.defaultJoinMode = r.defaultJoinMode;
|
|
39
55
|
}
|
|
56
|
+
if (typeof r.backgroundByDefault === "boolean") {
|
|
57
|
+
out.backgroundByDefault = r.backgroundByDefault;
|
|
58
|
+
}
|
|
40
59
|
if (typeof r.schedulingEnabled === "boolean") {
|
|
41
60
|
out.schedulingEnabled = r.schedulingEnabled;
|
|
42
61
|
}
|
|
43
62
|
if (typeof r.scopeModels === "boolean") {
|
|
44
63
|
out.scopeModels = r.scopeModels;
|
|
45
64
|
}
|
|
65
|
+
if (typeof r.strictAgentFiles === "boolean") {
|
|
66
|
+
out.strictAgentFiles = r.strictAgentFiles;
|
|
67
|
+
}
|
|
46
68
|
if (typeof r.disableDefaultAgents === "boolean") {
|
|
47
69
|
out.disableDefaultAgents = r.disableDefaultAgents;
|
|
48
70
|
}
|
|
49
71
|
if (typeof r.toolDescriptionMode === "string" && VALID_TOOL_DESCRIPTION_MODES.has(r.toolDescriptionMode)) {
|
|
50
72
|
out.toolDescriptionMode = r.toolDescriptionMode;
|
|
51
73
|
}
|
|
74
|
+
if (typeof r.fleetView === "boolean") {
|
|
75
|
+
out.fleetView = r.fleetView;
|
|
76
|
+
}
|
|
77
|
+
// Was a boolean before the `model` mode existed. A hand-written or
|
|
78
|
+
// previously-written `true` means "on", which is now the default `model`.
|
|
79
|
+
if (typeof r.agentMentions === "boolean") {
|
|
80
|
+
out.agentMentions = r.agentMentions ? "model" : "off";
|
|
81
|
+
}
|
|
82
|
+
else if (typeof r.agentMentions === "string" && VALID_AGENT_MENTION_MODES.has(r.agentMentions)) {
|
|
83
|
+
out.agentMentions = r.agentMentions;
|
|
84
|
+
}
|
|
85
|
+
if (typeof r.rememberAgents === "boolean") {
|
|
86
|
+
out.rememberAgents = r.rememberAgents;
|
|
87
|
+
}
|
|
52
88
|
if (typeof r.widgetMode === "string" && VALID_WIDGET_MODES.has(r.widgetMode)) {
|
|
53
89
|
out.widgetMode = r.widgetMode;
|
|
54
90
|
}
|
|
55
91
|
if (typeof r.outputTranscript === "boolean") {
|
|
56
92
|
out.outputTranscript = r.outputTranscript;
|
|
57
93
|
}
|
|
94
|
+
if (typeof r.worktreeIsolation === "boolean") {
|
|
95
|
+
out.worktreeIsolation = r.worktreeIsolation;
|
|
96
|
+
}
|
|
97
|
+
if (typeof r.reportUsage === "boolean") {
|
|
98
|
+
out.reportUsage = r.reportUsage;
|
|
99
|
+
}
|
|
100
|
+
if (typeof r.showCost === "boolean") {
|
|
101
|
+
out.showCost = r.showCost;
|
|
102
|
+
}
|
|
103
|
+
if (typeof r.showModel === "boolean") {
|
|
104
|
+
out.showModel = r.showModel;
|
|
105
|
+
}
|
|
106
|
+
if (typeof r.viewerMarkdown === "string" && VALID_VIEWER_MARKDOWN_MODES.has(r.viewerMarkdown)) {
|
|
107
|
+
out.viewerMarkdown = r.viewerMarkdown;
|
|
108
|
+
}
|
|
109
|
+
if (typeof r.workflowsEnabled === "boolean") {
|
|
110
|
+
out.workflowsEnabled = r.workflowsEnabled;
|
|
111
|
+
}
|
|
112
|
+
if (r.fallbackSubagent === false) {
|
|
113
|
+
// The only non-string spelling worth accepting: a boolean would otherwise be
|
|
114
|
+
// dropped, silently leaving the PERMISSIVE default in place. Every string is
|
|
115
|
+
// an agent name except the `none` sentinel, which the resolver recognizes —
|
|
116
|
+
// so a mistaken "off" fails loudly at dispatch instead of meaning something
|
|
117
|
+
// different here than it does there.
|
|
118
|
+
out.fallbackSubagent = NO_FALLBACK;
|
|
119
|
+
}
|
|
120
|
+
else if (typeof r.fallbackSubagent === "string" && r.fallbackSubagent.trim()) {
|
|
121
|
+
out.fallbackSubagent = r.fallbackSubagent.trim();
|
|
122
|
+
}
|
|
58
123
|
return out;
|
|
59
124
|
}
|
|
60
125
|
function globalPath() {
|
|
@@ -104,24 +169,53 @@ export function saveSettings(s, cwd = process.cwd()) {
|
|
|
104
169
|
export function applySettings(s, appliers) {
|
|
105
170
|
if (typeof s.maxConcurrent === "number")
|
|
106
171
|
appliers.setMaxConcurrent(s.maxConcurrent);
|
|
172
|
+
if (typeof s.maxConcurrentForeground === "number") {
|
|
173
|
+
appliers.setMaxConcurrentForeground(s.maxConcurrentForeground);
|
|
174
|
+
}
|
|
107
175
|
if (typeof s.defaultMaxTurns === "number")
|
|
108
176
|
appliers.setDefaultMaxTurns(s.defaultMaxTurns);
|
|
109
177
|
if (typeof s.graceTurns === "number")
|
|
110
178
|
appliers.setGraceTurns(s.graceTurns);
|
|
179
|
+
if (typeof s.maxSubagentDepth === "number")
|
|
180
|
+
appliers.setMaxSubagentDepth(s.maxSubagentDepth);
|
|
181
|
+
if (typeof s.fallbackSubagent === "string")
|
|
182
|
+
appliers.setFallbackSubagent(s.fallbackSubagent);
|
|
111
183
|
if (s.defaultJoinMode)
|
|
112
184
|
appliers.setDefaultJoinMode(s.defaultJoinMode);
|
|
185
|
+
if (typeof s.backgroundByDefault === "boolean")
|
|
186
|
+
appliers.setBackgroundByDefault(s.backgroundByDefault);
|
|
113
187
|
if (typeof s.schedulingEnabled === "boolean")
|
|
114
188
|
appliers.setSchedulingEnabled(s.schedulingEnabled);
|
|
115
189
|
if (typeof s.scopeModels === "boolean")
|
|
116
190
|
appliers.setScopeModels(s.scopeModels);
|
|
191
|
+
if (typeof s.strictAgentFiles === "boolean")
|
|
192
|
+
appliers.setStrictAgentFiles(s.strictAgentFiles);
|
|
117
193
|
if (typeof s.disableDefaultAgents === "boolean")
|
|
118
194
|
appliers.setDisableDefaultAgents(s.disableDefaultAgents);
|
|
119
195
|
if (s.toolDescriptionMode)
|
|
120
196
|
appliers.setToolDescriptionMode(s.toolDescriptionMode);
|
|
197
|
+
if (typeof s.fleetView === "boolean")
|
|
198
|
+
appliers.setFleetView(s.fleetView);
|
|
199
|
+
if (s.agentMentions)
|
|
200
|
+
appliers.setAgentMentions(s.agentMentions);
|
|
201
|
+
if (typeof s.rememberAgents === "boolean")
|
|
202
|
+
appliers.setRememberAgents(s.rememberAgents);
|
|
121
203
|
if (s.widgetMode)
|
|
122
204
|
appliers.setWidgetMode(s.widgetMode);
|
|
123
205
|
if (typeof s.outputTranscript === "boolean")
|
|
124
206
|
appliers.setOutputTranscript(s.outputTranscript);
|
|
207
|
+
if (typeof s.worktreeIsolation === "boolean")
|
|
208
|
+
appliers.setWorktreeIsolation(s.worktreeIsolation);
|
|
209
|
+
if (typeof s.reportUsage === "boolean")
|
|
210
|
+
appliers.setReportUsage(s.reportUsage);
|
|
211
|
+
if (typeof s.showCost === "boolean")
|
|
212
|
+
appliers.setShowCost(s.showCost);
|
|
213
|
+
if (typeof s.showModel === "boolean")
|
|
214
|
+
appliers.setShowModel(s.showModel);
|
|
215
|
+
if (s.viewerMarkdown)
|
|
216
|
+
appliers.setViewerMarkdown(s.viewerMarkdown);
|
|
217
|
+
if (typeof s.workflowsEnabled === "boolean")
|
|
218
|
+
appliers.setWorkflowsEnabled(s.workflowsEnabled);
|
|
125
219
|
}
|
|
126
220
|
/**
|
|
127
221
|
* Format the user-facing toast for a settings mutation. Pure function —
|
package/dist/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,kGAAkG;AAClG,gGAAgG;AAEhG,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,kGAAkG;AAClG,gGAAgG;AAEhG,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA4U/C,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAW,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAC7F,MAAM,4BAA4B,GAAwB,IAAI,GAAG,CAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AACtH,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAa,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;AAClG,MAAM,2BAA2B,GAAwB,IAAI,GAAG,CAAqB,CAAC,KAAK,EAAE,W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B,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;IACtE,OAAO,eAAe,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAChD,CAAC"}
|
package/dist/status-note.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* status-note.ts —
|
|
2
|
+
* status-note.ts — Honest framing for an agent result: the parenthetical status
|
|
3
|
+
* note for a non-normal outcome, and the salvaged partial output of a failure.
|
|
4
|
+
*
|
|
5
|
+
* Lives here rather than in an index.ts closure because both entry points need
|
|
6
|
+
* it — the top-level tools and the nested delegation tools, which can't import
|
|
7
|
+
* from index.ts (that is the extension entry, and it already reaches these tools
|
|
8
|
+
* through agent-runner).
|
|
3
9
|
*/
|
|
10
|
+
import type { AgentRecord } from "./types.js";
|
|
4
11
|
/**
|
|
5
12
|
* Explicit parenthetical note for a non-normal terminal outcome, so the parent
|
|
6
13
|
* agent can't mistake partial output for a completed result. Empty string for a
|
|
@@ -11,4 +18,45 @@
|
|
|
11
18
|
* from a budget cutoff.
|
|
12
19
|
*/
|
|
13
20
|
export declare function getStatusNote(status: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Foreground variant of `getStatusNote`. A foreground caller is in a different
|
|
23
|
+
* position from a background one, so it needs different text:
|
|
24
|
+
*
|
|
25
|
+
* - It already holds the agent's ENTIRE output inline, whereas the background
|
|
26
|
+
* notification carries a 500-char preview. So only here can we truthfully
|
|
27
|
+
* say there is nothing more to fetch — which is the whole point, because
|
|
28
|
+
* - it has no agent id. The id travels in the tool result's renderer
|
|
29
|
+
* `details`, which is never serialized to the model. A parent that reads
|
|
30
|
+
* "output may be partial" as "truncated, go retrieve the rest" therefore
|
|
31
|
+
* has nothing valid to call `get_subagent_result` with, and will invent an
|
|
32
|
+
* id (#174).
|
|
33
|
+
*
|
|
34
|
+
* Only the lead clause varies between the three, and each variation carries
|
|
35
|
+
* information: `wrapped up` vs `aborted` tells the parent whether the output is
|
|
36
|
+
* a considered final answer or a fragment, and `stopped` shouts because a human
|
|
37
|
+
* intervening outranks everything else in the string. Only `steered` hedges on
|
|
38
|
+
* completion — it was told to wrap up and did, so it may well have finished at
|
|
39
|
+
* the limit; an aborted run blew through its grace turns while still working,
|
|
40
|
+
* and `stopped` can only fire on a running agent, so neither ever delivered a
|
|
41
|
+
* final answer. Identical confidence gets identical wording: phrasing one fact
|
|
42
|
+
* two ways invites a hunt for a distinction that isn't there.
|
|
43
|
+
*
|
|
44
|
+
* Every clause is a statement about state, never an instruction to act, and
|
|
45
|
+
* `get_subagent_result` is never named — naming the tool we steer away from only
|
|
46
|
+
* raises its salience. Two instructions were tried here and cut: "re-spawn with
|
|
47
|
+
* a higher max_turns" (pushes a fresh multi-minute run to save one wasted tool
|
|
48
|
+
* call) and, on `stopped`, "ask before restarting it" (restates the lead, and
|
|
49
|
+
* presumes someone is present to ask — false under `pi -p`, in scheduled jobs,
|
|
50
|
+
* and in any background-driven run). Nothing here can measure whether wording
|
|
51
|
+
* improves parent behavior, so removing a false cue (which cannot induce new
|
|
52
|
+
* behavior) and adding an instruction (which can) are not equally safe bets.
|
|
53
|
+
* Don't add either back without a way to measure it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getForegroundOutcomeNote(status: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Salvaged partial output of a failed run, as a labeled suffix for the error
|
|
58
|
+
* surfaces (or "" if the run produced nothing). `record.result` is bounded to
|
|
59
|
+
* the run's own turns, so this is never a stale earlier answer (#144).
|
|
60
|
+
*/
|
|
61
|
+
export declare function partialOutputSuffix(record: AgentRecord): string;
|
|
14
62
|
//# sourceMappingURL=status-note.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-note.d.ts","sourceRoot":"","sources":["../src/status-note.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"status-note.d.ts","sourceRoot":"","sources":["../src/status-note.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAWpD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAW/D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAG/D"}
|
package/dist/status-note.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* status-note.ts —
|
|
2
|
+
* status-note.ts — Honest framing for an agent result: the parenthetical status
|
|
3
|
+
* note for a non-normal outcome, and the salvaged partial output of a failure.
|
|
4
|
+
*
|
|
5
|
+
* Lives here rather than in an index.ts closure because both entry points need
|
|
6
|
+
* it — the top-level tools and the nested delegation tools, which can't import
|
|
7
|
+
* from index.ts (that is the extension entry, and it already reaches these tools
|
|
8
|
+
* through agent-runner).
|
|
3
9
|
*/
|
|
4
10
|
/**
|
|
5
11
|
* Explicit parenthetical note for a non-normal terminal outcome, so the parent
|
|
@@ -22,4 +28,59 @@ export function getStatusNote(status) {
|
|
|
22
28
|
return "";
|
|
23
29
|
}
|
|
24
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Foreground variant of `getStatusNote`. A foreground caller is in a different
|
|
33
|
+
* position from a background one, so it needs different text:
|
|
34
|
+
*
|
|
35
|
+
* - It already holds the agent's ENTIRE output inline, whereas the background
|
|
36
|
+
* notification carries a 500-char preview. So only here can we truthfully
|
|
37
|
+
* say there is nothing more to fetch — which is the whole point, because
|
|
38
|
+
* - it has no agent id. The id travels in the tool result's renderer
|
|
39
|
+
* `details`, which is never serialized to the model. A parent that reads
|
|
40
|
+
* "output may be partial" as "truncated, go retrieve the rest" therefore
|
|
41
|
+
* has nothing valid to call `get_subagent_result` with, and will invent an
|
|
42
|
+
* id (#174).
|
|
43
|
+
*
|
|
44
|
+
* Only the lead clause varies between the three, and each variation carries
|
|
45
|
+
* information: `wrapped up` vs `aborted` tells the parent whether the output is
|
|
46
|
+
* a considered final answer or a fragment, and `stopped` shouts because a human
|
|
47
|
+
* intervening outranks everything else in the string. Only `steered` hedges on
|
|
48
|
+
* completion — it was told to wrap up and did, so it may well have finished at
|
|
49
|
+
* the limit; an aborted run blew through its grace turns while still working,
|
|
50
|
+
* and `stopped` can only fire on a running agent, so neither ever delivered a
|
|
51
|
+
* final answer. Identical confidence gets identical wording: phrasing one fact
|
|
52
|
+
* two ways invites a hunt for a distinction that isn't there.
|
|
53
|
+
*
|
|
54
|
+
* Every clause is a statement about state, never an instruction to act, and
|
|
55
|
+
* `get_subagent_result` is never named — naming the tool we steer away from only
|
|
56
|
+
* raises its salience. Two instructions were tried here and cut: "re-spawn with
|
|
57
|
+
* a higher max_turns" (pushes a fresh multi-minute run to save one wasted tool
|
|
58
|
+
* call) and, on `stopped`, "ask before restarting it" (restates the lead, and
|
|
59
|
+
* presumes someone is present to ask — false under `pi -p`, in scheduled jobs,
|
|
60
|
+
* and in any background-driven run). Nothing here can measure whether wording
|
|
61
|
+
* improves parent behavior, so removing a false cue (which cannot induce new
|
|
62
|
+
* behavior) and adding an instruction (which can) are not equally safe bets.
|
|
63
|
+
* Don't add either back without a way to measure it.
|
|
64
|
+
*/
|
|
65
|
+
export function getForegroundOutcomeNote(status) {
|
|
66
|
+
switch (status) {
|
|
67
|
+
case "stopped":
|
|
68
|
+
return " (STOPPED BY THE USER — everything the agent produced is above; the task is unfinished)";
|
|
69
|
+
case "aborted":
|
|
70
|
+
return " (aborted at the turn limit — everything the agent produced is above; the task is unfinished)";
|
|
71
|
+
case "steered":
|
|
72
|
+
return " (wrapped up at the turn limit — everything the agent produced is above; the task may be unfinished)";
|
|
73
|
+
default:
|
|
74
|
+
return "";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Salvaged partial output of a failed run, as a labeled suffix for the error
|
|
79
|
+
* surfaces (or "" if the run produced nothing). `record.result` is bounded to
|
|
80
|
+
* the run's own turns, so this is never a stale earlier answer (#144).
|
|
81
|
+
*/
|
|
82
|
+
export function partialOutputSuffix(record) {
|
|
83
|
+
const partial = record.result?.trim();
|
|
84
|
+
return partial ? `\n\nPartial output before the failure:\n${partial}` : "";
|
|
85
|
+
}
|
|
25
86
|
//# sourceMappingURL=status-note.js.map
|
package/dist/status-note.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-note.js","sourceRoot":"","sources":["../src/status-note.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"status-note.js","sourceRoot":"","sources":["../src/status-note.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,yFAAyF,CAAC;QACnG,KAAK,SAAS;YACZ,OAAO,6EAA6E,CAAC;QACvF,KAAK,SAAS;YACZ,OAAO,yDAAyD,CAAC;QACnE;YACE,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAc;IACrD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,yFAAyF,CAAC;QACnG,KAAK,SAAS;YACZ,OAAO,+FAA+F,CAAC;QACzG,KAAK,SAAS;YACZ,OAAO,sGAAsG,CAAC;QAChH;YACE,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAmB;IACrD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;IACtC,OAAO,OAAO,CAAC,CAAC,CAAC,2CAA2C,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7E,CAAC"}
|