@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/dist/model-resolver.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model resolution: exact match ("provider/modelId") with fuzzy fallback.
|
|
3
|
-
*/
|
|
4
|
-
export interface ModelEntry {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
provider: string;
|
|
8
|
-
}
|
|
9
|
-
export interface ModelRegistry {
|
|
10
|
-
find(provider: string, modelId: string): any;
|
|
11
|
-
getAll(): any[];
|
|
12
|
-
getAvailable?(): any[];
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Both display forms of a model. The short one goes on tight rows (the widget,
|
|
16
|
-
* the Agent tool result), the canonical one where there is room to disambiguate
|
|
17
|
-
* two providers serving a similarly-named model (the conversation viewer).
|
|
18
|
-
*
|
|
19
|
-
* One function, because `index.ts` labels the model it resolved before the run
|
|
20
|
-
* and `agent-manager.ts` relabels it from the live session afterwards — the two
|
|
21
|
-
* must agree or the label would visibly change the moment the session starts.
|
|
22
|
-
*/
|
|
23
|
-
export declare function describeModel(model: {
|
|
24
|
-
provider: string;
|
|
25
|
-
id: string;
|
|
26
|
-
name?: string;
|
|
27
|
-
}): {
|
|
28
|
-
modelName: string;
|
|
29
|
-
modelId: string;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Resolve a model string to a Model instance.
|
|
33
|
-
* Tries exact match first ("provider/modelId"), then fuzzy match against all available models.
|
|
34
|
-
* Returns the Model on success, or an error message string on failure.
|
|
35
|
-
*/
|
|
36
|
-
export declare function resolveModel(input: string, registry: ModelRegistry): any | string;
|
|
37
|
-
//# sourceMappingURL=model-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-resolver.d.ts","sourceRoot":"","sources":["../src/model-resolver.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC;IAC7C,MAAM,IAAI,GAAG,EAAE,CAAC;IAChB,YAAY,CAAC,IAAI,GAAG,EAAE,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAKxC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,aAAa,GACtB,GAAG,GAAG,MAAM,CA2Ed"}
|
package/dist/model-resolver.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model resolution: exact match ("provider/modelId") with fuzzy fallback.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Both display forms of a model. The short one goes on tight rows (the widget,
|
|
6
|
-
* the Agent tool result), the canonical one where there is room to disambiguate
|
|
7
|
-
* two providers serving a similarly-named model (the conversation viewer).
|
|
8
|
-
*
|
|
9
|
-
* One function, because `index.ts` labels the model it resolved before the run
|
|
10
|
-
* and `agent-manager.ts` relabels it from the live session afterwards — the two
|
|
11
|
-
* must agree or the label would visibly change the moment the session starts.
|
|
12
|
-
*/
|
|
13
|
-
export function describeModel(model) {
|
|
14
|
-
return {
|
|
15
|
-
modelName: (model.name ?? model.id).replace(/^Claude\s+/i, "").toLowerCase(),
|
|
16
|
-
modelId: `${model.provider}/${model.id}`,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Resolve a model string to a Model instance.
|
|
21
|
-
* Tries exact match first ("provider/modelId"), then fuzzy match against all available models.
|
|
22
|
-
* Returns the Model on success, or an error message string on failure.
|
|
23
|
-
*/
|
|
24
|
-
export function resolveModel(input, registry) {
|
|
25
|
-
// Available models (those with auth configured)
|
|
26
|
-
const all = (registry.getAvailable?.() ?? registry.getAll());
|
|
27
|
-
const availableSet = new Set(all.map(m => `${m.provider}/${m.id}`.toLowerCase()));
|
|
28
|
-
// 1. Exact match: "provider/modelId" — only if available (has auth)
|
|
29
|
-
const slashIdx = input.indexOf("/");
|
|
30
|
-
if (slashIdx !== -1) {
|
|
31
|
-
const provider = input.slice(0, slashIdx);
|
|
32
|
-
const modelId = input.slice(slashIdx + 1);
|
|
33
|
-
if (availableSet.has(input.toLowerCase())) {
|
|
34
|
-
const found = registry.find(provider, modelId);
|
|
35
|
-
if (found)
|
|
36
|
-
return found;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// 2. Fuzzy match against available models. Normalize separators so cosmetic
|
|
40
|
-
// punctuation differences still match — e.g. "claude-haiku-4.5" and
|
|
41
|
-
// "claude-haiku-4-5" (dot vs dash in the version) resolve to the same model.
|
|
42
|
-
const normalize = (s) => s.toLowerCase().replace(/\./g, "-");
|
|
43
|
-
const query = normalize(input);
|
|
44
|
-
// Score each model: prefer exact id match > id contains > name contains > provider+id contains
|
|
45
|
-
let bestMatch;
|
|
46
|
-
let bestScore = 0;
|
|
47
|
-
for (const m of all) {
|
|
48
|
-
const id = normalize(m.id);
|
|
49
|
-
const name = normalize(m.name);
|
|
50
|
-
const full = normalize(`${m.provider}/${m.id}`);
|
|
51
|
-
let score = 0;
|
|
52
|
-
if (id === query || full === query) {
|
|
53
|
-
score = 100; // exact
|
|
54
|
-
}
|
|
55
|
-
else if (id.includes(query) || full.includes(query)) {
|
|
56
|
-
score = 60 + (query.length / id.length) * 30; // substring, prefer tighter matches
|
|
57
|
-
}
|
|
58
|
-
else if (name.includes(query)) {
|
|
59
|
-
score = 40 + (query.length / name.length) * 20;
|
|
60
|
-
}
|
|
61
|
-
else if (
|
|
62
|
-
// A trailing date-stamp token (e.g. "20251001") is optional, so a
|
|
63
|
-
// date-pinned config like "claude-haiku-4-5-20251001" still matches an
|
|
64
|
-
// undated registry id like "claude-haiku-4-5".
|
|
65
|
-
query
|
|
66
|
-
.split(/[\s\-/]+/)
|
|
67
|
-
.every(part => /^\d{8}$/.test(part) || id.includes(part) || name.includes(part) || m.provider.toLowerCase().includes(part))) {
|
|
68
|
-
score = 20; // all parts present somewhere
|
|
69
|
-
}
|
|
70
|
-
if (score > bestScore) {
|
|
71
|
-
bestScore = score;
|
|
72
|
-
bestMatch = m;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (bestMatch && bestScore >= 20) {
|
|
76
|
-
const found = registry.find(bestMatch.provider, bestMatch.id);
|
|
77
|
-
if (found)
|
|
78
|
-
return found;
|
|
79
|
-
}
|
|
80
|
-
// 3. Provider fallback: a "provider/modelId" query that didn't match under the
|
|
81
|
-
// named provider (exact or fuzzy above) retries against all providers. The
|
|
82
|
-
// named provider is preferred when present; this only kicks in when it isn't,
|
|
83
|
-
// so the same model from another provider beats falling back to "inherit".
|
|
84
|
-
if (slashIdx !== -1) {
|
|
85
|
-
const bare = resolveModel(input.slice(slashIdx + 1), registry);
|
|
86
|
-
if (typeof bare !== "string")
|
|
87
|
-
return bare;
|
|
88
|
-
}
|
|
89
|
-
// 4. No match — list available models
|
|
90
|
-
const modelList = all
|
|
91
|
-
.map(m => ` ${m.provider}/${m.id}`)
|
|
92
|
-
.sort()
|
|
93
|
-
.join("\n");
|
|
94
|
-
return `Model not found: "${input}".\n\nAvailable models:\n${modelList}`;
|
|
95
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nC,IAAI,EAAE;SACN,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,qBAAqB,KAAK,4BAA4B,SAAS,EAAE,CAAC;AAC3E,CAAC"}
|
package/dist/model-scope.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* model-scope.ts — `scopeModels` policy, shared by the top-level Agent tool and
|
|
3
|
-
* the nested delegation tools so a nested spawn can't escape the allowlist the
|
|
4
|
-
* top-level path enforces.
|
|
5
|
-
*
|
|
6
|
-
* State lives here (rather than in an index.ts closure) for the same reason
|
|
7
|
-
* `disableDefaults` lives in agent-types.ts: both entry points need it.
|
|
8
|
-
*/
|
|
9
|
-
import { type ModelRegistryRef } from "./enabled-models.js";
|
|
10
|
-
export declare function isScopeModelsEnabled(): boolean;
|
|
11
|
-
export declare function setScopeModelsEnabled(enabled: boolean): void;
|
|
12
|
-
export type ModelScopeVerdict =
|
|
13
|
-
/** In scope, or nothing to validate against (feature off / no allowlist). */
|
|
14
|
-
{
|
|
15
|
-
kind: "ok";
|
|
16
|
-
}
|
|
17
|
-
/** Caller-supplied out-of-scope choice — refuse the spawn with this message. */
|
|
18
|
-
| {
|
|
19
|
-
kind: "error";
|
|
20
|
-
message: string;
|
|
21
|
-
}
|
|
22
|
-
/** Frontmatter-pinned or parent-inherited — proceed, but tell the user. */
|
|
23
|
-
| {
|
|
24
|
-
kind: "warn";
|
|
25
|
-
message: string;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Check the effective resolved model against the user's enabledModels list.
|
|
29
|
-
*
|
|
30
|
-
* scopeModels guards against *runtime* LLM choices, not user-level config:
|
|
31
|
-
* - Caller-supplied out-of-scope → hard error (the orchestrator made an explicit
|
|
32
|
-
* out-of-scope choice; surface it so it picks differently).
|
|
33
|
-
* - Frontmatter-pinned or parent-inherited out-of-scope → warn but proceed (the
|
|
34
|
-
* user authored/installed this agent or chose the parent's model; trust it).
|
|
35
|
-
*/
|
|
36
|
-
export declare function checkModelScope(args: {
|
|
37
|
-
model: {
|
|
38
|
-
provider: string;
|
|
39
|
-
id: string;
|
|
40
|
-
} | undefined;
|
|
41
|
-
cwd: string;
|
|
42
|
-
modelRegistry: ModelRegistryRef;
|
|
43
|
-
/** True when the model came from the tool call rather than frontmatter. */
|
|
44
|
-
callerSupplied: boolean;
|
|
45
|
-
/** Display name used in the warning toast. */
|
|
46
|
-
agentLabel: string;
|
|
47
|
-
/** The raw `model:` input, when there was one. */
|
|
48
|
-
modelInput?: string;
|
|
49
|
-
}): ModelScopeVerdict;
|
|
50
|
-
//# sourceMappingURL=model-scope.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-scope.d.ts","sourceRoot":"","sources":["../src/model-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAkB,KAAK,gBAAgB,EAA2C,MAAM,qBAAqB,CAAC;AAWrH,wBAAgB,oBAAoB,IAAI,OAAO,CAA+B;AAC9E,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAkC;AAE/F,MAAM,MAAM,iBAAiB;AAC3B,6EAA6E;AAC3E;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE;AAChB,gFAAgF;GAC9E;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AACpC,2EAA2E;GACzE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,gBAAgB,CAAC;IAChC,2EAA2E;IAC3E,cAAc,EAAE,OAAO,CAAC;IACxB,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,iBAAiB,CAmBpB"}
|
package/dist/model-scope.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* model-scope.ts — `scopeModels` policy, shared by the top-level Agent tool and
|
|
3
|
-
* the nested delegation tools so a nested spawn can't escape the allowlist the
|
|
4
|
-
* top-level path enforces.
|
|
5
|
-
*
|
|
6
|
-
* State lives here (rather than in an index.ts closure) for the same reason
|
|
7
|
-
* `disableDefaults` lives in agent-types.ts: both entry points need it.
|
|
8
|
-
*/
|
|
9
|
-
import { isModelInScope, readEnabledModels, resolveEnabledModels } from "./enabled-models.js";
|
|
10
|
-
/**
|
|
11
|
-
* When enabled, subagent model choices are validated against `enabledModels`
|
|
12
|
-
* from pi's settings — both global `<agentDir>/settings.json` and project-local
|
|
13
|
-
* `<cwd>/.pi/settings.json` (project overrides global). Off by default; opt-in
|
|
14
|
-
* via `/agents → Settings`. See the SubagentsSettings.scopeModels docstring for
|
|
15
|
-
* the hard-error vs warn-and-proceed policy and its rationale.
|
|
16
|
-
*/
|
|
17
|
-
let scopeModelsEnabled = false;
|
|
18
|
-
export function isScopeModelsEnabled() { return scopeModelsEnabled; }
|
|
19
|
-
export function setScopeModelsEnabled(enabled) { scopeModelsEnabled = enabled; }
|
|
20
|
-
/**
|
|
21
|
-
* Check the effective resolved model against the user's enabledModels list.
|
|
22
|
-
*
|
|
23
|
-
* scopeModels guards against *runtime* LLM choices, not user-level config:
|
|
24
|
-
* - Caller-supplied out-of-scope → hard error (the orchestrator made an explicit
|
|
25
|
-
* out-of-scope choice; surface it so it picks differently).
|
|
26
|
-
* - Frontmatter-pinned or parent-inherited out-of-scope → warn but proceed (the
|
|
27
|
-
* user authored/installed this agent or chose the parent's model; trust it).
|
|
28
|
-
*/
|
|
29
|
-
export function checkModelScope(args) {
|
|
30
|
-
const { model, cwd, modelRegistry, callerSupplied, agentLabel, modelInput } = args;
|
|
31
|
-
if (!scopeModelsEnabled || !model)
|
|
32
|
-
return { kind: "ok" };
|
|
33
|
-
const allowed = resolveEnabledModels(readEnabledModels(cwd), modelRegistry, cwd);
|
|
34
|
-
if (!allowed || isModelInScope(model, allowed))
|
|
35
|
-
return { kind: "ok" };
|
|
36
|
-
if (callerSupplied) {
|
|
37
|
-
const list = [...allowed].sort().map(m => ` ${m}`).join("\n");
|
|
38
|
-
return {
|
|
39
|
-
kind: "error",
|
|
40
|
-
message: `Model not in scope: "${modelInput}".\n\nAllowed models (from enabledModels):\n${list}`,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
const modelLabel = modelInput ?? `${model.provider}/${model.id}`;
|
|
44
|
-
return {
|
|
45
|
-
kind: "warn",
|
|
46
|
-
message: `Agent "${agentLabel}" using out-of-scope model "${modelLabel}"`,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=model-scope.js.map
|
package/dist/model-scope.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-scope.js","sourceRoot":"","sources":["../src/model-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAyB,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAErH;;;;;;GAMG;AACH,IAAI,kBAAkB,GAAG,KAAK,CAAC;AAE/B,MAAM,UAAU,oBAAoB,KAAc,OAAO,kBAAkB,CAAC,CAAC,CAAC;AAC9E,MAAM,UAAU,qBAAqB,CAAC,OAAgB,IAAU,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;AAU/F;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,IAU/B;IACC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IACnF,IAAI,CAAC,kBAAkB,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAEzD,MAAM,OAAO,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC;IACjF,IAAI,CAAC,OAAO,IAAI,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAEtE,IAAI,cAAc,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/D,OAAO;YACL,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,wBAAwB,UAAU,+CAA+C,IAAI,EAAE;SACjG,CAAC;IACJ,CAAC;IACD,MAAM,UAAU,GAAG,UAAU,IAAI,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC;IACjE,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,UAAU,UAAU,+BAA+B,UAAU,GAAG;KAC1E,CAAC;AACJ,CAAC"}
|
package/dist/nested-tools.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { Model } from "@earendil-works/pi-ai";
|
|
2
|
-
import { type AgentSession, type ExtensionAPI, type ExtensionContext, type ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import type { AgentInvocation, AgentRecord, IsolationMode, ThinkingLevel } from "./types.js";
|
|
4
|
-
export declare function getMaxSubagentDepth(): number;
|
|
5
|
-
export declare function setMaxSubagentDepth(n: number): void;
|
|
6
|
-
interface NestedSpawnOptions {
|
|
7
|
-
description: string;
|
|
8
|
-
model?: Model<any>;
|
|
9
|
-
maxTurns?: number;
|
|
10
|
-
isolated?: boolean;
|
|
11
|
-
inheritContext?: boolean;
|
|
12
|
-
thinkingLevel?: ThinkingLevel;
|
|
13
|
-
isBackground?: boolean;
|
|
14
|
-
isolation?: IsolationMode;
|
|
15
|
-
outputTranscript?: boolean;
|
|
16
|
-
invocation?: AgentInvocation;
|
|
17
|
-
signal?: AbortSignal;
|
|
18
|
-
onAssistantUsage?: (usage: {
|
|
19
|
-
input: number;
|
|
20
|
-
output: number;
|
|
21
|
-
cacheWrite: number;
|
|
22
|
-
}) => void;
|
|
23
|
-
onSessionCreated?: (session: AgentSession) => void;
|
|
24
|
-
depth: number;
|
|
25
|
-
parentAgentId: string;
|
|
26
|
-
maxSubagentDepth: number;
|
|
27
|
-
configCwd?: string;
|
|
28
|
-
rootSessionId?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface NestedAgentManager {
|
|
31
|
-
spawn(pi: ExtensionAPI, ctx: ExtensionContext, type: string, prompt: string, options: NestedSpawnOptions): string;
|
|
32
|
-
/** Resolves once the spawned agent is running; rejects on a startup failure. */
|
|
33
|
-
awaitStartup(id: string): Promise<void>;
|
|
34
|
-
spawnAndWait(pi: ExtensionAPI, ctx: ExtensionContext, type: string, prompt: string, options: Omit<NestedSpawnOptions, "isBackground">,
|
|
35
|
-
/** Fires synchronously after spawn, before the session exists — where the transcript is attached. */
|
|
36
|
-
onSpawned?: (id: string) => void): Promise<{
|
|
37
|
-
id: string;
|
|
38
|
-
record: AgentRecord;
|
|
39
|
-
}>;
|
|
40
|
-
getRecord(id: string): AgentRecord | undefined;
|
|
41
|
-
resume(id: string, prompt: string, signal?: AbortSignal): Promise<AgentRecord | undefined>;
|
|
42
|
-
}
|
|
43
|
-
export interface NestedToolContext {
|
|
44
|
-
manager: NestedAgentManager;
|
|
45
|
-
pi: ExtensionAPI;
|
|
46
|
-
parentAgentId: string;
|
|
47
|
-
depth: number;
|
|
48
|
-
maxSubagentDepth: number;
|
|
49
|
-
/** "all" = any enabled agent; string[] = only those types. Never empty. */
|
|
50
|
-
allowedSubagents: "all" | string[];
|
|
51
|
-
/** Root used for agent/config discovery; may differ from the agent's working directory. */
|
|
52
|
-
configCwd: string;
|
|
53
|
-
}
|
|
54
|
-
/** Build child-safe orchestration tools scoped to one parent agent instance. */
|
|
55
|
-
export declare function createNestedSubagentTools(context: NestedToolContext): ToolDefinition[];
|
|
56
|
-
export {};
|
|
57
|
-
//# sourceMappingURL=nested-tools.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nested-tools.d.ts","sourceRoot":"","sources":["../src/nested-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,iCAAiC,CAAC;AAqBzC,OAAO,KAAK,EAEV,eAAe,EACf,WAAW,EACX,aAAa,EACb,aAAa,EACd,MAAM,YAAY,CAAC;AAYpB,wBAAgB,mBAAmB,IAAI,MAAM,CAA6B;AAC1E,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAmD;AAIvG,UAAU,kBAAkB;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE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E,EAAE,YAAY,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,2EAA2E;IAC3E,gBAAgB,EAAE,KAAK,GAAG,MAAM,EAAE,CAAC;IACnC,2FAA2F;IAC3F,SAAS,EAAE,MAAM,CAAC;CACnB;AAwCD,gFAAgF;AAChF,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,EAAE,CAqRtF"}
|
package/dist/nested-tools.js
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import { defineTool, } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { Type } from "@sinclair/typebox";
|
|
3
|
-
import { abortable } from "./abortable.js";
|
|
4
|
-
import { buildAgentRegistry, getAgentConfigIn, getAvailableTypesIn, resolveEnabledTypeIn, resolveTypeIn, } from "./agent-types.js";
|
|
5
|
-
import { loadCustomAgents } from "./custom-agents.js";
|
|
6
|
-
import { isolationParam, resolveAgentInvocationConfig } from "./invocation-config.js";
|
|
7
|
-
import { resolveModel } from "./model-resolver.js";
|
|
8
|
-
import { checkModelScope } from "./model-scope.js";
|
|
9
|
-
import { createOutputFilePath, getOutputTranscriptDefault, streamToOutputFile, writeInitialEntry, } from "./output-file.js";
|
|
10
|
-
import { getForegroundOutcomeNote, getStatusNote, partialOutputSuffix } from "./status-note.js";
|
|
11
|
-
import { addUsage } from "./usage.js";
|
|
12
|
-
import { isWorktreeIsolationEnabled } from "./worktree.js";
|
|
13
|
-
/**
|
|
14
|
-
* Hard ceiling on nesting for every branch: main session = 0, its subagents = 1,
|
|
15
|
-
* their children = 2. `0`/`1` disables nesting entirely. Set from
|
|
16
|
-
* `subagents.json` (`maxSubagentDepth`). Read when a subagent session is built,
|
|
17
|
-
* so a change applies to sessions started after it.
|
|
18
|
-
*/
|
|
19
|
-
let maxSubagentDepth = 2;
|
|
20
|
-
export function getMaxSubagentDepth() { return maxSubagentDepth; }
|
|
21
|
-
export function setMaxSubagentDepth(n) { maxSubagentDepth = Math.max(0, Math.floor(n)); }
|
|
22
|
-
const NESTED_TOOL_NAMES = ["Agent", "get_subagent_result", "steer_subagent"];
|
|
23
|
-
function textResult(text, isError = false) {
|
|
24
|
-
return { content: [{ type: "text", text }], isError, details: {} };
|
|
25
|
-
}
|
|
26
|
-
function ownsRecord(record, parentAgentId) {
|
|
27
|
-
return record?.parentAgentId === parentAgentId;
|
|
28
|
-
}
|
|
29
|
-
function formatRecord(record, position) {
|
|
30
|
-
if (record.status === "error") {
|
|
31
|
-
return `Agent failed: ${record.error ?? "unknown error"}${partialOutputSuffix(record)}`;
|
|
32
|
-
}
|
|
33
|
-
if (record.status === "queued" || record.status === "running") {
|
|
34
|
-
return `Agent ${record.id} is ${record.status}.`;
|
|
35
|
-
}
|
|
36
|
-
// A truncated run must not read as a finished one. The top-level path carries
|
|
37
|
-
// this in its result headline; a nested result has no headline, so the note
|
|
38
|
-
// leads — appended, it would look like part of the child's own output.
|
|
39
|
-
const text = record.result?.trim() || record.error?.trim() || "No output.";
|
|
40
|
-
const note = position === "inline"
|
|
41
|
-
? getForegroundOutcomeNote(record.status)
|
|
42
|
-
: getStatusNote(record.status);
|
|
43
|
-
return note ? `Nested agent${note}.\n\n${text}` : text;
|
|
44
|
-
}
|
|
45
|
-
/** Build child-safe orchestration tools scoped to one parent agent instance. */
|
|
46
|
-
export function createNestedSubagentTools(context) {
|
|
47
|
-
// Agents resolve from a registry built for THIS branch's config root (under
|
|
48
|
-
// worktree isolation, the copy). Never via registerAgents — that is
|
|
49
|
-
// process-global state shared with the main session and every other agent.
|
|
50
|
-
const loadRegistry = () => buildAgentRegistry(loadCustomAgents(context.configCwd));
|
|
51
|
-
const allowedTypesIn = (registry) => context.allowedSubagents === "all"
|
|
52
|
-
? undefined
|
|
53
|
-
: new Set(context.allowedSubagents.map(name => resolveTypeIn(registry, name) ?? name));
|
|
54
|
-
const availableIn = (registry) => {
|
|
55
|
-
const allowed = allowedTypesIn(registry);
|
|
56
|
-
return getAvailableTypesIn(registry).filter(name => allowed === undefined || allowed.has(name));
|
|
57
|
-
};
|
|
58
|
-
const agentTool = defineTool({
|
|
59
|
-
name: NESTED_TOOL_NAMES[0],
|
|
60
|
-
label: "Agent",
|
|
61
|
-
description: "Launch a child-safe nested subagent for bounded delegated work. " +
|
|
62
|
-
"Only use agent types allowed by this parent agent; nesting is depth-limited.",
|
|
63
|
-
parameters: Type.Object({
|
|
64
|
-
prompt: Type.String({ description: "Self-contained task for the nested agent." }),
|
|
65
|
-
description: Type.String({ description: "Short 3-5 word task description." }),
|
|
66
|
-
subagent_type: Type.String({ description: `Allowed nested agent type. Available: ${availableIn(loadRegistry()).join(", ") || "none"}.` }),
|
|
67
|
-
model: Type.Optional(Type.String({ description: "Optional provider/model override." })),
|
|
68
|
-
thinking: Type.Optional(Type.String({ description: "Optional thinking level." })),
|
|
69
|
-
max_turns: Type.Optional(Type.Number({ minimum: 1 })),
|
|
70
|
-
run_in_background: Type.Optional(Type.Boolean({
|
|
71
|
-
description: "Defaults to false for nested spawns — the call blocks and returns the child's result inline. Set true only for work you will collect later with get_subagent_result; a detached child is stopped when you finish.",
|
|
72
|
-
})),
|
|
73
|
-
resume: Type.Optional(Type.String({ description: "Resume a nested agent owned by this parent." })),
|
|
74
|
-
isolated: Type.Optional(Type.Boolean()),
|
|
75
|
-
inherit_context: Type.Optional(Type.Boolean()),
|
|
76
|
-
...isolationParam(isWorktreeIsolationEnabled()),
|
|
77
|
-
}),
|
|
78
|
-
execute: async (_toolCallId, params, signal, _onUpdate, ctx) => {
|
|
79
|
-
if (params.resume) {
|
|
80
|
-
const existing = context.manager.getRecord(params.resume);
|
|
81
|
-
if (!ownsRecord(existing, context.parentAgentId)) {
|
|
82
|
-
return textResult(`Nested agent not found or not owned by this parent: "${params.resume}".`, true);
|
|
83
|
-
}
|
|
84
|
-
const resumed = await context.manager.resume(params.resume, params.prompt, signal);
|
|
85
|
-
return resumed
|
|
86
|
-
? textResult(formatRecord(resumed, "inline"), resumed.status === "error")
|
|
87
|
-
: textResult(`Failed to resume nested agent "${params.resume}".`, true);
|
|
88
|
-
}
|
|
89
|
-
if (context.depth >= context.maxSubagentDepth) {
|
|
90
|
-
return textResult(`Nested subagent call blocked (depth=${context.depth}, max=${context.maxSubagentDepth}). Complete the task directly.`, true);
|
|
91
|
-
}
|
|
92
|
-
// Reloaded per call so new agent files are picked up without a restart.
|
|
93
|
-
const registry = loadRegistry();
|
|
94
|
-
const rawType = params.subagent_type;
|
|
95
|
-
// Strict resolve, never the fallback policy: a project-level
|
|
96
|
-
// `fallbackSubagent` must not hand a nested caller an agent its allowlist
|
|
97
|
-
// never named. The list stays allowlist-filtered so a typo can't enumerate
|
|
98
|
-
// agents this parent may not reach.
|
|
99
|
-
const resolvedType = resolveEnabledTypeIn(registry, rawType);
|
|
100
|
-
if (resolvedType === undefined) {
|
|
101
|
-
return textResult(`Unknown or disabled nested agent type: "${rawType}". Allowed: ${availableIn(registry).join(", ") || "none"}.`, true);
|
|
102
|
-
}
|
|
103
|
-
const allowed = allowedTypesIn(registry);
|
|
104
|
-
if (allowed !== undefined && !allowed.has(resolvedType)) {
|
|
105
|
-
return textResult(`Nested agent type "${resolvedType}" is not allowed for this parent. Allowed: ${[...allowed].join(", ")}.`, true);
|
|
106
|
-
}
|
|
107
|
-
const config = getAgentConfigIn(registry, resolvedType);
|
|
108
|
-
// Foreground regardless of `backgroundByDefault` — see the reasoning on
|
|
109
|
-
// ResolveOptions. An explicit `true` here still opts in.
|
|
110
|
-
const invocation = resolveAgentInvocationConfig(config, params, {
|
|
111
|
-
worktreeAllowed: isWorktreeIsolationEnabled(),
|
|
112
|
-
defaultRunInBackground: false,
|
|
113
|
-
});
|
|
114
|
-
let model = ctx.model;
|
|
115
|
-
if (invocation.modelInput) {
|
|
116
|
-
const resolvedModel = resolveModel(invocation.modelInput, ctx.modelRegistry);
|
|
117
|
-
if (typeof resolvedModel === "string") {
|
|
118
|
-
if (invocation.modelFromParams)
|
|
119
|
-
return textResult(resolvedModel, true);
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
model = resolvedModel;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
// Same scopeModels policy as the top-level Agent tool — a nested spawn
|
|
126
|
-
// must not escape the allowlist. A "warn" verdict proceeds silently:
|
|
127
|
-
// child sessions have no UI surface to toast to.
|
|
128
|
-
const scopeVerdict = checkModelScope({
|
|
129
|
-
model,
|
|
130
|
-
cwd: context.configCwd,
|
|
131
|
-
modelRegistry: ctx.modelRegistry,
|
|
132
|
-
callerSupplied: invocation.modelFromParams,
|
|
133
|
-
agentLabel: config?.displayName ?? resolvedType,
|
|
134
|
-
modelInput: invocation.modelInput,
|
|
135
|
-
});
|
|
136
|
-
if (scopeVerdict.kind === "error")
|
|
137
|
-
return textResult(scopeVerdict.message, true);
|
|
138
|
-
// The whole branch shares the root session's transcript directory; read it
|
|
139
|
-
// off the owning parent rather than this child session's own id.
|
|
140
|
-
const rootSessionId = context.manager.getRecord(context.parentAgentId)?.rootSessionId;
|
|
141
|
-
const childDepth = context.depth + 1;
|
|
142
|
-
const options = {
|
|
143
|
-
description: params.description,
|
|
144
|
-
model,
|
|
145
|
-
maxTurns: invocation.maxTurns,
|
|
146
|
-
isolated: invocation.isolated,
|
|
147
|
-
inheritContext: invocation.inheritContext,
|
|
148
|
-
thinkingLevel: invocation.thinking,
|
|
149
|
-
isolation: invocation.isolation,
|
|
150
|
-
outputTranscript: config?.outputTranscript ?? getOutputTranscriptDefault(),
|
|
151
|
-
invocation: {
|
|
152
|
-
thinking: invocation.thinking,
|
|
153
|
-
maxTurns: invocation.maxTurns,
|
|
154
|
-
isolated: invocation.isolated,
|
|
155
|
-
inheritContext: invocation.inheritContext,
|
|
156
|
-
runInBackground: invocation.runInBackground,
|
|
157
|
-
isolation: invocation.isolation,
|
|
158
|
-
},
|
|
159
|
-
// Nested children are hidden from every reporting surface, so their spend
|
|
160
|
-
// would otherwise be unattributable. Fold it into every ancestor's record:
|
|
161
|
-
// the top-level one appears in lifecycle events, completion notifications,
|
|
162
|
-
// and `/agents`, and those all read `lifetimeUsage`. The whole chain is
|
|
163
|
-
// walked, not just the immediate parent — a spawn callback only fires for
|
|
164
|
-
// that child's OWN turns, so stopping at one level would hide a
|
|
165
|
-
// great-grandchild from the only record anyone can see. (The live
|
|
166
|
-
// widget/fleet counters read their own per-agent activity tracker, which
|
|
167
|
-
// still sees only the top-level agent's own turns.)
|
|
168
|
-
onAssistantUsage: (usage) => {
|
|
169
|
-
for (let id = context.parentAgentId; id !== undefined;) {
|
|
170
|
-
const ancestor = context.manager.getRecord(id);
|
|
171
|
-
if (!ancestor)
|
|
172
|
-
break;
|
|
173
|
-
addUsage(ancestor.lifetimeUsage, usage);
|
|
174
|
-
id = ancestor.parentAgentId;
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
depth: childDepth,
|
|
178
|
-
parentAgentId: context.parentAgentId,
|
|
179
|
-
maxSubagentDepth: context.maxSubagentDepth,
|
|
180
|
-
configCwd: context.configCwd,
|
|
181
|
-
rootSessionId,
|
|
182
|
-
};
|
|
183
|
-
// Transcript wiring, same gate as the top-level path: the child's
|
|
184
|
-
// `output_transcript` frontmatter wins, else the project default. Without
|
|
185
|
-
// it a nested run leaves no artifact but the string it returned — the
|
|
186
|
-
// parent's own transcript records the call and the answer, never the tool
|
|
187
|
-
// calls in between, which is exactly what a misbehaving child needs to
|
|
188
|
-
// explain itself. Filed under the ROOT session and this branch's config
|
|
189
|
-
// root, so a nested transcript lands in the same `tasks/` directory as its
|
|
190
|
-
// ancestors' rather than in a directory of its own.
|
|
191
|
-
const transcriptSessionId = rootSessionId !== undefined && (config?.outputTranscript ?? getOutputTranscriptDefault())
|
|
192
|
-
? rootSessionId
|
|
193
|
-
: undefined;
|
|
194
|
-
let childId;
|
|
195
|
-
const attachTranscript = (id) => {
|
|
196
|
-
childId = id;
|
|
197
|
-
if (transcriptSessionId === undefined)
|
|
198
|
-
return;
|
|
199
|
-
const rec = context.manager.getRecord(id);
|
|
200
|
-
if (!rec)
|
|
201
|
-
return;
|
|
202
|
-
rec.outputFile = createOutputFilePath(context.configCwd, id, transcriptSessionId);
|
|
203
|
-
writeInitialEntry(rec.outputFile, id, params.prompt, ctx.cwd);
|
|
204
|
-
};
|
|
205
|
-
options.onSessionCreated = (session) => {
|
|
206
|
-
const rec = childId === undefined ? undefined : context.manager.getRecord(childId);
|
|
207
|
-
if (rec?.outputFile && childId !== undefined) {
|
|
208
|
-
rec.outputCleanup = streamToOutputFile(session, rec.outputFile, childId, ctx.cwd, undefined);
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
// `ctx` is forwarded to the manager unmodified, never captured at tool-build
|
|
212
|
-
// time: each AgentSession builds its own ExtensionRunner from that session's
|
|
213
|
-
// cwd/sessionManager/modelRegistry, so this is the CHILD's context. Capturing
|
|
214
|
-
// one earlier would silently give a grandchild the wrong worktree base, the
|
|
215
|
-
// wrong conversation under inherit_context, and the wrong inherited model.
|
|
216
|
-
//
|
|
217
|
-
// spawn() throws on strict worktree-isolation failure and cwd validation —
|
|
218
|
-
// report it as a tool error, like the top-level Agent tool does, instead of
|
|
219
|
-
// letting it escape into the child's turn.
|
|
220
|
-
try {
|
|
221
|
-
if (invocation.runInBackground) {
|
|
222
|
-
const id = context.manager.spawn(context.pi, ctx, resolvedType, params.prompt, {
|
|
223
|
-
...options,
|
|
224
|
-
isBackground: true,
|
|
225
|
-
});
|
|
226
|
-
// Synchronous, before the event loop yields — onSessionCreated fires
|
|
227
|
-
// asynchronously inside runAgent, so the file is attached in time.
|
|
228
|
-
attachTranscript(id);
|
|
229
|
-
// Worktree isolation starts the agent asynchronously; surface its
|
|
230
|
-
// failure as a tool error, like the synchronous throw used to.
|
|
231
|
-
await context.manager.awaitStartup(id);
|
|
232
|
-
return textResult(`Nested agent started in background. Agent ID: ${id}`);
|
|
233
|
-
}
|
|
234
|
-
const { record } = await context.manager.spawnAndWait(context.pi, ctx, resolvedType, params.prompt, { ...options, signal }, attachTranscript);
|
|
235
|
-
return textResult(formatRecord(record, "inline"), record.status === "error");
|
|
236
|
-
}
|
|
237
|
-
catch (err) {
|
|
238
|
-
return textResult(err instanceof Error ? err.message : String(err), true);
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
});
|
|
242
|
-
const resultTool = defineTool({
|
|
243
|
-
name: NESTED_TOOL_NAMES[1],
|
|
244
|
-
label: "Get Nested Agent Result",
|
|
245
|
-
description: "Check or wait for a background nested agent owned by this parent.",
|
|
246
|
-
parameters: Type.Object({
|
|
247
|
-
agent_id: Type.String(),
|
|
248
|
-
wait: Type.Optional(Type.Boolean()),
|
|
249
|
-
}),
|
|
250
|
-
execute: async (_toolCallId, params, signal) => {
|
|
251
|
-
const record = context.manager.getRecord(params.agent_id);
|
|
252
|
-
if (!ownsRecord(record, context.parentAgentId)) {
|
|
253
|
-
return textResult(`Nested agent not found or not owned by this parent: "${params.agent_id}".`, true);
|
|
254
|
-
}
|
|
255
|
-
// Wait for completion if requested. Cancellation (e.g. the parent's tool
|
|
256
|
-
// call is aborted) stops only this wait; the nested child keeps running and
|
|
257
|
-
// stays unconsumed. Queued records have no promise until the manager starts
|
|
258
|
-
// them, so poll — abortably — until they leave the queue, then await.
|
|
259
|
-
if (params.wait && (record.status === "queued" || record.status === "running")) {
|
|
260
|
-
while (record.status === "queued") {
|
|
261
|
-
await abortable(new Promise(resolve => setTimeout(resolve, 250)), signal);
|
|
262
|
-
}
|
|
263
|
-
if (record.promise)
|
|
264
|
-
await abortable(record.promise, signal);
|
|
265
|
-
}
|
|
266
|
-
return textResult(formatRecord(record, "fetched"), record.status === "error");
|
|
267
|
-
},
|
|
268
|
-
});
|
|
269
|
-
const steerTool = defineTool({
|
|
270
|
-
name: NESTED_TOOL_NAMES[2],
|
|
271
|
-
label: "Steer Nested Agent",
|
|
272
|
-
description: "Send guidance to a running nested agent owned by this parent.",
|
|
273
|
-
parameters: Type.Object({
|
|
274
|
-
agent_id: Type.String(),
|
|
275
|
-
message: Type.String(),
|
|
276
|
-
}),
|
|
277
|
-
execute: async (_toolCallId, params) => {
|
|
278
|
-
const record = context.manager.getRecord(params.agent_id);
|
|
279
|
-
if (!ownsRecord(record, context.parentAgentId) || record.status !== "running") {
|
|
280
|
-
return textResult(`Running nested agent not found or not owned by this parent: "${params.agent_id}".`, true);
|
|
281
|
-
}
|
|
282
|
-
// Session not ready yet — queue the steer. The manager flushes pending
|
|
283
|
-
// steers when the session is created (same contract as the top-level tool).
|
|
284
|
-
if (!record.session) {
|
|
285
|
-
if (!record.pendingSteers)
|
|
286
|
-
record.pendingSteers = [];
|
|
287
|
-
record.pendingSteers.push(params.message);
|
|
288
|
-
return textResult(`Steering message queued for nested agent ${params.agent_id}.`);
|
|
289
|
-
}
|
|
290
|
-
try {
|
|
291
|
-
await record.session.steer(params.message);
|
|
292
|
-
}
|
|
293
|
-
catch (err) {
|
|
294
|
-
return textResult(`Failed to steer nested agent: ${err instanceof Error ? err.message : String(err)}`, true);
|
|
295
|
-
}
|
|
296
|
-
return textResult(`Steering message sent to nested agent ${params.agent_id}.`);
|
|
297
|
-
},
|
|
298
|
-
});
|
|
299
|
-
return [agentTool, resultTool, steerTool];
|
|
300
|
-
}
|
|
301
|
-
//# sourceMappingURL=nested-tools.js.map
|
package/dist/nested-tools.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nested-tools.js","sourceRoot":"","sources":["../src/nested-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,UAAU,GAIX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EA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