@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,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task progress — the checklist the model keeps while it works.
|
|
3
|
+
*
|
|
4
|
+
* A run that starts by naming the work and then does it in order behaves very
|
|
5
|
+
* differently from one that discovers the work as it goes. The difference is
|
|
6
|
+
* not that the model is incapable of planning: it plans fine, and then loses
|
|
7
|
+
* the plan, because nothing carries it forward. What comes out the far end is
|
|
8
|
+
* the "wait, I also have to fix..." style of run, where each turn re-derives
|
|
9
|
+
* the goal from whatever is nearest.
|
|
10
|
+
*
|
|
11
|
+
* So this module is two things that have to exist together. A checklist the
|
|
12
|
+
* model can write as a side effect of work it is already doing — an optional
|
|
13
|
+
* `task_progress` parameter on every tool, so keeping the list current never
|
|
14
|
+
* costs a round trip — and a reminder that puts the list back in front of the
|
|
15
|
+
* model every few calls. The list alone is a display feature; the reminder is
|
|
16
|
+
* what changes behaviour.
|
|
17
|
+
*
|
|
18
|
+
* The parameter is added to the JSON schema rather than the zod schema on
|
|
19
|
+
* purpose: several tools validate with `.refine(...)`, which has no `.extend`,
|
|
20
|
+
* and every tool strips unknown keys before `execute` sees them. Capture
|
|
21
|
+
* therefore reads the *raw* input in a decorator that runs before the tool's
|
|
22
|
+
* own validation.
|
|
23
|
+
*/
|
|
24
|
+
import type { AgentTool } from "@cerebriline/shared";
|
|
25
|
+
/** The wire name of the checklist parameter, shared with the host. */
|
|
26
|
+
export declare const TASK_PROGRESS_PARAM = "task_progress";
|
|
27
|
+
/**
|
|
28
|
+
* How often the checklist is put back in front of the model, counted in tool
|
|
29
|
+
* calls. Matches the legacy default (`remindClineInterval`).
|
|
30
|
+
*
|
|
31
|
+
* A reminder is not free — it is re-sent text, and at a large context that is
|
|
32
|
+
* real budget — so the interval trades staleness against cost rather than
|
|
33
|
+
* being set as low as it can go.
|
|
34
|
+
*/
|
|
35
|
+
export declare const DEFAULT_TASK_PROGRESS_REMINDER_INTERVAL = 6;
|
|
36
|
+
/**
|
|
37
|
+
* The same reminder, counted in calls that changed the workspace.
|
|
38
|
+
*
|
|
39
|
+
* Asked for after a pandorum run that wrote for twenty turns without once
|
|
40
|
+
* re-marking the list. A read does not finish an item; a write usually does, so
|
|
41
|
+
* three of them is where the list has most likely gone stale, and it arrives
|
|
42
|
+
* sooner than the every-six-calls interval in exactly the runs that are doing
|
|
43
|
+
* the most work. Both counters share one reminder and one reset, so a busy run
|
|
44
|
+
* is not reminded twice.
|
|
45
|
+
*/
|
|
46
|
+
export declare const DEFAULT_TASK_PROGRESS_WRITE_INTERVAL = 3;
|
|
47
|
+
/**
|
|
48
|
+
* The description the model reads.
|
|
49
|
+
*
|
|
50
|
+
* Written to be answerable at the moment of any tool call, because that is
|
|
51
|
+
* when it is read: it says what to send the first time (the whole plan) and
|
|
52
|
+
* what to send afterwards (the same list, re-marked), which is the distinction
|
|
53
|
+
* models get wrong when told only "keep it updated". It also states the format
|
|
54
|
+
* exactly, since the list is parsed.
|
|
55
|
+
*/
|
|
56
|
+
export declare const TASK_PROGRESS_PARAM_DESCRIPTION: string;
|
|
57
|
+
/** A single parsed checklist line. */
|
|
58
|
+
export interface TaskProgressItem {
|
|
59
|
+
text: string;
|
|
60
|
+
done: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** The checklist as the UI and the reminder consume it. */
|
|
63
|
+
export interface TaskProgressState {
|
|
64
|
+
/** The raw markdown exactly as the model sent it. */
|
|
65
|
+
markdown: string;
|
|
66
|
+
items: TaskProgressItem[];
|
|
67
|
+
completed: number;
|
|
68
|
+
total: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Add the checklist parameter to a tool's JSON input schema.
|
|
72
|
+
*
|
|
73
|
+
* Returns the schema unchanged when it is not object-shaped, rather than
|
|
74
|
+
* throwing: a tool with an exotic schema should lose the checklist, not fail
|
|
75
|
+
* to register.
|
|
76
|
+
*/
|
|
77
|
+
export declare function withTaskProgressParam(inputSchema: Record<string, unknown>): Record<string, unknown>;
|
|
78
|
+
/**
|
|
79
|
+
* Read the checklist off a raw tool input.
|
|
80
|
+
*
|
|
81
|
+
* The field advertises `string`, and two thirds of the time that is what
|
|
82
|
+
* arrives. The rest of the time the items are all present and the container is
|
|
83
|
+
* not: measured across 240 pandorum sessions, of 1,920 tool calls carrying the
|
|
84
|
+
* field **641 -- 33.4% -- were discarded**, as an array (5.8%), as the field
|
|
85
|
+
* nested inside itself (20.5%), or as a string with no `- [ ]` lines (7.1%).
|
|
86
|
+
*
|
|
87
|
+
* That was deliberate once -- "a model that sends the field as an array has not
|
|
88
|
+
* sent a checklist" -- and the measurement says otherwise: the arrays are the
|
|
89
|
+
* parsed form, just not joined with newlines. Nothing here invents an item. A
|
|
90
|
+
* container it cannot read still returns `undefined`, and a checklist with no
|
|
91
|
+
* usable entry is still nothing.
|
|
92
|
+
*
|
|
93
|
+
* The silence is what made this expensive. No error is returned for a dropped
|
|
94
|
+
* payload, so `task_progress` reports a 0% failure rate either way.
|
|
95
|
+
*/
|
|
96
|
+
export declare function readTaskProgress(input: unknown): string | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Parse a markdown checklist.
|
|
99
|
+
*
|
|
100
|
+
* Only `- [ ]` / `- [x]` lines become items. Models routinely wrap the list in
|
|
101
|
+
* a heading or a sentence, and treating those as unchecked items would report
|
|
102
|
+
* work that does not exist and never complete.
|
|
103
|
+
*/
|
|
104
|
+
export declare function parseTaskProgress(markdown: string): TaskProgressItem[];
|
|
105
|
+
/** Build the full checklist state from raw markdown. */
|
|
106
|
+
export declare function buildTaskProgressState(markdown: string): TaskProgressState;
|
|
107
|
+
/**
|
|
108
|
+
* Render the reminder appended to a tool result.
|
|
109
|
+
*
|
|
110
|
+
* Sent as the checklist the model itself wrote, not as an instruction about
|
|
111
|
+
* checklists: the model already has the parameter description for that, and
|
|
112
|
+
* repeating advice every few calls trains it to skim the block. What it needs
|
|
113
|
+
* back is the *content* — which of its own steps are still open.
|
|
114
|
+
*/
|
|
115
|
+
export declare function buildTaskProgressReminder(state: TaskProgressState): string;
|
|
116
|
+
/**
|
|
117
|
+
* Find the most recent checklist in a transcript.
|
|
118
|
+
*
|
|
119
|
+
* Structurally typed rather than importing the message types: this reads one
|
|
120
|
+
* optional field out of tool-call inputs, and every shape it walks is
|
|
121
|
+
* defensively narrowed, so tying it to a concrete Message union would buy
|
|
122
|
+
* nothing but a dependency.
|
|
123
|
+
*/
|
|
124
|
+
export declare function findLatestTaskProgress(messages: readonly {
|
|
125
|
+
content?: unknown;
|
|
126
|
+
}[] | undefined): string | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* The nudge sent when a run is about to end with checklist items still open.
|
|
129
|
+
*
|
|
130
|
+
* Measured: a 58-minute run set the checklist once, on its 11th message of 137,
|
|
131
|
+
* and never touched it again — finishing with "Fix syntax errors" and "Verify
|
|
132
|
+
* fix with browser" unticked, both of which it had in fact done. The list is
|
|
133
|
+
* written as a side effect of a tool call, so once the model stops passing
|
|
134
|
+
* `task_progress` nothing ever ticks the boxes, and the panel ends the run
|
|
135
|
+
* reading as though the task failed.
|
|
136
|
+
*
|
|
137
|
+
* Two outcomes are acceptable and the message names both, because the checklist
|
|
138
|
+
* being stale and the work being unfinished are genuinely different situations
|
|
139
|
+
* and only the model knows which one it is in.
|
|
140
|
+
*/
|
|
141
|
+
export declare function buildTaskProgressCloseOutNudge(state: TaskProgressState, attempt?: 1 | 2): string;
|
|
142
|
+
/**
|
|
143
|
+
* A `completionPolicy.completionGuard` that will not let a run end quietly on a
|
|
144
|
+
* checklist with open items.
|
|
145
|
+
*
|
|
146
|
+
* Stops as soon as the checklist is closed: the second ask only happens if the
|
|
147
|
+
* first one changed nothing, so a model that ticks the boxes never sees it.
|
|
148
|
+
* After the budget is spent, the ordinary no-tool-call nudge and its own budget
|
|
149
|
+
* take over.
|
|
150
|
+
*/
|
|
151
|
+
export declare function createTaskProgressCompletionGuard(tracker: TaskProgressTracker): () => string | undefined;
|
|
152
|
+
/** Whether a tool has already been wrapped for checklist capture. */
|
|
153
|
+
export declare function isTaskProgressWrapped(tool: object): boolean;
|
|
154
|
+
export interface TaskProgressTrackerOptions {
|
|
155
|
+
/** Tool calls between reminders. Zero or less disables reminding. */
|
|
156
|
+
reminderInterval?: number;
|
|
157
|
+
/**
|
|
158
|
+
* Workspace-changing calls between reminders. Zero or less disables that
|
|
159
|
+
* half, leaving the plain interval above.
|
|
160
|
+
*/
|
|
161
|
+
writeInterval?: number;
|
|
162
|
+
/** Called whenever the model sends a new checklist. */
|
|
163
|
+
onUpdate?: (state: TaskProgressState) => void;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Holds the current checklist for a session and decides when to remind.
|
|
167
|
+
*
|
|
168
|
+
* The reminder counter advances on every tool call, not only on calls that
|
|
169
|
+
* carried a checklist — a model that has stopped updating the list is exactly
|
|
170
|
+
* the one that needs to see it again.
|
|
171
|
+
*/
|
|
172
|
+
export declare class TaskProgressTracker {
|
|
173
|
+
private state;
|
|
174
|
+
private callsSinceReminder;
|
|
175
|
+
private writesSinceReminder;
|
|
176
|
+
private readonly reminderInterval;
|
|
177
|
+
private readonly writeInterval;
|
|
178
|
+
private readonly onUpdate;
|
|
179
|
+
constructor(options?: TaskProgressTrackerOptions);
|
|
180
|
+
/** The checklist as last sent, or undefined if the model never sent one. */
|
|
181
|
+
getState(): TaskProgressState | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* Restore the checklist from history without treating it as a fresh update.
|
|
184
|
+
*
|
|
185
|
+
* The tracker is per-session memory, so a resumed task would otherwise come
|
|
186
|
+
* back with an empty list and the model would be reminded of nothing. It
|
|
187
|
+
* does not need to be persisted separately: every call that carried a
|
|
188
|
+
* checklist is already in the transcript, so history is the durable copy and
|
|
189
|
+
* this is a cache being warmed from it. Silent by design — a restore is not
|
|
190
|
+
* the model saying something new, and firing `onUpdate` would replay a
|
|
191
|
+
* checklist message the UI already has.
|
|
192
|
+
*
|
|
193
|
+
* Only fills an empty tracker; a live checklist is never overwritten by an
|
|
194
|
+
* older one from history.
|
|
195
|
+
*/
|
|
196
|
+
hydrate(markdown: string | undefined): void;
|
|
197
|
+
/**
|
|
198
|
+
* Record one tool call. Returns the reminder to append to its result, or
|
|
199
|
+
* undefined.
|
|
200
|
+
*
|
|
201
|
+
* A call that carried a checklist never also gets a reminder: the model just
|
|
202
|
+
* demonstrated it has the list, and echoing it straight back is pure cost.
|
|
203
|
+
*/
|
|
204
|
+
recordToolCall(input: unknown, toolName?: string): string | undefined;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Wrap a tool so its calls feed the tracker and its results carry reminders.
|
|
208
|
+
*
|
|
209
|
+
* The wrapper sits outside the tool's own validation, which is the only place
|
|
210
|
+
* the checklist is still visible: every tool strips keys its schema does not
|
|
211
|
+
* name, so by the time `execute` runs the field is gone.
|
|
212
|
+
*
|
|
213
|
+
* Reminders are only appended to string results. A tool that returns structured
|
|
214
|
+
* output has a shape its caller parses, and appending prose to that would break
|
|
215
|
+
* the consumer to nudge the model — the wrong trade.
|
|
216
|
+
*/
|
|
217
|
+
export declare function withTaskProgressCapture<TInput, TOutput>(tool: AgentTool<TInput, TOutput>, tracker: TaskProgressTracker): AgentTool<TInput, TOutput>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asking the engine whether one more agent fits, before spending a prefill
|
|
3
|
+
* finding out that it does not.
|
|
4
|
+
*
|
|
5
|
+
* opencoti's admission gate refuses a saturated pool with `429` + `Retry-After`,
|
|
6
|
+
* and the retry middleware in `@cerebriline/llms` waits that out. This is the other
|
|
7
|
+
* half, and the better one: a request that is going to be refused is a request
|
|
8
|
+
* worth not sending. `GET /polykv/pools/{id}/capacity` answers directly --
|
|
9
|
+
* `can_admit`, and `headroom_sessions` for how many more the pool will take --
|
|
10
|
+
* which is the contract the reference fan-out node is built on (FS-H1:
|
|
11
|
+
* "bounds the round by /capacity -- headroom_sessions caps, hard reject holds
|
|
12
|
+
* all").
|
|
13
|
+
*
|
|
14
|
+
* THE ONE RULE THIS FILE EXISTS TO ENFORCE: on c7, every `GET /capacity` folds
|
|
15
|
+
* the settle and bias EWMAs. It is not a read -- it advances the learner. A
|
|
16
|
+
* client that polls it corrupts the measurement it is asking for, and then acts
|
|
17
|
+
* on the corrupted answer. So capacity is read exactly once per round, where a
|
|
18
|
+
* round is the burst of spawns between one quiescent point and the next, and
|
|
19
|
+
* the agents in that round draw from that one answer. Nothing else in this
|
|
20
|
+
* codebase may call it. (c8 makes the GET read-only and moves the fold behind
|
|
21
|
+
* `?fold=1`; this file does not need to change when it does, it just stops
|
|
22
|
+
* being load-bearing.)
|
|
23
|
+
*
|
|
24
|
+
* A hold is not a failure. The engine is describing this moment, and a held
|
|
25
|
+
* agent has not started, so there is nothing to fail -- it waits for one of its
|
|
26
|
+
* siblings to finish and goes then. That is the difference between pacing a
|
|
27
|
+
* swarm and killing it, and it is the whole reason this sits before the spawn
|
|
28
|
+
* rather than after the refusal.
|
|
29
|
+
*/
|
|
30
|
+
import type { PolykvCapacity } from "@cerebriline/llms";
|
|
31
|
+
/** What one capacity read says, in the only three terms this file acts on. */
|
|
32
|
+
export interface AdmissionCapacity {
|
|
33
|
+
/** Whether the engine would take one more right now. */
|
|
34
|
+
canAdmit: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* How many more it would take. Negative means the engine has no
|
|
37
|
+
* measurement yet -- which is NOT "none": clamping `-1` to `0` is what told
|
|
38
|
+
* an empty server it was full (c8 T9), and it must read as "unbounded by
|
|
39
|
+
* this signal" instead.
|
|
40
|
+
*/
|
|
41
|
+
headroomSessions: number;
|
|
42
|
+
/**
|
|
43
|
+
* Why, in the engine's own words. Carried back verbatim: the engine keeps
|
|
44
|
+
* `elastic_reason` distinct from `kv headroom exhausted` precisely so a
|
|
45
|
+
* caller can tell "raise --max-parallel" from "this context does not fit",
|
|
46
|
+
* and collapsing them into one word throws that away.
|
|
47
|
+
*/
|
|
48
|
+
reason: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Read a `/capacity` payload into the three terms this file acts on.
|
|
52
|
+
*
|
|
53
|
+
* Both absences are deliberate readings, not defaults of convenience. A
|
|
54
|
+
* missing `can_admit` is a pool with an advisory policy -- the engine
|
|
55
|
+
* reporting rather than gating -- and reading it as a refusal would hold every
|
|
56
|
+
* agent on a server that never says no. A missing or negative
|
|
57
|
+
* `headroom_sessions` is the engine saying it has no measurement yet, which is
|
|
58
|
+
* the `-1` that must not be clamped to zero (c8 T9).
|
|
59
|
+
*/
|
|
60
|
+
export declare function admissionFromCapacity(capacity: Partial<PolykvCapacity> | undefined): AdmissionCapacity | undefined;
|
|
61
|
+
export interface AgentAdmissionController {
|
|
62
|
+
/**
|
|
63
|
+
* Resolves when this agent may start, having waited however long the
|
|
64
|
+
* engine's answer required. Rejects only on cancellation.
|
|
65
|
+
*/
|
|
66
|
+
acquire(signal?: AbortSignal): Promise<{
|
|
67
|
+
reason: string;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* The same question, answered instead of waited on.
|
|
71
|
+
*
|
|
72
|
+
* `undefined` where {@link acquire} would have held. A supervisor that
|
|
73
|
+
* re-checks on a tick needs an answer rather than a wait, or the first
|
|
74
|
+
* refusal stalls the loop whose whole job is to ask again later.
|
|
75
|
+
*
|
|
76
|
+
* **It reads the engine only when the answer could have changed.** On c7
|
|
77
|
+
* every `GET /capacity` folds the settle and bias EWMAs, so a 5-second tick
|
|
78
|
+
* that reached the wire would fold the learner twelve times a minute for
|
|
79
|
+
* the life of the swarm and corrupt the measurement it is reading. What
|
|
80
|
+
* changes the answer is an agent finishing, so a fresh read is bought by a
|
|
81
|
+
* {@link release} and by nothing else -- not by time passing.
|
|
82
|
+
*/
|
|
83
|
+
tryAcquire(): Promise<{
|
|
84
|
+
reason: string;
|
|
85
|
+
} | undefined>;
|
|
86
|
+
/**
|
|
87
|
+
* Whether one more could start right now — **without taking the slot**.
|
|
88
|
+
*
|
|
89
|
+
* For a caller that is deciding whether to launch, where something else
|
|
90
|
+
* does the real acquiring: a swarm supervisor asks this, and the worker it
|
|
91
|
+
* launches then acquires through its own gate. Consuming here would book
|
|
92
|
+
* every worker twice and halve the round.
|
|
93
|
+
*
|
|
94
|
+
* Reads under the same discipline as {@link tryAcquire}: a fresh answer is
|
|
95
|
+
* bought by an agent finishing, never by time passing.
|
|
96
|
+
*/
|
|
97
|
+
canAdmitMore(): Promise<boolean>;
|
|
98
|
+
/** Called when an admitted agent finishes, however it finished. */
|
|
99
|
+
release(): void;
|
|
100
|
+
}
|
|
101
|
+
interface AdmissionLogger {
|
|
102
|
+
log?(message: string, meta?: Record<string, unknown>): void;
|
|
103
|
+
}
|
|
104
|
+
export interface AgentAdmissionOptions {
|
|
105
|
+
/**
|
|
106
|
+
* One capacity read. `undefined` for "could not be asked" -- an unreachable
|
|
107
|
+
* control plane, or an endpoint with no pool -- which admits rather than
|
|
108
|
+
* holds, matching the engine's own default when its internal capacity check
|
|
109
|
+
* fails (it warns and admits; only `--polykv-adm-on-error deny` refuses).
|
|
110
|
+
*/
|
|
111
|
+
capacity: () => Promise<AdmissionCapacity | undefined>;
|
|
112
|
+
/**
|
|
113
|
+
* How long a held agent waits before asking again, when no sibling is
|
|
114
|
+
* running to release it.
|
|
115
|
+
*
|
|
116
|
+
* Only reached when the whole round is held and nothing is outstanding, so
|
|
117
|
+
* there is no release coming. Long enough that re-asking does not become
|
|
118
|
+
* the poll this file forbids.
|
|
119
|
+
*/
|
|
120
|
+
holdRetryMs?: number;
|
|
121
|
+
logger?: AdmissionLogger;
|
|
122
|
+
/** Seam for tests; the real one is abort-aware. */
|
|
123
|
+
sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
124
|
+
}
|
|
125
|
+
export declare const DEFAULT_ADMISSION_HOLD_RETRY_MS = 2000;
|
|
126
|
+
export declare function createAgentAdmissionController(options: AgentAdmissionOptions): AgentAdmissionController;
|
|
127
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lead's check on a delegated agent: a command and what its output must
|
|
3
|
+
* say, run when the agent says it is done.
|
|
4
|
+
*
|
|
5
|
+
* The same thing the change protocol's approved check is, with the same
|
|
6
|
+
* runner (`runtime/atomic/oracle.ts`) and the same semantics: it runs once at
|
|
7
|
+
* each completion attempt; on a fail the agent is shown the output and goes on
|
|
8
|
+
* working, within its iteration budget; on a pass -- or when the budget is
|
|
9
|
+
* spent -- the verdict goes into the agent's report. What an agent's own "it
|
|
10
|
+
* works now" is worth was measured across the atomic campaign: routinely
|
|
11
|
+
* nothing, because a model reports on the edit it meant to make.
|
|
12
|
+
*
|
|
13
|
+
* Where it runs is the part that differs. A delegated agent works on a private
|
|
14
|
+
* overlay of the workspace, so the lead's files do not hold its work, and a
|
|
15
|
+
* check run on them judges nothing the agent did. The check runs where the
|
|
16
|
+
* agent's own shell runs: under the sandbox launcher (`wrapSpawn`), which maps
|
|
17
|
+
* the workspace onto the agent's overlay. Where there is no launcher -- no
|
|
18
|
+
* sandbox on this platform, or "Agents can run commands" off -- the check is
|
|
19
|
+
* NOT run on the host instead: every delegated command runs sandboxed, and an
|
|
20
|
+
* unsandboxed one would both read the wrong files and be free to write the
|
|
21
|
+
* real ones. The report says "not run: no command sandbox".
|
|
22
|
+
*/
|
|
23
|
+
import { z } from "zod";
|
|
24
|
+
import { type OracleSpawnWrapper, runOracle } from "../../../runtime/atomic/oracle";
|
|
25
|
+
/** What the lead writes: a command, a pattern, and which way it must go. */
|
|
26
|
+
export interface AgentCheck {
|
|
27
|
+
command: string;
|
|
28
|
+
/** A regular expression, matched against stdout and stderr together. */
|
|
29
|
+
expect: string;
|
|
30
|
+
/** `match` (default): the output must match. `not_match`: it must not. */
|
|
31
|
+
must?: "match" | "not_match";
|
|
32
|
+
}
|
|
33
|
+
/** The check as a tool field; see {@link readAgentCheck} for what is tolerated. */
|
|
34
|
+
export declare const AgentCheckSchema: z.ZodObject<{
|
|
35
|
+
command: z.ZodString;
|
|
36
|
+
expect: z.ZodString;
|
|
37
|
+
must: z.ZodOptional<z.ZodEnum<{
|
|
38
|
+
match: "match";
|
|
39
|
+
not_match: "not_match";
|
|
40
|
+
}>>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
/** How the check came out, in the agent's report. */
|
|
43
|
+
export interface AgentOracleResult {
|
|
44
|
+
status: "pass" | "fail" | "not_run";
|
|
45
|
+
command: string;
|
|
46
|
+
expect: string;
|
|
47
|
+
must: "match" | "not_match";
|
|
48
|
+
/** Exit status of the last run; `null` when it could not start or was not run. */
|
|
49
|
+
exitCode: number | null;
|
|
50
|
+
/** The end of the last run's output, bounded. */
|
|
51
|
+
output: string;
|
|
52
|
+
/** How many completion attempts it judged. */
|
|
53
|
+
runs: number;
|
|
54
|
+
/** Why it was not run, or what stopped it being re-run. */
|
|
55
|
+
reason?: string;
|
|
56
|
+
}
|
|
57
|
+
/** Most of a check's output kept for the report and the agent. */
|
|
58
|
+
export declare const AGENT_CHECK_OUTPUT_TAIL_CHARS = 1500;
|
|
59
|
+
/**
|
|
60
|
+
* Identical failing verdicts in a row after which the check stops holding the
|
|
61
|
+
* agent back.
|
|
62
|
+
*
|
|
63
|
+
* Needed because the default iteration cap is none: a check that cannot pass
|
|
64
|
+
* (a pattern the fixed program never prints -- measured on the change
|
|
65
|
+
* protocol's auto-approved checks) would otherwise keep an uncapped agent at
|
|
66
|
+
* it forever. A check re-run over output that has not moved cannot say
|
|
67
|
+
* anything the run before it did not, which is the change protocol's own
|
|
68
|
+
* stalled-check rule. The agent is let finish; the verdict stays `fail`.
|
|
69
|
+
*/
|
|
70
|
+
export declare const AGENT_CHECK_MAX_IDENTICAL_FAILS = 3;
|
|
71
|
+
/**
|
|
72
|
+
* Failing runs in a row where the shell did not find the check's program,
|
|
73
|
+
* after which the agent is let finish and the check counts as not run.
|
|
74
|
+
*/
|
|
75
|
+
export declare const AGENT_CHECK_MAX_UNRESOLVED = 2;
|
|
76
|
+
/** Whether a failed run says the shell never found the program. */
|
|
77
|
+
export declare function checkCommandUnresolved(verdict: {
|
|
78
|
+
exitCode: number | null;
|
|
79
|
+
output: string;
|
|
80
|
+
}): boolean;
|
|
81
|
+
/** The reason a check is not run when the agent has no sandboxed shell. */
|
|
82
|
+
export declare const AGENT_CHECK_NO_SANDBOX = "no command sandbox";
|
|
83
|
+
/**
|
|
84
|
+
* The check as the lead wrote it, read tolerantly, or `undefined` for none.
|
|
85
|
+
*
|
|
86
|
+
* Models send tool arguments in more shapes than the schema names: the object
|
|
87
|
+
* as JSON text, `cmd` for `command`, `pattern` or `regex` for `expect`, a
|
|
88
|
+
* pattern wrapped in slashes, `must: "not-match"`. Each of those has only one
|
|
89
|
+
* reading, so it is taken. What cannot be read -- no command, or a pattern
|
|
90
|
+
* that will not compile -- is refused with the reason, at spawn time: a check
|
|
91
|
+
* that fails every run for a typo would hold the agent to work it can never
|
|
92
|
+
* finish.
|
|
93
|
+
*/
|
|
94
|
+
export declare function readAgentCheck(raw: unknown): AgentCheck | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* What the agent is told up front, at the end of its task, so it can run the
|
|
97
|
+
* check itself before it says it is done.
|
|
98
|
+
*/
|
|
99
|
+
export declare function describeAgentCheck(check: AgentCheck, canRun: boolean): string;
|
|
100
|
+
export interface DelegatedAgentCheck {
|
|
101
|
+
readonly check: AgentCheck;
|
|
102
|
+
/** Whether it will actually be run: a sandboxed shell to run it in. */
|
|
103
|
+
readonly canRun: boolean;
|
|
104
|
+
/** For the agent's `completionPolicy.onCompletionAttempt`. */
|
|
105
|
+
onCompletionAttempt(context: {
|
|
106
|
+
text?: string;
|
|
107
|
+
forced?: boolean;
|
|
108
|
+
}): Promise<string | undefined>;
|
|
109
|
+
/** The verdict so far; `undefined` before any completion attempt. */
|
|
110
|
+
result(): AgentOracleResult | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Stop judging: the run is over, and anything that follows on the same
|
|
113
|
+
* conversation -- the summary asked for the lead -- is not a completion
|
|
114
|
+
* attempt of the task.
|
|
115
|
+
*/
|
|
116
|
+
close(): void;
|
|
117
|
+
}
|
|
118
|
+
export interface CreateDelegatedAgentCheckOptions {
|
|
119
|
+
check: AgentCheck;
|
|
120
|
+
/** The workspace root, which the launcher maps onto the agent's overlay. */
|
|
121
|
+
cwd: string;
|
|
122
|
+
/**
|
|
123
|
+
* The agent's sandboxed shell launcher. Absent means no command sandbox,
|
|
124
|
+
* and the check is reported as not run -- never run on the host instead.
|
|
125
|
+
*/
|
|
126
|
+
wrapSpawn?: OracleSpawnWrapper;
|
|
127
|
+
timeoutMs?: number;
|
|
128
|
+
/** Test seam: the runner. The change protocol's by default. */
|
|
129
|
+
run?: typeof runOracle;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* A check bound to one agent: its launcher, its counters, its verdict.
|
|
133
|
+
*/
|
|
134
|
+
export declare function createDelegatedAgentCheck(options: CreateDelegatedAgentCheckOptions): DelegatedAgentCheck;
|
|
135
|
+
/** Its task reads as review and report only, with nothing to change. */
|
|
136
|
+
export declare function isReviewOnlyTask(text: string): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Agents given a check they cannot pass by doing what they were asked.
|
|
139
|
+
*
|
|
140
|
+
* A check judges an agent's copy of the workspace, so it measures edits; a
|
|
141
|
+
* reviewer's job leaves the copy as it was, and every "done" is sent back to
|
|
142
|
+
* work by a check that still fails. Six reviewers in swarm czbnh ended on a
|
|
143
|
+
* failing check after editing the file they were told to review, and ground
|
|
144
|
+
* on until the lead stopped them. Warned, not refused: the heuristic reads
|
|
145
|
+
* words, and the lead may mean it.
|
|
146
|
+
*/
|
|
147
|
+
export declare function reviewOnlyCheckWarning(members: ReadonlyArray<{
|
|
148
|
+
name: string;
|
|
149
|
+
task: string;
|
|
150
|
+
instructions?: string;
|
|
151
|
+
check?: AgentCheck;
|
|
152
|
+
}>): string | undefined;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two per-agent controls every spawn tool offers the lead:
|
|
3
|
+
* `max_iterations` (see `agent-iteration-cap.ts`) and `check` (see
|
|
4
|
+
* `agent-check.ts`). Stated once here so that `spawn_agent`, its batch
|
|
5
|
+
* entries, configured agents and `spawn_swarm` read them -- and describe them
|
|
6
|
+
* -- the same way.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
/** Highest cap accepted; anything above is a typo, not a plan. */
|
|
10
|
+
export declare const MAX_ITERATIONS_CEILING = 100000;
|
|
11
|
+
export declare const MaxIterationsField: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
12
|
+
/**
|
|
13
|
+
* The controls a spawn tool offers the lead: its check.
|
|
14
|
+
*
|
|
15
|
+
* `max_iterations` is not offered (user ruling, 2026-09-28). No agent the lead
|
|
16
|
+
* launches is capped by default, and a lead given the field set one anyway --
|
|
17
|
+
* 25 on every agent of pandorum's h0o2o swarm -- and then reported "7 agents
|
|
18
|
+
* reached their 25-iteration caps before completing" as a flaw of the harness.
|
|
19
|
+
* What watches a long run instead is the lead being told every
|
|
20
|
+
* {@link LEAD_ITERATION_NUDGE_EVERY} iterations to look at it. A cap the user
|
|
21
|
+
* wrote into an agent file still applies, and a model that sends the field
|
|
22
|
+
* anyway is ignored rather than refused (see {@link controlFields}).
|
|
23
|
+
*/
|
|
24
|
+
export declare const AgentControlFields: {
|
|
25
|
+
check: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
command: z.ZodString;
|
|
27
|
+
expect: z.ZodString;
|
|
28
|
+
must: z.ZodOptional<z.ZodEnum<{
|
|
29
|
+
match: "match";
|
|
30
|
+
not_match: "not_match";
|
|
31
|
+
}>>;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
};
|
|
34
|
+
/** Iterations between the notes that ask the lead to look at a long-running agent. */
|
|
35
|
+
export declare const LEAD_ITERATION_NUDGE_EVERY = 60;
|
|
36
|
+
/**
|
|
37
|
+
* `max_iterations` as a number, or `undefined` for the default.
|
|
38
|
+
*
|
|
39
|
+
* Tolerant of what models send: a numeric string, a float (floored), the
|
|
40
|
+
* camel-cased name. What cannot be a cap -- zero, a negative, words -- is
|
|
41
|
+
* refused with the reason rather than read as "no cap", which is the one
|
|
42
|
+
* reading that turns a typo into an unbounded agent.
|
|
43
|
+
*/
|
|
44
|
+
export declare function readMaxIterations(raw: unknown): number | undefined;
|
|
45
|
+
/** The field under either name a model uses for it. */
|
|
46
|
+
export declare function maxIterationsOf(input: unknown): number | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* How the system works and what the lead's part in it is. Swarm 2026-09-27:
|
|
49
|
+
* the lead told 50 agents "DO NOT modify any file" for fear of concurrent
|
|
50
|
+
* edits, gave review-only agents a check they could never pass, and never
|
|
51
|
+
* applied a single revision -- it did not know that was its job.
|
|
52
|
+
*/
|
|
53
|
+
export declare const AGENT_SANDBOX_ROLE_NOTE = "How agents work: each runs in its own sandboxed copy of the workspace, so any number may read and edit the same files at once -- there is no concurrency problem to avoid, and no reason to forbid edits. Your files stay unchanged: each agent's edits come back to you as revisions. You are the synthesizer, and nothing merges on its own: read each report, inspect its revisions (`read_files` with `revision`), apply what is right (`restore_file`), reconcile agents that disagree, and verify the result yourself. ";
|
|
54
|
+
/** What a spawn tool's description says about the two controls. */
|
|
55
|
+
export declare const AGENT_CONTROLS_NOTE = "Agents run without an iteration cap; you are told every 60 iterations of a long-running one, so you can check on it with `agents_status`. A configured agent whose file sets a cap stops at it and waits for you with its work kept: `resume_agent(agent_ids?)` continues it, or `stop_agents` takes its work as it is. An agent the loop guard stops for sending the same call again waits for you the same way, reported as looping with the call it repeated: resume it with `instructions` saying what to do instead, or restart it. Per agent, or for the whole call (an agent's own wins): `check: {command, expect, must?}` is its oracle, and it is deterministic: when it says it is done, `command` runs in its own sandboxed copy of the workspace and must exit 0 with output matching the regex `expect` (`must: \"not_match\"`: not matching); on a fail it is shown the output and keeps working. It judges only that agent's own copy -- not the merged result, which is yours to check -- and a call-level check applies to every agent of the call: give it per agent to those whose edits it measures, never to review or analysis agents, which cannot pass it. It is told its check up front. Its report gives `iterations`/`maxIterations`, `stopReason` (`iteration_cap` or `loop_guard`) when either ended it, and `oracle` {status, exitCode, output}. ";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writing an agent file to disk.
|
|
3
|
+
*
|
|
4
|
+
* The format itself -- the frontmatter order, the quoting, the file name --
|
|
5
|
+
* lives in `@cerebriline/shared` so the VS Code agent editor and this share one
|
|
6
|
+
* renderer. Only the part that touches the filesystem is here.
|
|
7
|
+
*/
|
|
8
|
+
import { type AgentFileFields, agentFileName, renderAgentFile, validateAgentFields } from "@cerebriline/shared";
|
|
9
|
+
export type { AgentFileFields };
|
|
10
|
+
export { agentFileName, renderAgentFile, validateAgentFields };
|
|
11
|
+
export interface WriteAgentFileResult {
|
|
12
|
+
path: string;
|
|
13
|
+
/** True when a file of the same name was replaced. */
|
|
14
|
+
overwritten: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Write one agent file into `directory`, creating the directory if needed.
|
|
18
|
+
*
|
|
19
|
+
* Refuses to replace an existing agent unless told to. A model asked to "create
|
|
20
|
+
* an agent for network troubleshooting" twice should say the second one is
|
|
21
|
+
* already there, not silently discard whatever the user had tuned in the first.
|
|
22
|
+
*/
|
|
23
|
+
export declare function writeAgentFile(input: {
|
|
24
|
+
directory: string;
|
|
25
|
+
agent: AgentFileFields;
|
|
26
|
+
overwrite?: boolean;
|
|
27
|
+
fileExists: (path: string) => Promise<boolean>;
|
|
28
|
+
}): Promise<WriteAgentFileResult>;
|