@esso0428/pi-subagents 0.17.15 → 0.17.17
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 +11 -0
- package/ROADMAP.md +87 -0
- package/docs/post-0.17.6-agents-roster-viewer-spec.md +42 -0
- package/docs/post-0.17.6-durable-history-spec.md +41 -0
- package/docs/post-0.17.6-feature-specs.md +50 -0
- package/docs/post-0.17.6-nested-agents-spec.md +38 -0
- package/docs/post-0.17.6-recovery-shutdown-spec.md +46 -0
- package/docs/post-0.17.6-ui-latency-baseline-spec.md +46 -0
- package/docs/post-0.17.6-workflow-rpc-lifecycle-spec.md +54 -0
- package/package.json +2 -3
- package/src/agent-history.ts +2 -54
- package/src/agent-manager.ts +406 -1288
- package/src/agent-runner.ts +27 -251
- package/src/agent-types.ts +32 -188
- package/src/cross-extension-rpc.ts +20 -96
- package/src/custom-agents.ts +13 -170
- package/src/index.ts +480 -1920
- package/src/invocation-config.ts +3 -118
- package/src/model-resolver.ts +0 -18
- package/src/output-file.ts +6 -61
- package/src/prompts.ts +2 -45
- package/src/schedule.ts +14 -35
- package/src/settings.ts +2 -301
- package/src/status-note.ts +1 -66
- package/src/types.ts +10 -177
- package/src/ui/agent-widget.ts +57 -278
- package/src/ui/conversation-blocks.ts +0 -6
- package/src/ui/conversation-timeline.ts +25 -139
- package/src/ui/conversation-viewer.ts +48 -212
- package/src/ui/schedule-menu.ts +8 -9
- package/src/usage.ts +2 -109
- package/src/worktree.ts +55 -69
- package/dist/abortable.d.ts +0 -13
- package/dist/abortable.d.ts.map +0 -1
- package/dist/abortable.js +0 -43
- package/dist/abortable.js.map +0 -1
- package/dist/agent-color.d.ts +0 -36
- package/dist/agent-color.d.ts.map +0 -1
- package/dist/agent-color.js +0 -124
- package/dist/agent-color.js.map +0 -1
- package/dist/agent-file-toggle.d.ts +0 -126
- package/dist/agent-file-toggle.d.ts.map +0 -1
- package/dist/agent-file-toggle.js +0 -259
- package/dist/agent-file-toggle.js.map +0 -1
- package/dist/agent-history-list.d.ts +0 -19
- package/dist/agent-history-list.d.ts.map +0 -1
- package/dist/agent-history-list.js +0 -69
- package/dist/agent-history-list.js.map +0 -1
- package/dist/agent-history.d.ts +0 -35
- package/dist/agent-history.d.ts.map +0 -1
- package/dist/agent-history.js +0 -188
- package/dist/agent-history.js.map +0 -1
- package/dist/agent-manager.d.ts +0 -503
- package/dist/agent-manager.d.ts.map +0 -1
- package/dist/agent-manager.js +0 -1572
- package/dist/agent-manager.js.map +0 -1
- package/dist/agent-recovery.d.ts +0 -37
- package/dist/agent-recovery.d.ts.map +0 -1
- package/dist/agent-recovery.js +0 -171
- package/dist/agent-recovery.js.map +0 -1
- package/dist/agent-runner.d.ts +0 -303
- package/dist/agent-runner.d.ts.map +0 -1
- package/dist/agent-runner.js +0 -1003
- package/dist/agent-runner.js.map +0 -1
- package/dist/agent-types.d.ts +0 -120
- package/dist/agent-types.d.ts.map +0 -1
- package/dist/agent-types.js +0 -301
- package/dist/agent-types.js.map +0 -1
- package/dist/child-context.d.ts +0 -3
- package/dist/child-context.d.ts.map +0 -1
- package/dist/child-context.js +0 -13
- package/dist/child-context.js.map +0 -1
- package/dist/context.d.ts +0 -13
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -57
- package/dist/context.js.map +0 -1
- package/dist/cross-extension-rpc.d.ts +0 -67
- package/dist/cross-extension-rpc.d.ts.map +0 -1
- package/dist/cross-extension-rpc.js +0 -139
- package/dist/cross-extension-rpc.js.map +0 -1
- package/dist/custom-agents.d.ts +0 -55
- package/dist/custom-agents.d.ts.map +0 -1
- package/dist/custom-agents.js +0 -309
- package/dist/custom-agents.js.map +0 -1
- package/dist/default-agents.d.ts +0 -8
- package/dist/default-agents.d.ts.map +0 -1
- package/dist/default-agents.js +0 -123
- package/dist/default-agents.js.map +0 -1
- package/dist/enabled-models.d.ts +0 -50
- package/dist/enabled-models.d.ts.map +0 -1
- package/dist/enabled-models.js +0 -146
- package/dist/enabled-models.js.map +0 -1
- package/dist/env.d.ts +0 -7
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js +0 -29
- package/dist/env.js.map +0 -1
- package/dist/group-join.d.ts +0 -33
- package/dist/group-join.d.ts.map +0 -1
- package/dist/group-join.js +0 -117
- package/dist/group-join.js.map +0 -1
- package/dist/index.d.ts +0 -51
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3687
- package/dist/index.js.map +0 -1
- package/dist/invocation-config.d.ts +0 -108
- package/dist/invocation-config.d.ts.map +0 -1
- package/dist/invocation-config.js +0 -84
- package/dist/invocation-config.js.map +0 -1
- package/dist/memory.d.ts +0 -54
- package/dist/memory.d.ts.map +0 -1
- package/dist/memory.js +0 -166
- package/dist/memory.js.map +0 -1
- package/dist/mention-clone.d.ts +0 -88
- package/dist/mention-clone.d.ts.map +0 -1
- package/dist/mention-clone.js +0 -154
- package/dist/mention-clone.js.map +0 -1
- package/dist/mention.d.ts +0 -82
- package/dist/mention.d.ts.map +0 -1
- package/dist/mention.js +0 -132
- package/dist/mention.js.map +0 -1
- package/dist/model-resolver.d.ts +0 -37
- package/dist/model-resolver.d.ts.map +0 -1
- package/dist/model-resolver.js +0 -96
- package/dist/model-resolver.js.map +0 -1
- package/dist/model-scope.d.ts +0 -50
- package/dist/model-scope.d.ts.map +0 -1
- package/dist/model-scope.js +0 -49
- package/dist/model-scope.js.map +0 -1
- package/dist/nested-tools.d.ts +0 -57
- package/dist/nested-tools.d.ts.map +0 -1
- package/dist/nested-tools.js +0 -301
- package/dist/nested-tools.js.map +0 -1
- package/dist/nico-overrides.d.ts +0 -54
- package/dist/nico-overrides.d.ts.map +0 -1
- package/dist/nico-overrides.js +0 -170
- package/dist/nico-overrides.js.map +0 -1
- package/dist/output-file.d.ts +0 -44
- package/dist/output-file.d.ts.map +0 -1
- package/dist/output-file.js +0 -156
- package/dist/output-file.js.map +0 -1
- package/dist/prompts.d.ts +0 -56
- package/dist/prompts.d.ts.map +0 -1
- package/dist/prompts.js +0 -92
- package/dist/prompts.js.map +0 -1
- package/dist/schedule-store.d.ts +0 -39
- package/dist/schedule-store.d.ts.map +0 -1
- package/dist/schedule-store.js +0 -156
- package/dist/schedule-store.js.map +0 -1
- package/dist/schedule.d.ts +0 -110
- package/dist/schedule.d.ts.map +0 -1
- package/dist/schedule.js +0 -360
- package/dist/schedule.js.map +0 -1
- package/dist/settings.d.ts +0 -354
- package/dist/settings.d.ts.map +0 -1
- package/dist/settings.js +0 -247
- package/dist/settings.js.map +0 -1
- package/dist/skill-loader.d.ts +0 -25
- package/dist/skill-loader.d.ts.map +0 -1
- package/dist/skill-loader.js +0 -94
- package/dist/skill-loader.js.map +0 -1
- package/dist/status-note.d.ts +0 -62
- package/dist/status-note.d.ts.map +0 -1
- package/dist/status-note.js +0 -86
- package/dist/status-note.js.map +0 -1
- package/dist/structured-output.d.ts +0 -62
- package/dist/structured-output.d.ts.map +0 -1
- package/dist/structured-output.js +0 -113
- package/dist/structured-output.js.map +0 -1
- package/dist/types.d.ts +0 -372
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -6
- package/dist/types.js.map +0 -1
- package/dist/ui/agent-mention.d.ts +0 -83
- package/dist/ui/agent-mention.d.ts.map +0 -1
- package/dist/ui/agent-mention.js +0 -188
- package/dist/ui/agent-mention.js.map +0 -1
- package/dist/ui/agent-widget.d.ts +0 -241
- package/dist/ui/agent-widget.d.ts.map +0 -1
- package/dist/ui/agent-widget.js +0 -992
- package/dist/ui/agent-widget.js.map +0 -1
- package/dist/ui/ccstyle/diff/ansi-utils.d.ts +0 -11
- package/dist/ui/ccstyle/diff/ansi-utils.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/ansi-utils.js +0 -145
- package/dist/ui/ccstyle/diff/ansi-utils.js.map +0 -1
- package/dist/ui/ccstyle/diff/diff-presentation.d.ts +0 -12
- package/dist/ui/ccstyle/diff/diff-presentation.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/diff-presentation.js +0 -48
- package/dist/ui/ccstyle/diff/diff-presentation.js.map +0 -1
- package/dist/ui/ccstyle/diff/diff-renderer.d.ts +0 -46
- package/dist/ui/ccstyle/diff/diff-renderer.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/diff-renderer.js +0 -2049
- package/dist/ui/ccstyle/diff/diff-renderer.js.map +0 -1
- package/dist/ui/ccstyle/diff/line-width-safety.d.ts +0 -12
- package/dist/ui/ccstyle/diff/line-width-safety.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/line-width-safety.js +0 -58
- package/dist/ui/ccstyle/diff/line-width-safety.js.map +0 -1
- package/dist/ui/ccstyle/diff/render-utils.d.ts +0 -6
- package/dist/ui/ccstyle/diff/render-utils.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/render-utils.js +0 -25
- package/dist/ui/ccstyle/diff/render-utils.js.map +0 -1
- package/dist/ui/ccstyle/diff/shiki-highlight.d.ts +0 -19
- package/dist/ui/ccstyle/diff/shiki-highlight.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/shiki-highlight.js +0 -85
- package/dist/ui/ccstyle/diff/shiki-highlight.js.map +0 -1
- package/dist/ui/ccstyle/diff/types.d.ts +0 -22
- package/dist/ui/ccstyle/diff/types.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/types.js +0 -10
- package/dist/ui/ccstyle/diff/types.js.map +0 -1
- package/dist/ui/ccstyle/diff/write-display-utils.d.ts +0 -2
- package/dist/ui/ccstyle/diff/write-display-utils.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/write-display-utils.js +0 -12
- package/dist/ui/ccstyle/diff/write-display-utils.js.map +0 -1
- package/dist/ui/ccstyle/tool-renderer.d.ts +0 -17
- package/dist/ui/ccstyle/tool-renderer.d.ts.map +0 -1
- package/dist/ui/ccstyle/tool-renderer.js +0 -74
- package/dist/ui/ccstyle/tool-renderer.js.map +0 -1
- package/dist/ui/ccstyle/tool-result.d.ts +0 -44
- package/dist/ui/ccstyle/tool-result.d.ts.map +0 -1
- package/dist/ui/ccstyle/tool-result.js +0 -423
- package/dist/ui/ccstyle/tool-result.js.map +0 -1
- package/dist/ui/conversation-blocks.d.ts +0 -46
- package/dist/ui/conversation-blocks.d.ts.map +0 -1
- package/dist/ui/conversation-blocks.js +0 -313
- package/dist/ui/conversation-blocks.js.map +0 -1
- package/dist/ui/conversation-nvim.d.ts +0 -8
- package/dist/ui/conversation-nvim.d.ts.map +0 -1
- package/dist/ui/conversation-nvim.js +0 -117
- package/dist/ui/conversation-nvim.js.map +0 -1
- package/dist/ui/conversation-role.d.ts +0 -13
- package/dist/ui/conversation-role.d.ts.map +0 -1
- package/dist/ui/conversation-role.js +0 -39
- package/dist/ui/conversation-role.js.map +0 -1
- package/dist/ui/conversation-search.d.ts +0 -39
- package/dist/ui/conversation-search.d.ts.map +0 -1
- package/dist/ui/conversation-search.js +0 -124
- package/dist/ui/conversation-search.js.map +0 -1
- package/dist/ui/conversation-timeline.d.ts +0 -102
- package/dist/ui/conversation-timeline.d.ts.map +0 -1
- package/dist/ui/conversation-timeline.js +0 -555
- package/dist/ui/conversation-timeline.js.map +0 -1
- package/dist/ui/conversation-viewer.d.ts +0 -138
- package/dist/ui/conversation-viewer.d.ts.map +0 -1
- package/dist/ui/conversation-viewer.js +0 -1175
- package/dist/ui/conversation-viewer.js.map +0 -1
- package/dist/ui/schedule-menu.d.ts +0 -17
- package/dist/ui/schedule-menu.d.ts.map +0 -1
- package/dist/ui/schedule-menu.js +0 -95
- package/dist/ui/schedule-menu.js.map +0 -1
- package/dist/ui/select-item.d.ts +0 -28
- package/dist/ui/select-item.d.ts.map +0 -1
- package/dist/ui/select-item.js +0 -35
- package/dist/ui/select-item.js.map +0 -1
- package/dist/ui/viewer-keys.d.ts +0 -21
- package/dist/ui/viewer-keys.d.ts.map +0 -1
- package/dist/ui/viewer-keys.js +0 -18
- package/dist/ui/viewer-keys.js.map +0 -1
- package/dist/ui/workflow-card.d.ts +0 -176
- package/dist/ui/workflow-card.d.ts.map +0 -1
- package/dist/ui/workflow-card.js +0 -333
- package/dist/ui/workflow-card.js.map +0 -1
- package/dist/ui/workflow-dialog.d.ts +0 -306
- package/dist/ui/workflow-dialog.d.ts.map +0 -1
- package/dist/ui/workflow-dialog.js +0 -844
- package/dist/ui/workflow-dialog.js.map +0 -1
- package/dist/ui/workflow-menu.d.ts +0 -42
- package/dist/ui/workflow-menu.d.ts.map +0 -1
- package/dist/ui/workflow-menu.js +0 -127
- package/dist/ui/workflow-menu.js.map +0 -1
- package/dist/usage.d.ts +0 -136
- package/dist/usage.d.ts.map +0 -1
- package/dist/usage.js +0 -121
- package/dist/usage.js.map +0 -1
- package/dist/workflow/collisions.d.ts +0 -96
- package/dist/workflow/collisions.d.ts.map +0 -1
- package/dist/workflow/collisions.js +0 -89
- package/dist/workflow/collisions.js.map +0 -1
- package/dist/workflow/entry.d.ts +0 -33
- package/dist/workflow/entry.d.ts.map +0 -1
- package/dist/workflow/entry.js +0 -30
- package/dist/workflow/entry.js.map +0 -1
- package/dist/workflow/host.d.ts +0 -63
- package/dist/workflow/host.d.ts.map +0 -1
- package/dist/workflow/host.js +0 -363
- package/dist/workflow/host.js.map +0 -1
- package/dist/workflow/journal.d.ts +0 -98
- package/dist/workflow/journal.d.ts.map +0 -1
- package/dist/workflow/journal.js +0 -121
- package/dist/workflow/journal.js.map +0 -1
- package/dist/workflow/json-schema.d.ts +0 -52
- package/dist/workflow/json-schema.d.ts.map +0 -1
- package/dist/workflow/json-schema.js +0 -112
- package/dist/workflow/json-schema.js.map +0 -1
- package/dist/workflow/meta.d.ts +0 -68
- package/dist/workflow/meta.d.ts.map +0 -1
- package/dist/workflow/meta.js +0 -318
- package/dist/workflow/meta.js.map +0 -1
- package/dist/workflow/progress.d.ts +0 -225
- package/dist/workflow/progress.d.ts.map +0 -1
- package/dist/workflow/progress.js +0 -362
- package/dist/workflow/progress.js.map +0 -1
- package/dist/workflow/runtime.d.ts +0 -335
- package/dist/workflow/runtime.d.ts.map +0 -1
- package/dist/workflow/runtime.js +0 -831
- package/dist/workflow/runtime.js.map +0 -1
- package/dist/workflow/saved.d.ts +0 -91
- package/dist/workflow/saved.d.ts.map +0 -1
- package/dist/workflow/saved.js +0 -204
- package/dist/workflow/saved.js.map +0 -1
- package/dist/workflow/task.d.ts +0 -137
- package/dist/workflow/task.d.ts.map +0 -1
- package/dist/workflow/task.js +0 -208
- package/dist/workflow/task.js.map +0 -1
- package/dist/workflow/tool-description.d.ts +0 -39
- package/dist/workflow/tool-description.d.ts.map +0 -1
- package/dist/workflow/tool-description.js +0 -200
- package/dist/workflow/tool-description.js.map +0 -1
- package/dist/workflow/worker-source.d.ts +0 -48
- package/dist/workflow/worker-source.d.ts.map +0 -1
- package/dist/workflow/worker-source.js +0 -779
- package/dist/workflow/worker-source.js.map +0 -1
- package/dist/worktree.d.ts +0 -53
- package/dist/worktree.d.ts.map +0 -1
- package/dist/worktree.js +0 -165
- package/dist/worktree.js.map +0 -1
- package/dist/write-execution.d.ts +0 -42
- package/dist/write-execution.d.ts.map +0 -1
- package/dist/write-execution.js +0 -138
- package/dist/write-execution.js.map +0 -1
- package/dist/xml.d.ts +0 -11
- package/dist/xml.d.ts.map +0 -1
- package/dist/xml.js +0 -13
- package/dist/xml.js.map +0 -1
- package/src/abortable.ts +0 -43
- package/src/agent-color.ts +0 -161
- package/src/agent-file-toggle.ts +0 -269
- package/src/child-context.ts +0 -15
- package/src/mention-clone.ts +0 -196
- package/src/mention.ts +0 -141
- package/src/model-scope.ts +0 -70
- package/src/nested-tools.ts +0 -424
- package/src/structured-output.ts +0 -130
- package/src/ui/agent-mention.ts +0 -216
- package/src/ui/select-item.ts +0 -45
- package/src/ui/workflow-card.ts +0 -470
- package/src/ui/workflow-dialog.ts +0 -1115
- package/src/ui/workflow-menu.ts +0 -166
- package/src/workflow/collisions.ts +0 -123
- package/src/workflow/entry.ts +0 -47
- package/src/workflow/host.ts +0 -403
- package/src/workflow/journal.ts +0 -164
- package/src/workflow/json-schema.ts +0 -128
- package/src/workflow/meta.ts +0 -325
- package/src/workflow/progress.ts +0 -550
- package/src/workflow/runtime.ts +0 -1219
- package/src/workflow/saved.ts +0 -217
- package/src/workflow/task.ts +0 -302
- package/src/workflow/tool-description.ts +0 -200
- package/src/workflow/worker-source.ts +0 -781
- package/src/xml.ts +0 -13
package/src/types.ts
CHANGED
|
@@ -17,26 +17,13 @@ export const DEFAULT_AGENT_NAMES = ["general-purpose", "Explore", "Plan"] as con
|
|
|
17
17
|
/** Memory scope for persistent agent memory. */
|
|
18
18
|
export type MemoryScope = "user" | "project" | "local";
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
* `"off"` exists for the caller's benefit, not the runtime's: models that fill
|
|
24
|
-
* every optional parameter had no legal way to decline a single-value
|
|
25
|
-
* `isolation` field and kept spawning worktrees they had just reasoned their
|
|
26
|
-
* way out of (#231, #184). It is an input spelling only —
|
|
27
|
-
* `resolveAgentInvocationConfig` collapses it to `undefined`, so nothing
|
|
28
|
-
* downstream sees a value other than `"worktree"`. In an agent file it is a
|
|
29
|
-
* genuine veto, since agent config outranks tool-call params.
|
|
30
|
-
*/
|
|
31
|
-
export type IsolationMode = "worktree" | "off";
|
|
20
|
+
/** Isolation mode for agent execution. */
|
|
21
|
+
export type IsolationMode = "worktree";
|
|
32
22
|
|
|
33
23
|
/** Unified agent configuration — used for both default and user-defined agents. */
|
|
34
24
|
export interface AgentConfig {
|
|
35
25
|
name: string;
|
|
36
|
-
/** UI name. `display_name` wins; Claude Code's `name` is accepted as a fallback. */
|
|
37
26
|
displayName?: string;
|
|
38
|
-
/** Claude Code-compatible name color (named color or #RRGGBB). */
|
|
39
|
-
color?: string;
|
|
40
27
|
description: string;
|
|
41
28
|
builtinToolNames?: string[];
|
|
42
29
|
/** Raw `ext:` selector entries from the `tools:` CSV, e.g. ["ext:foo", "ext:bar/x"].
|
|
@@ -60,11 +47,6 @@ export interface AgentConfig {
|
|
|
60
47
|
outputTranscript?: boolean;
|
|
61
48
|
/** Optional session directory used when persistSession is true. Omitted = pi's normal session location. */
|
|
62
49
|
sessionDir?: string;
|
|
63
|
-
/**
|
|
64
|
-
* Nested delegation, off by default: undefined = no nested tools;
|
|
65
|
-
* "all" = any enabled agent; string[] = only those agent types.
|
|
66
|
-
*/
|
|
67
|
-
allowedSubagents?: "all" | string[];
|
|
68
50
|
systemPrompt: string;
|
|
69
51
|
promptMode: "replace" | "append";
|
|
70
52
|
/** Default for spawn: fork parent conversation. undefined = caller decides. */
|
|
@@ -75,10 +57,7 @@ export interface AgentConfig {
|
|
|
75
57
|
isolated?: boolean;
|
|
76
58
|
/** Persistent memory scope — agents with memory get a persistent directory and MEMORY.md */
|
|
77
59
|
memory?: MemoryScope;
|
|
78
|
-
/**
|
|
79
|
-
* Isolation mode — "worktree" runs the agent in a temporary git worktree,
|
|
80
|
-
* "off" refuses one even when the caller asks (frontmatter outranks params).
|
|
81
|
-
*/
|
|
60
|
+
/** Isolation mode — "worktree" runs the agent in a temporary git worktree */
|
|
82
61
|
isolation?: IsolationMode;
|
|
83
62
|
/** true = this is an embedded default agent (informational) */
|
|
84
63
|
isDefault?: boolean;
|
|
@@ -86,8 +65,6 @@ export interface AgentConfig {
|
|
|
86
65
|
enabled?: boolean;
|
|
87
66
|
/** Where this agent was loaded from */
|
|
88
67
|
source?: "default" | "project" | "global";
|
|
89
|
-
/** Path of the .md it was loaded from. Unset for embedded defaults. */
|
|
90
|
-
sourcePath?: string;
|
|
91
68
|
}
|
|
92
69
|
|
|
93
70
|
export type JoinMode = 'async' | 'group' | 'smart';
|
|
@@ -101,75 +78,9 @@ export type JoinMode = 'async' | 'group' | 'smart';
|
|
|
101
78
|
*/
|
|
102
79
|
export type WidgetMode = 'all' | 'background' | 'off';
|
|
103
80
|
|
|
104
|
-
/**
|
|
105
|
-
* How much of the conversation viewer's transcript is rendered as Markdown.
|
|
106
|
-
* - `off`: every line wraps as literal text, as it did before the mode existed.
|
|
107
|
-
* - `assistant`: assistant text renders as Markdown; tool results stay verbatim
|
|
108
|
-
* and dim. The default, because assistant text *is* Markdown by contract
|
|
109
|
-
* while a tool result is arbitrary bytes — a Markdown pass over a log or a
|
|
110
|
-
* diff eats `#` from shell comments, swallows a `---` line into a setext
|
|
111
|
-
* heading, re-fences indented output and redraws `| a | b |` as a table.
|
|
112
|
-
* (Ordered-list renumbering is the one such rewrite actively suppressed —
|
|
113
|
-
* see `MARKDOWN_OPTIONS` — because it silently changes data, not layout.)
|
|
114
|
-
* - `all`: tool results render as Markdown too, for tools that genuinely emit
|
|
115
|
-
* it (#210's `ctx_execute`), accepting the rewrites above on ones that don't.
|
|
116
|
-
*/
|
|
117
|
-
export type ViewerMarkdownMode = 'off' | 'assistant' | 'all';
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* How `@handle message` starts an agent that is not already running.
|
|
121
|
-
* - `model`: inject Claude Code's `agent_mention` reminder and let the main
|
|
122
|
-
* model spawn it with the `Agent` tool, which is what Claude Code does.
|
|
123
|
-
* - `direct`: spawn it here, immediately, with the typed message as its prompt
|
|
124
|
-
* and no main-model turn spent.
|
|
125
|
-
* - `off`: `@` means only "attach a file" again.
|
|
126
|
-
*
|
|
127
|
-
* Messaging a running agent and resuming a finished one are direct in every
|
|
128
|
-
* mode — Claude Code only differs from us on the *new* invocation.
|
|
129
|
-
*/
|
|
130
|
-
export type AgentMentionMode = 'model' | 'direct' | 'off';
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* What survives a record's eviction so `@handle` keeps working. The live record
|
|
134
|
-
* is discarded after ~10 minutes, but the pi session it wrote is still on disk,
|
|
135
|
-
* and this is the little that is needed to find and describe it again.
|
|
136
|
-
*/
|
|
137
|
-
export interface AgentTombstone {
|
|
138
|
-
handle: string;
|
|
139
|
-
alias?: string;
|
|
140
|
-
id: string;
|
|
141
|
-
type: SubagentType;
|
|
142
|
-
description: string;
|
|
143
|
-
/** Always set — a record with no session file is never tombstoned. */
|
|
144
|
-
sessionFile: string;
|
|
145
|
-
completedAt: number;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* What `@handle` resolved to: an agent still in memory, or the remains of one
|
|
150
|
-
* whose conversation can be reopened from disk.
|
|
151
|
-
*/
|
|
152
|
-
export type MentionResolution =
|
|
153
|
-
| { kind: "live"; record: AgentRecord }
|
|
154
|
-
| { kind: "tombstone"; entry: AgentTombstone };
|
|
155
|
-
|
|
156
81
|
export interface AgentRecord {
|
|
157
82
|
id: string;
|
|
158
83
|
type: SubagentType;
|
|
159
|
-
/**
|
|
160
|
-
* Typeable name for the `@handle message` prompt mention, derived from the
|
|
161
|
-
* agent type and numbered when siblings collide (`explore`, `explore-2`).
|
|
162
|
-
* Top-level agents only — nested children are hidden from every top-level
|
|
163
|
-
* surface, so nothing can address them.
|
|
164
|
-
*/
|
|
165
|
-
handle?: string;
|
|
166
|
-
/**
|
|
167
|
-
* A second, memorable handle from the spawner's `name` (`@auth-audit`), drawn
|
|
168
|
-
* from the same namespace as `handle` so the two can never collide. Purely
|
|
169
|
-
* additive: `handle` is assigned regardless, so a named agent stays reachable
|
|
170
|
-
* by its type and `@explore` never comes to mean "start another one".
|
|
171
|
-
*/
|
|
172
|
-
alias?: string;
|
|
173
84
|
description: string;
|
|
174
85
|
status: "queued" | "running" | "completed" | "steered" | "aborted" | "stopped" | "error";
|
|
175
86
|
result?: string;
|
|
@@ -180,22 +91,6 @@ export interface AgentRecord {
|
|
|
180
91
|
session?: AgentSession;
|
|
181
92
|
abortController?: AbortController;
|
|
182
93
|
promise?: Promise<string>;
|
|
183
|
-
/**
|
|
184
|
-
* A caller is awaiting this agent inline (`spawnAndWait`) — what
|
|
185
|
-
* `maxConcurrentForeground` bounds. Distinct from `isBackground === false`,
|
|
186
|
-
* which says only that the agent has an inline result surface: a detached
|
|
187
|
-
* cross-extension RPC spawn is foreground by that measure and yet blocks
|
|
188
|
-
* nobody, so it takes no slot.
|
|
189
|
-
*/
|
|
190
|
-
blocking?: boolean;
|
|
191
|
-
/**
|
|
192
|
-
* Present only while the record is "queued": resolves when it leaves the
|
|
193
|
-
* queue, started or aborted. `spawnAndWait` waits on this because a queued
|
|
194
|
-
* record has no `promise` yet. Always resolves, never rejects — a rejection
|
|
195
|
-
* would escape into the caller's tool `execute` and take down pi's whole
|
|
196
|
-
* Promise.all tool batch.
|
|
197
|
-
*/
|
|
198
|
-
startGate?: Promise<void>;
|
|
199
94
|
groupId?: string;
|
|
200
95
|
joinMode?: JoinMode;
|
|
201
96
|
/** Set when result was already consumed via get_subagent_result — suppresses completion notification. */
|
|
@@ -214,17 +109,8 @@ export interface AgentRecord {
|
|
|
214
109
|
historyFile?: string;
|
|
215
110
|
/** Project-relative durable transcript path persisted in the parent session. */
|
|
216
111
|
transcriptPath?: string;
|
|
217
|
-
/**
|
|
218
|
-
* The agent's pi session file, when it was persisted (`persist_session`, or
|
|
219
|
-
* the `rememberAgents` default). Captured so a mention can reopen the
|
|
220
|
-
* conversation after the record itself has been evicted; undefined for an
|
|
221
|
-
* in-memory session, which leaves nothing to reopen.
|
|
222
|
-
*/
|
|
223
|
-
sessionFile?: string;
|
|
224
|
-
/** Cleanup function for the optional `.output` stream subscription. */
|
|
112
|
+
/** Cleanup function for the output file stream subscription. */
|
|
225
113
|
outputCleanup?: () => void;
|
|
226
|
-
/** Cleanup function for the mandatory durable `.pi-subagents` history stream. */
|
|
227
|
-
historyCleanup?: () => void;
|
|
228
114
|
/**
|
|
229
115
|
* Lifetime usage breakdown, accumulated via `message_end` events. Survives
|
|
230
116
|
* compaction. Total = input + output + cacheWrite (cacheRead deliberately
|
|
@@ -246,63 +132,16 @@ export interface AgentRecord {
|
|
|
246
132
|
isBackground?: boolean;
|
|
247
133
|
/** Resolved spawn params, captured for UI display. Fixed at spawn time. */
|
|
248
134
|
invocation?: AgentInvocation;
|
|
249
|
-
/** Nesting depth: top-level subagent = 1. */
|
|
250
|
-
depth?: number;
|
|
251
|
-
/**
|
|
252
|
-
* The validated `StructuredOutput` payload, as canonical JSON.
|
|
253
|
-
*
|
|
254
|
-
* Set only when the spawn asked for a schema. Separate from `result` because
|
|
255
|
-
* `result` is prose for a reader — previewed in the widget, written to the
|
|
256
|
-
* transcript, and appended to with the worktree branch note — and JSON that
|
|
257
|
-
* has been appended to no longer parses.
|
|
258
|
-
*/
|
|
259
|
-
structuredJson?: string;
|
|
260
|
-
/** Whether the child needed the extra structured-output prompt. */
|
|
261
|
-
structuredRetried?: boolean;
|
|
262
|
-
/** Parent agent ID for ownership-scoped nested controls. */
|
|
263
|
-
parentAgentId?: string;
|
|
264
|
-
/**
|
|
265
|
-
* The workflow run that owns this child, when a workflow spawned it.
|
|
266
|
-
*
|
|
267
|
-
* Owned the same way a nested child is owned by its parent: filtered out of
|
|
268
|
-
* every top-level surface, and outside the `maxConcurrent` pool. See
|
|
269
|
-
* `isTopLevelAgent`.
|
|
270
|
-
*/
|
|
271
|
-
workflowId?: string;
|
|
272
|
-
/** Effective inherited nesting cap for this branch. */
|
|
273
|
-
maxSubagentDepth?: number;
|
|
274
|
-
/**
|
|
275
|
-
* Session id of the root (main) session this branch descends from. Nested
|
|
276
|
-
* spawns inherit it so their transcripts file under the same session
|
|
277
|
-
* directory as their ancestors' instead of the child session's own id.
|
|
278
|
-
*/
|
|
279
|
-
rootSessionId?: string;
|
|
280
135
|
}
|
|
281
136
|
|
|
282
|
-
/**
|
|
283
|
-
* What a session reports as its level: pi's `ThinkingLevel` plus the `"off"` a
|
|
284
|
-
* model with thinking disabled reports. Display-only — spawning still takes a
|
|
285
|
-
* `ThinkingLevel`, so this widening cannot leak into an invocation.
|
|
286
|
-
*/
|
|
287
|
-
export type EffectiveThinkingLevel = ThinkingLevel | "off";
|
|
288
|
-
|
|
289
137
|
export interface AgentInvocation {
|
|
290
|
-
/** Short display name
|
|
138
|
+
/** Short display name, e.g. "haiku" — only set when different from parent. */
|
|
291
139
|
modelName?: string;
|
|
292
|
-
/**
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
* What the caller asked for, kept only when they did not get it — pi clamped
|
|
298
|
-
* the level to the model's capabilities, or an agent file's frontmatter
|
|
299
|
-
* outranked the parameter (#182). The snapshot exists to answer "did the spawn
|
|
300
|
-
* honor my instructions?" (#62), which it cannot do if the request is lost, so
|
|
301
|
-
* neither `requested*` field is overwritten once set.
|
|
302
|
-
*/
|
|
303
|
-
requestedThinking?: EffectiveThinkingLevel;
|
|
304
|
-
/** The caller's `model` parameter, as written, when an agent file's pin won. */
|
|
305
|
-
requestedModel?: string;
|
|
140
|
+
/** Effective model captured from the child session, including inherited models. */
|
|
141
|
+
effectiveModelName?: string;
|
|
142
|
+
/** Requested/ effective thinking level. */
|
|
143
|
+
effectiveThinking?: AgentSession["thinkingLevel"];
|
|
144
|
+
thinking?: ThinkingLevel;
|
|
306
145
|
maxTurns?: number;
|
|
307
146
|
isolated?: boolean;
|
|
308
147
|
inheritContext?: boolean;
|
|
@@ -319,12 +158,6 @@ export interface NotificationDetails {
|
|
|
319
158
|
turnCount: number;
|
|
320
159
|
maxTurns?: number;
|
|
321
160
|
totalTokens: number;
|
|
322
|
-
/**
|
|
323
|
-
* Estimated cost in USD, from pi's per-message `usage.cost.total`. Always
|
|
324
|
-
* populated (0 when the model has no pricing); the renderer decides whether
|
|
325
|
-
* to show it, per the `showCost` setting.
|
|
326
|
-
*/
|
|
327
|
-
totalCost?: number;
|
|
328
161
|
durationMs: number;
|
|
329
162
|
outputFile?: string;
|
|
330
163
|
error?: string;
|