@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,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A second opinion on a compaction, before it replaces the transcript.
|
|
3
|
+
*
|
|
4
|
+
* A summary is written once, from the whole of a transcript, by a model that
|
|
5
|
+
* has just spent its budget doing the work being summarised. It is the only
|
|
6
|
+
* artifact in the system that is never checked against the thing it describes
|
|
7
|
+
* -- and it is also the one artifact that, once written, *is* the thing it
|
|
8
|
+
* describes. Every later turn reads it and never the conversation again.
|
|
9
|
+
*
|
|
10
|
+
* Measured on pandorum: summaries that reported a checker run as a success
|
|
11
|
+
* when it had returned `ok:false` three times, that paraphrased the
|
|
12
|
+
* instruction they had been asked to quote, and that narrated in the past
|
|
13
|
+
* tense a prompt had asked three times to be present. None of these are
|
|
14
|
+
* failures of intelligence. They are failures of a single pass over more
|
|
15
|
+
* material than fits comfortably in one.
|
|
16
|
+
*
|
|
17
|
+
* So the summary is reviewed the way a council reviews a proposal. The
|
|
18
|
+
* transcript is cut in half; each half is given to a fresh reviewer along with
|
|
19
|
+
* the summary and the retrospective, and asked what is missing, what is
|
|
20
|
+
* contradicted and what is misquoted **in that half**. A synthesiser then
|
|
21
|
+
* glues the two corrected versions back into one.
|
|
22
|
+
*
|
|
23
|
+
* Three properties the shape is chosen for:
|
|
24
|
+
*
|
|
25
|
+
* - **Each reviewer sees half the evidence and all of the claim.** That is the
|
|
26
|
+
* point: a reviewer holding half a transcript has room to actually read it,
|
|
27
|
+
* where the original pass did not. It is also the danger, and the reviewer
|
|
28
|
+
* prompt spends most of its words on it -- a reviewer who deletes what its
|
|
29
|
+
* half does not cover turns a review into a truncation.
|
|
30
|
+
* - **The reviewers are parallel, not chained.** Both correct the *original*.
|
|
31
|
+
* Chaining would make the second reviewer's job "review a text the first one
|
|
32
|
+
* already changed", and its corrections would compound rather than converge.
|
|
33
|
+
* - **Nothing here may fail the compaction.** Every step falls back to what it
|
|
34
|
+
* was given. A council that cannot run leaves an unreviewed summary, which
|
|
35
|
+
* is exactly what shipped before it existed.
|
|
36
|
+
*/
|
|
37
|
+
import type { BasicLogger, MessageWithMetadata } from "@cerebriline/shared";
|
|
38
|
+
/** What a reviewer and the synthesiser are told they are. */
|
|
39
|
+
export declare const COUNCIL_SYSTEM_PROMPTS: {
|
|
40
|
+
readonly critic: "You are rewriting one half of an account of your own work, with the record of that work in front of you. Correct what the record contradicts, add what it shows missing, fix every quotation against it, and improve the prose where it has drifted out of voice. You return your half and only your half: another writer is rewriting the other one, and the two will be joined into a single continuous replay.";
|
|
41
|
+
readonly synthesizer: "You are joining two independently rewritten halves of one replay into a single continuous piece, and revising a retrospective against the result. Each half was rewritten by someone holding the whole record but owning only that half, so both are grounded — and both could be wrong about the other's territory. Your answer is the finished text, not an account of how you produced it.";
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* What the replay's writer is told when a council will review it: where to
|
|
45
|
+
* put the line that splits it in two.
|
|
46
|
+
*
|
|
47
|
+
* Its own prompt rather than a paragraph of the replay prompt, where it used
|
|
48
|
+
* to live: it was sent with the council switched off, when nothing reads the
|
|
49
|
+
* marker, and never with the full-compaction prompt, so a full compaction
|
|
50
|
+
* reviewed by the council always fell back to a guessed split. It is appended
|
|
51
|
+
* to whichever writer prompt runs, and only while the council is on.
|
|
52
|
+
*/
|
|
53
|
+
export declare const DEFAULT_COUNCIL_WRITER_PROMPT = "## Mark the halfway point\n\nExactly once, put a line containing `<<<HALFWAY>>>` and nothing else, at the\npoint where you are about half way through the work you are describing.\n\nMeasure the half by the **work**, not by the words: the marker goes where the\nfirst half of what happened ends and the second half begins. It must sit on a\nboundary between steps \u2014 after one step and its outcome are complete, never\ninside a step, never between a call and what it returned, and never inside a\nfenced block.\n\nNothing else about the replay changes. It is one continuous piece of prose that\nhappens to carry a marker; do not write headings for the halves, do not\nsummarise each half, and do not refer to the marker in the text.";
|
|
54
|
+
/**
|
|
55
|
+
* The reviewer's instruction, as a template.
|
|
56
|
+
*
|
|
57
|
+
* `{{half}}`, `{{other_half}}` and `{{half_length}}` are substituted; the two
|
|
58
|
+
* halves, the numbered record and the transcript are appended by the harness
|
|
59
|
+
* after it, so a custom prompt cannot drop the evidence it is asked to check.
|
|
60
|
+
*/
|
|
61
|
+
export declare const DEFAULT_COUNCIL_CRITIC_PROMPT = "You wrote the replay below from the transcript that follows it. The replay has been cut in two and you own the **{{half}} half**. Someone else is rewriting the {{other_half}} half from the same transcript, at the same time, and the two halves will be joined back into one continuous replay.\n\nSo: **return the {{half}} half only.** Do not return the {{other_half}} half, do not restate it, do not summarise it, do not lead into it or round it off. It is shown to you for one reason only \u2014 so you can check your own half against it and see where your half ends. Anything of it you reproduce will appear twice in the joined replay, once from you and once from the writer who owns it.\n\n**The user's own words stay.** If your half quotes what the user asked for, that quotation is the most load-bearing text in it \u2014 it is the only place the instruction survives at all once the transcript is gone. Keep it word for word. Do not paraphrase it, do not shorten it, and never drop it to make room.\n\n**You are revising a draft, not writing one.** Start from the text below and change what is wrong with it. Do not re-derive your half from the transcript and write it out afresh: a step that is already right is already done, and rewriting it from scratch is how a correct sentence becomes a different, shorter, wronger one.\n\n**About the `[#7]` marks.** Those are citations, not step numbers and not part of the prose. Each one names a call in the numbered record, and the harness replaces it with that call before anyone reads this. So:\n\n- **Keep every citation your half already has, exactly as it is, where it is.** Do not renumber them, do not turn them into a numbered list, do not write them out as \"Step 7\".\n- **Only cite a number that appears in the record.** If your half describes something with no call behind it, leave it uncited \u2014 inventing a number attaches your sentence to somebody else's call, or to nothing.\n- If the transcript shows a call your half never mentions, add the step and cite its number from the record.\n\nWhat to change in your half:\n\n- **Something that happened and is missing.** A call that was made, an answer that came back, an instruction that was given, a conclusion that was reached, an approach that was ruled out. Add it.\n- **Something the transcript contradicts.** A call reported as succeeding that returned an error; a file said to have been read that was refused; a count, a line number or a filename that does not match. Correct it to what the transcript shows.\n- **Something quoted that does not match.** The user's own words, error text, identifiers, paths and numbers have to be character for character what the transcript holds.\n- **Something the {{other_half}} half contradicts.** Ground your half against it: the two are one account of one session, and a fact stated one way in your half and another way there is a fact to settle from the transcript.\n- **Prose that has drifted.** Fix it. If a step is written as a report of itself \u2014 past tense, or narrated as something finished \u2014 rewrite it as the step and its outcome. First person, present continuous, the voice of someone picking the work back up rather than recounting it.\n\nWrite every step as the step itself, then what came back as its own short sentence after it. This holds in the middle of your half and not only at its ends.\n\n**Length.** Your half is {{half_length}} characters. Return something close to that \u2014 within about 10% either way. You are correcting and rewriting it, not condensing it: material you drop is material nothing else will carry, because the transcript it came from is being deleted.\n\nAnswer with the {{half}} half of the replay and nothing else. No heading, no preamble, no note about what you changed, no marker line. Just the prose.";
|
|
62
|
+
/**
|
|
63
|
+
* The synthesiser's instruction, as a template.
|
|
64
|
+
*
|
|
65
|
+
* `{{original_length}}` and `{{max_length}}` are substituted. The retrospective
|
|
66
|
+
* paragraph and the answer format come after it from the harness, because the
|
|
67
|
+
* reply is parsed by its headings, and so do the halves themselves.
|
|
68
|
+
*/
|
|
69
|
+
export declare const DEFAULT_COUNCIL_SYNTHESIZER_PROMPT = "A replay of your recent work was cut in half, and each half was rewritten against the full transcript by a different writer. Join them back into one continuous replay.\n\nBoth writers had the whole transcript, so both halves are grounded in the record \u2014 but each owned only its own half, and either could be wrong about the seam between them or about a fact the other half settles differently. Cross-check the two against each other: where they disagree about the same fact, keep the version that quotes the transcript over the version that describes it; where one states something the other contradicts, keep the one that is specific.\n\nWhat you are producing is one piece of prose, not two halves stacked up. Make the seam invisible: no heading between them, no marker line, no sentence that restarts or recaps. If the two writers both wrote the same step \u2014 once at the end of the first half and once at the start of the second \u2014 keep it once.\n\nKeep it in the first person and the present continuous tense, every step written as the step and its outcome after it.\n\n**Length.** The replay was {{original_length}} characters before it was rewritten. Aim at that. You may go up to {{max_length}} \u2014 about 10% more \u2014 and you should use that allowance only where it takes the extra room to keep something that would otherwise be lost. Do not use it to be more thorough for its own sake, and do not come in far under: material dropped here is material nothing else carries.";
|
|
70
|
+
/** Substitute `{{name}}` placeholders; an unknown one is left as written. */
|
|
71
|
+
export declare function renderCouncilPrompt(template: string, values: Record<string, string | number>): string;
|
|
72
|
+
/**
|
|
73
|
+
* A writer prompt with the council's marker instruction, when the council runs.
|
|
74
|
+
*
|
|
75
|
+
* Not appended twice: a custom prompt copied from an older default already
|
|
76
|
+
* carries the section, marker and all.
|
|
77
|
+
*/
|
|
78
|
+
export declare function withCouncilWriterPrompt(prompt: string, writerPrompt?: string): string;
|
|
79
|
+
/** The line the replay carries to say where its first half ends. */
|
|
80
|
+
export declare const COUNCIL_HALF_MARKER = "<<<HALFWAY>>>";
|
|
81
|
+
/**
|
|
82
|
+
* The replay in two pieces.
|
|
83
|
+
*
|
|
84
|
+
* Prefers the marker the writer placed, because a boundary between two
|
|
85
|
+
* stretches of work is a thing only the writer knows. Falls back to the
|
|
86
|
+
* nearest blank line to the midpoint when the marker is missing or lands far
|
|
87
|
+
* enough off-centre that one writer would get most of the replay -- a
|
|
88
|
+
* paragraph break is not a semantic boundary, but it is a boundary, and a
|
|
89
|
+
* balanced split at a slightly wrong place beats a correct one that nobody
|
|
90
|
+
* works on.
|
|
91
|
+
*/
|
|
92
|
+
export declare function splitReplayAtMarker(replay: string): {
|
|
93
|
+
first: string;
|
|
94
|
+
second: string;
|
|
95
|
+
source: "marker" | "rebalanced";
|
|
96
|
+
} | undefined;
|
|
97
|
+
/** Strip any marker the model left behind, so it never reaches the context. */
|
|
98
|
+
export declare function stripHalfMarker(text: string): string;
|
|
99
|
+
/** Which half of the transcript a reviewer was given. */
|
|
100
|
+
export type CouncilHalf = "first" | "second";
|
|
101
|
+
export interface CouncilSections {
|
|
102
|
+
replay?: string;
|
|
103
|
+
retrospective?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The reviewer's instruction.
|
|
107
|
+
*
|
|
108
|
+
* Most of it is about what *not* to do, which is unusual here and is the
|
|
109
|
+
* lesson of the shape: the failure mode of a reviewer holding half the
|
|
110
|
+
* evidence is not missing a correction, it is confidently deleting a fact it
|
|
111
|
+
* cannot see the support for. A replay covering the whole of the work will
|
|
112
|
+
* always look half-unsupported to each reviewer, so saying it once is not
|
|
113
|
+
* enough.
|
|
114
|
+
*/
|
|
115
|
+
export declare function buildCouncilCriticRequest(input: {
|
|
116
|
+
half: CouncilHalf;
|
|
117
|
+
/** The half this writer owns and returns. */
|
|
118
|
+
ownReplay: string;
|
|
119
|
+
/** The other half, for grounding only. */
|
|
120
|
+
otherReplay: string;
|
|
121
|
+
transcript: string;
|
|
122
|
+
/**
|
|
123
|
+
* The numbered record the replay's `[#N]` citations point at.
|
|
124
|
+
*
|
|
125
|
+
* Without it the citations are unexplained punctuation. Measured on
|
|
126
|
+
* pandorum with thinking on, the writer wrote its own reading into its
|
|
127
|
+
* task list -- "write every step as `Step [number]. Outcome.`" -- and
|
|
128
|
+
* restructured its half around a step numbering that does not exist,
|
|
129
|
+
* returning 30% of what it was given.
|
|
130
|
+
*/
|
|
131
|
+
toolLedgerKey?: string;
|
|
132
|
+
/** Replaces {@link DEFAULT_COUNCIL_CRITIC_PROMPT}; blank uses it. */
|
|
133
|
+
instructions?: string;
|
|
134
|
+
/**
|
|
135
|
+
* The writer is reading this as the next turn of the conversation the
|
|
136
|
+
* replay was written from (compaction as a continuation): the transcript
|
|
137
|
+
* is the context above, and repeating it here would pay for it twice.
|
|
138
|
+
*/
|
|
139
|
+
transcriptInContext?: boolean;
|
|
140
|
+
}): string;
|
|
141
|
+
/**
|
|
142
|
+
* The synthesiser's instruction.
|
|
143
|
+
*
|
|
144
|
+
* It sees each half's original beside that half's rewrite, rather than the
|
|
145
|
+
* whole original in one piece: the halves are what the two writers actually
|
|
146
|
+
* worked on, so pairing them is what makes a change visible. It is also the
|
|
147
|
+
* only role that touches the retrospective, which is deliberate -- a
|
|
148
|
+
* retrospective is a judgement about how the work went, and a reviewer holding
|
|
149
|
+
* one half of the evidence is the worst possible judge of it. By the time this
|
|
150
|
+
* runs the merged replay exists, which is the thing the judgement is about.
|
|
151
|
+
*/
|
|
152
|
+
export declare function buildCouncilSynthesizerRequest(input: {
|
|
153
|
+
firstOriginal: string;
|
|
154
|
+
secondOriginal: string;
|
|
155
|
+
firstRewritten: string;
|
|
156
|
+
secondRewritten: string;
|
|
157
|
+
thinkingSummary?: string;
|
|
158
|
+
/** What the whole replay was before either half was rewritten. */
|
|
159
|
+
originalLength: number;
|
|
160
|
+
/** Replaces {@link DEFAULT_COUNCIL_SYNTHESIZER_PROMPT}; blank uses it. */
|
|
161
|
+
instructions?: string;
|
|
162
|
+
/**
|
|
163
|
+
* The synthesiser continues the conversation the replay was written in, so
|
|
164
|
+
* the originals are its own answer above: named by where they begin and
|
|
165
|
+
* end rather than pasted again.
|
|
166
|
+
*/
|
|
167
|
+
originalsInContext?: boolean;
|
|
168
|
+
}): string;
|
|
169
|
+
/**
|
|
170
|
+
* Read the two sections back out of a reply.
|
|
171
|
+
*
|
|
172
|
+
* Tolerant of the heading level and of anything the model puts before the
|
|
173
|
+
* first heading, because the alternative to tolerance here is discarding a
|
|
174
|
+
* good correction over a `###`. A reply with no recognisable `Replay` section
|
|
175
|
+
* yields nothing and is treated as a reviewer that declined.
|
|
176
|
+
*/
|
|
177
|
+
export declare function parseCouncilSections(text: string): CouncilSections;
|
|
178
|
+
/**
|
|
179
|
+
* Head, middle and tail rather than the opening.
|
|
180
|
+
*
|
|
181
|
+
* The question these excerpts exist to answer is whether the replay holds its
|
|
182
|
+
* voice all the way through, and the prompt says as much in as many words:
|
|
183
|
+
* the rule "holds for the middle of the replay and not only its first and last
|
|
184
|
+
* sentences". An excerpt that only ever showed the opening could not tell a
|
|
185
|
+
* replay that drifts from one that does not.
|
|
186
|
+
*/
|
|
187
|
+
export declare function logExcerpt(text: string, limit?: number): string;
|
|
188
|
+
export interface CouncilReviewResult {
|
|
189
|
+
summary: string;
|
|
190
|
+
thinkingSummary?: string;
|
|
191
|
+
/** How many reviewers came back with something usable. */
|
|
192
|
+
reviewers: number;
|
|
193
|
+
/** Whether the synthesiser's merge replaced the original. */
|
|
194
|
+
merged: boolean;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Run the review. Returns what it was given if any part of it does not land.
|
|
198
|
+
*/
|
|
199
|
+
export declare function runCouncilReview(input: {
|
|
200
|
+
summary: string;
|
|
201
|
+
thinkingSummary?: string;
|
|
202
|
+
messages: readonly MessageWithMetadata[];
|
|
203
|
+
/**
|
|
204
|
+
* One model call. Throwing is allowed and is handled as a decline.
|
|
205
|
+
*
|
|
206
|
+
* `role` and `half` say which call it is, for a caller that runs the two
|
|
207
|
+
* kinds differently -- a compaction written as a continuation sends a
|
|
208
|
+
* critic as the next turn of the conversation and the synthesiser as a
|
|
209
|
+
* request of its own.
|
|
210
|
+
*/
|
|
211
|
+
generate: (call: {
|
|
212
|
+
systemPrompt: string;
|
|
213
|
+
request: string;
|
|
214
|
+
role: "critic" | "synthesizer";
|
|
215
|
+
half?: CouncilHalf;
|
|
216
|
+
}) => Promise<string>;
|
|
217
|
+
/**
|
|
218
|
+
* The critics hold the transcript as their context; it is not repeated in
|
|
219
|
+
* their requests (see {@link buildCouncilCriticRequest}).
|
|
220
|
+
*/
|
|
221
|
+
transcriptInContext?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Called once the reviewers are done and before the synthesiser runs.
|
|
224
|
+
* Its `thinkingSummary`, when it returns one, is the retrospective the
|
|
225
|
+
* synthesiser revises.
|
|
226
|
+
*
|
|
227
|
+
* This is where a continuation gives its cells back: the critics were the
|
|
228
|
+
* last calls that needed the session's context, and the synthesiser reads
|
|
229
|
+
* only the halves.
|
|
230
|
+
*/
|
|
231
|
+
prepareSynthesis?: () => Promise<{
|
|
232
|
+
thinkingSummary?: string;
|
|
233
|
+
originalsInContext?: boolean;
|
|
234
|
+
} | undefined>;
|
|
235
|
+
/**
|
|
236
|
+
* What the summarizer will accept as one request. A reviewer whose half
|
|
237
|
+
* does not fit declines rather than sending a call the provider refuses;
|
|
238
|
+
* the other half is still reviewed, which is why this is not a reason to
|
|
239
|
+
* abandon the council.
|
|
240
|
+
*/
|
|
241
|
+
maxRequestChars?: number;
|
|
242
|
+
/**
|
|
243
|
+
* The numbered record the replay's `[#N]` citations point at, passed
|
|
244
|
+
* through to both writers so the citations are not unexplained
|
|
245
|
+
* punctuation they have to guess a meaning for.
|
|
246
|
+
*/
|
|
247
|
+
toolLedgerKey?: string;
|
|
248
|
+
logger?: BasicLogger;
|
|
249
|
+
/**
|
|
250
|
+
* Review the halves one after the other instead of at once.
|
|
251
|
+
*
|
|
252
|
+
* Set when the agent runs inside an engine session it shares with a swarm:
|
|
253
|
+
* two concurrent reviewers are two concurrent requests against a window the
|
|
254
|
+
* other agents are drawing on, which is the load compaction is meant to
|
|
255
|
+
* relieve, not add to.
|
|
256
|
+
*/
|
|
257
|
+
serial?: boolean;
|
|
258
|
+
/** Replaces the reviewers' instruction; blank uses the default. */
|
|
259
|
+
criticPrompt?: string;
|
|
260
|
+
/** Replaces the synthesiser's instruction; blank uses the default. */
|
|
261
|
+
synthesizerPrompt?: string;
|
|
262
|
+
}): Promise<CouncilReviewResult>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compaction for the strategy that keeps nothing.
|
|
3
|
+
*
|
|
4
|
+
* When the recency tail is disabled the summary *is* the context: the model
|
|
5
|
+
* reads it and nothing else. That is a harder brief than the replay prompt's,
|
|
6
|
+
* and the failure modes are measured rather than guessed. Three results shaped
|
|
7
|
+
* every choice here, and the reasons are recorded because each of them
|
|
8
|
+
* contradicts something that looks obviously right.
|
|
9
|
+
*
|
|
10
|
+
* **Asking for detail does not produce detail.** (arXiv 2605.23296.) Switching
|
|
11
|
+
* the instruction from "concise" to "very detailed" barely moves the output,
|
|
12
|
+
* and output length grows only ~3× as input grows from 2k to 96k tokens —
|
|
13
|
+
* models anchor summary length to the distribution they were trained on. So
|
|
14
|
+
* there is not one length adjective in this prompt. Completeness is enforced
|
|
15
|
+
* structurally instead: a fixed section list, every section required even when
|
|
16
|
+
* empty, explicit `(none)`, and per-section enumeration requirements. That is
|
|
17
|
+
* the lever that measurably works.
|
|
18
|
+
*
|
|
19
|
+
* **A summary flattens a process into declarations, and the agent then cannot
|
|
20
|
+
* tell where it is.** (arXiv 2608.06503.) With a summary in place of the
|
|
21
|
+
* trajectory, agents terminated on only 44.6% of samples against 77.2% for
|
|
22
|
+
* plain FIFO truncation, and re-issued already-blocked actions. The ordered
|
|
23
|
+
* action–observation sequence is what anchors "this is already done". Hence
|
|
24
|
+
* the hard separation of Done / In progress / Next, the explicit ban on
|
|
25
|
+
* describing finished work as pending, and — outside this prompt — the tool
|
|
26
|
+
* ledger the harness appends, which restores the sequence itself.
|
|
27
|
+
*
|
|
28
|
+
* **Enumerable state cannot be summarised.** (arXiv 2608.01326.) A production
|
|
29
|
+
* compaction endpoint answered set-membership over 15,000 items at close to
|
|
30
|
+
* chance, worse than a same-size Bloom filter. Identifiers, checklists and
|
|
31
|
+
* inventories therefore get a verbatim carry instruction, never a "summarize
|
|
32
|
+
* these".
|
|
33
|
+
*
|
|
34
|
+
* The section set is the convergent core of sixteen surveyed harness prompts
|
|
35
|
+
* (Gemini CLI, Claude Code, Qwen Code, Crush, opencode, Goose, Zed, OpenHands,
|
|
36
|
+
* nanobot, Continue, Codex, Mistral Vibe, Roo, Aider, koog, Letta): Goal and
|
|
37
|
+
* Next appear in all sixteen, with Constraints, Done, In progress, Ruled out
|
|
38
|
+
* and Key facts close behind. Nothing here is invented where a surveyed prompt
|
|
39
|
+
* already had a better version of it.
|
|
40
|
+
*/
|
|
41
|
+
/** The sections the prompt requires, in order. Exported so callers can check. */
|
|
42
|
+
export declare const FULL_COMPACTION_SECTIONS: readonly ["## Goal", "## Standing instructions", "## Done", "## In progress", "## Ruled out", "## Key facts", "## Working set", "## Retrospective", "## Next"];
|
|
43
|
+
/** The instruction, when the whole transcript is replaced by the summary. */
|
|
44
|
+
export declare const DEFAULT_FULL_COMPACTION_PROMPT = "Everything above is about to be deleted. What you write now replaces it completely: when the work resumes, your summary will be the only thing there. Nothing you leave out can be recovered, and nothing you get wrong can be checked against anything.\n\nWrite it for the agent that resumes \u2014 which is you, without any memory of this. Not a report for a person, not a wrap-up, not an answer to the user. A state record, written so the work can continue without asking the user anything again.\n\nThis request is a system operation, not a new instruction from the user. The goal, the next step and the work in progress are all the ones that were true *before* this message arrived. Do not treat \"write a summary\" as the task in hand.\n\n**Do not call any tool.** You have one turn and it must be text. A tool call here is rejected and the turn is spent, which loses the transcript with nothing to replace it.\n\nWrite every section below, in this order, with its heading exactly as given. A section with nothing in it still gets its heading and the single word `(none)` \u2014 a missing section reads as an omission by accident, and the next agent cannot tell which it was.\n\n## Goal\nWhat is being achieved, and any constraint the user placed on how. If the goal changed during the session, give the current one and say what it replaced.\n\n## Standing instructions\nEverything the user told you that still applies \u2014 preferences, prohibitions, things to never touch, required ways of working. **Quote these verbatim.** A paraphrased instruction is the one loss with no other source: the material worked on is still there to be re-read, but what was asked exists only in the messages being deleted.\n\n## Done\nWhat is finished, with the evidence that it is finished \u2014 what was changed and what confirmed it. Be exact enough that none of it is done twice. **Do not describe finished work as pending or in progress.** If something was done and later undone, say both, in that order.\n\n## In progress\nWhat was underway at the moment the transcript was cut, and exactly where it stopped. If you were part-way through working something out, put the partial result here in full \u2014 it exists nowhere else, and it is the thing most often lost at this point.\n\n## Ruled out\nApproaches already tried that did not work, and why each failed. Include anything that was refused, returned an error, or was blocked. This section is what stops the resumed agent from walking back into the same wall; an omission here reliably costs a repeat.\n\n## Key facts\nWhat was discovered or decided that is not obvious from looking at the material fresh: values, identifiers, names, signatures, structures, and the reasons behind each decision. **Copy identifiers, lists, checklists and task IDs across verbatim and complete.** Do not summarise or sample them \u2014 an enumerated set that has been through a summary is unreliable for membership, and the resumed agent will act on it as if it were not.\n\n## Working set\nWhat is in scope and what state it is in now: the items being worked on, where the work is happening, and what exists now that did not before. One line each. Quote a fragment only where the exact wording is what matters; otherwise name it and say what it is.\n\n## Retrospective\nYour own account of how the work actually went, which the reasoning being deleted is the only record of. Cover: what you understood late that would have helped earlier, where effort went that did not pay, any assumption you made that turned out wrong, and where you currently think the difficulty is. This is the one section whose content is judgement rather than fact \u2014 write it as judgement, and say when you are unsure.\n\n## Next\nThe immediate next steps, in order, specific enough to act on without re-deriving them.\n\nTwo rules over all of it. **Do not invent anything.** If you cannot recall something, leave it out or say it is uncertain \u2014 a confident wrong detail in this summary cannot be checked against anything and will be acted on. And do not write a step that rewrites or restores content this summary does not itself contain: the material is still there to be read, and reconstructing it from memory produces a worse copy of something intact.";
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { type OpencotiAllocation, type OpencotiKvPressure } from "@cerebriline/llms";
|
|
2
|
+
import type { BasicLogger } from "@cerebriline/shared";
|
|
3
|
+
import { type PolykvProviderConfig } from "./polykv-session";
|
|
4
|
+
/**
|
|
5
|
+
* Running agents give cells back when the server is refusing others, and take
|
|
6
|
+
* them again when it stops (`kv_pressure_v1` + `kv_resize_v1`, opencoti b108).
|
|
7
|
+
*
|
|
8
|
+
* The policy, as ruled (2026-09-25): admission refuses new agents under
|
|
9
|
+
* pressure; RUNNING agents compact and shrink, transparently, when there is
|
|
10
|
+
* pressure -- and never below their floor, because one agent with 60k beats
|
|
11
|
+
* two with 30k. The floor is the node's "Agent window" share (or the profile's
|
|
12
|
+
* `contextFloor` for a lead), recorded by the fetch that sent it.
|
|
13
|
+
*
|
|
14
|
+
* Three moves, all at a turn boundary -- the prepare step of the compaction
|
|
15
|
+
* pipeline, which is between this session's requests by construction:
|
|
16
|
+
*
|
|
17
|
+
* 1. **Compact on global pressure.** The server refused someone in the last
|
|
18
|
+
* minute, this agent holds more than its floor, and compacting would let it
|
|
19
|
+
* give back a real share of its window: compaction is requested through the
|
|
20
|
+
* existing trigger -- one more reason beside the ratio, the overflow report
|
|
21
|
+
* and the engine's own row, never a second compaction path.
|
|
22
|
+
* 2. **Shrink.** After a compaction, or at once when the context is already
|
|
23
|
+
* small, the booking is resized to what the context needs plus room to
|
|
24
|
+
* grow, never below the floor.
|
|
25
|
+
* 3. **Grow back.** When a recent read says nobody is being refused and the
|
|
26
|
+
* booking is filling, it is resized up toward the window it first asked for
|
|
27
|
+
* -- before the ratio trigger would compact it. Growth is preferred over
|
|
28
|
+
* compaction whenever the server has the room.
|
|
29
|
+
*
|
|
30
|
+
* Every refusal the engine can give a resize is an ordinary outcome here: a
|
|
31
|
+
* busy session is tried again at the next boundary, a gone one is dropped, an
|
|
32
|
+
* exhausted grow takes `largest_admissible`. Nothing is a warning, and nothing
|
|
33
|
+
* fails a turn. On a server that does not advertise both features none of this
|
|
34
|
+
* runs and no resize is ever sent.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* How full a shrunk window is left: the context and a reply's room take this
|
|
38
|
+
* share, the rest is room to grow before the next decision. Below
|
|
39
|
+
* {@link KV_GROW_AT} so a window just shrunk is not grown on the next turn,
|
|
40
|
+
* and below the ratio trigger (0.9) so it is not compacted either.
|
|
41
|
+
*/
|
|
42
|
+
export declare const KV_SHRINK_FILL = 0.6;
|
|
43
|
+
/**
|
|
44
|
+
* How full a window has to be, by the engine's own count, before it grows
|
|
45
|
+
* back. Below the ratio trigger, so growth comes first when there is room.
|
|
46
|
+
*/
|
|
47
|
+
export declare const KV_GROW_AT = 0.75;
|
|
48
|
+
/** Resize targets are whole multiples of this, as the engine's grants are. */
|
|
49
|
+
export declare const KV_RESIZE_ALIGN = 256;
|
|
50
|
+
/**
|
|
51
|
+
* The least a shrink must give back to be worth a resize: a tenth of the
|
|
52
|
+
* window, and never under this many cells. A resize for a handful of cells is
|
|
53
|
+
* churn.
|
|
54
|
+
*/
|
|
55
|
+
export declare const KV_SHRINK_MIN_CELLS = 4096;
|
|
56
|
+
export declare const KV_SHRINK_MIN_SHARE = 0.1;
|
|
57
|
+
/**
|
|
58
|
+
* What a pressure compaction must buy, as a share of the window, beyond what
|
|
59
|
+
* a shrink without it would. Compaction costs the agent its detail; it is
|
|
60
|
+
* spent under pressure only when it frees a real part of the booking. Without
|
|
61
|
+
* this a window just shrunk to fit its compacted context would be compacted
|
|
62
|
+
* again on the next turn, for a few thousand cells.
|
|
63
|
+
*/
|
|
64
|
+
export declare const KV_PRESSURE_COMPACTION_MIN_GAIN_SHARE = 0.25;
|
|
65
|
+
/**
|
|
66
|
+
* How much bigger than a compaction's result the context must be for a
|
|
67
|
+
* pressure compaction: a context already near what compaction would leave has
|
|
68
|
+
* nothing to give.
|
|
69
|
+
*/
|
|
70
|
+
export declare const KV_PRESSURE_COMPACTION_MIN_RATIO = 1.25;
|
|
71
|
+
/**
|
|
72
|
+
* When the cells idle slots hold count as pressure (`kv_observable_v1`).
|
|
73
|
+
*
|
|
74
|
+
* `idle_resident` is resident cache no booking pays for: a released worker's
|
|
75
|
+
* private suffix, an LCP-kept slot's cache. The admission gate counts those
|
|
76
|
+
* cells as free (`cells_free`) and hands them out; the cache does not have
|
|
77
|
+
* them. The engine reclaims them one slot per FAILED `find_slot` -- so once
|
|
78
|
+
* the bookings grow into that room, what reclaims it is a failed batch, and
|
|
79
|
+
* a failed batch is an "Invalid input batch" for everyone in it or a partial
|
|
80
|
+
* eviction (b108: `used 9750` booked while ~81k released-worker tokens were
|
|
81
|
+
* held, then evictions of agents holding 20-31k of 64k).
|
|
82
|
+
*
|
|
83
|
+
* So it is pressure when it is a real part of the room admission still
|
|
84
|
+
* offers: at least {@link KV_IDLE_RESIDENT_PRESSURE_SHARE} of `cells_free`
|
|
85
|
+
* (of `cells_total` where the engine states no free count). A quarter because
|
|
86
|
+
* that is the point where the next few admissions -- each books a window of
|
|
87
|
+
* tens of thousands of cells -- can already reach cells that are not there,
|
|
88
|
+
* while a pool with room several times the ghosts has nothing to fear from
|
|
89
|
+
* them yet. And never under {@link KV_IDLE_RESIDENT_PRESSURE_MIN_CELLS}: one
|
|
90
|
+
* idle slot keeping a short request's cache is how the engine is meant to run
|
|
91
|
+
* (the 0399 gate read 1,997 after a single 512-token completion), not a leak.
|
|
92
|
+
*/
|
|
93
|
+
export declare const KV_IDLE_RESIDENT_PRESSURE_SHARE = 0.25;
|
|
94
|
+
export declare const KV_IDLE_RESIDENT_PRESSURE_MIN_CELLS = 8192;
|
|
95
|
+
/** Whether the idle-resident cells are pressure: see the constants above. */
|
|
96
|
+
export declare function idleResidentIsPressure(resident: {
|
|
97
|
+
idleResident: number;
|
|
98
|
+
cellsFree?: number;
|
|
99
|
+
cellsTotal?: number;
|
|
100
|
+
}): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* When the SWA half is full enough to be pressure (opencoti mail #322).
|
|
103
|
+
*
|
|
104
|
+
* On a model with a sliding window the cache has two halves, and bookings and
|
|
105
|
+
* `largest_admissible` count only the base. Every resident sequence keeps its
|
|
106
|
+
* last SWA window -- idle sessions and pools too -- so the SWA half fills while
|
|
107
|
+
* the base looks empty: the b116 evictions were "SWA half could not fit the
|
|
108
|
+
* batch (2048 tokens): swa 66044 used of 66048 cells" with the base at 163k of
|
|
109
|
+
* 1M. A batch needs a ubatch of free SWA cells on top of every live window,
|
|
110
|
+
* so the room that matters is a few batches, not a share of a big pool.
|
|
111
|
+
*
|
|
112
|
+
* 0.85: on that 66,048-cell half the last 15% is ~9,900 cells, four or five
|
|
113
|
+
* 2,048-token batches -- the headroom a wave of prefills uses up before the
|
|
114
|
+
* next turn boundary reads `/kv` again. Lower would call a half that is
|
|
115
|
+
* merely busy (each live sequence holds a whole window by design) pressure;
|
|
116
|
+
* higher leaves less than two batches between the reading and the failure.
|
|
117
|
+
* And `/kv`'s count is the engine's accounting, which leaves the idle slots'
|
|
118
|
+
* windows out: the physical half is fuller than it says, never emptier.
|
|
119
|
+
*/
|
|
120
|
+
export declare const KV_SWA_PRESSURE_OCCUPANCY = 0.85;
|
|
121
|
+
/** Whether the SWA half is pressure: see {@link KV_SWA_PRESSURE_OCCUPANCY}. */
|
|
122
|
+
export declare function swaIsPressure(swa: {
|
|
123
|
+
cellsUsed: number;
|
|
124
|
+
cellsTotal: number;
|
|
125
|
+
cellsFree?: number;
|
|
126
|
+
cellsPhysFree?: number;
|
|
127
|
+
cellsPhysTotal?: number;
|
|
128
|
+
}): boolean;
|
|
129
|
+
/** The booking this session's usage lands in, and its bounds. */
|
|
130
|
+
export interface KvResizeSubject {
|
|
131
|
+
/**
|
|
132
|
+
* `own`: the session's own booking. `owner`: the swarm owner its pooled
|
|
133
|
+
* turns are charged to -- the owner resizes, never each worker.
|
|
134
|
+
*/
|
|
135
|
+
kind: "own" | "owner";
|
|
136
|
+
/** The id the engine knows the booking by. */
|
|
137
|
+
engineId: string;
|
|
138
|
+
/** The host session whose grant follows the resize. */
|
|
139
|
+
grantKey: string;
|
|
140
|
+
/** Never shrunk below. Absent: no smaller window was declared acceptable. */
|
|
141
|
+
floor?: number;
|
|
142
|
+
/** Never grown above: the window first asked for. */
|
|
143
|
+
ceiling?: number;
|
|
144
|
+
}
|
|
145
|
+
/** What one turn boundary knows about the server's pressure. */
|
|
146
|
+
export interface KvPressureTurn {
|
|
147
|
+
baseUrl: string;
|
|
148
|
+
fetch?: typeof fetch;
|
|
149
|
+
headers?: Record<string, string>;
|
|
150
|
+
subject: KvResizeSubject;
|
|
151
|
+
state: "active" | "clear" | "unknown";
|
|
152
|
+
pressure?: OpencotiKvPressure;
|
|
153
|
+
/** The subject's `/kv` row, as read this turn (updated by a resize). */
|
|
154
|
+
row?: OpencotiAllocation;
|
|
155
|
+
logger?: BasicLogger;
|
|
156
|
+
/**
|
|
157
|
+
* The server queues a busy booking's resize for its idle moment
|
|
158
|
+
* (`kv_resize_deferred_v1`): every resize is asked for that way, and one
|
|
159
|
+
* already queued is not asked again.
|
|
160
|
+
*/
|
|
161
|
+
deferred?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Cells idle slots hold beyond every booking, server-wide, as this turn's
|
|
164
|
+
* `/kv` read stated them (`kv_observable_v1`); absent on older engines.
|
|
165
|
+
* Added to `used` wherever a shrink is sized: right after a batch failure
|
|
166
|
+
* `used` alone is a floor, not a fact.
|
|
167
|
+
*/
|
|
168
|
+
idleResident?: number;
|
|
169
|
+
/**
|
|
170
|
+
* {@link idleResident} is pressure of its own ({@link
|
|
171
|
+
* idleResidentIsPressure}): the state is `active` whatever the refusals
|
|
172
|
+
* say.
|
|
173
|
+
*/
|
|
174
|
+
idlePressure?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* The SWA half is full ({@link swaIsPressure}), whatever the base says.
|
|
177
|
+
* Nothing grows into it. It is NOT a reason to compact or shrink: a
|
|
178
|
+
* sequence holds one SWA window whatever its context length, so neither
|
|
179
|
+
* frees an SWA cell, and a shrink hands base cells to admission, which
|
|
180
|
+
* books base only and would seat more sequences in the full half. What
|
|
181
|
+
* frees SWA is fewer resident sequences -- sessions released as their
|
|
182
|
+
* agents end.
|
|
183
|
+
*/
|
|
184
|
+
swaPressure?: boolean;
|
|
185
|
+
/** The SWA half as read, for the log. */
|
|
186
|
+
swa?: {
|
|
187
|
+
cellsUsed: number;
|
|
188
|
+
cellsTotal: number;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* The subject is a lead conversation's own booking, not a delegated
|
|
192
|
+
* agent's: it compacts for the server only while its own agents need
|
|
193
|
+
* this engine's cells (see {@link kvPressureWantsCompaction}).
|
|
194
|
+
*/
|
|
195
|
+
lead?: boolean;
|
|
196
|
+
}
|
|
197
|
+
/** Test seam. */
|
|
198
|
+
export declare function resetKvPressureState(): void;
|
|
199
|
+
/**
|
|
200
|
+
* The booking a session lives in, or `undefined` when it has none of its own
|
|
201
|
+
* to resize.
|
|
202
|
+
*
|
|
203
|
+
* A pooled worker lives in the owner its last turn was charged to, and only
|
|
204
|
+
* an owner this process opened is resized -- the lead's own session lent to
|
|
205
|
+
* priority-0 agents is the lead's, and the lead resizes it at its own
|
|
206
|
+
* boundaries. Everything else is its own session under the id the wire
|
|
207
|
+
* carried.
|
|
208
|
+
*/
|
|
209
|
+
export declare function resolveKvResizeSubject(sessionId: string, providerConfig: PolykvProviderConfig): KvResizeSubject | undefined;
|
|
210
|
+
/**
|
|
211
|
+
* Open a turn boundary: read the pressure, find the booking, and grow it back
|
|
212
|
+
* if the pressure has cleared and it is filling.
|
|
213
|
+
*
|
|
214
|
+
* `undefined` -- and nothing sent -- unless the server advertises both
|
|
215
|
+
* `kv_pressure_v1` and `kv_resize_v1`. Called before the compaction trigger
|
|
216
|
+
* sizes itself, so a window grown here is the window the trigger measures
|
|
217
|
+
* against this very turn.
|
|
218
|
+
*/
|
|
219
|
+
export declare function beginKvPressureTurn(options: {
|
|
220
|
+
sessionId: string | undefined;
|
|
221
|
+
providerConfig: PolykvProviderConfig;
|
|
222
|
+
logger?: BasicLogger;
|
|
223
|
+
/**
|
|
224
|
+
* Grow back here when the pressure has cleared. Off for a manual
|
|
225
|
+
* compaction and an overflow recovery: they are shrink-only boundaries.
|
|
226
|
+
*/
|
|
227
|
+
grow?: boolean;
|
|
228
|
+
}): Promise<KvPressureTurn | undefined>;
|
|
229
|
+
/**
|
|
230
|
+
* Whether this turn should compact because the SERVER is under pressure.
|
|
231
|
+
*
|
|
232
|
+
* All of: refusals inside the window; a floor declared and the booking above
|
|
233
|
+
* it; the context meaningfully bigger than what compaction leaves; and
|
|
234
|
+
* compacting lets the booking shrink by at least
|
|
235
|
+
* {@link KV_PRESSURE_COMPACTION_MIN_GAIN_SHARE} of itself beyond what a plain
|
|
236
|
+
* shrink would. Tokens are on the provider's count (`requestTokens`) and the
|
|
237
|
+
* compacted size is put on the same scale by the caller.
|
|
238
|
+
*/
|
|
239
|
+
export declare function kvPressureWantsCompaction(turn: KvPressureTurn | undefined, input: {
|
|
240
|
+
requestTokens: number;
|
|
241
|
+
compactedTokens: number;
|
|
242
|
+
outputRoomTokens: number;
|
|
243
|
+
}): boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Give cells back while the server is refusing: resize the booking down to
|
|
246
|
+
* what the context needs plus room to grow, never below the floor.
|
|
247
|
+
*
|
|
248
|
+
* `usageTokens` is the context about to be sent. Right after a compaction it
|
|
249
|
+
* is the compacted size, which the engine may not see yet -- its tree still
|
|
250
|
+
* holds the old cells until the next request -- so a `used_exceeds_window`
|
|
251
|
+
* then is expected, and the next boundary asks again with the engine's own
|
|
252
|
+
* count. An owner is sized from its own row: its usage is every agent's.
|
|
253
|
+
*/
|
|
254
|
+
export declare function shrinkForKvPressure(turn: KvPressureTurn | undefined, input: {
|
|
255
|
+
usageTokens: number;
|
|
256
|
+
outputRoomTokens: number;
|
|
257
|
+
afterCompaction: boolean;
|
|
258
|
+
}): Promise<void>;
|