@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,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Struggle supervision for a headless delegated worker.
|
|
3
|
+
*
|
|
4
|
+
* The lead session has had a struggle layer for a while: the {@link
|
|
5
|
+
* StruggleDetector} scores a run, {@link createStruggleFeed} drives it from the
|
|
6
|
+
* event stream, and {@link withStruggleSuggestion} lands the verdict on the
|
|
7
|
+
* next tool result. A delegated worker had none of it.
|
|
8
|
+
*
|
|
9
|
+
* What the worker layer does was set by replaying the two 75-agent swarms from
|
|
10
|
+
* pandorum (sessions yglnz and ysde8, 150 workers) through it, not by reasoning
|
|
11
|
+
* about what a stuck worker looks like. The replay overturned the first guess:
|
|
12
|
+
*
|
|
13
|
+
* - **The loop is thinking that runs out its budget, turn after turn.** The
|
|
14
|
+
* one worker that looped (`k76ar4`) spent its whole thinking budget on 9 of
|
|
15
|
+
* 18 turns -- each ending on the engine's "I have used my thinking budget"
|
|
16
|
+
* -- while telling itself "I have enough evidence to write the report" and
|
|
17
|
+
* probing once more. That is not exact repetition (the repeat guards stay
|
|
18
|
+
* quiet) and not a long run (it died at turn 18). Across the other 149
|
|
19
|
+
* workers only one hit the budget more than twice, and it answered.
|
|
20
|
+
*
|
|
21
|
+
* - **Long is not stuck.** The longest workers (29, 36, 43 turns) all
|
|
22
|
+
* answered in the end; they spent their tokens on edits, not on thought. A
|
|
23
|
+
* turn-count stop, and a stop on the detector's refused-edit streak, would
|
|
24
|
+
* have ended three of them before they reported. So both are nudge-only
|
|
25
|
+
* here. A nudge costs a paragraph on a tool result; a stop costs a report.
|
|
26
|
+
*
|
|
27
|
+
* The terminal action a headless worker can take is *nudge once, then
|
|
28
|
+
* recover-and-stop*: the first trigger holds a worker-shaped nudge ("commit
|
|
29
|
+
* your best finding now as a SUMMARY") for the next tool result; only the
|
|
30
|
+
* budget loop carrying on after it -- past a grace window, so the nudge has a
|
|
31
|
+
* chance to land -- stops the worker, through the supervisor's abort signal.
|
|
32
|
+
* The stop is not data loss: the swarm's digest recovery reads whatever the
|
|
33
|
+
* worker produced, its reasoning tail included, so a stopped worker still
|
|
34
|
+
* reports. On the replay: `k76ar4` is nudged at turn 6 and stopped at turn 13,
|
|
35
|
+
* and no worker that answered is stopped.
|
|
36
|
+
*/
|
|
37
|
+
import type { AgentEvent, AgentToolDefinition } from "@cerebriline/shared";
|
|
38
|
+
import { type StruggleThresholds } from "./struggle-detector";
|
|
39
|
+
import { type WorkerStruggleReason } from "./worker-struggle-stop";
|
|
40
|
+
/**
|
|
41
|
+
* Before this iteration the detector's window/distress path stays quiet.
|
|
42
|
+
*
|
|
43
|
+
* The lead floors this at 20 because a run stuck at iteration 12 is
|
|
44
|
+
* indistinguishable from one still reading the problem. A worker's whole life
|
|
45
|
+
* is shorter -- its `maxIterations` is ~40, not the lead's hundreds -- so the
|
|
46
|
+
* same floor would gate the signal out of most of the run. Lowered here; the
|
|
47
|
+
* edit-streak path fires outside this floor either way.
|
|
48
|
+
*/
|
|
49
|
+
export declare const WORKER_STRUGGLE_MIN_ITERATION = 8;
|
|
50
|
+
/** Tool-calling turns without a final answer before the one nudge. */
|
|
51
|
+
export declare const WORKER_NUDGE_AFTER_ITERATIONS = 20;
|
|
52
|
+
/** Turns the budget loop is looked for over. */
|
|
53
|
+
export declare const WORKER_BUDGET_WINDOW = 6;
|
|
54
|
+
/** Budget-exhausted turns inside the window that earn the nudge. */
|
|
55
|
+
export declare const WORKER_BUDGET_TURNS_TO_NUDGE = 3;
|
|
56
|
+
/** Budget-exhausted turns after the grace window that stop the worker. */
|
|
57
|
+
export declare const WORKER_BUDGET_TURNS_TO_STOP = 2;
|
|
58
|
+
/** Turns the nudge is given to land before anything counts toward a stop. */
|
|
59
|
+
export declare const WORKER_STRUGGLE_GRACE_ITERATIONS = 2;
|
|
60
|
+
/**
|
|
61
|
+
* Worker-calibrated detector thresholds.
|
|
62
|
+
*
|
|
63
|
+
* Only the iteration floor moves; the failure/edit/transaction counts are the
|
|
64
|
+
* lead's, calibrated over the harness corpus and no less true of a worker.
|
|
65
|
+
*/
|
|
66
|
+
export declare const WORKER_STRUGGLE_THRESHOLDS: StruggleThresholds;
|
|
67
|
+
export type WorkerStrugglePhase = "watching" | "nudged" | "stopped";
|
|
68
|
+
export type { WorkerStruggleReason };
|
|
69
|
+
export interface WorkerStruggleOptions {
|
|
70
|
+
/** Detector thresholds; defaults to {@link WORKER_STRUGGLE_THRESHOLDS}. */
|
|
71
|
+
thresholds?: StruggleThresholds;
|
|
72
|
+
/** Turns of tool-calling with no answer before the one nudge. */
|
|
73
|
+
nudgeAfterIterations?: number;
|
|
74
|
+
/**
|
|
75
|
+
* The server's thinking-budget message, when the session knows it.
|
|
76
|
+
*
|
|
77
|
+
* Without it, a turn counts as budget-exhausted when its reasoning ends on
|
|
78
|
+
* the generic admission -- see `reasoningHitBudget`.
|
|
79
|
+
*/
|
|
80
|
+
thinkingBudgetMessage?: string;
|
|
81
|
+
/** See {@link WORKER_BUDGET_WINDOW}. */
|
|
82
|
+
budgetWindow?: number;
|
|
83
|
+
/** See {@link WORKER_BUDGET_TURNS_TO_NUDGE}. */
|
|
84
|
+
budgetTurnsToNudge?: number;
|
|
85
|
+
/** See {@link WORKER_BUDGET_TURNS_TO_STOP}. */
|
|
86
|
+
budgetTurnsToStop?: number;
|
|
87
|
+
/** Turns the worker is given to heed the nudge before a stop can count. */
|
|
88
|
+
graceIterations?: number;
|
|
89
|
+
/** Overrides the nudge text; by default it is worded for what fired it. */
|
|
90
|
+
nudgeMessage?: string;
|
|
91
|
+
/** Called on every phase transition, for logging and telemetry. */
|
|
92
|
+
onTransition?: (phase: WorkerStrugglePhase, reason: WorkerStruggleReason) => void;
|
|
93
|
+
/**
|
|
94
|
+
* The controller whose signal stops the worker.
|
|
95
|
+
*
|
|
96
|
+
* A spawn path that already owns the worker's abort controller passes it so
|
|
97
|
+
* one signal carries both the outer cancellation and this supervisor's stop.
|
|
98
|
+
* Omitted, the supervisor owns one of its own.
|
|
99
|
+
*/
|
|
100
|
+
abortController?: AbortController;
|
|
101
|
+
}
|
|
102
|
+
export interface WorkerStruggleSupervisor {
|
|
103
|
+
/** Fold one agent event into the detector and the turn counter. */
|
|
104
|
+
observe(event: AgentEvent): void;
|
|
105
|
+
/** Wrap the worker's tools so the held nudge lands on the next result. */
|
|
106
|
+
wrapTools<T extends AgentToolDefinition>(tools: readonly T[]): T[];
|
|
107
|
+
/**
|
|
108
|
+
* Aborts when the worker is stopped, with the stop's words
|
|
109
|
+
* ({@link describeWorkerStop}) as its reason. A fresh one after
|
|
110
|
+
* {@link rearm}.
|
|
111
|
+
*/
|
|
112
|
+
readonly stopSignal: AbortSignal;
|
|
113
|
+
/** Which stage of the machine the supervisor is in. */
|
|
114
|
+
readonly phase: WorkerStrugglePhase;
|
|
115
|
+
/**
|
|
116
|
+
* Be told of a stop, with the reason the run is to be aborted with. How
|
|
117
|
+
* the delegated agent's builder aborts the *run* -- not the agent, which
|
|
118
|
+
* the lead may resume. Returns the unsubscribe.
|
|
119
|
+
*/
|
|
120
|
+
onStop(listener: (reason: Error) => void): () => void;
|
|
121
|
+
/**
|
|
122
|
+
* The lead resumed the worker it stopped: watch it from zero again, as
|
|
123
|
+
* a fresh attempt is watched, with a nudge and a stop still to give.
|
|
124
|
+
*/
|
|
125
|
+
rearm(): void;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Where a worker's turn-count nudge sits, relative to its cap.
|
|
129
|
+
*
|
|
130
|
+
* Half the cap: late enough that a worker still reading the problem is left
|
|
131
|
+
* alone, early enough that the nudge arrives with turns to spare. It is a
|
|
132
|
+
* nudge only -- on the replayed swarms the longest workers all answered in the
|
|
133
|
+
* end, so the turn count is not evidence enough to stop one. With no cap set
|
|
134
|
+
* the supervisor's own default, calibrated to a ~40-iteration worker, stands.
|
|
135
|
+
* Every delegated path places it the same way: the swarm, `spawn_agent` and a
|
|
136
|
+
* configured agent.
|
|
137
|
+
*/
|
|
138
|
+
export declare function workerStruggleOptions(maxIterations?: number): Pick<WorkerStruggleOptions, "nudgeAfterIterations">;
|
|
139
|
+
/**
|
|
140
|
+
* The supervisor a delegated agent gets, built the one way every path builds
|
|
141
|
+
* it: the nudge placed at half its cap, the server's thinking-budget message
|
|
142
|
+
* when the session knows it, and each transition logged under its name. Fresh
|
|
143
|
+
* per attempt, so a re-placed or restarted agent is watched from zero.
|
|
144
|
+
*/
|
|
145
|
+
export declare function createDelegatedStruggleSupervisor(input: {
|
|
146
|
+
/** How the log names it: `[agents] reviewer`. */
|
|
147
|
+
label: string;
|
|
148
|
+
maxIterations?: number;
|
|
149
|
+
thinkingBudgetMessage?: string;
|
|
150
|
+
logger?: {
|
|
151
|
+
log?: (message: string) => void;
|
|
152
|
+
};
|
|
153
|
+
}): WorkerStruggleSupervisor;
|
|
154
|
+
export { describeWorkerStop, isWorkerStruggleStop, } from "./worker-struggle-stop";
|
|
155
|
+
/**
|
|
156
|
+
* The nudge a headless worker is handed, worded for what it can actually do.
|
|
157
|
+
*
|
|
158
|
+
* The lead's nudge names the expert and `spawn_agent`; a worker has neither, so
|
|
159
|
+
* naming them would be telling it to reach for a tool it does not hold. What it
|
|
160
|
+
* can do is stop and report -- the swarm digest is a free-form `SUMMARY:` text
|
|
161
|
+
* turn -- so that is the instruction. The opening line says what was measured,
|
|
162
|
+
* because "you keep running out of thinking" is actionable in a way "you have
|
|
163
|
+
* been going a while" is not.
|
|
164
|
+
*/
|
|
165
|
+
export declare function describeWorkerNudge(reason?: WorkerStruggleReason): string;
|
|
166
|
+
export declare function createWorkerStruggleSupervisor(options?: WorkerStruggleOptions): WorkerStruggleSupervisor;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { AgentOverlay, type OverlayChange } from "./overlay-fs";
|
|
2
|
+
/** The native command-sandbox binary and its hook library. */
|
|
3
|
+
export interface SandboxBinaries {
|
|
4
|
+
/** Absolute path to the `cerebriline-sandbox` launcher (`.exe` on Windows). */
|
|
5
|
+
launcher: string;
|
|
6
|
+
/**
|
|
7
|
+
* Absolute path to the hook library the launcher injects (Windows `hook.dll`);
|
|
8
|
+
* on Linux/macOS there is none, so this points back at the launcher, which
|
|
9
|
+
* ignores it — keeping `wrapSpawn`'s `[hook, log, cmd, ...]` shape uniform.
|
|
10
|
+
*/
|
|
11
|
+
hook: string;
|
|
12
|
+
/** Platforms the binaries support. */
|
|
13
|
+
platforms?: NodeJS.Platform[];
|
|
14
|
+
}
|
|
15
|
+
type SpawnSpec = {
|
|
16
|
+
executable: string;
|
|
17
|
+
args: string[];
|
|
18
|
+
cwd: string;
|
|
19
|
+
env: Record<string, string>;
|
|
20
|
+
};
|
|
21
|
+
export interface AgentSandbox {
|
|
22
|
+
readonly overlay: AgentOverlay;
|
|
23
|
+
readonly overlayRoot: string;
|
|
24
|
+
/**
|
|
25
|
+
* Wrap a shell spawn so the command tree runs under the sandbox, or
|
|
26
|
+
* undefined when this platform has no launcher (the caller then withholds
|
|
27
|
+
* `run_commands`). Shape matches `ShellExecutorOptions.wrapSpawn`.
|
|
28
|
+
*/
|
|
29
|
+
readonly wrapSpawn?: (spec: SpawnSpec) => SpawnSpec;
|
|
30
|
+
/** The agent's change set, for the hand-back to the lead. */
|
|
31
|
+
changedFiles(): Promise<OverlayChange[]>;
|
|
32
|
+
/** Remove the overlay and its log once the hand-back has been read. */
|
|
33
|
+
dispose(): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export interface CreateAgentSandboxOptions {
|
|
36
|
+
/** The lead's workspace, read-only to the agent. */
|
|
37
|
+
workspaceRoot: string;
|
|
38
|
+
/** The agent's private overlay directory (in extension storage). */
|
|
39
|
+
overlayRoot: string;
|
|
40
|
+
/** The native binaries; absent means tools-only isolation, no sandboxed commands. */
|
|
41
|
+
binaries?: SandboxBinaries;
|
|
42
|
+
/**
|
|
43
|
+
* Confine the agent's commands: they read the system and write only the
|
|
44
|
+
* workspace (their overlay) and a temp folder. On unless set to `false`.
|
|
45
|
+
*
|
|
46
|
+
* The overlay keeps an agent's work off the lead's files and says nothing
|
|
47
|
+
* about the rest of the machine. In swarm wlafh one agent appended to the
|
|
48
|
+
* user's PATH and another copied a program into the home folder, and their
|
|
49
|
+
* reports said "no file changes".
|
|
50
|
+
*/
|
|
51
|
+
confine?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* What the launcher is told to confine a command (see `confine.rs`,
|
|
55
|
+
* `windows.rs` and `macos.rs` in `sandbox/cerebriline-sandbox`).
|
|
56
|
+
*
|
|
57
|
+
* On Linux and macOS the system temp folder stays writable as it is. On
|
|
58
|
+
* Windows the user's `%TEMP%` is not writable to a low-integrity process and
|
|
59
|
+
* relabelling it would change the user's system, so the agent gets a temp
|
|
60
|
+
* folder of its own beside its overlay, which the launcher labels.
|
|
61
|
+
*/
|
|
62
|
+
export declare function confinementEnv(tempRoot: string, platform?: NodeJS.Platform): Record<string, string>;
|
|
63
|
+
/**
|
|
64
|
+
* The environment with the workspace as the last entry of the search path.
|
|
65
|
+
*
|
|
66
|
+
* A command's working directory is the workspace, and whoever writes
|
|
67
|
+
* `run_game.exe page.html` means the program beside the page. cmd looks in the
|
|
68
|
+
* working directory by listing it, PowerShell and sh do not look there at all;
|
|
69
|
+
* on the search path the program is opened by its full name in every shell.
|
|
70
|
+
* Last, so nothing in the workspace shadows a system command.
|
|
71
|
+
*/
|
|
72
|
+
export declare function withWorkspaceOnPath(env: Record<string, string>, workspaceRoot: string, inherited?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): Record<string, string>;
|
|
73
|
+
export declare function createAgentSandbox(options: CreateAgentSandboxOptions): Promise<AgentSandbox>;
|
|
74
|
+
/**
|
|
75
|
+
* {@link createAgentSandbox} for a caller that cannot await: a teammate's
|
|
76
|
+
* toolset is built synchronously when it is spawned. Only the overlay root's
|
|
77
|
+
* creation differs; the sandbox is the same object.
|
|
78
|
+
*/
|
|
79
|
+
export declare function createAgentSandboxSync(options: CreateAgentSandboxOptions): AgentSandbox;
|
|
80
|
+
/**
|
|
81
|
+
* Replace a finished sandbox log with `<log>.gz`, at gzip's fastest level.
|
|
82
|
+
*
|
|
83
|
+
* The trace is UTF-16 lines of the same few paths, and it compresses about
|
|
84
|
+
* 22x at level 1 (201 MB to 9 MB in a second, measured on a pandorum swarm
|
|
85
|
+
* log); the higher levels bought 5% more for the same time. Only once the
|
|
86
|
+
* agent is gone: every process in its tree appends to the plain file while it
|
|
87
|
+
* runs. A log that cannot be compressed is left as it is rather than lost,
|
|
88
|
+
* and an empty or absent one leaves nothing behind.
|
|
89
|
+
*/
|
|
90
|
+
export declare function archiveSandboxLog(logPath: string): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* The lead's own commands, confined: a wrapper for its command executor, or
|
|
93
|
+
* undefined when confinement is off.
|
|
94
|
+
*
|
|
95
|
+
* The launcher runs in direct mode. There is no overlay, because the lead's
|
|
96
|
+
* changes are the user's: the command writes the workspace in place and a
|
|
97
|
+
* temp folder, and the rest of the system is read-only to it.
|
|
98
|
+
*
|
|
99
|
+
* With confinement on and no launcher for this platform the wrapper throws,
|
|
100
|
+
* so the command fails with the reason. Running it unconfined would be the
|
|
101
|
+
* one outcome the setting exists to prevent.
|
|
102
|
+
*/
|
|
103
|
+
export declare function createLeadConfinement(options: {
|
|
104
|
+
enabled: boolean;
|
|
105
|
+
workspaceRoot: string;
|
|
106
|
+
binaries?: SandboxBinaries;
|
|
107
|
+
/** Windows only: the temp folder the launcher makes writable. */
|
|
108
|
+
tempRoot: string;
|
|
109
|
+
platform?: NodeJS.Platform;
|
|
110
|
+
}): ((spec: SpawnSpec) => SpawnSpec) | undefined;
|
|
111
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** AUFS-style whiteout marker prefix, shared with the native command layer. */
|
|
2
|
+
export declare const WHITEOUT_PREFIX = ".wh.";
|
|
3
|
+
export type OverlayChangeKind = "modified" | "created" | "deleted";
|
|
4
|
+
export interface OverlayChange {
|
|
5
|
+
/** Workspace-relative path, forward-slashed. */
|
|
6
|
+
rel: string;
|
|
7
|
+
kind: OverlayChangeKind;
|
|
8
|
+
/** Absolute overlay path (absent for a deletion). */
|
|
9
|
+
overlayPath?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The agent's overlay. `workspaceRoot` is the lead's tree, read-only here;
|
|
13
|
+
* `overlayRoot` is the agent's private directory in extension storage.
|
|
14
|
+
*/
|
|
15
|
+
export declare class AgentOverlay {
|
|
16
|
+
private readonly workspaceRoot;
|
|
17
|
+
private readonly overlayRoot;
|
|
18
|
+
private readonly copyUpListeners;
|
|
19
|
+
constructor(workspaceRoot: string, overlayRoot: string);
|
|
20
|
+
/**
|
|
21
|
+
* Be told when a workspace file is copied up into the overlay, after the
|
|
22
|
+
* copy. The read receipts use it: the agent read the workspace file, and
|
|
23
|
+
* the copy it is about to edit is that same file.
|
|
24
|
+
*/
|
|
25
|
+
onCopyUp(listener: (wsPath: string, ovPath: string) => Promise<void> | void): void;
|
|
26
|
+
/**
|
|
27
|
+
* `text` with every path into the overlay rewritten to the workspace path
|
|
28
|
+
* it stands for. For anything an executor hands back to the agent: the
|
|
29
|
+
* agent is told only about the workspace, and an overlay path in a result
|
|
30
|
+
* or a refusal is an address it would then read and write directly.
|
|
31
|
+
*/
|
|
32
|
+
redact(text: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* The workspace path an overlay path stands for; any other path unchanged.
|
|
35
|
+
* A file is one file to the agent whichever side of the overlay it is
|
|
36
|
+
* currently read from, and anything keyed by path must agree.
|
|
37
|
+
*/
|
|
38
|
+
logicalPath(p: string): string;
|
|
39
|
+
/** Where a path lands. Paths outside the workspace are used as given. */
|
|
40
|
+
private locate;
|
|
41
|
+
/**
|
|
42
|
+
* Resolve a path to the real file a *read* should open: the overlay copy if
|
|
43
|
+
* present, a non-existent overlay path when the file was deleted (so the
|
|
44
|
+
* caller's own read fails with ENOENT), otherwise the workspace file. Lets an
|
|
45
|
+
* executor keep using `fs`/`createReadStream` on the returned path.
|
|
46
|
+
*/
|
|
47
|
+
resolveRead(p: string): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Resolve a path to the real file a *write* should open, copying the
|
|
50
|
+
* workspace version up into the overlay first so a read-modify-write sees the
|
|
51
|
+
* lead's content, and dropping any whiteout. The returned overlay path is
|
|
52
|
+
* what the executor then reads and writes.
|
|
53
|
+
*/
|
|
54
|
+
resolveWrite(p: string): Promise<string>;
|
|
55
|
+
read(p: string): Promise<Buffer>;
|
|
56
|
+
write(p: string, data: Buffer | string): Promise<void>;
|
|
57
|
+
unlink(p: string): Promise<void>;
|
|
58
|
+
rename(src: string, dst: string): Promise<void>;
|
|
59
|
+
mkdir(p: string, opts?: {
|
|
60
|
+
recursive?: boolean;
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
stat(p: string): Promise<import("node:fs").Stats>;
|
|
63
|
+
exists(p: string): Promise<boolean>;
|
|
64
|
+
/** Merged listing: overlay entries, then workspace entries not shadowed,
|
|
65
|
+
* minus whiteouted names and the tombstone markers themselves. */
|
|
66
|
+
readdir(p: string): Promise<string[]>;
|
|
67
|
+
private listRaw;
|
|
68
|
+
/** The agent's change set: what to hand the lead as revisions. */
|
|
69
|
+
changedFiles(): Promise<OverlayChange[]>;
|
|
70
|
+
private walk;
|
|
71
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SandboxBinaries } from "./agent-sandbox";
|
|
2
|
+
/**
|
|
3
|
+
* The native command-sandbox launcher under `dir`, or undefined when there is
|
|
4
|
+
* none for this platform. Windows is the Detours launcher + hook DLL; Linux is
|
|
5
|
+
* the `cerebriline-sandbox` binary (user namespace + overlayfs, no injected
|
|
6
|
+
* library — the `hook` field is unused there and points at the launcher itself
|
|
7
|
+
* so the shared `wrapSpawn` shape holds). A platform with no launcher gets file
|
|
8
|
+
* isolation without a shell rather than an unsandboxed one.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveSandboxBinaries(dir?: string): SandboxBinaries | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const MAX_NODE_TIMER_DELAY_MS = 2147483647;
|
|
2
|
+
type ParentProcess = {
|
|
3
|
+
once(event: "disconnect", listener: () => void): unknown;
|
|
4
|
+
exit(code: number): unknown;
|
|
5
|
+
};
|
|
6
|
+
export declare function normalizeIdleTimeoutMs(timeoutMs: number | undefined): number | undefined;
|
|
7
|
+
/** Ensure an IPC child cannot survive the process that owns it. */
|
|
8
|
+
export declare function installParentDisconnectGuard(target?: ParentProcess): void;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export interface SubprocessSandboxOptions {
|
|
2
|
+
/** Inline script to execute via `node -e`. Mutually exclusive with {@link bootstrapFile}. */
|
|
3
|
+
bootstrapScript?: string;
|
|
4
|
+
/** Path to a JavaScript file to execute via `node <file>`. Mutually exclusive with {@link bootstrapScript}. */
|
|
5
|
+
bootstrapFile?: string;
|
|
6
|
+
/** Runtime executable for internal JavaScript helpers. Defaults to node/bun instead of packaged CLI binaries. */
|
|
7
|
+
runtimeExecutable?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Shut down the child after this many milliseconds with no calls in flight.
|
|
10
|
+
* The next call starts a fresh child transparently. Disabled when omitted.
|
|
11
|
+
*/
|
|
12
|
+
idleTimeoutMs?: number;
|
|
13
|
+
name?: string;
|
|
14
|
+
onEvent?: (event: {
|
|
15
|
+
name: string;
|
|
16
|
+
payload?: unknown;
|
|
17
|
+
}) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface SandboxCallOptions {
|
|
20
|
+
timeoutMs?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const CLINE_JS_RUNTIME_PATH_ENV = "CLINE_JS_RUNTIME_PATH";
|
|
23
|
+
export declare function resolveSubprocessRuntimeExecutable(options?: {
|
|
24
|
+
env?: NodeJS.ProcessEnv;
|
|
25
|
+
execPath?: string;
|
|
26
|
+
runtimeExecutable?: string;
|
|
27
|
+
}): string;
|
|
28
|
+
export declare function buildSubprocessSandboxCommand(args: string[], options?: {
|
|
29
|
+
env?: NodeJS.ProcessEnv;
|
|
30
|
+
execArgv?: string[];
|
|
31
|
+
name?: string;
|
|
32
|
+
execPath?: string;
|
|
33
|
+
runtimeExecutable?: string;
|
|
34
|
+
}): string[];
|
|
35
|
+
export declare class SubprocessSandbox {
|
|
36
|
+
private readonly options;
|
|
37
|
+
private readonly idleTimeoutMs;
|
|
38
|
+
private process;
|
|
39
|
+
private requestCounter;
|
|
40
|
+
private readonly pending;
|
|
41
|
+
private idleTimer;
|
|
42
|
+
private readonly shutdowns;
|
|
43
|
+
constructor(options: SubprocessSandboxOptions);
|
|
44
|
+
private get processLabel();
|
|
45
|
+
private clearPendingRequest;
|
|
46
|
+
private clearIdleTimer;
|
|
47
|
+
private hasPendingRequests;
|
|
48
|
+
/**
|
|
49
|
+
* The parent is the sole idle-lifecycle authority. A matching child-side
|
|
50
|
+
* deadline can fire just before this timer and drop a newly dispatched RPC.
|
|
51
|
+
* Children should independently handle only parent IPC disconnection.
|
|
52
|
+
*/
|
|
53
|
+
private armIdleTimer;
|
|
54
|
+
start(): void;
|
|
55
|
+
call<TResult = unknown>(method: string, args: unknown, options?: SandboxCallOptions): Promise<TResult>;
|
|
56
|
+
shutdown(): Promise<void>;
|
|
57
|
+
private shutdownProcess;
|
|
58
|
+
private terminateProcess;
|
|
59
|
+
private onMessage;
|
|
60
|
+
private failPendingForProcess;
|
|
61
|
+
private failPending;
|
|
62
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolApprovalRequest, ToolApprovalResult } from "@cerebriline/shared";
|
|
2
|
+
export type DesktopToolApprovalOptions = {
|
|
3
|
+
approvalDir?: string;
|
|
4
|
+
sessionId?: string;
|
|
5
|
+
timeoutMs?: number;
|
|
6
|
+
pollIntervalMs?: number;
|
|
7
|
+
nowIso?: () => string;
|
|
8
|
+
};
|
|
9
|
+
export declare function requestDesktopToolApproval(request: ToolApprovalRequest, options?: DesktopToolApprovalOptions): Promise<ToolApprovalResult>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The harness's notes to the model, and how queued ones merge.
|
|
3
|
+
*
|
|
4
|
+
* Every note opens with {@link HARNESS_TAG} so the model can tell the harness
|
|
5
|
+
* from the user. They are written to be cheap: pandorum 2026-09-26, one
|
|
6
|
+
* queued note of nine side-turn recaps was 11.4k characters, each recap
|
|
7
|
+
* quoting the whole stuck-agent report again, and the facts in it were 1.5k.
|
|
8
|
+
*/
|
|
9
|
+
/** What every note from the harness to the model opens with. */
|
|
10
|
+
export declare const HARNESS_TAG = "[SYSTEM MESSAGE]";
|
|
11
|
+
/** The first line of the side-turn recap note. */
|
|
12
|
+
export declare const SIDE_TURN_RECAP_HEADER = "[SYSTEM MESSAGE] Side turns while your agents ran (already done, do not repeat):";
|
|
13
|
+
/**
|
|
14
|
+
* Two recap notes as one. The user's messages come first, every one kept.
|
|
15
|
+
* Of the reports on stuck agents only the latest is kept whole: it names the
|
|
16
|
+
* agents as they are now. An older one survives only as what it did to them.
|
|
17
|
+
*/
|
|
18
|
+
export declare function mergeSideTurnRecaps(older: string, newer: string): string;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type AgentMode } from "@cerebriline/shared";
|
|
2
|
+
import type { CoreSessionEvent, SessionPendingPrompt } from "../../types/events";
|
|
3
|
+
import type { ActiveSession } from "../../types/session";
|
|
4
|
+
import type { PendingPromptMutationResult, PendingPromptsDeleteInput, PendingPromptsUpdateInput } from "../host/runtime-host";
|
|
5
|
+
export type PendingPromptDelivery = "queue" | "steer";
|
|
6
|
+
/**
|
|
7
|
+
* Who queued a prompt. `harness` is text the runtime writes to the model --
|
|
8
|
+
* a side turn's recap, a round's report, a nudge about stuck agents -- that
|
|
9
|
+
* rides the same queue as the user's messages; the UI labels it instead of
|
|
10
|
+
* showing it as something the user typed.
|
|
11
|
+
*/
|
|
12
|
+
export type PendingPromptOrigin = "user" | "harness";
|
|
13
|
+
/**
|
|
14
|
+
* Harness notes that merge while they wait: a status report is replaced by a
|
|
15
|
+
* newer one (it describes the same agents, later), and side-turn recaps are
|
|
16
|
+
* merged into one note (`mergeSideTurnRecaps`: the user's messages first,
|
|
17
|
+
* the latest report on the agents whole). Measured
|
|
18
|
+
* 2026-09-26: a lead held by its round collected seven separate recaps.
|
|
19
|
+
* An `awaiting` note lists the agents waiting on the lead; it is replaced
|
|
20
|
+
* too, and rewritten when it is read (`refresh`).
|
|
21
|
+
*/
|
|
22
|
+
export type PendingPromptNoteKind = "status" | "recap" | "awaiting" | "queued";
|
|
23
|
+
/**
|
|
24
|
+
* Rewrites a harness note as it is delivered: what it says may have changed
|
|
25
|
+
* since it was queued. `undefined` drops it. Swarm 2026-09-27: 2 of 51 cap
|
|
26
|
+
* notes reached the lead after it had resumed the agents they named.
|
|
27
|
+
*/
|
|
28
|
+
export type PendingPromptRefresh = () => string | undefined;
|
|
29
|
+
export interface PendingPromptEntry {
|
|
30
|
+
id: string;
|
|
31
|
+
prompt: string;
|
|
32
|
+
mode?: AgentMode;
|
|
33
|
+
delivery: PendingPromptDelivery;
|
|
34
|
+
userImages?: string[];
|
|
35
|
+
userFiles?: string[];
|
|
36
|
+
origin?: PendingPromptOrigin;
|
|
37
|
+
/** For a harness note: what it is, so a later one of the same kind merges. */
|
|
38
|
+
noteKind?: PendingPromptNoteKind;
|
|
39
|
+
refresh?: PendingPromptRefresh;
|
|
40
|
+
}
|
|
41
|
+
export interface PendingPromptQueueState {
|
|
42
|
+
pendingPrompts: PendingPromptEntry[];
|
|
43
|
+
}
|
|
44
|
+
export interface PendingPromptsControllerDeps {
|
|
45
|
+
getSession(sessionId: string): ActiveSession | undefined;
|
|
46
|
+
emit(event: CoreSessionEvent): void;
|
|
47
|
+
send(input: {
|
|
48
|
+
sessionId: string;
|
|
49
|
+
prompt: string;
|
|
50
|
+
mode?: AgentMode;
|
|
51
|
+
userImages?: string[];
|
|
52
|
+
userFiles?: string[];
|
|
53
|
+
}): Promise<unknown>;
|
|
54
|
+
}
|
|
55
|
+
export interface PendingPromptEnqueueInput {
|
|
56
|
+
prompt: string;
|
|
57
|
+
mode?: AgentMode;
|
|
58
|
+
delivery: PendingPromptDelivery;
|
|
59
|
+
userImages?: string[];
|
|
60
|
+
userFiles?: string[];
|
|
61
|
+
origin?: PendingPromptOrigin;
|
|
62
|
+
noteKind?: PendingPromptNoteKind;
|
|
63
|
+
refresh?: PendingPromptRefresh;
|
|
64
|
+
}
|
|
65
|
+
export interface PendingPromptConsumeResult {
|
|
66
|
+
entry?: PendingPromptEntry;
|
|
67
|
+
prompts: SessionPendingPrompt[];
|
|
68
|
+
}
|
|
69
|
+
export declare class PendingPromptService {
|
|
70
|
+
list(state: PendingPromptQueueState | undefined): SessionPendingPrompt[];
|
|
71
|
+
update(state: PendingPromptQueueState | undefined, input: PendingPromptsUpdateInput): PendingPromptMutationResult;
|
|
72
|
+
delete(state: PendingPromptQueueState | undefined, input: PendingPromptsDeleteInput): PendingPromptMutationResult;
|
|
73
|
+
enqueue(state: PendingPromptQueueState, input: PendingPromptEnqueueInput): SessionPendingPrompt[];
|
|
74
|
+
consumeSteer(state: PendingPromptQueueState): PendingPromptConsumeResult;
|
|
75
|
+
shiftNext(state: PendingPromptQueueState): PendingPromptConsumeResult;
|
|
76
|
+
requeueFront(state: PendingPromptQueueState, entry: PendingPromptEntry): SessionPendingPrompt[];
|
|
77
|
+
clear(state: PendingPromptQueueState): SessionPendingPrompt[];
|
|
78
|
+
/** Drop the harness's notes, keeping what the user queued. */
|
|
79
|
+
dropHarnessNotes(state: PendingPromptQueueState): number;
|
|
80
|
+
}
|
|
81
|
+
export declare class PendingPromptsController {
|
|
82
|
+
private readonly deps;
|
|
83
|
+
private readonly service;
|
|
84
|
+
constructor(deps: PendingPromptsControllerDeps);
|
|
85
|
+
list(sessionId: string): SessionPendingPrompt[];
|
|
86
|
+
update(input: PendingPromptsUpdateInput): PendingPromptMutationResult;
|
|
87
|
+
delete(input: PendingPromptsDeleteInput): PendingPromptMutationResult;
|
|
88
|
+
enqueue(sessionId: string, entry: {
|
|
89
|
+
prompt: string;
|
|
90
|
+
mode?: AgentMode;
|
|
91
|
+
delivery: "queue" | "steer";
|
|
92
|
+
userImages?: string[];
|
|
93
|
+
userFiles?: string[];
|
|
94
|
+
origin?: PendingPromptOrigin;
|
|
95
|
+
noteKind?: PendingPromptNoteKind;
|
|
96
|
+
refresh?: PendingPromptRefresh;
|
|
97
|
+
}): void;
|
|
98
|
+
consumeSteer(sessionId: string): PendingPromptEntry | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Drops every queued prompt. Only called when the user aborts a
|
|
101
|
+
* queue-initiated turn — that gesture means "stop the queued work", not
|
|
102
|
+
* just "stop this response", so the remainder must not auto-run.
|
|
103
|
+
*/
|
|
104
|
+
discardQueue(session: ActiveSession): void;
|
|
105
|
+
/**
|
|
106
|
+
* A user's Cancel stops the lead; the harness's notes to it must not start
|
|
107
|
+
* it again. They were the lead's to read at its next boundary, and a
|
|
108
|
+
* cancelled turn has none: drained, a queued note ran a new turn the moment
|
|
109
|
+
* the old one stopped -- on pandorum 2026-09-26 it compacted a 58k-token
|
|
110
|
+
* transcript until a second Cancel. What the user queued still runs.
|
|
111
|
+
*/
|
|
112
|
+
dropHarnessNotes(session: ActiveSession): void;
|
|
113
|
+
emitPrompts(session: ActiveSession): void;
|
|
114
|
+
scheduleDrain(sessionId: string, session: ActiveSession): void;
|
|
115
|
+
drain(sessionId: string): Promise<void>;
|
|
116
|
+
private emitSubmitted;
|
|
117
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AgentEvent } from "@cerebriline/shared";
|
|
2
|
+
import type { SessionAccumulatedUsage } from "../runtime/host/runtime-host";
|
|
3
|
+
import type { CoreSessionConfig } from "../types/config";
|
|
4
|
+
import type { CoreSessionEvent } from "../types/events";
|
|
5
|
+
import type { ActiveSession } from "../types/session";
|
|
6
|
+
import { type TelemetryAgentIdentityProperties } from "./telemetry/core-events";
|
|
7
|
+
export declare function extractSkillNameFromToolInput(input: unknown): string | undefined;
|
|
8
|
+
export interface AgentEventContext {
|
|
9
|
+
sessionId: string;
|
|
10
|
+
config: CoreSessionConfig;
|
|
11
|
+
liveSession: ActiveSession | undefined;
|
|
12
|
+
usageBySession: Map<string, SessionAccumulatedUsage>;
|
|
13
|
+
aggregateUsageBySession: Map<string, SessionAccumulatedUsage>;
|
|
14
|
+
persistMessages: (sessionId: string, messages: unknown[], systemPrompt?: string) => void;
|
|
15
|
+
emit: (event: CoreSessionEvent) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface AgentTelemetryContextOverrides {
|
|
18
|
+
agentId?: string;
|
|
19
|
+
conversationId?: string;
|
|
20
|
+
parentAgentId?: string | null;
|
|
21
|
+
createdByAgentId?: string;
|
|
22
|
+
teamId?: string;
|
|
23
|
+
teamName?: string;
|
|
24
|
+
teamRole?: "lead" | "teammate";
|
|
25
|
+
teamAgentId?: string;
|
|
26
|
+
isPrimaryAgentEvent?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare function extractAgentEventMetadata(event: AgentEvent): {
|
|
29
|
+
agentId?: string;
|
|
30
|
+
conversationId?: string;
|
|
31
|
+
parentAgentId?: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function buildTelemetryAgentIdentity(context: AgentTelemetryContextOverrides): TelemetryAgentIdentityProperties | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* `task.tokens` telemetry contract (inherited from the legacy extension):
|
|
36
|
+
* one event per completed model request, carrying that request's token/cost
|
|
37
|
+
* deltas as DISJOINT buckets — `tokensIn` is uncached input only, with cache
|
|
38
|
+
* reads/writes reported in their own attributes, so
|
|
39
|
+
* `sum(tokensIn + cacheReadTokens + cacheWriteTokens)` equals total input.
|
|
40
|
+
*
|
|
41
|
+
* SDK usage events follow the AI SDK convention instead: `event.inputTokens`
|
|
42
|
+
* is the FULL request input, cache reads/writes included. Emitting it as
|
|
43
|
+
* `tokensIn` unchanged re-reports the whole (mostly cached) conversation
|
|
44
|
+
* context on every request, so per-task sums re-count the same context
|
|
45
|
+
* tokens once per request. This helper translates to the legacy disjoint
|
|
46
|
+
* buckets (mirroring the webview's `normalizeUsageEvent`). The clamp keeps
|
|
47
|
+
* ApiHandler-backed providers — whose `inputTokens` is already uncached-only
|
|
48
|
+
* — from going negative.
|
|
49
|
+
*/
|
|
50
|
+
export declare function legacyTokenUsageFromUsageEvent(event: Extract<AgentEvent, {
|
|
51
|
+
type: "usage";
|
|
52
|
+
}>): {
|
|
53
|
+
tokensIn: number;
|
|
54
|
+
tokensOut: number;
|
|
55
|
+
cacheWriteTokens: number;
|
|
56
|
+
cacheReadTokens: number;
|
|
57
|
+
totalCost?: number;
|
|
58
|
+
};
|
|
59
|
+
export declare function handleAgentEvent(ctx: AgentEventContext, event: AgentEvent, overrides?: AgentTelemetryContextOverrides): void;
|