@clinebot/core 0.0.37 → 0.0.38
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/README.md +11 -1
- package/dist/ClineCore.d.ts +18 -214
- package/dist/account/cline-account-service.d.ts +0 -1
- package/dist/account/index.d.ts +0 -1
- package/dist/account/rpc.d.ts +0 -1
- package/dist/account/types.d.ts +0 -1
- package/dist/auth/bounded-ttl-cache.d.ts +0 -1
- package/dist/auth/client.d.ts +0 -1
- package/dist/auth/cline.d.ts +0 -5
- package/dist/auth/codex.d.ts +0 -1
- package/dist/auth/oca.d.ts +0 -1
- package/dist/auth/server.d.ts +0 -1
- package/dist/auth/types.d.ts +0 -1
- package/dist/auth/utils.d.ts +0 -1
- 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 +221 -0
- package/dist/cron/{cron-event-ingress.d.ts → events/cron-event-ingress.d.ts} +1 -2
- package/dist/cron/{cron-report-writer.d.ts → reports/cron-report-writer.d.ts} +1 -2
- package/dist/cron/{cron-materializer.d.ts → runner/cron-materializer.d.ts} +1 -2
- package/dist/cron/{cron-runner.d.ts → runner/cron-runner.d.ts} +6 -4
- package/dist/cron/{resource-limiter.d.ts → runner/resource-limiter.d.ts} +0 -1
- package/dist/cron/schedule/scheduler.d.ts +12 -0
- package/dist/cron/{cron-service.d.ts → service/cron-service.d.ts} +4 -5
- package/dist/cron/{schedule-command-service.d.ts → service/schedule-command-service.d.ts} +0 -1
- package/dist/cron/{schedule-service.d.ts → service/schedule-service.d.ts} +20 -22
- package/dist/cron/{cron-reconciler.d.ts → specs/cron-reconciler.d.ts} +1 -2
- package/dist/cron/{cron-spec-parser.d.ts → specs/cron-spec-parser.d.ts} +0 -1
- package/dist/cron/{cron-watcher.d.ts → specs/cron-watcher.d.ts} +0 -1
- package/dist/cron/{cron-schema.d.ts → store/cron-schema.d.ts} +0 -1
- package/dist/cron/{sqlite-cron-store.d.ts → store/sqlite-cron-store.d.ts} +12 -2
- package/dist/extensions/config/index.d.ts +4 -7
- package/dist/extensions/config/runtime-commands.d.ts +0 -1
- package/dist/extensions/config/skill-frontmatter-toggle.d.ts +11 -0
- package/dist/extensions/config/unified-config-file-watcher.d.ts +0 -1
- package/dist/extensions/config/user-instruction-config-loader.d.ts +0 -1
- package/dist/extensions/config/user-instruction-plugin.d.ts +25 -0
- package/dist/extensions/config/user-instruction-service.d.ts +23 -0
- package/dist/extensions/context/agentic-compaction.d.ts +0 -1
- package/dist/extensions/context/basic-compaction.d.ts +0 -1
- package/dist/extensions/context/compaction-shared.d.ts +0 -1
- package/dist/extensions/context/compaction.d.ts +0 -1
- package/dist/extensions/index.d.ts +0 -1
- package/dist/extensions/mcp/client.d.ts +0 -1
- package/dist/extensions/mcp/config-loader.d.ts +0 -1
- package/dist/extensions/mcp/index.d.ts +0 -1
- package/dist/extensions/mcp/manager.d.ts +0 -1
- package/dist/extensions/mcp/name-transform.d.ts +0 -1
- package/dist/extensions/mcp/policies.d.ts +0 -1
- package/dist/extensions/mcp/tools.d.ts +2 -3
- package/dist/extensions/mcp/types.d.ts +3 -4
- package/dist/extensions/plugin/plugin-config-loader.d.ts +0 -1
- package/dist/extensions/plugin/plugin-load-report.d.ts +0 -1
- package/dist/extensions/plugin/plugin-loader.d.ts +0 -1
- package/dist/extensions/plugin/plugin-module-import.d.ts +0 -1
- package/dist/extensions/plugin/plugin-sandbox.d.ts +0 -1
- package/dist/extensions/plugin/plugin-targeting.d.ts +0 -1
- package/dist/extensions/plugin-sandbox-bootstrap.js +1 -446
- package/dist/extensions/tools/constants.d.ts +0 -1
- package/dist/extensions/tools/definitions.d.ts +13 -14
- package/dist/extensions/tools/executors/apply-patch-parser.d.ts +0 -1
- package/dist/extensions/tools/executors/apply-patch.d.ts +0 -1
- package/dist/extensions/tools/executors/bash.d.ts +0 -1
- package/dist/extensions/tools/executors/editor.d.ts +0 -1
- package/dist/extensions/tools/executors/file-read.d.ts +0 -1
- package/dist/extensions/tools/executors/index.d.ts +0 -1
- package/dist/extensions/tools/executors/search.d.ts +0 -1
- package/dist/extensions/tools/executors/web-fetch.d.ts +0 -1
- package/dist/extensions/tools/helpers.d.ts +0 -1
- package/dist/extensions/tools/index.d.ts +2 -3
- package/dist/extensions/tools/model-tool-routing.d.ts +0 -1
- package/dist/extensions/tools/presets.d.ts +4 -5
- package/dist/extensions/tools/runtime.d.ts +0 -1
- package/dist/extensions/tools/schemas.d.ts +0 -1
- package/dist/extensions/tools/team/delegated-agent.d.ts +3 -4
- package/dist/extensions/tools/team/index.d.ts +0 -1
- package/dist/extensions/tools/team/multi-agent.d.ts +1 -2
- package/dist/extensions/tools/team/projections.d.ts +0 -1
- package/dist/extensions/tools/team/runtime.d.ts +0 -1
- package/dist/extensions/tools/team/spawn-agent-tool.d.ts +4 -5
- package/dist/extensions/tools/team/subagent-prompts.d.ts +0 -1
- package/dist/extensions/tools/team/team-tools.d.ts +7 -8
- package/dist/extensions/tools/types.d.ts +11 -12
- package/dist/hooks/checkpoint-hooks.d.ts +9 -2
- package/dist/hooks/hook-extension.d.ts +2 -0
- package/dist/{extensions/config/hooks-config-loader.d.ts → hooks/hook-file-config.d.ts} +1 -2
- package/dist/hooks/hook-file-hooks.d.ts +2 -2
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/subprocess-runner.d.ts +0 -1
- package/dist/hooks/subprocess.d.ts +0 -1
- package/dist/hub/{connect.d.ts → client/connect.d.ts} +1 -2
- package/dist/hub/{client.d.ts → client/index.d.ts} +41 -4
- package/dist/hub/{session-client.d.ts → client/session-client.d.ts} +41 -13
- package/dist/hub/{ui-client.d.ts → client/ui-client.d.ts} +1 -1
- package/dist/hub/daemon/entry.d.ts +1 -0
- package/dist/hub/daemon/entry.js +720 -0
- package/dist/hub/{daemon.d.ts → daemon/index.d.ts} +6 -3
- package/dist/hub/{runtime-handlers.d.ts → daemon/runtime-handlers.d.ts} +3 -2
- package/dist/hub/{start-shared-server.d.ts → daemon/start-shared-server.d.ts} +1 -2
- package/dist/hub/{defaults.d.ts → discovery/defaults.d.ts} +0 -1
- package/dist/hub/{discovery.d.ts → discovery/index.d.ts} +2 -1
- package/dist/hub/{workspace.d.ts → discovery/workspace.d.ts} +1 -2
- package/dist/hub/index.d.ts +28 -11
- package/dist/hub/index.js +484 -1061
- package/dist/hub/runtime-host/hub-runtime-host.d.ts +73 -0
- package/dist/{transports/remote.d.ts → hub/runtime-host/remote-runtime-host.d.ts} +1 -2
- package/dist/hub/{browser-websocket.d.ts → server/browser-websocket.d.ts} +1 -2
- package/dist/hub/{transport.d.ts → server/command-transport.d.ts} +0 -1
- package/dist/hub/server/handlers/approval-handlers.d.ts +17 -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/context.d.ts +56 -0
- package/dist/hub/server/handlers/run-handlers.d.ts +5 -0
- package/dist/hub/server/handlers/session-event-projector.d.ts +7 -0
- package/dist/hub/server/handlers/session-handlers.d.ts +20 -0
- package/dist/hub/server/hub-client-contributions.d.ts +19 -0
- package/dist/hub/server/hub-notifications.d.ts +7 -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 +55 -0
- package/dist/hub/server/hub-server-transport.d.ts +34 -0
- package/dist/hub/server/hub-session-records.d.ts +8 -0
- package/dist/hub/server/hub-websocket-server.d.ts +6 -0
- package/dist/hub/server/index.d.ts +4 -0
- package/dist/hub/{native-transport.d.ts → server/native-transport.d.ts} +1 -2
- package/dist/index.d.ts +51 -41
- package/dist/index.js +214 -872
- 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 +6 -0
- package/dist/runtime/config/agent-message-codec.d.ts +6 -0
- package/dist/runtime/{agent-runtime-config-builder.d.ts → config/agent-runtime-config-builder.d.ts} +12 -21
- package/dist/runtime/host/history.d.ts +18 -0
- package/dist/runtime/{host.d.ts → host/host.d.ts} +3 -4
- package/dist/runtime/host/local/agent-event-bridge.d.ts +29 -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 +15 -0
- package/dist/runtime/host/local/user-files.d.ts +1 -0
- package/dist/runtime/host/local-runtime-host.d.ts +118 -0
- package/dist/{transports → runtime/host}/runtime-host-support.d.ts +3 -5
- package/dist/runtime/{runtime-host.d.ts → host/runtime-host.d.ts} +66 -31
- package/dist/runtime/{runtime-builder.d.ts → orchestration/runtime-builder.d.ts} +0 -1
- package/dist/runtime/{runtime-event-adapter.d.ts → orchestration/runtime-event-adapter.d.ts} +0 -1
- package/dist/runtime/{runtime-oauth-token-manager.d.ts → orchestration/runtime-oauth-token-manager.d.ts} +1 -2
- package/dist/runtime/{session-runtime-orchestrator.d.ts → orchestration/session-runtime-orchestrator.d.ts} +20 -63
- package/dist/runtime/{session-runtime.d.ts → orchestration/session-runtime.d.ts} +14 -12
- package/dist/runtime/{user-input-builder.d.ts → orchestration/user-input-builder.d.ts} +2 -11
- package/dist/runtime/{loop-detection.d.ts → safety/loop-detection.d.ts} +0 -1
- package/dist/runtime/{mistake-tracker.d.ts → safety/mistake-tracker.d.ts} +0 -1
- package/dist/runtime/{rules.d.ts → safety/rules.d.ts} +1 -2
- package/dist/runtime/{subprocess-sandbox.d.ts → tools/subprocess-sandbox.d.ts} +15 -1
- package/dist/runtime/{tool-approval.d.ts → tools/tool-approval.d.ts} +0 -1
- package/dist/runtime/turn-queue/pending-prompt-service.d.ts +64 -0
- package/dist/services/agent-events.d.ts +1 -2
- package/dist/services/config.d.ts +0 -1
- package/dist/services/global-settings.d.ts +27 -5
- package/dist/{llms → services/llms}/cline-recommended-models.d.ts +1 -2
- package/dist/{llms → services/llms}/configured-provider-registry.d.ts +0 -1
- package/dist/services/llms/handler-factory.d.ts +3 -0
- package/dist/{llms → services/llms}/provider-defaults.d.ts +2 -1
- package/dist/{llms → services/llms}/provider-settings.d.ts +5 -3
- package/dist/{llms → services/llms}/runtime-config.d.ts +0 -1
- package/dist/{llms → services/llms}/runtime-registry.d.ts +0 -1
- package/dist/{llms → services/llms}/runtime-types.d.ts +0 -1
- package/dist/services/local-runtime-bootstrap.d.ts +7 -9
- package/dist/services/plugin-tools.d.ts +0 -1
- package/dist/services/providers/local-provider-registry.d.ts +9 -10
- package/dist/services/providers/local-provider-service.d.ts +36 -3
- package/dist/services/providers/model-source.d.ts +3 -0
- package/dist/services/session-artifacts.d.ts +0 -1
- package/dist/services/session-data.d.ts +2 -3
- package/dist/services/session-telemetry.d.ts +0 -1
- package/dist/services/storage/file-team-store.d.ts +0 -1
- package/dist/services/storage/provider-settings-legacy-migration.d.ts +0 -1
- package/dist/services/storage/provider-settings-manager.d.ts +3 -4
- package/dist/services/storage/sqlite-session-store.d.ts +0 -1
- package/dist/services/storage/sqlite-team-store.d.ts +0 -1
- package/dist/services/storage/team-store.d.ts +0 -1
- package/dist/services/telemetry/ITelemetryAdapter.d.ts +0 -1
- package/dist/services/telemetry/OpenTelemetryAdapter.d.ts +0 -1
- package/dist/services/telemetry/OpenTelemetryProvider.d.ts +32 -1
- package/dist/services/telemetry/TelemetryLoggerSink.d.ts +0 -1
- package/dist/services/telemetry/TelemetryService.d.ts +0 -1
- package/dist/services/telemetry/core-events.d.ts +46 -3
- package/dist/services/telemetry/distinct-id.d.ts +0 -1
- package/dist/services/telemetry/index.d.ts +1 -2
- package/dist/services/telemetry/index.js +1 -0
- package/dist/services/usage.d.ts +10 -2
- package/dist/services/workspace/file-indexer.d.ts +0 -1
- package/dist/services/workspace/index.d.ts +0 -1
- package/dist/services/workspace/mention-enricher.d.ts +0 -1
- package/dist/{session → services/workspace}/workspace-manager.d.ts +0 -1
- package/dist/services/{workspace-manifest.d.ts → workspace/workspace-manifest.d.ts} +20 -5
- package/dist/services/workspace/workspace-telemetry.d.ts +18 -0
- package/dist/session/checkpoint-restore.d.ts +20 -0
- package/dist/session/{session-graph.d.ts → models/session-graph.d.ts} +2 -3
- package/dist/session/{session-manifest.d.ts → models/session-manifest.d.ts} +0 -1
- package/dist/session/{session-row.d.ts → models/session-row.d.ts} +2 -3
- package/dist/session/{file-session-service.d.ts → services/file-session-service.d.ts} +1 -2
- package/dist/session/{message-builder.d.ts → services/message-builder.d.ts} +7 -16
- package/dist/session/{persistence-service.d.ts → services/persistence-service.d.ts} +10 -11
- package/dist/session/{session-service.d.ts → services/session-service.d.ts} +4 -5
- package/dist/session/session-snapshot.d.ts +57 -0
- package/dist/session/session-versioning-service.d.ts +48 -0
- package/dist/session/{conversation-store.d.ts → stores/conversation-store.d.ts} +0 -1
- package/dist/session/{session-manifest-store.d.ts → stores/session-manifest-store.d.ts} +3 -4
- package/dist/session/{team-persistence-store.d.ts → stores/team-persistence-store.d.ts} +2 -3
- package/dist/session/team/index.d.ts +2 -0
- package/dist/session/{subagent-session-manager.d.ts → team/team-child-session-manager.d.ts} +7 -8
- package/dist/session/{session-team-coordination.d.ts → team/team-session-coordinator.d.ts} +3 -4
- package/dist/settings/index.d.ts +2 -0
- package/dist/settings/settings-service.d.ts +6 -0
- package/dist/settings/types.d.ts +42 -0
- package/dist/types/chat-schema.d.ts +24 -7
- package/dist/types/common.d.ts +0 -1
- package/dist/types/config.d.ts +2 -3
- package/dist/types/events.d.ts +8 -1
- package/dist/types/provider-settings.d.ts +2 -3
- package/dist/types/session.d.ts +22 -6
- package/dist/types/sessions.d.ts +0 -1
- package/dist/types/storage.d.ts +0 -1
- package/dist/types.d.ts +17 -14
- package/dist/version.d.ts +0 -1
- package/package.json +16 -12
- package/dist/ClineCore.d.ts.map +0 -1
- package/dist/account/cline-account-service.d.ts.map +0 -1
- package/dist/account/index.d.ts.map +0 -1
- package/dist/account/rpc.d.ts.map +0 -1
- package/dist/account/types.d.ts.map +0 -1
- package/dist/auth/bounded-ttl-cache.d.ts.map +0 -1
- package/dist/auth/client.d.ts.map +0 -1
- package/dist/auth/cline.d.ts.map +0 -1
- package/dist/auth/codex.d.ts.map +0 -1
- package/dist/auth/oca.d.ts.map +0 -1
- package/dist/auth/server.d.ts.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/utils.d.ts.map +0 -1
- package/dist/cron/cron-event-ingress.d.ts.map +0 -1
- package/dist/cron/cron-materializer.d.ts.map +0 -1
- package/dist/cron/cron-reconciler.d.ts.map +0 -1
- package/dist/cron/cron-report-writer.d.ts.map +0 -1
- package/dist/cron/cron-runner.d.ts.map +0 -1
- package/dist/cron/cron-schema.d.ts.map +0 -1
- package/dist/cron/cron-service.d.ts.map +0 -1
- package/dist/cron/cron-spec-parser.d.ts.map +0 -1
- package/dist/cron/cron-watcher.d.ts.map +0 -1
- package/dist/cron/resource-limiter.d.ts.map +0 -1
- package/dist/cron/schedule-command-service.d.ts.map +0 -1
- package/dist/cron/schedule-service.d.ts.map +0 -1
- package/dist/cron/scheduler.d.ts +0 -68
- package/dist/cron/scheduler.d.ts.map +0 -1
- package/dist/cron/sqlite-cron-store.d.ts.map +0 -1
- package/dist/cron/sqlite-schedule-store.d.ts +0 -52
- package/dist/cron/sqlite-schedule-store.d.ts.map +0 -1
- package/dist/extensions/config/agent-config-loader.d.ts +0 -20
- package/dist/extensions/config/agent-config-loader.d.ts.map +0 -1
- package/dist/extensions/config/agent-config-parser.d.ts +0 -29
- package/dist/extensions/config/agent-config-parser.d.ts.map +0 -1
- package/dist/extensions/config/hooks-config-loader.d.ts.map +0 -1
- package/dist/extensions/config/index.d.ts.map +0 -1
- package/dist/extensions/config/runtime-commands.d.ts.map +0 -1
- package/dist/extensions/config/unified-config-file-watcher.d.ts.map +0 -1
- package/dist/extensions/config/user-instruction-config-loader.d.ts.map +0 -1
- package/dist/extensions/context/agentic-compaction.d.ts.map +0 -1
- package/dist/extensions/context/basic-compaction.d.ts.map +0 -1
- package/dist/extensions/context/compaction-shared.d.ts.map +0 -1
- package/dist/extensions/context/compaction.d.ts.map +0 -1
- package/dist/extensions/index.d.ts.map +0 -1
- package/dist/extensions/mcp/client.d.ts.map +0 -1
- package/dist/extensions/mcp/config-loader.d.ts.map +0 -1
- package/dist/extensions/mcp/index.d.ts.map +0 -1
- package/dist/extensions/mcp/manager.d.ts.map +0 -1
- package/dist/extensions/mcp/name-transform.d.ts.map +0 -1
- package/dist/extensions/mcp/policies.d.ts.map +0 -1
- package/dist/extensions/mcp/tools.d.ts.map +0 -1
- package/dist/extensions/mcp/types.d.ts.map +0 -1
- package/dist/extensions/plugin/plugin-config-loader.d.ts.map +0 -1
- package/dist/extensions/plugin/plugin-load-report.d.ts.map +0 -1
- package/dist/extensions/plugin/plugin-loader.d.ts.map +0 -1
- package/dist/extensions/plugin/plugin-module-import.d.ts.map +0 -1
- package/dist/extensions/plugin/plugin-sandbox.d.ts.map +0 -1
- package/dist/extensions/plugin/plugin-targeting.d.ts.map +0 -1
- package/dist/extensions/tools/constants.d.ts.map +0 -1
- package/dist/extensions/tools/definitions.d.ts.map +0 -1
- package/dist/extensions/tools/executors/apply-patch-parser.d.ts.map +0 -1
- package/dist/extensions/tools/executors/apply-patch.d.ts.map +0 -1
- package/dist/extensions/tools/executors/bash.d.ts.map +0 -1
- package/dist/extensions/tools/executors/editor.d.ts.map +0 -1
- package/dist/extensions/tools/executors/file-read.d.ts.map +0 -1
- package/dist/extensions/tools/executors/index.d.ts.map +0 -1
- package/dist/extensions/tools/executors/search.d.ts.map +0 -1
- package/dist/extensions/tools/executors/web-fetch.d.ts.map +0 -1
- package/dist/extensions/tools/helpers.d.ts.map +0 -1
- package/dist/extensions/tools/index.d.ts.map +0 -1
- package/dist/extensions/tools/model-tool-routing.d.ts.map +0 -1
- package/dist/extensions/tools/presets.d.ts.map +0 -1
- package/dist/extensions/tools/runtime.d.ts.map +0 -1
- package/dist/extensions/tools/schemas.d.ts.map +0 -1
- package/dist/extensions/tools/team/delegated-agent.d.ts.map +0 -1
- package/dist/extensions/tools/team/index.d.ts.map +0 -1
- package/dist/extensions/tools/team/multi-agent.d.ts.map +0 -1
- package/dist/extensions/tools/team/projections.d.ts.map +0 -1
- package/dist/extensions/tools/team/runtime.d.ts.map +0 -1
- package/dist/extensions/tools/team/spawn-agent-tool.d.ts.map +0 -1
- package/dist/extensions/tools/team/subagent-prompts.d.ts.map +0 -1
- package/dist/extensions/tools/team/team-tools.d.ts.map +0 -1
- package/dist/extensions/tools/types.d.ts.map +0 -1
- package/dist/hooks/checkpoint-hooks.d.ts.map +0 -1
- package/dist/hooks/hook-bridge.d.ts +0 -118
- package/dist/hooks/hook-bridge.d.ts.map +0 -1
- package/dist/hooks/hook-file-hooks.d.ts.map +0 -1
- package/dist/hooks/hook-registry.d.ts +0 -16
- package/dist/hooks/hook-registry.d.ts.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/subprocess-runner.d.ts.map +0 -1
- package/dist/hooks/subprocess.d.ts.map +0 -1
- package/dist/hub/browser-websocket.d.ts.map +0 -1
- package/dist/hub/client.d.ts.map +0 -1
- package/dist/hub/connect.d.ts.map +0 -1
- package/dist/hub/daemon-entry.d.ts +0 -2
- package/dist/hub/daemon-entry.d.ts.map +0 -1
- package/dist/hub/daemon-entry.js +0 -1305
- package/dist/hub/daemon.d.ts.map +0 -1
- package/dist/hub/defaults.d.ts.map +0 -1
- package/dist/hub/discovery.d.ts.map +0 -1
- package/dist/hub/index.d.ts.map +0 -1
- package/dist/hub/native-transport.d.ts.map +0 -1
- package/dist/hub/runtime-handlers.d.ts.map +0 -1
- package/dist/hub/server.d.ts +0 -104
- package/dist/hub/server.d.ts.map +0 -1
- package/dist/hub/session-client.d.ts.map +0 -1
- package/dist/hub/start-shared-server.d.ts.map +0 -1
- package/dist/hub/transport.d.ts.map +0 -1
- package/dist/hub/ui-client.d.ts.map +0 -1
- package/dist/hub/workspace.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/llms/cline-recommended-models.d.ts.map +0 -1
- package/dist/llms/configured-provider-registry.d.ts.map +0 -1
- package/dist/llms/handler-factory.d.ts +0 -16
- package/dist/llms/handler-factory.d.ts.map +0 -1
- package/dist/llms/provider-defaults.d.ts.map +0 -1
- package/dist/llms/provider-settings.d.ts.map +0 -1
- package/dist/llms/runtime-config.d.ts.map +0 -1
- package/dist/llms/runtime-registry.d.ts.map +0 -1
- package/dist/llms/runtime-types.d.ts.map +0 -1
- package/dist/runtime/agent-config-adapter.d.ts +0 -148
- package/dist/runtime/agent-config-adapter.d.ts.map +0 -1
- package/dist/runtime/agent-runtime-config-builder.d.ts.map +0 -1
- package/dist/runtime/history.d.ts +0 -10
- package/dist/runtime/history.d.ts.map +0 -1
- package/dist/runtime/host.d.ts.map +0 -1
- package/dist/runtime/loop-detection.d.ts.map +0 -1
- package/dist/runtime/mistake-tracker.d.ts.map +0 -1
- package/dist/runtime/rules.d.ts.map +0 -1
- package/dist/runtime/runtime-builder.d.ts.map +0 -1
- package/dist/runtime/runtime-event-adapter.d.ts.map +0 -1
- package/dist/runtime/runtime-host.d.ts.map +0 -1
- package/dist/runtime/runtime-oauth-token-manager.d.ts.map +0 -1
- package/dist/runtime/session-runtime-orchestrator.d.ts.map +0 -1
- package/dist/runtime/session-runtime.d.ts.map +0 -1
- package/dist/runtime/subprocess-sandbox.d.ts.map +0 -1
- package/dist/runtime/tool-approval.d.ts.map +0 -1
- package/dist/runtime/user-input-builder.d.ts.map +0 -1
- package/dist/services/agent-events.d.ts.map +0 -1
- package/dist/services/config.d.ts.map +0 -1
- package/dist/services/global-settings.d.ts.map +0 -1
- package/dist/services/index.js +0 -28
- package/dist/services/local-runtime-bootstrap.d.ts.map +0 -1
- package/dist/services/plugin-tools.d.ts.map +0 -1
- package/dist/services/providers/local-provider-registry.d.ts.map +0 -1
- package/dist/services/providers/local-provider-service.d.ts.map +0 -1
- package/dist/services/session-artifacts.d.ts.map +0 -1
- package/dist/services/session-data.d.ts.map +0 -1
- package/dist/services/session-telemetry.d.ts.map +0 -1
- package/dist/services/storage/file-team-store.d.ts.map +0 -1
- package/dist/services/storage/provider-settings-legacy-migration.d.ts.map +0 -1
- package/dist/services/storage/provider-settings-manager.d.ts.map +0 -1
- package/dist/services/storage/sqlite-session-store.d.ts.map +0 -1
- package/dist/services/storage/sqlite-team-store.d.ts.map +0 -1
- package/dist/services/storage/team-store.d.ts.map +0 -1
- package/dist/services/telemetry/ITelemetryAdapter.d.ts.map +0 -1
- package/dist/services/telemetry/OpenTelemetryAdapter.d.ts.map +0 -1
- package/dist/services/telemetry/OpenTelemetryProvider.d.ts.map +0 -1
- package/dist/services/telemetry/TelemetryLoggerSink.d.ts.map +0 -1
- package/dist/services/telemetry/TelemetryService.d.ts.map +0 -1
- package/dist/services/telemetry/core-events.d.ts.map +0 -1
- package/dist/services/telemetry/distinct-id.d.ts.map +0 -1
- package/dist/services/telemetry/index.d.ts.map +0 -1
- package/dist/services/usage.d.ts.map +0 -1
- package/dist/services/workspace/file-indexer.d.ts.map +0 -1
- package/dist/services/workspace/index.d.ts.map +0 -1
- package/dist/services/workspace/mention-enricher.d.ts.map +0 -1
- package/dist/services/workspace-manifest.d.ts.map +0 -1
- package/dist/session/conversation-store.d.ts.map +0 -1
- package/dist/session/file-session-service.d.ts.map +0 -1
- package/dist/session/message-builder.d.ts.map +0 -1
- package/dist/session/persistence-service.d.ts.map +0 -1
- package/dist/session/session-graph.d.ts.map +0 -1
- package/dist/session/session-manifest-store.d.ts.map +0 -1
- package/dist/session/session-manifest.d.ts.map +0 -1
- package/dist/session/session-row.d.ts.map +0 -1
- package/dist/session/session-service.d.ts.map +0 -1
- package/dist/session/session-team-coordination.d.ts.map +0 -1
- package/dist/session/subagent-session-manager.d.ts.map +0 -1
- package/dist/session/team-persistence-store.d.ts.map +0 -1
- package/dist/session/workspace-manager.d.ts.map +0 -1
- package/dist/transports/hub.d.ts +0 -58
- package/dist/transports/hub.d.ts.map +0 -1
- package/dist/transports/local.d.ts +0 -119
- package/dist/transports/local.d.ts.map +0 -1
- package/dist/transports/remote.d.ts.map +0 -1
- package/dist/transports/runtime-host-support.d.ts.map +0 -1
- package/dist/types/chat-schema.d.ts.map +0 -1
- package/dist/types/common.d.ts.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/events.d.ts.map +0 -1
- package/dist/types/provider-settings.d.ts.map +0 -1
- package/dist/types/session.d.ts.map +0 -1
- package/dist/types/sessions.d.ts.map +0 -1
- package/dist/types/storage.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/src/ClineCore.ts +0 -1026
- package/src/account/cline-account-service.ts +0 -338
- package/src/account/index.ts +0 -24
- package/src/account/rpc.ts +0 -185
- package/src/account/types.ts +0 -108
- package/src/auth/bounded-ttl-cache.ts +0 -53
- package/src/auth/client.ts +0 -46
- package/src/auth/cline.ts +0 -724
- package/src/auth/codex.ts +0 -491
- package/src/auth/oca.ts +0 -588
- package/src/auth/server.ts +0 -265
- package/src/auth/types.ts +0 -110
- package/src/auth/utils.ts +0 -247
- package/src/cron/cron-event-ingress.ts +0 -357
- package/src/cron/cron-materializer.ts +0 -97
- package/src/cron/cron-reconciler.ts +0 -241
- package/src/cron/cron-report-writer.ts +0 -153
- package/src/cron/cron-runner.ts +0 -495
- package/src/cron/cron-schema.ts +0 -127
- package/src/cron/cron-service.ts +0 -163
- package/src/cron/cron-spec-parser.ts +0 -489
- package/src/cron/cron-watcher.ts +0 -102
- package/src/cron/index.ts +0 -15
- package/src/cron/resource-limiter.ts +0 -46
- package/src/cron/schedule-command-service.ts +0 -193
- package/src/cron/schedule-service.ts +0 -703
- package/src/cron/scheduler.ts +0 -772
- package/src/cron/sqlite-cron-store.ts +0 -1286
- package/src/cron/sqlite-schedule-store.ts +0 -708
- package/src/extensions/config/agent-config-loader.ts +0 -114
- package/src/extensions/config/agent-config-parser.ts +0 -198
- package/src/extensions/config/hooks-config-loader.ts +0 -117
- package/src/extensions/config/index.ts +0 -77
- package/src/extensions/config/runtime-commands.ts +0 -82
- package/src/extensions/config/unified-config-file-watcher.ts +0 -496
- package/src/extensions/config/user-instruction-config-loader.ts +0 -549
- package/src/extensions/context/agentic-compaction.ts +0 -131
- package/src/extensions/context/basic-compaction.ts +0 -300
- package/src/extensions/context/compaction-shared.ts +0 -459
- package/src/extensions/context/compaction.ts +0 -226
- package/src/extensions/index.ts +0 -18
- package/src/extensions/mcp/client.ts +0 -420
- package/src/extensions/mcp/config-loader.ts +0 -219
- package/src/extensions/mcp/index.ts +0 -42
- package/src/extensions/mcp/manager.ts +0 -260
- package/src/extensions/mcp/name-transform.ts +0 -33
- package/src/extensions/mcp/policies.ts +0 -47
- package/src/extensions/mcp/tools.ts +0 -47
- package/src/extensions/mcp/types.ts +0 -116
- package/src/extensions/plugin/plugin-config-loader.ts +0 -140
- package/src/extensions/plugin/plugin-load-report.ts +0 -20
- package/src/extensions/plugin/plugin-loader.ts +0 -220
- package/src/extensions/plugin/plugin-module-import.ts +0 -276
- package/src/extensions/plugin/plugin-sandbox-bootstrap.ts +0 -662
- package/src/extensions/plugin/plugin-sandbox.ts +0 -586
- package/src/extensions/plugin/plugin-targeting.ts +0 -32
- package/src/extensions/tools/constants.ts +0 -37
- package/src/extensions/tools/definitions.ts +0 -738
- package/src/extensions/tools/executors/apply-patch-parser.ts +0 -520
- package/src/extensions/tools/executors/apply-patch.ts +0 -348
- package/src/extensions/tools/executors/bash.ts +0 -207
- package/src/extensions/tools/executors/editor.ts +0 -220
- package/src/extensions/tools/executors/file-read.ts +0 -135
- package/src/extensions/tools/executors/index.ts +0 -87
- package/src/extensions/tools/executors/search.ts +0 -470
- package/src/extensions/tools/executors/web-fetch.ts +0 -259
- package/src/extensions/tools/helpers.ts +0 -154
- package/src/extensions/tools/index.ts +0 -183
- package/src/extensions/tools/model-tool-routing.ts +0 -134
- package/src/extensions/tools/presets.ts +0 -190
- package/src/extensions/tools/runtime.ts +0 -261
- package/src/extensions/tools/schemas.ts +0 -343
- package/src/extensions/tools/team/delegated-agent.ts +0 -136
- package/src/extensions/tools/team/index.ts +0 -5
- package/src/extensions/tools/team/multi-agent.ts +0 -1845
- package/src/extensions/tools/team/projections.ts +0 -283
- package/src/extensions/tools/team/runtime.ts +0 -54
- package/src/extensions/tools/team/spawn-agent-tool.ts +0 -201
- package/src/extensions/tools/team/subagent-prompts.ts +0 -41
- package/src/extensions/tools/team/team-tools.ts +0 -902
- package/src/extensions/tools/types.ts +0 -354
- package/src/hooks/checkpoint-hooks.ts +0 -238
- package/src/hooks/hook-bridge.ts +0 -489
- package/src/hooks/hook-file-hooks.ts +0 -934
- package/src/hooks/hook-registry.ts +0 -257
- package/src/hooks/index.ts +0 -18
- package/src/hooks/subprocess-runner.ts +0 -196
- package/src/hooks/subprocess.ts +0 -469
- package/src/hub/browser-websocket.ts +0 -159
- package/src/hub/client.ts +0 -633
- package/src/hub/connect.ts +0 -156
- package/src/hub/daemon-entry.ts +0 -122
- package/src/hub/daemon.ts +0 -284
- package/src/hub/defaults.ts +0 -70
- package/src/hub/discovery.ts +0 -247
- package/src/hub/index.ts +0 -14
- package/src/hub/native-transport.ts +0 -31
- package/src/hub/runtime-handlers.ts +0 -141
- package/src/hub/server.ts +0 -2317
- package/src/hub/session-client.ts +0 -502
- package/src/hub/start-shared-server.ts +0 -61
- package/src/hub/transport.ts +0 -14
- package/src/hub/ui-client.ts +0 -126
- package/src/hub/workspace.ts +0 -19
- package/src/index.ts +0 -688
- package/src/llms/cline-recommended-models.ts +0 -167
- package/src/llms/configured-provider-registry.ts +0 -193
- package/src/llms/handler-factory.ts +0 -56
- package/src/llms/provider-defaults.ts +0 -653
- package/src/llms/provider-settings.ts +0 -310
- package/src/llms/runtime-config.ts +0 -43
- package/src/llms/runtime-registry.ts +0 -172
- package/src/llms/runtime-types.ts +0 -121
- package/src/runtime/agent-config-adapter.ts +0 -636
- package/src/runtime/agent-runtime-config-builder.ts +0 -205
- package/src/runtime/error-feedback.ts +0 -142
- package/src/runtime/history.ts +0 -374
- package/src/runtime/host.ts +0 -222
- package/src/runtime/index.ts +0 -23
- package/src/runtime/loop-detection.ts +0 -162
- package/src/runtime/mistake-tracker.ts +0 -221
- package/src/runtime/rules.ts +0 -49
- package/src/runtime/runtime-builder.ts +0 -814
- package/src/runtime/runtime-event-adapter.ts +0 -412
- package/src/runtime/runtime-host.ts +0 -250
- package/src/runtime/runtime-oauth-token-manager.ts +0 -268
- package/src/runtime/session-runtime-orchestrator.ts +0 -1253
- package/src/runtime/session-runtime.ts +0 -69
- package/src/runtime/subprocess-sandbox.ts +0 -255
- package/src/runtime/tool-approval.ts +0 -102
- package/src/runtime/user-input-builder.ts +0 -167
- package/src/services/agent-events.ts +0 -256
- package/src/services/config.ts +0 -5
- package/src/services/global-settings.ts +0 -122
- package/src/services/local-runtime-bootstrap.ts +0 -424
- package/src/services/plugin-tools.ts +0 -86
- package/src/services/providers/local-provider-registry.ts +0 -456
- package/src/services/providers/local-provider-service.ts +0 -772
- package/src/services/session-artifacts.ts +0 -138
- package/src/services/session-data.ts +0 -398
- package/src/services/session-telemetry.ts +0 -89
- package/src/services/storage/artifact-store.ts +0 -1
- package/src/services/storage/file-team-store.ts +0 -250
- package/src/services/storage/index.ts +0 -11
- package/src/services/storage/provider-settings-legacy-migration.ts +0 -789
- package/src/services/storage/provider-settings-manager.ts +0 -167
- package/src/services/storage/session-store.ts +0 -1
- package/src/services/storage/sqlite-session-store.ts +0 -270
- package/src/services/storage/sqlite-team-store.ts +0 -537
- package/src/services/storage/team-store.ts +0 -36
- package/src/services/telemetry/ITelemetryAdapter.ts +0 -94
- package/src/services/telemetry/OpenTelemetryAdapter.ts +0 -348
- package/src/services/telemetry/OpenTelemetryProvider.ts +0 -415
- package/src/services/telemetry/TelemetryLoggerSink.ts +0 -121
- package/src/services/telemetry/TelemetryService.ts +0 -139
- package/src/services/telemetry/core-events.ts +0 -400
- package/src/services/telemetry/distinct-id.ts +0 -58
- package/src/services/telemetry/index.ts +0 -20
- package/src/services/usage.ts +0 -32
- package/src/services/workspace/file-indexer.ts +0 -351
- package/src/services/workspace/index.ts +0 -7
- package/src/services/workspace/mention-enricher.ts +0 -122
- package/src/services/workspace-manifest.ts +0 -72
- package/src/session/conversation-store.ts +0 -77
- package/src/session/file-session-service.ts +0 -282
- package/src/session/index.ts +0 -32
- package/src/session/message-builder.ts +0 -941
- package/src/session/persistence-service.ts +0 -559
- package/src/session/session-graph.ts +0 -92
- package/src/session/session-manifest-store.ts +0 -158
- package/src/session/session-manifest.ts +0 -29
- package/src/session/session-row.ts +0 -199
- package/src/session/session-service.ts +0 -324
- package/src/session/session-team-coordination.ts +0 -240
- package/src/session/subagent-session-manager.ts +0 -397
- package/src/session/team-persistence-store.ts +0 -176
- package/src/session/workspace-manager.ts +0 -100
- package/src/transports/hub.ts +0 -1081
- package/src/transports/local.ts +0 -1826
- package/src/transports/remote.ts +0 -27
- package/src/transports/runtime-host-support.ts +0 -140
- package/src/types/chat-schema.ts +0 -81
- package/src/types/common.ts +0 -26
- package/src/types/config.ts +0 -220
- package/src/types/events.ts +0 -80
- package/src/types/index.ts +0 -26
- package/src/types/provider-settings.ts +0 -54
- package/src/types/session.ts +0 -111
- package/src/types/sessions.ts +0 -37
- package/src/types/storage.ts +0 -56
- package/src/types.ts +0 -167
- package/src/version.ts +0 -3
package/src/ClineCore.ts
DELETED
|
@@ -1,1026 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AgentConfig,
|
|
3
|
-
AgentExtensionAutomationContext,
|
|
4
|
-
AgentResult,
|
|
5
|
-
AutomationEventEnvelope,
|
|
6
|
-
BasicLogger,
|
|
7
|
-
ChatRunTurnRequest,
|
|
8
|
-
ChatStartSessionRequest,
|
|
9
|
-
ChatTurnResult,
|
|
10
|
-
ExtensionContext,
|
|
11
|
-
ITelemetryService,
|
|
12
|
-
ToolApprovalRequest,
|
|
13
|
-
ToolApprovalResult,
|
|
14
|
-
} from "@clinebot/shared";
|
|
15
|
-
import type {
|
|
16
|
-
CronEventIngressResult,
|
|
17
|
-
CronEventSuppression,
|
|
18
|
-
} from "./cron/cron-event-ingress";
|
|
19
|
-
import { CronService } from "./cron/cron-service";
|
|
20
|
-
import type { HubScheduleRuntimeHandlers } from "./cron/schedule-service";
|
|
21
|
-
import type {
|
|
22
|
-
CronEventLogRecord,
|
|
23
|
-
CronRunRecord,
|
|
24
|
-
CronSpecRecord,
|
|
25
|
-
} from "./cron/sqlite-cron-store";
|
|
26
|
-
import type { ToolExecutors } from "./extensions/tools";
|
|
27
|
-
import { normalizeProviderId } from "./llms/provider-settings";
|
|
28
|
-
import type { SessionHistoryListOptions } from "./runtime/history";
|
|
29
|
-
import { listSessionHistory } from "./runtime/history";
|
|
30
|
-
import type { SessionBackend } from "./runtime/host";
|
|
31
|
-
import { createRuntimeHost } from "./runtime/host";
|
|
32
|
-
import type {
|
|
33
|
-
LocalRuntimeStartOptions,
|
|
34
|
-
PendingPromptMutationResult,
|
|
35
|
-
PendingPromptsAction,
|
|
36
|
-
PendingPromptsDeleteInput,
|
|
37
|
-
PendingPromptsListInput,
|
|
38
|
-
PendingPromptsUpdateInput,
|
|
39
|
-
RuntimeHost,
|
|
40
|
-
RuntimeHostMode,
|
|
41
|
-
RuntimeHostSubscribeOptions,
|
|
42
|
-
StartSessionInput,
|
|
43
|
-
StartSessionResult,
|
|
44
|
-
} from "./runtime/runtime-host";
|
|
45
|
-
import { splitCoreSessionConfig } from "./runtime/runtime-host";
|
|
46
|
-
import { CORE_TELEMETRY_EVENTS } from "./services/telemetry/core-events";
|
|
47
|
-
import { SessionSource } from "./types/common";
|
|
48
|
-
import type { CoreSessionConfig } from "./types/config";
|
|
49
|
-
import type { CoreSessionEvent, SessionPendingPrompt } from "./types/events";
|
|
50
|
-
import type { SessionMessagesArtifactUploader } from "./types/session";
|
|
51
|
-
import type { SessionHistoryRecord } from "./types/sessions";
|
|
52
|
-
|
|
53
|
-
export interface HubOptions {
|
|
54
|
-
endpoint?: string;
|
|
55
|
-
authToken?: string;
|
|
56
|
-
strategy?: "prefer-hub" | "require-hub";
|
|
57
|
-
clientType?: string;
|
|
58
|
-
displayName?: string;
|
|
59
|
-
workspaceRoot?: string;
|
|
60
|
-
cwd?: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface RemoteOptions {
|
|
64
|
-
endpoint: string;
|
|
65
|
-
authToken?: string;
|
|
66
|
-
clientType?: string;
|
|
67
|
-
displayName?: string;
|
|
68
|
-
workspaceRoot?: string;
|
|
69
|
-
cwd?: string;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface ClineCoreAutomationOptions {
|
|
73
|
-
/** @deprecated Use `cronSpecsDir`. */
|
|
74
|
-
cronDir?: string;
|
|
75
|
-
cronSpecsDir?: string;
|
|
76
|
-
/** @deprecated Reports are written under the resolved cron specs directory. */
|
|
77
|
-
reportsDir?: string;
|
|
78
|
-
cronScope?: "global" | "user" | "workspace";
|
|
79
|
-
workspaceRoot?: string;
|
|
80
|
-
dbPath?: string;
|
|
81
|
-
pollIntervalMs?: number;
|
|
82
|
-
claimLeaseSeconds?: number;
|
|
83
|
-
globalMaxConcurrency?: number;
|
|
84
|
-
watcherDebounceMs?: number;
|
|
85
|
-
autoStart?: boolean;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export type ClineAutomationSpec = CronSpecRecord;
|
|
89
|
-
export type ClineAutomationRun = CronRunRecord;
|
|
90
|
-
export type ClineAutomationEventLog = CronEventLogRecord;
|
|
91
|
-
export type ClineAutomationEventSuppression = CronEventSuppression;
|
|
92
|
-
export type ClineAutomationRunStatus =
|
|
93
|
-
| "queued"
|
|
94
|
-
| "running"
|
|
95
|
-
| "done"
|
|
96
|
-
| "failed"
|
|
97
|
-
| "cancelled";
|
|
98
|
-
|
|
99
|
-
export interface ClineAutomationListSpecsOptions {
|
|
100
|
-
triggerKind?: "one_off" | "schedule" | "event";
|
|
101
|
-
enabled?: boolean;
|
|
102
|
-
parseStatus?: "valid" | "invalid";
|
|
103
|
-
includeRemoved?: boolean;
|
|
104
|
-
limit?: number;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export interface ClineAutomationListRunsOptions {
|
|
108
|
-
specId?: string;
|
|
109
|
-
status?: ClineAutomationRunStatus | ClineAutomationRunStatus[];
|
|
110
|
-
limit?: number;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface ClineAutomationListEventsOptions {
|
|
114
|
-
eventType?: string;
|
|
115
|
-
source?: string;
|
|
116
|
-
processingStatus?:
|
|
117
|
-
| "received"
|
|
118
|
-
| "unmatched"
|
|
119
|
-
| "queued"
|
|
120
|
-
| "suppressed"
|
|
121
|
-
| "failed";
|
|
122
|
-
limit?: number;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface ClineAutomationEventIngressResult {
|
|
126
|
-
event: ClineAutomationEventLog;
|
|
127
|
-
duplicate: boolean;
|
|
128
|
-
matchedSpecIds: string[];
|
|
129
|
-
queuedRuns: ClineAutomationRun[];
|
|
130
|
-
suppressions: ClineAutomationEventSuppression[];
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export interface ClineCoreAutomationApi {
|
|
134
|
-
start(): Promise<void>;
|
|
135
|
-
stop(): Promise<void>;
|
|
136
|
-
reconcileNow(): Promise<void>;
|
|
137
|
-
ingestEvent(event: any): ClineAutomationEventIngressResult;
|
|
138
|
-
listEvents(
|
|
139
|
-
options?: ClineAutomationListEventsOptions,
|
|
140
|
-
): ClineAutomationEventLog[];
|
|
141
|
-
getEvent(eventId: string): ClineAutomationEventLog | undefined;
|
|
142
|
-
listSpecs(options?: ClineAutomationListSpecsOptions): ClineAutomationSpec[];
|
|
143
|
-
listRuns(options?: ClineAutomationListRunsOptions): ClineAutomationRun[];
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export type { RuntimeHostMode };
|
|
147
|
-
|
|
148
|
-
export type ClineCoreListHistoryOptions = SessionHistoryListOptions;
|
|
149
|
-
|
|
150
|
-
export interface ClineCoreStartInput
|
|
151
|
-
extends Omit<StartSessionInput, "config" | "localRuntime"> {
|
|
152
|
-
config: CoreSessionConfig;
|
|
153
|
-
localRuntime?: LocalRuntimeStartOptions;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export interface ClineCoreOptions {
|
|
157
|
-
/**
|
|
158
|
-
* A human-readable name for this SDK client (e.g. `"my-app"`, `"acme-bot"`).
|
|
159
|
-
* Used to identify the consumer in telemetry and logs.
|
|
160
|
-
*/
|
|
161
|
-
clientName?: string;
|
|
162
|
-
/**
|
|
163
|
-
* A stable identifier for this machine or user, used for telemetry attribution.
|
|
164
|
-
* Defaults to the system machine ID, falling back to a generated `cl-<nanoid>` persisted
|
|
165
|
-
* at `~/.cline/data/machine-id`.
|
|
166
|
-
*/
|
|
167
|
-
distinctId?: string;
|
|
168
|
-
/**
|
|
169
|
-
* Controls how the runtime host is selected:
|
|
170
|
-
* - `"auto"` (default) — prefers a compatible local hub when one is available and falls
|
|
171
|
-
* back to local in-process execution when not.
|
|
172
|
-
* - `"hub"` — requires a compatible websocket hub runtime; throws if one is not reachable.
|
|
173
|
-
* - `"remote"` — requires an explicit remote websocket hub endpoint.
|
|
174
|
-
* - `"local"` — always uses local in-process execution and local SQLite/file storage.
|
|
175
|
-
*/
|
|
176
|
-
backendMode?: RuntimeHostMode;
|
|
177
|
-
/**
|
|
178
|
-
* Hub runtime connection options. Used when `backendMode` is `"hub"` or when `"auto"`
|
|
179
|
-
* should prefer a shared local hub if available.
|
|
180
|
-
*/
|
|
181
|
-
hub?: HubOptions;
|
|
182
|
-
/**
|
|
183
|
-
* Remote hub connection options. Only relevant when `backendMode` is `"remote"`.
|
|
184
|
-
*/
|
|
185
|
-
remote?: RemoteOptions;
|
|
186
|
-
/**
|
|
187
|
-
* Override one or more default tool executors (e.g. file I/O, shell, browser).
|
|
188
|
-
* Partial — only the keys you supply are replaced; the rest use built-in implementations.
|
|
189
|
-
*/
|
|
190
|
-
defaultToolExecutors?: Partial<ToolExecutors>;
|
|
191
|
-
/**
|
|
192
|
-
* Telemetry service instance to use for capturing events and usage.
|
|
193
|
-
* If omitted, telemetry is a no-op.
|
|
194
|
-
*/
|
|
195
|
-
telemetry?: ITelemetryService;
|
|
196
|
-
/**
|
|
197
|
-
* Optional structured logger for core-side operational diagnostics such as
|
|
198
|
-
* runtime-host selection and fallback decisions.
|
|
199
|
-
*/
|
|
200
|
-
logger?: BasicLogger;
|
|
201
|
-
/**
|
|
202
|
-
* Per-tool approval policies that control whether a tool runs automatically,
|
|
203
|
-
* requires user confirmation, or is blocked entirely.
|
|
204
|
-
*/
|
|
205
|
-
toolPolicies?: AgentConfig["toolPolicies"];
|
|
206
|
-
/**
|
|
207
|
-
* Called before any tool is executed that requires explicit user approval.
|
|
208
|
-
* Return `{ approved: true }` to allow or `{ approved: false }` to deny.
|
|
209
|
-
* If omitted, all approval-required tools are auto-denied.
|
|
210
|
-
*/
|
|
211
|
-
requestToolApproval?: (
|
|
212
|
-
request: ToolApprovalRequest,
|
|
213
|
-
) => Promise<ToolApprovalResult>;
|
|
214
|
-
/**
|
|
215
|
-
* Optional hook invoked after `messages.json` is persisted to disk.
|
|
216
|
-
* Consumers can use this to mirror session transcripts into remote storage.
|
|
217
|
-
*/
|
|
218
|
-
messagesArtifactUploader?: SessionMessagesArtifactUploader;
|
|
219
|
-
/**
|
|
220
|
-
* Enables file-based and event-driven automation through this ClineCore
|
|
221
|
-
* instance. When configured, callers use `cline.automation.*` instead of
|
|
222
|
-
* constructing cron services directly.
|
|
223
|
-
*/
|
|
224
|
-
automation?: boolean | ClineCoreAutomationOptions;
|
|
225
|
-
/**
|
|
226
|
-
* Custom `fetch` implementation forwarded to the AI gateway providers used
|
|
227
|
-
* by local sessions. When supplied, it is threaded into each
|
|
228
|
-
* `ProviderConfig.fetch` built during session bootstrap, which in turn
|
|
229
|
-
* populates `GatewayProviderSettings.fetch` (and the top-level
|
|
230
|
-
* `GatewayConfig.fetch` fallback) so hosts can inject custom HTTP behavior
|
|
231
|
-
* such as proxies, retries, tracing, or test doubles.
|
|
232
|
-
*
|
|
233
|
-
* Per-session or per-provider overrides still win: an explicit
|
|
234
|
-
* `config.fetch` on `CoreSessionConfig` or a stored provider-level `fetch`
|
|
235
|
-
* takes precedence over this default.
|
|
236
|
-
*
|
|
237
|
-
* Applies only to sessions executed in this process (local and fallback-
|
|
238
|
-
* to-local auto mode). For hub and remote runtimes the HTTP call happens
|
|
239
|
-
* inside the process that owns the gateway, so configure `fetch` there:
|
|
240
|
-
* - `startHubServer({ fetch })` / `ensureHubServer({ fetch })` from
|
|
241
|
-
* `@clinebot/hub`
|
|
242
|
-
* - `createLocalHubScheduleRuntimeHandlers({ fetch })` from
|
|
243
|
-
* `@clinebot/core/hub` for the scheduler
|
|
244
|
-
*/
|
|
245
|
-
fetch?: typeof fetch;
|
|
246
|
-
/**
|
|
247
|
-
* An already-constructed session backend to use instead of resolving one automatically.
|
|
248
|
-
* Intended for testing or embedding a custom persistence layer.
|
|
249
|
-
* @internal
|
|
250
|
-
*/
|
|
251
|
-
sessionService?: SessionBackend;
|
|
252
|
-
/**
|
|
253
|
-
* Optional hook invoked before each session starts.
|
|
254
|
-
* Use this to prepare workspace-scoped runtime state and then return an
|
|
255
|
-
* adapter that mutates the shared session input before core starts the run.
|
|
256
|
-
*/
|
|
257
|
-
prepare?: (
|
|
258
|
-
input: ClineCoreStartInput,
|
|
259
|
-
) =>
|
|
260
|
-
| Promise<StartSessionBootstrap | undefined>
|
|
261
|
-
| StartSessionBootstrap
|
|
262
|
-
| undefined;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export interface StartSessionBootstrap {
|
|
266
|
-
applyToStartSessionInput(
|
|
267
|
-
input: ClineCoreStartInput,
|
|
268
|
-
): Promise<ClineCoreStartInput> | ClineCoreStartInput;
|
|
269
|
-
dispose?(): Promise<void> | void;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
function normalizeAutomationOptions(
|
|
273
|
-
options: ClineCoreOptions["automation"],
|
|
274
|
-
): ClineCoreAutomationOptions | undefined {
|
|
275
|
-
if (options === true) return {};
|
|
276
|
-
if (!options) return undefined;
|
|
277
|
-
return options;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
function normalizeAutomationCronScope(
|
|
281
|
-
scope: ClineCoreAutomationOptions["cronScope"],
|
|
282
|
-
): "global" | "workspace" | undefined {
|
|
283
|
-
if (scope === "user") return "global";
|
|
284
|
-
return scope;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function toChatTurnResult(result: AgentResult): ChatTurnResult {
|
|
288
|
-
return {
|
|
289
|
-
text: result.text,
|
|
290
|
-
usage: {
|
|
291
|
-
inputTokens: result.usage.inputTokens,
|
|
292
|
-
outputTokens: result.usage.outputTokens,
|
|
293
|
-
cacheReadTokens: result.usage.cacheReadTokens,
|
|
294
|
-
cacheWriteTokens: result.usage.cacheWriteTokens,
|
|
295
|
-
totalCost: result.usage.totalCost,
|
|
296
|
-
},
|
|
297
|
-
inputTokens: result.usage.inputTokens,
|
|
298
|
-
outputTokens: result.usage.outputTokens,
|
|
299
|
-
iterations: result.iterations,
|
|
300
|
-
finishReason: result.finishReason,
|
|
301
|
-
toolCalls: result.toolCalls.map((call) => ({
|
|
302
|
-
name: call.name,
|
|
303
|
-
input: call.input,
|
|
304
|
-
output: call.output,
|
|
305
|
-
error: call.error,
|
|
306
|
-
durationMs: call.durationMs,
|
|
307
|
-
})),
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
function resolveMode(
|
|
312
|
-
request: ChatStartSessionRequest | ChatRunTurnRequest["config"],
|
|
313
|
-
): "act" | "plan" | "yolo" {
|
|
314
|
-
return request.mode === "plan"
|
|
315
|
-
? "plan"
|
|
316
|
-
: request.mode === "yolo"
|
|
317
|
-
? "yolo"
|
|
318
|
-
: "act";
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
class ClineCoreAutomationController implements ClineCoreAutomationApi {
|
|
322
|
-
constructor(private readonly getService: () => CronService) {}
|
|
323
|
-
|
|
324
|
-
async start(): Promise<void> {
|
|
325
|
-
await this.getService().start();
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
async stop(): Promise<void> {
|
|
329
|
-
await this.getService().stop();
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
async reconcileNow(): Promise<void> {
|
|
333
|
-
await this.getService().reconcileNow();
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
ingestEvent(
|
|
337
|
-
event: AutomationEventEnvelope,
|
|
338
|
-
): ClineAutomationEventIngressResult {
|
|
339
|
-
const result: CronEventIngressResult = this.getService().ingestEvent(event);
|
|
340
|
-
return {
|
|
341
|
-
event: result.event,
|
|
342
|
-
duplicate: result.duplicate,
|
|
343
|
-
matchedSpecIds: result.matchedSpecs.map((spec) => spec.specId),
|
|
344
|
-
queuedRuns: result.queuedRuns,
|
|
345
|
-
suppressions: result.suppressions,
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
listEvents(
|
|
350
|
-
options?: ClineAutomationListEventsOptions,
|
|
351
|
-
): ClineAutomationEventLog[] {
|
|
352
|
-
return this.getService().listEventLogs(options);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
getEvent(eventId: string): ClineAutomationEventLog | undefined {
|
|
356
|
-
return this.getService().getEventLog(eventId);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
listSpecs(options?: ClineAutomationListSpecsOptions): ClineAutomationSpec[] {
|
|
360
|
-
return this.getService().listSpecs(options);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
listRuns(options?: ClineAutomationListRunsOptions): ClineAutomationRun[] {
|
|
364
|
-
return this.getService().listRuns(options);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* The primary entry point for the Cline Core SDK.
|
|
370
|
-
*
|
|
371
|
-
* @example
|
|
372
|
-
* ```ts
|
|
373
|
-
* import { ClineCore } from "@clinebot/core";
|
|
374
|
-
*
|
|
375
|
-
* const cline = await ClineCore.create({ clientName: "my-app" });
|
|
376
|
-
* const session = await cline.start({ ... });
|
|
377
|
-
* ```
|
|
378
|
-
*/
|
|
379
|
-
export class ClineCore implements RuntimeHost {
|
|
380
|
-
readonly clientName: string | undefined;
|
|
381
|
-
readonly runtimeAddress: string | undefined;
|
|
382
|
-
readonly automation: ClineCoreAutomationApi;
|
|
383
|
-
private readonly host: RuntimeHost;
|
|
384
|
-
private readonly prepare: ClineCoreOptions["prepare"] | undefined;
|
|
385
|
-
private readonly defaultToolExecutors: Partial<ToolExecutors> | undefined;
|
|
386
|
-
private readonly logger: BasicLogger | undefined;
|
|
387
|
-
private readonly telemetry: ITelemetryService | undefined;
|
|
388
|
-
private readonly distinctId: string | undefined;
|
|
389
|
-
private readonly automationService: CronService | undefined;
|
|
390
|
-
private readonly activeSessionBootstraps = new Map<
|
|
391
|
-
string,
|
|
392
|
-
StartSessionBootstrap
|
|
393
|
-
>();
|
|
394
|
-
private readonly unsubscribeBootstrapCleanup: () => void;
|
|
395
|
-
|
|
396
|
-
private constructor(
|
|
397
|
-
host: RuntimeHost,
|
|
398
|
-
clientName: string | undefined,
|
|
399
|
-
runtimeAddress: string | undefined,
|
|
400
|
-
prepare: ClineCoreOptions["prepare"],
|
|
401
|
-
defaultToolExecutors: Partial<ToolExecutors> | undefined,
|
|
402
|
-
logger: BasicLogger | undefined,
|
|
403
|
-
telemetry: ITelemetryService | undefined,
|
|
404
|
-
distinctId: string | undefined,
|
|
405
|
-
automationOptions:
|
|
406
|
-
| (ClineCoreAutomationOptions & { logger?: BasicLogger })
|
|
407
|
-
| undefined,
|
|
408
|
-
) {
|
|
409
|
-
this.clientName = clientName;
|
|
410
|
-
this.runtimeAddress = runtimeAddress;
|
|
411
|
-
this.host = host;
|
|
412
|
-
this.prepare = prepare;
|
|
413
|
-
this.defaultToolExecutors = defaultToolExecutors;
|
|
414
|
-
this.logger = logger;
|
|
415
|
-
this.telemetry = telemetry;
|
|
416
|
-
this.distinctId = distinctId;
|
|
417
|
-
this.automationService = automationOptions
|
|
418
|
-
? new CronService({
|
|
419
|
-
workspaceRoot: automationOptions.workspaceRoot ?? process.cwd(),
|
|
420
|
-
specs: {
|
|
421
|
-
cronSpecsDir:
|
|
422
|
-
automationOptions.cronSpecsDir ?? automationOptions.cronDir,
|
|
423
|
-
scope: normalizeAutomationCronScope(automationOptions.cronScope),
|
|
424
|
-
workspaceRoot: automationOptions.workspaceRoot,
|
|
425
|
-
},
|
|
426
|
-
runtimeHandlers: this.createAutomationRuntimeHandlers(host),
|
|
427
|
-
dbPath: automationOptions.dbPath,
|
|
428
|
-
logger: automationOptions.logger,
|
|
429
|
-
pollIntervalMs: automationOptions.pollIntervalMs,
|
|
430
|
-
claimLeaseSeconds: automationOptions.claimLeaseSeconds,
|
|
431
|
-
globalMaxConcurrency: automationOptions.globalMaxConcurrency,
|
|
432
|
-
watcherDebounceMs: automationOptions.watcherDebounceMs,
|
|
433
|
-
})
|
|
434
|
-
: undefined;
|
|
435
|
-
this.automation = new ClineCoreAutomationController(() => {
|
|
436
|
-
if (!this.automationService) {
|
|
437
|
-
throw new Error(
|
|
438
|
-
"ClineCore automation is not enabled. Pass `automation: true` or automation options to ClineCore.create().",
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
return this.automationService;
|
|
442
|
-
});
|
|
443
|
-
this.unsubscribeBootstrapCleanup = this.host.subscribe((event) => {
|
|
444
|
-
if (event.type !== "ended") {
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
void this.disposeSessionBootstrap(event.payload.sessionId);
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Creates a new ClineCore instance.
|
|
453
|
-
*
|
|
454
|
-
* This is the primary factory method for initializing the SDK. It sets up the runtime
|
|
455
|
-
* host (local, hub, or remote) based on the provided options and prepares the SDK for
|
|
456
|
-
* starting sessions.
|
|
457
|
-
*
|
|
458
|
-
* @param options Configuration options for the SDK instance
|
|
459
|
-
* @returns A promise that resolves to a new ClineCore instance
|
|
460
|
-
*
|
|
461
|
-
* @example
|
|
462
|
-
* ```ts
|
|
463
|
-
* const cline = await ClineCore.create({
|
|
464
|
-
* clientName: "my-app",
|
|
465
|
-
* backendMode: "local",
|
|
466
|
-
* });
|
|
467
|
-
* ```
|
|
468
|
-
*/
|
|
469
|
-
static async create(options: ClineCoreOptions = {}): Promise<ClineCore> {
|
|
470
|
-
const host = await createRuntimeHost(options);
|
|
471
|
-
const automationOptions = normalizeAutomationOptions(options.automation);
|
|
472
|
-
const core = new ClineCore(
|
|
473
|
-
host,
|
|
474
|
-
options.clientName,
|
|
475
|
-
host.runtimeAddress,
|
|
476
|
-
options.prepare,
|
|
477
|
-
options.defaultToolExecutors,
|
|
478
|
-
options.logger,
|
|
479
|
-
options.telemetry,
|
|
480
|
-
options.distinctId,
|
|
481
|
-
automationOptions
|
|
482
|
-
? { ...automationOptions, logger: options.logger }
|
|
483
|
-
: undefined,
|
|
484
|
-
);
|
|
485
|
-
if (automationOptions && automationOptions.autoStart !== false) {
|
|
486
|
-
await core.automation.start();
|
|
487
|
-
}
|
|
488
|
-
return core;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
private createAutomationRuntimeHandlers(
|
|
492
|
-
host: RuntimeHost,
|
|
493
|
-
): HubScheduleRuntimeHandlers {
|
|
494
|
-
const core = this;
|
|
495
|
-
return {
|
|
496
|
-
async startSession(request) {
|
|
497
|
-
const cwd = (request.cwd?.trim() || request.workspaceRoot).trim();
|
|
498
|
-
const started = await host.start({
|
|
499
|
-
source: request.source?.trim() || SessionSource.CLI,
|
|
500
|
-
interactive: false,
|
|
501
|
-
config: {
|
|
502
|
-
providerId: normalizeProviderId(request.provider),
|
|
503
|
-
modelId: request.model,
|
|
504
|
-
apiKey: request.apiKey?.trim() || undefined,
|
|
505
|
-
cwd,
|
|
506
|
-
workspaceRoot: request.workspaceRoot,
|
|
507
|
-
systemPrompt: request.systemPrompt ?? "",
|
|
508
|
-
mode: resolveMode(request),
|
|
509
|
-
maxIterations: request.maxIterations,
|
|
510
|
-
enableTools: request.enableTools !== false,
|
|
511
|
-
enableSpawnAgent: request.enableSpawn !== false,
|
|
512
|
-
enableAgentTeams: request.enableTeams !== false,
|
|
513
|
-
disableMcpSettingsTools: request.disableMcpSettingsTools,
|
|
514
|
-
missionLogIntervalSteps: request.missionStepInterval,
|
|
515
|
-
missionLogIntervalMs: request.missionTimeIntervalMs,
|
|
516
|
-
},
|
|
517
|
-
toolPolicies: request.toolPolicies ?? {
|
|
518
|
-
"*": {
|
|
519
|
-
autoApprove: request.autoApproveTools !== false,
|
|
520
|
-
},
|
|
521
|
-
},
|
|
522
|
-
localRuntime: {
|
|
523
|
-
configOverrides: {
|
|
524
|
-
extensionContext: core.withAutomationExtensionContext(),
|
|
525
|
-
},
|
|
526
|
-
configExtensions: request.configExtensions,
|
|
527
|
-
},
|
|
528
|
-
});
|
|
529
|
-
return {
|
|
530
|
-
sessionId: started.sessionId,
|
|
531
|
-
startResult: {
|
|
532
|
-
sessionId: started.sessionId,
|
|
533
|
-
manifestPath: started.manifestPath,
|
|
534
|
-
messagesPath: started.messagesPath,
|
|
535
|
-
},
|
|
536
|
-
};
|
|
537
|
-
},
|
|
538
|
-
async sendSession(sessionId, request) {
|
|
539
|
-
const result = await host.send({
|
|
540
|
-
sessionId,
|
|
541
|
-
prompt: request.prompt,
|
|
542
|
-
userImages: request.attachments?.userImages,
|
|
543
|
-
userFiles: request.attachments?.userFiles?.map(
|
|
544
|
-
(file) => file.content,
|
|
545
|
-
),
|
|
546
|
-
delivery: request.delivery,
|
|
547
|
-
});
|
|
548
|
-
if (!result) {
|
|
549
|
-
throw new Error("ClineCore automation runtime returned no result");
|
|
550
|
-
}
|
|
551
|
-
return { result: toChatTurnResult(result) };
|
|
552
|
-
},
|
|
553
|
-
async abortSession(sessionId) {
|
|
554
|
-
await host.abort(sessionId, new Error("ClineCore automation abort"));
|
|
555
|
-
return { applied: true };
|
|
556
|
-
},
|
|
557
|
-
async stopSession(sessionId) {
|
|
558
|
-
await host.stop(sessionId);
|
|
559
|
-
return { applied: true };
|
|
560
|
-
},
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
private createAutomationPluginContext():
|
|
565
|
-
| AgentExtensionAutomationContext
|
|
566
|
-
| undefined {
|
|
567
|
-
if (!this.automationService) {
|
|
568
|
-
return undefined;
|
|
569
|
-
}
|
|
570
|
-
return {
|
|
571
|
-
ingestEvent: (event: AutomationEventEnvelope) => {
|
|
572
|
-
this.automation.ingestEvent(event);
|
|
573
|
-
},
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
private withAutomationExtensionContext(
|
|
578
|
-
context?: ExtensionContext,
|
|
579
|
-
): ExtensionContext | undefined {
|
|
580
|
-
const automation = this.createAutomationPluginContext();
|
|
581
|
-
const client =
|
|
582
|
-
context?.client ??
|
|
583
|
-
(this.clientName ? { name: this.clientName } : undefined);
|
|
584
|
-
const user =
|
|
585
|
-
context?.user ??
|
|
586
|
-
(this.distinctId ? { distinctId: this.distinctId } : undefined);
|
|
587
|
-
const logger = context?.logger ?? this.logger;
|
|
588
|
-
const telemetry = context?.telemetry ?? this.telemetry;
|
|
589
|
-
if (!automation && !client && !user && !logger && !telemetry) {
|
|
590
|
-
return context;
|
|
591
|
-
}
|
|
592
|
-
return {
|
|
593
|
-
...(context ?? {}),
|
|
594
|
-
...(client ? { client } : {}),
|
|
595
|
-
...(user ? { user } : {}),
|
|
596
|
-
...(logger ? { logger } : {}),
|
|
597
|
-
...(telemetry ? { telemetry } : {}),
|
|
598
|
-
...(automation ? { automation } : {}),
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
private async disposeSessionBootstrap(sessionId: string): Promise<void> {
|
|
603
|
-
const bootstrap = this.activeSessionBootstraps.get(sessionId);
|
|
604
|
-
if (!bootstrap) {
|
|
605
|
-
return;
|
|
606
|
-
}
|
|
607
|
-
this.activeSessionBootstraps.delete(sessionId);
|
|
608
|
-
await Promise.resolve(bootstrap.dispose?.());
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
private toClineCoreStartInput(
|
|
612
|
-
input: StartSessionInput | ClineCoreStartInput,
|
|
613
|
-
): ClineCoreStartInput {
|
|
614
|
-
const config = input.config as CoreSessionConfig;
|
|
615
|
-
return "providerId" in config
|
|
616
|
-
? {
|
|
617
|
-
...input,
|
|
618
|
-
config: {
|
|
619
|
-
...config,
|
|
620
|
-
...(input.localRuntime?.configOverrides ?? {}),
|
|
621
|
-
},
|
|
622
|
-
localRuntime: input.localRuntime
|
|
623
|
-
? {
|
|
624
|
-
...input.localRuntime,
|
|
625
|
-
configOverrides: input.localRuntime.configOverrides,
|
|
626
|
-
}
|
|
627
|
-
: undefined,
|
|
628
|
-
}
|
|
629
|
-
: (input as ClineCoreStartInput);
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
private normalizeStartInput(input: ClineCoreStartInput): StartSessionInput {
|
|
633
|
-
const split = splitCoreSessionConfig(input.config);
|
|
634
|
-
let localRuntime: LocalRuntimeStartOptions | undefined =
|
|
635
|
-
split.localRuntime || input.localRuntime || this.defaultToolExecutors
|
|
636
|
-
? {
|
|
637
|
-
...(split.localRuntime ?? {}),
|
|
638
|
-
...(input.localRuntime ?? {}),
|
|
639
|
-
configOverrides: {
|
|
640
|
-
...(split.localRuntime?.configOverrides ?? {}),
|
|
641
|
-
...(input.localRuntime?.configOverrides ?? {}),
|
|
642
|
-
},
|
|
643
|
-
defaultToolExecutors: {
|
|
644
|
-
...(this.defaultToolExecutors ?? {}),
|
|
645
|
-
...(split.localRuntime?.defaultToolExecutors ?? {}),
|
|
646
|
-
...(input.localRuntime?.defaultToolExecutors ?? {}),
|
|
647
|
-
},
|
|
648
|
-
}
|
|
649
|
-
: undefined;
|
|
650
|
-
const automationExtensionContext = this.withAutomationExtensionContext(
|
|
651
|
-
localRuntime?.configOverrides?.extensionContext,
|
|
652
|
-
);
|
|
653
|
-
if (automationExtensionContext) {
|
|
654
|
-
localRuntime = {
|
|
655
|
-
...(localRuntime ?? {}),
|
|
656
|
-
configOverrides: {
|
|
657
|
-
...(localRuntime?.configOverrides ?? {}),
|
|
658
|
-
extensionContext: automationExtensionContext,
|
|
659
|
-
},
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
return {
|
|
663
|
-
...input,
|
|
664
|
-
...split,
|
|
665
|
-
...(localRuntime ? { localRuntime } : {}),
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
/**
|
|
670
|
-
* Starts a new Cline session with the provided configuration.
|
|
671
|
-
*
|
|
672
|
-
* This method initializes and begins a new agent session. It handles session setup,
|
|
673
|
-
* runs any preparation hooks, and returns session metadata along with event streams.
|
|
674
|
-
* The session continues to run until explicitly stopped or aborted.
|
|
675
|
-
*
|
|
676
|
-
* @param input The session configuration and startup parameters
|
|
677
|
-
* @returns A promise that resolves to session metadata and event stream
|
|
678
|
-
*
|
|
679
|
-
* @example
|
|
680
|
-
* ```ts
|
|
681
|
-
* const result = await cline.start({
|
|
682
|
-
* config: {
|
|
683
|
-
* providerId: "anthropic",
|
|
684
|
-
* modelId: "claude-opus-4-1",
|
|
685
|
-
* },
|
|
686
|
-
* });
|
|
687
|
-
*
|
|
688
|
-
* // Subscribe to session events
|
|
689
|
-
* result.subscribe((event) => {
|
|
690
|
-
* console.log("Session event:", event);
|
|
691
|
-
* });
|
|
692
|
-
* ```
|
|
693
|
-
*/
|
|
694
|
-
start(input: StartSessionInput): Promise<StartSessionResult>;
|
|
695
|
-
/**
|
|
696
|
-
* Starts a new Cline session with extended core-specific configuration.
|
|
697
|
-
* This overload allows specifying local runtime options and config overrides.
|
|
698
|
-
*/
|
|
699
|
-
start(input: ClineCoreStartInput): Promise<StartSessionResult>;
|
|
700
|
-
async start(
|
|
701
|
-
input: StartSessionInput | ClineCoreStartInput,
|
|
702
|
-
): Promise<StartSessionResult> {
|
|
703
|
-
const clineCoreInput = this.toClineCoreStartInput(input);
|
|
704
|
-
const bootstrap = await this.prepare?.(clineCoreInput);
|
|
705
|
-
try {
|
|
706
|
-
const preparedInput = bootstrap
|
|
707
|
-
? await bootstrap.applyToStartSessionInput(clineCoreInput)
|
|
708
|
-
: clineCoreInput;
|
|
709
|
-
const result = await this.host.start(
|
|
710
|
-
this.normalizeStartInput(preparedInput),
|
|
711
|
-
);
|
|
712
|
-
if (bootstrap) {
|
|
713
|
-
const activeSession = await this.host.get(result.sessionId);
|
|
714
|
-
if (activeSession) {
|
|
715
|
-
this.activeSessionBootstraps.set(result.sessionId, bootstrap);
|
|
716
|
-
} else {
|
|
717
|
-
await Promise.resolve(bootstrap.dispose?.());
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
this.emitSessionStartedTelemetry(preparedInput, result.sessionId);
|
|
721
|
-
return result;
|
|
722
|
-
} catch (error) {
|
|
723
|
-
await Promise.resolve(bootstrap?.dispose?.());
|
|
724
|
-
throw error;
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
private emitSessionStartedTelemetry(
|
|
729
|
-
input: ClineCoreStartInput,
|
|
730
|
-
sessionId: string,
|
|
731
|
-
): void {
|
|
732
|
-
// Per-session telemetry override (passed via `CoreSessionConfig.telemetry`)
|
|
733
|
-
// takes precedence over the instance-wide telemetry service configured
|
|
734
|
-
// on `ClineCore.create`. Either way we fire a single `session.started`
|
|
735
|
-
// event here so the signal is emitted for every backend (local, hub,
|
|
736
|
-
// remote), not just the in-process local transport.
|
|
737
|
-
const telemetry = input.config.telemetry ?? this.telemetry;
|
|
738
|
-
if (!telemetry) {
|
|
739
|
-
return;
|
|
740
|
-
}
|
|
741
|
-
telemetry.capture({
|
|
742
|
-
event: CORE_TELEMETRY_EVENTS.SESSION.STARTED,
|
|
743
|
-
properties: {
|
|
744
|
-
sessionId,
|
|
745
|
-
source: input.source ?? SessionSource.CORE,
|
|
746
|
-
providerId: input.config.providerId,
|
|
747
|
-
modelId: input.config.modelId,
|
|
748
|
-
enableTools: input.config.enableTools,
|
|
749
|
-
enableSpawnAgent: input.config.enableSpawnAgent,
|
|
750
|
-
enableAgentTeams: input.config.enableAgentTeams,
|
|
751
|
-
clientName: this.clientName,
|
|
752
|
-
runtimeAddress: this.runtimeAddress,
|
|
753
|
-
},
|
|
754
|
-
});
|
|
755
|
-
}
|
|
756
|
-
/**
|
|
757
|
-
* Sends a message or command to an active session.
|
|
758
|
-
*
|
|
759
|
-
* This method communicates with a running session, allowing you to send user messages,
|
|
760
|
-
* tool responses, or other session input while the session is in progress.
|
|
761
|
-
*
|
|
762
|
-
* @example
|
|
763
|
-
* ```ts
|
|
764
|
-
* await cline.send(sessionId, {
|
|
765
|
-
* type: "user_message",
|
|
766
|
-
* text: "Please implement the login feature",
|
|
767
|
-
* });
|
|
768
|
-
* ```
|
|
769
|
-
*/
|
|
770
|
-
send: RuntimeHost["send"] = (...args) => this.host.send(...args);
|
|
771
|
-
pendingPrompts(
|
|
772
|
-
action: "list",
|
|
773
|
-
input: PendingPromptsListInput,
|
|
774
|
-
): Promise<SessionPendingPrompt[]>;
|
|
775
|
-
pendingPrompts(
|
|
776
|
-
action: "update",
|
|
777
|
-
input: PendingPromptsUpdateInput,
|
|
778
|
-
): Promise<PendingPromptMutationResult>;
|
|
779
|
-
pendingPrompts(
|
|
780
|
-
action: "delete",
|
|
781
|
-
input: PendingPromptsDeleteInput,
|
|
782
|
-
): Promise<PendingPromptMutationResult>;
|
|
783
|
-
pendingPrompts(
|
|
784
|
-
action: PendingPromptsAction,
|
|
785
|
-
input:
|
|
786
|
-
| PendingPromptsListInput
|
|
787
|
-
| PendingPromptsUpdateInput
|
|
788
|
-
| PendingPromptsDeleteInput,
|
|
789
|
-
): Promise<SessionPendingPrompt[] | PendingPromptMutationResult> {
|
|
790
|
-
switch (action) {
|
|
791
|
-
case "list":
|
|
792
|
-
return this.host.pendingPrompts(
|
|
793
|
-
"list",
|
|
794
|
-
input as PendingPromptsListInput,
|
|
795
|
-
);
|
|
796
|
-
case "update":
|
|
797
|
-
return this.host.pendingPrompts(
|
|
798
|
-
"update",
|
|
799
|
-
input as PendingPromptsUpdateInput,
|
|
800
|
-
);
|
|
801
|
-
case "delete":
|
|
802
|
-
return this.host.pendingPrompts(
|
|
803
|
-
"delete",
|
|
804
|
-
input as PendingPromptsDeleteInput,
|
|
805
|
-
);
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
/**
|
|
809
|
-
* Retrieves accumulated token and cost usage for a session.
|
|
810
|
-
*
|
|
811
|
-
* Returns metrics about the session's resource consumption, including tokens used
|
|
812
|
-
* across different API providers and associated costs. Useful for monitoring and billing.
|
|
813
|
-
*
|
|
814
|
-
* @example
|
|
815
|
-
* ```ts
|
|
816
|
-
* const usage = await cline.getAccumulatedUsage(sessionId);
|
|
817
|
-
* console.log(`Total cost: $${usage.totalCost}`);
|
|
818
|
-
* ```
|
|
819
|
-
*/
|
|
820
|
-
getAccumulatedUsage: RuntimeHost["getAccumulatedUsage"] = (...args) =>
|
|
821
|
-
this.host.getAccumulatedUsage(...args);
|
|
822
|
-
/**
|
|
823
|
-
* Aborts an in-flight tool execution without stopping the session.
|
|
824
|
-
*
|
|
825
|
-
* Interrupts the current tool operation (e.g., file read, shell command) while keeping
|
|
826
|
-
* the session alive. The session can continue processing after the abort. Use this for
|
|
827
|
-
* cancelling long-running operations.
|
|
828
|
-
*
|
|
829
|
-
* @example
|
|
830
|
-
* ```ts
|
|
831
|
-
* // Stop the current operation but keep the session running
|
|
832
|
-
* await cline.abort(sessionId);
|
|
833
|
-
* ```
|
|
834
|
-
*/
|
|
835
|
-
abort: RuntimeHost["abort"] = (...args) => this.host.abort(...args);
|
|
836
|
-
/**
|
|
837
|
-
* Stops an active session gracefully.
|
|
838
|
-
*
|
|
839
|
-
* Terminates the session and cleans up associated resources. Unlike abort, this
|
|
840
|
-
* completely ends the session. The session cannot be resumed after stopping.
|
|
841
|
-
*
|
|
842
|
-
* @example
|
|
843
|
-
* ```ts
|
|
844
|
-
* // Cleanly shutdown the session
|
|
845
|
-
* await cline.stop(sessionId);
|
|
846
|
-
* ```
|
|
847
|
-
*/
|
|
848
|
-
stop: RuntimeHost["stop"] = async (sessionId) => {
|
|
849
|
-
await this.host.stop(sessionId);
|
|
850
|
-
await this.disposeSessionBootstrap(sessionId);
|
|
851
|
-
};
|
|
852
|
-
/**
|
|
853
|
-
* Disposes the ClineCore instance and all associated resources.
|
|
854
|
-
*
|
|
855
|
-
* Shuts down the runtime host, closes connections, and cleans up all active sessions
|
|
856
|
-
* and bootstraps. Call this when you're done using the SDK instance, typically at
|
|
857
|
-
* application shutdown. After calling dispose, the instance cannot be reused.
|
|
858
|
-
*
|
|
859
|
-
* @example
|
|
860
|
-
* ```ts
|
|
861
|
-
* // Clean up when done
|
|
862
|
-
* await cline.dispose();
|
|
863
|
-
* ```
|
|
864
|
-
*/
|
|
865
|
-
dispose: RuntimeHost["dispose"] = async (...args) => {
|
|
866
|
-
try {
|
|
867
|
-
await this.automationService?.dispose();
|
|
868
|
-
await this.host.dispose(...args);
|
|
869
|
-
} finally {
|
|
870
|
-
this.unsubscribeBootstrapCleanup();
|
|
871
|
-
const sessionIds = [...this.activeSessionBootstraps.keys()];
|
|
872
|
-
await Promise.allSettled(
|
|
873
|
-
sessionIds.map((sessionId) => this.disposeSessionBootstrap(sessionId)),
|
|
874
|
-
);
|
|
875
|
-
}
|
|
876
|
-
};
|
|
877
|
-
/**
|
|
878
|
-
* Retrieves information about a specific session by ID.
|
|
879
|
-
*
|
|
880
|
-
* Fetches the current metadata and state of a session, including configuration,
|
|
881
|
-
* status, and other session details.
|
|
882
|
-
*
|
|
883
|
-
* @example
|
|
884
|
-
* ```ts
|
|
885
|
-
* const session = await cline.get(sessionId);
|
|
886
|
-
* console.log("Session status:", session?.status);
|
|
887
|
-
* ```
|
|
888
|
-
*/
|
|
889
|
-
get: RuntimeHost["get"] = (...args) => this.host.get(...args);
|
|
890
|
-
/**
|
|
891
|
-
* Lists recent sessions through the shared history-listing path.
|
|
892
|
-
*/
|
|
893
|
-
listHistory = async (
|
|
894
|
-
options: ClineCoreListHistoryOptions = {},
|
|
895
|
-
): Promise<SessionHistoryRecord[]> =>
|
|
896
|
-
await listSessionHistory(this.host, options);
|
|
897
|
-
/**
|
|
898
|
-
* Lists recent sessions with inferred history display metadata.
|
|
899
|
-
*
|
|
900
|
-
* Retrieves a paginated list of recent sessions, optionally limited by the
|
|
901
|
-
* provided count.
|
|
902
|
-
*
|
|
903
|
-
* @param limit Maximum number of sessions to return (defaults to 200)
|
|
904
|
-
* @returns A promise resolving to an array of session history records
|
|
905
|
-
*
|
|
906
|
-
* @example
|
|
907
|
-
* ```ts
|
|
908
|
-
* const sessions = await cline.list(50);
|
|
909
|
-
* sessions.forEach((session) => {
|
|
910
|
-
* console.log(`Session ${session.sessionId}: ${session.metadata?.title}`);
|
|
911
|
-
* });
|
|
912
|
-
* ```
|
|
913
|
-
*/
|
|
914
|
-
list = async (
|
|
915
|
-
limit = 200,
|
|
916
|
-
options: Omit<ClineCoreListHistoryOptions, "limit"> = {},
|
|
917
|
-
): Promise<SessionHistoryRecord[]> =>
|
|
918
|
-
await this.listHistory({ ...options, limit });
|
|
919
|
-
/**
|
|
920
|
-
* Permanently deletes a session and all its associated data.
|
|
921
|
-
*
|
|
922
|
-
* Removes the session from storage and cleans up any related resources. This is
|
|
923
|
-
* a destructive operation that cannot be undone.
|
|
924
|
-
*
|
|
925
|
-
* @param sessionId The ID of the session to delete
|
|
926
|
-
* @returns A promise that resolves to true if the session was deleted, false if not found
|
|
927
|
-
*
|
|
928
|
-
* @example
|
|
929
|
-
* ```ts
|
|
930
|
-
* const deleted = await cline.delete(sessionId);
|
|
931
|
-
* if (deleted) {
|
|
932
|
-
* console.log("Session deleted successfully");
|
|
933
|
-
* }
|
|
934
|
-
* ```
|
|
935
|
-
*/
|
|
936
|
-
delete: RuntimeHost["delete"] = async (sessionId) => {
|
|
937
|
-
const deleted = await this.host.delete(sessionId);
|
|
938
|
-
if (deleted) {
|
|
939
|
-
await this.disposeSessionBootstrap(sessionId);
|
|
940
|
-
}
|
|
941
|
-
return deleted;
|
|
942
|
-
};
|
|
943
|
-
/**
|
|
944
|
-
* Updates an existing session's metadata.
|
|
945
|
-
*
|
|
946
|
-
* Modifies session properties like title or other mutable metadata while preserving
|
|
947
|
-
* message history and other session data.
|
|
948
|
-
*
|
|
949
|
-
* @example
|
|
950
|
-
* ```ts
|
|
951
|
-
* await cline.update(sessionId, {
|
|
952
|
-
* title: "Updated session title",
|
|
953
|
-
* });
|
|
954
|
-
* ```
|
|
955
|
-
*/
|
|
956
|
-
update: RuntimeHost["update"] = (...args) => this.host.update(...args);
|
|
957
|
-
/**
|
|
958
|
-
* Reads message history for a session.
|
|
959
|
-
*
|
|
960
|
-
* Retrieves the full message transcript for a specific session, including all
|
|
961
|
-
* user messages, agent responses, and tool interactions.
|
|
962
|
-
*
|
|
963
|
-
* @example
|
|
964
|
-
* ```ts
|
|
965
|
-
* const messages = await cline.readMessages(sessionId);
|
|
966
|
-
* messages.forEach((msg) => {
|
|
967
|
-
* console.log(`${msg.role}: ${msg.content}`);
|
|
968
|
-
* });
|
|
969
|
-
* ```
|
|
970
|
-
*/
|
|
971
|
-
readMessages: RuntimeHost["readMessages"] = (...args) =>
|
|
972
|
-
this.host.readMessages(...args);
|
|
973
|
-
/**
|
|
974
|
-
* Handles hook events from the runtime environment.
|
|
975
|
-
*
|
|
976
|
-
* Processes system or environment events (e.g., workspace changes, external signals)
|
|
977
|
-
* that may affect the current session. This is typically called by the host environment
|
|
978
|
-
* rather than directly by consumer code.
|
|
979
|
-
*
|
|
980
|
-
* @internal
|
|
981
|
-
*/
|
|
982
|
-
handleHookEvent: RuntimeHost["handleHookEvent"] = (...args) =>
|
|
983
|
-
this.host.handleHookEvent(...args);
|
|
984
|
-
/**
|
|
985
|
-
* Subscribes to session events.
|
|
986
|
-
*
|
|
987
|
-
* Registers a listener for all session events (messages, state changes, errors, etc.).
|
|
988
|
-
* Returns an unsubscribe function to stop listening.
|
|
989
|
-
*
|
|
990
|
-
* @param listener Callback function invoked for each event
|
|
991
|
-
* @param options Optional configuration for the subscription
|
|
992
|
-
* @returns An unsubscribe function
|
|
993
|
-
*
|
|
994
|
-
* @example
|
|
995
|
-
* ```ts
|
|
996
|
-
* const unsubscribe = cline.subscribe((event) => {
|
|
997
|
-
* if (event.type === "message") {
|
|
998
|
-
* console.log("New message:", event.payload.message);
|
|
999
|
-
* }
|
|
1000
|
-
* });
|
|
1001
|
-
*
|
|
1002
|
-
* // Later, stop listening
|
|
1003
|
-
* unsubscribe();
|
|
1004
|
-
* ```
|
|
1005
|
-
*/
|
|
1006
|
-
subscribe(
|
|
1007
|
-
listener: (event: CoreSessionEvent) => void,
|
|
1008
|
-
options?: RuntimeHostSubscribeOptions,
|
|
1009
|
-
): () => void {
|
|
1010
|
-
return this.host.subscribe(listener, options);
|
|
1011
|
-
}
|
|
1012
|
-
/**
|
|
1013
|
-
* Updates the AI model used by an active session.
|
|
1014
|
-
*
|
|
1015
|
-
* Switches the session to use a different AI model while maintaining the session state
|
|
1016
|
-
* and message history. This allows you to continue a conversation with a different model.
|
|
1017
|
-
*
|
|
1018
|
-
* @example
|
|
1019
|
-
* ```ts
|
|
1020
|
-
* // Switch to a different model mid-session
|
|
1021
|
-
* await cline.updateSessionModel(sessionId, "claude-opus-4-1");
|
|
1022
|
-
* ```
|
|
1023
|
-
*/
|
|
1024
|
-
updateSessionModel: RuntimeHost["updateSessionModel"] = (...args) =>
|
|
1025
|
-
this.host.updateSessionModel?.(...args) ?? Promise.resolve();
|
|
1026
|
-
}
|