@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,272 @@
|
|
|
1
|
+
import type { AgentConfig, AgentEvent, AgentHooks, AgentTool, BasicLogger, HookErrorMode, ITelemetryService, ToolApprovalRequest, ToolApprovalResult } from "@cerebriline/shared";
|
|
2
|
+
import { SessionRuntime } from "../../../runtime/orchestration/session-runtime-orchestrator";
|
|
3
|
+
import type { WorkerStruggleSupervisor } from "../../../runtime/safety/worker-struggle";
|
|
4
|
+
import type { DelegatedAgentCheck } from "./agent-check";
|
|
5
|
+
import type { AgentNodePlacement } from "./agent-node-placement";
|
|
6
|
+
import type { AgentSlotGate, AgentSlotGateRegistry } from "./agent-slot-gate";
|
|
7
|
+
import { type RealizedSpawnSampling, type SpawnSamplingDraw } from "./spawn-sampling";
|
|
8
|
+
type AgentExtension = NonNullable<AgentConfig["extensions"]>[number];
|
|
9
|
+
export type DelegatedAgentConnectionConfig = Pick<AgentConfig, "providerId" | "modelId" | "apiKey" | "baseUrl" | "headers" | "onAuthError" | "providerConfig" | "knownModels" | "thinking" | "reasoningEffort" | "thinkingBudgetTokens" | "maxTokensPerTurn" | "maxToolResultChars" | "staleReadRewrites" | "temperature">;
|
|
10
|
+
export interface DelegatedAgentRuntimeConfig extends DelegatedAgentConnectionConfig {
|
|
11
|
+
cwd?: string;
|
|
12
|
+
providerId: string;
|
|
13
|
+
clinePlatform?: string;
|
|
14
|
+
clineIdeName?: string;
|
|
15
|
+
maxIterations?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Loop-detection and mistake-budget tuning for this agent's own runtime.
|
|
18
|
+
*
|
|
19
|
+
* Until now a delegated agent ran on whatever `execution` the lead's runtime
|
|
20
|
+
* config carried, which for a headless swarm worker is nothing worker-shaped:
|
|
21
|
+
* the exact-repeat loop tracker and the default mistake budget never catch a
|
|
22
|
+
* worker grinding on slightly-varying probes to the token cap. Carrying it
|
|
23
|
+
* here lets a spawn path hand a worker a tighter, worker-calibrated budget --
|
|
24
|
+
* see `worker-struggle.ts` -- without touching the shared runtime config.
|
|
25
|
+
*/
|
|
26
|
+
execution?: AgentConfig["execution"];
|
|
27
|
+
/**
|
|
28
|
+
* What the server appends to reasoning it cut at the thinking budget, when
|
|
29
|
+
* the session knows it: how an agent's struggle supervisor tells a turn
|
|
30
|
+
* that ran out its budget. Without it the supervisor reads the generic
|
|
31
|
+
* admission in the reasoning's tail (`worker-struggle.ts`).
|
|
32
|
+
*/
|
|
33
|
+
thinkingBudgetMessage?: string;
|
|
34
|
+
hooks?: AgentHooks;
|
|
35
|
+
extensions?: AgentExtension[];
|
|
36
|
+
logger?: BasicLogger;
|
|
37
|
+
telemetry?: ITelemetryService;
|
|
38
|
+
workspaceMetadata?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Holds delegated agents to the number of requests their endpoint serves.
|
|
41
|
+
*
|
|
42
|
+
* Carried here because it is the one thing every spawn path already shares:
|
|
43
|
+
* the team runtime, the lead's `spawn_agent`, and a sub-agent spawning its
|
|
44
|
+
* own all read this provider, so one gate covers them without any of them
|
|
45
|
+
* knowing about the others. Omitted means no gate -- see
|
|
46
|
+
* `createAgentSlotGate` for when that is the right answer.
|
|
47
|
+
*/
|
|
48
|
+
slotGate?: AgentSlotGate;
|
|
49
|
+
/**
|
|
50
|
+
* The same bound, held per endpoint, for the path that does not all run on
|
|
51
|
+
* this provider.
|
|
52
|
+
*
|
|
53
|
+
* `slotGate` above covers `spawn_agent`, whose sub-agents are free-form and
|
|
54
|
+
* always on this connection. A *configured* agent is not: its file may name
|
|
55
|
+
* a `providerId` or a `profile`, so several in one turn can be spread over a
|
|
56
|
+
* local server and a cloud one. Gating those together would queue an
|
|
57
|
+
* Anthropic agent behind a one-slot Ollama; not gating them at all -- which
|
|
58
|
+
* is what happened until now -- lets four agents pointed at that same Ollama
|
|
59
|
+
* be spawned four-wide, which is what the gate exists to prevent.
|
|
60
|
+
*/
|
|
61
|
+
slotGates?: AgentSlotGateRegistry;
|
|
62
|
+
/**
|
|
63
|
+
* Where a delegated agent runs, when the profile configures agent nodes.
|
|
64
|
+
*
|
|
65
|
+
* A node is a whole agents configuration, so the node decides the agent's
|
|
66
|
+
* connection and has to be chosen BEFORE the agent is built. A spawn path
|
|
67
|
+
* that has this takes a node, builds the agent on that node's config
|
|
68
|
+
* provider, runs inside the node's own gate, and gives the node back --
|
|
69
|
+
* see `agent-node-placement.ts`. Absent is every session that names no
|
|
70
|
+
* node: the single delegated connection, and `slotGate` above.
|
|
71
|
+
*/
|
|
72
|
+
nodePlacement?: AgentNodePlacement;
|
|
73
|
+
/**
|
|
74
|
+
* Priority 0 (PLANS §9g): this configuration is the lead's own opencoti
|
|
75
|
+
* connection, and a pooled agent built from it attaches as a sub-pool of
|
|
76
|
+
* the lead's session -- this id -- rather than of an owner opened for the
|
|
77
|
+
* swarm. Set only on the priority-0 node's provider; see
|
|
78
|
+
* `agent-node-placement.ts`. Absent everywhere else, which is every agent
|
|
79
|
+
* before this setting.
|
|
80
|
+
*/
|
|
81
|
+
polykvLeadOwner?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Stable end-user identity inherited from the parent session so
|
|
84
|
+
* delegated-agent telemetry (Langfuse `userId`) groups with the user.
|
|
85
|
+
*/
|
|
86
|
+
distinctId?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Root core session id inherited from the parent session so
|
|
89
|
+
* delegated-agent telemetry (Langfuse `sessionId`) groups with it.
|
|
90
|
+
*/
|
|
91
|
+
sessionId?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Builds this agent's context pipeline -- compaction and the thinking cap.
|
|
94
|
+
*
|
|
95
|
+
* A factory rather than the pipeline itself because compaction carries
|
|
96
|
+
* state: the lead's is bound to the session's sidecar, and every delegated
|
|
97
|
+
* agent needs one keyed to its own transcript. Called once per agent in
|
|
98
|
+
* {@link buildDelegatedAgentConfig}.
|
|
99
|
+
*
|
|
100
|
+
* Absent means this agent compacts never. That was the behaviour until now,
|
|
101
|
+
* and it is how a sub-agent reached 1.87x its model's context window across
|
|
102
|
+
* 34 consecutive requests with nothing in the transcript to say so.
|
|
103
|
+
*/
|
|
104
|
+
createPrepareTurn?: (agent?: DelegatedPrepareTurnTarget) => AgentConfig["prepareTurn"];
|
|
105
|
+
/** The pipeline's other half; stateless, so shared rather than built. */
|
|
106
|
+
condenseDiscardedReasoning?: AgentConfig["condenseDiscardedReasoning"];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Whose compaction a delegated agent's pipeline is.
|
|
110
|
+
*
|
|
111
|
+
* The agent's own: its connection and its engine session. Built from the
|
|
112
|
+
* lead's instead -- as it was -- a sub-agent on an opencoti node summarised
|
|
113
|
+
* itself with the lead's model, measured its trigger against the lead's
|
|
114
|
+
* request counts, and read pool pressure in the lead's name.
|
|
115
|
+
*/
|
|
116
|
+
export interface DelegatedPrepareTurnTarget {
|
|
117
|
+
providerId: string;
|
|
118
|
+
modelId: string;
|
|
119
|
+
providerConfig: NonNullable<AgentConfig["providerConfig"]>;
|
|
120
|
+
engineSessionId?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface DelegatedAgentConfigProvider {
|
|
123
|
+
getRuntimeConfig(): DelegatedAgentRuntimeConfig;
|
|
124
|
+
/**
|
|
125
|
+
* Hand this provider the session's node placement.
|
|
126
|
+
*
|
|
127
|
+
* A setter because the placement needs this provider to build from -- each
|
|
128
|
+
* node's connection is the session's with the node's fields over it -- so
|
|
129
|
+
* the two cannot both be constructed first. Optional on the interface for
|
|
130
|
+
* the hand-built providers a couple of hosts fall back to.
|
|
131
|
+
*/
|
|
132
|
+
setNodePlacement?(placement: AgentNodePlacement): void;
|
|
133
|
+
getConnectionConfig(): DelegatedAgentConnectionConfig;
|
|
134
|
+
updateConnectionDefaults(overrides: Partial<DelegatedAgentConnectionConfig>): void;
|
|
135
|
+
/**
|
|
136
|
+
* The part of a session connection push the agents take: the fields
|
|
137
|
+
* their own connection names are left out. For an agent built earlier
|
|
138
|
+
* that the push reaches directly -- a live teammate -- so it keeps its own
|
|
139
|
+
* server as a new spawn would.
|
|
140
|
+
*/
|
|
141
|
+
acceptedConnectionUpdates?(overrides: Partial<DelegatedAgentConnectionConfig>): Partial<DelegatedAgentConnectionConfig>;
|
|
142
|
+
}
|
|
143
|
+
export type DelegatedAgentKind = "subagent" | "teammate";
|
|
144
|
+
export interface BuildDelegatedAgentConfigOptions {
|
|
145
|
+
kind: DelegatedAgentKind;
|
|
146
|
+
prompt: string;
|
|
147
|
+
tools: AgentTool[];
|
|
148
|
+
configProvider: DelegatedAgentConfigProvider;
|
|
149
|
+
parentAgentId?: string;
|
|
150
|
+
maxIterations?: number;
|
|
151
|
+
/**
|
|
152
|
+
* Per-build override of the runtime's loop-detection and mistake budget.
|
|
153
|
+
* Falls back to {@link DelegatedAgentRuntimeConfig.execution}. The swarm path
|
|
154
|
+
* uses it to hand each worker a tighter budget than the shared runtime.
|
|
155
|
+
*/
|
|
156
|
+
execution?: AgentConfig["execution"];
|
|
157
|
+
abortSignal?: AbortSignal;
|
|
158
|
+
onEvent?: (event: AgentEvent) => void;
|
|
159
|
+
hookErrorMode?: HookErrorMode;
|
|
160
|
+
toolPolicies?: AgentConfig["toolPolicies"];
|
|
161
|
+
requestToolApproval?: (request: ToolApprovalRequest) => Promise<ToolApprovalResult> | ToolApprovalResult;
|
|
162
|
+
role?: string;
|
|
163
|
+
cwd?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Hooks for this run alone, on top of the session's.
|
|
166
|
+
*
|
|
167
|
+
* The session's hooks belong to the session and are shared by every
|
|
168
|
+
* delegated run it starts. A background delegation needs one of its own --
|
|
169
|
+
* the barrier that holds it while the user has it paused -- and that barrier
|
|
170
|
+
* belongs to that run and no other.
|
|
171
|
+
*/
|
|
172
|
+
hooks?: AgentHooks;
|
|
173
|
+
/**
|
|
174
|
+
* Something to say to this agent at its next turn boundary, if anything.
|
|
175
|
+
*
|
|
176
|
+
* The runtime asks at the one point in the loop with no tool call open, so
|
|
177
|
+
* what is handed back arrives inside the turn rather than as an invitation
|
|
178
|
+
* to go and fetch it. The session's own model has had this since steering
|
|
179
|
+
* existed; a delegated agent could not be reached at all, which was fine
|
|
180
|
+
* while nothing else was running beside one and is not fine now that the
|
|
181
|
+
* escalation's base model watches the expert and may need to stop it.
|
|
182
|
+
*/
|
|
183
|
+
consumePendingUserMessage?: AgentConfig["consumePendingUserMessage"];
|
|
184
|
+
/**
|
|
185
|
+
* The engine session this agent runs in -- its own, never the lead's.
|
|
186
|
+
* See `AgentConfig.engineSessionId`.
|
|
187
|
+
*/
|
|
188
|
+
engineSessionId?: string;
|
|
189
|
+
/** Attach to a shared PolyKV pool tree; see `AgentConfig.polykvWorker`. */
|
|
190
|
+
polykvWorker?: AgentConfig["polykvWorker"];
|
|
191
|
+
/**
|
|
192
|
+
* Shared turns at the head of the conversation that compaction must keep
|
|
193
|
+
* verbatim. See `subagent-layout.ts`.
|
|
194
|
+
*/
|
|
195
|
+
pinnedHead?: readonly string[];
|
|
196
|
+
/**
|
|
197
|
+
* Watches a headless worker for a grind and stops it, per worker.
|
|
198
|
+
*
|
|
199
|
+
* The lead has a struggle layer; a delegated worker had none, and on the
|
|
200
|
+
* 75-agent swarm a third of them ground to the token cap without ever
|
|
201
|
+
* reporting. Passed here rather than composed in each spawn path because this
|
|
202
|
+
* builder is the one funnel both `spawn_agent` and the swarm pass through:
|
|
203
|
+
* wiring it once reaches both. When present it wraps this agent's tools so the
|
|
204
|
+
* one nudge lands on a result, folds every event into the supervisor, and ORs
|
|
205
|
+
* its stop into the agent's abort signal. See `worker-struggle.ts`. The
|
|
206
|
+
* supervisor is stateful and per-agent -- a caller that builds two agents
|
|
207
|
+
* gives each its own.
|
|
208
|
+
*/
|
|
209
|
+
struggle?: WorkerStruggleSupervisor;
|
|
210
|
+
/**
|
|
211
|
+
* How this agent waits out a turn the server dropped or refused. Defaults
|
|
212
|
+
* to waiting on its own connection's server with no limit (see
|
|
213
|
+
* `turn-fault-recovery.ts`); a spawn path that placed the agent passes one
|
|
214
|
+
* that knows the node and whether the engine has admitted it.
|
|
215
|
+
*/
|
|
216
|
+
recoverTurnFault?: AgentConfig["recoverTurnFault"];
|
|
217
|
+
/**
|
|
218
|
+
* The sampler the spawning call asked for: `temperature` and `seed`.
|
|
219
|
+
*
|
|
220
|
+
* A build option rather than a connection field, and applied after the
|
|
221
|
+
* connection is read, so that nothing which moves a connection -- the
|
|
222
|
+
* session's `updateConnectionDefaults`, a profile, a node's placement --
|
|
223
|
+
* can move it. Absent leaves the connection's sampler exactly as it was.
|
|
224
|
+
* See `spawn-sampling.ts`.
|
|
225
|
+
*
|
|
226
|
+
* Already drawn (`drawSpawnSampling`): a random seed is a number here, and
|
|
227
|
+
* a random temperature is a position in its range, made concrete against
|
|
228
|
+
* this build's connection -- the model's own temperature is only known
|
|
229
|
+
* once the node, and so the model, is.
|
|
230
|
+
*/
|
|
231
|
+
sampling?: SpawnSamplingDraw;
|
|
232
|
+
/**
|
|
233
|
+
* Told what this build's sampler came to: the values applied, what a
|
|
234
|
+
* random one was drawn around, or why one was not applied. Called on every
|
|
235
|
+
* build with a sampler, so a re-placement reports its own.
|
|
236
|
+
*/
|
|
237
|
+
onSampling?: (realized: RealizedSpawnSampling) => void;
|
|
238
|
+
/**
|
|
239
|
+
* The lead's check on this agent (`agent-check.ts`), judged at each of its
|
|
240
|
+
* completion attempts. Wired into the runtime's completion boundary -- the
|
|
241
|
+
* hook the change protocol's approved check uses -- so a failing check
|
|
242
|
+
* keeps the agent in the same run, within its iteration budget.
|
|
243
|
+
*/
|
|
244
|
+
check?: DelegatedAgentCheck;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* @param pinned Connection fields the session must not push over.
|
|
248
|
+
*
|
|
249
|
+
* Delegated agents normally track the session: the host pushes a model switch
|
|
250
|
+
* or a refreshed key through `updateConnectionDefaults` and the agents follow,
|
|
251
|
+
* which is what makes them agents *of* this session. When the agents have been
|
|
252
|
+
* given a connection of their own, that same push would silently move them back
|
|
253
|
+
* onto the lead's model — so the fields the override supplied are held, and
|
|
254
|
+
* everything else still gets through.
|
|
255
|
+
*/
|
|
256
|
+
export declare function createDelegatedAgentConfigProvider(initialConfig: DelegatedAgentRuntimeConfig, pinned?: readonly (keyof DelegatedAgentConnectionConfig)[]): DelegatedAgentConfigProvider;
|
|
257
|
+
/**
|
|
258
|
+
* The worker spec with its owner, when the agent was placed on priority 0.
|
|
259
|
+
*
|
|
260
|
+
* Decided here, the one funnel every spawn path builds through, rather than at
|
|
261
|
+
* each of the three spawn sites: which node took the agent is a property of
|
|
262
|
+
* the configuration it was built from, and a site that forgot to ask would put
|
|
263
|
+
* a priority-0 agent in an owner the swarm opened -- quietly correct, and not
|
|
264
|
+
* what the setting says.
|
|
265
|
+
*/
|
|
266
|
+
export declare function withPolykvLeadOwner(worker: AgentConfig["polykvWorker"], owner: string | undefined): AgentConfig["polykvWorker"];
|
|
267
|
+
export declare function buildDelegatedAgentConfig(options: BuildDelegatedAgentConfigOptions): AgentConfig & {
|
|
268
|
+
role?: string;
|
|
269
|
+
};
|
|
270
|
+
export declare function createDelegatedAgent(options: BuildDelegatedAgentConfigOptions): SessionRuntime;
|
|
271
|
+
export { type AgentCheck, type AgentOracleResult, createDelegatedAgentCheck, type DelegatedAgentCheck, describeAgentCheck, readAgentCheck, } from "./agent-check";
|
|
272
|
+
export { type AwaitingLeadEvent, type AwaitingLeadView, createDelegatedAgentLifetime, type DelegatedAgentLifetime, type DelegatedRunOutcome, type DelegatedStopReason, listAwaitingLead, onAwaitingLead, RESUME_AGENT_TOOL_NAME, type ResumeSuspendedResult, resumeSuspended, runDelegatedWithCap, stopSuspended, } from "./agent-iteration-cap";
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The private workspaces of every delegated agent in one session.
|
|
3
|
+
*
|
|
4
|
+
* Every path that runs an agent on the lead's behalf -- `spawn_agent`, swarm
|
|
5
|
+
* workers, configured agents (`subagent_<name>`), and teammates -- opens one
|
|
6
|
+
* here, keyed by whatever identifies that agent's run, and closes it when the
|
|
7
|
+
* agent is done. In between the agent's file tools resolve through its overlay
|
|
8
|
+
* and its shell (when it has one) is rooted at the native launcher, so nothing
|
|
9
|
+
* it does touches the lead's tree. What it changed comes back to the lead as
|
|
10
|
+
* revisions in the lead's own revision log, attributed to the agent and never
|
|
11
|
+
* written to disk.
|
|
12
|
+
*
|
|
13
|
+
* One object for all four paths so the rules cannot drift between them:
|
|
14
|
+
*
|
|
15
|
+
* - **The shell.** `run_commands` is offered only when the sandbox has a
|
|
16
|
+
* launcher for this platform AND the user allowed agent commands. Either
|
|
17
|
+
* missing and it is withheld -- an un-launched command runs against the real
|
|
18
|
+
* workspace, which is the escape the sandbox exists to prevent.
|
|
19
|
+
* - **The hand-back.** Each changed file is seeded with the lead's current
|
|
20
|
+
* on-disk version, then recorded as the agent's revision. A long-lived agent
|
|
21
|
+
* (a teammate) hands back more than once, so each hand-back carries only
|
|
22
|
+
* what changed since the last one.
|
|
23
|
+
* - **Disposal.** Idempotent, and it hands back first: an agent that failed,
|
|
24
|
+
* was cancelled or was shut down still leaves its work where the lead can
|
|
25
|
+
* find it.
|
|
26
|
+
*/
|
|
27
|
+
import type { RevisionLog } from "../../../runtime/atomic/file-revisions";
|
|
28
|
+
import type { AgentSandbox } from "../../../runtime/sandbox/agent-sandbox";
|
|
29
|
+
import type { DefaultExecutorsOptions } from "../executors";
|
|
30
|
+
import { type DelegatedSandboxProvider } from "./agent-sandbox-executors";
|
|
31
|
+
/** One file an agent handed back, and the revision it became. */
|
|
32
|
+
export interface HandedRevision {
|
|
33
|
+
/** Workspace-relative path, forward-slashed. */
|
|
34
|
+
rel: string;
|
|
35
|
+
/** The revision number in the lead's log. */
|
|
36
|
+
index: number;
|
|
37
|
+
kind: string;
|
|
38
|
+
}
|
|
39
|
+
/** An agent's open workspace: what its toolset is built from. */
|
|
40
|
+
export interface DelegatedWorkspace {
|
|
41
|
+
readonly sandbox: AgentSandbox;
|
|
42
|
+
/** Pass to `createBuiltinTools({ executorOptions })`. */
|
|
43
|
+
readonly executorOptions: DefaultExecutorsOptions;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the agent gets `run_commands`: a launcher covers this platform and
|
|
46
|
+
* the user allowed agent commands. False means build it with
|
|
47
|
+
* `enableBash: false`, whatever the mode preset or routing rules say.
|
|
48
|
+
*/
|
|
49
|
+
readonly allowCommands: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface DelegatedSandboxes {
|
|
52
|
+
/** The lead's workspace, read-only to every agent. */
|
|
53
|
+
readonly workspaceRoot: string;
|
|
54
|
+
/** Open a workspace for `key`. A key already open is closed first. */
|
|
55
|
+
open(key: string): Promise<DelegatedWorkspace>;
|
|
56
|
+
/** {@link open} for a caller that cannot await (a teammate's toolset). */
|
|
57
|
+
openSync(key: string): DelegatedWorkspace;
|
|
58
|
+
has(key: string): boolean;
|
|
59
|
+
/** The open workspace for `key`, if any: what the agent's check runs in. */
|
|
60
|
+
get(key: string): DelegatedWorkspace | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Fold what the agent changed since its last hand-back into the lead's
|
|
63
|
+
* revision log, attributed to `agentName`. The workspace stays open.
|
|
64
|
+
*/
|
|
65
|
+
handBack(key: string, agentName: string): Promise<HandedRevision[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Hand back anything outstanding, then dispose the overlay. A key that is
|
|
68
|
+
* not open is a no-op returning nothing, so every exit path may call it.
|
|
69
|
+
*/
|
|
70
|
+
close(key: string, agentName: string): Promise<HandedRevision[]>;
|
|
71
|
+
/** Close every open workspace -- the session is ending. */
|
|
72
|
+
closeAll(): Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
export interface CreateDelegatedSandboxesOptions {
|
|
75
|
+
provider: DelegatedSandboxProvider;
|
|
76
|
+
/** The "Agents can run commands" toggle. */
|
|
77
|
+
commandsEnabled: boolean;
|
|
78
|
+
/** The lead's revision log, read when a hand-back runs. */
|
|
79
|
+
revisionLog: () => RevisionLog | undefined;
|
|
80
|
+
}
|
|
81
|
+
export declare function createDelegatedSandboxes(options: CreateDelegatedSandboxesOptions): DelegatedSandboxes;
|
|
82
|
+
/**
|
|
83
|
+
* The launcher an agent's commands run under, when it may run any: the same
|
|
84
|
+
* `wrapSpawn` its `run_commands` was built with. `undefined` -- no workspace,
|
|
85
|
+
* no launcher on this platform, or agent commands turned off -- means nothing
|
|
86
|
+
* may be run for the agent at all; never run it on the host instead.
|
|
87
|
+
*/
|
|
88
|
+
export declare function commandLauncherOf(workspace: DelegatedWorkspace | undefined): NonNullable<DelegatedWorkspace["executorOptions"]["bash"]>["wrapSpawn"];
|
|
89
|
+
/**
|
|
90
|
+
* The launcher and root an agent's check runs under, from its open workspace
|
|
91
|
+
* (keyed as it was opened); `undefined` when it may run no command.
|
|
92
|
+
*/
|
|
93
|
+
export declare function commandSandboxOf(sandboxes: DelegatedSandboxes | undefined, key: string | undefined): {
|
|
94
|
+
wrapSpawn: NonNullable<ReturnType<typeof commandLauncherOf>>;
|
|
95
|
+
cwd: string;
|
|
96
|
+
} | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* What an agent that was stopped before answering had got to, from its own
|
|
99
|
+
* transcript: its latest message, and what it called.
|
|
100
|
+
*
|
|
101
|
+
* A stopped agent reported only that it gave no answer, while an agent of the
|
|
102
|
+
* same round that ran into its cap wrote a full report -- and the stopped
|
|
103
|
+
* one's transcript held findings as good (pandorum h0o2o, 2026-09-28: the lead
|
|
104
|
+
* stopped 18 of 25 and got 18 disclaimers). A last turn to write one is not
|
|
105
|
+
* the answer: most were stopped *because* the server kept refusing them, and
|
|
106
|
+
* a final turn would be refused the same way. So this reads what is already
|
|
107
|
+
* there.
|
|
108
|
+
*/
|
|
109
|
+
export declare function partialFindings(messages: readonly unknown[]): string;
|
|
110
|
+
/**
|
|
111
|
+
* The note that tells the lead where an agent's work went, to append to the
|
|
112
|
+
* agent's answer. Without it the lead reads or runs its own on-disk copy --
|
|
113
|
+
* unchanged, because the agent worked on a private overlay -- sees no fix, and
|
|
114
|
+
* calls the agent a liar (pandorum 2026-09-24).
|
|
115
|
+
*
|
|
116
|
+
* `text` is the agent's answer before the note, read to tell whether it gave
|
|
117
|
+
* one: an empty answer is the tell that the run ended without the agent saying
|
|
118
|
+
* what it did, and the usual cause is a final turn that produced no text and no
|
|
119
|
+
* *readable* tool call -- a tool call emitted inside the reasoning channel is
|
|
120
|
+
* swallowed, so the loop sees "no more tool calls" and finishes as "completed".
|
|
121
|
+
* The lead must not read that silence as success, and if the agent handed
|
|
122
|
+
* changes back it must be told they are unvetted (pandorum 2026-09-24, agent
|
|
123
|
+
* "fix-manic-miner").
|
|
124
|
+
*/
|
|
125
|
+
export declare function handbackNote(text: string, finishReason: string | undefined, agentName: string, handed: readonly HandedRevision[]): string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tools a delegated agent gets, on every path that starts one:
|
|
3
|
+
* `spawn_agent`, a configured `subagent_*` tool, and a swarm worker.
|
|
4
|
+
*
|
|
5
|
+
* Two things differ from the lead's set, both measured on pandorum
|
|
6
|
+
* 2026-09-24 (yglnz):
|
|
7
|
+
*
|
|
8
|
+
* - **A question goes to the lead, not the user.** An agent's `ask_question`
|
|
9
|
+
* reached the user directly, and the whole round -- the lead included, since
|
|
10
|
+
* it waits inside its delegation call -- sat for 1,141 s until they answered
|
|
11
|
+
* a question about a tool, from an agent they could not place. Here the
|
|
12
|
+
* agent's `ask_question` ends its run and its question is its report: the
|
|
13
|
+
* lead reads it with the others' and decides whether to answer, run the
|
|
14
|
+
* agent again, or ask the user itself.
|
|
15
|
+
* - **The host's stateless tools come along.** Delegated agents got core's
|
|
16
|
+
* builtins only, so `check_file` -- which their instructions name -- was an
|
|
17
|
+
* `unavailable tool` twice, and the question above was the agent asking how
|
|
18
|
+
* to check braces without it. The ones shared are those that hold nothing
|
|
19
|
+
* per session and start nothing: not the terminal, which would give every
|
|
20
|
+
* agent of a round of 75 its own VS Code terminal, and not the browser,
|
|
21
|
+
* which is one Chrome.
|
|
22
|
+
*/
|
|
23
|
+
import type { AgentTool } from "@cerebriline/shared";
|
|
24
|
+
/** Host tools a delegated agent is given as well as its builtins. */
|
|
25
|
+
export declare const DELEGATED_HOST_TOOLS: ReadonlySet<string>;
|
|
26
|
+
export declare const ASK_LEAD_TOOL_NAME = "ask_question";
|
|
27
|
+
/** How an agent's question reads in the report the lead receives. */
|
|
28
|
+
export declare function formatQuestionForLead(question: string, options: readonly string[]): string;
|
|
29
|
+
/**
|
|
30
|
+
* `ask_question` for a delegated agent: the same name and input, so an agent
|
|
31
|
+
* file that tells it to ask still works, but the call ends the agent's run and
|
|
32
|
+
* the question becomes what it reports to the lead.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createAskLeadTool(): AgentTool;
|
|
35
|
+
/**
|
|
36
|
+
* A delegated agent's tools from its builtins and the host's tools.
|
|
37
|
+
*
|
|
38
|
+
* A host tool replaces a builtin of the same name, as it does for the lead.
|
|
39
|
+
*/
|
|
40
|
+
export declare function delegatedAgentTools(builtins: readonly AgentTool[], hostTools: readonly AgentTool[] | undefined): AgentTool[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hooks a caller attaches to one delegated run, carried on the tool context.
|
|
3
|
+
*
|
|
4
|
+
* A configured agent is reached through a tool, and a tool's only channel to
|
|
5
|
+
* its implementation is the input and the context. The input belongs to the
|
|
6
|
+
* model -- it is in the schema the model writes against -- so hooks that exist
|
|
7
|
+
* for one call and one call only travel on `context.metadata`, which the host
|
|
8
|
+
* already uses to say `delegatedByUser`.
|
|
9
|
+
*
|
|
10
|
+
* A function through a metadata bag is not pretty. The alternative is a
|
|
11
|
+
* registry threaded through `createConfiguredAgentTools` at session build time,
|
|
12
|
+
* which would mean the tool factory knowing about background runs, and a
|
|
13
|
+
* background run is a thing a user starts long after the tools were built.
|
|
14
|
+
* Reading and writing it live in this one file so the two ends cannot drift.
|
|
15
|
+
*/
|
|
16
|
+
import type { AgentHooks } from "@cerebriline/shared";
|
|
17
|
+
export declare function withDelegationHooks(metadata: Record<string, unknown> | undefined, hooks: AgentHooks | undefined): Record<string, unknown> | undefined;
|
|
18
|
+
export declare function readDelegationHooks(metadata: Record<string, unknown> | undefined): AgentHooks | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* How a run hands its caller the way to give its engine session back.
|
|
21
|
+
*
|
|
22
|
+
* A background delegation the user paused holds its engine session -- on an
|
|
23
|
+
* opencoti node a whole booked window -- for as long as the pause lasts. The
|
|
24
|
+
* session id is made inside the agent's tool, so the tool binds its release
|
|
25
|
+
* here and the caller calls it on pause. The next request after the resume
|
|
26
|
+
* books the session again.
|
|
27
|
+
*/
|
|
28
|
+
export type DelegationEngineSessionBinder = (release: () => Promise<unknown>) => void;
|
|
29
|
+
export declare function withDelegationEngineSession(metadata: Record<string, unknown> | undefined, bind: DelegationEngineSessionBinder | undefined): Record<string, unknown> | undefined;
|
|
30
|
+
export declare function readDelegationEngineSession(metadata: Record<string, unknown> | undefined): DelegationEngineSessionBinder | undefined;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every session the engine evicted, as this process saw it.
|
|
3
|
+
*
|
|
4
|
+
* opencoti's partial eviction (patch 0233) drops the largest live sequence
|
|
5
|
+
* when the KV cannot fit another token, to keep the rest of the batch alive.
|
|
6
|
+
* Ruled after swarm 0926 on b108 (11 agents holding 20-31k of 64k ended on
|
|
7
|
+
* it): no session is ever evicted. An eviction is a critical failure and a
|
|
8
|
+
* bug in the engine, never an operating mode -- so the agent is retried like
|
|
9
|
+
* a refusal, and every eviction is counted here, where the lead's status
|
|
10
|
+
* (`agents_status`) and the round report read it, and reported at WARN by the
|
|
11
|
+
* agent loop.
|
|
12
|
+
*
|
|
13
|
+
* Also delivered live on the agent's row: every update the turn-fault
|
|
14
|
+
* recovery emits for an eviction carries `evicted`, that agent's count so
|
|
15
|
+
* far, for whoever keeps per-agent state from the row stream.
|
|
16
|
+
*/
|
|
17
|
+
/** One eviction. */
|
|
18
|
+
export interface EngineEviction {
|
|
19
|
+
/** `Date.now()` when the agent was told. */
|
|
20
|
+
at: number;
|
|
21
|
+
/** The agent, as its row and the log name it. */
|
|
22
|
+
label: string;
|
|
23
|
+
/** The node or server that evicted it. */
|
|
24
|
+
where?: string;
|
|
25
|
+
/** The evicted session, when the loop knew it. */
|
|
26
|
+
sessionId?: string;
|
|
27
|
+
/** What the session held at the least: its last completed request. */
|
|
28
|
+
tokensHeld?: number;
|
|
29
|
+
/** The engine's text. */
|
|
30
|
+
message: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function recordEngineEviction(eviction: EngineEviction): void;
|
|
33
|
+
/** Every eviction since the process started. */
|
|
34
|
+
export declare function engineEvictionCount(): number;
|
|
35
|
+
/** The evictions kept, oldest first; optionally only those since `since`. */
|
|
36
|
+
export declare function engineEvictions(since?: number): EngineEviction[];
|
|
37
|
+
/** Test seam. */
|
|
38
|
+
export declare function resetEngineEvictions(): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { type AgentCheck, AgentCheckSchema, type AgentOracleResult, createDelegatedAgentCheck, type DelegatedAgentCheck, describeAgentCheck, readAgentCheck, } from "./agent-check";
|
|
2
|
+
export { AGENT_CONTROLS_NOTE, AGENT_SANDBOX_ROLE_NOTE, AgentControlFields, maxIterationsOf, readMaxIterations, } from "./agent-controls";
|
|
3
|
+
export { type AwaitingLeadEvent, type AwaitingLeadView, createDelegatedAgentLifetime, type DelegatedAgentLifetime, type DelegatedRunOutcome, type DelegatedStopReason, describeAwaitingLead, listAwaitingLead, onAwaitingLead, RESUME_AGENT_TOOL_NAME, type ResumeSuspendedResult, resumeSuspended, runDelegatedWithCap, type SubagentStopOutcome, stopSubagent, stopSuspended, } from "./agent-iteration-cap";
|
|
4
|
+
export { type AgentNodePlacement, type AgentNodeRuntimeConfig, createAgentNodePlacement, type PlacedAgentNode, POLYKV_LEAD_NODE_ID, POLYKV_LEAD_NODE_LABEL, PRIMARY_OVERFLOW_NODE_ID, type SessionAgentNodesInput, sessionAgentNodes, } from "./agent-node-placement";
|
|
5
|
+
export { type AgentNode, capLeadTier, emptyPlacementState, LEAD_PRIORITY, LEAD_SUBPOOL_CAPACITY, type Placement, type PlacementState, placeAgent, } from "./agent-placement";
|
|
6
|
+
export { type AgentPlacementQueue, createAgentPlacementQueue, NODE_COOL_OFF_MS, NoAgentCapacityError, type PlacementLease, } from "./agent-placement-queue";
|
|
7
|
+
export { AGENT_SUMMARY_MAX_CHARS, clearAgentReports, createReadAgentReportTool, READ_AGENT_REPORT_TOOL_NAME, readAgentReport, recordAgentReport, } from "./agent-reports";
|
|
8
|
+
export { type BackgroundDelegationControls, type BackgroundDelegationRegistry, type BackgroundDelegationStatus, type BackgroundDelegationView, createBackgroundDelegationRegistry, type StartBackgroundDelegationInput, startBackgroundDelegation, } from "./background-delegations";
|
|
9
|
+
export { type ConfiguredAgentConfig, type ConfiguredAgentLoadResult, type ConfiguredAgentReadError, loadConfiguredAgentConfigs, parseConfiguredAgentConfig, } from "./configured-agent-config";
|
|
10
|
+
export { type AgentProfileConnection, type AgentProviderConnection, buildConfiguredAgentToolDescriptors, buildConfiguredAgentToolName, type ConfiguredAgentInput, type ConfiguredAgentToolConfig, type ConfiguredAgentToolDescriptor, createConfiguredAgentTools, } from "./configured-agent-tool";
|
|
11
|
+
export { type ConfiguredAgentDelegationResult, type ConfiguredAgentSummary, type DelegateToConfiguredAgentInput, delegateToConfiguredAgent, findConfiguredAgent, listConfiguredAgentSummaries, renderDelegationForTranscript, UnknownConfiguredAgentError, } from "./delegate-to-agent";
|
|
12
|
+
export { type EngineEviction, engineEvictionCount, engineEvictions, recordEngineEviction, resetEngineEvictions, } from "./engine-evictions";
|
|
13
|
+
export { isNodeUnreachable } from "./node-reachability";
|
|
14
|
+
export { buildTeamProgressSummary, toTeamProgressLifecycleEvent, } from "./projections";
|
|
15
|
+
export * from "./runtime";
|
|
16
|
+
export { isSessionAllocationFull, retryWhileSessionFull, } from "./session-window-retry";
|
|
17
|
+
export type { SubAgentEndContext, SubAgentSettledContext, SubAgentStartContext, } from "./spawn-agent-tool";
|
|
18
|
+
export { createSpawnSwarmTool, DEFAULT_MAX_SWARM_WORKERS, type SpawnSwarmInput, SpawnSwarmInputSchema, type SpawnSwarmOutput, type SpawnSwarmToolConfig, SWARM_REDUCER_PROMPT, type SwarmPoolSnapshot, type SwarmPoolSource, type SwarmWorkerRequest, } from "./spawn-swarm-tool";
|
|
19
|
+
export { subagentCancelId, subagentCancellation, } from "./subagent-cancellation";
|
|
20
|
+
export { SUBAGENT_OUTPUT_STEP_CHARS, type SubagentOutputChunk, type SubagentOutputEvent, subagentOutput, } from "./subagent-output";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lead's controls over its delegated agents (spec C).
|
|
3
|
+
*
|
|
4
|
+
* - `requeue_agent`: stop an agent at its next boundary and put it back in
|
|
5
|
+
* the placement queue with its transcript. The harness picks the node; a
|
|
6
|
+
* reason of `slow` or `malfunction` sends it anywhere but where it was.
|
|
7
|
+
* - `restart_agent`: start it over from its task, in its place in the round,
|
|
8
|
+
* with its check, its sampler (a random seed drawn again) and its cap.
|
|
9
|
+
* - `resume_agent`: carry on an agent held at its iteration cap.
|
|
10
|
+
* - `retry_failed`: run a round's failed and cancelled agents again from the
|
|
11
|
+
* tasks they were given.
|
|
12
|
+
* - `message_agents` / `stop_agents`: what the side turn could already do,
|
|
13
|
+
* now from the lead's own turn too, by id or by name.
|
|
14
|
+
*
|
|
15
|
+
* Every control takes an agent's id (`r3-2`) or its name, and every one works
|
|
16
|
+
* for every delegated path that opens a round -- `spawn_agent` single and
|
|
17
|
+
* batch, configured agents, swarm workers -- because they all go through the
|
|
18
|
+
* round registry and the stop registry. A teammate is not a round, but its
|
|
19
|
+
* running task is in the stop registry under the teammate's name: stop,
|
|
20
|
+
* restart, message and requeue reach it there.
|
|
21
|
+
*
|
|
22
|
+
* None of these routes an agent by hand. Infrastructure trouble is the
|
|
23
|
+
* harness's to retry (ruling 1); these are for an agent whose *work* the lead
|
|
24
|
+
* wants handled differently.
|
|
25
|
+
*/
|
|
26
|
+
import type { AgentTool } from "@cerebriline/shared";
|
|
27
|
+
import { RESUME_AGENT_TOOL_NAME } from "./agent-iteration-cap";
|
|
28
|
+
import { type AgentRounds, type RoundAgentRecord, type RoundRecord } from "./agent-rounds";
|
|
29
|
+
export declare const REQUEUE_AGENT_TOOL_NAME = "requeue_agent";
|
|
30
|
+
export declare const RESTART_AGENT_TOOL_NAME = "restart_agent";
|
|
31
|
+
export { RESUME_AGENT_TOOL_NAME };
|
|
32
|
+
export declare const RETRY_FAILED_TOOL_NAME = "retry_failed";
|
|
33
|
+
export declare const MESSAGE_AGENTS_TOOL_NAME = "message_agents";
|
|
34
|
+
export declare const STOP_AGENTS_TOOL_NAME = "stop_agents";
|
|
35
|
+
export declare const AWAIT_AGENTS_TOOL_NAME = "await_agents";
|
|
36
|
+
export declare const COMPACT_AGENTS_TOOL_NAME = "compact_agents";
|
|
37
|
+
/**
|
|
38
|
+
* The tools that act on agents, as opposed to looking at them. An
|
|
39
|
+
* escalation's expert gets none of them (spec: status only).
|
|
40
|
+
*/
|
|
41
|
+
export declare const LEAD_CONTROL_TOOL_NAMES: ReadonlySet<string>;
|
|
42
|
+
/**
|
|
43
|
+
* The controls that reach a teammate's running task. The rest act on rounds,
|
|
44
|
+
* which a team alone never opens.
|
|
45
|
+
*/
|
|
46
|
+
export declare const TEAMMATE_CONTROL_TOOL_NAMES: ReadonlySet<string>;
|
|
47
|
+
/** An agent the lead named, resolved. */
|
|
48
|
+
export interface ResolvedAgent {
|
|
49
|
+
ref: string;
|
|
50
|
+
round?: RoundRecord;
|
|
51
|
+
agent?: RoundAgentRecord;
|
|
52
|
+
/** Its live control, while it runs. */
|
|
53
|
+
cancelId?: string;
|
|
54
|
+
label: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Resolve an agent by id or name: a round's agent first, then any agent
|
|
58
|
+
* running for the session under that name (a path with no round).
|
|
59
|
+
*/
|
|
60
|
+
export declare function resolveAgent(sessionId: string, ref: string, rounds?: AgentRounds): ResolvedAgent | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* The agents a message or a stop goes to: those named (by id or name), or
|
|
63
|
+
* every agent running for the session.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveTargets(sessionId: string, refs: readonly string[] | undefined): {
|
|
66
|
+
targets: ResolvedAgent[];
|
|
67
|
+
unknown: string[];
|
|
68
|
+
};
|
|
69
|
+
export declare const REQUEUE_AGENT_DESCRIPTION = "Stop an agent at its next turn boundary and put it back in the placement queue, keeping its transcript: it continues where it was, it does not start over. The harness picks the node -- you cannot, and never need to: waits on a server are already retried on their own. `reason` is for you and the log; `slow` or `malfunction` also sends it anywhere but its current node when another has room. Use it for an agent crawling on an overloaded node or behaving oddly there; use restart_agent when its work itself went wrong.";
|
|
70
|
+
export declare const RESTART_AGENT_DESCRIPTION = "Start an agent over from its original task, discarding its transcript and its workspace changes. It keeps its place in the round, its check, its sampler (a random seed is drawn again) and its iteration cap. `instructions` are added to its task as revised instructions -- say what to do differently. Works on a running agent and on one that has finished, failed or been stopped; a finished agent's new report reaches you when it ends.";
|
|
71
|
+
export declare const RESUME_AGENT_DESCRIPTION = "Continue agents that are waiting for you (awaiting_lead): stopped at their iteration cap, by the loop guard for repeating the same call, or by the struggle supervisor for grinding on after being told to commit a SUMMARY. Each carries on from where it stopped, with its transcript and its changes. One call takes several: `agent_ids`, or leave it out for every agent waiting on you. `extra_iterations` defaults to the cap each was spawned with (60 -> 120 -> 180). `instructions` are added as they resume -- for a looping agent, say what to do instead of the call it repeated; for a struggling one, what to settle for. To take the work as it is instead, stop_agents; to start over, restart_agent.";
|
|
72
|
+
export declare const RETRY_FAILED_DESCRIPTION = "Run a round's failed and cancelled agents again, each from the task it was originally given (and any revised instructions from a restart), with the same check, sampler and cap. `agent_ids` limits it to some of them. The round reports again when they finish. Infrastructure trouble never fails an agent -- it is retried on its own -- so what this reruns failed on its task: consider restart_agent with instructions for one that will fail the same way again.";
|
|
73
|
+
export declare const MESSAGE_AGENTS_DESCRIPTION = "Leave a message for running agents. Each reads it at its next turn, between tool calls, and carries on with it in mind. Use it to pass on a change of plan, a constraint, or an answer.";
|
|
74
|
+
export declare const STOP_AGENTS_DESCRIPTION = "Stop agents. A last resort: its task ends unfinished, and is lost unless you run it again. Slowness and a full server are not reasons to stop one: the harness paces agents and retries refusals, the PolyKV server frees KV cells on its own, and while an agent compacts its throughput drops to zero for minutes -- that is progress, not a hang (agents_status shows each agent's phase). To free KV cells, compact_agents; to move an agent off a slow node, requeue_agent; to change its course, message_agents. The rest of its round carries on. By default the stop is graceful: the agent finishes the step it is in, then gets one turn with no tools to report what it changed, found and verified, and where it stopped -- its report reaches you as its result, marked as partial work, and its file changes are kept. That takes as long as its step plus one reply, minutes on a slow node or a looping model. `immediate: true` ends it at once, with its file changes and no report -- also the way to end one already stopping gracefully. An agent waiting on you (at its cap, looping, struggling) is ended where it stopped, after the same report turn unless `immediate`.";
|
|
75
|
+
export declare const COMPACT_AGENTS_DESCRIPTION = "Compact running agents' context, giving their KV cells back without stopping them -- what to do instead of stop_agents when a PolyKV node is short of cells. Each compacts before its next model request: a summary call during which its throughput is zero, often for minutes, and after which it carries on with a summary in place of its detailed history. Rarely needed: agents compact on their own when their node's KV pressure reaches its threshold (0.85 unless configured), and the server frees cells itself. Use it only on agents holding a large share of a node's cells while the node's pressure is near its threshold -- agents_status shows both. An agent already compacting, or waiting on you, is left as it is.";
|
|
76
|
+
export interface LeadAgentToolsOptions {
|
|
77
|
+
sessionId: string;
|
|
78
|
+
/** What each tool did, in words: the side turn reports it to the lead. */
|
|
79
|
+
onAction?: (line: string) => void;
|
|
80
|
+
}
|
|
81
|
+
/** requeue_agent, restart_agent, resume_agent, retry_failed. */
|
|
82
|
+
export declare function createLeadAgentControlTools(options: LeadAgentToolsOptions): AgentTool[];
|
|
83
|
+
/** message_agents and stop_agents, by id or name, from any turn of the lead. */
|
|
84
|
+
export declare function createLeadAgentMessagingTools(options: LeadAgentToolsOptions): AgentTool[];
|
|
85
|
+
export declare const AWAIT_AGENTS_DESCRIPTION = "Wait for rounds running in the background to finish, and get their reports. With no arguments it waits for every round still running; `round_id` (or `round_ids`) waits for those. You need it only when you have nothing else to do until the agents are done: a background round's report is delivered to you on its own when it ends. A message for you -- from the user, or the agent system's report of a stuck agent -- ends the wait: this call returns, you read the message, and you can wait again.";
|
|
86
|
+
/**
|
|
87
|
+
* Wait for background rounds, as a call that waited would have: their
|
|
88
|
+
* reports come back as this call's result, and not as a notice as well.
|
|
89
|
+
*/
|
|
90
|
+
export declare function createAwaitAgentsTool(options: LeadAgentToolsOptions): AgentTool;
|
|
91
|
+
/** Everything the lead has over its agents, for its own turn. */
|
|
92
|
+
export declare function createLeadAgentTools(options: LeadAgentToolsOptions): AgentTool[];
|