@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,327 @@
|
|
|
1
|
+
import { type PromptTemplate } from "@cerebriline/shared";
|
|
2
|
+
import { type CompactionPromptSources } from "./prompt-template-compaction";
|
|
3
|
+
export declare const DEFAULT_REQUIRED_REWRITES: readonly ["read_files", "search_codebase", "editor", "apply_patch", "run_commands", "fetch_web_content", "check_file", "ask_lsp", "grep", "sed", "awk"];
|
|
4
|
+
export declare const PROMPT_TEMPLATE_REVIEW_INSTRUCTIONS = "You are being shown the prompt Cline gives you when it uses you as a coding agent: a system prompt and a set of tool descriptions. You are the intended reader of this text. Rewrite it into the form you would rather receive.\n\nThis is not a copy-editing task. The prompt below was written by someone reasoning about how you read, and they may have been wrong. Where a section is phrased in a way you would skim, reorder or restate it. Where a rule matters and is buried, put it where you would be when you are about to break it. Where something is repeated to no effect, cut it.\n\nFour failures are observed in practice with models in your family, and the rewrite is judged on whether it prevents them:\n\n1. Reaching for shell commands to do file work \u2014 'cat' to read, 'sed -i' or 'echo >' to write, 'grep' to search \u2014 when dedicated tools exist and are always available.\n2. Serialising independent work across turns: one read, wait, one read, wait, when all of them were known at the start.\n3. Announcing an intention instead of acting on it, or claiming a task is finished without reading back what was written.\n4. Answering a question about a symbol with a text search. Asking where something is defined, what uses it, what implements it, or what a name means, and then grepping for it and reading several files to work out which hit was the real one \u2014 when the IDE's language servers already know the answer exactly and will give it in one call. The same failure in its other form: running a compiler or a linter through the shell to find out whether one file is valid, and waiting for a whole-project build to answer a one-file question.\n\nOne thing you must get right, and which prompts written for this get wrong in both directions:\n\nA coding agent is multi-turn, and the end of a turn is never in itself the end of the work. What is final is the completion of the assigned work \u2014 the task, the work package, the milestone, the request. An end of turn may be a milestone reached, a point where you need direction, guidance or a clarification from the user, or simply an intermediate step between two things the user asked for. So:\n\n- Do not treat \"I have stopped emitting tool calls\" as \"the work is done\". It is not a signal about the work at all.\n- Do not write a rule that makes stopping feel like failure, such as \"a response without a tool call is considered complete\". A rule like that buys one more unnecessary tool call on every finished task, and it teaches the wrong thing: that continuing is always correct.\n- Keep your attention on the long horizon of the assigned work rather than on the current turn. Ending a turn to ask a question is correct when you need the answer. Ending it while work you were asked to do remains untouched, and saying nothing about that, is not.\n\nFour more things are settled by measurement rather than by opinion, and a rewrite is judged on whether it keeps them:\n\n- The checker and the run belong in the same turn. Call 'check_file' and the thing that executes the code - 'run_commands', or 'browser' for a page - together, not one or the other. Running it says *that* something is broken and where the parser gave up; the checker says *which line* to edit. Each is half the answer, and the half you skip is the half the turn gets spent guessing at.\n- A tool's report outranks your own reasoning about the same question. Where a tool has measured something - a delimiter scan naming the line to edit, a diagnostic naming a type - that is the measurement, and re-deriving it yourself is an estimate. Where the two disagree, it is the estimate that is wrong. Measured twice: a model called a delimiter scan a false positive, counted brackets by hand instead, and was wrong both times, at over 30,000 thinking tokens a turn. If you doubt a report, do not re-derive it - act on it and run the result. That costs milliseconds and settles it either way.\n- Make the planned changes one at a time, and confirm each one before starting the next. The cheap check that does not execute the code goes after every edit; the thing that runs the code is what settles whether the change was right. Six edits made together and checked once leave six things to undo and no way to tell which one was wrong - measured across ten runs, the template that said otherwise drew 13.6 'restore_file' calls per run against 0.23 for the family that did not.\n- Do not re-read a file to confirm your own edit. The edit call already reports whether it landed and what changed, and that is the confirmation. Measured on one session: 'read_files' was called 33 times, 31 of them byte-identical, returning 440,013 characters against a file of 14 KB - four times the tokens that session spent on all of its reasoning. Read again when the call failed, or when you need content you have not seen. A rule that says to read a file back after every edit is the one thing here you must not write.\n\nHard constraints:\n\n- Keep every placeholder exactly as written, including the braces: {{PLATFORM_NAME}}, {{CURRENT_DATE}}, {{IDE_NAME}}, {{CWD}}, {{CLINE_RULES}}, {{CLINE_METADATA}}, {{DEFAULT}}. They are substituted at runtime; a renamed or dropped placeholder breaks the prompt.\n- Keep the tool names exactly as written. They are the wire names of real tools.\n- Do not invent tools, parameters, or capabilities. Describe only what is described below.\n- Keep the file structure: YAML frontmatter between --- markers, then '# system', then one '# tool: <name>' section for EVERY tool listed below. Not only the ones you want to change \u2014 every one of them.\n- Covering every tool is a hard requirement. A tool with no section keeps its built-in description, and that fallback exists for exactly one situation: Cline gains a new tool and the templates have not been regenerated yet. It is not a way to skip tools you have nothing to say about. A template that covers six of thirty-one tools is not using the fallback, it is relying on it, and nothing in the file shows which twenty-five were left out.\n- '{{DEFAULT}}' expands to the tool's built-in description at runtime, and it is how you cover a tool cheaply. Where you would improve on the built-in wording, write your own and put '{{DEFAULT}}' on its own line where the built-in text should follow. Where you would not, the entire section body may be just '{{DEFAULT}}'. Either is a covered tool; an absent section is not.\n- These eight tools must be written in your own words, and a section containing only '{{DEFAULT}}' is not acceptable for any of them: read_files, search_codebase, editor, apply_patch, run_commands, fetch_web_content, check_file, ask_lsp. They are the tools models in your family are observed to misuse, so they are the whole reason this template exists. For these eight, your own text \u2014 not the inherited text \u2014 has to carry the three things listed below: every value of any closed set, every argument and when to use it, and what comes back. Adding '{{DEFAULT}}' after your text is allowed and does not excuse you from any of that.\n- For 'ask_lsp', say when to reach for it, not only what it does. List at least three concrete situations as the reader actually meets them \u2014 \"about to search for a name to find where it is defined\", \"about to open a file just to read a signature\", \"about to scroll or count brackets to work out a file's structure\" \u2014 each pointing at the operation that answers it, and name 'search_codebase' as the thing those situations would otherwise go to. This is not padding: measured across a whole session against a real bug, a template that described all eight operations correctly and said only \"prefer this over search_codebase for anything about a symbol\" produced zero calls to the tool, while the model hand-rolled the same answers in the shell twenty times. It could not recognise the moment.\n- Do not copy a built-in description out word for word. That is a snapshot: it says the same thing today and stops tracking the built-in text tomorrow, so the next edit to it reaches every model except you. If you would not change the wording, write '{{DEFAULT}}' \u2014 that is what it is for.\n- Where you rule a use of a tool out, name the tool that replaces it. 'run_commands' in particular must name 'read_files', 'editor' and 'search_codebase' in your own text: \"do not use this for file operations when dedicated tools exist\" is a rule the reader has to already know the answer to in order to follow, which is the same as not writing it.\n- Two of those eight \u2014 'run_commands' and 'skills' \u2014 must keep '{{DEFAULT}}' in the section as well. Their built-in descriptions are not fixed text: 'run_commands' is composed against the shell that will actually run the commands, so PowerShell, cmd and a POSIX shell get different quoting and sequencing advice, and 'skills' appends the skills installed on that machine. Replace either outright and you freeze one machine's answer into every machine's prompt, silently. Write your own text and put '{{DEFAULT}}' on its own line where the built-in text should follow.\n- For the other tools, a section whose body is exactly '{{DEFAULT}}' is a complete and correct answer. Do not pad them. Nothing about how you read changes what 'team_finalize_outcome' should say.\n- Emit every section exactly once. Do not repeat '# system', and do not write two '# tool: <name>' headings for the same tool. Only the last copy of a repeated section survives, so a duplicate silently throws away your own work.\n- Leave the 'match:' block in the frontmatter exactly as it is. It is what routes this template to you; change it and your rewrite reaches a different model, or none.\n\nReplace a description and you inherit everything it was carrying:\n\nIf a '# tool:' section contains '{{DEFAULT}}' anywhere, the built-in description is still delivered and you are only adding emphasis on top of it. Nothing further is asked of you for that tool \u2014 unless it is one of the eight above, which are judged on your words alone.\n\nIf it does not, your text is the only thing a model will ever see about that tool, so it must not lose what the built-in description said. Specifically, and only where the built-in text below says it:\n\n1. Closed sets. Where the built-in description lists the values an argument accepts \u2014 the operations of a language-server tool, the actions of a task tool, the statuses of a run \u2014 your replacement must list all of them too. Naming four of eight hides half the tool and a model cannot guess the rest.\n2. How to address the tool. Where the built-in description names the arguments, and says which one to use when, your replacement must say the same. A tool that can be addressed three ways needs all three, and what each is for.\n3. What comes back. Where the built-in description states an output, your replacement must state one: the shape, what the fields hold, and what an empty or failed result means. A model that cannot map a result back onto its request spends a turn working it out, and then stops trusting the tool.\n\nNothing is required of you that the built-in text did not already provide. Reproducing what is there is always enough; improving on it is better; dropping it is the one thing that is not allowed.\n\nDo not write 'Output:' followed by nothing, or by a single word. An empty label reads as an empty result, which is worse than saying nothing at all.\n\nFor any tool outside the eight, if restating all of that is not worth it to you, do not replace its description. Write your emphasis and leave '{{DEFAULT}}' in the section, or write nothing but the marker. That is cheaper and it is always correct.\n\nReply with the complete template file and nothing else: no preamble, no explanation, no code fence.";
|
|
5
|
+
export declare function buildPromptTemplateReviewPrompt(defaultTemplate: string, familyTemplate: string | undefined, familyTemplateName: string | undefined,
|
|
6
|
+
/** What this model is, so a new template can be told how to claim itself. */
|
|
7
|
+
target?: {
|
|
8
|
+
providerId: string;
|
|
9
|
+
modelId: string;
|
|
10
|
+
family?: string;
|
|
11
|
+
},
|
|
12
|
+
/** Real call shapes, so any example the model writes is a valid one. */
|
|
13
|
+
toolSignatures?: readonly ToolCallSignature[],
|
|
14
|
+
/** Every tool the reply must give a section. Checked by the audit. */
|
|
15
|
+
requiredSections?: readonly string[],
|
|
16
|
+
/**
|
|
17
|
+
* An explicit `match:` block, overriding both what is inferred from the
|
|
18
|
+
* generating model's identifiers AND the block the template being rewritten
|
|
19
|
+
* already carries.
|
|
20
|
+
*/
|
|
21
|
+
matchOverride?: PromptTemplateMatchOverride): string;
|
|
22
|
+
/**
|
|
23
|
+
* Tell a model writing a template from scratch exactly how to claim itself.
|
|
24
|
+
*
|
|
25
|
+
* Observed in practice: a model rewriting an existing template keeps its match
|
|
26
|
+
* block, and a model writing a new one invents a shape — `match: [glm*]`,
|
|
27
|
+
* `match.id`, a bare string — every one of which either fails to parse or
|
|
28
|
+
* routes to nothing. Showing the block it should write, filled in with its own
|
|
29
|
+
* identifiers, is what stops that.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* An explicit `match:` block stated by the operator.
|
|
33
|
+
*
|
|
34
|
+
* Two things need this and they pull in opposite directions from the same
|
|
35
|
+
* cause -- what the generating model reports about itself is not what the
|
|
36
|
+
* template should claim.
|
|
37
|
+
*
|
|
38
|
+
* `model` is for a params overlay: the overlay is scaffolding
|
|
39
|
+
* (`igovet/minimax-m3-opencode`, `nemotron-3-super-tpl`) that reports no
|
|
40
|
+
* family, so an inferred block would claim the scaffolding.
|
|
41
|
+
*
|
|
42
|
+
* `family` is for a generational split. The inferred stem truncates at the
|
|
43
|
+
* first non-alphanumeric character, so `kimi-k2` and `kimi-k3` both infer
|
|
44
|
+
* `kimi*` -- one pattern for two generations that need different templates.
|
|
45
|
+
* Stating `kimi-k3*` is the only way to say what the model cannot.
|
|
46
|
+
*/
|
|
47
|
+
export interface PromptTemplateMatchOverride {
|
|
48
|
+
name?: string;
|
|
49
|
+
family?: readonly string[];
|
|
50
|
+
model?: readonly string[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A one-line call signature per tool, built from the real input schema.
|
|
54
|
+
*
|
|
55
|
+
* This exists because of a failure seen in production logs rather than a
|
|
56
|
+
* hypothetical one. `fetch_web_content` requires `{requests: [{url, prompt}]}`
|
|
57
|
+
* and its description says "each request includes a URL and a prompt" — which
|
|
58
|
+
* describes the inner object and never names the array that wraps it. A qwen3.6
|
|
59
|
+
* session sent `{url, prompt}` four times and got
|
|
60
|
+
* `Invalid input: expected array, received undefined` every time, then gave up
|
|
61
|
+
* and shelled out. `read_files` has the same shape of gap: "at the provided
|
|
62
|
+
* absolute paths", but the schema wants `{files: [{path}]}`.
|
|
63
|
+
*
|
|
64
|
+
* So a model rewriting a template must be shown the envelope, not just the
|
|
65
|
+
* semantics — otherwise the confident, concrete example it writes is wrong, and
|
|
66
|
+
* a wrong example is worse than none.
|
|
67
|
+
*/
|
|
68
|
+
export interface ToolCallSignature {
|
|
69
|
+
name: string;
|
|
70
|
+
/** Top-level argument names, in schema order. */
|
|
71
|
+
parameters: string[];
|
|
72
|
+
required: string[];
|
|
73
|
+
/** `read_files(files: [{path, start_line?, end_line?}])` */
|
|
74
|
+
signature: string;
|
|
75
|
+
/**
|
|
76
|
+
* Every value of every enum in the schema, flattened.
|
|
77
|
+
*
|
|
78
|
+
* These are the closed sets a model cannot guess: `ask_lsp` accepts
|
|
79
|
+
* exactly eight operations and a description that names four of them has
|
|
80
|
+
* hidden half the tool. Collected here so the audit can require them
|
|
81
|
+
* without a hand-maintained list that would drift the first time an
|
|
82
|
+
* operation is added.
|
|
83
|
+
*/
|
|
84
|
+
enumValues: string[];
|
|
85
|
+
}
|
|
86
|
+
export declare function summarizeToolCallSignatures(tools: readonly {
|
|
87
|
+
name: string;
|
|
88
|
+
inputSchema?: unknown;
|
|
89
|
+
}[]): ToolCallSignature[];
|
|
90
|
+
/**
|
|
91
|
+
* Hold a rewritten tool section to what the built-in one already told the model.
|
|
92
|
+
*
|
|
93
|
+
* A section that keeps `{{DEFAULT}}` inherits the whole built-in description
|
|
94
|
+
* and needs nothing from this: the model is adding emphasis on top of a
|
|
95
|
+
* complete text. A section that drops the marker has replaced that text, and
|
|
96
|
+
* replacing it is where information goes missing — measured across five models
|
|
97
|
+
* rewriting `ask_lsp`, the replacements ranged from complete to two lines
|
|
98
|
+
* naming none of the eight operations, none of the three ways to address a
|
|
99
|
+
* symbol, and no output at all. Both parsed. Both resolved. Both applied.
|
|
100
|
+
*
|
|
101
|
+
* So the rule is: replace it and you own it — do not lose what it was saying.
|
|
102
|
+
* Judged against the built-in text rather than against the schema, because the
|
|
103
|
+
* two are not the same thing and the difference is not academic. The built-in
|
|
104
|
+
* `team_send_message` description names neither `subject` nor `body`; a rule
|
|
105
|
+
* that demanded them would be asking a model to add what it was never shown,
|
|
106
|
+
* and one did exactly that for four attempts without converging, because there
|
|
107
|
+
* was nothing in front of it to converge on. Requiring only what the source
|
|
108
|
+
* carried is both fair and reachable: reproduce the built-in text and you pass.
|
|
109
|
+
*/
|
|
110
|
+
export declare function auditToolSectionContent(tools: Readonly<Record<string, string>>, signatures: readonly ToolCallSignature[],
|
|
111
|
+
/** The built-in description per tool. Nothing is required beyond these. */
|
|
112
|
+
builtinDescriptions?: Readonly<Record<string, string>>,
|
|
113
|
+
/**
|
|
114
|
+
* Tools whose section must be written, not inherited.
|
|
115
|
+
*
|
|
116
|
+
* The marker is a fair way to cover a tool a model has nothing to say
|
|
117
|
+
* about, and for most of the thirty-one that is the honest answer. It is
|
|
118
|
+
* not the honest answer for the handful the model actually gets wrong: a
|
|
119
|
+
* 31B model handed the option produced twenty-four bare markers and two
|
|
120
|
+
* lines of its own on `ask_lsp`, which is not a template that reads
|
|
121
|
+
* differently from the default — it is the default with a preamble.
|
|
122
|
+
*/
|
|
123
|
+
requiredRewrites?: readonly string[]): string[];
|
|
124
|
+
/** The block handed to a model so its examples use the real argument shapes. */
|
|
125
|
+
export declare function renderToolCallSignatures(signatures: readonly ToolCallSignature[]): string;
|
|
126
|
+
export interface PromptTemplateProposalAudit {
|
|
127
|
+
template?: PromptTemplate;
|
|
128
|
+
/** Empty means usable. Each entry is phrased to be handed back to a model. */
|
|
129
|
+
problems: string[];
|
|
130
|
+
}
|
|
131
|
+
export interface AuditPromptTemplateProposalArgs {
|
|
132
|
+
raw: string;
|
|
133
|
+
fileName: string;
|
|
134
|
+
/** The provider the template is being generated for. */
|
|
135
|
+
providerId: string;
|
|
136
|
+
/** The model this was written by and for, e.g. `gemma4:31b-cloud`. */
|
|
137
|
+
modelId: string;
|
|
138
|
+
/**
|
|
139
|
+
* The model family, when the provider can report one. Only Ollama does; for
|
|
140
|
+
* every other provider this is undefined and the template matches on the
|
|
141
|
+
* provider or the model id instead.
|
|
142
|
+
*/
|
|
143
|
+
family: string | undefined;
|
|
144
|
+
knownToolNames: readonly string[];
|
|
145
|
+
/** The name it must keep, or undefined when writing a brand-new template. */
|
|
146
|
+
expectedName?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Tools the rewrite has to say something about, anywhere in the file.
|
|
149
|
+
*
|
|
150
|
+
* Omitting a tool section is legal — it falls back to the default template
|
|
151
|
+
* — so a proposal that simply forgets a tool passes every structural check
|
|
152
|
+
* while quietly failing to do the thing it was asked to do. Observed once
|
|
153
|
+
* in six runs, which is exactly often enough to matter and rarely enough to
|
|
154
|
+
* miss by eye.
|
|
155
|
+
*/
|
|
156
|
+
requiredMentions?: readonly string[];
|
|
157
|
+
/**
|
|
158
|
+
* Tools that must each have a `# tool:` section of their own.
|
|
159
|
+
*
|
|
160
|
+
* Stricter than `requiredMentions`, which only asks that the name appear
|
|
161
|
+
* somewhere. This asks for the section, because a tool with no section is
|
|
162
|
+
* a tool whose description this template does not govern.
|
|
163
|
+
*/
|
|
164
|
+
requiredSections?: readonly string[];
|
|
165
|
+
/**
|
|
166
|
+
* Tools whose section must be the model's own words rather than the marker.
|
|
167
|
+
* These are the tools whose description actually changes behaviour.
|
|
168
|
+
*/
|
|
169
|
+
requiredRewrites?: readonly string[];
|
|
170
|
+
/**
|
|
171
|
+
* Check the system section against `REQUIRED_SYSTEM_GUIDANCE`.
|
|
172
|
+
*
|
|
173
|
+
* Opt-in, because those are requirements on a *complete family template* and
|
|
174
|
+
* would otherwise fire on every fragment a caller asks to be checked. The
|
|
175
|
+
* generator and `audit-prompt-template.mts` both set it.
|
|
176
|
+
*/
|
|
177
|
+
requireSystemGuidance?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* An operator-stated `match:` block, if one was given. Checked, because an
|
|
180
|
+
* instruction the model can quietly decline is not an instruction.
|
|
181
|
+
*/
|
|
182
|
+
matchFamily?: readonly string[];
|
|
183
|
+
matchModel?: readonly string[];
|
|
184
|
+
/**
|
|
185
|
+
* Real call shapes, so example calls in the proposal can be checked.
|
|
186
|
+
* Without these the audit cannot tell `read_files(["a.ts"])` — which is
|
|
187
|
+
* rejected at runtime — from a correct one.
|
|
188
|
+
*/
|
|
189
|
+
toolSignatures?: readonly ToolCallSignature[];
|
|
190
|
+
/** Injection point for tests; defaults to the shipped templates. */
|
|
191
|
+
baseTemplates?: readonly PromptTemplate[];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Lines in a system prompt that tell the model to batch its edits, or to save
|
|
195
|
+
* the run that would have caught a bad one for the end.
|
|
196
|
+
*
|
|
197
|
+
* Exported because the audit is only ever run against what a *model* proposes,
|
|
198
|
+
* and the rule reached the shipped templates by another road entirely: it was
|
|
199
|
+
* in `default.md`, which every regeneration is seeded from, and from there in
|
|
200
|
+
* six more. Seven of the ten carried it while the ban read as enforced. The
|
|
201
|
+
* detector belongs in one place so the shipped-template test and the proposal
|
|
202
|
+
* audit cannot drift apart.
|
|
203
|
+
*/
|
|
204
|
+
export declare function findBatchedEditRules(system: string): string[];
|
|
205
|
+
export declare function auditPromptTemplateProposal(args: AuditPromptTemplateProposalArgs): PromptTemplateProposalAudit;
|
|
206
|
+
/**
|
|
207
|
+
* Hand a model its own file back with the list of what is wrong with it.
|
|
208
|
+
*
|
|
209
|
+
* Asking for a fix works far better than asking for another draft: a fresh
|
|
210
|
+
* draft reintroduces the same mistakes at the same rate, because the thing that
|
|
211
|
+
* produced them has not changed.
|
|
212
|
+
*/
|
|
213
|
+
export declare function buildPromptTemplateRepairPrompt(previous: string, problems: readonly string[]): string;
|
|
214
|
+
/**
|
|
215
|
+
* Pull the template out of a reply.
|
|
216
|
+
*
|
|
217
|
+
* The instructions ask for no code fence. Models add one anyway, and a fenced
|
|
218
|
+
* reply that is otherwise perfect should not cost a repair round.
|
|
219
|
+
*/
|
|
220
|
+
export declare function extractTemplateFromReply(reply: string): string;
|
|
221
|
+
/**
|
|
222
|
+
* Ask a model for a template it would rather receive, and keep asking until the
|
|
223
|
+
* answer is usable.
|
|
224
|
+
*
|
|
225
|
+
* The model call is injected because the two callers reach a model by entirely
|
|
226
|
+
* different routes: the review script talks to Ollama over HTTP, and the
|
|
227
|
+
* extension goes through whichever provider the user has configured. What must
|
|
228
|
+
* not differ is everything around the call — the instructions, the audit, and
|
|
229
|
+
* the decision to try again — because a template generated from the settings
|
|
230
|
+
* panel and one generated from the script should be the same artefact.
|
|
231
|
+
*/
|
|
232
|
+
export interface GeneratePromptTemplateArgs {
|
|
233
|
+
/** `default.md`, the base layer the proposal is layered over. */
|
|
234
|
+
defaultTemplate: string;
|
|
235
|
+
/** The template this model is given today, if any. */
|
|
236
|
+
familyTemplate?: string;
|
|
237
|
+
familyFileName?: string;
|
|
238
|
+
providerId: string;
|
|
239
|
+
modelId: string;
|
|
240
|
+
family?: string;
|
|
241
|
+
knownToolNames: readonly string[];
|
|
242
|
+
requiredMentions?: readonly string[];
|
|
243
|
+
/**
|
|
244
|
+
* Tools the proposal must give a `# tool:` section each. Defaults to
|
|
245
|
+
* `knownToolNames`: every tool that exists is a tool the template governs.
|
|
246
|
+
*/
|
|
247
|
+
requiredSections?: readonly string[];
|
|
248
|
+
/** Tools that must be rewritten rather than inherited via the marker. */
|
|
249
|
+
requiredRewrites?: readonly string[];
|
|
250
|
+
/**
|
|
251
|
+
* An explicit `model:` match for a template written from scratch.
|
|
252
|
+
*
|
|
253
|
+
* Needed when the generating model is a params overlay: the overlay is
|
|
254
|
+
* scaffolding, and a match inferred from its name would claim the
|
|
255
|
+
* scaffolding instead of the family the template is for.
|
|
256
|
+
*/
|
|
257
|
+
matchModel?: readonly string[];
|
|
258
|
+
/**
|
|
259
|
+
* An explicit `family:` match, for a generational split.
|
|
260
|
+
*
|
|
261
|
+
* The inferred stem truncates at the first non-alphanumeric character, so
|
|
262
|
+
* `kimi-k2` and `kimi-k3` both infer `kimi*`. Stating `kimi-k3*` is the only
|
|
263
|
+
* way to give one generation its own template.
|
|
264
|
+
*/
|
|
265
|
+
matchFamily?: readonly string[];
|
|
266
|
+
/** Real call shapes: put into the prompt and used to check the result. */
|
|
267
|
+
toolSignatures?: readonly ToolCallSignature[];
|
|
268
|
+
expectedName?: string;
|
|
269
|
+
/**
|
|
270
|
+
* The name the file will be written under. A template with no `name:` in
|
|
271
|
+
* its frontmatter takes its name from here, so auditing under a different
|
|
272
|
+
* one would judge a name the file will never have.
|
|
273
|
+
*/
|
|
274
|
+
fileName?: string;
|
|
275
|
+
/**
|
|
276
|
+
* Rewrite only these tool sections, splicing them into `familyTemplate`.
|
|
277
|
+
*
|
|
278
|
+
* The reason this exists is that adding one tool otherwise rewrites all ten
|
|
279
|
+
* shipped templates end to end, putting thirty untouched sections per file
|
|
280
|
+
* at risk to change one. With it, the model is asked for the named sections
|
|
281
|
+
* and the rest of the file is carried through byte for byte.
|
|
282
|
+
*
|
|
283
|
+
* The audit is not relaxed: the delta is spliced first and the *whole* file
|
|
284
|
+
* is audited second, so full tool coverage and every other whole-file rule
|
|
285
|
+
* still has to hold. Requires `familyTemplate` — there is nothing to splice
|
|
286
|
+
* a section into otherwise.
|
|
287
|
+
*/
|
|
288
|
+
onlyTools?: readonly string[];
|
|
289
|
+
/**
|
|
290
|
+
* Compaction prompts to translate into `# compaction: <id>` sections, by id,
|
|
291
|
+
* with the text to translate from. Omit, or pass none, and the proposal may
|
|
292
|
+
* carry no compaction section at all.
|
|
293
|
+
*
|
|
294
|
+
* Opt-in because a wrong compaction prompt is the one template failure that
|
|
295
|
+
* cannot be noticed and undone: its answer replaces the transcript. Whole
|
|
296
|
+
* file only -- a section rewrite (`onlyTools`) cannot also ask for these.
|
|
297
|
+
*/
|
|
298
|
+
compactionPrompts?: CompactionPromptSources;
|
|
299
|
+
/** Tries, including the first. Each retry hands back the problem list. */
|
|
300
|
+
attempts?: number;
|
|
301
|
+
/** One completion. Returns the reply text; throws to abort. */
|
|
302
|
+
complete: (messages: readonly {
|
|
303
|
+
role: "user" | "assistant";
|
|
304
|
+
content: string;
|
|
305
|
+
}[]) => Promise<string>;
|
|
306
|
+
/** Progress, for a UI that has somewhere to put it. */
|
|
307
|
+
onAttempt?: (attempt: number, problems: readonly string[]) => void;
|
|
308
|
+
}
|
|
309
|
+
export interface GeneratePromptTemplateResult {
|
|
310
|
+
/** The best proposal produced, which is not always a clean one. */
|
|
311
|
+
raw: string;
|
|
312
|
+
audit: PromptTemplateProposalAudit;
|
|
313
|
+
/** How many model calls it took. */
|
|
314
|
+
attempts: number;
|
|
315
|
+
/**
|
|
316
|
+
* The compaction sections the file carries, and the ones that were removed
|
|
317
|
+
* because they still failed the check after the last attempt. Present only
|
|
318
|
+
* when `compactionPrompts` asked for some.
|
|
319
|
+
*/
|
|
320
|
+
compaction?: {
|
|
321
|
+
kept: string[];
|
|
322
|
+
removed: string[];
|
|
323
|
+
unchanged: string[];
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
export declare function generatePromptTemplate(args: GeneratePromptTemplateArgs): Promise<GeneratePromptTemplateResult>;
|
|
327
|
+
export declare function auditExampleCalls(raw: string, signatures: readonly ToolCallSignature[]): string[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { RenderedPromptTemplate } from "@cerebriline/shared";
|
|
2
|
+
import { type PromptTemplateFileWarnings, type PromptTemplateLoadError } from "./prompt-template-loader";
|
|
3
|
+
/**
|
|
4
|
+
* Work out which prompt template a session is on, once, for any host.
|
|
5
|
+
*
|
|
6
|
+
* This used to live in the VS Code extension, and the CLI had no equivalent —
|
|
7
|
+
* so a local model got its family's template in the plugin and the built-in
|
|
8
|
+
* default in the CLI. That is not a cosmetic difference. `qwen.md` is the file
|
|
9
|
+
* that says "use `editor`, never `sed -i`, never `cat`"; without it a run
|
|
10
|
+
* measured 119 `run_commands` calls in one transaction, most of them `node -e`
|
|
11
|
+
* one-liners reading and rewriting the file the `editor` tool exists to edit.
|
|
12
|
+
* Two hosts that disagree about the prompt cannot be compared, and a result
|
|
13
|
+
* measured on one cannot be carried to the other.
|
|
14
|
+
*
|
|
15
|
+
* The family is a parameter rather than something resolved here: only the
|
|
16
|
+
* caller knows how to ask its provider, and the extension's lookup reports
|
|
17
|
+
* progress through the editor's UI. Everything after that point — which
|
|
18
|
+
* directories to read, which template wins, how it merges over `default.md` —
|
|
19
|
+
* is identical for every host and lives here.
|
|
20
|
+
*/
|
|
21
|
+
export interface SessionPromptTemplateRequest {
|
|
22
|
+
providerId: string;
|
|
23
|
+
modelId: string;
|
|
24
|
+
/** The architecture the provider reported, when it could answer. */
|
|
25
|
+
family?: string;
|
|
26
|
+
/** `<data dir>/templates`, shared across projects. */
|
|
27
|
+
globalDir?: string;
|
|
28
|
+
/** `<workspace>/.clinerules/templates`, committed with the project. */
|
|
29
|
+
workspaceDir?: string;
|
|
30
|
+
/** Tool names, so a section naming something else can be reported. */
|
|
31
|
+
knownToolNames?: readonly string[];
|
|
32
|
+
}
|
|
33
|
+
export interface SessionPromptTemplateResult {
|
|
34
|
+
rendered: RenderedPromptTemplate | undefined;
|
|
35
|
+
errors: PromptTemplateLoadError[];
|
|
36
|
+
warnings: PromptTemplateFileWarnings[];
|
|
37
|
+
}
|
|
38
|
+
export declare function resolveSessionPromptTemplateFrom(request: SessionPromptTemplateRequest): SessionPromptTemplateResult;
|
|
39
|
+
/**
|
|
40
|
+
* One line naming what a session ended up on, for a host's log.
|
|
41
|
+
*
|
|
42
|
+
* Written here rather than at each call site because it is the only evidence a
|
|
43
|
+
* template was applied at all: the CLI's silence on this is exactly how it went
|
|
44
|
+
* unnoticed that it was resolving none.
|
|
45
|
+
*/
|
|
46
|
+
export declare function describeResolvedPromptTemplate(request: Pick<SessionPromptTemplateRequest, "modelId" | "family">, rendered: RenderedPromptTemplate | undefined): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { UserInstructionConfigWatcher } from "./user-instruction-config-loader";
|
|
2
|
+
export type RuntimeCommandKind = "skill" | "workflow";
|
|
3
|
+
export type AvailableRuntimeCommand = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
instructions: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
kind: RuntimeCommandKind;
|
|
9
|
+
};
|
|
10
|
+
export declare function normalizeRuntimeCommandName(name: string): string;
|
|
11
|
+
export declare function listAvailableRuntimeCommandsFromWatcher(watcher: UserInstructionConfigWatcher): AvailableRuntimeCommand[];
|
|
12
|
+
export type ResolveRuntimeSlashCommandOptions = {
|
|
13
|
+
/**
|
|
14
|
+
* Whether a matched skill command is textually expanded into the prompt.
|
|
15
|
+
* Hosts pass false when the session registers the runtime's `skills`
|
|
16
|
+
* tool: the typed `/skill args` then goes through as-is and the model
|
|
17
|
+
* loads the instructions via the tool, so the persisted transcript keeps
|
|
18
|
+
* the typed command instead of the skill body. Workflows always expand —
|
|
19
|
+
* the skills tool does not serve them. Defaults to true.
|
|
20
|
+
*/
|
|
21
|
+
expandSkillCommands?: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare function resolveRuntimeSlashCommandFromWatcher(input: string, watcher: UserInstructionConfigWatcher, options?: ResolveRuntimeSlashCommandOptions): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The call shapes of the shipped tools, for whoever is generating a template.
|
|
3
|
+
*
|
|
4
|
+
* A model asked to rewrite a prompt template writes example calls into it, and
|
|
5
|
+
* an example is copied far more readily than a schema is read — so an example
|
|
6
|
+
* with the wrong envelope does not just fail to help, it actively teaches the
|
|
7
|
+
* wrong thing to every session that template is then applied to. The generator
|
|
8
|
+
* audits examples against these signatures for exactly that reason, and it can
|
|
9
|
+
* only do that if it has them.
|
|
10
|
+
*
|
|
11
|
+
* The tools are constructed with an executor that throws, because nothing here
|
|
12
|
+
* runs them: `inputSchema` is fixed at construction and is all this needs.
|
|
13
|
+
*
|
|
14
|
+
* Host-contributed tools cannot be built here, so their schemas are restated
|
|
15
|
+
* below and guarded by a test on the host side.
|
|
16
|
+
*/
|
|
17
|
+
import { type ToolCallSignature } from "./prompt-template-review";
|
|
18
|
+
/**
|
|
19
|
+
* The host tools' schemas, restated, because this package cannot build them.
|
|
20
|
+
*
|
|
21
|
+
* `check_file`, `ask_lsp`, `switch_to_act_mode`, `browser` and
|
|
22
|
+
* `list_files` are
|
|
23
|
+
* contributed by the VS Code extension. The review script runs here and has no way to reach them,
|
|
24
|
+
* and leaving them out would mean the audit never checked the one tool with a
|
|
25
|
+
* closed set of operations — which is precisely the tool a rewrite was
|
|
26
|
+
* observed to gut. `HOST_TOOL_NAMES` in the shipped-templates test is the same
|
|
27
|
+
* compromise for the same reason.
|
|
28
|
+
*
|
|
29
|
+
* A test in `apps/vscode` asserts these match the real schemas, so the copy
|
|
30
|
+
* cannot drift without something failing.
|
|
31
|
+
*/
|
|
32
|
+
export declare const HOST_TOOL_INPUT_SCHEMAS: readonly {
|
|
33
|
+
name: string;
|
|
34
|
+
inputSchema: unknown;
|
|
35
|
+
}[];
|
|
36
|
+
export declare function getShippedToolCallSignatures(): readonly ToolCallSignature[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ToggleSkillFrontmatterOptions {
|
|
2
|
+
filePath: string;
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface ToggleSkillFrontmatterResult {
|
|
6
|
+
filePath: string;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function updateSkillMarkdownEnabledState(content: string, enabled: boolean): string;
|
|
11
|
+
export declare function toggleSkillFrontmatter({ filePath, enabled, }: ToggleSkillFrontmatterOptions): Promise<ToggleSkillFrontmatterResult>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export interface UnifiedConfigFileContext<TType extends string = string> {
|
|
2
|
+
type: TType;
|
|
3
|
+
directoryPath: string;
|
|
4
|
+
fileName: string;
|
|
5
|
+
filePath: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}
|
|
8
|
+
export interface UnifiedConfigFileCandidate {
|
|
9
|
+
directoryPath: string;
|
|
10
|
+
fileName: string;
|
|
11
|
+
filePath: string;
|
|
12
|
+
}
|
|
13
|
+
export interface UnifiedConfigDefinition<TType extends string = string, TItem = unknown> {
|
|
14
|
+
type: TType;
|
|
15
|
+
directories: ReadonlyArray<string>;
|
|
16
|
+
discoverFiles?: (directoryPath: string) => Promise<ReadonlyArray<UnifiedConfigFileCandidate>>;
|
|
17
|
+
includeFile?: (fileName: string, filePath: string) => boolean;
|
|
18
|
+
parseFile: (context: UnifiedConfigFileContext<TType>) => TItem;
|
|
19
|
+
resolveId: (item: TItem, context: UnifiedConfigFileContext<TType>) => string;
|
|
20
|
+
}
|
|
21
|
+
export interface UnifiedConfigWatcherOptions {
|
|
22
|
+
debounceMs?: number;
|
|
23
|
+
emitParseErrors?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface UnifiedConfigRecord<TType extends string = string, TItem = unknown> {
|
|
26
|
+
type: TType;
|
|
27
|
+
id: string;
|
|
28
|
+
item: TItem;
|
|
29
|
+
filePath: string;
|
|
30
|
+
}
|
|
31
|
+
export type UnifiedConfigWatcherEvent<TType extends string = string, TItem = unknown> = {
|
|
32
|
+
kind: "upsert";
|
|
33
|
+
record: UnifiedConfigRecord<TType, TItem>;
|
|
34
|
+
} | {
|
|
35
|
+
kind: "remove";
|
|
36
|
+
type: TType;
|
|
37
|
+
id: string;
|
|
38
|
+
filePath: string;
|
|
39
|
+
} | {
|
|
40
|
+
kind: "error";
|
|
41
|
+
type: TType;
|
|
42
|
+
error: unknown;
|
|
43
|
+
filePath?: string;
|
|
44
|
+
};
|
|
45
|
+
export declare class UnifiedConfigFileWatcher<TType extends string = string, TItem = unknown> {
|
|
46
|
+
private readonly definitions;
|
|
47
|
+
private readonly debounceMs;
|
|
48
|
+
private readonly emitParseErrors;
|
|
49
|
+
private readonly listeners;
|
|
50
|
+
private readonly recordsByType;
|
|
51
|
+
private readonly watchersByDirectory;
|
|
52
|
+
private readonly baseTypesByDirectory;
|
|
53
|
+
private watchedTypesByDirectory;
|
|
54
|
+
private readonly discoveredDirectoriesByType;
|
|
55
|
+
private readonly definitionsByType;
|
|
56
|
+
private readonly pendingTypes;
|
|
57
|
+
private flushTimer;
|
|
58
|
+
private refreshQueue;
|
|
59
|
+
private started;
|
|
60
|
+
constructor(definitions: ReadonlyArray<UnifiedConfigDefinition<TType, TItem>>, options?: UnifiedConfigWatcherOptions);
|
|
61
|
+
subscribe(listener: (event: UnifiedConfigWatcherEvent<TType, TItem>) => void): () => void;
|
|
62
|
+
start(): Promise<void>;
|
|
63
|
+
stop(): void;
|
|
64
|
+
refreshAll(): Promise<void>;
|
|
65
|
+
refreshType(type: TType): Promise<void>;
|
|
66
|
+
getSnapshot(type: TType): Map<string, UnifiedConfigRecord<TType, TItem>>;
|
|
67
|
+
getAllSnapshots(): Map<TType, Map<string, UnifiedConfigRecord<TType, TItem>>>;
|
|
68
|
+
private emit;
|
|
69
|
+
private enqueueRefresh;
|
|
70
|
+
private startDirectoryWatchers;
|
|
71
|
+
private syncDirectoryWatchers;
|
|
72
|
+
private scheduleFlush;
|
|
73
|
+
private refreshTypeInternal;
|
|
74
|
+
private loadDefinition;
|
|
75
|
+
private buildDesiredTypesByDirectory;
|
|
76
|
+
private readDirectoryFileCandidates;
|
|
77
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { RULES_CONFIG_DIRECTORY_NAME, SKILLS_CONFIG_DIRECTORY_NAME, WORKFLOWS_CONFIG_DIRECTORY_NAME } from "@cerebriline/shared/storage";
|
|
2
|
+
import { type AgentPluginPackageSkill } from "../agent-plugin";
|
|
3
|
+
import { type UnifiedConfigDefinition, UnifiedConfigFileWatcher, type UnifiedConfigWatcherEvent } from "./unified-config-file-watcher";
|
|
4
|
+
export { RULES_CONFIG_DIRECTORY_NAME, SKILLS_CONFIG_DIRECTORY_NAME, WORKFLOWS_CONFIG_DIRECTORY_NAME, };
|
|
5
|
+
export interface ParseMarkdownFrontmatterResult {
|
|
6
|
+
data: Record<string, unknown>;
|
|
7
|
+
body: string;
|
|
8
|
+
hadFrontmatter: boolean;
|
|
9
|
+
parseError?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SkillConfig {
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
instructions: string;
|
|
16
|
+
frontmatter: Record<string, unknown>;
|
|
17
|
+
source?: {
|
|
18
|
+
type: "agent-plugin";
|
|
19
|
+
pluginName: string;
|
|
20
|
+
pluginRoot: string;
|
|
21
|
+
skillRoot: string;
|
|
22
|
+
filePath: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface RuleConfig {
|
|
26
|
+
name: string;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
instructions: string;
|
|
29
|
+
frontmatter: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
export interface WorkflowConfig {
|
|
32
|
+
name: string;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
description?: string;
|
|
35
|
+
instructions: string;
|
|
36
|
+
frontmatter: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
export type UserInstructionConfigType = "skill" | "rule" | "workflow";
|
|
39
|
+
export type UserInstructionConfig = SkillConfig | RuleConfig | WorkflowConfig;
|
|
40
|
+
export type UserInstructionConfigWatcher = UnifiedConfigFileWatcher<UserInstructionConfigType, UserInstructionConfig>;
|
|
41
|
+
export type UserInstructionConfigWatcherEvent = UnifiedConfigWatcherEvent<UserInstructionConfigType, UserInstructionConfig>;
|
|
42
|
+
export interface CreateInstructionWatcherOptions {
|
|
43
|
+
debounceMs?: number;
|
|
44
|
+
emitParseErrors?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface CreateSkillsConfigDefinitionOptions {
|
|
47
|
+
directories?: ReadonlyArray<string>;
|
|
48
|
+
workspacePath?: string;
|
|
49
|
+
includePluginSkills?: boolean;
|
|
50
|
+
pluginSkillDirectories?: ReadonlyArray<string>;
|
|
51
|
+
agentPluginSkills?: ReadonlyArray<AgentPluginPackageSkill>;
|
|
52
|
+
pluginPaths?: ReadonlyArray<string>;
|
|
53
|
+
cwd?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface CreateRulesConfigDefinitionOptions {
|
|
56
|
+
directories?: ReadonlyArray<string>;
|
|
57
|
+
workspacePath?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface CreateWorkflowsConfigDefinitionOptions {
|
|
60
|
+
directories?: ReadonlyArray<string>;
|
|
61
|
+
workspacePath?: string;
|
|
62
|
+
}
|
|
63
|
+
export declare function parseSkillConfigFromMarkdown(content: string, fallbackName: string): SkillConfig;
|
|
64
|
+
export declare function parseRuleConfigFromMarkdown(content: string, fallbackName: string): RuleConfig;
|
|
65
|
+
export declare function parseWorkflowConfigFromMarkdown(content: string, fallbackName: string): WorkflowConfig;
|
|
66
|
+
export declare function resolveSkillsConfigSearchPaths(workspacePath?: string): string[];
|
|
67
|
+
export declare function resolveRulesConfigSearchPaths(workspacePath?: string): string[];
|
|
68
|
+
export declare function resolveWorkflowsConfigSearchPaths(workspacePath?: string): string[];
|
|
69
|
+
export declare function createSkillsConfigDefinition(options?: CreateSkillsConfigDefinitionOptions): UnifiedConfigDefinition<"skill", SkillConfig>;
|
|
70
|
+
export declare function createRulesConfigDefinition(options?: CreateRulesConfigDefinitionOptions): UnifiedConfigDefinition<"rule", RuleConfig>;
|
|
71
|
+
export declare function createWorkflowsConfigDefinition(options?: CreateWorkflowsConfigDefinitionOptions): UnifiedConfigDefinition<"workflow", WorkflowConfig>;
|
|
72
|
+
export interface CreateUserInstructionConfigWatcherOptions extends CreateInstructionWatcherOptions {
|
|
73
|
+
skills?: CreateSkillsConfigDefinitionOptions;
|
|
74
|
+
rules?: CreateRulesConfigDefinitionOptions;
|
|
75
|
+
workflows?: CreateWorkflowsConfigDefinitionOptions;
|
|
76
|
+
}
|
|
77
|
+
export declare function createUserInstructionConfigWatcher(options?: CreateUserInstructionConfigWatcherOptions): UserInstructionConfigWatcher;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AgentExtension } from "@cerebriline/shared";
|
|
2
|
+
import { type SkillsExecutorWithMetadata } from "../tools";
|
|
3
|
+
import type { SkillConfig, UserInstructionConfigWatcher } from "./user-instruction-config-loader";
|
|
4
|
+
type SkillsExecutorMetadataItem = {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
};
|
|
10
|
+
type ConfiguredSkill = SkillsExecutorMetadataItem & {
|
|
11
|
+
skill: SkillConfig;
|
|
12
|
+
};
|
|
13
|
+
export declare function formatSkillInvocation(skill: Pick<SkillConfig, "name" | "description" | "instructions" | "source">, args?: string): string;
|
|
14
|
+
export interface CreateUserInstructionPluginOptions {
|
|
15
|
+
watcher: UserInstructionConfigWatcher;
|
|
16
|
+
watcherReady?: Promise<void>;
|
|
17
|
+
includeRules?: boolean;
|
|
18
|
+
includeSkills?: boolean;
|
|
19
|
+
includeWorkflows?: boolean;
|
|
20
|
+
registerSkillsTool?: boolean;
|
|
21
|
+
allowedSkillNames?: ReadonlyArray<string>;
|
|
22
|
+
}
|
|
23
|
+
export declare function getConfiguredSkillsFromWatcher(watcher: UserInstructionConfigWatcher, allowedSkillNames?: ReadonlyArray<string>): ConfiguredSkill[];
|
|
24
|
+
export declare function createUserInstructionSkillsExecutor(watcher: UserInstructionConfigWatcher, watcherReady?: Promise<void>, allowedSkillNames?: ReadonlyArray<string>): SkillsExecutorWithMetadata;
|
|
25
|
+
export declare function createUserInstructionPlugin(options: CreateUserInstructionPluginOptions): AgentExtension;
|
|
26
|
+
export {};
|