@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,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-session consecutive-mistake tracker.
|
|
3
|
+
*
|
|
4
|
+
* @see PLAN.md §3.1 — wrapped around `recordMistake` moved from
|
|
5
|
+
* `packages/agents/src/api/error-handling.ts` lines 147–311.
|
|
6
|
+
* @see PLAN.md §3.2.3 — public surface of `MistakeTracker`.
|
|
7
|
+
*
|
|
8
|
+
* The pure procedural `recordMistake(input, deps)` becomes `record(input)`
|
|
9
|
+
* on the class; `consecutiveMistakes` is internal state. Other deps flow
|
|
10
|
+
* through the constructor instead.
|
|
11
|
+
*
|
|
12
|
+
* NOTE: the §3.2.3 constructor shape omits some fields (agentId,
|
|
13
|
+
* conversationId/runId getters, appendRecoveryNotice). They are retained
|
|
14
|
+
* here for log + notice parity per PLAN.md §3.4.3/§3.4.5. Step 8
|
|
15
|
+
* (`impl-runtime-porter`) may refactor once SessionRuntime is wired up.
|
|
16
|
+
*/
|
|
17
|
+
import type { AgentEvent, BasicLogMetadata, ConsecutiveMistakeLimitContext, ConsecutiveMistakeLimitDecision } from "@cerebriline/shared";
|
|
18
|
+
/**
|
|
19
|
+
* Legacy-agents-style leveled log function. The sdk-re `BasicLogger`
|
|
20
|
+
* does not carry a level argument (§shared/logging/logger.ts); callers
|
|
21
|
+
* are expected to bridge via `metadata.severity` or dispatch to
|
|
22
|
+
* `debug`/`log`/`error`. `MistakeTracker` accepts a leveled callable
|
|
23
|
+
* here so Step 8 can plug in whichever bridging shape `SessionRuntime`
|
|
24
|
+
* ends up using.
|
|
25
|
+
*/
|
|
26
|
+
export type LeveledLog = (level: "debug" | "info" | "warn" | "error", message: string, metadata?: BasicLogMetadata) => void;
|
|
27
|
+
export type MistakeReason = "api_error" | "invalid_tool_call" | "tool_execution_failed";
|
|
28
|
+
export interface RecordMistakeInput {
|
|
29
|
+
iteration: number;
|
|
30
|
+
reason: MistakeReason;
|
|
31
|
+
details?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Stop now, whatever the count says.
|
|
34
|
+
*
|
|
35
|
+
* This used to jump the counter to the limit, which forced the stop but also
|
|
36
|
+
* made the count a lie: a repeated-call loop stopped a run that had two
|
|
37
|
+
* failures behind it and the user was told Cline "ran into 6 errors in a
|
|
38
|
+
* row", with two successful edits among the turns it was counting. The stop
|
|
39
|
+
* is forced here instead, so the number stays the number.
|
|
40
|
+
*/
|
|
41
|
+
forceAtLimit?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export type MistakeOutcome = {
|
|
44
|
+
action: "continue";
|
|
45
|
+
guidance?: string;
|
|
46
|
+
} | {
|
|
47
|
+
action: "stop";
|
|
48
|
+
message: string;
|
|
49
|
+
reason?: string;
|
|
50
|
+
};
|
|
51
|
+
export interface MistakeTrackerOptions {
|
|
52
|
+
readonly maxConsecutiveMistakes: number;
|
|
53
|
+
readonly onLimitReached?: (ctx: ConsecutiveMistakeLimitContext) => Promise<ConsecutiveMistakeLimitDecision> | ConsecutiveMistakeLimitDecision;
|
|
54
|
+
/**
|
|
55
|
+
* Observability hook fired exactly once per limit hit, right before the
|
|
56
|
+
* limit decision is resolved — regardless of whether `onLimitReached` is
|
|
57
|
+
* configured or what it decides. Used for telemetry.
|
|
58
|
+
*/
|
|
59
|
+
readonly onLimitTelemetry?: (ctx: ConsecutiveMistakeLimitContext) => void;
|
|
60
|
+
readonly emit: (event: AgentEvent) => void;
|
|
61
|
+
readonly log: LeveledLog;
|
|
62
|
+
readonly agentId: string;
|
|
63
|
+
readonly getConversationId: () => string;
|
|
64
|
+
readonly getActiveRunId: () => string;
|
|
65
|
+
readonly appendRecoveryNotice: (message: string, reason: MistakeReason) => void;
|
|
66
|
+
}
|
|
67
|
+
export declare class MistakeTracker {
|
|
68
|
+
private consecutiveMistakes;
|
|
69
|
+
private readonly options;
|
|
70
|
+
constructor(options: MistakeTrackerOptions);
|
|
71
|
+
record(input: RecordMistakeInput): Promise<MistakeOutcome>;
|
|
72
|
+
reset(): void;
|
|
73
|
+
get value(): number;
|
|
74
|
+
}
|
|
75
|
+
export declare function buildMistakeLimitStopMessage(input: {
|
|
76
|
+
iteration: number;
|
|
77
|
+
consecutiveMistakes: number;
|
|
78
|
+
maxConsecutiveMistakes: number;
|
|
79
|
+
reason: "api_error" | "invalid_tool_call" | "completion_without_submit" | "tool_execution_failed";
|
|
80
|
+
details?: string;
|
|
81
|
+
stopReason?: string;
|
|
82
|
+
/** Stopped on demand rather than by reaching the limit. */
|
|
83
|
+
forced?: boolean;
|
|
84
|
+
}): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RuleConfig, UserInstructionConfigWatcher } from "../../extensions/config/user-instruction-config-loader";
|
|
2
|
+
export declare function isRuleEnabled(rule: RuleConfig): boolean;
|
|
3
|
+
export declare function formatRulesForSystemPrompt(rules: ReadonlyArray<RuleConfig>): string;
|
|
4
|
+
export declare function mergeRulesForSystemPrompt(primaryRules?: string, additionalRules?: string): string | undefined;
|
|
5
|
+
export declare function listEnabledRulesFromWatcher(watcher: UserInstructionConfigWatcher): RuleConfig[];
|
|
6
|
+
export declare function loadRulesForSystemPromptFromWatcher(watcher: UserInstructionConfigWatcher): string;
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-session scorer for "this run is not going anywhere".
|
|
3
|
+
*
|
|
4
|
+
* Built from 360 harness run digests, replayed against every run's iteration
|
|
5
|
+
* timeline. Two findings shaped it, and both cut against the obvious design:
|
|
6
|
+
*
|
|
7
|
+
* - **Absolute hedging does not separate anything.** `wait` spans 5.4 to 11.9
|
|
8
|
+
* per 1,000 reasoning words across thirteen cohorts with no relation to
|
|
9
|
+
* outcome: the highest rate in the study belongs to a mediocre model and the
|
|
10
|
+
* lowest to the weakest one in it. What separates a converging run from a
|
|
11
|
+
* stuck one is whether hedging *decays* -- `hmm` collapses to 14% of its
|
|
12
|
+
* opening rate in runs that end FIXED and holds at 57% in runs that do not.
|
|
13
|
+
* So the feature is the ratio of the current window to the run's own opening,
|
|
14
|
+
* which needs no cross-model calibration.
|
|
15
|
+
* - **Lexical evidence alone is unusable.** `distress10 >= 2` catches 86% of
|
|
16
|
+
* failures and fires on 62% of successes -- 46% of successes by the good
|
|
17
|
+
* models, which should almost never be told they are struggling. Behavioural
|
|
18
|
+
* evidence alone is precise and far too late: `f10 >= 5` arrives with 46
|
|
19
|
+
* iterations left of a 300-iteration run.
|
|
20
|
+
*
|
|
21
|
+
* The conjunction is what earns its place. Replayed over the corpus it fires at
|
|
22
|
+
* 42% of the way in, leaves 91 iterations of budget to spend differently, and
|
|
23
|
+
* troubles a healthy good-model run once in twenty-five: 56% recall, 15% false
|
|
24
|
+
* alarm overall, 4% on the good models.
|
|
25
|
+
*
|
|
26
|
+
* Diagnosis only, never the consequence -- the same separation the loop
|
|
27
|
+
* detector next door keeps. What this says is what it measured; whether that
|
|
28
|
+
* earns an offer of help, and in what words, belongs to the caller.
|
|
29
|
+
*/
|
|
30
|
+
import type { AgentEvent } from "@cerebriline/shared";
|
|
31
|
+
/** Iterations of history the trigger reads. */
|
|
32
|
+
export declare const STRUGGLE_WINDOW = 10;
|
|
33
|
+
/**
|
|
34
|
+
* Failed tool calls in that window before the behavioural half is satisfied.
|
|
35
|
+
*
|
|
36
|
+
* **Six, raised from four when the signal underneath it was corrected.** Four
|
|
37
|
+
* was fitted against `content_end.error`, and our tools almost never set it: a
|
|
38
|
+
* tool that refuses returns `{success: false, error: ...}` as its output and
|
|
39
|
+
* the call is reported as a success. `refusalIn` below now counts both, which
|
|
40
|
+
* moved the measurement by an order of magnitude rather than a little.
|
|
41
|
+
*
|
|
42
|
+
* Replayed over 288 harness runs -- 219 that reached FIXED, 69 that ended
|
|
43
|
+
* broken or timed out -- with the old signal against the new one, at the same
|
|
44
|
+
* thresholds:
|
|
45
|
+
*
|
|
46
|
+
* ```
|
|
47
|
+
* error only error + refusal
|
|
48
|
+
* N=3 3% / 19% 47% / 91% (false alarm / recall)
|
|
49
|
+
* N=4 3% / 10% 35% / 87%
|
|
50
|
+
* N=5 2% / 4% 25% / 74%
|
|
51
|
+
* N=6 1% / 3% 13% / 57%
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* The old four was not a conservative operating point, it was an unreachable
|
|
55
|
+
* one: it caught 10% of the runs that failed. The new four is the opposite
|
|
56
|
+
* problem -- the nudge fires one below the trigger, so four here means the
|
|
57
|
+
* model is nudged on 47% of the runs that go on to succeed. Six restores the
|
|
58
|
+
* intended rarity with 57% recall, which is better than the old number ever
|
|
59
|
+
* delivered, and `STRUGGLE_EDIT_STREAK` covers the loops it gives up.
|
|
60
|
+
*/
|
|
61
|
+
export declare const STRUGGLE_FAILED_CALLS = 6;
|
|
62
|
+
/** Distress-lexicon hits in the window that satisfy the lexical half. */
|
|
63
|
+
export declare const STRUGGLE_DISTRESS_HITS = 2;
|
|
64
|
+
/**
|
|
65
|
+
* Before this iteration nothing fires, whatever the evidence says.
|
|
66
|
+
*
|
|
67
|
+
* A run that is genuinely stuck at iteration 12 is indistinguishable from one
|
|
68
|
+
* that is still reading the problem, and the corpus has no operating point
|
|
69
|
+
* below 20 that is worth its false alarms.
|
|
70
|
+
*/
|
|
71
|
+
export declare const STRUGGLE_MIN_ITERATION = 20;
|
|
72
|
+
/** Suggestions per task. Two, and at most one per transaction. */
|
|
73
|
+
export declare const STRUGGLE_MAX_PER_TASK = 2;
|
|
74
|
+
/**
|
|
75
|
+
* Consecutive failing edits before the model is told to consider the expert.
|
|
76
|
+
*
|
|
77
|
+
* Separate from `STRUGGLE_FAILED_CALLS` because it is a different measurement,
|
|
78
|
+
* not a smaller one. That threshold reads a ten-turn window of every tool the
|
|
79
|
+
* session called; this one reads an unbroken run of calls to the tools that
|
|
80
|
+
* change a file, and it does not care how far apart the turns are.
|
|
81
|
+
*
|
|
82
|
+
* Three, measured. Across 307 harness runs and one 829-message plugin session,
|
|
83
|
+
* the longest unbroken run of refused calls is 2 in a run that finishes and 4
|
|
84
|
+
* to 8 in the three that do not, so 3 is the first value that separates them.
|
|
85
|
+
* Two would fire on healthy runs; four arrives after the loop is established.
|
|
86
|
+
*/
|
|
87
|
+
export declare const STRUGGLE_EDIT_STREAK = 3;
|
|
88
|
+
/**
|
|
89
|
+
* Attempts the change protocol threw away before the model is told.
|
|
90
|
+
*
|
|
91
|
+
* A discarded transaction is an attempt that ran, failed its check and was put
|
|
92
|
+
* back; an empty submission is one spent with nothing changed. Both are counted
|
|
93
|
+
* because both are an attempt the run no longer has.
|
|
94
|
+
*
|
|
95
|
+
* **Two, measured, and it is the only signal here the protocol emits.** The
|
|
96
|
+
* failed-call window is structurally blind to it: a model failing the protocol
|
|
97
|
+
* calls its tools *successfully* and is told by the result that the check did
|
|
98
|
+
* not pass. Replayed over 335 harness runs with a verdict (236 FIXED, 99
|
|
99
|
+
* broken/timed out), false alarm / recall:
|
|
100
|
+
*
|
|
101
|
+
* ```
|
|
102
|
+
* >= 1 thrown away 2.5% / 18%
|
|
103
|
+
* >= 2 thrown away 0.0% / 15% <- this
|
|
104
|
+
* >= 3 thrown away 0.0% / 13%
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* Zero of 236 runs that reached FIXED ever threw away two. That is what buys
|
|
108
|
+
* it a place beside `STRUGGLE_FAILED_CALLS` rather than in place of it: the two
|
|
109
|
+
* signals fire on different populations, because a run without the protocol has
|
|
110
|
+
* no transactions and a run with it fails half as many tool calls (8.2% against
|
|
111
|
+
* 18.6%). Read together they catch 59% of the failures at the 9% false alarm
|
|
112
|
+
* the window already costs on its own -- nine more runs, and not one new false
|
|
113
|
+
* alarm.
|
|
114
|
+
*/
|
|
115
|
+
export declare const STRUGGLE_FAILED_TRANSACTIONS = 2;
|
|
116
|
+
/**
|
|
117
|
+
* The operating point, as the user may set it.
|
|
118
|
+
*
|
|
119
|
+
* These are load-bearing and the right numbers are an empirical question we
|
|
120
|
+
* have not finished answering -- the constants above are the best corpus fit
|
|
121
|
+
* so far, and one measured arm (jackod4ac, oracle, n=3) fired the trigger zero
|
|
122
|
+
* times because the change protocol produces no failed tool calls at all.
|
|
123
|
+
* Rather than keep guessing centrally, they are exposed so a run can set them
|
|
124
|
+
* and the defaults can be chosen from evidence.
|
|
125
|
+
*
|
|
126
|
+
* Every field is optional and falls back to the constant, so a host that says
|
|
127
|
+
* nothing behaves exactly as it did.
|
|
128
|
+
*/
|
|
129
|
+
export interface StruggleThresholds {
|
|
130
|
+
/** Iterations of history the trigger reads. */
|
|
131
|
+
window?: number;
|
|
132
|
+
/** Failed tool calls in that window before the behavioural half is satisfied. */
|
|
133
|
+
failedCalls?: number;
|
|
134
|
+
/** Distress-lexicon hits in the window that satisfy the lexical half. */
|
|
135
|
+
distressHits?: number;
|
|
136
|
+
/** Before this iteration nothing fires, whatever the evidence says. */
|
|
137
|
+
minIteration?: number;
|
|
138
|
+
/** Suggestions per task. */
|
|
139
|
+
maxPerTask?: number;
|
|
140
|
+
/** Consecutive failing edits before the model is told to consider the expert. */
|
|
141
|
+
editStreak?: number;
|
|
142
|
+
/** Attempts the protocol threw away before the model is told. */
|
|
143
|
+
failedTransactions?: number;
|
|
144
|
+
}
|
|
145
|
+
export interface ResolvedStruggleThresholds {
|
|
146
|
+
readonly window: number;
|
|
147
|
+
readonly failedCalls: number;
|
|
148
|
+
readonly distressHits: number;
|
|
149
|
+
readonly minIteration: number;
|
|
150
|
+
readonly maxPerTask: number;
|
|
151
|
+
readonly editStreak: number;
|
|
152
|
+
readonly failedTransactions: number;
|
|
153
|
+
}
|
|
154
|
+
export declare function resolveStruggleThresholds(given: StruggleThresholds | undefined): ResolvedStruggleThresholds;
|
|
155
|
+
/**
|
|
156
|
+
* The refusal a tool reported inside a successful envelope, if it did.
|
|
157
|
+
*
|
|
158
|
+
* `content_end.error` is set only where the runtime marked the whole call an
|
|
159
|
+
* error, and our own tools almost never are: a tool that refuses returns
|
|
160
|
+
* `{success: false, error: "..."}` as its *output* and the call is reported as
|
|
161
|
+
* having succeeded. Measured on one 829-message session, that gap is the whole
|
|
162
|
+
* signal -- 3 calls carried `error`, 50 carried a refusal in the output, and
|
|
163
|
+
* 46 of 162 `editor` calls were refused. A detector reading only the first
|
|
164
|
+
* number is looking at 6% of what the model experienced.
|
|
165
|
+
*
|
|
166
|
+
* A call counts as refused only when nothing in it succeeded. The list-shaped
|
|
167
|
+
* tools return one result per item, so a `read_files` that found two paths of
|
|
168
|
+
* three did work the model can use and is not a failure.
|
|
169
|
+
*/
|
|
170
|
+
export declare function refusalIn(output: unknown): string | undefined;
|
|
171
|
+
export interface StruggleSignals {
|
|
172
|
+
/** The iteration the verdict was asked for. */
|
|
173
|
+
iteration: number;
|
|
174
|
+
/** Failed tool calls in the last `STRUGGLE_WINDOW` iterations. */
|
|
175
|
+
failedCalls: number;
|
|
176
|
+
/** Distress-lexicon hits in the same window. */
|
|
177
|
+
distress: number;
|
|
178
|
+
/**
|
|
179
|
+
* Hedging in the window as a multiple of the run's own opening rate, or
|
|
180
|
+
* undefined where there is not yet an opening rate to compare against.
|
|
181
|
+
*/
|
|
182
|
+
hedgingRatio?: number;
|
|
183
|
+
}
|
|
184
|
+
export interface StruggleVerdict {
|
|
185
|
+
/**
|
|
186
|
+
* `nudge` is the quieter one, and it arrives first.
|
|
187
|
+
*
|
|
188
|
+
* The offer at `suggest` is a real proposal: it costs money or somebody
|
|
189
|
+
* else's hardware, so it fires late and only on the disjunction. That left
|
|
190
|
+
* the turn before it silent, which is the turn where saying something is
|
|
191
|
+
* cheapest. A nudge is one failure short of the trigger, carries no
|
|
192
|
+
* proposal of its own, and stops as soon as the offer takes over.
|
|
193
|
+
*/
|
|
194
|
+
kind: "ok" | "nudge" | "suggest";
|
|
195
|
+
/**
|
|
196
|
+
* Which measurement produced it, for a caller that words them differently.
|
|
197
|
+
*
|
|
198
|
+
* `failures` is the ten-turn window; `edit-streak` is an unbroken run of
|
|
199
|
+
* refused edits, which says something the window cannot -- that the model
|
|
200
|
+
* is not merely failing often but failing at the same thing, in a row.
|
|
201
|
+
* `transactions` is the protocol's own evidence, and it is the only one of
|
|
202
|
+
* the three that survives the protocol being on.
|
|
203
|
+
*/
|
|
204
|
+
reason?: "failures" | "edit-streak" | "transactions";
|
|
205
|
+
/** What was measured. Never what should be done about it. */
|
|
206
|
+
message?: string;
|
|
207
|
+
signals?: StruggleSignals;
|
|
208
|
+
/**
|
|
209
|
+
* Files this session has changed, for a caller that can say something about
|
|
210
|
+
* them the detector cannot -- their complexity, which needs to read them.
|
|
211
|
+
*/
|
|
212
|
+
files?: readonly string[];
|
|
213
|
+
}
|
|
214
|
+
export interface StruggleTurn {
|
|
215
|
+
iteration: number;
|
|
216
|
+
/** The model's reasoning for that turn, where the provider reports it. */
|
|
217
|
+
reasoning?: string;
|
|
218
|
+
}
|
|
219
|
+
export interface StruggleToolOutcome {
|
|
220
|
+
iteration: number;
|
|
221
|
+
failed: boolean;
|
|
222
|
+
/** The tool that ran, where the caller knows it. */
|
|
223
|
+
tool?: string;
|
|
224
|
+
/** What the tool said when it refused, where it said anything. */
|
|
225
|
+
refusal?: string;
|
|
226
|
+
}
|
|
227
|
+
export interface StruggleInspection {
|
|
228
|
+
iteration: number;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* What the detector measured, in the model's own terms.
|
|
232
|
+
*
|
|
233
|
+
* Written as observation and nothing else. The loop detector's header explains
|
|
234
|
+
* why at length: a message that names a consequence the caller has not decided
|
|
235
|
+
* on describes something that did not happen.
|
|
236
|
+
*/
|
|
237
|
+
export declare function describeStruggle(signals: StruggleSignals, thresholds?: StruggleThresholds): string;
|
|
238
|
+
/**
|
|
239
|
+
* What an unbroken run of refused edits looks like, in the model's own terms.
|
|
240
|
+
*
|
|
241
|
+
* Observation, like `describeStruggle` next door, and for the same reason: the
|
|
242
|
+
* caller owns what follows from it. What this adds over the window is the word
|
|
243
|
+
* *row* -- a model failing four calls out of ten is having a bad patch, and a
|
|
244
|
+
* model whose last three edits were all refused is trying the same thing.
|
|
245
|
+
*/
|
|
246
|
+
export declare function describeEditStreak(streak: number, lastRefusal?: string): string;
|
|
247
|
+
/**
|
|
248
|
+
* What a run of thrown-away attempts looks like, in the model's own terms.
|
|
249
|
+
*
|
|
250
|
+
* Observation, like the two beside it. What this adds over both is *cost*: a
|
|
251
|
+
* failed tool call is a turn, and a discarded transaction is a whole attempt
|
|
252
|
+
* the task does not get back.
|
|
253
|
+
*/
|
|
254
|
+
export declare function describeFailedTransactions(thrownAway: number, discarded: number, empty: number): string;
|
|
255
|
+
/**
|
|
256
|
+
* Per-session struggle scorer.
|
|
257
|
+
*
|
|
258
|
+
* The caller feeds it turns and tool outcomes and asks `inspect` at a boundary
|
|
259
|
+
* of its choosing. Nothing here reads the clock, the provider or the workspace.
|
|
260
|
+
*/
|
|
261
|
+
export declare class StruggleDetector {
|
|
262
|
+
private readonly limits;
|
|
263
|
+
private readonly history;
|
|
264
|
+
/** The run's opening hedging rate, frozen once the baseline window closes. */
|
|
265
|
+
private baseline?;
|
|
266
|
+
private baselineHedging;
|
|
267
|
+
private baselineWords;
|
|
268
|
+
private firedInTask;
|
|
269
|
+
private firedInTransaction;
|
|
270
|
+
private transaction;
|
|
271
|
+
private lastFiredKey?;
|
|
272
|
+
/**
|
|
273
|
+
* The nudge repeats while the evidence holds, and the evidence holds for
|
|
274
|
+
* many calls at a time. Keyed so that saying the same thing twice in a row
|
|
275
|
+
* -- which inspecting after every tool call would otherwise do several
|
|
276
|
+
* times per turn -- says it once.
|
|
277
|
+
*/
|
|
278
|
+
private lastNudgeKey?;
|
|
279
|
+
/** Consecutive refused edits, counted over edit calls and nothing else. */
|
|
280
|
+
private editStreak;
|
|
281
|
+
/**
|
|
282
|
+
* Attempts the protocol threw away, over the whole task.
|
|
283
|
+
*
|
|
284
|
+
* Cumulative on purpose, and deliberately not reset by `noteTransaction`:
|
|
285
|
+
* what was measured is how many attempts a run has spent without keeping
|
|
286
|
+
* one, and a transaction that passes does not give back the two before it.
|
|
287
|
+
*/
|
|
288
|
+
private discardedTransactions;
|
|
289
|
+
private emptyTransactions;
|
|
290
|
+
private lastEditRefusal?;
|
|
291
|
+
/**
|
|
292
|
+
* Files the session has changed, for the rule that a diagnosis is never
|
|
293
|
+
* repeated over an unchanged file set.
|
|
294
|
+
*
|
|
295
|
+
* A model told it is struggling, which then changes nothing, has been told
|
|
296
|
+
* everything this can tell it -- and the two-per-task allowance is there
|
|
297
|
+
* for a run that moved on to different code, not for one saying the same
|
|
298
|
+
* thing about the same file twice.
|
|
299
|
+
*/
|
|
300
|
+
private readonly changedFiles;
|
|
301
|
+
constructor(thresholds?: StruggleThresholds);
|
|
302
|
+
/** The operating point in force, for whoever has to report it. */
|
|
303
|
+
get thresholds(): ResolvedStruggleThresholds;
|
|
304
|
+
/** Record a file this session has changed. */
|
|
305
|
+
noteFileChanged(path: string): void;
|
|
306
|
+
/** Record a turn's reasoning, which is where both lexicons are counted. */
|
|
307
|
+
noteTurn(turn: StruggleTurn): void;
|
|
308
|
+
/** Record one tool call's outcome. Only the failures are counted. */
|
|
309
|
+
noteToolOutcome(outcome: StruggleToolOutcome): void;
|
|
310
|
+
/**
|
|
311
|
+
* The change protocol closed an attempt.
|
|
312
|
+
*
|
|
313
|
+
* Only the two outcomes that cost the task an attempt are counted; `kept`
|
|
314
|
+
* is recorded and counts for nothing, which is what the corpus measured.
|
|
315
|
+
*/
|
|
316
|
+
noteTransactionOutcome(outcome: "kept" | "discarded" | "empty"): void;
|
|
317
|
+
/**
|
|
318
|
+
* Context was compacted.
|
|
319
|
+
*
|
|
320
|
+
* Never fire across one. Compaction is normal for a long task -- 545
|
|
321
|
+
* occurrences in the corpus -- and the reasoning the window was counting is
|
|
322
|
+
* no longer in the conversation, so the evidence for a diagnosis the model
|
|
323
|
+
* would now be reading for the first time has been deleted. The window
|
|
324
|
+
* rebuilds from here.
|
|
325
|
+
*/
|
|
326
|
+
noteCompaction(): void;
|
|
327
|
+
/**
|
|
328
|
+
* The change protocol opened a transaction.
|
|
329
|
+
*
|
|
330
|
+
* At most one suggestion per transaction: a second inside the same one is a
|
|
331
|
+
* repeat of a diagnosis the model has already been given and has not been
|
|
332
|
+
* able to act on yet.
|
|
333
|
+
*/
|
|
334
|
+
noteTransaction(transaction: number): void;
|
|
335
|
+
/** The signals as they stand, without the caps or the firing decision. */
|
|
336
|
+
signalsAt(iteration: number): StruggleSignals;
|
|
337
|
+
inspect(input: StruggleInspection): StruggleVerdict;
|
|
338
|
+
/**
|
|
339
|
+
* The quieter verdict, one failure short of the offer.
|
|
340
|
+
*
|
|
341
|
+
* `failedCalls - 1`, derived rather than configured: the point of it is to
|
|
342
|
+
* speak on the turn before the trigger, so it has to move when the trigger
|
|
343
|
+
* moves. A host that sets `failedCalls: 1` gets no nudge at all, which is
|
|
344
|
+
* right -- there is no turn before the first one.
|
|
345
|
+
*
|
|
346
|
+
* It repeats while the count stays in the band, and the band is one wide by
|
|
347
|
+
* construction, so "repeats" is bounded by how long the model sits at
|
|
348
|
+
* exactly that many failures.
|
|
349
|
+
*/
|
|
350
|
+
private nudgeAt;
|
|
351
|
+
/**
|
|
352
|
+
* Two attempts thrown away, said once per new pair.
|
|
353
|
+
*
|
|
354
|
+
* The same rule the streak uses and for the same reason: a model told about
|
|
355
|
+
* the second discard learns nothing from being told about the third, and it
|
|
356
|
+
* speaks again only once as much evidence has accumulated again.
|
|
357
|
+
*/
|
|
358
|
+
private thrownAwayVerdict;
|
|
359
|
+
/**
|
|
360
|
+
* Three refused edits in a row, said once per new value of "three".
|
|
361
|
+
*
|
|
362
|
+
* It speaks again only once as much evidence has accumulated again -- at
|
|
363
|
+
* three, then six, then nine. A model that has already been told about the
|
|
364
|
+
* third refusal learns nothing from being told about the fourth, and a
|
|
365
|
+
* nudge that arrives on every one of them is how a diagnosis stops being
|
|
366
|
+
* read. The longest streak in the corpus is nine, so this is at most three
|
|
367
|
+
* messages in the worst run measured.
|
|
368
|
+
*/
|
|
369
|
+
private editStreakVerdict;
|
|
370
|
+
/**
|
|
371
|
+
* Emit a nudge, or nothing if it would repeat the last one verbatim.
|
|
372
|
+
*
|
|
373
|
+
* `inspect` is asked after every tool call and every block of reasoning, so
|
|
374
|
+
* the same evidence is read many times per turn. Without this the model
|
|
375
|
+
* would be told the same thing four times in one reply, which is how a
|
|
376
|
+
* diagnosis stops being read.
|
|
377
|
+
*/
|
|
378
|
+
private nudge;
|
|
379
|
+
private recordFor;
|
|
380
|
+
/**
|
|
381
|
+
* Fold a turn into the run's opening rate while the baseline is still open.
|
|
382
|
+
*
|
|
383
|
+
* Frozen after the first `STRUGGLE_WINDOW` iterations, because the
|
|
384
|
+
* comparison is against how this run started and a baseline that kept
|
|
385
|
+
* moving would converge on the window it is being compared to.
|
|
386
|
+
*/
|
|
387
|
+
private absorbBaseline;
|
|
388
|
+
}
|
|
389
|
+
export interface StruggleFeed {
|
|
390
|
+
/** Fold one agent event into the detector, and inspect at a turn's end. */
|
|
391
|
+
observe(event: AgentEvent): void;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Drive a detector from the session's own event stream.
|
|
395
|
+
*
|
|
396
|
+
* Everything the trigger needs is already on the wire: `iteration_start`
|
|
397
|
+
* carries the cursor, `content_end` carries the turn's reasoning and each tool
|
|
398
|
+
* call's error, and `content_start` carries the tool input the file set is read
|
|
399
|
+
* from. Nothing here reaches into the runtime.
|
|
400
|
+
*
|
|
401
|
+
* `onVerdict` fires after every tool result, after every block of reasoning,
|
|
402
|
+
* and at the end of a turn. It used to fire only at the turn boundary, on the
|
|
403
|
+
* argument that a diagnosis arriving between two tool calls of one reply lands
|
|
404
|
+
* in the middle of work the model has already decided on. That argument was
|
|
405
|
+
* wrong about where the message goes: the caller holds the verdict and attaches
|
|
406
|
+
* it to the next tool result, so inspecting sooner does not interrupt anything
|
|
407
|
+
* -- it only stops the evidence waiting for a turn that a looping model may
|
|
408
|
+
* take hundreds of calls to end. The detector dedupes, so reading the same
|
|
409
|
+
* evidence four times in one reply still says it once.
|
|
410
|
+
*
|
|
411
|
+
* It receives both verdicts that carry something -- the offer and the nudge
|
|
412
|
+
* below it -- and never `ok`.
|
|
413
|
+
*/
|
|
414
|
+
export declare function createStruggleFeed(detector: StruggleDetector, onVerdict: (verdict: StruggleVerdict) => void): StruggleFeed;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A struggle supervisor's stop, in words: what a delegated run's abort reason
|
|
3
|
+
* carries when the supervisor ended it (`worker-struggle.ts`).
|
|
4
|
+
*
|
|
5
|
+
* Its own module, importing nothing, because the iteration cap reads it
|
|
6
|
+
* (`agent-iteration-cap.ts`, which suspends such a run for the lead, as it
|
|
7
|
+
* does the loop guard's) and sits under every spawn path, while the
|
|
8
|
+
* supervisor itself reaches back into the tools through the struggle offer.
|
|
9
|
+
*/
|
|
10
|
+
/** Which signal moved a supervisor's phase. */
|
|
11
|
+
export type WorkerStruggleReason = "struggle" | "non-progress" | "thinking-budget";
|
|
12
|
+
/** Whether a run's abort reason is a supervisor stop. */
|
|
13
|
+
export declare function isWorkerStruggleStop(reason: string | undefined): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The supervisor's stop, in words the lead reads when it decides: what was
|
|
16
|
+
* measured, and that the worker had been told to commit a SUMMARY first.
|
|
17
|
+
*/
|
|
18
|
+
export declare function describeWorkerStop(reason: WorkerStruggleReason, counts?: {
|
|
19
|
+
spentAfterNudge?: number;
|
|
20
|
+
}): string;
|