@evandu/super-pi-server 0.0.0-stage → 0.1.259
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/README.md +248 -3
- package/agents/code-auditor.md +64 -0
- package/agents/code-designer.md +64 -0
- package/agents/coder.md +24 -0
- package/agents/critic.md +24 -0
- package/agents/document-organizer.md +48 -0
- package/agents/patcher.md +27 -0
- package/agents/planner.md +30 -0
- package/agents/project-leader.md +28 -0
- package/agents/reviewer.md +27 -0
- package/agents/scout.md +27 -0
- package/agents/solution-designer.md +62 -0
- package/agents/super-pi-documents/index.ts +92 -0
- package/agents/super-pi-feishu/index.ts +88 -0
- package/agents/super-pi-knowledge/index.ts +70 -0
- package/agents/super-pi-managed-model/index.ts +9 -0
- package/agents/super-pi-memory/index.ts +75 -0
- package/agents/super-pi-native-tools/index.ts +1 -0
- package/agents/super-pi-task/core.ts +2262 -0
- package/agents/super-pi-task/index.ts +814 -0
- package/agents/super-pi-task/workflow-schema.ts +34 -0
- package/agents/super-pi-web/index.ts +32 -0
- package/agents/verifier.md +25 -0
- package/assets/fonts/LICENSE +92 -0
- package/assets/fonts/NotoSansSC-Bold.otf +0 -0
- package/assets/fonts/NotoSansSC-Regular.otf +0 -0
- package/assets/knowledge-model/README.md +37 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/config.json +31 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/onnx/model_quantized.onnx +0 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/special_tokens_map.json +7 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/tokenizer.json +21278 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/tokenizer_config.json +15 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/vocab.txt +21128 -0
- package/bin/npm-prefix.d.ts +1 -0
- package/bin/npm-prefix.js +10 -0
- package/bin/super-pi.js +349 -0
- package/dist/client/.super-pi-client-sources.json +82 -0
- package/dist/client/assets/CodeMirrorEditor-mi9rGUce.js +2 -0
- package/dist/client/assets/GitDiffEditor-CpoDDQrA.css +1 -0
- package/dist/client/assets/GitDiffEditor-FQBfGxOY.js +29 -0
- package/dist/client/assets/diff-ChtP43wD.js +1 -0
- package/dist/client/assets/dist-AW5lyI3I.js +1 -0
- package/dist/client/assets/dist-B3-a6uF0.js +7 -0
- package/dist/client/assets/dist-BGxkyh6e.js +1 -0
- package/dist/client/assets/dist-BJxfd7yb.js +11 -0
- package/dist/client/assets/dist-BRVQKlcp.js +1 -0
- package/dist/client/assets/dist-BV64A9Ji.js +1 -0
- package/dist/client/assets/dist-BXAOrsjq.js +1 -0
- package/dist/client/assets/dist-CKF2Jksy.js +1 -0
- package/dist/client/assets/dist-CX_Hm4GS.js +1 -0
- package/dist/client/assets/dist-Cus6_oaF.js +2 -0
- package/dist/client/assets/dist-Cx00EZKR.js +23 -0
- package/dist/client/assets/dist-D71y2EI1.js +1 -0
- package/dist/client/assets/dist-D978o95T.js +5 -0
- package/dist/client/assets/dist-Dc1MBGAG.js +1 -0
- package/dist/client/assets/dist-Dds-qLxY.js +9 -0
- package/dist/client/assets/dist-DeD9copn.js +1 -0
- package/dist/client/assets/dist-DuvGReu-.js +6 -0
- package/dist/client/assets/dist-Dvb0SqcK.js +2 -0
- package/dist/client/assets/dist-J6XWqRpB.js +3 -0
- package/dist/client/assets/dist-QzbOCAU6.js +1 -0
- package/dist/client/assets/dist-moiMRpw_.js +1 -0
- package/dist/client/assets/dist-scBkrwv-.js +2 -0
- package/dist/client/assets/dockerfile-BDePf5PZ.js +1 -0
- package/dist/client/assets/index-Cn7hdrDw.js +350 -0
- package/dist/client/assets/index-UfzqdECL.css +1 -0
- package/dist/client/assets/powershell-D8WpQPaX.js +1 -0
- package/dist/client/assets/properties-C357ku5U.js +1 -0
- package/dist/client/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/client/assets/ruby-ChfNwlCY.js +1 -0
- package/dist/client/assets/shell-DwuoZtxw.js +1 -0
- package/dist/client/assets/swift-DKB6_1j6.js +1 -0
- package/dist/client/assets/toml-BPTmHmyx.js +1 -0
- package/dist/client/favicon.ico +0 -0
- package/dist/client/favicon.png +0 -0
- package/dist/client/favicon.svg +10 -0
- package/dist/client/index.html +18 -0
- package/dist/extension.d.ts +15 -0
- package/dist/extension.js +126 -0
- package/dist/server/active-memory.d.ts +247 -0
- package/dist/server/active-memory.js +669 -0
- package/dist/server/agents.d.ts +245 -0
- package/dist/server/agents.js +701 -0
- package/dist/server/application/catalog-service.d.ts +98 -0
- package/dist/server/application/catalog-service.js +245 -0
- package/dist/server/application/conversation-service.d.ts +245 -0
- package/dist/server/application/conversation-service.js +654 -0
- package/dist/server/application/document-service.d.ts +68 -0
- package/dist/server/application/document-service.js +120 -0
- package/dist/server/application/extension-ui-service.d.ts +44 -0
- package/dist/server/application/extension-ui-service.js +135 -0
- package/dist/server/application/feishu-service.d.ts +179 -0
- package/dist/server/application/feishu-service.js +358 -0
- package/dist/server/application/group-chat-service.d.ts +75 -0
- package/dist/server/application/group-chat-service.js +953 -0
- package/dist/server/application/group-execution.d.ts +15 -0
- package/dist/server/application/group-execution.js +77 -0
- package/dist/server/application/project-service.d.ts +464 -0
- package/dist/server/application/project-service.js +2523 -0
- package/dist/server/application/provider-service.d.ts +174 -0
- package/dist/server/application/provider-service.js +510 -0
- package/dist/server/application/run-service.d.ts +547 -0
- package/dist/server/application/run-service.js +2683 -0
- package/dist/server/application/scheduled-task-service.d.ts +184 -0
- package/dist/server/application/scheduled-task-service.js +391 -0
- package/dist/server/application/session-orchestrator-service.d.ts +388 -0
- package/dist/server/application/session-orchestrator-service.js +1146 -0
- package/dist/server/application/session-reminder-service.d.ts +59 -0
- package/dist/server/application/session-reminder-service.js +141 -0
- package/dist/server/application/session-watchdog.d.ts +171 -0
- package/dist/server/application/session-watchdog.js +284 -0
- package/dist/server/application/workspace-service.d.ts +52 -0
- package/dist/server/application/workspace-service.js +186 -0
- package/dist/server/application/worktree-service.d.ts +13 -0
- package/dist/server/application/worktree-service.js +76 -0
- package/dist/server/browser-access.d.ts +34 -0
- package/dist/server/browser-access.js +89 -0
- package/dist/server/capability.d.ts +105 -0
- package/dist/server/capability.js +170 -0
- package/dist/server/command-handler.d.ts +93 -0
- package/dist/server/command-handler.js +540 -0
- package/dist/server/content-search.d.ts +16 -0
- package/dist/server/content-search.js +235 -0
- package/dist/server/conversation-usage.d.ts +22 -0
- package/dist/server/conversation-usage.js +43 -0
- package/dist/server/documents.d.ts +152 -0
- package/dist/server/documents.js +998 -0
- package/dist/server/engineering-learning.d.ts +30 -0
- package/dist/server/engineering-learning.js +106 -0
- package/dist/server/exec-service.d.ts +45 -0
- package/dist/server/exec-service.js +167 -0
- package/dist/server/explicit-file-open.d.ts +34 -0
- package/dist/server/explicit-file-open.js +105 -0
- package/dist/server/failure-text.d.ts +18 -0
- package/dist/server/failure-text.js +44 -0
- package/dist/server/feishu-cli.d.ts +223 -0
- package/dist/server/feishu-cli.js +464 -0
- package/dist/server/file-changes.d.ts +119 -0
- package/dist/server/file-changes.js +280 -0
- package/dist/server/file-diff.d.ts +41 -0
- package/dist/server/file-diff.js +97 -0
- package/dist/server/file-index.d.ts +100 -0
- package/dist/server/file-index.js +296 -0
- package/dist/server/file-name-index.d.ts +160 -0
- package/dist/server/file-name-index.js +411 -0
- package/dist/server/files.d.ts +269 -0
- package/dist/server/files.js +748 -0
- package/dist/server/git.d.ts +245 -0
- package/dist/server/git.js +903 -0
- package/dist/server/http-server.d.ts +45 -0
- package/dist/server/http-server.js +3830 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +485 -0
- package/dist/server/inline-thinking.d.ts +90 -0
- package/dist/server/inline-thinking.js +181 -0
- package/dist/server/json-comments.d.ts +14 -0
- package/dist/server/json-comments.js +71 -0
- package/dist/server/knowledge-embedding-worker.d.ts +1 -0
- package/dist/server/knowledge-embedding-worker.js +27 -0
- package/dist/server/knowledge-vectors.d.ts +150 -0
- package/dist/server/knowledge-vectors.js +385 -0
- package/dist/server/knowledge.d.ts +273 -0
- package/dist/server/knowledge.js +848 -0
- package/dist/server/length-continuation.d.ts +83 -0
- package/dist/server/length-continuation.js +118 -0
- package/dist/server/logging.d.ts +32 -0
- package/dist/server/logging.js +185 -0
- package/dist/server/managed-http-tunnel.d.ts +6 -0
- package/dist/server/managed-http-tunnel.js +85 -0
- package/dist/server/managed-http.d.ts +4 -0
- package/dist/server/managed-http.js +85 -0
- package/dist/server/managed-model-adapter.d.ts +17 -0
- package/dist/server/managed-model-adapter.js +75 -0
- package/dist/server/managed-model-gateway.d.ts +49 -0
- package/dist/server/managed-model-gateway.js +73 -0
- package/dist/server/managed-servers.d.ts +55 -0
- package/dist/server/managed-servers.js +392 -0
- package/dist/server/managed-ssh.d.ts +26 -0
- package/dist/server/managed-ssh.js +73 -0
- package/dist/server/manager-vault.d.ts +11 -0
- package/dist/server/manager-vault.js +67 -0
- package/dist/server/memory-recall.d.ts +25 -0
- package/dist/server/memory-recall.js +45 -0
- package/dist/server/memory.d.ts +67 -0
- package/dist/server/memory.js +216 -0
- package/dist/server/message-media.d.ts +7 -0
- package/dist/server/message-media.js +54 -0
- package/dist/server/model-context-window.d.ts +186 -0
- package/dist/server/model-context-window.js +444 -0
- package/dist/server/model-filter.d.ts +23 -0
- package/dist/server/model-filter.js +48 -0
- package/dist/server/models-store.d.ts +36 -0
- package/dist/server/models-store.js +132 -0
- package/dist/server/native-tool-settings.d.ts +25 -0
- package/dist/server/native-tool-settings.js +41 -0
- package/dist/server/native-tools-extension.d.ts +2 -0
- package/dist/server/native-tools-extension.js +39 -0
- package/dist/server/native-tools-service.d.ts +39 -0
- package/dist/server/native-tools-service.js +240 -0
- package/dist/server/persistence/app-state-repository.d.ts +65 -0
- package/dist/server/persistence/app-state-repository.js +1 -0
- package/dist/server/persistence/json-state-repository.d.ts +14 -0
- package/dist/server/persistence/json-state-repository.js +43 -0
- package/dist/server/persistence/open-state-store.d.ts +3 -0
- package/dist/server/persistence/open-state-store.js +35 -0
- package/dist/server/persistence/rename.d.ts +22 -0
- package/dist/server/persistence/rename.js +44 -0
- package/dist/server/persistence/sqlite-state-repository.d.ts +12 -0
- package/dist/server/persistence/sqlite-state-repository.js +264 -0
- package/dist/server/pi-command.d.ts +94 -0
- package/dist/server/pi-command.js +265 -0
- package/dist/server/pi-native.d.ts +12 -0
- package/dist/server/pi-native.js +16 -0
- package/dist/server/pi-session-events.d.ts +158 -0
- package/dist/server/pi-session-events.js +373 -0
- package/dist/server/pi-session-pool.d.ts +233 -0
- package/dist/server/pi-session-pool.js +382 -0
- package/dist/server/pi-session.d.ts +642 -0
- package/dist/server/pi-session.js +655 -0
- package/dist/server/presentations/schema.d.ts +120 -0
- package/dist/server/presentations/schema.js +128 -0
- package/dist/server/provider-network.d.ts +16 -0
- package/dist/server/provider-network.js +106 -0
- package/dist/server/provider-proxy.d.ts +18 -0
- package/dist/server/provider-proxy.js +200 -0
- package/dist/server/providers.d.ts +333 -0
- package/dist/server/providers.js +989 -0
- package/dist/server/remote-bootstrap.d.ts +17 -0
- package/dist/server/remote-bootstrap.js +119 -0
- package/dist/server/rpc-channel.d.ts +131 -0
- package/dist/server/rpc-channel.js +135 -0
- package/dist/server/runtime.d.ts +1393 -0
- package/dist/server/runtime.js +3286 -0
- package/dist/server/scheduled-tasks.d.ts +101 -0
- package/dist/server/scheduled-tasks.js +138 -0
- package/dist/server/server-context.d.ts +119 -0
- package/dist/server/server-context.js +1 -0
- package/dist/server/session-cwd.d.ts +19 -0
- package/dist/server/session-cwd.js +58 -0
- package/dist/server/session-ledger.d.ts +67 -0
- package/dist/server/session-ledger.js +76 -0
- package/dist/server/session-memory-scope.d.ts +4 -0
- package/dist/server/session-memory-scope.js +30 -0
- package/dist/server/session-repository.d.ts +100 -0
- package/dist/server/session-repository.js +246 -0
- package/dist/server/session-tree-scope.d.ts +125 -0
- package/dist/server/session-tree-scope.js +337 -0
- package/dist/server/skills.d.ts +23 -0
- package/dist/server/skills.js +190 -0
- package/dist/server/store.d.ts +1062 -0
- package/dist/server/store.js +3305 -0
- package/dist/server/subagent-runs.d.ts +185 -0
- package/dist/server/subagent-runs.js +383 -0
- package/dist/server/subagents.d.ts +200 -0
- package/dist/server/subagents.js +619 -0
- package/dist/server/task-tool.d.ts +282 -0
- package/dist/server/task-tool.js +507 -0
- package/dist/server/tavily.d.ts +32 -0
- package/dist/server/tavily.js +136 -0
- package/dist/server/team-context.d.ts +12 -0
- package/dist/server/team-context.js +180 -0
- package/dist/server/terminal.d.ts +163 -0
- package/dist/server/terminal.js +557 -0
- package/dist/server/thinking-level-discovery.d.ts +38 -0
- package/dist/server/thinking-level-discovery.js +183 -0
- package/dist/server/time-zone.d.ts +20 -0
- package/dist/server/time-zone.js +32 -0
- package/dist/server/tool-calls.d.ts +130 -0
- package/dist/server/tool-calls.js +341 -0
- package/dist/server/tool-llm.d.ts +72 -0
- package/dist/server/tool-llm.js +146 -0
- package/dist/server/tool-registry.d.ts +129 -0
- package/dist/server/tool-registry.js +249 -0
- package/dist/server/tool-runner.d.ts +112 -0
- package/dist/server/tool-runner.js +306 -0
- package/dist/server/turn-failure.d.ts +48 -0
- package/dist/server/turn-failure.js +148 -0
- package/dist/server/types.d.ts +2315 -0
- package/dist/server/types.js +11 -0
- package/dist/server/update-status.d.ts +14 -0
- package/dist/server/update-status.js +69 -0
- package/dist/server/update.d.ts +46 -0
- package/dist/server/update.js +104 -0
- package/dist/server/upload.d.ts +35 -0
- package/dist/server/upload.js +177 -0
- package/dist/server/version.d.ts +33 -0
- package/dist/server/version.js +111 -0
- package/dist/server/web.d.ts +27 -0
- package/dist/server/web.js +183 -0
- package/dist/server/workflow-engine.d.ts +47 -0
- package/dist/server/workflow-engine.js +255 -0
- package/dist/server/workflow.d.ts +329 -0
- package/dist/server/workflow.js +469 -0
- package/dist/server/workspace-file-indexes.d.ts +2 -0
- package/dist/server/workspace-file-indexes.js +61 -0
- package/dist/server/workspace-file-operations.d.ts +36 -0
- package/dist/server/workspace-file-operations.js +281 -0
- package/dist/server/workspace-file-response.d.ts +7 -0
- package/dist/server/workspace-file-response.js +79 -0
- package/dist/server/ws-server.d.ts +149 -0
- package/dist/server/ws-server.js +640 -0
- package/dist/shared/agent-order.d.ts +44 -0
- package/dist/shared/agent-order.js +50 -0
- package/dist/shared/archive-decisions.d.ts +44 -0
- package/dist/shared/archive-decisions.js +98 -0
- package/dist/shared/background-task.d.ts +25 -0
- package/dist/shared/background-task.js +183 -0
- package/dist/shared/child-session-lock.d.ts +37 -0
- package/dist/shared/child-session-lock.js +59 -0
- package/dist/shared/content-search.d.ts +22 -0
- package/dist/shared/content-search.js +1 -0
- package/dist/shared/conversation-title.d.ts +4 -0
- package/dist/shared/conversation-title.js +4 -0
- package/dist/shared/file-mentions.d.ts +17 -0
- package/dist/shared/file-mentions.js +91 -0
- package/dist/shared/git-commit.d.ts +11 -0
- package/dist/shared/git-commit.js +1 -0
- package/dist/shared/git-graph.d.ts +42 -0
- package/dist/shared/git-graph.js +30 -0
- package/dist/shared/group-chat.d.ts +132 -0
- package/dist/shared/group-chat.js +6 -0
- package/dist/shared/managed-servers.d.ts +36 -0
- package/dist/shared/managed-servers.js +1 -0
- package/dist/shared/message-media.d.ts +12 -0
- package/dist/shared/message-media.js +27 -0
- package/dist/shared/model-window-label.d.ts +39 -0
- package/dist/shared/model-window-label.js +55 -0
- package/dist/shared/native-tools.d.ts +43 -0
- package/dist/shared/native-tools.js +1 -0
- package/dist/shared/pi-cache-warming.d.ts +9 -0
- package/dist/shared/pi-cache-warming.js +4 -0
- package/dist/shared/project-overview.d.ts +107 -0
- package/dist/shared/project-overview.js +92 -0
- package/dist/shared/project-presentation.d.ts +55 -0
- package/dist/shared/project-presentation.js +111 -0
- package/dist/shared/provider-network.d.ts +30 -0
- package/dist/shared/provider-network.js +1 -0
- package/dist/shared/session-reporting.d.ts +40 -0
- package/dist/shared/session-reporting.js +97 -0
- package/dist/shared/session-search.d.ts +14 -0
- package/dist/shared/session-search.js +1 -0
- package/dist/shared/team-context-view.d.ts +33 -0
- package/dist/shared/team-context-view.js +49 -0
- package/dist/shared/team-context.d.ts +59 -0
- package/dist/shared/team-context.js +3 -0
- package/dist/shared/terminal-protocol.d.ts +71 -0
- package/dist/shared/terminal-protocol.js +1 -0
- package/dist/shared/thinking-levels.d.ts +53 -0
- package/dist/shared/thinking-levels.js +85 -0
- package/dist/shared/tool-glyph.d.ts +7 -0
- package/dist/shared/tool-glyph.js +19 -0
- package/dist/shared/transcript-order.d.ts +7 -0
- package/dist/shared/transcript-order.js +12 -0
- package/dist/shared/update-status.d.ts +28 -0
- package/dist/shared/update-status.js +1 -0
- package/dist/shared/workspace-file-preview.d.ts +4 -0
- package/dist/shared/workspace-file-preview.js +28 -0
- package/package.json +448 -4
- package/scripts/diagnose.mjs +603 -0
- package/scripts/patch-brace-expansion.mjs +260 -0
- package/scripts/restart-server.mjs +104 -0
- package/skills/presentation/SKILL.md +30 -0
- package/skills/presentation/references/data.md +10 -0
- package/skills/presentation/references/quality.md +12 -0
- package/skills/presentation/references/story.md +12 -0
- package/skills/presentation/references/templates-and-editing.md +11 -0
- package/skills/presentation/references/visual-system.md +10 -0
- package/skills/super-pi-agent-development/SKILL.md +25 -0
- package/skills/super-pi-development/SKILL.md +31 -0
- package/skills/super-pi-tool-development/SKILL.md +39 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { type ExtensionUiHost } from "./runtime.js";
|
|
2
|
+
import { describeToolCall, TOOL_DETAIL_CAP } from "./tool-calls.js";
|
|
3
|
+
import { type ModelSelection, type SubagentFailure, type SubagentUsage } from "./types.js";
|
|
4
|
+
/** Re-exported from `types.js` where it is declared: usage is a PERSISTED shape, not a spawn detail. */
|
|
5
|
+
export type { SubagentUsage };
|
|
6
|
+
/**
|
|
7
|
+
* The tool-call derivation now lives in `tool-calls.js`, because the primary agent's runtime needs the
|
|
8
|
+
* identical mapping and `subagents.ts` already imports `runtime.ts` - so the shared definition has to sit
|
|
9
|
+
* below both of them.
|
|
10
|
+
*
|
|
11
|
+
* RE-EXPORTED rather than moved silently. `scripts/agent-vis-records.test.mjs` imports both of these from
|
|
12
|
+
* this module, and a card that quietly lost its only derivation would still typecheck. Keeping the names
|
|
13
|
+
* exported here means that test keeps pointing at the one definition that also serves a call block.
|
|
14
|
+
*/
|
|
15
|
+
export { describeToolCall, TOOL_DETAIL_CAP };
|
|
16
|
+
/**
|
|
17
|
+
* The run id every dispatch gets unless a caller supplies one: `sub_<uuid>`, and Pi's `--session-id`
|
|
18
|
+
* alongside it. Exported so a caller that must know the id BEFORE the spawn - the recorder, which has to
|
|
19
|
+
* write a `running` row before the child exists - generates exactly the id this would have generated.
|
|
20
|
+
*/
|
|
21
|
+
export declare const newSubagentRunId: () => string;
|
|
22
|
+
/**
|
|
23
|
+
* One tool the child started, and later ended.
|
|
24
|
+
*
|
|
25
|
+
* `detail` is a derived label, not the arguments - see `describeToolCall` in `tool-calls.js`, which is
|
|
26
|
+
* where that mapping now lives and why. `status` and `durationMs` arrive on the separate `onToolEnd`
|
|
27
|
+
* callback, because they are facts about the END of a call and a caller that cannot tell the two apart
|
|
28
|
+
* would have to guess at a half-filled row.
|
|
29
|
+
*/
|
|
30
|
+
export type SubagentToolCall = {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
detail?: string;
|
|
34
|
+
status?: "ok" | "error";
|
|
35
|
+
durationMs?: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* One completed run.
|
|
39
|
+
*
|
|
40
|
+
* `sessionId` is Pi's own session id for the child, which today is the run id because that is what
|
|
41
|
+
* `--session-id` was given. They are separate fields because they are separate facts: the run is
|
|
42
|
+
* Super Pi's record, the session is the file Pi wrote, and a future caller (records in step 2) will
|
|
43
|
+
* want to report one after the other has been changed.
|
|
44
|
+
*/
|
|
45
|
+
export type SubagentResult = {
|
|
46
|
+
id: string;
|
|
47
|
+
sessionId: string;
|
|
48
|
+
finalText: string;
|
|
49
|
+
usage: SubagentUsage;
|
|
50
|
+
};
|
|
51
|
+
export type SubagentRunInput = {
|
|
52
|
+
/** The conversation that dispatched this run. Recorded on the child so a later reader can attribute it. */
|
|
53
|
+
conversationId: string;
|
|
54
|
+
/** The `agents/*.md` file's base name, which must be a `mode: subagent` definition. */
|
|
55
|
+
agentId: string;
|
|
56
|
+
/** What the child is asked to do. Sent over RPC stdin, never on the command line - see `run()`. */
|
|
57
|
+
task: string;
|
|
58
|
+
/**
|
|
59
|
+
* The directory the child must run in: the dispatching conversation's workspace, resolved by the
|
|
60
|
+
* caller. Required with no default for the same reason `AnswerInput.cwd` is: every tool the child runs
|
|
61
|
+
* resolves its paths against this directory, so an absent one would silently run the sub-agent in the
|
|
62
|
+
* server's own directory instead of failing.
|
|
63
|
+
*/
|
|
64
|
+
cwd: string;
|
|
65
|
+
/** The parent conversation's current model, used when the definition names none. See `run()`. */
|
|
66
|
+
model?: ModelSelection;
|
|
67
|
+
/**
|
|
68
|
+
* Tools the DISPATCHING agent has denied, removed from this child's allowlist.
|
|
69
|
+
*
|
|
70
|
+
* The parent's denies are inherited and its allowlist is NOT, which is exactly what OpenCode's
|
|
71
|
+
* `deriveSubagentSessionPermission` does and why: "parent agent restrictions only govern that agent;
|
|
72
|
+
* the subagent's own permissions determine its capabilities" (subagent-permissions.ts:11-12). A
|
|
73
|
+
* primary agent that took `bash` away from itself has said something about its own turns; a child
|
|
74
|
+
* whose own author gave it `bash` for verification is not thereby unsafe.
|
|
75
|
+
*
|
|
76
|
+
* Applied to the child's `agents/*.md` map by `agentSpawnArgs`, never by editing the definition: two
|
|
77
|
+
* runs of the same agent under different parents must be able to differ.
|
|
78
|
+
*/
|
|
79
|
+
denyTools?: readonly string[];
|
|
80
|
+
/**
|
|
81
|
+
* The id this run answers to. Omitted means `newSubagentRunId()`.
|
|
82
|
+
*
|
|
83
|
+
* Supplied by a caller that must know the id before the child exists - the recorder persists a
|
|
84
|
+
* `running` row first precisely so a crashed server leaves a reconcilable orphan, which is impossible
|
|
85
|
+
* if the id only appears after `run()` returns. Validated rather than trusted, because the same string
|
|
86
|
+
* becomes Pi's `--session-id` and is the key startup reconciliation looks orphans up by: a run
|
|
87
|
+
* recorded under an id nothing else knows can never be found, let alone cleaned up.
|
|
88
|
+
*/
|
|
89
|
+
id?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Who answers the child's Extension UI questions.
|
|
92
|
+
*
|
|
93
|
+
* Absent means nobody can be asked, and a blocking question is CANCELLED - Pi's own third response
|
|
94
|
+
* shape, meaning "no answer was collected". Auto-answering with `options[0]` would look to Pi exactly
|
|
95
|
+
* like a decision the user made, and the user would never learn a question was asked of them.
|
|
96
|
+
*/
|
|
97
|
+
host?: ExtensionUiHost;
|
|
98
|
+
/** Aborting writes Pi an `abort` and then kills the whole process tree; `run()` rejects with `SubagentCancelled`. */
|
|
99
|
+
signal?: AbortSignal;
|
|
100
|
+
/** Called once per `text_delta`, in order, with the raw delta. Never the accumulated text. */
|
|
101
|
+
onTextDelta?: (delta: string) => void;
|
|
102
|
+
/** Called on `tool_execution_start`, with the name and the derived target label. */
|
|
103
|
+
onToolCall?: (call: SubagentToolCall) => void;
|
|
104
|
+
onToolUpdate?: (id: string, output: string, final: boolean) => void;
|
|
105
|
+
/**
|
|
106
|
+
* Called on `tool_execution_end` for the same `id`, carrying how the call ended.
|
|
107
|
+
*
|
|
108
|
+
* A SEPARATE callback rather than a second `onToolCall`, so "a tool started" and "a tool finished"
|
|
109
|
+
* stay distinguishable: a row with no status is a call still in flight, which is the whole reason the
|
|
110
|
+
* card can show that a child is inside a long tool right now. Nothing here is derived from the
|
|
111
|
+
* RESULT - only `isError` and Pi's own `durationMs` come through, because a result can be a file.
|
|
112
|
+
*/
|
|
113
|
+
onToolEnd?: (call: SubagentToolCall) => void;
|
|
114
|
+
/** Called on every `thinking_delta`: the child is composing, and emitting no output while it does. */
|
|
115
|
+
onThinking?: () => void;
|
|
116
|
+
/**
|
|
117
|
+
* Called when the run moves to a new phase, for a caller that has to report where it died.
|
|
118
|
+
*
|
|
119
|
+
* Driven by the drain loop meeting each record family rather than by a timer, so the phase can only
|
|
120
|
+
* ever be one the supervisor actually observed. `dispatch` is the implicit starting value and is
|
|
121
|
+
* never announced - a run that fails before the prompt is written never called it, and the caller's
|
|
122
|
+
* default is the honest answer rather than a special case.
|
|
123
|
+
*/
|
|
124
|
+
onStage?: (stage: SubagentFailure["stage"]) => void;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* A run that ended because the caller aborted it.
|
|
128
|
+
*
|
|
129
|
+
* A named error rather than a message a caller has to pattern-match, because "the user pressed stop" and
|
|
130
|
+
* "the child failed" are different outcomes for whoever reports this run later, and collapsing them into
|
|
131
|
+
* one rejected promise would force that decision back out of string matching.
|
|
132
|
+
*/
|
|
133
|
+
export declare class SubagentCancelled extends Error {
|
|
134
|
+
readonly runId: string;
|
|
135
|
+
constructor(runId: string);
|
|
136
|
+
}
|
|
137
|
+
/** Spawns sub-agent children Pi and drains their JSONL RPC streams. */
|
|
138
|
+
export declare class SubagentSupervisor {
|
|
139
|
+
private readonly sessionDir;
|
|
140
|
+
private agents;
|
|
141
|
+
private memory?;
|
|
142
|
+
setMemory(memory: import("./active-memory.js").ActiveMemory): void;
|
|
143
|
+
private readonly pi;
|
|
144
|
+
/** Live children by run id, so a caller can name the process it means. Cleared in the run's `finally`. */
|
|
145
|
+
private readonly children;
|
|
146
|
+
/**
|
|
147
|
+
* `command` and `agents` are the same two override points `PiRpcRuntime` takes, and for the same
|
|
148
|
+
* reasons: a test needs to launch a fake peer, and a Pi installed somewhere unusual needs to be
|
|
149
|
+
* reachable. `Pi` is resolved once, because a resolution that could change mid-run would make one
|
|
150
|
+
* child's spawn line depend on when it was started.
|
|
151
|
+
*/
|
|
152
|
+
private modelValidator?;
|
|
153
|
+
setModelValidator(validator: (conversationId: string, model: import("./types.js").ModelSelection | undefined) => Promise<void>): void;
|
|
154
|
+
constructor(sessionDir: string, command?: string, agents?: {
|
|
155
|
+
dir: string | string[];
|
|
156
|
+
promptDir: string;
|
|
157
|
+
});
|
|
158
|
+
/**
|
|
159
|
+
* Every child this supervisor still owns, optionally narrowed to one conversation.
|
|
160
|
+
*
|
|
161
|
+
* A live view rather than a returned handle, because the caller cannot have the id before the run:
|
|
162
|
+
* `run()` returns the RESULT, and a stop button needs the pid while the promise is still pending.
|
|
163
|
+
* Deleted as soon as the child is gone, so a caller that polls it sees the truth rather than a
|
|
164
|
+
* remembered one.
|
|
165
|
+
*/
|
|
166
|
+
liveRuns(conversationId?: string): {
|
|
167
|
+
id: string;
|
|
168
|
+
conversationId: string;
|
|
169
|
+
pid: number | undefined;
|
|
170
|
+
}[];
|
|
171
|
+
setAgentsDir(dir: string | string[]): void;
|
|
172
|
+
/**
|
|
173
|
+
* Runs one sub-agent to completion and returns what it said.
|
|
174
|
+
*
|
|
175
|
+
* The three spawn-time decisions, all of which the design fixes rather than leaves open:
|
|
176
|
+
*
|
|
177
|
+
* - `--mode rpc`, NOT the reference implementation's `--mode json -p`. In print mode a child that
|
|
178
|
+
* wants to ask something has nowhere to ask and hangs; in RPC mode its questions arrive as
|
|
179
|
+
* `extension_ui_request` records on the channel Super Pi already owns. That is the whole reason this
|
|
180
|
+
* supervisor exists instead of shipping Pi's extension.
|
|
181
|
+
* - `--session-dir` shared by every child, `--session-id` unique per run, so Pi owns the directory and
|
|
182
|
+
* Super Pi never has to read a transcript it could only misread.
|
|
183
|
+
* - `agentSpawnArgs` verbatim, so a sub-agent's tool allowlist and prompt go through the one proven
|
|
184
|
+
* translation rather than a second hand-rolled one.
|
|
185
|
+
*
|
|
186
|
+
* The TASK goes over RPC stdin, never on argv. The reference passes it as a positional argument, which
|
|
187
|
+
* under `shell: true` on Windows is cmd.exe's to parse: an ampersand or a pipe in a model's own words
|
|
188
|
+
* becomes a command. `{ type: "prompt" }` is exactly how the primary agent is already prompted, so
|
|
189
|
+
* this costs nothing and removes the whole class of bug.
|
|
190
|
+
*/
|
|
191
|
+
run(input: SubagentRunInput): Promise<SubagentResult>;
|
|
192
|
+
/**
|
|
193
|
+
* The definition this run will use, or the reason there is none.
|
|
194
|
+
*
|
|
195
|
+
* Read with `mode: "subagent"`, so a primary agent is not found by id at all rather than found and
|
|
196
|
+
* then judged: a sub-agent definition is the same `agents/*.md` file with a different `mode`, and this
|
|
197
|
+
* is the filter that keeps the two rosters from ever meeting.
|
|
198
|
+
*/
|
|
199
|
+
private subagentDefinition;
|
|
200
|
+
}
|