@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,82 @@
|
|
|
1
|
+
import type { AgentConfig, PluginSetupContext, WorkspaceInfo } from "@cerebriline/shared";
|
|
2
|
+
import type { PluginLoadDiagnostics } from "./plugin-load-report";
|
|
3
|
+
import type { PluginTargeting } from "./plugin-targeting";
|
|
4
|
+
export declare const CLINE_PLUGIN_IDLE_TIMEOUT_MS_ENV = "CLINE_PLUGIN_IDLE_TIMEOUT_MS";
|
|
5
|
+
export declare const DEFAULT_PLUGIN_SANDBOX_IDLE_TIMEOUT_MS: number;
|
|
6
|
+
export type SandboxedPluginSetupContext = Pick<PluginSetupContext, "session" | "client" | "user" | "workspaceInfo" | "logger">;
|
|
7
|
+
export interface PluginSandboxOptions extends PluginTargeting {
|
|
8
|
+
pluginPaths: string[];
|
|
9
|
+
exportName?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Max wall time for plugin module imports. Defaults to 4000 ms; falls back
|
|
12
|
+
* to the `CLINE_PLUGIN_IMPORT_TIMEOUT_MS` env var when this option is not
|
|
13
|
+
* set, allowing slower hosts (Windows cold-start, CI without warm caches)
|
|
14
|
+
* to raise the ceiling without touching code.
|
|
15
|
+
*/
|
|
16
|
+
importTimeoutMs?: number;
|
|
17
|
+
hookTimeoutMs?: number;
|
|
18
|
+
contributionTimeoutMs?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Reclaim the plugin subprocess after this much time with no calls in
|
|
21
|
+
* flight. Defaults to 30 minutes and can be overridden with
|
|
22
|
+
* `CLINE_PLUGIN_IDLE_TIMEOUT_MS`.
|
|
23
|
+
*/
|
|
24
|
+
idleTimeoutMs?: number;
|
|
25
|
+
onEvent?: (event: {
|
|
26
|
+
name: string;
|
|
27
|
+
payload?: unknown;
|
|
28
|
+
}) => void;
|
|
29
|
+
/**
|
|
30
|
+
* The session's working directory. Forwarded to the sandbox subprocess so
|
|
31
|
+
* that `process.cwd()` returns the correct path inside the sandbox even
|
|
32
|
+
* when `--cwd` was passed without calling `process.chdir()` on the host.
|
|
33
|
+
*/
|
|
34
|
+
cwd?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Structured workspace and git metadata (branch, commit, remotes) generated
|
|
37
|
+
* at session startup. Forwarded to plugins via PluginSetupCtx.workspaceInfo
|
|
38
|
+
* so they can inspect git state without running their own commands.
|
|
39
|
+
*/
|
|
40
|
+
workspaceInfo?: WorkspaceInfo;
|
|
41
|
+
session?: SandboxedPluginSetupContext["session"];
|
|
42
|
+
client?: SandboxedPluginSetupContext["client"];
|
|
43
|
+
user?: SandboxedPluginSetupContext["user"];
|
|
44
|
+
/** Enables a logger bridge that forwards sandbox log calls to the host. */
|
|
45
|
+
logger?: SandboxedPluginSetupContext["logger"];
|
|
46
|
+
/**
|
|
47
|
+
* Enables the telemetry bridge (`ctx.telemetry`) for sandboxed plugins.
|
|
48
|
+
* Set only when the host has a live telemetry service to route
|
|
49
|
+
* `plugin_telemetry` events into, so plugin feature-detection of
|
|
50
|
+
* `ctx.telemetry` means "someone is listening" in both execution modes.
|
|
51
|
+
*/
|
|
52
|
+
telemetryAvailable?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Pick the bootstrap the sandbox subprocess should run.
|
|
56
|
+
*
|
|
57
|
+
* Sibling compiled candidates always match the running host build, so they
|
|
58
|
+
* win. When the host runs from source (the `.ts` bootstrap exists next to
|
|
59
|
+
* this module), the sandbox must run that SAME source bootstrap: the
|
|
60
|
+
* wrapper/executable fallbacks locate compiled bootstraps from a separately
|
|
61
|
+
* installed CLI package (e.g. a published version in the package-manager
|
|
62
|
+
* cache), and mixing that code with a source host silently breaks plugin
|
|
63
|
+
* loading because its module resolution points at the other installation's
|
|
64
|
+
* layout. Those fallbacks exist only for compiled hosts
|
|
65
|
+
* (`bun build --compile`) where import.meta points inside the binary and no
|
|
66
|
+
* sibling file exists on real disk.
|
|
67
|
+
*/
|
|
68
|
+
export declare function selectBootstrapCandidate(options: {
|
|
69
|
+
siblingCandidates: string[];
|
|
70
|
+
sourceBootstrapPath: string;
|
|
71
|
+
installedCandidates: Array<string | undefined>;
|
|
72
|
+
exists?: (path: string) => boolean;
|
|
73
|
+
}): {
|
|
74
|
+
file: string;
|
|
75
|
+
} | {
|
|
76
|
+
sourcePath: string;
|
|
77
|
+
};
|
|
78
|
+
export declare function loadSandboxedPlugins(options: PluginSandboxOptions): Promise<{
|
|
79
|
+
extensions: AgentConfig["extensions"];
|
|
80
|
+
pluginPaths: string[];
|
|
81
|
+
shutdown: () => Promise<void>;
|
|
82
|
+
} & PluginLoadDiagnostics>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PluginManifest } from "@cerebriline/shared";
|
|
2
|
+
export interface PluginTargeting {
|
|
3
|
+
providerId?: string;
|
|
4
|
+
modelId?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function matchesPluginManifestTargeting(manifest: PluginManifest | undefined, targeting: PluginTargeting | undefined): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as XQ}from"node:module";var YQ=XQ(import.meta.url);import{normalizePluginManifest as DQ}from"@cerebriline/shared";function P(Q=process){Q.once("disconnect",()=>Q.exit(0))}import{existsSync as _,readFileSync as O}from"node:fs";import{builtinModules as ZQ,createRequire as R}from"node:module";import{dirname as J,extname as I,isAbsolute as $Q,resolve as q}from"node:path";import{fileURLToPath as m}from"node:url";import{PLUGIN_FILE_EXTENSIONS as GQ}from"@cerebriline/shared";var d=J(m(import.meta.url)),KQ=R(import.meta.url),qQ=q(d,"..","..","..","..",".."),T=wQ(qQ),WQ=["@cerebriline/sdk","@cerebriline/agents","@cerebriline/core","@cerebriline/core/hub","@cerebriline/core/hub/daemon-entry","@cerebriline/core/telemetry","@cerebriline/llms","@cerebriline/llms/browser","@cerebriline/shared","@cerebriline/shared/automation","@cerebriline/shared/browser","@cerebriline/shared/storage","@cerebriline/shared/db","@cerebriline/shared/types"],k=new Set(ZQ.flatMap((Q)=>[Q,Q.replace(/^node:/,"")])),B=new Set(GQ),_Q=["development","node","import","require","default"];function wQ(Q){let U={},X={"@cerebriline/sdk":q(Q,"packages/sdk/src/index.ts"),"@cerebriline/agents":q(Q,"packages/agents/src/index.ts"),"@cerebriline/core":q(Q,"packages/core/src/index.ts"),"@cerebriline/llms":q(Q,"packages/llms/src/index.ts"),"@cerebriline/shared":q(Q,"packages/shared/src/index.ts"),"@cerebriline/shared/storage":q(Q,"packages/shared/src/storage/index.ts"),"@cerebriline/shared/db":q(Q,"packages/shared/src/db/index.ts")};for(let[Z,$]of Object.entries(X))if(_($))U[Z]=$;for(let Z of["agents","core","llms","shared"]){let $=q(Q,"packages",Z),G=q($,"package.json");if(!_(G))continue;try{let Y=JSON.parse(O(G,"utf8"));if(typeof Y.name!=="string"||!Y.exports)continue;if(typeof Y.exports==="string"){let K=q($,Y.exports);if(_(K))U[Y.name]=K;continue}if(typeof Y.exports!=="object")continue;for(let[K,A]of Object.entries(Y.exports)){let L=AQ($,A);if(!L)continue;let w=K==="."?Y.name:`${Y.name}/${K.replace(/^\.\//,"")}`;U[w]=L}}catch{}}return U}function AQ(Q,U){let X=v(U);if(!X)return null;let Z=u(Q,X);for(let $ of Z)if(_($))return $;return null}function v(Q,U=new Set){if(typeof Q==="string")return Q;if(!Q||typeof Q!=="object")return null;if(U.has(Q))return null;U.add(Q);let X=Q;for(let Z of _Q){let $=v(X[Z],U);if($)return $}return null}function u(Q,U){let X=U.replace(/^\.\//,""),Z=[q(Q,U)];if(X.startsWith("dist/")){let $=X.replace(/^dist\//,"src/").replace(/\.(mjs|cjs|js)$/,"");return[q(Q,`${$}.ts`),q(Q,`${$}.tsx`),q(Q,`${$}.mts`),q(Q,`${$}.cts`),...Z]}return Z}function LQ(Q){return Object.fromEntries(Object.entries(Q).sort(([U],[X])=>X.length-U.length))}function N(Q){return!(Q.startsWith(".")||Q.startsWith("/")||Q.startsWith("file:")||Q.startsWith("data:")||Q.startsWith("http:")||Q.startsWith("https:"))}function C(Q){if(Q.startsWith("@")){let[U,X]=Q.split("/",3);return X?`${U}/${X}`:Q}return Q.split("/",1)[0]??Q}function FQ(Q){let U=C(Q);if(Q===U)return".";return`.${Q.slice(U.length)}`}function c(Q){return C(Q).startsWith("@cline/")}function y(Q,U){let X=C(U),Z=J(Q);while(!0){let $=q(Z,"node_modules",X);if(_($)||_(q($,"package.json")))return!0;let G=q(Z,"..");if(G===Z)return!1;Z=G}}function h(Q){return b(Q)!==null}function b(Q){try{return KQ.resolve(Q)}catch{}return JQ(Q)}function JQ(Q){let U=C(Q),X=l(U);if(!X)return null;let Z=q(X,"package.json");try{let $=JSON.parse(O(Z,"utf8")),G=FQ(Q),Y=G==="."&&typeof $.exports==="string"?$.exports:$.exports&&typeof $.exports==="object"&&Object.hasOwn($.exports,G)?$.exports[G]:void 0,K=v(Y)??(G==="."&&typeof $.main==="string"?$.main:null);if(!K)return null;let A=q(X,K),L=[A,...u(X,K).filter((w)=>w!==A)];for(let w of L)if(_(w))return w;return null}catch{return null}}function zQ(){let Q=[d],U=process.env.CLINE_WRAPPER_PATH?.trim();if(U)Q.push(J(J(U)));let X=process.execPath?.trim();if(X)Q.push(J(X));return[...new Set(Q.map((Z)=>q(Z)))]}function CQ(Q,U){let X=Q;while(!0){let Z=q(X,"package.json");if(_(Z))try{if(JSON.parse(O(Z,"utf8")).name===U)return X}catch{}let $=q(X,"node_modules",U,"package.json");if(_($))return J($);let G=q(X,"..");if(G===X)return null;X=G}}function l(Q){for(let U of zQ()){let X=CQ(U,Q);if(X)return X}return null}function OQ(Q){let X=J(Q);for(let Z=0;Z<4;Z++){let $=q(X,"package.json");if(_($))try{let Y=JSON.parse(O($,"utf8"));return Y!=null&&typeof Y==="object"&&"cline"in Y}catch{return!1}let G=q(X,"..");if(G===X)return!1;X=G}return!1}function g(Q,U){let X=U.startsWith("file:")?m(U):$Q(U)?U:q(J(Q),U);if(_(X)&&B.has(I(X)))return X;for(let Z of B){let $=`${X}${Z}`;if(_($))return $}for(let Z of B){let $=q(X,`index${Z}`);if(_($))return $}return null}function n(Q){let U=new Set,X=[/\bimport\s+(?:type\s+)?[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bexport\s+[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bimport\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g,/\brequire\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g];for(let Z of X)for(let $ of Q.matchAll(Z)){let G=$[1];if(G)U.add(G)}return[...U]}function jQ(Q){return I(Q)!==".ts"}function o(Q,U,X=new Set){if(X.has(Q)||!_(Q))return;if(X.add(Q),!B.has(I(Q)))return;let Z=O(Q,"utf8"),$=jQ(Q);for(let G of n(Z)){if(G.startsWith("node:")||k.has(G))continue;if(N(G)){if(!$)continue;if(Object.hasOwn(T,G)||Object.hasOwn(T,C(G))||y(Q,G)||c(G)&&h(G)||U&&h(G))continue;throw Error(`Cannot find module '${C(G)}'`)}let Y=g(Q,G);if(Y)o(Y,U,X)}}function p(Q,U=new Set,X=new Set){if(U.has(Q)||!_(Q))return X;if(U.add(Q),!B.has(I(Q)))return X;let Z=O(Q,"utf8");for(let $ of n(Z)){if(X.add($),N($))continue;let G=g(Q,$);if(G)p(G,U,X)}return X}function BQ(Q,U){let X=R(Q),Z={},$=p(Q),G=new Set(WQ);for(let[Y,K]of Object.entries(T)){try{X.resolve(Y);continue}catch{}Z[Y]=K}for(let Y of $)if(N(Y)&&(c(Y)||U))G.add(Y);for(let Y of G){if(Object.hasOwn(Z,Y)||y(Q,Y))continue;let K=b(Y);if(K)Z[Y]=K}if(!U)return Z;for(let Y of $){if(!N(Y)||Object.hasOwn(Z,Y)||y(Q,Y)||Y.startsWith("node:")||k.has(Y))continue;let K=b(Y);if(K)Z[Y]=K}return Z}function IQ(Q){let U=I(Q);return U===".ts"||U===".tsx"||U===".mts"||U===".cts"}var z;function HQ(){if(z!==void 0)return z;let Q=l("jiti");if(!Q)return z=null,null;let U=q(Q,"dist","babel.cjs");if(!_(U))return z=null,null;try{let Z=R(U)(U);z=typeof Z==="function"?Z:null}catch{z=null}return z}async function s(Q,U={}){let X=!OQ(Q);o(Q,X);let Z=BQ(Q,X),$=LQ(Z),G=await import("jiti"),Y=typeof G==="function"?G:typeof G.default==="function"?G.default:void 0;if(!Y)throw Error("Unable to load jiti");let K=Object.entries($).filter(([,W])=>IQ(W)).map(([W])=>W),A=HQ(),L=A?(W)=>A({...W,interopDefault:!0}):void 0;return await Y(Q,{alias:$,cache:U.useCache,requireCache:U.useCache,esmResolve:!0,interopDefault:!1,nativeModules:[...k],transformModules:K,tryNative:!1,...L?{transform:L}:{}}).import(Q,{})}function i(Q,U){if(!Q)return!0;if(Q.providerIds?.length){if(!U?.providerId||!Q.providerIds.includes(U.providerId))return!1}if(Q.modelIds?.length){if(!U?.modelId||!Q.modelIds.includes(U.modelId))return!1}return!0}function F(Q){return typeof Q==="object"&&Q!==null}function r(Q){return Array.isArray(Q)&&Q.every((U)=>typeof U==="string")}function NQ(Q,U){if(!F(Q))throw Error(`Invalid plugin module: ${U}`);if(typeof Q.name!=="string"||!Q.name)throw Error(`Invalid plugin name: ${U}`);if(!F(Q.manifest))throw Error(`Invalid plugin manifest: ${U}`);if(Object.hasOwn(Q.manifest,"providerIds")&&!r(Q.manifest.providerIds))throw Error(`Invalid plugin manifest.providerIds: ${U}`);if(Object.hasOwn(Q.manifest,"modelIds")&&!r(Q.manifest.modelIds))throw Error(`Invalid plugin manifest.modelIds: ${U}`)}function SQ(Q){if(!F(Q))throw Error("Plugin setup context must be an object");if(Q.session!==void 0&&!F(Q.session))throw Error("Plugin setup context session must be an object");if(Q.client!==void 0&&!F(Q.client))throw Error("Plugin setup context client must be an object");if(Q.user!==void 0&&!F(Q.user))throw Error("Plugin setup context user must be an object");if(Q.workspaceInfo!==void 0&&!F(Q.workspaceInfo))throw Error("Plugin setup context workspaceInfo must be an object");if(Q.automation!==void 0&&!F(Q.automation))throw Error("Plugin setup context automation must be an object");if(Q.automation!==void 0&&typeof Q.automation.ingestEvent!=="function")throw Error("Plugin setup context automation.ingestEvent must be a function");if(Q.logger!==void 0&&!F(Q.logger))throw Error("Plugin setup context logger must be an object")}var t=0,S=new Map,f=new Map;function MQ(Q){let U=Q instanceof Error?Q.message:String(Q),X=Q instanceof Error?Q.stack:void 0;return{message:U,stack:X}}function x(Q,U,X,Z){if(!process.send)return;process.send({type:"response",id:Q,ok:U,result:X,error:Z})}function V(Q,U){if(!process.send)return;process.send({type:"event",name:Q,payload:U})}globalThis.__clinePluginHost={emitEvent:V};globalThis.__clineSessionEnv={cwd:void 0,workspaceInfo:void 0};function a(Q){if(!Q||typeof Q!=="object")return{};return Q}function M(Q){if(!Q||typeof Q!=="object")return;let U={...Q};if(U.error instanceof Error)U.error={name:U.error.name,message:U.error.message,stack:U.error.stack};return U}function VQ(Q){let U=(X,Z,$)=>{V("plugin_log",{level:X,pluginName:Q,message:Z,metadata:M($)})};return{debug:(X,Z)=>U("debug",X,Z),log:(X,Z)=>U("log",X,Z),error:(X,Z)=>U("error",X,Z)}}function EQ(Q){let U=($)=>{V("plugin_telemetry",{pluginName:Q,...$})},X=($)=>(G,Y,K,A,L)=>{U({kind:"metric",metric:$,name:G,value:Y,attributes:M(K),description:A,required:L})},Z=()=>{};return{capture:($)=>{U({kind:"event",event:$?.event,properties:M($?.properties)})},captureRequired:($,G)=>{U({kind:"event",event:$,properties:M(G),required:!0})},recordCounter:X("counter"),recordHistogram:X("histogram"),recordGauge:X("gauge"),isEnabled:()=>!0,setDistinctId:Z,setMetadata:Z,updateMetadata:Z,setCommonProperties:Z,updateCommonProperties:Z,flush:async()=>{},dispose:async()=>{}}}function j(Q,U){let X=`${Q}:${U}`,Z=(f.get(X)??0)+1;return f.set(X,Z),`${Q}_${U}_${Z}`}function TQ(Q){let U=typeof Q.eventType==="string"?Q.eventType.trim():"",X=typeof Q.source==="string"?Q.source.trim():"";if(!U)throw Error("Automation event type contribution requires eventType");if(!X)throw Error("Automation event type contribution requires source");return{...Q,eventType:U,source:X,examples:Q.examples?[...Q.examples]:void 0,metadata:Q.metadata?a(Q.metadata):void 0}}function H(Q){let U=S.get(Q);if(!U)throw Error(`Unknown sandbox plugin id: ${Q}`);return U}async function yQ(Q){let U;try{let X=await s(Q.pluginPath);if(U=X.default??X[Q.exportName],NQ(U,Q.pluginPath),U.manifest=DQ(U.manifest),!i(U.manifest,Q.targeting))return{type:"skipped"};let Z={tools:[],commands:[],rules:[],messageBuilders:[],providers:[],automationEventTypes:[],mcpServers:[],shortcuts:[],flags:[]},$={tools:new Map,commands:new Map,rules:new Map,messageBuilders:new Map},G={registerTool:(Y)=>{let K=j(Q.pluginId,"tool");$.tools.set(K,Y.execute),Z.tools.push({id:K,name:Y.name,description:Y.description,inputSchema:Y.inputSchema,timeoutMs:Y.timeoutMs,retryable:Y.retryable})},registerCommand:(Y)=>{let K=j(Q.pluginId,"command");if(typeof Y.handler==="function")$.commands.set(K,Y.handler);Z.commands.push({id:K,name:Y.name,description:Y.description})},registerRule:(Y)=>{let K=j(Q.pluginId,"rule");if(typeof Y.content==="function"){$.rules.set(K,Y.content),Z.rules.push({id:K,ruleId:Y.id,source:Y.source,hasContentHandler:!0});return}Z.rules.push({id:K,ruleId:Y.id,content:Y.content,source:Y.source})},registerMessageBuilder:(Y)=>{let K=j(Q.pluginId,"builder");$.messageBuilders.set(K,Y.build),Z.messageBuilders.push({id:K,name:Y.name})},registerProvider:(Y)=>{Z.providers.push({id:j(Q.pluginId,"provider"),name:Y.name,description:Y.description,metadata:a(Y.metadata)})},registerAutomationEventType:(Y)=>{Z.automationEventTypes.push({id:j(Q.pluginId,"automation_event"),...TQ(Y)})},registerMcpServer:(Y)=>{Z.mcpServers.push(Y)}};if(typeof U.setup==="function")try{let Y={...Q.setupCtxBase,...Q.telemetryEnabled?{telemetry:EQ(U.name)}:{},...Q.loggerEnabled?{logger:VQ(U.name)}:{},...U.manifest.capabilities.includes("automationEvents")?{automation:{ingestEvent:(K)=>{V("automation_event",K)}}}:{}};SQ(Y),await U.setup(G,Y)}catch(Y){return{type:"failure",failure:{pluginPath:Q.pluginPath,pluginName:U.name,phase:"setup",message:Y instanceof Error?Y.message:String(Y),stack:Y instanceof Error?Y.stack:void 0}}}return{type:"loaded",state:{plugin:U,handlers:$},descriptor:{pluginId:Q.pluginId,pluginPath:Q.pluginPath,name:U.name,manifest:U.manifest,hooks:U.hooks?Object.entries(U.hooks).filter(([,Y])=>typeof Y==="function").map(([Y])=>Y):void 0,contributions:Z}}}catch(X){return{type:"failure",failure:{pluginPath:Q.pluginPath,pluginName:U?.name,phase:"load",message:X instanceof Error?X.message:String(X),stack:X instanceof Error?X.stack:void 0}}}}async function bQ(Q){if(S.clear(),t=0,f.clear(),Q.cwd)try{process.chdir(Q.cwd)}catch{}let U=globalThis.__clineSessionEnv;if(U)U.cwd=Q.cwd,U.workspaceInfo=Q.workspaceInfo;let X=[],Z=[],$=[],G=Q.exportName||"plugin",Y=new Map,K={providerId:Q.providerId,modelId:Q.modelId},A={session:Q.session,client:Q.client,user:Q.user,workspaceInfo:Q.workspaceInfo},L=await Promise.all((Q.pluginPaths||[]).map((w)=>{let W=`plugin_${++t}`;return yQ({pluginPath:w,pluginId:W,exportName:G,targeting:K,setupCtxBase:A,loggerEnabled:Q.loggerEnabled,telemetryEnabled:Q.telemetryEnabled})}));for(let w of L){if(w.type==="skipped")continue;if(w.type==="failure"){Z.push(w.failure);continue}let{descriptor:W,state:e}=w,E=Y.get(W.name);if(E!==void 0){let D=X[E];if(!D)Y.delete(W.name);else{$.push({type:"duplicate_plugin_override",pluginName:W.name,pluginPath:W.pluginPath,overriddenPluginPath:D.pluginPath,message:`Plugin "${W.name}" from ${W.pluginPath} overrides ${D.pluginPath}`}),S.delete(D.pluginId),X.splice(E,1),Y.clear();for(let[QQ,UQ]of X.entries())Y.set(UQ.name,QQ)}}S.set(W.pluginId,e),Y.set(W.name,X.length),X.push(W)}return{plugins:X,failures:Z,warnings:$}}async function RQ(Q){let X=H(Q.pluginId).plugin.hooks?.[Q.hookName];if(typeof X!=="function")return;return await X(Q.payload)}async function kQ(Q){let X=H(Q.pluginId).handlers.tools.get(Q.contributionId);if(typeof X!=="function")throw Error("Unknown sandbox tool contribution");return await X(Q.input,Q.context)}async function vQ(Q){let X=H(Q.pluginId).handlers.commands.get(Q.contributionId);if(typeof X!=="function")return"";return await X(Q.input)}async function xQ(Q){let X=H(Q.pluginId).handlers.messageBuilders.get(Q.contributionId);if(typeof X!=="function")return[];return await X(Q.messages)}async function fQ(Q){let X=H(Q.pluginId).handlers.rules.get(Q.contributionId);if(typeof X!=="function")return"";return await X()}var PQ={initialize:bQ,invokeHook:RQ,executeTool:kQ,executeCommand:vQ,buildMessages:xQ,resolveRuleContent:fQ};P();process.on("message",async(Q)=>{if(!Q||Q.type!=="call")return;let U=PQ[Q.method];if(!U){x(Q.id,!1,void 0,{message:`Unknown method: ${String(Q.method)}`});return}try{let X=await U(Q.args||{});x(Q.id,!0,X)}catch(X){x(Q.id,!1,void 0,MQ(X))}});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { type AgentTool } from "@cerebriline/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Hand the model the workspace's language servers.
|
|
4
|
+
*
|
|
5
|
+
* VS Code already runs a language server for every language in the workspace,
|
|
6
|
+
* and those servers already know what every symbol means: where it is defined,
|
|
7
|
+
* everywhere it is used, what its type is, which classes implement it. None of
|
|
8
|
+
* that reached the model. It had regex search — `search_codebase` — and a regex
|
|
9
|
+
* cannot tell a definition from a mention, a method on this class from a method
|
|
10
|
+
* with the same name on another, or a live reference from one inside a comment.
|
|
11
|
+
*
|
|
12
|
+
* So the model compensates by reading. It greps a name, gets forty hits, reads
|
|
13
|
+
* six files to work out which one is the definition, and spends the turns on
|
|
14
|
+
* work the editor had already done and would have answered instantly. This is
|
|
15
|
+
* free capability that was sitting one `executeCommand` away.
|
|
16
|
+
*
|
|
17
|
+
* Position resolution is the part that makes it usable. Every LSP request is
|
|
18
|
+
* addressed by line and character, and a model almost never has those — it has
|
|
19
|
+
* a name it read in a file. So `symbol` is the primary way to ask, and the
|
|
20
|
+
* position is found on the model's behalf; line/character are accepted too, for
|
|
21
|
+
* when it does know.
|
|
22
|
+
*
|
|
23
|
+
* The name is `ask_lsp` because `code_intel` was not carrying what the tool is.
|
|
24
|
+
* Asked afterwards what `code_intel` had been, models that had *used it* did
|
|
25
|
+
* not know it was the LSP and did not expect it to be — with the first line of
|
|
26
|
+
* the description saying so, in the same request. A name is read every time and
|
|
27
|
+
* retained; a description is read once. `ask_lsp` also cannot prefix-match an
|
|
28
|
+
* MCP server's `lsp__*` tools, which a model in a workspace that has one was
|
|
29
|
+
* observed merging with ours.
|
|
30
|
+
*
|
|
31
|
+
* The provider interface below keeps its `CodeIntel*` names. It is the editor's
|
|
32
|
+
* code-intelligence surface, which this tool is one consumer of, and no model
|
|
33
|
+
* ever sees it.
|
|
34
|
+
*/
|
|
35
|
+
export declare const ASK_LSP_TOOL_NAME = "ask_lsp";
|
|
36
|
+
export declare const ASK_LSP_OPERATIONS: readonly ["definition", "references", "implementations", "type_definition", "hover", "document_symbols", "workspace_symbols", "callers"];
|
|
37
|
+
export type AskLspOperation = (typeof ASK_LSP_OPERATIONS)[number];
|
|
38
|
+
export declare const ASK_LSP_TOOL_DESCRIPTION = "Ask the language servers \u2014 the LSP \u2014 about a symbol. If you are reaching for an LSP tool or an MCP server that wraps one, this is it: the same protocol, already running against this workspace and its open files, with no server to start. This answers questions a text search cannot, because it understands the code: it distinguishes a definition from a mention, and this class's method from another class's method of the same name.\n\nUse this before falling back to `search_codebase` for anything about a symbol. It is faster, exact, and does not need you to read files to interpret the result.\n\nReach for it the moment you are about to do one of these by hand:\n- search for a name to find where it is defined -> `definition`\n- search for a name to find what uses it, or what would break -> `references` or `callers`\n- open a file just to read a signature, type or doc comment -> `hover`\n- scroll a file, or count brackets, to work out its structure -> `document_symbols`\n- grep the repo to find which file something lives in -> `workspace_symbols`\n\nOperations:\n- `definition` \u2014 where a symbol is defined.\n- `references` \u2014 every place it is actually used.\n- `implementations` \u2014 the classes or functions implementing an interface or abstract method.\n- `type_definition` \u2014 where the type of an expression is defined.\n- `hover` \u2014 the signature, type and documentation, as an editor shows on hover.\n- `document_symbols` \u2014 an outline of one file: its classes, functions and methods.\n- `workspace_symbols` \u2014 find a symbol by name across the whole project when you do not know which file it is in.\n- `callers` \u2014 what calls this function.\n\nHow to address a symbol:\n- Usually: `path` plus `symbol` \u2014 the name as it appears in that file.\n- If you know the exact position: `path`, `line` and `character` (both 1-based).\n- If you do not know the file: `symbol` alone, with `operation: \"workspace_symbols\"`.\n\nOutput: plain text, one result per line as `file:line:column` followed by that source line, so you can go straight to the one you want rather than reading each candidate. `hover` returns the signature and documentation as text instead, and `document_symbols` and `workspace_symbols` name each symbol's kind.\n\nAn empty answer is a real answer once the symbol resolved: for `definition`, `references`, `implementations`, `type_definition`, `callers` and `hover` the server understood the symbol and nothing matched, so a text search for the same question will not find more. `workspace_symbols` is the exception, and says so when it comes back empty: it reads a project-wide index that covers the languages a server is installed for and does not index script embedded in `.html` or other template files, so nothing there is not proof of nothing anywhere. And when the file does not parse, every answer about it opens with that line \u2014 while it is there, the server is answering from a partial parse and you are reading guesses.";
|
|
39
|
+
/** Exported for the same reason as `CHECK_FILE_TOOL_INPUT_SCHEMA`. */
|
|
40
|
+
export declare const ASK_LSP_TOOL_INPUT_SCHEMA: {
|
|
41
|
+
readonly type: "object";
|
|
42
|
+
readonly properties: {
|
|
43
|
+
readonly operation: {
|
|
44
|
+
readonly type: "string";
|
|
45
|
+
readonly enum: readonly ["definition", "references", "implementations", "type_definition", "hover", "document_symbols", "workspace_symbols", "callers"];
|
|
46
|
+
readonly description: "What to ask the language server.";
|
|
47
|
+
};
|
|
48
|
+
readonly path: {
|
|
49
|
+
readonly type: "string";
|
|
50
|
+
readonly description: "File the symbol appears in. Absolute, or relative to the working directory.";
|
|
51
|
+
};
|
|
52
|
+
readonly symbol: {
|
|
53
|
+
readonly type: "string";
|
|
54
|
+
readonly description: "The symbol's name, as written in that file. The usual way to address a symbol.";
|
|
55
|
+
};
|
|
56
|
+
readonly line: {
|
|
57
|
+
readonly type: "number";
|
|
58
|
+
readonly description: "1-based line, if you know the exact position.";
|
|
59
|
+
};
|
|
60
|
+
readonly character: {
|
|
61
|
+
readonly type: "number";
|
|
62
|
+
readonly description: "1-based column, if you know the exact position.";
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
readonly required: readonly ["operation"];
|
|
66
|
+
};
|
|
67
|
+
/** A location in a file. Lines and characters are 0-based, as LSP has them. */
|
|
68
|
+
export interface CodeIntelLocation {
|
|
69
|
+
filePath: string;
|
|
70
|
+
line: number;
|
|
71
|
+
character: number;
|
|
72
|
+
}
|
|
73
|
+
export interface CodeIntelSymbol {
|
|
74
|
+
name: string;
|
|
75
|
+
/** "class", "function", "method", … — whatever the server calls it. */
|
|
76
|
+
kind: string;
|
|
77
|
+
location: CodeIntelLocation;
|
|
78
|
+
/** The class or module the symbol sits in, when the server says. */
|
|
79
|
+
containerName?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Everything this tool needs from the editor.
|
|
83
|
+
*
|
|
84
|
+
* An interface rather than direct `vscode` calls so the tool's behaviour — the
|
|
85
|
+
* position resolution, the fallbacks, the rendering — is testable without an
|
|
86
|
+
* extension host. `check-file-tool.ts` is built the same way.
|
|
87
|
+
*/
|
|
88
|
+
export interface CodeIntelProvider {
|
|
89
|
+
/** Locate a name inside one file, for the position-addressed requests. */
|
|
90
|
+
findSymbolPosition(filePath: string, symbol: string): Promise<CodeIntelLocation | undefined>;
|
|
91
|
+
definitions(at: CodeIntelLocation): Promise<CodeIntelLocation[]>;
|
|
92
|
+
typeDefinitions(at: CodeIntelLocation): Promise<CodeIntelLocation[]>;
|
|
93
|
+
implementations(at: CodeIntelLocation): Promise<CodeIntelLocation[]>;
|
|
94
|
+
references(at: CodeIntelLocation): Promise<CodeIntelLocation[]>;
|
|
95
|
+
hover(at: CodeIntelLocation): Promise<string | undefined>;
|
|
96
|
+
documentSymbols(filePath: string): Promise<CodeIntelSymbol[]>;
|
|
97
|
+
workspaceSymbols(query: string): Promise<CodeIntelSymbol[]>;
|
|
98
|
+
callers(at: CodeIntelLocation): Promise<CodeIntelSymbol[]>;
|
|
99
|
+
/** The source line, so a result is readable without opening the file. */
|
|
100
|
+
readLine(filePath: string, line: number): Promise<string | undefined>;
|
|
101
|
+
/**
|
|
102
|
+
* The whole file, for the parse check that qualifies every answer about it.
|
|
103
|
+
*
|
|
104
|
+
* Optional because it arrived after the two hosts did, and a provider that
|
|
105
|
+
* cannot read the file should lose the warning rather than the answer.
|
|
106
|
+
*/
|
|
107
|
+
readFile?(filePath: string): Promise<string | undefined>;
|
|
108
|
+
}
|
|
109
|
+
export interface AskLspToolOptions {
|
|
110
|
+
cwd: string;
|
|
111
|
+
provider: CodeIntelProvider;
|
|
112
|
+
/**
|
|
113
|
+
* Where a failed request goes. Injected rather than imported: this tool is
|
|
114
|
+
* shared by the extension and the CLI, and each has its own logger.
|
|
115
|
+
*/
|
|
116
|
+
onError?: (message: string, error: unknown) => void;
|
|
117
|
+
}
|
|
118
|
+
interface AskLspInput {
|
|
119
|
+
operation?: unknown;
|
|
120
|
+
path?: unknown;
|
|
121
|
+
symbol?: unknown;
|
|
122
|
+
/**
|
|
123
|
+
* Accepted as a spelling of `symbol`. `search_codebase` sits next to this
|
|
124
|
+
* tool and takes `queries`, so a model reaching for a name-search here
|
|
125
|
+
* reasonably guesses `query` -- observed doing exactly that, which cost a
|
|
126
|
+
* turn and a fall back to a text search for a question the language server
|
|
127
|
+
* had already been asked.
|
|
128
|
+
*/
|
|
129
|
+
query?: unknown;
|
|
130
|
+
line?: unknown;
|
|
131
|
+
character?: unknown;
|
|
132
|
+
}
|
|
133
|
+
export interface ParsedAskLspRequest {
|
|
134
|
+
operation: AskLspOperation;
|
|
135
|
+
filePath?: string;
|
|
136
|
+
symbol?: string;
|
|
137
|
+
/** 0-based, converted from the 1-based numbers the description asks for. */
|
|
138
|
+
line?: number;
|
|
139
|
+
character?: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Read a request, or say what is missing from it.
|
|
143
|
+
*
|
|
144
|
+
* Returns a message rather than throwing: an unusable call should cost the
|
|
145
|
+
* model one sentence telling it what to send, not a tool error it has to
|
|
146
|
+
* interpret.
|
|
147
|
+
*/
|
|
148
|
+
export declare function parseAskLspRequest(input: AskLspInput | undefined): ParsedAskLspRequest | string;
|
|
149
|
+
export declare function createAskLspTool(options: AskLspToolOptions): AgentTool;
|
|
150
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Two tools that cross between text and sound.
|
|
3
|
+
*
|
|
4
|
+
* `transcribe_audio` turns a recording in the workspace into text, and
|
|
5
|
+
* `synthesize_speech` turns text into an audio file there. A meeting recording
|
|
6
|
+
* that has to become notes, a voice-over for a demo, a prompt for a phone menu:
|
|
7
|
+
* each one used to leave the session, like an image did before
|
|
8
|
+
* `generate_image`.
|
|
9
|
+
*
|
|
10
|
+
* The wire format is the OpenAI audio API -- `POST {endpoint}/audio/
|
|
11
|
+
* transcriptions` (multipart) and `POST {endpoint}/audio/speech` (JSON, bytes
|
|
12
|
+
* back) -- which opencoti and xOllama serve beside chat and which the hosted
|
|
13
|
+
* services serve too. The two are separate endpoints because they are often
|
|
14
|
+
* separate servers: a Whisper box and a TTS box.
|
|
15
|
+
*
|
|
16
|
+
* Audio is never re-encoded here. What the engine returns is what is written,
|
|
17
|
+
* and the file is named from what came back: opencoti b97 answers WAV whatever
|
|
18
|
+
* was asked, and a `.mp3` holding WAV bytes is a file some players refuse.
|
|
19
|
+
*/
|
|
20
|
+
import { type AgentTool } from "@cerebriline/shared";
|
|
21
|
+
import { type MediaServer } from "./media-endpoint";
|
|
22
|
+
export declare const TRANSCRIBE_AUDIO_TOOL_NAME = "transcribe_audio";
|
|
23
|
+
export declare const SYNTHESIZE_SPEECH_TOOL_NAME = "synthesize_speech";
|
|
24
|
+
export declare const TRANSCRIBE_AUDIO_TOOL_DESCRIPTION = "Transcribe an audio file in the workspace to text. Use it to read a recording you would otherwise have to ask the user to describe: a meeting, a voice note, the audio of a demo.\n\nArguments:\n- `path` \u2014 the audio file, relative to the workspace (wav, mp3, flac, ogg, m4a, webm).\n- `format` \u2014 `text` (the default), `srt` or `vtt` for subtitles with timestamps, or `verbose_json` for segments with start and end times.\n- `language` \u2014 the spoken language as a two-letter code, e.g. `en`. Optional; the model detects it when omitted.\n- `translate` \u2014 true to get the text in English whatever language is spoken. Optional.\n- `prompt` \u2014 names and terms the recording uses, to help spelling. Optional.\n- `output` \u2014 a workspace path to write the transcript to. Optional. Give one for a long recording or for subtitles: the transcript is saved there and only its beginning is returned to you.\n\nOutput: the transcript as plain text. Without `output`, a very long transcript is cut and the cut is stated. A long recording takes minutes.";
|
|
25
|
+
export declare const TRANSCRIBE_AUDIO_TOOL_INPUT_SCHEMA: {
|
|
26
|
+
readonly type: "object";
|
|
27
|
+
readonly properties: {
|
|
28
|
+
readonly path: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly description: "The audio file to transcribe, relative to the workspace.";
|
|
31
|
+
};
|
|
32
|
+
readonly format: {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
readonly enum: readonly ["text", "srt", "vtt", "verbose_json"];
|
|
35
|
+
readonly description: "text (default), srt or vtt for subtitles, verbose_json for timed segments.";
|
|
36
|
+
};
|
|
37
|
+
readonly language: {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
readonly description: "The spoken language as a two-letter code, e.g. \"en\". Optional.";
|
|
40
|
+
};
|
|
41
|
+
readonly translate: {
|
|
42
|
+
readonly type: "boolean";
|
|
43
|
+
readonly description: "True to get the text in English. Optional.";
|
|
44
|
+
};
|
|
45
|
+
readonly prompt: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly description: "Names and terms in the recording, to help spelling. Optional.";
|
|
48
|
+
};
|
|
49
|
+
readonly output: {
|
|
50
|
+
readonly type: "string";
|
|
51
|
+
readonly description: "Workspace path to write the transcript to. Optional; use it for long recordings and subtitles.";
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
readonly required: readonly ["path"];
|
|
55
|
+
};
|
|
56
|
+
export declare const SYNTHESIZE_SPEECH_TOOL_DESCRIPTION = "Turn text into spoken audio and save it as a file in the workspace. Use it for a voice-over, a spoken prompt, or an audio version of something you wrote.\n\nArguments:\n- `text` \u2014 what to say. Write it as it should be spoken: spell out abbreviations and numbers that must be read a particular way.\n- `path` \u2014 where to save it, relative to the workspace. Optional; defaults to a file under `.cline/generated-audio/`. The extension is corrected to match the audio the backend returns.\n- `voice` \u2014 the voice to use. Optional; the configured default is used when omitted. Backends name their own voices, and most accept the OpenAI names (alloy, echo, fable, onyx, nova, shimmer).\n- `speed` \u2014 speaking rate, 1 is normal, e.g. 1.25. Optional.\n- `format` \u2014 `wav`, `mp3`, `flac`, `opus` or `pcm`. Optional, and a backend that cannot encode it returns what it can; the reply says which.\n\nOutput: the saved path, the audio format and its length. You do not hear the result, so say what you asked for when reporting it. A long text takes a while.";
|
|
57
|
+
export declare const SYNTHESIZE_SPEECH_TOOL_INPUT_SCHEMA: {
|
|
58
|
+
readonly type: "object";
|
|
59
|
+
readonly properties: {
|
|
60
|
+
readonly text: {
|
|
61
|
+
readonly type: "string";
|
|
62
|
+
readonly description: "What to say, written as it should be spoken.";
|
|
63
|
+
};
|
|
64
|
+
readonly path: {
|
|
65
|
+
readonly type: "string";
|
|
66
|
+
readonly description: "Where to save it, relative to the workspace. Optional; defaults to a file under .cline/generated-audio/.";
|
|
67
|
+
};
|
|
68
|
+
readonly voice: {
|
|
69
|
+
readonly type: "string";
|
|
70
|
+
readonly description: "The voice. Optional; the configured default otherwise.";
|
|
71
|
+
};
|
|
72
|
+
readonly speed: {
|
|
73
|
+
readonly type: "number";
|
|
74
|
+
readonly description: "Speaking rate; 1 is normal. Optional.";
|
|
75
|
+
};
|
|
76
|
+
readonly format: {
|
|
77
|
+
readonly type: "string";
|
|
78
|
+
readonly enum: readonly ["wav", "mp3", "flac", "opus", "pcm"];
|
|
79
|
+
readonly description: "The audio format to ask for. Optional.";
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
readonly required: readonly ["text"];
|
|
83
|
+
};
|
|
84
|
+
export interface TranscriptionEndpoint {
|
|
85
|
+
/** Base URL, with or without a trailing `/v1`. */
|
|
86
|
+
baseUrl: string;
|
|
87
|
+
model: string;
|
|
88
|
+
apiKey?: string;
|
|
89
|
+
}
|
|
90
|
+
export interface SpeechEndpoint extends TranscriptionEndpoint {
|
|
91
|
+
/** Default for calls that name no voice. */
|
|
92
|
+
voice?: string;
|
|
93
|
+
/** Default for calls that name no format. */
|
|
94
|
+
format?: string;
|
|
95
|
+
}
|
|
96
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
97
|
+
interface AudioToolBase {
|
|
98
|
+
cwd: string;
|
|
99
|
+
fetchImpl?: typeof fetch;
|
|
100
|
+
onError?: (message: string, error: unknown) => void;
|
|
101
|
+
}
|
|
102
|
+
export interface TranscribeAudioToolOptions extends AudioToolBase {
|
|
103
|
+
getEndpoint: () => MaybePromise<TranscriptionEndpoint | undefined>;
|
|
104
|
+
readFile: (absolutePath: string) => Promise<Buffer>;
|
|
105
|
+
writeFile: (absolutePath: string, data: Buffer) => Promise<void>;
|
|
106
|
+
/** Milliseconds one transcription may take. Defaults to 15 minutes. */
|
|
107
|
+
timeoutMs?: number;
|
|
108
|
+
/** Characters of transcript returned to the model. Defaults to 24,000. */
|
|
109
|
+
maxReturnedChars?: number;
|
|
110
|
+
}
|
|
111
|
+
export interface SynthesizeSpeechToolOptions extends AudioToolBase {
|
|
112
|
+
getEndpoint: () => MaybePromise<SpeechEndpoint | undefined>;
|
|
113
|
+
writeFile: (absolutePath: string, data: Buffer) => Promise<void>;
|
|
114
|
+
/** Milliseconds one synthesis may take. Defaults to 5 minutes. */
|
|
115
|
+
timeoutMs?: number;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* What the bytes are, according to the bytes, as a file extension.
|
|
119
|
+
*
|
|
120
|
+
* Trusted ahead of the header and the request for the image tool's reason: the
|
|
121
|
+
* engine decides, and one of them answers WAV to a request for mp3.
|
|
122
|
+
*/
|
|
123
|
+
export declare function sniffAudioExtension(data: Buffer): string | undefined;
|
|
124
|
+
/** The extension the returned audio should carry. */
|
|
125
|
+
export declare function audioExtension(data: Buffer, contentType: string | null, requestedFormat: string | undefined): string;
|
|
126
|
+
/** Seconds of audio in a WAV, from its own header. Nothing for other formats. */
|
|
127
|
+
export declare function wavSeconds(data: Buffer): number | undefined;
|
|
128
|
+
/** A filename that says what was said, for the same reason an image gets one. */
|
|
129
|
+
export declare function defaultSpeechPath(text: string, now: number): string;
|
|
130
|
+
export declare function createTranscribeAudioTool(options: TranscribeAudioToolOptions): AgentTool;
|
|
131
|
+
export declare function createSynthesizeSpeechTool(options: SynthesizeSpeechToolOptions): AgentTool;
|
|
132
|
+
/** What a speech engine says it can do, for a settings picker. */
|
|
133
|
+
export interface SpeechVoices {
|
|
134
|
+
/** The engine's own voices first, then the OpenAI names it also answers to. */
|
|
135
|
+
voices: string[];
|
|
136
|
+
default?: string;
|
|
137
|
+
/** The `response_format` values the engine encodes. */
|
|
138
|
+
formats: string[];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The voices and formats of a speech endpoint, where the server can say.
|
|
142
|
+
*
|
|
143
|
+
* The OpenAI API has no route for this, so only the two servers that added one
|
|
144
|
+
* answer: opencoti in `/props` (`media.tts`), xOllama at
|
|
145
|
+
* `/api/xollama/media/voices`. Anything else is `undefined`, which is "type
|
|
146
|
+
* the name", not "no voices".
|
|
147
|
+
*
|
|
148
|
+
* Call it when the user asks, not when a pane opens: xOllama starts the speech
|
|
149
|
+
* engine to answer, and that is seconds of load and gigabytes of memory nobody
|
|
150
|
+
* asked for.
|
|
151
|
+
*/
|
|
152
|
+
export declare function listSpeechVoices(endpoint: TranscriptionEndpoint, server: MediaServer | "unknown", options?: {
|
|
153
|
+
fetchImpl?: typeof fetch;
|
|
154
|
+
timeoutMs?: number;
|
|
155
|
+
}): Promise<SpeechVoices | undefined>;
|
|
156
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { type AgentTool } from "@cerebriline/shared";
|
|
2
|
+
/**
|
|
3
|
+
* What a driver reports back from one action.
|
|
4
|
+
*
|
|
5
|
+
* Declared here rather than imported from the extension's message types: this
|
|
6
|
+
* tool is shared, and a host that has no webview should not have to model one
|
|
7
|
+
* to drive a browser. The extension's `BrowserActionResult` is structurally
|
|
8
|
+
* this, so its `BrowserSession` still satisfies the driver unchanged.
|
|
9
|
+
*/
|
|
10
|
+
export type BrowserActionResult = {
|
|
11
|
+
screenshot?: string;
|
|
12
|
+
logs?: string;
|
|
13
|
+
currentUrl?: string;
|
|
14
|
+
currentMousePosition?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A tool that answers "does this page actually work?".
|
|
18
|
+
*
|
|
19
|
+
* `check_file` answers that question for a file the editor understands. It has
|
|
20
|
+
* nothing to say about a page: an `.html` file gets no syntax checking from VS
|
|
21
|
+
* Code at all, and even a file that parses can throw the moment it runs. The
|
|
22
|
+
* only component that knows is the browser, and until now the model had no way
|
|
23
|
+
* to ask one.
|
|
24
|
+
*
|
|
25
|
+
* What it did instead was ask the user. Measured across four sessions: the
|
|
26
|
+
* model finishes an edit, cannot verify it, and either declares success it has
|
|
27
|
+
* not earned or asks whether the page works — a round trip that costs a human
|
|
28
|
+
* turn to answer something a headless Chrome answers in two seconds.
|
|
29
|
+
*
|
|
30
|
+
* Nothing here is new machinery. `BrowserSession` — puppeteer, Chrome
|
|
31
|
+
* discovery, remote-debug attach, screenshots, console capture — has been in
|
|
32
|
+
* the tree the whole time; it was upstream's `browser_action` tool, and the SDK
|
|
33
|
+
* migration cut the tool while leaving the service, its settings, its webview
|
|
34
|
+
* menu and its five gRPC handlers in place. This is the wire that was cut.
|
|
35
|
+
*/
|
|
36
|
+
export declare const BROWSER_TOOL_NAME = "browser";
|
|
37
|
+
/**
|
|
38
|
+
* Written at the failure it replaces, the way `check_file`'s is.
|
|
39
|
+
*
|
|
40
|
+
* The reflex being displaced here is not a shell command — it is asking the
|
|
41
|
+
* user. So the description says, in the place the model is standing when it is
|
|
42
|
+
* about to ask, that the answer is available without them.
|
|
43
|
+
*/
|
|
44
|
+
export declare const BROWSER_TOOL_DESCRIPTION = "Open a page in a real browser and report what it printed to the console and what it threw. This is how you check that a page works. Do not ask the user whether it works \u2014 open it and read the errors yourself.\n\nUse it after editing any HTML, CSS or JavaScript the page loads, and before reporting a task finished. `check_file` cannot answer this: no language server checks the script inside an `.html` file, and a file that parses can still throw the moment it runs.\n\nActions:\n- `open` \u2014 go to `url` and report the console output. Launches the browser on first use. A local file is a URL: pass the absolute path and it is converted for you.\n- `click` \u2014 click at `coordinate` (\"x,y\" in page pixels, from the screenshot).\n- `type` \u2014 type `text` at the current focus.\n- `scroll_down`, `scroll_up` \u2014 one viewport.\n- `close` \u2014 shut the browser down. Do this when finished with it.\n\nEvery action reports the console messages and uncaught errors produced while it ran, so a syntax error, a failed fetch or a null dereference comes back as text you can act on. `[error]` and `[Page Error]` lines are real failures. A page that says nothing printed nothing \u2014 that is a pass, not a failed call, and for a local file it is checked: a silent console over a file that does not parse is reported as the failure it is, not as a pass.\n\nA parse error from the browser names no line, because the script never ran. For a local file a `Delimiter scan` section follows it and names the line to edit and how many brackets that line is out by \u2014 one line per place the trouble starts, since a file can be broken in several spots at once. Fix every line it lists in one edit and reload once, rather than one edit and one reload per line. Edit those lines instead of counting brackets yourself: counting a whole file by hand costs more thinking than you have, and the scan skips strings, comments and regex literals, which counting does not.\n\nThe browser stays open between calls, so `open` once and then interact. Only one page is open at a time; `open` again to go elsewhere.";
|
|
45
|
+
/**
|
|
46
|
+
* Exported so the template generator can state this tool's real call shape.
|
|
47
|
+
*
|
|
48
|
+
* Same reason `check_file` exports its schema: a model rewriting a prompt
|
|
49
|
+
* template writes example calls, and an example is copied more readily than a
|
|
50
|
+
* schema is read.
|
|
51
|
+
*/
|
|
52
|
+
export declare const BROWSER_TOOL_INPUT_SCHEMA: {
|
|
53
|
+
readonly type: "object";
|
|
54
|
+
readonly properties: {
|
|
55
|
+
readonly action: {
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
readonly enum: readonly ["open", "click", "type", "scroll_down", "scroll_up", "close"];
|
|
58
|
+
readonly description: "What to do.";
|
|
59
|
+
};
|
|
60
|
+
readonly url: {
|
|
61
|
+
readonly type: "string";
|
|
62
|
+
readonly description: "For `open`: the page to load. An absolute file path is accepted and converted to a file URL.";
|
|
63
|
+
};
|
|
64
|
+
readonly coordinate: {
|
|
65
|
+
readonly type: "string";
|
|
66
|
+
readonly description: "For `click`: \"x,y\" in page pixels.";
|
|
67
|
+
};
|
|
68
|
+
readonly text: {
|
|
69
|
+
readonly type: "string";
|
|
70
|
+
readonly description: "For `type`: the text to type.";
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
readonly required: readonly ["action"];
|
|
74
|
+
};
|
|
75
|
+
export declare const BROWSER_ACTIONS: readonly ["open", "click", "type", "scroll_down", "scroll_up", "close"];
|
|
76
|
+
export type BrowserToolAction = (typeof BROWSER_ACTIONS)[number];
|
|
77
|
+
/**
|
|
78
|
+
* The subset of `BrowserSession` this tool drives.
|
|
79
|
+
*
|
|
80
|
+
* Declared structurally rather than imported: `BrowserSession` reaches for
|
|
81
|
+
* `StateManager`, telemetry and the host bridge in its constructor, none of
|
|
82
|
+
* which a unit test should have to stand up to check how a console log is
|
|
83
|
+
* rendered.
|
|
84
|
+
*/
|
|
85
|
+
export interface BrowserDriver {
|
|
86
|
+
launchBrowser(): Promise<void>;
|
|
87
|
+
navigateToUrl(url: string): Promise<BrowserActionResult>;
|
|
88
|
+
click(coordinate: string): Promise<BrowserActionResult>;
|
|
89
|
+
type(text: string): Promise<BrowserActionResult>;
|
|
90
|
+
scrollDown(): Promise<BrowserActionResult>;
|
|
91
|
+
scrollUp(): Promise<BrowserActionResult>;
|
|
92
|
+
closeBrowser(): Promise<unknown>;
|
|
93
|
+
}
|
|
94
|
+
export interface BrowserToolOptions {
|
|
95
|
+
cwd: string;
|
|
96
|
+
/** Built on first use, so a session that never browses never spawns Chrome. */
|
|
97
|
+
createDriver: () => BrowserDriver | Promise<BrowserDriver>;
|
|
98
|
+
/** Injection point for tests; defaults to reading the file off disk. */
|
|
99
|
+
readFile?: (filePath: string) => Promise<string>;
|
|
100
|
+
/**
|
|
101
|
+
* Where a failed action goes. Injected rather than imported: this tool is
|
|
102
|
+
* shared by the extension and the CLI, and each has its own logger.
|
|
103
|
+
*/
|
|
104
|
+
onError?: (message: string, error: unknown) => void;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Turn what a model typed into something a browser will accept.
|
|
108
|
+
*
|
|
109
|
+
* Models pass local files three ways — a bare absolute path, a Windows path
|
|
110
|
+
* with backslashes, and an already-correct `file://` URL — and only the third
|
|
111
|
+
* works unaided. Rejecting the other two would teach the model to stop using
|
|
112
|
+
* the tool rather than to write the third.
|
|
113
|
+
*/
|
|
114
|
+
export declare function toNavigableUrl(raw: string, cwd: string): string;
|
|
115
|
+
/**
|
|
116
|
+
* How a result reads to the model.
|
|
117
|
+
*
|
|
118
|
+
* The console block is the point of the tool, so it is labelled and never
|
|
119
|
+
* silently omitted: "nothing" stated is a result, while nothing printed is
|
|
120
|
+
* indistinguishable from the tool having failed — and a model that suspects a
|
|
121
|
+
* tool failed goes back to asking the user.
|
|
122
|
+
*/
|
|
123
|
+
export declare function renderBrowserResult(action: string, result: BrowserActionResult, target?: string): string;
|
|
124
|
+
/**
|
|
125
|
+
* Split a data URL into the parts an image content block needs.
|
|
126
|
+
*
|
|
127
|
+
* `BrowserSession` hands back `data:image/png;base64,…` because that is what
|
|
128
|
+
* the webview renders. The model's message wants the media type and the
|
|
129
|
+
* payload apart.
|
|
130
|
+
*/
|
|
131
|
+
export declare function splitDataUrl(dataUrl: string): {
|
|
132
|
+
data: string;
|
|
133
|
+
mediaType: string;
|
|
134
|
+
} | undefined;
|
|
135
|
+
/** The local path behind a `file://` URL, or nothing for anything remote. */
|
|
136
|
+
export declare function localPathOf(url: string | undefined): string | undefined;
|
|
137
|
+
export declare function createBrowserTool(options: BrowserToolOptions): AgentTool;
|