@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,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cognitive complexity, SonarSource-style, over a tree-sitter parse.
|
|
3
|
+
*
|
|
4
|
+
* What it answers is "how hard is this code to follow", and the bound has to
|
|
5
|
+
* be said out loud wherever the number is: **it measures how hard code is to
|
|
6
|
+
* read, not how likely a model is to fix it.** It belongs in an escalation
|
|
7
|
+
* brief as context for the expert, and in the assessment as a tiebreaker. It
|
|
8
|
+
* is not evidence that escalation is warranted, and nothing here lets it act
|
|
9
|
+
* as one.
|
|
10
|
+
*
|
|
11
|
+
* Not cyclomatic complexity, which counts paths and rates a flat twenty-case
|
|
12
|
+
* switch as harder than three levels of nested conditionals. Cognitive
|
|
13
|
+
* complexity charges nesting, which is the thing that actually makes a
|
|
14
|
+
* minified `forEach(d=>{if(d){...}})` expensive to reason about.
|
|
15
|
+
*
|
|
16
|
+
* The node-type sets below are shared across grammars rather than written per
|
|
17
|
+
* language. Tree-sitter's naming is conventional enough that `if_statement`,
|
|
18
|
+
* `while_statement` and `catch_clause` mean the same thing in a dozen
|
|
19
|
+
* grammars, and a type this does not recognise scores nothing -- which is the
|
|
20
|
+
* safe direction for a number that is only ever a tiebreaker.
|
|
21
|
+
*/
|
|
22
|
+
import { type ParsedTree } from "./grammars";
|
|
23
|
+
/**
|
|
24
|
+
* The scale, because an unbounded integer on its own says nothing.
|
|
25
|
+
*
|
|
26
|
+
* "This function scores 474" is not information. The reader's first question
|
|
27
|
+
* is *out of what*, and there is no out-of-what: the metric is a sum with no
|
|
28
|
+
* ceiling. A model handed a bare number has to score several functions itself,
|
|
29
|
+
* infer a distribution, and guess where the number sits in it -- so what it
|
|
30
|
+
* actually does is ignore the number. The bands are how the scale travels with
|
|
31
|
+
* the score instead of being left for the reader to reconstruct.
|
|
32
|
+
*
|
|
33
|
+
* The boundaries are anchored on the one published figure and then checked
|
|
34
|
+
* against measurement. SonarSource flags a **function** at 15; scoring 5,695
|
|
35
|
+
* functions across TypeScript, C, C++ and a minified HTML game puts that at
|
|
36
|
+
* the worst 6.8%, which is an independent vindication of their number rather
|
|
37
|
+
* than a coincidence worth ignoring. The rest of the ladder is the same
|
|
38
|
+
* distribution:
|
|
39
|
+
*
|
|
40
|
+
* ```
|
|
41
|
+
* p25 0 >= 5 21.6% moderate
|
|
42
|
+
* p50 1 >= 15 6.8% high <- SonarSource's flag point
|
|
43
|
+
* p75 4 >= 25 3.2% very high
|
|
44
|
+
* p90 10 >= 60 0.7% extreme
|
|
45
|
+
* p95 18
|
|
46
|
+
* p99 50 max 452
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export type ComplexityBand = "simple" | "moderate" | "high" | "very high" | "extreme";
|
|
50
|
+
export declare function bandFor(score: number): ComplexityBand;
|
|
51
|
+
/**
|
|
52
|
+
* The ladder, written out, so the number is readable without a second lookup.
|
|
53
|
+
*
|
|
54
|
+
* Said in full every time on purpose. The alternative is a bare score plus an
|
|
55
|
+
* expectation that whoever reads it remembers a scale from somewhere else,
|
|
56
|
+
* and nothing downstream of here has a somewhere else.
|
|
57
|
+
*/
|
|
58
|
+
export declare const COMPLEXITY_SCALE = "0-4 simple, 5-14 moderate, 15-24 high, 25-59 very high, 60+ extreme; 15 is where SonarSource flags a function, and across 5,695 functions of real code 15+ is the worst 6.8% and 60+ the worst 0.7%";
|
|
59
|
+
/**
|
|
60
|
+
* Where a file starts being worth raising unprompted.
|
|
61
|
+
*
|
|
62
|
+
* The worst function in it reaching `extreme`. Measured over 380 files of
|
|
63
|
+
* TypeScript, C and C++, that is 6.3% of them -- rare enough that saying
|
|
64
|
+
* something means something, common enough to fire on real code.
|
|
65
|
+
*/
|
|
66
|
+
export declare function isHighComplexity(score: ComplexityScore | undefined): boolean;
|
|
67
|
+
export interface ComplexityScore {
|
|
68
|
+
/** The cognitive-complexity total for the span that was walked. */
|
|
69
|
+
score: number;
|
|
70
|
+
/** First and last line of that span, one-based. */
|
|
71
|
+
startLine: number;
|
|
72
|
+
endLine: number;
|
|
73
|
+
/** The function's name where the grammar names it, for the reader. */
|
|
74
|
+
name?: string;
|
|
75
|
+
}
|
|
76
|
+
/** Score a parsed tree, optionally narrowed to the function around one line. */
|
|
77
|
+
export declare function scoreTree(tree: ParsedTree, options?: {
|
|
78
|
+
line?: number;
|
|
79
|
+
}): ComplexityScore | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* How hard the code around a line is to follow, or nothing.
|
|
82
|
+
*
|
|
83
|
+
* Nothing means "not measured" and must never be read as "simple": a language
|
|
84
|
+
* with no grammar, a runtime that cannot load wasm, a file that will not parse.
|
|
85
|
+
* Every one of those is silence, not a low score.
|
|
86
|
+
*/
|
|
87
|
+
export declare function scoreComplexity(filePath: string, source: string, options?: {
|
|
88
|
+
line?: number;
|
|
89
|
+
grammarDir?: string;
|
|
90
|
+
}): Promise<ComplexityScore | undefined>;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the file still parses, or nothing where that cannot be told.
|
|
93
|
+
*
|
|
94
|
+
* The same grammar and the same `MAX_ERROR_COVERAGE` the score uses, asked as
|
|
95
|
+
* a yes/no. It exists because "your last three edits were refused" and "the
|
|
96
|
+
* file you are editing no longer parses" are different facts and a model
|
|
97
|
+
* needs both: the first says the edits are not landing, the second says the
|
|
98
|
+
* ones that did land broke something. Nothing here counts errors -- the number
|
|
99
|
+
* of ERROR nodes a grammar produces is an artefact of its recovery strategy,
|
|
100
|
+
* not a count of the mistakes in the file -- so the answer is only ever
|
|
101
|
+
* whether the file is wholesale broken.
|
|
102
|
+
*
|
|
103
|
+
* `undefined` means not measured: no grammar, no wasm, nothing to say. It must
|
|
104
|
+
* never be read as "fine".
|
|
105
|
+
*/
|
|
106
|
+
export declare function fileParses(filePath: string, source: string, options?: {
|
|
107
|
+
grammarDir?: string;
|
|
108
|
+
}): Promise<boolean | undefined>;
|
|
109
|
+
/**
|
|
110
|
+
* The one sentence that must travel with the number.
|
|
111
|
+
*
|
|
112
|
+
* `check_file` states its own bound the same way, and for the same reason: a
|
|
113
|
+
* measurement handed over without it gets used as the thing it is not.
|
|
114
|
+
*/
|
|
115
|
+
export declare function describeComplexity(score: ComplexityScore, filePath: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PromptTemplate } from "@cerebriline/shared";
|
|
2
|
+
export declare function getBuiltinPromptTemplates(): PromptTemplate[];
|
|
3
|
+
/**
|
|
4
|
+
* The markdown behind a builtin, by file name.
|
|
5
|
+
*
|
|
6
|
+
* A builtin has no path on disk, so "edit this template" has to write a copy
|
|
7
|
+
* somewhere first. This is what gets copied — the file verbatim, comments and
|
|
8
|
+
* all, so the copy reads like the original and diffs against it cleanly.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getBuiltinPromptTemplateSource(fileName: string): string | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { getBuiltinPromptTemplateSource, getBuiltinPromptTemplates, } from "./builtin-templates";
|
|
2
|
+
export { auditCompactionSections, BUILTIN_COMPACTION_PROMPTS, buildCompactionTranslationRequest, type CompactionPromptSources, resolveCompactionPromptSources, stripCompactionSections, } from "./prompt-template-compaction";
|
|
3
|
+
export { createPromptTemplateHooks, type PromptTemplateHooksOptions, } from "./prompt-template-hooks";
|
|
4
|
+
export { loadPromptTemplates, loadPromptTemplatesFromDirectory, PROMPT_TEMPLATES_DIRECTORY_NAME, type PromptTemplateDirectory, type PromptTemplateFileWarnings, type PromptTemplateLoadError, type PromptTemplateLoadResult, resolvePromptTemplateDirectories, } from "./prompt-template-loader";
|
|
5
|
+
export { type PromptTemplateParseInput, type PromptTemplateParseResult, parsePromptTemplate, } from "./prompt-template-parser";
|
|
6
|
+
export { type AuditPromptTemplateProposalArgs, auditPromptTemplateProposal, DEFAULT_REQUIRED_REWRITES, type GeneratePromptTemplateArgs, type GeneratePromptTemplateResult, generatePromptTemplate, type PromptTemplateProposalAudit, summarizeToolCallSignatures, type ToolCallSignature, } from "./prompt-template-review";
|
|
7
|
+
export { describeResolvedPromptTemplate, resolveSessionPromptTemplateFrom, type SessionPromptTemplateRequest, type SessionPromptTemplateResult, } from "./prompt-template-session";
|
|
8
|
+
export type { AvailableRuntimeCommand, ResolveRuntimeSlashCommandOptions, RuntimeCommandKind, } from "./runtime-commands";
|
|
9
|
+
export { getShippedToolCallSignatures, HOST_TOOL_INPUT_SCHEMAS, } from "./shipped-tool-signatures";
|
|
10
|
+
export type { UnifiedConfigDefinition, UnifiedConfigFileCandidate, UnifiedConfigFileContext, UnifiedConfigRecord, UnifiedConfigWatcherEvent, UnifiedConfigWatcherOptions, } from "./unified-config-file-watcher";
|
|
11
|
+
export { UnifiedConfigFileWatcher } from "./unified-config-file-watcher";
|
|
12
|
+
export type { CreateInstructionWatcherOptions, CreateRulesConfigDefinitionOptions, CreateSkillsConfigDefinitionOptions, CreateWorkflowsConfigDefinitionOptions, ParseMarkdownFrontmatterResult, RuleConfig, SkillConfig, UserInstructionConfig, UserInstructionConfigType, WorkflowConfig, } from "./user-instruction-config-loader";
|
|
13
|
+
export { createRulesConfigDefinition, createSkillsConfigDefinition, createWorkflowsConfigDefinition, parseRuleConfigFromMarkdown, parseSkillConfigFromMarkdown, parseWorkflowConfigFromMarkdown, RULES_CONFIG_DIRECTORY_NAME, resolveRulesConfigSearchPaths, resolveSkillsConfigSearchPaths, resolveWorkflowsConfigSearchPaths, SKILLS_CONFIG_DIRECTORY_NAME, WORKFLOWS_CONFIG_DIRECTORY_NAME, } from "./user-instruction-config-loader";
|
|
14
|
+
export type { CreateUserInstructionConfigServiceOptions, UserInstructionConfigRecord, UserInstructionConfigService, } from "./user-instruction-service";
|
|
15
|
+
export { combineUserInstructionConfigServices, createUserInstructionConfigService, } from "./user-instruction-service";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compaction prompts inside a generated template: what is asked for, what is
|
|
3
|
+
* checked, and what is thrown away when it fails the check.
|
|
4
|
+
*
|
|
5
|
+
* A tool description that reads badly costs a turn. A compaction prompt that
|
|
6
|
+
* reads badly costs the session: its output replaces the transcript, and
|
|
7
|
+
* nothing it drops can be recovered or checked against anything afterwards.
|
|
8
|
+
* So translating them is opt-in, and the audit is stricter than it is for a
|
|
9
|
+
* tool section in one respect -- a section that still fails after the repair
|
|
10
|
+
* rounds is REMOVED from the file rather than kept as "the best attempt". A
|
|
11
|
+
* removed section falls back to the built-in prompt, which is the safe answer;
|
|
12
|
+
* a kept broken one is not.
|
|
13
|
+
*
|
|
14
|
+
* What survives is still only a proposal: the generated file is the user's to
|
|
15
|
+
* review, edit, or strip before it is ever used.
|
|
16
|
+
*/
|
|
17
|
+
import { type PromptTemplateCompactionId, type PromptTemplateCompactionPrompts } from "@cerebriline/shared";
|
|
18
|
+
/** The source text for each compaction id: what is used when nothing overrides it. */
|
|
19
|
+
export declare const BUILTIN_COMPACTION_PROMPTS: Readonly<Record<PromptTemplateCompactionId, string>>;
|
|
20
|
+
/** Which prompts to translate, and the text to translate from. */
|
|
21
|
+
export type CompactionPromptSources = Readonly<Partial<Record<PromptTemplateCompactionId, string>>>;
|
|
22
|
+
/**
|
|
23
|
+
* The sources for every compaction id: the user's own prompt where they set
|
|
24
|
+
* one, the built-in one otherwise. A custom prompt is what that user's session
|
|
25
|
+
* actually sends, so it is the one worth translating.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveCompactionPromptSources(custom?: CompactionPromptSources): Record<PromptTemplateCompactionId, string>;
|
|
28
|
+
/**
|
|
29
|
+
* A translation shorter than this share of its source is read as a collapse.
|
|
30
|
+
*
|
|
31
|
+
* These prompts are long on purpose: each paragraph is a rule a summary was
|
|
32
|
+
* observed to break without it. A rewrite at half the length has dropped
|
|
33
|
+
* rules, however well it reads.
|
|
34
|
+
*/
|
|
35
|
+
export declare const MIN_COMPACTION_LENGTH_RATIO = 0.5;
|
|
36
|
+
/** The part of the generator's request that asks for the compaction sections. */
|
|
37
|
+
export declare function buildCompactionTranslationRequest(sources: CompactionPromptSources): string;
|
|
38
|
+
export interface CompactionSectionAudit {
|
|
39
|
+
problems: string[];
|
|
40
|
+
/** Ids whose section must not be kept as written. */
|
|
41
|
+
failing: Set<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Ids whose section is the source copied through, exactly or nearly
|
|
44
|
+
* (`NEAR_COPY_SIMILARITY`). Not a failure -- the
|
|
45
|
+
* request allows it -- but not kept either: a copy is a snapshot, and the
|
|
46
|
+
* next edit to the built-in prompt would reach every model except this one.
|
|
47
|
+
* Leaving the section out is what "use the built-in" means.
|
|
48
|
+
*/
|
|
49
|
+
unchanged: Set<string>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A rewrite at least this similar to its source, by words, is a copy.
|
|
53
|
+
*
|
|
54
|
+
* Measured 2026-09-23 at temperature 0.7: qwen3.5:397b's "rewrite" of the
|
|
55
|
+
* reviewer prompt changed one word, "being deleted" to "being deleting", and
|
|
56
|
+
* glm-5.3-flash's full prompt moved one sentence up a paragraph. Both passed
|
|
57
|
+
* as translations because only an exact copy counted as unchanged -- and a
|
|
58
|
+
* near-copy is worse than an exact one: the same frozen snapshot, plus
|
|
59
|
+
* whatever the model broke. glm's real restructure of the replay prompt sat
|
|
60
|
+
* well below this.
|
|
61
|
+
*/
|
|
62
|
+
export declare const NEAR_COPY_SIMILARITY = 0.98;
|
|
63
|
+
/**
|
|
64
|
+
* The same sentences in another order. glm-5.3-flash's "rewrite" of the full
|
|
65
|
+
* prompt was exactly this: one block moved up a paragraph, 0.95 by words,
|
|
66
|
+
* because a word LCS charges a move its whole length.
|
|
67
|
+
*/
|
|
68
|
+
export declare function isReordering(a: string, b: string): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Word-level similarity, 2·LCS / (|a| + |b|): 1 for identical text, 0 for
|
|
71
|
+
* nothing in common. Order counts, so a moved sentence costs its length.
|
|
72
|
+
*/
|
|
73
|
+
export declare function wordSimilarity(a: string, b: string): number;
|
|
74
|
+
/**
|
|
75
|
+
* Check the compaction sections a proposal carries against what was asked for.
|
|
76
|
+
*
|
|
77
|
+
* Every failing id is reported by name, so the repair round can fix it and
|
|
78
|
+
* the final strip can remove exactly those.
|
|
79
|
+
*/
|
|
80
|
+
export declare function auditCompactionSections(compaction: PromptTemplateCompactionPrompts | undefined, sources: CompactionPromptSources): CompactionSectionAudit;
|
|
81
|
+
/**
|
|
82
|
+
* The compaction ids a list of audit problems names, from the parser's
|
|
83
|
+
* validation warnings (`In 'compaction: <id>': ...`).
|
|
84
|
+
*/
|
|
85
|
+
export declare function compactionIdsWithWarnings(problems: readonly string[]): string[];
|
|
86
|
+
/**
|
|
87
|
+
* Remove the named `# compaction:` sections from a template file.
|
|
88
|
+
*
|
|
89
|
+
* Line-based on the same headings the parser reads, so a section's body runs
|
|
90
|
+
* to the next section heading and nothing else in the file moves.
|
|
91
|
+
*/
|
|
92
|
+
export declare function stripCompactionSections(raw: string, ids: ReadonlySet<string>): string;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regenerate individual `# tool:` sections instead of a whole template.
|
|
3
|
+
*
|
|
4
|
+
* Adding one tool used to mean a full-file rewrite of all ten shipped
|
|
5
|
+
* templates: ten model calls, ten files where every section could drift, and a
|
|
6
|
+
* diff in which the one section anyone wanted to read was buried. The cost is
|
|
7
|
+
* not the model time — it is that a full rewrite puts every *other* section at
|
|
8
|
+
* risk to add one, so a routine addition becomes a review of thirty sections
|
|
9
|
+
* per file.
|
|
10
|
+
*
|
|
11
|
+
* So the unit of work here is the section. The model is asked for the named
|
|
12
|
+
* sections and nothing else, and the result is spliced into the file it came
|
|
13
|
+
* from: every byte outside those sections is carried through unchanged, which
|
|
14
|
+
* a diff then proves.
|
|
15
|
+
*
|
|
16
|
+
* The audit is deliberately NOT relaxed to match. A delta is spliced first and
|
|
17
|
+
* audited second, as a complete file — so "every tool has a section" and every
|
|
18
|
+
* other whole-file guarantee still has to hold at the end. A partial answer is
|
|
19
|
+
* a smaller thing to ask for, not a smaller thing to check.
|
|
20
|
+
*/
|
|
21
|
+
export interface TemplateSection {
|
|
22
|
+
/** The heading line verbatim, or "" for the frontmatter and preamble. */
|
|
23
|
+
heading: string;
|
|
24
|
+
/** The tool this section is for, when the heading names one. */
|
|
25
|
+
name?: string;
|
|
26
|
+
/** Everything under the heading, trailing whitespace trimmed. */
|
|
27
|
+
body: string;
|
|
28
|
+
/**
|
|
29
|
+
* Newlines between the end of this section's text and the next heading.
|
|
30
|
+
*
|
|
31
|
+
* Not always 2. `kimi-k3.md` runs `{{DEFAULT}}` straight into the next
|
|
32
|
+
* `# tool:` heading with no blank line between them, in two places. Writing
|
|
33
|
+
* a uniform blank line back would edit two lines of a file nobody asked to
|
|
34
|
+
* touch — which is exactly the churn a section rewrite exists to avoid, so
|
|
35
|
+
* the separator is carried through rather than assumed.
|
|
36
|
+
*/
|
|
37
|
+
gapAfter?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Split a template into its sections, preserving order and everything else.
|
|
41
|
+
*
|
|
42
|
+
* The template parser gives back the sections' *text* but not the order they
|
|
43
|
+
* were written in, nor the frontmatter, nor a heading it does not recognise.
|
|
44
|
+
* All three have to survive a splice, so this walks the lines instead. The
|
|
45
|
+
* preamble — frontmatter plus any note above the first heading — comes back as
|
|
46
|
+
* a single leading section with an empty heading.
|
|
47
|
+
*/
|
|
48
|
+
export declare function splitTemplateSections(raw: string): TemplateSection[];
|
|
49
|
+
/** Reassemble what {@link splitTemplateSections} produced. */
|
|
50
|
+
export declare function joinTemplateSections(sections: readonly TemplateSection[]): string;
|
|
51
|
+
export interface SpliceToolSectionsResult {
|
|
52
|
+
/** The whole file, with only the named sections changed. */
|
|
53
|
+
template: string;
|
|
54
|
+
/** Sections that existed and were rewritten. */
|
|
55
|
+
replaced: string[];
|
|
56
|
+
/** Sections that did not exist and were appended. */
|
|
57
|
+
added: string[];
|
|
58
|
+
/** Names asked for that the reply never supplied. */
|
|
59
|
+
missing: string[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Put `sections` into `base`, changing nothing else.
|
|
63
|
+
*
|
|
64
|
+
* A tool the file already covers is rewritten in place, so its position in the
|
|
65
|
+
* file — which is editorial, and which a reader relies on — does not move. A
|
|
66
|
+
* tool it does not cover is appended, because there is no defensible place to
|
|
67
|
+
* guess and the end is at least predictable.
|
|
68
|
+
*/
|
|
69
|
+
export declare function spliceToolSections(base: string, sections: ReadonlyMap<string, string>): SpliceToolSectionsResult;
|
|
70
|
+
/**
|
|
71
|
+
* Pull `# tool:` sections out of a reply that is not a whole template.
|
|
72
|
+
*
|
|
73
|
+
* A delta reply has no frontmatter and no `# system`, so it cannot go through
|
|
74
|
+
* the template parser — that would reject it for the very thing that makes it
|
|
75
|
+
* a delta. Anything the model wrote above the first heading is dropped, which
|
|
76
|
+
* is where a model puts "Here are the sections you asked for".
|
|
77
|
+
*
|
|
78
|
+
* `known` is the guard against a model inventing a tool: a section naming
|
|
79
|
+
* something that is not a real tool is reported rather than spliced, because
|
|
80
|
+
* splicing it would put a tool that does not exist into a shipped template.
|
|
81
|
+
*/
|
|
82
|
+
export declare function parseToolSectionsFromReply(reply: string, known: readonly string[]): {
|
|
83
|
+
sections: Map<string, string>;
|
|
84
|
+
unknown: string[];
|
|
85
|
+
};
|
|
86
|
+
export interface ToolSectionDeltaPromptArgs {
|
|
87
|
+
/** The file being amended, shown so the rewrite matches its voice. */
|
|
88
|
+
familyTemplate: string;
|
|
89
|
+
/** `default.md`'s section for each tool: the text being rewritten. */
|
|
90
|
+
defaultSections: ReadonlyMap<string, string>;
|
|
91
|
+
/** The tools to write sections for. */
|
|
92
|
+
tools: readonly string[];
|
|
93
|
+
/** Real call shapes for those tools, rendered into the prompt. */
|
|
94
|
+
signatureText?: string;
|
|
95
|
+
modelId: string;
|
|
96
|
+
family?: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Ask for only the named sections.
|
|
100
|
+
*
|
|
101
|
+
* The instruction is blunt about the output shape because the failure that
|
|
102
|
+
* matters is a model helpfully returning the whole template: that is not a
|
|
103
|
+
* delta, and splicing it would silently revert every hand-made change in the
|
|
104
|
+
* file. Asking twice — once in the rules, once in the closing line — is cheap
|
|
105
|
+
* next to that.
|
|
106
|
+
*/
|
|
107
|
+
export declare function buildToolSectionDeltaPrompt(args: ToolSectionDeltaPromptArgs): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AgentHooks, RenderedPromptTemplate } from "@cerebriline/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Put a session's rendered template on every model request.
|
|
4
|
+
*
|
|
5
|
+
* Two things are deliberately *not* happening here. Nothing is resolved: which
|
|
6
|
+
* template governs this session, and how it layers over `default.md`, was
|
|
7
|
+
* settled once by `renderPromptTemplate` when the session started, and this
|
|
8
|
+
* hook only carries the answer. And nothing is recomputed per request: the
|
|
9
|
+
* rewritten tool list is memoised against the list it was built from, so a
|
|
10
|
+
* fifty-turn conversation does the work once.
|
|
11
|
+
*
|
|
12
|
+
* `beforeModel` is still the seam, because it is the only one that sees every
|
|
13
|
+
* tool. Builtin tools are constructed in core, MCP tools arrive from a hub and
|
|
14
|
+
* the VS Code host injects its own; there is no single construction site to
|
|
15
|
+
* patch, but they all converge on `request.tools`.
|
|
16
|
+
*/
|
|
17
|
+
export interface PromptTemplateHooksOptions {
|
|
18
|
+
/** The session's rendered template, from `renderPromptTemplate`. */
|
|
19
|
+
rendered: RenderedPromptTemplate | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* What this host is called — the same string the system prompt puts after
|
|
22
|
+
* `IDE:`, so `{{IDE_NAME}}` means one thing across the whole prompt.
|
|
23
|
+
*
|
|
24
|
+
* A host that omits it gets `the editor` in the descriptions that use the
|
|
25
|
+
* token. That is a wording default, not a behavioural one, which is why it
|
|
26
|
+
* is not required.
|
|
27
|
+
*/
|
|
28
|
+
ideName?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Where the rewrite is reported, once.
|
|
31
|
+
*
|
|
32
|
+
* The resolution line -- `[PromptTemplates] <model> (<family>) -> qwen over
|
|
33
|
+
* default` -- says which template won. It does not say whether the
|
|
34
|
+
* descriptions reached the request, and those are two different failures.
|
|
35
|
+
* This hook has to be merged into the host's config, and merging it wrongly
|
|
36
|
+
* dropped it before: silently, and completely under `--yolo`, where the
|
|
37
|
+
* runtime layer was `undefined` and the assignment erased everything. A
|
|
38
|
+
* session whose tools kept their built-in text looks identical from the
|
|
39
|
+
* outside to one where the template applied -- same log line, same prompt,
|
|
40
|
+
* different tools.
|
|
41
|
+
*
|
|
42
|
+
* So this names what actually went onto the request. A host that omits it
|
|
43
|
+
* loses the report, not the rewrite.
|
|
44
|
+
*/
|
|
45
|
+
log?: (message: string) => void;
|
|
46
|
+
}
|
|
47
|
+
export declare function createPromptTemplateHooks(options: PromptTemplateHooksOptions): AgentHooks | undefined;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { PromptTemplate, PromptTemplateSource, PromptTemplateWarning } from "@cerebriline/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Load prompt templates from the three places they can live.
|
|
4
|
+
*
|
|
5
|
+
* Builtin templates ship with the package and are always present. A global
|
|
6
|
+
* directory holds the user's own, which is where most of them belong — a Qwen
|
|
7
|
+
* template is about Qwen, not about one repository. A workspace directory
|
|
8
|
+
* holds the ones a project wants to pin and commit, and those shadow the
|
|
9
|
+
* global templates of the same name.
|
|
10
|
+
*
|
|
11
|
+
* A file that fails to parse is reported and skipped, never thrown: one stray
|
|
12
|
+
* colon in one template must not stop a session from starting, and the
|
|
13
|
+
* settings UI needs the message to show which file is broken.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Directory name for both the global and the workspace template stores —
|
|
17
|
+
* `<cline data dir>/templates` and `<workspace>/.clinerules/templates`. The
|
|
18
|
+
* host joins it onto the root it knows.
|
|
19
|
+
*/
|
|
20
|
+
export declare const PROMPT_TEMPLATES_DIRECTORY_NAME = "templates";
|
|
21
|
+
export interface PromptTemplateLoadError {
|
|
22
|
+
filePath: string;
|
|
23
|
+
fileName: string;
|
|
24
|
+
source: PromptTemplateSource;
|
|
25
|
+
message: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A non-fatal problem in a template that loaded anyway.
|
|
29
|
+
*
|
|
30
|
+
* Carried per file rather than folded into one list, because the only useful
|
|
31
|
+
* thing to do with a warning is show it next to the file it came from and
|
|
32
|
+
* offer to open it.
|
|
33
|
+
*/
|
|
34
|
+
export interface PromptTemplateFileWarnings {
|
|
35
|
+
filePath: string;
|
|
36
|
+
fileName: string;
|
|
37
|
+
source: PromptTemplateSource;
|
|
38
|
+
warnings: PromptTemplateWarning[];
|
|
39
|
+
}
|
|
40
|
+
export interface PromptTemplateLoadResult {
|
|
41
|
+
templates: PromptTemplate[];
|
|
42
|
+
errors: PromptTemplateLoadError[];
|
|
43
|
+
warnings: PromptTemplateFileWarnings[];
|
|
44
|
+
}
|
|
45
|
+
export interface PromptTemplateDirectory {
|
|
46
|
+
path: string;
|
|
47
|
+
source: PromptTemplateSource;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Read one directory of `*.md` templates.
|
|
51
|
+
*
|
|
52
|
+
* A directory that does not exist is not an error — most users will never
|
|
53
|
+
* create one, and the builtin templates are enough on their own.
|
|
54
|
+
*/
|
|
55
|
+
export declare function loadPromptTemplatesFromDirectory(directory: PromptTemplateDirectory, options?: {
|
|
56
|
+
knownToolNames?: readonly string[];
|
|
57
|
+
}): PromptTemplateLoadResult;
|
|
58
|
+
/**
|
|
59
|
+
* Read every directory, nearest source last.
|
|
60
|
+
*
|
|
61
|
+
* Order matters downstream: `shadowPromptTemplates` keeps the last template of
|
|
62
|
+
* a given name, and `resolvePromptTemplate` breaks specificity ties towards the
|
|
63
|
+
* nearer source. Both agree that workspace beats global beats builtin, so the
|
|
64
|
+
* directories are read in that order and the list is left in it.
|
|
65
|
+
*/
|
|
66
|
+
export declare function loadPromptTemplates(directories: readonly PromptTemplateDirectory[], options?: {
|
|
67
|
+
knownToolNames?: readonly string[];
|
|
68
|
+
}): PromptTemplateLoadResult;
|
|
69
|
+
/**
|
|
70
|
+
* The directories a session reads, in the order it reads them.
|
|
71
|
+
*
|
|
72
|
+
* `builtinDir` is resolved by the host, because where the package's own assets
|
|
73
|
+
* land depends on how it was bundled, and core should not guess.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolvePromptTemplateDirectories(options: {
|
|
76
|
+
builtinDir?: string;
|
|
77
|
+
globalDir?: string;
|
|
78
|
+
workspaceDir?: string;
|
|
79
|
+
}): PromptTemplateDirectory[];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type PromptTemplate, type PromptTemplateSource, type PromptTemplateWarning } from "@cerebriline/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Parser for the prompt template files under `~/.cline/templates/` and
|
|
4
|
+
* `<workspace>/.clinerules/templates/`.
|
|
5
|
+
*
|
|
6
|
+
* The format is deliberately the same shape as the cron specs and skills next
|
|
7
|
+
* to it — YAML frontmatter, markdown body — because it is edited by hand in
|
|
8
|
+
* the editor, and one more bespoke syntax is one more thing to get wrong at
|
|
9
|
+
* two in the morning.
|
|
10
|
+
*
|
|
11
|
+
* ```markdown
|
|
12
|
+
* ---
|
|
13
|
+
* name: gemma
|
|
14
|
+
* match:
|
|
15
|
+
* family: [gemma*]
|
|
16
|
+
* ---
|
|
17
|
+
*
|
|
18
|
+
* # system
|
|
19
|
+
* You are Cline...
|
|
20
|
+
*
|
|
21
|
+
* # tool: editor
|
|
22
|
+
* Write a file. Use this instead of shell redirection...
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Like the cron parser, this never throws for a bad file: it returns an error
|
|
26
|
+
* string so the loader can show which template is broken and carry on with the
|
|
27
|
+
* others, rather than a session failing to start because of a stray colon.
|
|
28
|
+
*/
|
|
29
|
+
export interface PromptTemplateParseInput {
|
|
30
|
+
raw: string;
|
|
31
|
+
source: PromptTemplateSource;
|
|
32
|
+
/** Used for the template name when the frontmatter omits one. */
|
|
33
|
+
fileName: string;
|
|
34
|
+
filePath?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Tool names this session has, so a section naming something else can be
|
|
37
|
+
* reported. Omitted by callers that only want to read the file.
|
|
38
|
+
*/
|
|
39
|
+
knownToolNames?: readonly string[];
|
|
40
|
+
}
|
|
41
|
+
export type PromptTemplateParseResult = {
|
|
42
|
+
template: PromptTemplate;
|
|
43
|
+
error?: undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Non-fatal problems: a mistyped placeholder, a missing one, a
|
|
46
|
+
* section for a tool that does not exist. The template still loads —
|
|
47
|
+
* these are things a person editing it needs told, not reasons to
|
|
48
|
+
* refuse the file.
|
|
49
|
+
*/
|
|
50
|
+
warnings: PromptTemplateWarning[];
|
|
51
|
+
} | {
|
|
52
|
+
template?: undefined;
|
|
53
|
+
error: string;
|
|
54
|
+
warnings?: undefined;
|
|
55
|
+
};
|
|
56
|
+
export declare function parsePromptTemplate(input: PromptTemplateParseInput): PromptTemplateParseResult;
|