@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,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `wait_for_expert` — the base model's turn valve while it stands down.
|
|
3
|
+
*
|
|
4
|
+
* The escalation is not a blocking call any more: `escalate` hands over and
|
|
5
|
+
* returns, and the base model is live for the whole exchange. That raises a
|
|
6
|
+
* question the blocking call never had to answer -- what does a live base
|
|
7
|
+
* model DO between the hand-over and the delivery? Left to itself it will burn
|
|
8
|
+
* its whole turn budget re-reading files, or call `escalate` again to see if
|
|
9
|
+
* anything has happened, which is the same busy-wait with a worse bill.
|
|
10
|
+
*
|
|
11
|
+
* So there is one call that means "wake me when there is something", and it
|
|
12
|
+
* blocks until there is. One turn per batch, and the batching interval decides
|
|
13
|
+
* how many batches there are. That is the entire turn economy of the
|
|
14
|
+
* supervision, in one tool.
|
|
15
|
+
*
|
|
16
|
+
* It is deliberately not a poll that returns "nothing yet". A tool that can
|
|
17
|
+
* return nothing is a tool a model will call in a loop.
|
|
18
|
+
*/
|
|
19
|
+
import { type AgentTool } from "@cerebriline/shared";
|
|
20
|
+
export declare const WAIT_FOR_EXPERT_TOOL_NAME = "wait_for_expert";
|
|
21
|
+
export declare const WAIT_FOR_EXPERT_TOOL_DESCRIPTION = "Wait for the expert, and be told what it has been doing.\n\nWhile the expert works you are standing down from changes, and this is how you follow it. The call returns when there is something for you: a batch of notes covering everything the expert has done since you last looked, or its delivery once it is finished. It costs you one turn each time, which is why the notes arrive in batches rather than one per action.\n\nEach note names a tool the expert called, and where that call wrote a file it also gives the revision number holding what was written. Read the flow rather than auditing it \u2014 you are forming a view of whether the work is going somewhere, not checking receipts. Spot-check the parts that matter: `read_files` with `revision: \"#4\"` shows you the exact bytes a note is about, which is the only way to check a claim against what was actually written rather than against a file that has moved on since.\n\nIf what you see is the expert going round in circles \u2014 the same file rewritten again and again, a check failing the same way each time, nothing moving across several batches \u2014 say so. Call `escalate` with `message` to tell it what you see, or to tell it to stop. That judgement is yours, and nobody else is going to make it.";
|
|
22
|
+
/** What waiting turned up. */
|
|
23
|
+
export interface ExpertWatchResult {
|
|
24
|
+
kind: "batch" | "delivered" | "none";
|
|
25
|
+
text: string;
|
|
26
|
+
}
|
|
27
|
+
export interface WaitForExpertToolOptions {
|
|
28
|
+
/** Blocks until the next batch or the delivery. Owned by the session. */
|
|
29
|
+
collect: () => Promise<ExpertWatchResult>;
|
|
30
|
+
onError?: (message: string, error: unknown) => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function createWaitForExpertTool(options: WaitForExpertToolOptions): AgentTool;
|
|
33
|
+
/** No expert is working, so there is nothing to wait for. */
|
|
34
|
+
export declare const NOTHING_TO_WAIT_FOR = "No expert is working right now, so there is nothing to wait for. The workspace is yours \u2014 carry on with the task.";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SessionManifest } from "../../session/models/session-manifest";
|
|
2
|
+
import type { SessionHistoryRecord, SessionRecord } from "../../types/sessions";
|
|
3
|
+
import type { SessionBackend } from "./host";
|
|
4
|
+
import type { RuntimeHost } from "./runtime-host";
|
|
5
|
+
export interface SessionHistoryListOptions {
|
|
6
|
+
limit?: number;
|
|
7
|
+
includeManifestFallback?: boolean;
|
|
8
|
+
hydrate?: boolean;
|
|
9
|
+
includeSubagents?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function manifestToSessionRecord(manifest: SessionManifest): SessionRecord;
|
|
12
|
+
export declare function hydrateSessionHistory(host: Pick<RuntimeHost, "readSessionMessages">, rows: SessionRecord[]): Promise<SessionHistoryRecord[]>;
|
|
13
|
+
export declare function listSessionHistory(host: Pick<RuntimeHost, "listSessions" | "readSessionMessages">, options?: SessionHistoryListOptions): Promise<SessionHistoryRecord[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Lists history directly from the persistence backend without constructing a
|
|
16
|
+
* runtime host. This keeps read-only history commands from initializing runtime
|
|
17
|
+
* services such as plugins, MCP, or hub transport.
|
|
18
|
+
*/
|
|
19
|
+
export declare function listSessionHistoryFromBackend(backend: Pick<SessionBackend, "listSessions">, options?: SessionHistoryListOptions): Promise<SessionHistoryRecord[]>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClineCoreOptions } from "../../cline-core/types";
|
|
2
|
+
import { FileSessionService } from "../../session/services/file-session-service";
|
|
3
|
+
import { CoreSessionService } from "../../session/services/session-service";
|
|
4
|
+
import type { RuntimeHost } from "./runtime-host";
|
|
5
|
+
export type SessionBackend = CoreSessionService | FileSessionService;
|
|
6
|
+
export declare function resolveSessionBackend(options: ClineCoreOptions): Promise<SessionBackend>;
|
|
7
|
+
export declare function createRuntimeHost(options: ClineCoreOptions): Promise<RuntimeHost>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { AgentEvent, BasicLogger } from "@cerebriline/shared";
|
|
2
|
+
import type { TeamEvent } from "../../../extensions/tools/team";
|
|
3
|
+
import { type AgentEventContext } from "../../../services/agent-events";
|
|
4
|
+
import type { CoreSessionConfig } from "../../../types/config";
|
|
5
|
+
import type { CoreSessionEvent } from "../../../types/events";
|
|
6
|
+
import type { ActiveSession } from "../../../types/session";
|
|
7
|
+
import type { SessionAccumulatedUsage } from "../runtime-host";
|
|
8
|
+
export interface AgentEventBridgeDeps {
|
|
9
|
+
getSession(sessionId: string): ActiveSession | undefined;
|
|
10
|
+
usageBySession: Map<string, SessionAccumulatedUsage>;
|
|
11
|
+
aggregateUsageBySession: Map<string, SessionAccumulatedUsage>;
|
|
12
|
+
emit(event: CoreSessionEvent): void;
|
|
13
|
+
persistMessages: AgentEventContext["persistMessages"];
|
|
14
|
+
enqueuePendingPrompt(sessionId: string, entry: {
|
|
15
|
+
prompt: string;
|
|
16
|
+
delivery: "queue" | "steer";
|
|
17
|
+
}): void;
|
|
18
|
+
invokeBackendOptional(method: string, ...args: unknown[]): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare class AgentEventBridge {
|
|
21
|
+
private readonly deps;
|
|
22
|
+
constructor(deps: AgentEventBridgeDeps);
|
|
23
|
+
/**
|
|
24
|
+
* Last agent identity stamped on each session's events while the session
|
|
25
|
+
* was still registered. A session's agent can keep emitting after the host
|
|
26
|
+
* removes it from the sessions map (teardown deletes the entry before the
|
|
27
|
+
* run fully drains), and without this snapshot those late events reach
|
|
28
|
+
* telemetry with no agent identity at all. Bounded FIFO so a long-lived
|
|
29
|
+
* host doesn't accumulate entries forever.
|
|
30
|
+
*/
|
|
31
|
+
private readonly lastKnownIdentityBySession;
|
|
32
|
+
private static readonly MAX_IDENTITY_SNAPSHOTS;
|
|
33
|
+
dispatchAgentEvent(sessionId: string, config: CoreSessionConfig, event: AgentEvent): void;
|
|
34
|
+
private rememberSessionIdentity;
|
|
35
|
+
handleTeamEvent(rootSessionId: string, event: TeamEvent): Promise<void>;
|
|
36
|
+
handlePluginEvent(rootSessionId: string, event: {
|
|
37
|
+
name: string;
|
|
38
|
+
payload?: unknown;
|
|
39
|
+
}, fallbackAutomation?: NonNullable<CoreSessionConfig["extensionContext"]>["automation"], fallbackTelemetry?: CoreSessionConfig["telemetry"]): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Route `plugin_telemetry` events emitted by the sandbox-side telemetry
|
|
42
|
+
* bridge into the host telemetry service. Sandboxed plugins cannot hold
|
|
43
|
+
* the live service (it is not JSON-serializable across the IPC boundary),
|
|
44
|
+
* so their capture/record calls arrive as events. All plugin events are
|
|
45
|
+
* namespaced under `plugin.` and stamped with the plugin name so they
|
|
46
|
+
* cannot impersonate first-party events.
|
|
47
|
+
*/
|
|
48
|
+
handlePluginTelemetry(rootSessionId: string, payload: unknown, fallbackTelemetry?: CoreSessionConfig["telemetry"]): void;
|
|
49
|
+
handlePluginLog(rootSessionId: string, payload: unknown, fallbackLogger?: BasicLogger): void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FileSessionService } from "../../../session/services/file-session-service";
|
|
2
|
+
import type { CoreSessionService } from "../../../session/services/session-service";
|
|
3
|
+
import type { ActiveSession } from "../../../types/session";
|
|
4
|
+
import type { SessionRecord } from "../../../types/sessions";
|
|
5
|
+
export type SessionBackend = CoreSessionService | FileSessionService;
|
|
6
|
+
export declare function toActiveSessionRecord(session: ActiveSession): SessionRecord;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SessionBackend } from "./session-record";
|
|
2
|
+
export declare function invokeBackend<T>(backend: SessionBackend, method: string, ...args: unknown[]): Promise<T>;
|
|
3
|
+
export declare function invokeBackendOptional(backend: SessionBackend, method: string, ...args: unknown[]): Promise<void>;
|
|
4
|
+
export declare function invokeBackendOptionalValue<T = unknown>(backend: SessionBackend, method: string, ...args: unknown[]): Promise<T | undefined>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { AgentEvent, AgentTool } from "@cerebriline/shared";
|
|
2
|
+
import { type ToolExecutors } from "../../../extensions/tools";
|
|
3
|
+
import { type DocumentExtractExecutorOptions } from "../../../extensions/tools/executors/document-extract";
|
|
4
|
+
import type { SubAgentEndContext, SubAgentSettledContext, SubAgentStartContext } from "../../../extensions/tools/team";
|
|
5
|
+
import type { DelegatedSandboxProvider } from "../../../extensions/tools/team/agent-sandbox-executors";
|
|
6
|
+
import { type DelegatedSandboxes, type DelegatedWorkspace, type HandedRevision } from "../../../extensions/tools/team/delegated-sandboxes";
|
|
7
|
+
import type { SpawnToolOptions } from "../../../extensions/tools/team/spawn-agent-tool";
|
|
8
|
+
import type { CoreSessionConfig } from "../../../types/config";
|
|
9
|
+
import type { ActiveSession } from "../../../types/session";
|
|
10
|
+
export type SubAgentStartTracker = Map<string, {
|
|
11
|
+
startedAt: number;
|
|
12
|
+
rootSessionId: string;
|
|
13
|
+
}>;
|
|
14
|
+
export interface SpawnToolDeps {
|
|
15
|
+
getSession(sessionId: string): ActiveSession | undefined;
|
|
16
|
+
subAgentStarts: SubAgentStartTracker;
|
|
17
|
+
onAgentEvent(rootSessionId: string, config: CoreSessionConfig, event: AgentEvent): void;
|
|
18
|
+
invokeBackendOptional(method: string, ...args: unknown[]): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* The session's delegated-agent workspaces. When present, every agent this
|
|
21
|
+
* builds -- a `spawn_agent` agent and each swarm worker -- runs over a
|
|
22
|
+
* private overlay of the workspace instead of the lead's executors, and gets
|
|
23
|
+
* a shell only where the sandbox can launch one and the user allowed agent
|
|
24
|
+
* commands. Absent, an agent keeps the lead's executors and gets no shell at
|
|
25
|
+
* all: an unsandboxed command would run against the real workspace.
|
|
26
|
+
*/
|
|
27
|
+
sandboxes?: DelegatedSandboxes;
|
|
28
|
+
}
|
|
29
|
+
/** Kept for hosts that name the provider type from here. */
|
|
30
|
+
export type { DelegatedSandboxProvider };
|
|
31
|
+
/**
|
|
32
|
+
* The builtin-tool options that bind a delegated agent to its workspace: the
|
|
33
|
+
* overlay-backed executors, and the shell only when the workspace allows it.
|
|
34
|
+
* Without a workspace, the lead's executors and never a shell.
|
|
35
|
+
*/
|
|
36
|
+
export declare function delegatedToolOptions(workspace: DelegatedWorkspace | undefined, leadExecutors: Partial<ToolExecutors> | undefined,
|
|
37
|
+
/** The lead's document reader settings and vision model, when the tool is on. */
|
|
38
|
+
extractDocument?: DocumentExtractExecutorOptions): {
|
|
39
|
+
executorOptions?: DelegatedWorkspace["executorOptions"];
|
|
40
|
+
executors?: Partial<ToolExecutors>;
|
|
41
|
+
enableBash?: false;
|
|
42
|
+
};
|
|
43
|
+
export interface SessionSubAgentLifecycleCallbacks {
|
|
44
|
+
onSubAgentEvent: (event: AgentEvent) => void;
|
|
45
|
+
onSubAgentStart: (context: SubAgentStartContext) => void;
|
|
46
|
+
onSubAgentEnd: (context: SubAgentEndContext) => void;
|
|
47
|
+
onSubAgentSettled: (context: SubAgentSettledContext) => Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
export declare function createSessionSubAgentLifecycleCallbacks(deps: SpawnToolDeps, config: CoreSessionConfig, rootSessionId: string): SessionSubAgentLifecycleCallbacks;
|
|
50
|
+
/**
|
|
51
|
+
* Append a note to the agent's answer naming the revisions its changes were
|
|
52
|
+
* handed back as, so the lead adopts them with `restore_file` instead of judging
|
|
53
|
+
* the agent by an on-disk copy the overlay never touched.
|
|
54
|
+
*/
|
|
55
|
+
export declare function appendHandbackNote(context: SubAgentEndContext, agentName: string, handed: readonly HandedRevision[]): void;
|
|
56
|
+
export declare function createSessionSpawnTool(deps: SpawnToolDeps, config: CoreSessionConfig, rootSessionId: string, toolExecutors?: Partial<ToolExecutors>, options?: SpawnToolOptions): AgentTool;
|
|
57
|
+
export declare function createSessionSwarmTool(deps: SpawnToolDeps, config: CoreSessionConfig, rootSessionId: string, toolExecutors?: Partial<ToolExecutors>): AgentTool;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadUserFileContent(path: string): Promise<string>;
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import type * as LlmsProviders from "@cerebriline/llms";
|
|
2
|
+
import { type AgentConfig, type AgentResult, type BasicLogger, type ITelemetryService } from "@cerebriline/shared";
|
|
3
|
+
import { type BackgroundDelegationView } from "../../extensions/tools/team/background-delegations";
|
|
4
|
+
import { type ConfiguredAgentDelegationResult, type ConfiguredAgentSummary } from "../../extensions/tools/team/delegate-to-agent";
|
|
5
|
+
import type { HookEventPayload } from "../../hooks";
|
|
6
|
+
import { ProviderSettingsManager } from "../../services/storage/provider-settings-manager";
|
|
7
|
+
import { type SessionCompactionState } from "../../session/models/session-compaction";
|
|
8
|
+
import type { CoreSessionConfig } from "../../types/config";
|
|
9
|
+
import type { CoreSessionEvent } from "../../types/events";
|
|
10
|
+
import type { SessionRecord } from "../../types/sessions";
|
|
11
|
+
import type { RuntimeCapabilities } from "../capabilities";
|
|
12
|
+
import { RuntimeOAuthTokenManager } from "../orchestration/runtime-oauth-token-manager";
|
|
13
|
+
import type { RuntimeBuilder } from "../orchestration/session-runtime";
|
|
14
|
+
import { SessionRuntime } from "../orchestration/session-runtime-orchestrator";
|
|
15
|
+
import { type SessionBackend } from "./local/session-record";
|
|
16
|
+
import type { PendingPromptsServiceApi, RestoreSessionInput, RestoreSessionResult, RuntimeHost, RuntimeHostSubscribeOptions, SendSessionInput, SessionConnectionUpdate, SessionUsageSummary, StartSessionInput, StartSessionResult } from "./runtime-host";
|
|
17
|
+
export interface LocalRuntimeHostOptions {
|
|
18
|
+
distinctId?: string;
|
|
19
|
+
sessionService: SessionBackend;
|
|
20
|
+
runtimeBuilder?: RuntimeBuilder;
|
|
21
|
+
createAgent?: (config: AgentConfig) => SessionRuntime;
|
|
22
|
+
capabilities?: RuntimeCapabilities;
|
|
23
|
+
toolPolicies?: AgentConfig["toolPolicies"];
|
|
24
|
+
providerSettingsManager?: ProviderSettingsManager;
|
|
25
|
+
oauthTokenManager?: RuntimeOAuthTokenManager;
|
|
26
|
+
telemetry?: ITelemetryService;
|
|
27
|
+
logger?: BasicLogger;
|
|
28
|
+
/**
|
|
29
|
+
* Default custom `fetch` implementation threaded into every
|
|
30
|
+
* `ProviderConfig.fetch` built during local session bootstrap. Used by
|
|
31
|
+
* the AI gateway providers when issuing HTTP requests.
|
|
32
|
+
*/
|
|
33
|
+
fetch?: typeof fetch;
|
|
34
|
+
}
|
|
35
|
+
export declare class LocalRuntimeHost implements RuntimeHost {
|
|
36
|
+
/**
|
|
37
|
+
* Sessions whose change protocol is to stand down at the next safe point.
|
|
38
|
+
*
|
|
39
|
+
* A request, not the act. The act is in `consumePendingUserMessage`, which
|
|
40
|
+
* is the only place in the loop where putting files back cannot race a tool
|
|
41
|
+
* call that is still open.
|
|
42
|
+
*/
|
|
43
|
+
private readonly pendingAtomicDisengage;
|
|
44
|
+
readonly runtimeAddress: undefined;
|
|
45
|
+
readonly pendingPrompts: PendingPromptsServiceApi;
|
|
46
|
+
private readonly sessionService;
|
|
47
|
+
private readonly runtimeBuilder;
|
|
48
|
+
private readonly createAgentInstance;
|
|
49
|
+
private readonly toolExecutors?;
|
|
50
|
+
private readonly defaultCapabilities?;
|
|
51
|
+
private readonly defaultToolPolicies?;
|
|
52
|
+
private readonly providerSettingsManager;
|
|
53
|
+
private readonly oauthTokenManager;
|
|
54
|
+
private readonly defaultTelemetry?;
|
|
55
|
+
private readonly distinctId;
|
|
56
|
+
private readonly defaultLogger?;
|
|
57
|
+
private readonly defaultFetch?;
|
|
58
|
+
private readonly events;
|
|
59
|
+
private readonly sessions;
|
|
60
|
+
private readonly manifestMutationQueues;
|
|
61
|
+
private readonly usageBySession;
|
|
62
|
+
private readonly aggregateUsageBySession;
|
|
63
|
+
private readonly subAgentStarts;
|
|
64
|
+
private readonly pendingPromptsController;
|
|
65
|
+
/**
|
|
66
|
+
* One registry per session, because a background run belongs to the
|
|
67
|
+
* conversation it was started from and its report has nowhere else to go.
|
|
68
|
+
*/
|
|
69
|
+
private readonly backgroundDelegations;
|
|
70
|
+
/**
|
|
71
|
+
* The lead's agent config, kept for the side turn that answers a steer
|
|
72
|
+
* while the lead waits on its agents (`steer-side-turn.ts`), and the
|
|
73
|
+
* chain that runs those turns one at a time per session.
|
|
74
|
+
*/
|
|
75
|
+
private readonly sideTurnConfigs;
|
|
76
|
+
private readonly sideTurns;
|
|
77
|
+
private readonly leadNudgeUnsubscribes;
|
|
78
|
+
/** Each session's subscription to its settled rounds (spec A). */
|
|
79
|
+
private readonly roundUnsubscribes;
|
|
80
|
+
private readonly eventBridge;
|
|
81
|
+
private readonly sessionVersioning;
|
|
82
|
+
private readonly runCommandExecutionController;
|
|
83
|
+
constructor(options: LocalRuntimeHostOptions);
|
|
84
|
+
private applyInitialOAuthCredentials;
|
|
85
|
+
startSession(input: StartSessionInput): Promise<StartSessionResult>;
|
|
86
|
+
private startResolvedSession;
|
|
87
|
+
restoreSession(input: RestoreSessionInput): Promise<RestoreSessionResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Answer a steer with the lead's model while the lead waits on its agents.
|
|
90
|
+
* One at a time per session; the reply goes to the chat as a status notice,
|
|
91
|
+
* and the lead's real turn is told what happened when the round returns.
|
|
92
|
+
*/
|
|
93
|
+
private answerSteerInSideTurn;
|
|
94
|
+
/**
|
|
95
|
+
* The agent system's report of agents stuck for a long time. Answered in
|
|
96
|
+
* a side turn while the lead waits on its round -- where it can stop them
|
|
97
|
+
* -- and queued for its next turn when there is no round to answer from.
|
|
98
|
+
*/
|
|
99
|
+
private nudgeLead;
|
|
100
|
+
runTurn(input: SendSessionInput): Promise<AgentResult | undefined>;
|
|
101
|
+
getAccumulatedUsage(sessionId: string): Promise<SessionUsageSummary | undefined>;
|
|
102
|
+
abort(sessionId: string, reason?: unknown): Promise<void>;
|
|
103
|
+
proceedWhileRunning(sessionId: string, toolCallId?: string): Promise<number>;
|
|
104
|
+
stopSession(sessionId: string): Promise<void>;
|
|
105
|
+
dispose(reason?: string): Promise<void>;
|
|
106
|
+
getSession(sessionId: string): Promise<SessionRecord | undefined>;
|
|
107
|
+
listSessions(limit?: number): Promise<SessionRecord[]>;
|
|
108
|
+
deleteSession(sessionId: string): Promise<boolean>;
|
|
109
|
+
updateSession(sessionId: string, updates: {
|
|
110
|
+
prompt?: string | null;
|
|
111
|
+
metadata?: Record<string, unknown> | null;
|
|
112
|
+
title?: string | null;
|
|
113
|
+
}): Promise<{
|
|
114
|
+
updated: boolean;
|
|
115
|
+
}>;
|
|
116
|
+
updateSessionCompactionState(sessionId: string, state: SessionCompactionState): Promise<{
|
|
117
|
+
updated: boolean;
|
|
118
|
+
}>;
|
|
119
|
+
readSessionCompactionState(sessionId: string): Promise<SessionCompactionState | undefined>;
|
|
120
|
+
private isCompactionStateForSession;
|
|
121
|
+
private canPersistCompactionState;
|
|
122
|
+
private persistActiveSessionCompactionState;
|
|
123
|
+
private enqueueCompactionStateWrite;
|
|
124
|
+
listConfiguredAgents(sessionId: string): Promise<ConfiguredAgentSummary[]>;
|
|
125
|
+
/**
|
|
126
|
+
* Run a configured agent because the user asked for it.
|
|
127
|
+
*
|
|
128
|
+
* Refused while a turn is in flight, for the reason manual compaction is:
|
|
129
|
+
* the report is appended to the conversation, and appending to a transcript
|
|
130
|
+
* the agent loop is currently writing to would race it.
|
|
131
|
+
*/
|
|
132
|
+
delegateToConfiguredAgent(input: {
|
|
133
|
+
sessionId: string;
|
|
134
|
+
agentName: string;
|
|
135
|
+
prompt: string;
|
|
136
|
+
signal?: AbortSignal;
|
|
137
|
+
}): Promise<ConfiguredAgentDelegationResult>;
|
|
138
|
+
/**
|
|
139
|
+
* Start a configured agent beside the turn instead of in place of it.
|
|
140
|
+
*
|
|
141
|
+
* No `canStartRun()` check, unlike the foreground call: running while the
|
|
142
|
+
* lead is working is the reason this exists. What that costs is a report
|
|
143
|
+
* that can arrive mid-turn, which {@link deliverBackgroundDelegation}
|
|
144
|
+
* answers.
|
|
145
|
+
*/
|
|
146
|
+
startBackgroundDelegation(input: {
|
|
147
|
+
sessionId: string;
|
|
148
|
+
agentName: string;
|
|
149
|
+
prompt: string;
|
|
150
|
+
}): Promise<BackgroundDelegationView>;
|
|
151
|
+
listBackgroundDelegations(sessionId: string): Promise<BackgroundDelegationView[]>;
|
|
152
|
+
controlBackgroundDelegation(input: {
|
|
153
|
+
sessionId: string;
|
|
154
|
+
id: string;
|
|
155
|
+
action: "pause" | "resume" | "stop";
|
|
156
|
+
}): Promise<boolean>;
|
|
157
|
+
private backgroundDelegationsFor;
|
|
158
|
+
/**
|
|
159
|
+
* Put a finished background run into the conversation it was started from.
|
|
160
|
+
*
|
|
161
|
+
* Two ways in, because a background run finishes whenever it finishes. With
|
|
162
|
+
* the session idle it is appended directly, exactly as the foreground call
|
|
163
|
+
* does. With a turn in flight, appending would race the agent loop over the
|
|
164
|
+
* message list, so it is queued as a steer and the runtime picks it up at
|
|
165
|
+
* the top of its next iteration.
|
|
166
|
+
*
|
|
167
|
+
* A failure is reported too. A delegation the user asked for and that did
|
|
168
|
+
* not work is something both they and the lead need to know; only a run the
|
|
169
|
+
* user stopped says nothing, and that one never reaches here.
|
|
170
|
+
*/
|
|
171
|
+
/**
|
|
172
|
+
* The user turned the change protocol off.
|
|
173
|
+
*
|
|
174
|
+
* Two ways in, for the same reason `deliverBackgroundDelegation` has two:
|
|
175
|
+
* with the session idle the notice is appended to the transcript directly,
|
|
176
|
+
* and with a turn in flight nothing is touched now -- the request is parked
|
|
177
|
+
* and the standing down happens at the top of the next iteration, where no
|
|
178
|
+
* tool call is open. A rollback is a write to the user's files, and the one
|
|
179
|
+
* thing it must never do is land while the model is mid-edit.
|
|
180
|
+
*
|
|
181
|
+
* Returns whether there was a protocol to stand down at all.
|
|
182
|
+
*/
|
|
183
|
+
disengageAtomicProtocol(sessionId: string): Promise<boolean>;
|
|
184
|
+
/**
|
|
185
|
+
* A settled round the lead was not waiting for, delivered the way a
|
|
186
|
+
* background delegation's report is: appended with the session idle,
|
|
187
|
+
* queued as a steer for the next boundary with a turn in flight.
|
|
188
|
+
*/
|
|
189
|
+
private deliverRound;
|
|
190
|
+
private deliverBackgroundDelegation;
|
|
191
|
+
readLiveSessionMessages(sessionId: string): Promise<LlmsProviders.MessageWithMetadata[]>;
|
|
192
|
+
readSessionMessages(sessionId: string): Promise<LlmsProviders.MessageWithMetadata[]>;
|
|
193
|
+
dispatchHookEvent(payload: HookEventPayload): Promise<void>;
|
|
194
|
+
subscribe(listener: (event: CoreSessionEvent) => void, options?: RuntimeHostSubscribeOptions): () => void;
|
|
195
|
+
updateSessionModel(sessionId: string, modelId: string): Promise<void>;
|
|
196
|
+
updateSessionConnection(sessionId: string, rawUpdates: SessionConnectionUpdate): Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* Serialized read-modify-write for a live session's manifest. Every
|
|
199
|
+
* manifest write for an active session MUST go through this helper: it
|
|
200
|
+
* re-reads the disk manifest first so disk-only writers (compaction-path
|
|
201
|
+
* updates, title/metadata renames) are never reverted by a stale in-memory
|
|
202
|
+
* copy, applies the field-level mutation, syncs the in-memory copy, and
|
|
203
|
+
* persists — one mutation at a time per session.
|
|
204
|
+
*/
|
|
205
|
+
private mutateSessionManifest;
|
|
206
|
+
handlePluginEvent(rootSessionId: string, event: {
|
|
207
|
+
name: string;
|
|
208
|
+
payload?: unknown;
|
|
209
|
+
}, fallbackAutomation?: NonNullable<CoreSessionConfig["extensionContext"]>["automation"]): Promise<void>;
|
|
210
|
+
private executeTurn;
|
|
211
|
+
private completeInteractiveTurn;
|
|
212
|
+
private resolveInteractiveStopStatus;
|
|
213
|
+
private resolveInteractiveStopExitCode;
|
|
214
|
+
private completeAbortedInteractiveTurn;
|
|
215
|
+
private executeAgentTurn;
|
|
216
|
+
/**
|
|
217
|
+
* Anchor `task.completed` telemetry to the assistant's explicit
|
|
218
|
+
* completion declaration. We emit at most once per session, the moment
|
|
219
|
+
* a successful `submit_and_exit` tool call is observed in the run
|
|
220
|
+
* result. This is the SDK analog of original Cline's
|
|
221
|
+
* `attempt_completion`-driven emission and works for both interactive
|
|
222
|
+
* and non-interactive sessions.
|
|
223
|
+
*
|
|
224
|
+
* `emitTaskCompletedOnTeardown(...)` retains a fallback emission for
|
|
225
|
+
* completed sessions that finish without an explicit completion-tool
|
|
226
|
+
* observation (e.g., non-interactive runs not using the yolo preset,
|
|
227
|
+
* or hosts that disable `submit_and_exit` entirely). This helper sets
|
|
228
|
+
* `taskCompletedEmitted` so the teardown fallback can suppress a
|
|
229
|
+
* duplicate emission for the same logical completion.
|
|
230
|
+
*/
|
|
231
|
+
private observeTaskCompletionTool;
|
|
232
|
+
/**
|
|
233
|
+
* Single choke point for the fallback `task.completed` emission on
|
|
234
|
+
* session teardown. Every path a session can end through funnels into
|
|
235
|
+
* `shutdownSession(...)` or `releaseSessionRuntime(...)`, and BOTH must
|
|
236
|
+
* call this helper — the emission must never depend on which teardown
|
|
237
|
+
* branch a stop happens to route through. (The 4.1.11 regression:
|
|
238
|
+
* truthful session-status reporting re-routed many interactive stops
|
|
239
|
+
* onto the release branch, and the fallback that lived only inside
|
|
240
|
+
* `shutdownSession` silently stopped firing for them.)
|
|
241
|
+
*
|
|
242
|
+
* Emits at most once per session (`taskCompletedEmitted`), and never
|
|
243
|
+
* after the `submit_and_exit` observer already reported the completion.
|
|
244
|
+
* The completion criterion deliberately does not read `session.status`
|
|
245
|
+
* (whose lifecycle is what changed in 4.1.11):
|
|
246
|
+
*
|
|
247
|
+
* - Interactive sessions use the recorded final-turn outcome,
|
|
248
|
+
* `lastInteractiveTurnFinishReason === "completed"`. The extra guards
|
|
249
|
+
* suppress emission when teardown arrives mid-run (the in-flight turn
|
|
250
|
+
* being aborted is the real final turn, and it did not complete).
|
|
251
|
+
* - Non-interactive sessions use the terminal status their run result
|
|
252
|
+
* resolved to (`finalStatus`, from `finalizeSingleRun`), preserving
|
|
253
|
+
* the pre-existing `input.status === "completed"` semantics.
|
|
254
|
+
*
|
|
255
|
+
* Sessions whose final turn errored or aborted emit nothing.
|
|
256
|
+
*/
|
|
257
|
+
private emitTaskCompletedOnTeardown;
|
|
258
|
+
private prepareTurnInput;
|
|
259
|
+
/**
|
|
260
|
+
* Say whether the change protocol engaged, once, on the session's stream.
|
|
261
|
+
*
|
|
262
|
+
* Deferred from `startSession` deliberately: see `pendingAtomicStatus`. By
|
|
263
|
+
* here the session is persisted and every host has it on record, so the
|
|
264
|
+
* notice lands in the same channel as the verdicts rather than being
|
|
265
|
+
* dropped as an event for a session nobody has heard of.
|
|
266
|
+
*/
|
|
267
|
+
private emitPendingAtomicStatus;
|
|
268
|
+
private ensureSessionPersisted;
|
|
269
|
+
private markTurnRunning;
|
|
270
|
+
/** Whether the session record already names this process as its owner. */
|
|
271
|
+
private ownsSessionRecord;
|
|
272
|
+
private refreshActiveSessionGitMetadata;
|
|
273
|
+
private markTurnPending;
|
|
274
|
+
private markTurnIdle;
|
|
275
|
+
private persistSessionMetadata;
|
|
276
|
+
private finalizeSingleRun;
|
|
277
|
+
private failSession;
|
|
278
|
+
private shutdownSession;
|
|
279
|
+
private releaseSessionRuntime;
|
|
280
|
+
private updateStatus;
|
|
281
|
+
private runWithAuthRetry;
|
|
282
|
+
private syncOAuthCredentials;
|
|
283
|
+
private getSessionOrThrow;
|
|
284
|
+
private resolveAbsoluteFilePaths;
|
|
285
|
+
private getSessionAgentTelemetryIdentity;
|
|
286
|
+
private seedAggregateUsageFromArtifacts;
|
|
287
|
+
private summarizePersistedTeammateUsage;
|
|
288
|
+
private withPersistedAggregateUsageFloor;
|
|
289
|
+
private emitStatus;
|
|
290
|
+
private emitSessionSnapshot;
|
|
291
|
+
private emit;
|
|
292
|
+
private listRows;
|
|
293
|
+
private getRow;
|
|
294
|
+
private readManifest;
|
|
295
|
+
private invoke;
|
|
296
|
+
private invokeOptional;
|
|
297
|
+
private invokeOptionalValue;
|
|
298
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type * as LlmsProviders from "@cerebriline/llms";
|
|
2
|
+
import type { HookEventPayload } from "../../hooks";
|
|
3
|
+
import type { CoreSessionEvent } from "../../types/events";
|
|
4
|
+
import type { RuntimeHostSubscribeOptions, SessionAccumulatedUsage } from "./runtime-host";
|
|
5
|
+
export declare class RuntimeHostEventBus {
|
|
6
|
+
private readonly listeners;
|
|
7
|
+
subscribe(listener: (event: CoreSessionEvent) => void, options?: RuntimeHostSubscribeOptions): () => void;
|
|
8
|
+
emit(event: CoreSessionEvent): void;
|
|
9
|
+
get size(): number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Where a session's messages really are, when the recorded path has moved.
|
|
13
|
+
*
|
|
14
|
+
* A session row stores the ABSOLUTE path of its own messages file. That is a
|
|
15
|
+
* cache -- the location is always derivable from the session id and the current
|
|
16
|
+
* sessions directory -- and it goes stale the moment the data directory moves.
|
|
17
|
+
* The Cerebriline migration moves it (`~/.cline` to `~/.cerebriline`), and the
|
|
18
|
+
* result was the worst shape of failure: the history list is built from the
|
|
19
|
+
* rows, so every session still LISTED, and every one of them opened EMPTY,
|
|
20
|
+
* because `readPersistedMessagesFile` answers `[]` for a file that is not there
|
|
21
|
+
* and says nothing about why.
|
|
22
|
+
*
|
|
23
|
+
* The stored path still wins when it resolves, so a session whose artifacts
|
|
24
|
+
* genuinely live somewhere else is untouched. And when neither location has the
|
|
25
|
+
* file, the stored path is returned unchanged rather than the derived one:
|
|
26
|
+
* a session whose messages are actually gone must keep reporting the path it
|
|
27
|
+
* expected, or real data loss is silently redressed as an empty conversation.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveMessagesPath(storedPath: string | undefined | null, sessionId: string, sessionsDir: string | undefined | null): string | undefined;
|
|
30
|
+
export declare function readPersistedMessagesFile(messagesPath?: string | null): Promise<LlmsProviders.MessageWithMetadata[]>;
|
|
31
|
+
export declare function cloneAccumulatedUsage(usage: SessionAccumulatedUsage | undefined): SessionAccumulatedUsage | undefined;
|
|
32
|
+
type HookAuditBackend = {
|
|
33
|
+
queueSpawnRequest(payload: HookEventPayload): Promise<void>;
|
|
34
|
+
upsertSubagentSessionFromHook(payload: HookEventPayload): Promise<string | undefined>;
|
|
35
|
+
appendSubagentHookAudit(sessionId: string, payload: HookEventPayload): Promise<void>;
|
|
36
|
+
applySubagentStatus(sessionId: string, payload: HookEventPayload): Promise<void>;
|
|
37
|
+
};
|
|
38
|
+
export declare function replaySubagentHookEvent(payload: HookEventPayload, backend: HookAuditBackend): Promise<void>;
|
|
39
|
+
export {};
|