@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,161 @@
|
|
|
1
|
+
import { type PrepareTurnUsage } from "@cerebriline/shared";
|
|
2
|
+
import { type SessionCompactionState } from "../../session/models/session-compaction";
|
|
3
|
+
import type { CoreCompactionContext, CoreCompactionMode, CoreSessionConfig } from "../../types/config";
|
|
4
|
+
import { type CompactionJournal } from "./compaction-journal";
|
|
5
|
+
export interface ContextPipelinePrepareTurnInput {
|
|
6
|
+
agentId: string;
|
|
7
|
+
conversationId: string;
|
|
8
|
+
parentAgentId: string | null;
|
|
9
|
+
iteration: number;
|
|
10
|
+
messages: CoreCompactionContext["messages"];
|
|
11
|
+
apiMessages: CoreCompactionContext["messages"];
|
|
12
|
+
/**
|
|
13
|
+
* Turns the wire request opens with that compaction must not see: a
|
|
14
|
+
* pooled sub-agent's shared head (`pinConversationHead`). Taken off
|
|
15
|
+
* `messages` and `apiMessages` so nothing folds or rewrites them, and put
|
|
16
|
+
* back in front wherever the request itself is rebuilt or measured -- the
|
|
17
|
+
* continuation writer continues the conversation the slot holds, head
|
|
18
|
+
* included.
|
|
19
|
+
*/
|
|
20
|
+
pinnedHead?: CoreCompactionContext["messages"];
|
|
21
|
+
abortSignal: AbortSignal;
|
|
22
|
+
systemPrompt: string;
|
|
23
|
+
tools: unknown[];
|
|
24
|
+
model: CoreCompactionContext["model"];
|
|
25
|
+
/**
|
|
26
|
+
* Set by the runtime when the provider rejected the previous request as
|
|
27
|
+
* exceeding the model's context window. Forces a compaction regardless of
|
|
28
|
+
* the token-estimate trigger (the estimate just proved wrong) and uses the
|
|
29
|
+
* deterministic basic strategy — recovery must not depend on another
|
|
30
|
+
* successful LLM request.
|
|
31
|
+
*/
|
|
32
|
+
overflowRecovery?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Someone asked for this compaction -- the lead, for a delegated agent
|
|
35
|
+
* (`compact_agents`). Runs as a manual compaction on this turn.
|
|
36
|
+
*/
|
|
37
|
+
compactionRequested?: boolean;
|
|
38
|
+
emitStatusNotice?: (message: string, metadata?: Record<string, unknown>) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Count what this preparation spent on the model. Every call of a
|
|
41
|
+
* compaction goes here, whether or not it produced a transcript: the
|
|
42
|
+
* agent's row read 4,055 tokens out after 28 compactions whose summaries
|
|
43
|
+
* and critics it never counted (swarm czbnh, 2026-09-29).
|
|
44
|
+
*/
|
|
45
|
+
reportUsage?: (usage: PrepareTurnUsage) => void;
|
|
46
|
+
}
|
|
47
|
+
export interface ContextPipelinePrepareTurnResult {
|
|
48
|
+
messages: CoreCompactionContext["messages"];
|
|
49
|
+
systemPrompt?: string;
|
|
50
|
+
}
|
|
51
|
+
export type ContextPipelinePrepareTurn = (context: ContextPipelinePrepareTurnInput) => Promise<ContextPipelinePrepareTurnResult | undefined>;
|
|
52
|
+
export interface ContextCompactionPrepareTurnOptions {
|
|
53
|
+
mode?: CoreCompactionMode;
|
|
54
|
+
manualTargetRatio?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Where the pre-compaction transcript is kept, so a compaction can be undone.
|
|
57
|
+
*
|
|
58
|
+
* Supplied by a caller that wants to reach it — a host offering an "undo
|
|
59
|
+
* compaction" action, or a test. Omitted, one is created internally and the
|
|
60
|
+
* transcript is still kept; the journal is never optional, only its
|
|
61
|
+
* visibility is. See {@link createCompactionJournal}.
|
|
62
|
+
*/
|
|
63
|
+
journal?: CompactionJournal;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The share of the *content* a compaction aims to leave behind.
|
|
67
|
+
*
|
|
68
|
+
* Of the content, not of the window. The system prompt, the tool schemas and
|
|
69
|
+
* any MCP tools are paid before a single message exists, and compaction cannot
|
|
70
|
+
* touch one token of them -- measured on pandorum 2026-09-19, 21,000-24,000
|
|
71
|
+
* tokens of a 65,536-token window, about a third of it gone before the
|
|
72
|
+
* conversation starts. (The system prompt is 1,607 of that; the rest is
|
|
73
|
+
* schemas.)
|
|
74
|
+
*
|
|
75
|
+
* Taking the share from the window made the target incoherent once the fixed
|
|
76
|
+
* price grew: a quarter of 65,536 is 16,384, below the price itself, so the
|
|
77
|
+
* transcript budget floored at nothing and every compaction became a full one
|
|
78
|
+
* whatever the tail setting said. Taking it from what is left asks the
|
|
79
|
+
* question that was always meant -- how much conversation may survive -- and
|
|
80
|
+
* has an answer for any window.
|
|
81
|
+
*/
|
|
82
|
+
export declare const COMPACTION_TARGET_CONTENT_SHARE = 0.25;
|
|
83
|
+
/**
|
|
84
|
+
* How many tokens of transcript a compaction should leave.
|
|
85
|
+
*
|
|
86
|
+
* `maxInputTokens` is the whole window and `requestOverheadTokens` is what is
|
|
87
|
+
* spent before any message; the difference is the only part a compaction can
|
|
88
|
+
* spend, and the share is taken from that.
|
|
89
|
+
*/
|
|
90
|
+
export declare function resolveMessageTargetTokens(input: {
|
|
91
|
+
maxInputTokens: number;
|
|
92
|
+
requestOverheadTokens: number;
|
|
93
|
+
share?: number;
|
|
94
|
+
}): number;
|
|
95
|
+
/**
|
|
96
|
+
* Put an estimate on the same scale as the provider's own count.
|
|
97
|
+
*
|
|
98
|
+
* `estimate` and `estimateOfObserved` measure the same transcript the same way;
|
|
99
|
+
* `observed` is what the provider charged for it. The ratio between the last
|
|
100
|
+
* two is this session's standing estimator error, and applying it to the first
|
|
101
|
+
* is what makes a "before" and an "after" comparable. Falls back to the raw
|
|
102
|
+
* estimate when there is nothing to calibrate against -- the first request of a
|
|
103
|
+
* session, before any response has been counted.
|
|
104
|
+
*/
|
|
105
|
+
/**
|
|
106
|
+
* The transcript budget, expressed in the units the planner measures in.
|
|
107
|
+
*
|
|
108
|
+
* Two scales meet here and used not to. `shouldCompact` compares
|
|
109
|
+
* `triggerInputTokens` -- the provider's own count of the last request, when
|
|
110
|
+
* there is one -- against the threshold. Everything after it is an estimate:
|
|
111
|
+
* `requestOverheadTokens` and the `estimateMessageTokens` sum the cut is
|
|
112
|
+
* planned with. Subtracting an estimated overhead from a target derived from
|
|
113
|
+
* the real window mixes the two, and the error goes entirely one way when the
|
|
114
|
+
* estimator under-reads.
|
|
115
|
+
*
|
|
116
|
+
* Measured on pandorum 2026-09-19, iteration 10: ollama counted the request at
|
|
117
|
+
* 58,328 and the estimator read it as 36,826. The trigger fired correctly on
|
|
118
|
+
* 58,328 against 57,536. The target was then 57,536 x 0.7 = 40,275, less an
|
|
119
|
+
* estimated overhead of 23,796, giving 16,479 -- against a transcript the
|
|
120
|
+
* planner measured at 13,045. The compaction was asked to shrink something to
|
|
121
|
+
* a size it was already 3,434 tokens under, cut two messages, and the next
|
|
122
|
+
* turn overflowed and forced a real one. Two compactions, one file read
|
|
123
|
+
* between them.
|
|
124
|
+
*
|
|
125
|
+
* Scaling the request target by `estimate / observed` before the subtraction
|
|
126
|
+
* is what makes the two halves comparable. It is a no-op when the estimator
|
|
127
|
+
* agrees with the provider, and a no-op when there is no observation to
|
|
128
|
+
* calibrate against.
|
|
129
|
+
*
|
|
130
|
+
* **One-directional: it may tighten the target and never loosen it.** The
|
|
131
|
+
* correction exists because an under-reading estimator leaves a target the
|
|
132
|
+
* transcript is already past. An over-reading one is the opposite case, and
|
|
133
|
+
* there the plain subtraction is already tight -- inflating it would hand back
|
|
134
|
+
* a budget bigger than the trigger that just fired was asking for, and the
|
|
135
|
+
* compaction would find nothing to do. That is not hypothetical: it is the
|
|
136
|
+
* starved-output-cap path, where a thin cap forces a compaction on a
|
|
137
|
+
* transcript the estimator reads at 2.7x the provider's count, and a
|
|
138
|
+
* two-directional scale suppresses it entirely.
|
|
139
|
+
*/
|
|
140
|
+
export declare function resolveMessageTargetOnTriggerScale(input: {
|
|
141
|
+
requestTargetTokens: number;
|
|
142
|
+
requestOverheadTokens: number;
|
|
143
|
+
requestInputTokens: number;
|
|
144
|
+
triggerInputTokens: number | undefined;
|
|
145
|
+
}): number;
|
|
146
|
+
export declare function scaleEstimateToObserved(estimate: number, estimateOfObserved: number, observed: number | undefined): number;
|
|
147
|
+
/** Test seam: the latch is process-wide, so a suite has to be able to clear it. */
|
|
148
|
+
export declare function resetStarvedOutputCapLatch(): void;
|
|
149
|
+
export declare function createContextCompactionPrepareTurn(config: Pick<CoreSessionConfig, "providerConfig" | "providerId" | "modelId" | "compaction" | "logger" | "telemetry" | "sessionId"> & Partial<Pick<CoreSessionConfig, "thinking" | "reasoningEffort" | "thinkingBudgetTokens" | "temperature">>, options?: ContextCompactionPrepareTurnOptions): ((context: ContextPipelinePrepareTurnInput) => Promise<ContextPipelinePrepareTurnResult | undefined>) | undefined;
|
|
150
|
+
export declare function createCompactionStateAwarePrepareTurn(input: {
|
|
151
|
+
compact?: ContextPipelinePrepareTurn;
|
|
152
|
+
getState?: () => SessionCompactionState | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Persist a freshly-computed compaction state. `sourceMessages` are the
|
|
155
|
+
* exact canonical messages the state's source-prefix hash was computed
|
|
156
|
+
* over; hosts must validate projection against these rather than a
|
|
157
|
+
* separately derived transcript, which can legally differ mid-turn and
|
|
158
|
+
* spuriously reject the write.
|
|
159
|
+
*/
|
|
160
|
+
saveState?: (state: SessionCompactionState, sourceMessages: CoreCompactionContext["messages"]) => void | Promise<void>;
|
|
161
|
+
}): ContextPipelinePrepareTurn;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Say so, once, when a session's window cannot hold one turn.
|
|
3
|
+
*
|
|
4
|
+
* The settings panel warns where a window is typed; a CLI user has no panel,
|
|
5
|
+
* and a window set by flag or `providers.json` below the fixed price plus the
|
|
6
|
+
* output cap reaches the first request unannounced -- to be cut short or
|
|
7
|
+
* refused there. This is the same arithmetic (`@cerebriline/shared`'s
|
|
8
|
+
* `resolveContextMinimumForWindow`), fed by what the compaction pipeline has
|
|
9
|
+
* just measured, logged at the session's first turn.
|
|
10
|
+
*/
|
|
11
|
+
/** Test seam: the once-per-session memory outlives any one test. */
|
|
12
|
+
export declare function resetContextMinimumWarnings(): void;
|
|
13
|
+
export declare function warnIfWindowBelowMinimum(input: {
|
|
14
|
+
sessionId: string | undefined;
|
|
15
|
+
logger: {
|
|
16
|
+
log?: (message: string, meta?: {
|
|
17
|
+
severity?: "warn";
|
|
18
|
+
}) => void;
|
|
19
|
+
} | undefined;
|
|
20
|
+
contextWindow: number | undefined;
|
|
21
|
+
systemPromptTokens?: number;
|
|
22
|
+
toolSchemaTokens?: number;
|
|
23
|
+
mcpToolSchemaTokens?: number;
|
|
24
|
+
/** The cap the session sends; resolved from the budget when absent. */
|
|
25
|
+
outputCapTokens?: number;
|
|
26
|
+
modelMaxOutputTokens?: number;
|
|
27
|
+
}): void;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compaction as a continuation of the session.
|
|
3
|
+
*
|
|
4
|
+
* The summarizer used to be a stranger to the conversation it summarised: its
|
|
5
|
+
* own system prompt, no tools, and the transcript pasted in as text. Every
|
|
6
|
+
* compaction call therefore prefilled the whole transcript again -- the writer,
|
|
7
|
+
* each critic, the synthesizer -- on the server whose cells had just run out.
|
|
8
|
+
* On opencoti each of those calls also booked a window of its own.
|
|
9
|
+
*
|
|
10
|
+
* Here the writer is the conversation's next turn: the agent's own system
|
|
11
|
+
* prompt, tools and messages, and one more user message asking for the
|
|
12
|
+
* replay. A server with a prompt cache prefills that message and nothing
|
|
13
|
+
* else. On opencoti with pools the rest of the user's design follows
|
|
14
|
+
* (mail #320):
|
|
15
|
+
*
|
|
16
|
+
* 1. **Freeze** the session's resident stream as pool P (`from_session`,
|
|
17
|
+
* pinned).
|
|
18
|
+
* 2. The **writer** continues the session in its own slot.
|
|
19
|
+
* 3. **P'** = P + the writer's instruction and summary (`fork from_session`).
|
|
20
|
+
* 4. The **critics** attach P' concurrently, each paying for its instruction
|
|
21
|
+
* and its answer only.
|
|
22
|
+
* 5. **Release**, leaves first: the critics' sessions, P', P, then the
|
|
23
|
+
* session's own cells.
|
|
24
|
+
* 6. The **synthesizer** joins the halves on an exact-size booking of its own,
|
|
25
|
+
* which is closed as soon as it answers.
|
|
26
|
+
*
|
|
27
|
+
* The session then continues as P0 (the shared system+tools prefix it was
|
|
28
|
+
* already attached to) plus the replay: nothing is re-rooted, because the
|
|
29
|
+
* prefix pools never held the transcript.
|
|
30
|
+
*
|
|
31
|
+
* Without pools -- Ollama, llama.cpp, an opencoti that does not advertise
|
|
32
|
+
* them, or one that is refusing bookings right now -- steps 2 and 4 still run
|
|
33
|
+
* as plain continuations in the session's own slot, one critic after the
|
|
34
|
+
* other so the second finds the first's prefix still resident.
|
|
35
|
+
*
|
|
36
|
+
* Two rules hold throughout. **Nothing books more than it needs**: a critic on
|
|
37
|
+
* an owned pool is a worker charged its instruction and answer, a critic on an
|
|
38
|
+
* unowned pool and the synthesizer book exactly their request and output, and
|
|
39
|
+
* a session with no booking of its own gives its writer an exact one. **Every
|
|
40
|
+
* failure releases what was created** ({@link CompactionContinuation.dispose}),
|
|
41
|
+
* and a continuation that cannot write a summary hands the compaction back to
|
|
42
|
+
* the transcript-as-text path it replaced.
|
|
43
|
+
*/
|
|
44
|
+
import { type BasicLogger, type MessageWithMetadata, type ProviderErrorClass, type RequestTimings } from "@cerebriline/shared";
|
|
45
|
+
import type { ProviderConfig } from "../../types/provider-settings";
|
|
46
|
+
/** Which of the two shapes a compaction ran as. */
|
|
47
|
+
export type ContinuationPath = "pooled" | "continuation";
|
|
48
|
+
/** An exact booking for a request of `chars` characters and `output` tokens. */
|
|
49
|
+
export declare function exactBooking(chars: number, output: number): number;
|
|
50
|
+
/** One model call, as a continuation or as a request of its own. */
|
|
51
|
+
export interface ContinuationCall {
|
|
52
|
+
purpose: "writer" | "critic" | "retrospective" | "synthesizer";
|
|
53
|
+
providerConfig: ProviderConfig;
|
|
54
|
+
/** The host session id the model is built for (telemetry, affinity). */
|
|
55
|
+
sessionId?: string;
|
|
56
|
+
systemPrompt: string;
|
|
57
|
+
messages: readonly MessageWithMetadata[];
|
|
58
|
+
tools: readonly unknown[];
|
|
59
|
+
maxTokens: number;
|
|
60
|
+
/** `none` keeps the tools in the prompt and asks for prose. */
|
|
61
|
+
toolChoice?: "none";
|
|
62
|
+
reasoning?: ContinuationReasoning;
|
|
63
|
+
abortSignal?: AbortSignal;
|
|
64
|
+
}
|
|
65
|
+
export interface ContinuationReasoning {
|
|
66
|
+
thinking?: boolean;
|
|
67
|
+
reasoningEffort?: string;
|
|
68
|
+
thinkingBudgetTokens?: number;
|
|
69
|
+
temperature?: number;
|
|
70
|
+
}
|
|
71
|
+
export interface ContinuationCallResult {
|
|
72
|
+
text: string;
|
|
73
|
+
reasoningChars: number;
|
|
74
|
+
incompleteReason?: string;
|
|
75
|
+
timings?: RequestTimings;
|
|
76
|
+
/** What the call spent, as the provider reported it. */
|
|
77
|
+
usage?: CompactionCallUsage;
|
|
78
|
+
}
|
|
79
|
+
/** One call's tokens, as a provider reports them for billing. */
|
|
80
|
+
export interface CompactionCallUsage {
|
|
81
|
+
inputTokens?: number;
|
|
82
|
+
outputTokens?: number;
|
|
83
|
+
cacheReadTokens?: number;
|
|
84
|
+
cacheWriteTokens?: number;
|
|
85
|
+
totalCost?: number;
|
|
86
|
+
}
|
|
87
|
+
/** The one seam every call goes through; tests replace it. */
|
|
88
|
+
export type ContinuationModel = (call: ContinuationCall, logger?: BasicLogger) => Promise<ContinuationCallResult>;
|
|
89
|
+
/** A turn that failed at the model, with what the provider said about it. */
|
|
90
|
+
export declare class ContinuationCallError extends Error {
|
|
91
|
+
readonly errorClass?: ProviderErrorClass | undefined;
|
|
92
|
+
constructor(message: string, errorClass?: ProviderErrorClass | undefined);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The call, through the same model path the agent's own turns take.
|
|
96
|
+
*
|
|
97
|
+
* `createAgentModelFromConfig` and `messagesToAgentMessages` are what the
|
|
98
|
+
* session runtime uses for the conversation, so the request this builds is
|
|
99
|
+
* rendered by the same conversion, the same environment hoisting and the same
|
|
100
|
+
* vendor fetch as the turn before it. The handler path the summarizer used
|
|
101
|
+
* converts messages with a different function, and a prefix is only shared if
|
|
102
|
+
* the two renderings agree byte for byte.
|
|
103
|
+
*/
|
|
104
|
+
export declare const defaultContinuationModel: ContinuationModel;
|
|
105
|
+
/** Two reports of usage as one. A provider may report a call in parts. */
|
|
106
|
+
export declare function addCallUsage(into: CompactionCallUsage | undefined, next: CompactionCallUsage | undefined): CompactionCallUsage | undefined;
|
|
107
|
+
/** Prompt tokens the engine actually evaluated for one call. */
|
|
108
|
+
export declare function evaluatedPromptTokens(timings: RequestTimings | undefined): number | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* What one compaction cost, for the line it logs and the numbers a gate
|
|
111
|
+
* compares. Filled by both paths: the continuation from the engine's own
|
|
112
|
+
* timings, the transcript-as-text path from the usage it reports.
|
|
113
|
+
*/
|
|
114
|
+
export interface CompactionMeter {
|
|
115
|
+
/** Prompt tokens evaluated across every call of the compaction. */
|
|
116
|
+
prefillTokens: number;
|
|
117
|
+
/**
|
|
118
|
+
* What every call of the compaction spent, as the providers reported it:
|
|
119
|
+
* the prompt sent (cached or not) and what was written. Not the prefill
|
|
120
|
+
* above -- that is what the engine had to evaluate -- but what a per-token
|
|
121
|
+
* price is charged on, and what the agent's own totals count.
|
|
122
|
+
*/
|
|
123
|
+
usage?: CompactionCallUsage;
|
|
124
|
+
/**
|
|
125
|
+
* Told each call's usage as the call finishes, so the agent it ran for
|
|
126
|
+
* counts it -- live, and whether or not the compaction then succeeds.
|
|
127
|
+
*/
|
|
128
|
+
onUsage?: (usage: CompactionCallUsage) => void;
|
|
129
|
+
/** Calls that reported nothing to count. */
|
|
130
|
+
unmeasuredCalls: number;
|
|
131
|
+
calls: number;
|
|
132
|
+
/** Extra cells booked at the compaction's peak, beyond the session's own. */
|
|
133
|
+
peakBookedCells: number;
|
|
134
|
+
/** The writer's `cache_n`, and what it was expected to reach. */
|
|
135
|
+
writerCacheN?: number;
|
|
136
|
+
writerExpectedCacheN?: number;
|
|
137
|
+
/** Each critic's `cache_n`, and what P' made possible. */
|
|
138
|
+
criticCacheN: number[];
|
|
139
|
+
criticExpectedCacheN?: number;
|
|
140
|
+
/** `cache_n` of the retrospective and synthesizer when they continued P'. */
|
|
141
|
+
siblingCacheN: number[];
|
|
142
|
+
/** Engine objects released, and those a release failed for. */
|
|
143
|
+
released: string[];
|
|
144
|
+
leaked: string[];
|
|
145
|
+
/** Decisions taken on the way, for the log line. */
|
|
146
|
+
notes: string[];
|
|
147
|
+
}
|
|
148
|
+
export declare function createCompactionMeter(onUsage?: (usage: CompactionCallUsage) => void): CompactionMeter;
|
|
149
|
+
export declare function meterCall(meter: CompactionMeter | undefined, timings: RequestTimings | undefined, fallbackPromptTokens?: number, usage?: CompactionCallUsage): void;
|
|
150
|
+
/** The half-plan for the council, decided once the writer's summary exists. */
|
|
151
|
+
export interface CriticPlan {
|
|
152
|
+
critics: "concurrent" | "serial" | "skip";
|
|
153
|
+
reason: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* One compaction's continuation: the session it continues, the pools it
|
|
157
|
+
* made, and every session it opened -- so all of it can be released on any
|
|
158
|
+
* path out.
|
|
159
|
+
*/
|
|
160
|
+
export interface CompactionContinuation {
|
|
161
|
+
readonly path: ContinuationPath;
|
|
162
|
+
readonly reason: string;
|
|
163
|
+
readonly meter: CompactionMeter;
|
|
164
|
+
/**
|
|
165
|
+
* The writer: the session's next turn, with `instruction` as the user
|
|
166
|
+
* message. Called again for a retry; the last call is the one the critics
|
|
167
|
+
* continue from.
|
|
168
|
+
*/
|
|
169
|
+
write(instruction: string, maxTokens: number): Promise<ContinuationCallResult>;
|
|
170
|
+
/** Freeze P' after the last writer attempt, and plan the critics. */
|
|
171
|
+
afterWriter(summaryChars: number, criticMaxTokens: number): Promise<CriticPlan>;
|
|
172
|
+
/** One critic, as a continuation of P' (or of the session, unpooled). */
|
|
173
|
+
critic(half: "first" | "second", systemPrompt: string, request: string, maxTokens: number): Promise<string>;
|
|
174
|
+
/**
|
|
175
|
+
* Room on P' for the retrospective or the synthesizer, reserved now; or
|
|
176
|
+
* `undefined` when the call does not fit there, and must wait for the
|
|
177
|
+
* release and run on a booking of its own. Only on an engine that
|
|
178
|
+
* continues a pool token-exact (`pool_continue_v1`): anywhere else the
|
|
179
|
+
* call's own reasoning fields would render the prefix differently and it
|
|
180
|
+
* would share nothing.
|
|
181
|
+
*/
|
|
182
|
+
reservePPrime(purpose: "retrospective" | "synthesizer", chars: number, maxTokens: number): PPrimeReservation | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* The retrospective or the synthesizer: as a continuation of P' with a
|
|
185
|
+
* reservation that still holds, otherwise on an exact booking of its own
|
|
186
|
+
* where the engine books.
|
|
187
|
+
*/
|
|
188
|
+
fresh(purpose: "retrospective" | "synthesizer", systemPrompt: string, request: string, maxTokens: number, providerConfig: ProviderConfig, reservation?: PPrimeReservation): Promise<ContinuationCallResult>;
|
|
189
|
+
/**
|
|
190
|
+
* Give the session's cells back: the critics, P', P, then the session's
|
|
191
|
+
* own slot. Idempotent; run before the synthesizer, and again by
|
|
192
|
+
* {@link dispose} on any path out.
|
|
193
|
+
*/
|
|
194
|
+
release(): Promise<void>;
|
|
195
|
+
/** Release everything this continuation created. Idempotent. */
|
|
196
|
+
dispose(): Promise<void>;
|
|
197
|
+
}
|
|
198
|
+
/** Room on P' held for one call (`reservePPrime`). */
|
|
199
|
+
export interface PPrimeReservation {
|
|
200
|
+
readonly purpose: "retrospective" | "synthesizer";
|
|
201
|
+
/** Cells charged against the owner's room while the call runs. */
|
|
202
|
+
readonly cells: number;
|
|
203
|
+
}
|
|
204
|
+
export interface PrepareContinuationInput {
|
|
205
|
+
/** The session's provider config: the connection its turns go out on. */
|
|
206
|
+
providerConfig: ProviderConfig;
|
|
207
|
+
/** The host's session id: the key of the pool registry and the wire id. */
|
|
208
|
+
sessionId: string | undefined;
|
|
209
|
+
systemPrompt: string;
|
|
210
|
+
tools: readonly unknown[];
|
|
211
|
+
/** The messages the agent's next request would carry. */
|
|
212
|
+
apiMessages: readonly MessageWithMetadata[];
|
|
213
|
+
/** The window the session holds (the granted one where it is smaller). */
|
|
214
|
+
contextWindow: number | undefined;
|
|
215
|
+
/** The provider's count of the last request, or the estimate. */
|
|
216
|
+
requestTokens: number;
|
|
217
|
+
/** The last request's own prompt count, when one was measured. */
|
|
218
|
+
observedRequestTokens?: number;
|
|
219
|
+
reasoning: ContinuationReasoning;
|
|
220
|
+
/** A summarizer model of its own is configured: it cannot continue this one. */
|
|
221
|
+
separateSummarizer: boolean;
|
|
222
|
+
/** The server is refusing bookings: no new ones, no pools. */
|
|
223
|
+
kvPressureActive: boolean;
|
|
224
|
+
overflowRecovery: boolean;
|
|
225
|
+
abortSignal?: AbortSignal;
|
|
226
|
+
logger?: BasicLogger;
|
|
227
|
+
/** Test seam for the model calls. */
|
|
228
|
+
model?: ContinuationModel;
|
|
229
|
+
/** Test seam for the waits between refusals. */
|
|
230
|
+
sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
231
|
+
/** A number unique within the process, for the compaction's session ids. */
|
|
232
|
+
serial?: number;
|
|
233
|
+
/**
|
|
234
|
+
* The compaction's meter: shared with a transcript-as-text fallback, so
|
|
235
|
+
* the one line it logs counts both.
|
|
236
|
+
*/
|
|
237
|
+
meter?: CompactionMeter;
|
|
238
|
+
}
|
|
239
|
+
/** Whether a failed call is the server saying "not now". */
|
|
240
|
+
export declare function isInfraFault(error: unknown): boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Whether compaction on this connection can run as a continuation, and in
|
|
243
|
+
* which shape. `undefined` continuation with the reason when it cannot.
|
|
244
|
+
*/
|
|
245
|
+
export declare function prepareCompactionContinuation(input: PrepareContinuationInput): Promise<{
|
|
246
|
+
continuation?: CompactionContinuation;
|
|
247
|
+
reason: string;
|
|
248
|
+
}>;
|
|
249
|
+
/**
|
|
250
|
+
* The line every compaction logs: which path it took and why, what it
|
|
251
|
+
* prefilled, how much of the session's cache it reused, what it booked, how
|
|
252
|
+
* long it took.
|
|
253
|
+
*/
|
|
254
|
+
export declare function describeCompactionRun(input: {
|
|
255
|
+
path: ContinuationPath | "fallback";
|
|
256
|
+
reason: string;
|
|
257
|
+
meter: CompactionMeter;
|
|
258
|
+
durationMs: number;
|
|
259
|
+
sessionWindow?: number;
|
|
260
|
+
}): string;
|