@evandu/super-pi-server 0.0.0-stage → 0.1.260
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 +250 -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 +396 -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 +450 -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,388 @@
|
|
|
1
|
+
import type { Store } from "../store.js";
|
|
2
|
+
import type { ConversationService } from "./conversation-service.js";
|
|
3
|
+
import { type RunService } from "./run-service.js";
|
|
4
|
+
import type { SessionLedger } from "../session-ledger.js";
|
|
5
|
+
import type { EventBroadcaster } from "../server-context.js";
|
|
6
|
+
import type { MessageDeliveryMode, RunStatus } from "../types.js";
|
|
7
|
+
import { SessionWatchdog } from "./session-watchdog.js";
|
|
8
|
+
export declare const SESSION_OUTPUT_CHAR_LIMIT: number;
|
|
9
|
+
export declare const sessionResultRelativePath: (conversationId: string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* HOW MANY TIMES A CHILD MAY BE TOLD TO CONTINUE AFTER ITS OUTPUT WAS TRUNCATED.
|
|
12
|
+
*
|
|
13
|
+
* The bound is not about tokens - it is about a model that truncates on EVERY response. Three
|
|
14
|
+
* continuations cover the ordinary case (a long answer split across a few responses) and stop the
|
|
15
|
+
* pathological one. Past the bound the child is reported as unfinished, which is a true sentence
|
|
16
|
+
* about what happened, instead of a loop that never ends.
|
|
17
|
+
*/
|
|
18
|
+
export declare const MAX_LENGTH_CONTINUATIONS = 3;
|
|
19
|
+
export interface SpawnSessionOptions {
|
|
20
|
+
/** Explicit, task-specific findings to hand over without copying private transcripts. */
|
|
21
|
+
handoffNote?: string;
|
|
22
|
+
/** The high-level task to be performed by the sibling session. */
|
|
23
|
+
task: string;
|
|
24
|
+
/** Parent conversation initiating the orchestration, if any. */
|
|
25
|
+
parentConversationId?: string;
|
|
26
|
+
/** Explicit target workspace. A parent conversation records only the session-tree relationship. */
|
|
27
|
+
workspaceId: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional workspace-root-relative subdirectory for the new session. Invalid or out-of-bounds
|
|
30
|
+
* values are rejected before the conversation is created.
|
|
31
|
+
*/
|
|
32
|
+
cwd?: string;
|
|
33
|
+
/** Optional custom title for the new session. */
|
|
34
|
+
title?: string;
|
|
35
|
+
/** Optional agent override for the new session. */
|
|
36
|
+
agentId?: string;
|
|
37
|
+
/** Optional model override for the new session. */
|
|
38
|
+
model?: {
|
|
39
|
+
provider: string;
|
|
40
|
+
modelId: string;
|
|
41
|
+
};
|
|
42
|
+
/** Optional thinking level override for the new session. */
|
|
43
|
+
thinkingLevel?: string;
|
|
44
|
+
/** Initial prompt to send immediately. Defaults to `task`. */
|
|
45
|
+
initialPrompt?: string;
|
|
46
|
+
/** Whether to await turn completion before returning (default: false, asynchronous dispatch). */
|
|
47
|
+
wait?: boolean;
|
|
48
|
+
/** Optional silence watchdog timeout in seconds. If set, parent is reminded if child goes quiet for this duration. */
|
|
49
|
+
watchdogTimeoutSeconds?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the new session opens its OWN memory tree instead of inheriting the parent's.
|
|
52
|
+
*
|
|
53
|
+
* A memory tree is what makes one conversation's tree-scoped memories visible to the sessions
|
|
54
|
+
* under it. A project wants the opposite: the project hangs under the conversation that asked
|
|
55
|
+
* for it in the SIDEBAR, and it shares nothing of that conversation's memories. The session tree
|
|
56
|
+
* edge and the memory tree are two different things, and this flag touches only the second.
|
|
57
|
+
*/
|
|
58
|
+
separateMemoryTree?: boolean;
|
|
59
|
+
/** Copy the settled history of another child of the same parent. */
|
|
60
|
+
forkFromConversationId?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface ReportSessionOptions {
|
|
63
|
+
/** The report content (milestone, findings, roadblock, or final output). */
|
|
64
|
+
content: string;
|
|
65
|
+
/**
|
|
66
|
+
* The status of the child session when reporting.
|
|
67
|
+
* "in_progress" (default): interim update; resets the watchdog timer.
|
|
68
|
+
* "completed" | "failed": terminal update; cancels the watchdog timer.
|
|
69
|
+
*/
|
|
70
|
+
status?: "in_progress" | "completed" | "failed";
|
|
71
|
+
}
|
|
72
|
+
export interface StopSessionOptions {
|
|
73
|
+
/** Whether to stop only the running turn ('active'), only queued messages ('queued'), or both ('all', default). */
|
|
74
|
+
mode?: "active" | "queued" | "all";
|
|
75
|
+
/** Optional specific queued message ID to interrupt or cancel. */
|
|
76
|
+
messageId?: string;
|
|
77
|
+
/** Optional list of specific queued message IDs to selectively withdraw while keeping other queued/steered messages intact. */
|
|
78
|
+
messageIds?: string[];
|
|
79
|
+
}
|
|
80
|
+
export interface SessionSummary {
|
|
81
|
+
conversationId: string;
|
|
82
|
+
workspaceId: string;
|
|
83
|
+
title: string;
|
|
84
|
+
status: RunStatus;
|
|
85
|
+
origin: "user" | "orchestrator";
|
|
86
|
+
parentConversationId?: string;
|
|
87
|
+
task?: string;
|
|
88
|
+
messageCount: number;
|
|
89
|
+
turnCount: number;
|
|
90
|
+
lastAssistantSnippet?: string;
|
|
91
|
+
lastUserSnippet?: string;
|
|
92
|
+
hasPendingQuestion: boolean;
|
|
93
|
+
activeTool?: {
|
|
94
|
+
label: string;
|
|
95
|
+
detail?: string;
|
|
96
|
+
};
|
|
97
|
+
error?: string;
|
|
98
|
+
updatedAt: string;
|
|
99
|
+
createdAt?: number;
|
|
100
|
+
lastProgress?: string;
|
|
101
|
+
output?: string;
|
|
102
|
+
outputPath?: string;
|
|
103
|
+
outputTruncated?: boolean;
|
|
104
|
+
queuedMessages?: {
|
|
105
|
+
id: string;
|
|
106
|
+
delivery: "waiting" | "sending";
|
|
107
|
+
role: "user" | "tool";
|
|
108
|
+
snippet: string;
|
|
109
|
+
}[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Orchestrator service coordinating sibling and child conversations.
|
|
113
|
+
*
|
|
114
|
+
* Provides lifecycle methods (spawn, dispatch, status, list, stop, resume) without
|
|
115
|
+
* duplicating message history or inflating memory.
|
|
116
|
+
*/
|
|
117
|
+
export declare class SessionOrchestratorService {
|
|
118
|
+
private readonly store;
|
|
119
|
+
private readonly conversationService;
|
|
120
|
+
private readonly runService;
|
|
121
|
+
private readonly ledger;
|
|
122
|
+
private readonly broadcaster?;
|
|
123
|
+
private readonly uploadsDir?;
|
|
124
|
+
readonly watchdog: SessionWatchdog;
|
|
125
|
+
/**
|
|
126
|
+
* HOW MANY TIMES EACH CHILD HAS BEEN TOLD TO CONTINUE AFTER A TRUNCATION.
|
|
127
|
+
*
|
|
128
|
+
* Per child rather than per dispatch, so a child that is given several tasks cannot extend itself
|
|
129
|
+
* indefinitely by being handed a new task each time it runs out of output budget. The entry is
|
|
130
|
+
* dropped as soon as the child finishes, so a child that continues successfully starts fresh on
|
|
131
|
+
* its next task.
|
|
132
|
+
*/
|
|
133
|
+
private readonly lengthContinuations;
|
|
134
|
+
/**
|
|
135
|
+
* THE CHILDREN THAT HAVE ALREADY REPORTED THEIR OWN RESULT TO THEIR PARENT, AND WHEN.
|
|
136
|
+
*
|
|
137
|
+
* A child can report explicitly - the `report` action - and that report is the child's own
|
|
138
|
+
* statement of what it did. When the child's turn then ends, the automatic completion report
|
|
139
|
+
* would deliver the same thing a second time, so the automatic path steps aside for a child that
|
|
140
|
+
* is in this map.
|
|
141
|
+
*
|
|
142
|
+
* The entry is added only by a TERMINAL report (`completed` / `failed`), because an interim
|
|
143
|
+
* update is not the child's final word: the task is still running, and the parent will want to
|
|
144
|
+
* hear how it ended.
|
|
145
|
+
*
|
|
146
|
+
* WHY THE MAP HOLDS A TIMESTAMP AND NOT A FLAG. A flag says "this child reported", and that is
|
|
147
|
+
* not the same question as "this child reported ABOUT THE TURN THAT JUST ENDED". A flag stays
|
|
148
|
+
* true for the rest of the child's life, so it silences every automatic report the child ever
|
|
149
|
+
* produces again: the parent gives the same child a second task, the child finishes, and the
|
|
150
|
+
* result is swallowed because of a report the parent received about the FIRST task. The parent
|
|
151
|
+
* waits for a result that was written and never arrives, and nothing in the transcript says why.
|
|
152
|
+
*
|
|
153
|
+
* The timestamp answers the real question: the report was made INSIDE this turn, so it speaks for
|
|
154
|
+
* this turn. A report made before the turn started speaks for an earlier one, and this turn's
|
|
155
|
+
* result is still its own.
|
|
156
|
+
*/
|
|
157
|
+
private readonly reportedChildren;
|
|
158
|
+
/**
|
|
159
|
+
* THE COMPLETION NOTICES THAT HAVE ALREADY KNOCKED ON A PARENT'S DOOR.
|
|
160
|
+
*
|
|
161
|
+
* One entry per finished child per completion, and the completion is identified by the child's
|
|
162
|
+
* last answer - so a RETRY of the same finished turn knocks once, while the next turn the child
|
|
163
|
+
* runs is a different completion and knocks again.
|
|
164
|
+
*
|
|
165
|
+
* WHY THIS IS A SET AND NOT A FLAG. A flag would say "this child has been announced", and that
|
|
166
|
+
* is a different question from "THIS completion has been announced". A flag silences every
|
|
167
|
+
* later completion of the same child, and a child that works for three turns would be announced
|
|
168
|
+
* once - the parent would sit through two of the child's finishes without being told.
|
|
169
|
+
*/
|
|
170
|
+
private readonly completionNotices;
|
|
171
|
+
constructor(store: Store, conversationService: ConversationService, runService: RunService, ledger: SessionLedger, broadcaster?: EventBroadcaster | undefined, watchdog?: SessionWatchdog, uploadsDir?: string | undefined);
|
|
172
|
+
/**
|
|
173
|
+
* The watchdog timer fired: the child has been silent for longer than the parent declared.
|
|
174
|
+
* Delivers a reminder message to the parent session. Does NOT interrupt or abort the child session.
|
|
175
|
+
*/
|
|
176
|
+
private handleWatchdogTimeout;
|
|
177
|
+
/**
|
|
178
|
+
* Spawns a new sibling conversation and immediately dispatches its initial task.
|
|
179
|
+
*/
|
|
180
|
+
spawn(options: SpawnSessionOptions): Promise<{
|
|
181
|
+
conversationId: string;
|
|
182
|
+
}>;
|
|
183
|
+
/**
|
|
184
|
+
* Dispatches a message to an arbitrary session (server-to-server).
|
|
185
|
+
* By default dispatches asynchronously so the orchestrator caller is not blocked.
|
|
186
|
+
*
|
|
187
|
+
* `silent` is for the platform's own housekeeping - the completion knock. A knock wakes a
|
|
188
|
+
* session and carries no result, so the turn it starts must not produce a result report of its
|
|
189
|
+
* own: a knock that made the woken session report up would turn one child's finish into a
|
|
190
|
+
* chain of knocks all the way to the top.
|
|
191
|
+
*/
|
|
192
|
+
dispatch(conversationId: string, content: string, options?: {
|
|
193
|
+
wait?: boolean;
|
|
194
|
+
mode?: MessageDeliveryMode;
|
|
195
|
+
silent?: boolean;
|
|
196
|
+
}): Promise<{
|
|
197
|
+
conversationId: string;
|
|
198
|
+
messageId?: string;
|
|
199
|
+
mode: MessageDeliveryMode;
|
|
200
|
+
}>;
|
|
201
|
+
/**
|
|
202
|
+
* THE PLATFORM KNOCKS ON THE PARENT'S DOOR WHEN A CHILD SESSION ENDS.
|
|
203
|
+
*
|
|
204
|
+
* A child that finished its work is a child the parent has to hear about, and the PLATFORM is the
|
|
205
|
+
* one that knows the turn ended: the child may forget to say so, and a parent that was not
|
|
206
|
+
* present for the turn cannot see that it happened. This is the platform's own housekeeping -
|
|
207
|
+
* it is not something the child is asked to do and not something the model has to remember.
|
|
208
|
+
*
|
|
209
|
+
* THE KNOCK CARRIES NO WORK. It says WHICH child session finished and nothing else: no output,
|
|
210
|
+
* no summary, no last message, no result, no task result. The parent reads the child's session
|
|
211
|
+
* itself, so a platform that summarized here would be writing the report the parent is supposed
|
|
212
|
+
* to write - and a summary written by the platform is a summary nobody verified.
|
|
213
|
+
*
|
|
214
|
+
* ONLY THE DIRECT PARENT IS TOLD. The parent wakes up and looks at its own child; the
|
|
215
|
+
* grandparent is not told about a grandchild's finish, because the parent is the one who has to
|
|
216
|
+
* decide what that means.
|
|
217
|
+
*
|
|
218
|
+
* A TOP-LEVEL SESSION HAS NOBODY TO TELL, so a session without a parent produces nothing - and
|
|
219
|
+
* the user's own session is one of those.
|
|
220
|
+
*/
|
|
221
|
+
notifyChildCompleted(childConversationId: string, options?: {
|
|
222
|
+
unit?: string;
|
|
223
|
+
}): Promise<{
|
|
224
|
+
delivered: boolean;
|
|
225
|
+
parentConversationId?: string;
|
|
226
|
+
}>;
|
|
227
|
+
/**
|
|
228
|
+
* WHAT MAKES TWO COMPLETION REPORTS THE SAME COMPLETION.
|
|
229
|
+
*
|
|
230
|
+
* The child's last answer is the thing the completion is about, so two reports that arrive after
|
|
231
|
+
* the same answer are the same completion - a retry, a repeated settle, a second report about a
|
|
232
|
+
* turn that already ended. The next turn produces the next answer, and that is a new completion
|
|
233
|
+
* the parent has not been told about yet.
|
|
234
|
+
*/
|
|
235
|
+
private completionUnit;
|
|
236
|
+
/**
|
|
237
|
+
* IS THIS SESSION ONE OF A PROJECT'S EMPLOYEES?
|
|
238
|
+
*
|
|
239
|
+
* A project member's turn ending is NOT its work being done: the delivery still has to be
|
|
240
|
+
* reviewed. The moment that counts is the task being completed, and the project announces that
|
|
241
|
+
* one - announcing both would wake the Leader twice for one piece of work.
|
|
242
|
+
*/
|
|
243
|
+
private projectParticipant;
|
|
244
|
+
/**
|
|
245
|
+
* THE CHILD'S OUTPUT WAS CUT OFF. TELL IT TO CARRY ON, AND LET IT.
|
|
246
|
+
*
|
|
247
|
+
* This is the recovery for a length stop, and it exists because a truncated answer is not a
|
|
248
|
+
* finished one. The child has already said most of what it had to say - that text is on its
|
|
249
|
+
* transcript - so the work left to do is the tail of the answer, not the whole of it.
|
|
250
|
+
*
|
|
251
|
+
* WHY THE CONTINUATION IS A NEW TURN RATHER THAN A RESUME OF THE SAME ONE. Pi has already settled
|
|
252
|
+
* the turn that was truncated: the model stopped, the message was written, the run ended. There is
|
|
253
|
+
* no live turn to resume, so the only way to get more output is to ask again - and asking again in
|
|
254
|
+
* the SAME conversation is what makes the continuation work, because the child's own partial
|
|
255
|
+
* answer is in its context and the model can see exactly where it stopped.
|
|
256
|
+
*
|
|
257
|
+
* WHY IT IS AN AGENT-SENT ORDER RATHER THAN A USER MESSAGE. The person never typed this, and the
|
|
258
|
+
* child's transcript must not show words under their name that they never said - the same reason
|
|
259
|
+
* `dispatch` uses `enqueueAndRunAsAgent` in the first place.
|
|
260
|
+
*
|
|
261
|
+
* Returns true when the child was continued (and the caller must NOT report a failure), and false
|
|
262
|
+
* when the continuation could not be made or the bound was reached - in which case the caller
|
|
263
|
+
* reports the original failure, which is then the honest description of what happened.
|
|
264
|
+
*/
|
|
265
|
+
private continueAfterLengthStop;
|
|
266
|
+
/**
|
|
267
|
+
* Explicit report from a child session to its direct parent.
|
|
268
|
+
* Can be called multiple times at any point during execution.
|
|
269
|
+
*/
|
|
270
|
+
report(childConversationId: string, options: ReportSessionOptions): Promise<{
|
|
271
|
+
delivered: boolean;
|
|
272
|
+
parentConversationId: string;
|
|
273
|
+
}>;
|
|
274
|
+
/**
|
|
275
|
+
* Sets or updates a silence watchdog timer on a child session.
|
|
276
|
+
*/
|
|
277
|
+
setWatchdog(options: {
|
|
278
|
+
childConversationId: string;
|
|
279
|
+
parentConversationId: string;
|
|
280
|
+
timeoutSeconds: number;
|
|
281
|
+
}): Promise<{
|
|
282
|
+
ok: boolean;
|
|
283
|
+
childConversationId: string;
|
|
284
|
+
timeoutSeconds: number;
|
|
285
|
+
}>;
|
|
286
|
+
/**
|
|
287
|
+
* Cancels a silence watchdog timer on a child session.
|
|
288
|
+
*/
|
|
289
|
+
cancelWatchdog(childConversationId: string): Promise<{
|
|
290
|
+
ok: boolean;
|
|
291
|
+
}>;
|
|
292
|
+
/**
|
|
293
|
+
* Re-arms persisted watchdogs from disk.
|
|
294
|
+
*/
|
|
295
|
+
restoreWatchdogs(): Promise<void>;
|
|
296
|
+
private persistSessionResult;
|
|
297
|
+
/**
|
|
298
|
+
* Returns a high-level summary of a session's progress without returning full transcripts.
|
|
299
|
+
* Uses narrow store reader `store.conversation(id)` to avoid cloning the entire state.
|
|
300
|
+
*/
|
|
301
|
+
status(conversationId: string, options?: {
|
|
302
|
+
includeOutput?: boolean;
|
|
303
|
+
}): Promise<SessionSummary>;
|
|
304
|
+
/**
|
|
305
|
+
* Lists summaries of all sessions, optionally filtered by parent conversation.
|
|
306
|
+
*
|
|
307
|
+
* Persisted store conversations are the authoritative source for session tree
|
|
308
|
+
* parent-child relationships across server restarts, while SessionLedger
|
|
309
|
+
* enriches live in-memory task, progress, and activeTool state.
|
|
310
|
+
*/
|
|
311
|
+
list(parentConversationId?: string): Promise<SessionSummary[]>;
|
|
312
|
+
/**
|
|
313
|
+
* Stops a target session.
|
|
314
|
+
* Can distinguish between interrupting an active turn, cancelling queued messages, or both.
|
|
315
|
+
*/
|
|
316
|
+
stop(conversationId: string, options?: StopSessionOptions): Promise<{
|
|
317
|
+
stopped: boolean;
|
|
318
|
+
mode: string;
|
|
319
|
+
withdrawn?: {
|
|
320
|
+
id: string;
|
|
321
|
+
content: string;
|
|
322
|
+
role: "user" | "tool";
|
|
323
|
+
}[];
|
|
324
|
+
missingIds?: string[];
|
|
325
|
+
}>;
|
|
326
|
+
/**
|
|
327
|
+
* THE SESSIONS UNDER ONE SESSION, DEEPEST LAST.
|
|
328
|
+
*
|
|
329
|
+
* The tree edge lives on the conversation itself (`parentConversationId`), so "who is under this
|
|
330
|
+
* one?" is a walk over the workspace's conversations rather than a separate structure that could
|
|
331
|
+
* disagree with it. The order is breadth-first, which is depth order - and the caller stops them
|
|
332
|
+
* in reverse, so the deepest work dies before the session that owns it.
|
|
333
|
+
*/
|
|
334
|
+
private descendantsOf;
|
|
335
|
+
/**
|
|
336
|
+
* STOPS A SESSION AND EVERYTHING UNDER IT.
|
|
337
|
+
*
|
|
338
|
+
* THIS IS NOT THE SAME THING AS STOPPING A SESSION, and it is deliberately a separate operation
|
|
339
|
+
* rather than a flag on the other one. Stopping a session stops THAT session: its turn, its queued
|
|
340
|
+
* messages, its watchdog. Nothing else. That behaviour is right for the ordinary case - a child
|
|
341
|
+
* that went down the wrong path should not take its own children down with it, because those
|
|
342
|
+
* children may be doing work the parent still wants.
|
|
343
|
+
*
|
|
344
|
+
* But there is a case where the ordinary case leaves a mess. A supervisor whose own supervisor has
|
|
345
|
+
* stopped is an ORPHAN, and the sessions it started are orphans too: they keep burning tokens,
|
|
346
|
+
* keep writing files, and report their results to a session that is no longer running - nobody is
|
|
347
|
+
* left to read them. The parent sees a child that has gone wrong, stops it, and the grandchildren
|
|
348
|
+
* keep running with no parent to stop them.
|
|
349
|
+
*
|
|
350
|
+
* So this operation takes the whole tree: the root, its children, its grandchildren, deepest
|
|
351
|
+
* first. The descendants are stopped AS A CONSEQUENCE of the root being stopped - the caller is
|
|
352
|
+
* still only managing its OWN direct child, and the cross-level reach the scope rules forbid is
|
|
353
|
+
* not what happens here: a grandchild cannot be stopped on its own, and it cannot be spared
|
|
354
|
+
* either, because it cannot outlive the session that owns it.
|
|
355
|
+
*/
|
|
356
|
+
stopSubtree(conversationId: string, options?: StopSessionOptions): Promise<{
|
|
357
|
+
stopped: boolean;
|
|
358
|
+
mode: string;
|
|
359
|
+
stoppedIds: string[];
|
|
360
|
+
descendantCount: number;
|
|
361
|
+
}>;
|
|
362
|
+
removeWarmSession(conversationId: string): Promise<void>;
|
|
363
|
+
/**
|
|
364
|
+
* Permanently destroys a direct child session and its entire descendant subtree (stopping any
|
|
365
|
+
* running/queued turns first) and removes all transcripts, outputs, runs, and auxiliary state.
|
|
366
|
+
*/
|
|
367
|
+
remove(conversationId: string, options?: {
|
|
368
|
+
reason?: string;
|
|
369
|
+
}): Promise<{
|
|
370
|
+
removed: boolean;
|
|
371
|
+
alreadyRemoved: boolean;
|
|
372
|
+
conversationId: string;
|
|
373
|
+
title?: string;
|
|
374
|
+
destroyedIds: string[];
|
|
375
|
+
stoppedFirst: boolean;
|
|
376
|
+
reason?: string;
|
|
377
|
+
}>;
|
|
378
|
+
/**
|
|
379
|
+
* Resumes execution in a conversation.
|
|
380
|
+
* If prompt is provided, sends it as a new turn.
|
|
381
|
+
* Otherwise, if there is a waiting message in the queue, kicks off its execution.
|
|
382
|
+
*/
|
|
383
|
+
resume(conversationId: string, prompt?: string, options?: {
|
|
384
|
+
wait?: boolean;
|
|
385
|
+
}): Promise<{
|
|
386
|
+
conversationId: string;
|
|
387
|
+
}>;
|
|
388
|
+
}
|