@cerebriline/core 4.100.240
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/LICENSE +201 -0
- package/README.md +16 -0
- package/assets/office-oxide/LICENSE-APACHE +176 -0
- package/assets/office-oxide/LICENSE-MIT +25 -0
- package/assets/office-oxide/office_oxide_bg.wasm +0 -0
- package/assets/prompt-templates/claude.md +516 -0
- package/assets/prompt-templates/deepseek.md +331 -0
- package/assets/prompt-templates/default.md +386 -0
- package/assets/prompt-templates/gemma.md +352 -0
- package/assets/prompt-templates/glm.md +334 -0
- package/assets/prompt-templates/kimi-k3.md +408 -0
- package/assets/prompt-templates/kimi.md +402 -0
- package/assets/prompt-templates/minimax.md +473 -0
- package/assets/prompt-templates/nemotron.md +358 -0
- package/assets/prompt-templates/qwen.md +612 -0
- package/dist/ClineCore.d.ts +365 -0
- package/dist/account/cline-account-service.d.ts +41 -0
- package/dist/account/index.d.ts +3 -0
- package/dist/account/rpc.d.ts +40 -0
- package/dist/account/types.d.ts +122 -0
- package/dist/auth/bounded-ttl-cache.d.ts +13 -0
- package/dist/auth/client.d.ts +30 -0
- package/dist/auth/cline.d.ts +71 -0
- package/dist/auth/codex.d.ts +40 -0
- package/dist/auth/oca.d.ts +21 -0
- package/dist/auth/provider-auth-registry.d.ts +52 -0
- package/dist/auth/server.d.ts +54 -0
- package/dist/auth/types.d.ts +103 -0
- package/dist/auth/utils.d.ts +31 -0
- package/dist/cline-core/automation.d.ts +34 -0
- package/dist/cline-core/runtime-services.d.ts +5 -0
- package/dist/cline-core/start-input.d.ts +10 -0
- package/dist/cline-core/telemetry.d.ts +10 -0
- package/dist/cline-core/types.d.ts +236 -0
- package/dist/cron/events/cron-event-ingress.d.ts +37 -0
- package/dist/cron/reports/cron-report-writer.d.ts +42 -0
- package/dist/cron/runner/cron-materializer.d.ts +35 -0
- package/dist/cron/runner/cron-runner.d.ts +60 -0
- package/dist/cron/runner/resource-limiter.d.ts +8 -0
- package/dist/cron/schedule/scheduler.d.ts +12 -0
- package/dist/cron/service/cron-service.d.ts +56 -0
- package/dist/cron/service/schedule-command-service.d.ts +14 -0
- package/dist/cron/service/schedule-service.d.ts +116 -0
- package/dist/cron/service/schedule-tool.d.ts +81 -0
- package/dist/cron/specs/cron-reconciler.d.ts +61 -0
- package/dist/cron/specs/cron-spec-parser.d.ts +26 -0
- package/dist/cron/specs/cron-watcher.d.ts +22 -0
- package/dist/cron/store/cron-schema.d.ts +2 -0
- package/dist/cron/store/sqlite-cron-store.d.ts +261 -0
- package/dist/extensions/agent-plugin/agent-skill.d.ts +21 -0
- package/dist/extensions/agent-plugin/index.d.ts +4 -0
- package/dist/extensions/agent-plugin/loader.d.ts +10 -0
- package/dist/extensions/agent-plugin/types.d.ts +67 -0
- package/dist/extensions/complexity/grammars.d.ts +92 -0
- package/dist/extensions/complexity/walker.d.ts +115 -0
- package/dist/extensions/config/builtin-templates.d.ts +10 -0
- package/dist/extensions/config/builtin-templates.generated.d.ts +5 -0
- package/dist/extensions/config/index.d.ts +15 -0
- package/dist/extensions/config/prompt-template-compaction.d.ts +92 -0
- package/dist/extensions/config/prompt-template-delta.d.ts +107 -0
- package/dist/extensions/config/prompt-template-hooks.d.ts +47 -0
- package/dist/extensions/config/prompt-template-loader.d.ts +79 -0
- package/dist/extensions/config/prompt-template-parser.d.ts +56 -0
- package/dist/extensions/config/prompt-template-review.d.ts +327 -0
- package/dist/extensions/config/prompt-template-session.d.ts +46 -0
- package/dist/extensions/config/runtime-commands.d.ts +23 -0
- package/dist/extensions/config/shipped-tool-signatures.d.ts +36 -0
- package/dist/extensions/config/skill-frontmatter-toggle.d.ts +11 -0
- package/dist/extensions/config/unified-config-file-watcher.d.ts +77 -0
- package/dist/extensions/config/user-instruction-config-loader.d.ts +77 -0
- package/dist/extensions/config/user-instruction-plugin.d.ts +26 -0
- package/dist/extensions/config/user-instruction-service.d.ts +31 -0
- package/dist/extensions/context/agentic-compaction.d.ts +129 -0
- package/dist/extensions/context/basic-compaction.d.ts +19 -0
- package/dist/extensions/context/budget-projection/index.d.ts +2 -0
- package/dist/extensions/context/budget-projection/project.d.ts +4 -0
- package/dist/extensions/context/budget-projection/types.d.ts +58 -0
- package/dist/extensions/context/capped-thinking.d.ts +195 -0
- package/dist/extensions/context/compaction-cause.d.ts +27 -0
- package/dist/extensions/context/compaction-journal.d.ts +65 -0
- package/dist/extensions/context/compaction-revisions.d.ts +72 -0
- package/dist/extensions/context/compaction-shared.d.ts +608 -0
- package/dist/extensions/context/compaction.d.ts +161 -0
- package/dist/extensions/context/context-minimum-warning.d.ts +27 -0
- package/dist/extensions/context/continuation-compaction.d.ts +260 -0
- package/dist/extensions/context/council-compaction.d.ts +262 -0
- package/dist/extensions/context/full-compaction.d.ts +44 -0
- package/dist/extensions/context/kv-pressure.d.ts +258 -0
- package/dist/extensions/context/polykv-session.d.ts +372 -0
- package/dist/extensions/context/replay-compaction.d.ts +90 -0
- package/dist/extensions/context/tool-ledger.d.ts +198 -0
- package/dist/extensions/context/work-digest.d.ts +92 -0
- package/dist/extensions/index.d.ts +7 -0
- package/dist/extensions/mcp/client.d.ts +28 -0
- package/dist/extensions/mcp/config-loader.d.ts +102 -0
- package/dist/extensions/mcp/index.d.ts +15 -0
- package/dist/extensions/mcp/manager.d.ts +23 -0
- package/dist/extensions/mcp/name-transform.d.ts +2 -0
- package/dist/extensions/mcp/oauth.d.ts +68 -0
- package/dist/extensions/mcp/plugin-server-registration.d.ts +18 -0
- package/dist/extensions/mcp/policies.d.ts +14 -0
- package/dist/extensions/mcp/remote-proxy.d.ts +9 -0
- package/dist/extensions/mcp/timeout.d.ts +2 -0
- package/dist/extensions/mcp/tools.d.ts +3 -0
- package/dist/extensions/mcp/types.d.ts +133 -0
- package/dist/extensions/plugin/plugin-config-loader.d.ts +44 -0
- package/dist/extensions/plugin/plugin-load-report.d.ts +18 -0
- package/dist/extensions/plugin/plugin-loader.d.ts +23 -0
- package/dist/extensions/plugin/plugin-module-import.d.ts +4 -0
- package/dist/extensions/plugin/plugin-sandbox.d.ts +82 -0
- package/dist/extensions/plugin/plugin-targeting.d.ts +6 -0
- package/dist/extensions/plugin-sandbox-bootstrap.js +1 -0
- package/dist/extensions/tools/ask-lsp.d.ts +150 -0
- package/dist/extensions/tools/audio-tools.d.ts +156 -0
- package/dist/extensions/tools/browser.d.ts +137 -0
- package/dist/extensions/tools/check-file.d.ts +218 -0
- package/dist/extensions/tools/check-on-failure.d.ts +49 -0
- package/dist/extensions/tools/code-intel.d.ts +131 -0
- package/dist/extensions/tools/command-guard-extension.d.ts +22 -0
- package/dist/extensions/tools/command-guard.d.ts +29 -0
- package/dist/extensions/tools/constants.d.ts +28 -0
- package/dist/extensions/tools/definitions.d.ts +178 -0
- package/dist/extensions/tools/delimiter-balance.d.ts +121 -0
- package/dist/extensions/tools/edit-verification.d.ts +86 -0
- package/dist/extensions/tools/error-locations.d.ts +53 -0
- package/dist/extensions/tools/executors/apply-patch-parser.d.ts +68 -0
- package/dist/extensions/tools/executors/apply-patch.d.ts +48 -0
- package/dist/extensions/tools/executors/awk-parser.d.ts +163 -0
- package/dist/extensions/tools/executors/awk.d.ts +41 -0
- package/dist/extensions/tools/executors/bash.d.ts +119 -0
- package/dist/extensions/tools/executors/document/assets.d.ts +22 -0
- package/dist/extensions/tools/executors/document/ebook.d.ts +11 -0
- package/dist/extensions/tools/executors/document/formats.d.ts +83 -0
- package/dist/extensions/tools/executors/document/images.d.ts +73 -0
- package/dist/extensions/tools/executors/document/legacy.d.ts +20 -0
- package/dist/extensions/tools/executors/document/ocr.d.ts +67 -0
- package/dist/extensions/tools/executors/document/office-oxide.d.ts +19 -0
- package/dist/extensions/tools/executors/document/office-oxide.generated.d.ts +82 -0
- package/dist/extensions/tools/executors/document/office.d.ts +10 -0
- package/dist/extensions/tools/executors/document/pdf.d.ts +6 -0
- package/dist/extensions/tools/executors/document/pdfjs.d.ts +30 -0
- package/dist/extensions/tools/executors/document/range.d.ts +18 -0
- package/dist/extensions/tools/executors/document/recognition.d.ts +67 -0
- package/dist/extensions/tools/executors/document-extract.d.ts +55 -0
- package/dist/extensions/tools/executors/editor.d.ts +68 -0
- package/dist/extensions/tools/executors/file-locks.d.ts +41 -0
- package/dist/extensions/tools/executors/file-read.d.ts +136 -0
- package/dist/extensions/tools/executors/grep.d.ts +35 -0
- package/dist/extensions/tools/executors/index.d.ts +97 -0
- package/dist/extensions/tools/executors/line-endings.d.ts +23 -0
- package/dist/extensions/tools/executors/output-limits.d.ts +58 -0
- package/dist/extensions/tools/executors/overlay-receipts.d.ts +25 -0
- package/dist/extensions/tools/executors/posix-regex.d.ts +52 -0
- package/dist/extensions/tools/executors/read-receipts.d.ts +93 -0
- package/dist/extensions/tools/executors/run-command-execution-controller.d.ts +16 -0
- package/dist/extensions/tools/executors/search.d.ts +50 -0
- package/dist/extensions/tools/executors/sed.d.ts +92 -0
- package/dist/extensions/tools/executors/unchanged-reads.d.ts +55 -0
- package/dist/extensions/tools/executors/web-fetch.d.ts +58 -0
- package/dist/extensions/tools/helpers.d.ts +59 -0
- package/dist/extensions/tools/image-edit.d.ts +76 -0
- package/dist/extensions/tools/image-generation.d.ts +183 -0
- package/dist/extensions/tools/index.d.ts +68 -0
- package/dist/extensions/tools/jev.d.ts +336 -0
- package/dist/extensions/tools/list-files.d.ts +128 -0
- package/dist/extensions/tools/media-endpoint.d.ts +160 -0
- package/dist/extensions/tools/media-tools.d.ts +140 -0
- package/dist/extensions/tools/model-tool-routing.d.ts +33 -0
- package/dist/extensions/tools/presets.d.ts +154 -0
- package/dist/extensions/tools/qa-credentials.d.ts +133 -0
- package/dist/extensions/tools/runtime.d.ts +39 -0
- package/dist/extensions/tools/schemas.d.ts +845 -0
- package/dist/extensions/tools/task-progress.d.ts +217 -0
- package/dist/extensions/tools/team/agent-admission.d.ts +127 -0
- package/dist/extensions/tools/team/agent-check.d.ts +152 -0
- package/dist/extensions/tools/team/agent-controls.d.ts +55 -0
- package/dist/extensions/tools/team/agent-file.d.ts +28 -0
- package/dist/extensions/tools/team/agent-iteration-cap.d.ts +328 -0
- package/dist/extensions/tools/team/agent-names.d.ts +29 -0
- package/dist/extensions/tools/team/agent-node-placement.d.ts +160 -0
- package/dist/extensions/tools/team/agent-placement-queue.d.ts +199 -0
- package/dist/extensions/tools/team/agent-placement.d.ts +118 -0
- package/dist/extensions/tools/team/agent-reports.d.ts +53 -0
- package/dist/extensions/tools/team/agent-rounds.d.ts +666 -0
- package/dist/extensions/tools/team/agent-sandbox-executors.d.ts +79 -0
- package/dist/extensions/tools/team/agent-slot-gate.d.ts +186 -0
- package/dist/extensions/tools/team/agent-status.d.ts +84 -0
- package/dist/extensions/tools/team/agent-trouble.d.ts +91 -0
- package/dist/extensions/tools/team/background-delegations.d.ts +106 -0
- package/dist/extensions/tools/team/batch-report.d.ts +151 -0
- package/dist/extensions/tools/team/configured-agent-config.d.ts +37 -0
- package/dist/extensions/tools/team/configured-agent-tool.d.ts +135 -0
- package/dist/extensions/tools/team/create-agent-tool.d.ts +45 -0
- package/dist/extensions/tools/team/delegate-to-agent.d.ts +105 -0
- package/dist/extensions/tools/team/delegated-agent.d.ts +272 -0
- package/dist/extensions/tools/team/delegated-sandboxes.d.ts +125 -0
- package/dist/extensions/tools/team/delegated-tools.d.ts +40 -0
- package/dist/extensions/tools/team/delegation-call-hooks.d.ts +30 -0
- package/dist/extensions/tools/team/engine-evictions.d.ts +38 -0
- package/dist/extensions/tools/team/index.d.ts +20 -0
- package/dist/extensions/tools/team/lead-agent-tools.d.ts +92 -0
- package/dist/extensions/tools/team/multi-agent.d.ts +364 -0
- package/dist/extensions/tools/team/node-reachability.d.ts +53 -0
- package/dist/extensions/tools/team/node-throughput.d.ts +40 -0
- package/dist/extensions/tools/team/placed-run.d.ts +114 -0
- package/dist/extensions/tools/team/projections.d.ts +8 -0
- package/dist/extensions/tools/team/runtime.d.ts +6 -0
- package/dist/extensions/tools/team/session-window-retry.d.ts +28 -0
- package/dist/extensions/tools/team/spawn-agent-tool.d.ts +450 -0
- package/dist/extensions/tools/team/spawn-sampling.d.ts +188 -0
- package/dist/extensions/tools/team/spawn-swarm-tool.d.ts +330 -0
- package/dist/extensions/tools/team/subagent-cancellation.d.ts +188 -0
- package/dist/extensions/tools/team/subagent-layout.d.ts +90 -0
- package/dist/extensions/tools/team/subagent-output.d.ts +73 -0
- package/dist/extensions/tools/team/subagent-progress.d.ts +211 -0
- package/dist/extensions/tools/team/subagent-prompts.d.ts +3 -0
- package/dist/extensions/tools/team/team-state-dates.d.ts +10 -0
- package/dist/extensions/tools/team/team-tools.d.ts +56 -0
- package/dist/extensions/tools/team/teammates-off.d.ts +14 -0
- package/dist/extensions/tools/team/token-split.d.ts +28 -0
- package/dist/extensions/tools/team/turn-fault-recovery.d.ts +71 -0
- package/dist/extensions/tools/types.d.ts +410 -0
- package/dist/extensions/tools/video-generation.d.ts +94 -0
- package/dist/hooks/checkpoint-hooks.d.ts +39 -0
- package/dist/hooks/hook-extension.d.ts +2 -0
- package/dist/hooks/hook-file-config.d.ts +24 -0
- package/dist/hooks/hook-file-hooks.d.ts +22 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/subprocess-runner.d.ts +21 -0
- package/dist/hooks/subprocess.d.ts +74 -0
- package/dist/hub/client/connect.d.ts +14 -0
- package/dist/hub/client/index.d.ts +146 -0
- package/dist/hub/client/managed-hub-build-watcher.d.ts +62 -0
- package/dist/hub/client/session-client.d.ts +138 -0
- package/dist/hub/client/ui-client.d.ts +52 -0
- package/dist/hub/daemon/entry.d.ts +15 -0
- package/dist/hub/daemon/entry.js +2033 -0
- package/dist/hub/daemon/index.d.ts +125 -0
- package/dist/hub/daemon/runtime-handlers.d.ts +12 -0
- package/dist/hub/daemon/shutdown-coordinator.d.ts +31 -0
- package/dist/hub/daemon/start-shared-server.d.ts +18 -0
- package/dist/hub/daemon/telemetry.d.ts +19 -0
- package/dist/hub/discovery/defaults.d.ts +16 -0
- package/dist/hub/discovery/index.d.ts +139 -0
- package/dist/hub/discovery/instance-lock.d.ts +51 -0
- package/dist/hub/discovery/workspace.d.ts +13 -0
- package/dist/hub/index.d.ts +38 -0
- package/dist/hub/index.js +2023 -0
- package/dist/hub/runtime-host/hub-runtime-host.d.ts +83 -0
- package/dist/hub/runtime-host/remote-runtime-host.d.ts +9 -0
- package/dist/hub/server/browser-websocket.d.ts +22 -0
- package/dist/hub/server/command-transport.d.ts +29 -0
- package/dist/hub/server/handlers/approval-handlers.d.ts +24 -0
- package/dist/hub/server/handlers/capability-handlers.d.ts +12 -0
- package/dist/hub/server/handlers/client-handlers.d.ts +6 -0
- package/dist/hub/server/handlers/connector-handlers.d.ts +20 -0
- package/dist/hub/server/handlers/context.d.ts +98 -0
- package/dist/hub/server/handlers/run-handlers.d.ts +6 -0
- package/dist/hub/server/handlers/run-queue-handlers.d.ts +33 -0
- package/dist/hub/server/handlers/session-event-projector.d.ts +7 -0
- package/dist/hub/server/handlers/session-handlers.d.ts +30 -0
- package/dist/hub/server/hub-client-contributions.d.ts +19 -0
- package/dist/hub/server/hub-event-log.d.ts +57 -0
- package/dist/hub/server/hub-notifications.d.ts +7 -0
- package/dist/hub/server/hub-run-queue.d.ts +82 -0
- package/dist/hub/server/hub-schedule-events.d.ts +2 -0
- package/dist/hub/server/hub-server-logging.d.ts +2 -0
- package/dist/hub/server/hub-server-options.d.ts +94 -0
- package/dist/hub/server/hub-server-transport.d.ts +71 -0
- package/dist/hub/server/hub-session-records.d.ts +9 -0
- package/dist/hub/server/hub-websocket-server.d.ts +12 -0
- package/dist/hub/server/index.d.ts +4 -0
- package/dist/hub/server/native-transport.d.ts +25 -0
- package/dist/hub/server/task-command-service.d.ts +11 -0
- package/dist/index.d.ts +172 -0
- package/dist/index.js +5435 -0
- package/dist/logging/early-logger.d.ts +37 -0
- package/dist/remote-config/integration.d.ts +17 -0
- package/dist/runtime/atomic/base-revision-reads.d.ts +106 -0
- package/dist/runtime/atomic/base-revision.d.ts +77 -0
- package/dist/runtime/atomic/check-first-edits.d.ts +79 -0
- package/dist/runtime/atomic/file-revisions.d.ts +268 -0
- package/dist/runtime/atomic/oracle.d.ts +178 -0
- package/dist/runtime/atomic/page-check.d.ts +39 -0
- package/dist/runtime/atomic/plan-capture.d.ts +40 -0
- package/dist/runtime/atomic/plan-text.d.ts +33 -0
- package/dist/runtime/atomic/plan-tool.d.ts +159 -0
- package/dist/runtime/atomic/proposal.d.ts +112 -0
- package/dist/runtime/atomic/propose-check-tool.d.ts +76 -0
- package/dist/runtime/atomic/protocol.d.ts +233 -0
- package/dist/runtime/atomic/restore-file-tool.d.ts +196 -0
- package/dist/runtime/atomic/revision-capture.d.ts +75 -0
- package/dist/runtime/atomic/run-check-tool.d.ts +64 -0
- package/dist/runtime/atomic/session-protocol.d.ts +304 -0
- package/dist/runtime/atomic/session-revisions.d.ts +77 -0
- package/dist/runtime/atomic/snapshot.d.ts +77 -0
- package/dist/runtime/atomic/stalled-checks.d.ts +106 -0
- package/dist/runtime/atomic/submit-transaction-tool.d.ts +50 -0
- package/dist/runtime/atomic/tool-activity.d.ts +15 -0
- package/dist/runtime/atomic/transaction-controller.d.ts +364 -0
- package/dist/runtime/atomic/unparseable-change.d.ts +35 -0
- package/dist/runtime/capabilities/index.d.ts +2 -0
- package/dist/runtime/capabilities/normalize-runtime-capabilities.d.ts +2 -0
- package/dist/runtime/capabilities/runtime-capabilities.d.ts +18 -0
- package/dist/runtime/config/agent-message-codec.d.ts +6 -0
- package/dist/runtime/config/agent-runtime-config-builder.d.ts +93 -0
- package/dist/runtime/config/connection-update.d.ts +40 -0
- package/dist/runtime/escalation/a2a.d.ts +109 -0
- package/dist/runtime/escalation/assessment.d.ts +54 -0
- package/dist/runtime/escalation/brief.d.ts +70 -0
- package/dist/runtime/escalation/escalate-tool.d.ts +93 -0
- package/dist/runtime/escalation/escalation-controller.d.ts +62 -0
- package/dist/runtime/escalation/escalation-session.d.ts +241 -0
- package/dist/runtime/escalation/expert-failure.d.ts +20 -0
- package/dist/runtime/escalation/expert-guards.d.ts +46 -0
- package/dist/runtime/escalation/expert-mailbox.d.ts +34 -0
- package/dist/runtime/escalation/expert-notes.d.ts +115 -0
- package/dist/runtime/escalation/expert-prompt.d.ts +29 -0
- package/dist/runtime/escalation/expert-revisions.d.ts +62 -0
- package/dist/runtime/escalation/expert-session.d.ts +164 -0
- package/dist/runtime/escalation/expert-transcript.d.ts +32 -0
- package/dist/runtime/escalation/forced-escalation.d.ts +58 -0
- package/dist/runtime/escalation/stand-down.d.ts +66 -0
- package/dist/runtime/escalation/struggle-offer.d.ts +100 -0
- package/dist/runtime/escalation/watch-tool.d.ts +34 -0
- package/dist/runtime/host/history.d.ts +19 -0
- package/dist/runtime/host/host.d.ts +7 -0
- package/dist/runtime/host/local/agent-event-bridge.d.ts +50 -0
- package/dist/runtime/host/local/session-record.d.ts +6 -0
- package/dist/runtime/host/local/session-service-invoker.d.ts +4 -0
- package/dist/runtime/host/local/spawn-tool.d.ts +57 -0
- package/dist/runtime/host/local/user-files.d.ts +1 -0
- package/dist/runtime/host/local-runtime-host.d.ts +298 -0
- package/dist/runtime/host/runtime-host-support.d.ts +39 -0
- package/dist/runtime/host/runtime-host.d.ts +280 -0
- package/dist/runtime/host/steer-side-turn.d.ts +119 -0
- package/dist/runtime/orchestration/runtime-builder.d.ts +14 -0
- package/dist/runtime/orchestration/runtime-event-adapter.d.ts +104 -0
- package/dist/runtime/orchestration/runtime-oauth-token-manager.d.ts +28 -0
- package/dist/runtime/orchestration/session-runtime-orchestrator.d.ts +339 -0
- package/dist/runtime/orchestration/session-runtime.d.ts +118 -0
- package/dist/runtime/orchestration/user-input-builder.d.ts +15 -0
- package/dist/runtime/process-start-token.d.ts +23 -0
- package/dist/runtime/safety/loop-detection.d.ts +160 -0
- package/dist/runtime/safety/mistake-tracker.d.ts +84 -0
- package/dist/runtime/safety/rules.d.ts +6 -0
- package/dist/runtime/safety/struggle-detector.d.ts +414 -0
- package/dist/runtime/safety/worker-struggle-stop.d.ts +20 -0
- package/dist/runtime/safety/worker-struggle.d.ts +166 -0
- package/dist/runtime/sandbox/agent-sandbox.d.ts +111 -0
- package/dist/runtime/sandbox/overlay-fs.d.ts +71 -0
- package/dist/runtime/sandbox/sandbox-binaries.d.ts +10 -0
- package/dist/runtime/tools/subprocess-sandbox-lifecycle.d.ts +9 -0
- package/dist/runtime/tools/subprocess-sandbox.d.ts +62 -0
- package/dist/runtime/tools/tool-approval.d.ts +9 -0
- package/dist/runtime/turn-queue/harness-notes.d.ts +18 -0
- package/dist/runtime/turn-queue/pending-prompt-service.d.ts +117 -0
- package/dist/services/agent-events.d.ts +59 -0
- package/dist/services/config.d.ts +2 -0
- package/dist/services/connectors/active-connectors.d.ts +2 -0
- package/dist/services/connectors/connector-autostart.d.ts +33 -0
- package/dist/services/connectors/connector-child-env.d.ts +14 -0
- package/dist/services/connectors/connector-cleanup.d.ts +20 -0
- package/dist/services/connectors/connector-supervisor.d.ts +134 -0
- package/dist/services/connectors/daemon-connector-reconnect.d.ts +15 -0
- package/dist/services/feature-flags/FeatureFlagsService.d.ts +49 -0
- package/dist/services/feature-flags/index.d.ts +2 -0
- package/dist/services/feature-flags/posthog.d.ts +24 -0
- package/dist/services/feature-flags/posthog.js +1 -0
- package/dist/services/feature-flags/providers.d.ts +7 -0
- package/dist/services/global-settings.d.ts +113 -0
- package/dist/services/llms/apihandler-agent-model-adapter.d.ts +26 -0
- package/dist/services/llms/cline-recommended-models.d.ts +62 -0
- package/dist/services/llms/configured-provider-registry.d.ts +27 -0
- package/dist/services/llms/handler-factory.d.ts +23 -0
- package/dist/services/llms/provider-defaults.d.ts +36 -0
- package/dist/services/llms/provider-settings.d.ts +420 -0
- package/dist/services/llms/runtime-config.d.ts +3 -0
- package/dist/services/llms/runtime-registry.d.ts +19 -0
- package/dist/services/llms/runtime-types.d.ts +84 -0
- package/dist/services/llms/session-budget.d.ts +88 -0
- package/dist/services/local-runtime-bootstrap.d.ts +62 -0
- package/dist/services/marketplace.d.ts +41 -0
- package/dist/services/mcp-install.d.ts +35 -0
- package/dist/services/plugin-install.d.ts +52 -0
- package/dist/services/plugin-mcp-settings.d.ts +31 -0
- package/dist/services/plugin-tools.d.ts +40 -0
- package/dist/services/plugin-uninstall.d.ts +13 -0
- package/dist/services/providers/local-provider-registry.d.ts +354 -0
- package/dist/services/providers/local-provider-service.d.ts +101 -0
- package/dist/services/providers/model-source.d.ts +3 -0
- package/dist/services/providers/provider-config-fields.d.ts +37 -0
- package/dist/services/providers/provider-readiness.d.ts +10 -0
- package/dist/services/session-artifacts.d.ts +18 -0
- package/dist/services/session-data.d.ts +61 -0
- package/dist/services/session-import/claude-code.d.ts +16 -0
- package/dist/services/session-import/codex.d.ts +34 -0
- package/dist/services/session-import/index.d.ts +6 -0
- package/dist/services/session-import/opencode.d.ts +25 -0
- package/dist/services/session-import/sanitize.d.ts +16 -0
- package/dist/services/session-import/service.d.ts +31 -0
- package/dist/services/session-import/types.d.ts +87 -0
- package/dist/services/session-telemetry.d.ts +15 -0
- package/dist/services/storage/file-team-store.d.ts +32 -0
- package/dist/services/storage/provider-settings-legacy-migration.d.ts +38 -0
- package/dist/services/storage/provider-settings-manager.d.ts +31 -0
- package/dist/services/storage/sqlite-session-store.d.ts +35 -0
- package/dist/services/storage/sqlite-team-store.d.ts +42 -0
- package/dist/services/storage/team-events-retention.d.ts +25 -0
- package/dist/services/storage/team-store.d.ts +16 -0
- package/dist/services/telemetry/ITelemetryAdapter.d.ts +54 -0
- package/dist/services/telemetry/OpenTelemetryAdapter.d.ts +43 -0
- package/dist/services/telemetry/OpenTelemetryProvider.d.ts +99 -0
- package/dist/services/telemetry/TelemetryLoggerSink.d.ts +27 -0
- package/dist/services/telemetry/TelemetryService.d.ts +40 -0
- package/dist/services/telemetry/core-events.d.ts +396 -0
- package/dist/services/telemetry/distinct-id.d.ts +2 -0
- package/dist/services/telemetry/index.d.ts +4 -0
- package/dist/services/telemetry/index.js +1 -0
- package/dist/services/usage.d.ts +19 -0
- package/dist/services/workspace/agent-schedules-workspace.d.ts +8 -0
- package/dist/services/workspace/chat-workspace.d.ts +9 -0
- package/dist/services/workspace/file-indexer.d.ts +5 -0
- package/dist/services/workspace/index.d.ts +6 -0
- package/dist/services/workspace/mention-enricher.d.ts +13 -0
- package/dist/services/workspace/workspace-manager.d.ts +27 -0
- package/dist/services/workspace/workspace-manifest.d.ts +42 -0
- package/dist/services/workspace/workspace-telemetry.d.ts +18 -0
- package/dist/session/checkpoint-diff.d.ts +25 -0
- package/dist/session/checkpoint-restore.d.ts +34 -0
- package/dist/session/display-messages.d.ts +28 -0
- package/dist/session/history-origin.d.ts +19 -0
- package/dist/session/models/session-compaction.d.ts +22 -0
- package/dist/session/models/session-graph.d.ts +15 -0
- package/dist/session/models/session-manifest.d.ts +32 -0
- package/dist/session/models/session-row.d.ts +107 -0
- package/dist/session/persisted-tool-result-content.d.ts +8 -0
- package/dist/session/search/index.d.ts +1 -0
- package/dist/session/search/session-history-search.d.ts +51 -0
- package/dist/session/services/file-session-service.d.ts +10 -0
- package/dist/session/services/message-builder.d.ts +208 -0
- package/dist/session/services/persistence-service.d.ts +92 -0
- package/dist/session/services/read-overlap.d.ts +40 -0
- package/dist/session/services/session-service.d.ts +15 -0
- package/dist/session/session-snapshot.d.ts +59 -0
- package/dist/session/session-versioning-service.d.ts +50 -0
- package/dist/session/stores/atomic-file.d.ts +1 -0
- package/dist/session/stores/conversation-store.d.ts +29 -0
- package/dist/session/stores/session-manifest-store.d.ts +49 -0
- package/dist/session/stores/team-persistence-store.d.ts +23 -0
- package/dist/session/team/index.d.ts +2 -0
- package/dist/session/team/team-child-session-manager.d.ts +35 -0
- package/dist/session/team/team-session-coordinator.d.ts +13 -0
- package/dist/session/user-run-messages.d.ts +20 -0
- package/dist/settings/index.d.ts +2 -0
- package/dist/settings/settings-service.d.ts +8 -0
- package/dist/settings/types.d.ts +83 -0
- package/dist/tasks/agenda-task-api.d.ts +20 -0
- package/dist/tasks/agenda-task-manager.d.ts +109 -0
- package/dist/tasks/agenda-task-tool.d.ts +94 -0
- package/dist/tasks/index.d.ts +9 -0
- package/dist/tasks/specs/task-spec-file-store.d.ts +38 -0
- package/dist/tasks/specs/task-spec-parser.d.ts +65 -0
- package/dist/tasks/store/sqlite-task-store.d.ts +73 -0
- package/dist/tasks/store/task-schema.d.ts +2 -0
- package/dist/tasks/task-location.d.ts +14 -0
- package/dist/tasks/task-tool.d.ts +143 -0
- package/dist/types/chat-schema.d.ts +194 -0
- package/dist/types/common.d.ts +35 -0
- package/dist/types/config.d.ts +994 -0
- package/dist/types/events.d.ts +102 -0
- package/dist/types/provider-settings.d.ts +29 -0
- package/dist/types/session.d.ts +187 -0
- package/dist/types/sessions.d.ts +42 -0
- package/dist/types/storage.d.ts +36 -0
- package/dist/types.d.ts +34 -0
- package/dist/version.d.ts +1 -0
- package/package.json +98 -0
- package/scripts/document-reader-assets.mjs +161 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `spawn_swarm` — several agents on one shared prefix, reporting digests.
|
|
3
|
+
*
|
|
4
|
+
* `spawn_agent` delegates one task to one sub-agent that starts from a system
|
|
5
|
+
* prompt and re-prefills the whole of it. A swarm is the other shape: N agents
|
|
6
|
+
* that all need what the lead already knows, which on opencoti can be given to
|
|
7
|
+
* them for free. The lead's live context is snapshotted into a KV pool with
|
|
8
|
+
* `from_session` — no tokens cross the wire, the engine takes the prefix from
|
|
9
|
+
* the slot's own token history — and every worker attaches to it. The workers
|
|
10
|
+
* share a prefix instead of each paying for it.
|
|
11
|
+
*
|
|
12
|
+
* Four things about that are load-bearing, in the order they bite:
|
|
13
|
+
*
|
|
14
|
+
* 1. **The snapshot's timing.** The host prompt cache saves and clears idle
|
|
15
|
+
* slots the moment any new task launches, so the snapshot has to be taken at
|
|
16
|
+
* the end of the lead's turn, before any other task starts. Taken late it
|
|
17
|
+
* captures a slot that has already been cleared.
|
|
18
|
+
* 2. **A failed snapshot holds the pooling, not the round.** Running the
|
|
19
|
+
* workers against a bad pool means each pays a full prefill and shares
|
|
20
|
+
* nothing, which is slower than not fanning out at all — so on failure they
|
|
21
|
+
* run unpooled and the result says so.
|
|
22
|
+
* 3. **Every pool is released, on every path.** Unpin then release, in a
|
|
23
|
+
* `finally`. The engine's 60-second ephemeral sweep is the crash net, not
|
|
24
|
+
* the plan, and a pin left on an abandoned subtree blocks reclaim forever.
|
|
25
|
+
* 4. **A worker that breaks the contract is still represented.** The reducer
|
|
26
|
+
* cannot tell "nothing to report" from "lost", so a worker that threw, or
|
|
27
|
+
* that spent its whole budget thinking and returned empty content, appears
|
|
28
|
+
* in the digest with what it did say. Its transcript goes when the pool
|
|
29
|
+
* does; whatever is not in the digest is gone.
|
|
30
|
+
*
|
|
31
|
+
* "As many agents as possible" needs no parser. The model reads the phrase and
|
|
32
|
+
* passes `count: "max"`, and the runtime resolves it against what the engine
|
|
33
|
+
* says it will take right now — which is the same `/capacity` answer the
|
|
34
|
+
* admission gate draws from, and is bounded there for the reason named in
|
|
35
|
+
* `agent-admission.ts`.
|
|
36
|
+
*/
|
|
37
|
+
import { type AgentResult, type AgentTool } from "@cerebriline/shared";
|
|
38
|
+
import { z } from "zod";
|
|
39
|
+
import { type WorkDigest } from "../../context/work-digest";
|
|
40
|
+
import { type AgentCheck, type AgentOracleResult } from "./agent-check";
|
|
41
|
+
import type { DelegatedStopReason } from "./agent-iteration-cap";
|
|
42
|
+
import type { HandedRevision } from "./delegated-sandboxes";
|
|
43
|
+
import { type RealizedSpawnSampling, type SpawnSampling } from "./spawn-sampling";
|
|
44
|
+
import { type SubagentCancellationRegistration } from "./subagent-cancellation";
|
|
45
|
+
export declare const SpawnSwarmInputSchema: z.ZodObject<{
|
|
46
|
+
systemPrompt: z.ZodString;
|
|
47
|
+
task: z.ZodOptional<z.ZodString>;
|
|
48
|
+
tasks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
49
|
+
name: z.ZodOptional<z.ZodString>;
|
|
50
|
+
task: z.ZodString;
|
|
51
|
+
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
52
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
temperature: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
|
|
54
|
+
seed: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
|
|
55
|
+
temperature_range: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
check: z.ZodOptional<z.ZodObject<{
|
|
57
|
+
command: z.ZodString;
|
|
58
|
+
expect: z.ZodString;
|
|
59
|
+
must: z.ZodOptional<z.ZodEnum<{
|
|
60
|
+
match: "match";
|
|
61
|
+
not_match: "not_match";
|
|
62
|
+
}>>;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
}, z.core.$strip>>>;
|
|
65
|
+
count: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">]>>;
|
|
66
|
+
temperature: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
|
|
67
|
+
seed: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"random">]>>;
|
|
68
|
+
temperature_range: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
check: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
command: z.ZodString;
|
|
71
|
+
expect: z.ZodString;
|
|
72
|
+
must: z.ZodOptional<z.ZodEnum<{
|
|
73
|
+
match: "match";
|
|
74
|
+
not_match: "not_match";
|
|
75
|
+
}>>;
|
|
76
|
+
}, z.core.$strip>>;
|
|
77
|
+
wait: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
export type SpawnSwarmInput = z.infer<typeof SpawnSwarmInputSchema>;
|
|
80
|
+
export interface SpawnSwarmOutput {
|
|
81
|
+
/** The merged report. The only thing that survives the round. */
|
|
82
|
+
digest: string;
|
|
83
|
+
/** How many workers actually ran. */
|
|
84
|
+
workers: number;
|
|
85
|
+
/** Whether they shared the lead's prefix, or each paid for their own. */
|
|
86
|
+
pooled: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* What the round cost, summed over the workers that reported it.
|
|
89
|
+
*
|
|
90
|
+
* Carried out because nothing downstream can recover it: the workers'
|
|
91
|
+
* transcripts are discarded when their pool is released, so a swarm that
|
|
92
|
+
* kept this to itself would spend N runs' worth of tokens that are counted
|
|
93
|
+
* nowhere the task header can see. `spawn_agent` reports its own for the
|
|
94
|
+
* same reason. A worker that threw contributes nothing, having returned no
|
|
95
|
+
* result to read a count from -- the number is what was reported, not an
|
|
96
|
+
* estimate of what was spent.
|
|
97
|
+
*/
|
|
98
|
+
usage: {
|
|
99
|
+
inputTokens: number;
|
|
100
|
+
outputTokens: number;
|
|
101
|
+
cachedInputTokens?: number;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* One report per requested worker, in the order they were asked for.
|
|
105
|
+
*
|
|
106
|
+
* What the host puts on each worker's row. Without it every row of a
|
|
107
|
+
* 75-worker round sat at "0 tools called · 0 tokens" for the whole round,
|
|
108
|
+
* and a worker that failed -- or never started -- said so nowhere.
|
|
109
|
+
*/
|
|
110
|
+
results?: SwarmMemberReport[];
|
|
111
|
+
/** The round this call opened, for `agents_status` and `retry_failed`. */
|
|
112
|
+
round?: string;
|
|
113
|
+
/** Every worker's id and how it ended, one line of facts each. */
|
|
114
|
+
agents?: Array<{
|
|
115
|
+
id: string;
|
|
116
|
+
name: string;
|
|
117
|
+
state?: string;
|
|
118
|
+
stop?: string;
|
|
119
|
+
facts?: string;
|
|
120
|
+
}>;
|
|
121
|
+
/** Set when the round runs in the background and this is its receipt. */
|
|
122
|
+
background?: true;
|
|
123
|
+
note?: string;
|
|
124
|
+
}
|
|
125
|
+
/** How one worker ended, for its row. */
|
|
126
|
+
export interface SwarmMemberReport {
|
|
127
|
+
name: string;
|
|
128
|
+
text?: string;
|
|
129
|
+
usage?: {
|
|
130
|
+
inputTokens: number;
|
|
131
|
+
outputTokens: number;
|
|
132
|
+
};
|
|
133
|
+
/** Why it failed, or why it never ran. Absent means it finished. */
|
|
134
|
+
error?: string;
|
|
135
|
+
model?: {
|
|
136
|
+
provider: string;
|
|
137
|
+
id: string;
|
|
138
|
+
};
|
|
139
|
+
nodeId?: string;
|
|
140
|
+
nodeLabel?: string;
|
|
141
|
+
/** The seed and temperature it ran with, as drawn, when the call set any. */
|
|
142
|
+
sampling?: RealizedSpawnSampling;
|
|
143
|
+
/** Its id in the round, and how it ended there. */
|
|
144
|
+
id?: string;
|
|
145
|
+
/** Its state in the round: `awaiting_lead` while it waits at its cap. */
|
|
146
|
+
state?: string;
|
|
147
|
+
/** The round's stop reason (`iteration_cap` when the cap ended it). */
|
|
148
|
+
stopReason?: DelegatedStopReason | string;
|
|
149
|
+
finishReason?: string;
|
|
150
|
+
/** Iterations used, and its cap where there is one. */
|
|
151
|
+
iterations?: number;
|
|
152
|
+
maxIterations?: number;
|
|
153
|
+
/** Its own id, for `resume_agent` and the status tool. */
|
|
154
|
+
agentId?: string;
|
|
155
|
+
/** The lead's check, when one was set. */
|
|
156
|
+
oracle?: AgentOracleResult;
|
|
157
|
+
}
|
|
158
|
+
/** A worker's result, with where it ran when the runner knows. */
|
|
159
|
+
export type SwarmWorkerResult = AgentResult & {
|
|
160
|
+
placed?: {
|
|
161
|
+
nodeId: string;
|
|
162
|
+
nodeLabel?: string;
|
|
163
|
+
};
|
|
164
|
+
/** What its sampler came to, when the call set one. */
|
|
165
|
+
sampling?: RealizedSpawnSampling;
|
|
166
|
+
/**
|
|
167
|
+
* The revisions its changes were handed back to the lead as, when it ran on
|
|
168
|
+
* a private workspace. Present -- even empty -- means it did; the runner
|
|
169
|
+
* sets the same field on the error a failed worker throws.
|
|
170
|
+
*/
|
|
171
|
+
handback?: readonly HandedRevision[];
|
|
172
|
+
/** Its cap, and what the cap and the check made of its run. */
|
|
173
|
+
maxIterations?: number;
|
|
174
|
+
stopReason?: DelegatedStopReason;
|
|
175
|
+
state?: "awaiting_lead";
|
|
176
|
+
agentId?: string;
|
|
177
|
+
oracle?: AgentOracleResult;
|
|
178
|
+
};
|
|
179
|
+
/** An ephemeral pool holding a snapshot of the lead's live context. */
|
|
180
|
+
export interface SwarmPoolSnapshot {
|
|
181
|
+
poolId: string;
|
|
182
|
+
/** Unpin then release. Called on every path, success and failure. */
|
|
183
|
+
release(): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
export interface SwarmPoolSource {
|
|
186
|
+
/**
|
|
187
|
+
* Snapshot the lead's live context into an ephemeral pool.
|
|
188
|
+
*
|
|
189
|
+
* `undefined` when the engine would not, which runs the round unpooled
|
|
190
|
+
* rather than failing it.
|
|
191
|
+
*/
|
|
192
|
+
snapshot(): Promise<SwarmPoolSnapshot | undefined>;
|
|
193
|
+
/**
|
|
194
|
+
* How many workers the engine will take right now, or `undefined` when it
|
|
195
|
+
* will not say.
|
|
196
|
+
*
|
|
197
|
+
* An **opening hint only**, where {@link admit} exists. It is a
|
|
198
|
+
* point-in-time status, and the question a growing round needs answered is
|
|
199
|
+
* a different one: not "how many are free" but "may I start one more",
|
|
200
|
+
* asked again after each spawn.
|
|
201
|
+
*/
|
|
202
|
+
headroom(): Promise<number | undefined>;
|
|
203
|
+
/**
|
|
204
|
+
* May one more worker start right now? **Asks without taking.**
|
|
205
|
+
*
|
|
206
|
+
* This is what lets a round grow: the engine's answer bounds it, rather
|
|
207
|
+
* than a number computed once at launch. Non-consuming on purpose — the
|
|
208
|
+
* worker this admits goes on to acquire through its own slot gate, so a
|
|
209
|
+
* probe that took the slot would book every worker twice and halve the
|
|
210
|
+
* round.
|
|
211
|
+
*
|
|
212
|
+
* Absent on a source that cannot be asked, which keeps the round sized
|
|
213
|
+
* from the hint: no probe is no evidence that one more would be taken.
|
|
214
|
+
*/
|
|
215
|
+
admit?(): Promise<boolean>;
|
|
216
|
+
}
|
|
217
|
+
export interface SwarmWorkerRequest {
|
|
218
|
+
name: string;
|
|
219
|
+
task: string;
|
|
220
|
+
systemPrompt: string;
|
|
221
|
+
/** The shared pool, when there is one. */
|
|
222
|
+
poolId?: string;
|
|
223
|
+
/** The only tools this worker gets, by name; absent means all of them. */
|
|
224
|
+
tools?: string[];
|
|
225
|
+
/**
|
|
226
|
+
* Progress for this worker's row: placement, tool calls, output. Already
|
|
227
|
+
* tagged with the worker, so the runner reports as a lone agent would.
|
|
228
|
+
*/
|
|
229
|
+
emitUpdate?: (update: unknown) => void;
|
|
230
|
+
/** This worker's own stop, which the lead's cancel also trips. */
|
|
231
|
+
signal?: AbortSignal;
|
|
232
|
+
/** Messages the lead's side turn left for it, one per turn boundary. */
|
|
233
|
+
takeMessage?: () => string | undefined;
|
|
234
|
+
/**
|
|
235
|
+
* The sampler the call asked for this worker, when it asked; its seed
|
|
236
|
+
* already offset by the worker's index. See `spawn-sampling.ts`.
|
|
237
|
+
*/
|
|
238
|
+
sampling?: SpawnSampling;
|
|
239
|
+
/** Its iteration cap: the task's, else the swarm's; absent is the default. */
|
|
240
|
+
maxIterations?: number;
|
|
241
|
+
/** Its check: the task's, else the swarm's. */
|
|
242
|
+
check?: AgentCheck;
|
|
243
|
+
/**
|
|
244
|
+
* The worker's own controls: read its signal per segment (a requeue ends
|
|
245
|
+
* a segment), run its placement `continuable` so a requeue carries its
|
|
246
|
+
* transcript, and `track` the agent it builds.
|
|
247
|
+
*/
|
|
248
|
+
control?: SubagentCancellationRegistration;
|
|
249
|
+
}
|
|
250
|
+
export interface SpawnSwarmToolConfig {
|
|
251
|
+
pools: SwarmPoolSource;
|
|
252
|
+
/** Run one worker to completion. */
|
|
253
|
+
runWorker: (request: SwarmWorkerRequest) => Promise<SwarmWorkerResult>;
|
|
254
|
+
/**
|
|
255
|
+
* Rewrite several digests into one, with a model that knows what the lead
|
|
256
|
+
* knows because it was forked from the same pool.
|
|
257
|
+
*
|
|
258
|
+
* Optional: without it, and whenever it fails, the digests are folded
|
|
259
|
+
* mechanically instead. That fold is lossless where the model's is not, so
|
|
260
|
+
* it is a fallback worth having rather than a degraded mode.
|
|
261
|
+
*
|
|
262
|
+
* The reducer is an agent with file tools like the workers, so it can hand
|
|
263
|
+
* changes back too. It reports them through `handedBack`, whether it
|
|
264
|
+
* returns a digest or not, so the report can name them beside the
|
|
265
|
+
* workers'.
|
|
266
|
+
*/
|
|
267
|
+
reduce?: (digests: readonly WorkDigest[], reducer?: {
|
|
268
|
+
handedBack(name: string, handed: readonly HandedRevision[]): void;
|
|
269
|
+
}) => Promise<WorkDigest | undefined>;
|
|
270
|
+
/** Most workers this will ever run, whatever the model or engine says. */
|
|
271
|
+
maxWorkers?: number;
|
|
272
|
+
/**
|
|
273
|
+
* How long the supervisor waits before asking again, when nothing has
|
|
274
|
+
* finished and the engine last said no.
|
|
275
|
+
*/
|
|
276
|
+
tickMs?: number;
|
|
277
|
+
/** Test seam. */
|
|
278
|
+
sleep?: (ms: number) => Promise<void>;
|
|
279
|
+
/**
|
|
280
|
+
* The lead's session, when the tool is built for one: `retry_failed` and a
|
|
281
|
+
* restart of a finished worker then run it again from its round.
|
|
282
|
+
*/
|
|
283
|
+
sessionId?: string;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* A spin guard, and deliberately not a policy.
|
|
287
|
+
*
|
|
288
|
+
* It exists only so that an engine answering yes forever cannot run this loop
|
|
289
|
+
* until something else breaks. It must never be the number that decides how
|
|
290
|
+
* wide a round gets — that is the engine's answer, and a constant standing in
|
|
291
|
+
* for it is the limit this was raised to remove. Set at the engine's own
|
|
292
|
+
* `--max-parallel` ceiling so that reaching it means something has gone wrong
|
|
293
|
+
* rather than that a swarm was busy.
|
|
294
|
+
*/
|
|
295
|
+
export declare const SWARM_RUNAWAY_MAX = 64;
|
|
296
|
+
/** Opening size when the engine will not say and cannot be probed. */
|
|
297
|
+
export declare const DEFAULT_MAX_SWARM_WORKERS = 8;
|
|
298
|
+
/** How often the supervisor re-asks while work is left. */
|
|
299
|
+
export declare const DEFAULT_SWARM_TICK_MS = 5000;
|
|
300
|
+
/** One sandboxed worker's hand-back. */
|
|
301
|
+
interface SwarmHandback {
|
|
302
|
+
name: string;
|
|
303
|
+
handed: readonly HandedRevision[];
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Where the round's work went, for the end of the swarm's report.
|
|
307
|
+
*
|
|
308
|
+
* Each worker ran on a private copy of the workspace, so the lead's files are
|
|
309
|
+
* untouched and every change is a revision in the lead's log. Without this the
|
|
310
|
+
* lead reads its own copy, sees none of the fixes the digest describes, and
|
|
311
|
+
* concludes the workers did nothing (the `spawn_agent` note's pandorum
|
|
312
|
+
* failure, once per worker). Empty when no worker was sandboxed.
|
|
313
|
+
*/
|
|
314
|
+
export declare function swarmHandbackNote(handbacks: readonly SwarmHandback[]): string;
|
|
315
|
+
/**
|
|
316
|
+
* Worker `index`'s sampler: the swarm's, its seed offset by the index so that
|
|
317
|
+
* workers on one task do not draw identical samples, under the task's own.
|
|
318
|
+
*/
|
|
319
|
+
export declare function workerSampling(input: Pick<SpawnSwarmInput, "temperature" | "seed" | "temperature_range">, index: number, task?: unknown): SpawnSampling | undefined;
|
|
320
|
+
/**
|
|
321
|
+
* What the reducer is asked to do.
|
|
322
|
+
*
|
|
323
|
+
* It runs attached to the same pool the workers did, so it already knows
|
|
324
|
+
* everything the lead knows -- which is why the prompt can tell it to be short
|
|
325
|
+
* rather than complete. "Done as planned" costs a line there and a paragraph
|
|
326
|
+
* anywhere else.
|
|
327
|
+
*/
|
|
328
|
+
export declare const SWARM_REDUCER_PROMPT = "You are merging the reports of several agents that worked in parallel on one task, and you already hold the context they were given \u2014 so do not restate it.\n\nWrite ONE report in the same form they used, as a fenced json block with any of these keys: goal, done, in_progress, ruled_out, key_facts, next, notes.\n\nRules:\n- Keep every specific: paths, symbols, error text, commands, numbers. A detail you drop has to be rediscovered.\n- Where two agents found the same thing, say it once.\n- Where they disagree, say so and say who found what. Do not pick a winner.\n- An agent that reported an error or nothing must still appear, in notes, by name.\n- Do not add findings none of them reported.";
|
|
329
|
+
export declare function createSpawnSwarmTool(config: SpawnSwarmToolConfig): AgentTool<SpawnSwarmInput, SpawnSwarmOutput>;
|
|
330
|
+
export {};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stopping one sub-agent without stopping the session.
|
|
3
|
+
*
|
|
4
|
+
* A delegated agent used to run on the parent's abort signal alone, so the
|
|
5
|
+
* only way to stop a runaway one was to cancel the whole task -- losing the
|
|
6
|
+
* lead's context and every sibling agent that was working correctly. A fan-out
|
|
7
|
+
* of five where one grinds is the case: four reports are already written, and
|
|
8
|
+
* the only control on screen cancels all of them.
|
|
9
|
+
*
|
|
10
|
+
* So each spawned agent gets a signal of its own, and it is registered here
|
|
11
|
+
* while it runs. The registry is the process's, keyed by session and tool
|
|
12
|
+
* call: the id is what the chat row is already keyed by, so a row can name the
|
|
13
|
+
* agent it is showing without inventing an identity for it.
|
|
14
|
+
*
|
|
15
|
+
* Deliberately plain. It holds only live runs -- registration is released in
|
|
16
|
+
* the spawn tool's `finally`, on every path -- so nothing here outlives the
|
|
17
|
+
* agent it refers to, and a stop for an agent that has already finished is a
|
|
18
|
+
* no-op rather than an error.
|
|
19
|
+
*/
|
|
20
|
+
/** Who stopped an agent, for the reason its report gives. */
|
|
21
|
+
export type SubagentStopActor = "user" | "lead";
|
|
22
|
+
/** What a requeue carries into the agent's next placement. */
|
|
23
|
+
export interface SubagentRequeueOptions {
|
|
24
|
+
/** Why the lead moved it, in its words or one of the named reasons. */
|
|
25
|
+
reason?: string;
|
|
26
|
+
/** The node to place it anywhere but, when another has room. */
|
|
27
|
+
avoidNodeId?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* An agent's run that was stopped at a boundary to be placed again: its
|
|
31
|
+
* transcript, and where not to put it.
|
|
32
|
+
*/
|
|
33
|
+
export interface SubagentRequeueCarry {
|
|
34
|
+
messages: readonly unknown[];
|
|
35
|
+
reason?: string;
|
|
36
|
+
avoidNodeId?: string;
|
|
37
|
+
/**
|
|
38
|
+
* A graceful stop: the next segment is one report turn on this
|
|
39
|
+
* transcript, and the agent ends on it. Who asked, for its report.
|
|
40
|
+
*/
|
|
41
|
+
wrapUp?: SubagentStopActor;
|
|
42
|
+
}
|
|
43
|
+
/** The live control state of one agent, for the lead's status tool. */
|
|
44
|
+
export interface SubagentControlState {
|
|
45
|
+
label: string;
|
|
46
|
+
/** A graceful stop was asked for: it is finishing its step, then reports. */
|
|
47
|
+
wrapUpPending: boolean;
|
|
48
|
+
/** A requeue was asked for and has not yet happened. */
|
|
49
|
+
requeuePending: boolean;
|
|
50
|
+
/** Waiting on infrastructure right now (a refusal, a server gone). */
|
|
51
|
+
waitingInfra: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface SubagentCancellation {
|
|
54
|
+
/**
|
|
55
|
+
* Stop this agent. `false` when nothing by that id is running. `by` says
|
|
56
|
+
* who, for its report: the row's stop is the user's, `stop_agents` the
|
|
57
|
+
* lead's.
|
|
58
|
+
*/
|
|
59
|
+
cancel(id: string, by?: SubagentStopActor): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Abandon this agent's current attempt and start it again from its task,
|
|
62
|
+
* in the same place in the round. `false` when nothing by that id is
|
|
63
|
+
* running.
|
|
64
|
+
*
|
|
65
|
+
* The case it is for: an agent stuck on a stream the server dropped (a
|
|
66
|
+
* restart under it), or one looping in its output. Stop was the only
|
|
67
|
+
* control, and a stopped agent is a lost task -- the lead gets "stopped"
|
|
68
|
+
* and the round is short one report.
|
|
69
|
+
*/
|
|
70
|
+
restart(id: string, options?: {
|
|
71
|
+
instructions?: string;
|
|
72
|
+
}): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Stop this agent at its next turn boundary -- or at once, if it is only
|
|
75
|
+
* waiting on infrastructure -- and put it back in the placement queue with
|
|
76
|
+
* its transcript: it continues, it does not start over. `false` when
|
|
77
|
+
* nothing by that id is running.
|
|
78
|
+
*/
|
|
79
|
+
requeue(id: string, options?: SubagentRequeueOptions): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Stop this agent gracefully: at its next turn boundary -- or at once, if
|
|
82
|
+
* it is only waiting on infrastructure -- it is given one turn, with no
|
|
83
|
+
* tools, to report what it has, and it ends on that report. `false` when
|
|
84
|
+
* nothing by that id is running, or it runs outside a segment that could
|
|
85
|
+
* take the report turn; stop it with `cancel` then.
|
|
86
|
+
*
|
|
87
|
+
* Slow by nature: the step it is in finishes first, and on a slow node or
|
|
88
|
+
* a looping model that can take minutes. `cancel` still ends it at once.
|
|
89
|
+
*/
|
|
90
|
+
wrapUp(id: string, by?: SubagentStopActor): boolean;
|
|
91
|
+
/** A graceful stop has been asked for this agent and not yet ended it. */
|
|
92
|
+
wrappingUp(id: string): boolean;
|
|
93
|
+
/** What a live agent's controls are doing, or undefined when not running. */
|
|
94
|
+
inspect(id: string): SubagentControlState | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Who stopped the agent last registered under `id`, if anyone did. Kept
|
|
97
|
+
* past its release, so a report written after the run can say.
|
|
98
|
+
*/
|
|
99
|
+
stoppedBy(id: string): SubagentStopActor | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Leave a message for this agent, read at its next turn boundary. `false`
|
|
102
|
+
* when nothing by that id is running.
|
|
103
|
+
*
|
|
104
|
+
* How the lead's side turn reaches the round it is waiting on: a message
|
|
105
|
+
* from the user while the lead sat inside its delegation call was queued
|
|
106
|
+
* for a turn the lead would not take until every agent had finished.
|
|
107
|
+
*/
|
|
108
|
+
message(id: string, text: string): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Compact this agent's context before its next model request, as a manual
|
|
111
|
+
* compaction: its KV cells are given back without stopping it. `false`
|
|
112
|
+
* when nothing by that id is running or it has not started a model yet.
|
|
113
|
+
*/
|
|
114
|
+
compact(id: string): boolean;
|
|
115
|
+
/** The agents running for this session, with the names they were given. */
|
|
116
|
+
runningIn(sessionId: string | undefined): Array<{
|
|
117
|
+
id: string;
|
|
118
|
+
label: string;
|
|
119
|
+
}>;
|
|
120
|
+
/** Ids of the agents running right now. For tests and diagnostics. */
|
|
121
|
+
running(): string[];
|
|
122
|
+
}
|
|
123
|
+
/** The agent a segment runs: its transcript, and -- a `SessionRuntime` -- a compaction on request. */
|
|
124
|
+
export interface TrackedAgent {
|
|
125
|
+
getMessages(): readonly unknown[];
|
|
126
|
+
requestCompaction?(): void;
|
|
127
|
+
}
|
|
128
|
+
export interface SubagentCancellationRegistration {
|
|
129
|
+
/** What it is registered under: its row's id and the controls'. */
|
|
130
|
+
readonly id: string | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* The signal to run under: the current attempt's, once `restartable` has
|
|
133
|
+
* started one. Read it when the agent is built, not once up front, or a
|
|
134
|
+
* restarted attempt runs on the signal of the one it replaced.
|
|
135
|
+
*/
|
|
136
|
+
readonly signal: AbortSignal | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Run `run`, and run it again for as long as an attempt ends because it was
|
|
139
|
+
* restarted. `onRestart` goes between attempts: whatever the abandoned one
|
|
140
|
+
* held -- its engine session -- is given back there.
|
|
141
|
+
*/
|
|
142
|
+
restartable<T>(run: () => Promise<T>, onRestart?: () => void | Promise<void>): Promise<T>;
|
|
143
|
+
/**
|
|
144
|
+
* Run `run` for as long as it ends because the agent was requeued: each
|
|
145
|
+
* time with the transcript the requeued segment left, so the agent carries
|
|
146
|
+
* on where it stopped. `onRequeue` goes between segments -- the engine
|
|
147
|
+
* session the stopped one held is given back there. Nested inside
|
|
148
|
+
* {@link restartable}: a restart still starts from the task.
|
|
149
|
+
*/
|
|
150
|
+
continuable<T>(run: (carry: SubagentRequeueCarry | undefined) => Promise<T>, onRequeue?: (carry: SubagentRequeueCarry) => void | Promise<void>): Promise<T>;
|
|
151
|
+
/** The agent the current segment runs, so a requeue can take its transcript. */
|
|
152
|
+
track(agent: TrackedAgent): void;
|
|
153
|
+
/** Waiting on infrastructure, or not: a requeue then stops it at once. */
|
|
154
|
+
setWaitingInfra(waiting: boolean): void;
|
|
155
|
+
/**
|
|
156
|
+
* Requeue this agent, as the lead's `requeue_agent` would: the harness's
|
|
157
|
+
* own move off a node that refused it. `false` when it cannot be moved.
|
|
158
|
+
*/
|
|
159
|
+
requeue(options?: SubagentRequeueOptions): boolean;
|
|
160
|
+
/** What the lead added to the task when it last restarted this agent. */
|
|
161
|
+
readonly instructions: string | undefined;
|
|
162
|
+
/** The next message left for this agent, for its `consumePendingUserMessage`. */
|
|
163
|
+
takeMessage: () => string | undefined;
|
|
164
|
+
release: () => void;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* How a running sub-agent is named from outside.
|
|
168
|
+
*
|
|
169
|
+
* Session first, because a tool call id comes from the model and is only
|
|
170
|
+
* unique within the conversation that produced it -- two windows on two tasks
|
|
171
|
+
* can mint the same one, and stopping the wrong window's agent would be the
|
|
172
|
+
* worst possible bug in a stop button.
|
|
173
|
+
*/
|
|
174
|
+
export declare function subagentCancelId(sessionId: string | undefined, toolCallId: string | undefined): string | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* A signal for one sub-agent, aborted by its own stop or by the parent's.
|
|
177
|
+
*
|
|
178
|
+
* Returns the signal to run under and a release to call when the run ends,
|
|
179
|
+
* however it ends. `undefined` id means the caller could not name this agent
|
|
180
|
+
* -- no tool call id -- in which case it simply runs on the parent's signal as
|
|
181
|
+
* it always did, rather than being registered under a name nothing can send.
|
|
182
|
+
*/
|
|
183
|
+
export declare function registerSubagentCancellation(id: string | undefined, parent: AbortSignal | undefined, label?: string): SubagentCancellationRegistration;
|
|
184
|
+
/** Its task, with what the lead added when it restarted it. */
|
|
185
|
+
export declare function withRevisedInstructions(task: string, instructions: string | undefined): string;
|
|
186
|
+
export declare const subagentCancellation: SubagentCancellation;
|
|
187
|
+
/** Test seam: no run outlives its `finally`, so this is only for isolation. */
|
|
188
|
+
export declare function __resetSubagentCancellations(): void;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a sub-agent's first request is laid out, and what it shares.
|
|
3
|
+
*
|
|
4
|
+
* Two layouts, chosen by where the agent runs.
|
|
5
|
+
*
|
|
6
|
+
* **On a PolyKV node** the request is built for deduplication, one shared layer
|
|
7
|
+
* per turn, in the order the engine's pool tree nests them:
|
|
8
|
+
*
|
|
9
|
+
* system the sub-agent base prompt -- identical for every agent
|
|
10
|
+
* user the knowledge, with files inlined -- identical for every agent given it
|
|
11
|
+
* user the instructions of the agent's role -- identical for every agent of it
|
|
12
|
+
* user the task -- the agent's own
|
|
13
|
+
*
|
|
14
|
+
* Each of the first three is a pool the engine holds once for the whole swarm
|
|
15
|
+
* (`polykv-swarm.ts`). The file is read here, once, and inlined: an agent that
|
|
16
|
+
* is only told the path reads it with its own tool, and every agent then holds
|
|
17
|
+
* a private copy -- measured, 51 agents each carrying the same 15,191-byte read
|
|
18
|
+
* result in their own suffix.
|
|
19
|
+
*
|
|
20
|
+
* **Everywhere else** there is nothing to dedupe against, so nothing changes
|
|
21
|
+
* for the model: the instructions are the system prompt and the knowledge
|
|
22
|
+
* rides at the top of the one task message -- with files named, not inlined,
|
|
23
|
+
* because the agent has the tools to read what it needs and a copy it may not
|
|
24
|
+
* need is context it pays for on every turn.
|
|
25
|
+
*/
|
|
26
|
+
/** What several agents are given in common. */
|
|
27
|
+
export interface SubagentKnowledge {
|
|
28
|
+
/** Workspace files every agent given this knowledge works from. */
|
|
29
|
+
files?: string[];
|
|
30
|
+
/** Shared notes: findings, constraints, context. */
|
|
31
|
+
text?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The system prompt of every pooled sub-agent.
|
|
35
|
+
*
|
|
36
|
+
* Fixed on purpose: it is the root of the pool tree, and a prompt that varied
|
|
37
|
+
* per agent would share nothing below it. What makes agents different goes in
|
|
38
|
+
* the instructions turn.
|
|
39
|
+
*/
|
|
40
|
+
export declare const SUBAGENT_BASE_PROMPT: string;
|
|
41
|
+
/** Files larger than this are named rather than inlined. */
|
|
42
|
+
export declare const SUBAGENT_INLINE_FILE_MAX_CHARS = 200000;
|
|
43
|
+
export interface SubagentLayout {
|
|
44
|
+
/** The agent's system prompt. */
|
|
45
|
+
systemPrompt: string;
|
|
46
|
+
/** The agent's own task turn. */
|
|
47
|
+
task: string;
|
|
48
|
+
/**
|
|
49
|
+
* The shared turns at the head of the conversation, verbatim, before the
|
|
50
|
+
* task.
|
|
51
|
+
*
|
|
52
|
+
* Compaction must leave them exactly where they are: they are the pool the
|
|
53
|
+
* agent's every request attaches to, and a head rewritten by a summary
|
|
54
|
+
* matches nothing and shares nothing for the rest of the run.
|
|
55
|
+
*/
|
|
56
|
+
pinnedHead: string[];
|
|
57
|
+
/** How many turns after the system turn are shared layers. */
|
|
58
|
+
layers: number;
|
|
59
|
+
}
|
|
60
|
+
export declare function buildSubagentLayout(options: {
|
|
61
|
+
/** The agent's role, as the lead wrote it. */
|
|
62
|
+
instructions: string;
|
|
63
|
+
task: string;
|
|
64
|
+
knowledge?: SubagentKnowledge;
|
|
65
|
+
/** Whether the agent runs on a PolyKV node. */
|
|
66
|
+
pooled: boolean;
|
|
67
|
+
cwd?: string;
|
|
68
|
+
}): Promise<SubagentLayout>;
|
|
69
|
+
type PrepareTurn<I, R> = (input: I) => Promise<R | undefined>;
|
|
70
|
+
/**
|
|
71
|
+
* Keep the shared head out of compaction's reach.
|
|
72
|
+
*
|
|
73
|
+
* The turns are taken off the front before the pipeline sees the conversation
|
|
74
|
+
* and put back in front of whatever it returns, unchanged. Compaction then
|
|
75
|
+
* summarises only the agent's own work -- which is also the only part of the
|
|
76
|
+
* conversation that grows -- and every request after it still opens with the
|
|
77
|
+
* exact tokens of the pool.
|
|
78
|
+
*
|
|
79
|
+
* A conversation that does not start with the pinned turns is passed through
|
|
80
|
+
* untouched: something upstream already changed the head, and guessing where
|
|
81
|
+
* it went would be worse than leaving the pipeline to see the whole thing.
|
|
82
|
+
*/
|
|
83
|
+
export declare function pinConversationHead<I extends {
|
|
84
|
+
messages: readonly unknown[];
|
|
85
|
+
apiMessages?: readonly unknown[];
|
|
86
|
+
pinnedHead?: readonly unknown[];
|
|
87
|
+
}, R extends {
|
|
88
|
+
messages: readonly unknown[];
|
|
89
|
+
}>(prepare: PrepareTurn<I, R> | undefined, pinned: readonly string[]): PrepareTurn<I, R> | undefined;
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a sub-agent is generating, in full, for the one row being inspected.
|
|
3
|
+
*
|
|
4
|
+
* The row's own line is a status: "Prefilling 39,050 / 56,042", "Writing
|
|
5
|
+
* editor call: 8,327 characters", or the last 400 characters of its text. That
|
|
6
|
+
* says what it is doing and hides how it is doing it -- a model reasoning in
|
|
7
|
+
* circles, or writing the wrong file, reads the same as one that is fine. The
|
|
8
|
+
* stream itself was never lost, only not kept.
|
|
9
|
+
*
|
|
10
|
+
* So each agent keeps its current step here: everything the model has
|
|
11
|
+
* generated since its latest request began -- thinking, answer text and the
|
|
12
|
+
* arguments of the tool calls it writes, in the order they arrive. A step
|
|
13
|
+
* starts over with the next request, so the call it just wrote stays readable
|
|
14
|
+
* while the tool runs.
|
|
15
|
+
*
|
|
16
|
+
* Nothing is sent anywhere unless someone subscribes: fifty agents streaming
|
|
17
|
+
* kilobytes each to a webview nobody is reading would cost the chat for
|
|
18
|
+
* nothing. The registry is the process's, keyed by the same id as
|
|
19
|
+
* `subagentCancellation`, and an agent's entry goes when its registration is
|
|
20
|
+
* released.
|
|
21
|
+
*/
|
|
22
|
+
/** What a stretch of the stream is. */
|
|
23
|
+
export type SubagentOutputKind = "reasoning" | "text" | "tool";
|
|
24
|
+
/** One stretch of the stream: consecutive output of one kind. */
|
|
25
|
+
export interface SubagentOutputChunk {
|
|
26
|
+
kind: SubagentOutputKind;
|
|
27
|
+
text: string;
|
|
28
|
+
/** The tool whose arguments these are, for `kind: "tool"`. */
|
|
29
|
+
toolName?: string;
|
|
30
|
+
/** Which call, so two calls to the same tool stay two stretches. */
|
|
31
|
+
toolCallId?: string;
|
|
32
|
+
}
|
|
33
|
+
/** What a subscriber is told, after the snapshot it started from. */
|
|
34
|
+
export type SubagentOutputEvent =
|
|
35
|
+
/** A new step began: what was shown is the previous step's. */
|
|
36
|
+
{
|
|
37
|
+
type: "step";
|
|
38
|
+
}
|
|
39
|
+
/** More of the stream. Joins the last chunk when kind and call match. */
|
|
40
|
+
| {
|
|
41
|
+
type: "append";
|
|
42
|
+
chunk: SubagentOutputChunk;
|
|
43
|
+
};
|
|
44
|
+
export type SubagentOutputListener = (event: SubagentOutputEvent) => void;
|
|
45
|
+
/**
|
|
46
|
+
* How much of a step is kept. An `editor` call carrying a whole file is the
|
|
47
|
+
* long case; past this the start of the step goes, as a terminal's scrollback
|
|
48
|
+
* would.
|
|
49
|
+
*/
|
|
50
|
+
export declare const SUBAGENT_OUTPUT_STEP_CHARS: number;
|
|
51
|
+
/** Where one agent's progress writes its stream. */
|
|
52
|
+
export interface SubagentOutputWriter {
|
|
53
|
+
append(chunk: SubagentOutputChunk): void;
|
|
54
|
+
/** A new request began: the step so far is over. */
|
|
55
|
+
step(): void;
|
|
56
|
+
}
|
|
57
|
+
export declare const subagentOutput: {
|
|
58
|
+
/** The writer for the agent registered under `id`. */
|
|
59
|
+
writer(id: string): SubagentOutputWriter;
|
|
60
|
+
/**
|
|
61
|
+
* Watch an agent's stream: the step so far, then what follows. An agent
|
|
62
|
+
* that has not written yet -- queued, or prefilling -- starts empty and
|
|
63
|
+
* fills in when it does. Call the returned function to stop.
|
|
64
|
+
*/
|
|
65
|
+
subscribe(id: string, listener: SubagentOutputListener): {
|
|
66
|
+
snapshot: SubagentOutputChunk[];
|
|
67
|
+
unsubscribe: () => void;
|
|
68
|
+
};
|
|
69
|
+
/** The agent ended: its stream goes, unless someone is still looking. */
|
|
70
|
+
release(id: string): void;
|
|
71
|
+
/** Ids with an entry. For tests and diagnostics. */
|
|
72
|
+
ids(): string[];
|
|
73
|
+
};
|