@clinebot/core 0.0.34 → 0.0.36
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 +13 -10
- package/dist/ClineCore.d.ts +96 -63
- package/dist/ClineCore.d.ts.map +1 -1
- package/dist/account/index.d.ts +1 -1
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/rpc.d.ts +6 -6
- package/dist/account/rpc.d.ts.map +1 -1
- package/dist/cron/index.d.ts +6 -0
- package/dist/cron/index.d.ts.map +1 -0
- package/dist/cron/resource-limiter.d.ts +9 -0
- package/dist/cron/resource-limiter.d.ts.map +1 -0
- package/dist/cron/schedule-command-service.d.ts +10 -0
- package/dist/cron/schedule-command-service.d.ts.map +1 -0
- package/dist/cron/schedule-service.d.ts +100 -0
- package/dist/cron/schedule-service.d.ts.map +1 -0
- package/dist/cron/scheduler.d.ts +66 -0
- package/dist/cron/scheduler.d.ts.map +1 -0
- package/dist/cron/sqlite-schedule-store.d.ts +52 -0
- package/dist/cron/sqlite-schedule-store.d.ts.map +1 -0
- package/dist/extensions/config/agent-config-loader.d.ts +6 -5
- package/dist/extensions/config/agent-config-loader.d.ts.map +1 -1
- package/dist/extensions/config/agent-config-parser.d.ts +1 -1
- package/dist/extensions/config/agent-config-parser.d.ts.map +1 -1
- package/dist/extensions/config/hooks-config-loader.d.ts +2 -2
- package/dist/extensions/config/hooks-config-loader.d.ts.map +1 -1
- package/dist/extensions/config/index.d.ts +3 -3
- package/dist/extensions/config/index.d.ts.map +1 -1
- package/dist/extensions/config/runtime-commands.d.ts +1 -0
- package/dist/extensions/config/runtime-commands.d.ts.map +1 -1
- package/dist/extensions/config/user-instruction-config-loader.d.ts +3 -2
- package/dist/extensions/config/user-instruction-config-loader.d.ts.map +1 -1
- package/dist/extensions/context/agentic-compaction.d.ts +2 -2
- package/dist/extensions/context/agentic-compaction.d.ts.map +1 -1
- package/dist/extensions/context/compaction-shared.d.ts +5 -4
- package/dist/extensions/context/compaction-shared.d.ts.map +1 -1
- package/dist/extensions/context/compaction.d.ts.map +1 -1
- package/dist/extensions/plugin/plugin-config-loader.d.ts +9 -2
- package/dist/extensions/plugin/plugin-config-loader.d.ts.map +1 -1
- package/dist/extensions/plugin/plugin-loader.d.ts +5 -3
- package/dist/extensions/plugin/plugin-loader.d.ts.map +1 -1
- package/dist/extensions/plugin/plugin-module-import.d.ts.map +1 -1
- package/dist/extensions/plugin/plugin-sandbox.d.ts +15 -2
- package/dist/extensions/plugin/plugin-sandbox.d.ts.map +1 -1
- package/dist/extensions/plugin/plugin-targeting.d.ts +7 -0
- package/dist/extensions/plugin/plugin-targeting.d.ts.map +1 -0
- package/dist/extensions/plugin-sandbox-bootstrap.js +253 -253
- package/dist/extensions/tools/constants.d.ts.map +1 -0
- package/dist/{tools → extensions/tools}/definitions.d.ts +1 -1
- package/dist/extensions/tools/definitions.d.ts.map +1 -0
- package/dist/extensions/tools/executors/apply-patch-parser.d.ts.map +1 -0
- package/dist/{tools → extensions/tools}/executors/apply-patch.d.ts +3 -1
- package/dist/extensions/tools/executors/apply-patch.d.ts.map +1 -0
- package/dist/extensions/tools/executors/bash.d.ts.map +1 -0
- package/dist/extensions/tools/executors/editor.d.ts.map +1 -0
- package/dist/extensions/tools/executors/file-read.d.ts.map +1 -0
- package/dist/extensions/tools/executors/index.d.ts.map +1 -0
- package/dist/{tools → extensions/tools}/executors/search.d.ts +1 -1
- package/dist/extensions/tools/executors/search.d.ts.map +1 -0
- package/dist/extensions/tools/executors/web-fetch.d.ts.map +1 -0
- package/dist/extensions/tools/helpers.d.ts.map +1 -0
- package/dist/{tools → extensions/tools}/index.d.ts +2 -0
- package/dist/extensions/tools/index.d.ts.map +1 -0
- package/dist/{tools → extensions/tools}/model-tool-routing.d.ts +1 -1
- package/dist/extensions/tools/model-tool-routing.d.ts.map +1 -0
- package/dist/{tools → extensions/tools}/presets.d.ts +26 -44
- package/dist/extensions/tools/presets.d.ts.map +1 -0
- package/dist/extensions/tools/runtime.d.ts +25 -0
- package/dist/extensions/tools/runtime.d.ts.map +1 -0
- package/dist/extensions/tools/schemas.d.ts.map +1 -0
- package/dist/extensions/tools/team/delegated-agent.d.ts.map +1 -0
- package/dist/extensions/tools/team/index.d.ts.map +1 -0
- package/dist/{team → extensions/tools/team}/multi-agent.d.ts +1 -3
- package/dist/extensions/tools/team/multi-agent.d.ts.map +1 -0
- package/dist/extensions/tools/team/projections.d.ts.map +1 -0
- package/dist/extensions/tools/team/runtime.d.ts.map +1 -0
- package/dist/{team → extensions/tools/team}/spawn-agent-tool.d.ts +0 -1
- package/dist/extensions/tools/team/spawn-agent-tool.d.ts.map +1 -0
- package/dist/extensions/tools/team/subagent-prompts.d.ts.map +1 -0
- package/dist/{team → extensions/tools/team}/team-tools.d.ts +1 -0
- package/dist/extensions/tools/team/team-tools.d.ts.map +1 -0
- package/dist/{tools → extensions/tools}/types.d.ts +4 -3
- package/dist/extensions/tools/types.d.ts.map +1 -0
- package/dist/{runtime → hooks}/checkpoint-hooks.d.ts +7 -0
- package/dist/hooks/checkpoint-hooks.d.ts.map +1 -0
- package/dist/{runtime → hooks}/hook-file-hooks.d.ts +4 -3
- package/dist/hooks/hook-file-hooks.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/subprocess.d.ts +10 -130
- package/dist/hooks/subprocess.d.ts.map +1 -1
- package/dist/hub/browser-websocket.d.ts +18 -0
- package/dist/hub/browser-websocket.d.ts.map +1 -0
- package/dist/hub/client.d.ts +45 -0
- package/dist/hub/client.d.ts.map +1 -0
- package/dist/hub/connect.d.ts +15 -0
- package/dist/hub/connect.d.ts.map +1 -0
- package/dist/hub/daemon-entry.d.ts +2 -0
- package/dist/hub/daemon-entry.d.ts.map +1 -0
- package/dist/hub/daemon-entry.js +1045 -0
- package/dist/hub/daemon.d.ts +5 -0
- package/dist/hub/daemon.d.ts.map +1 -0
- package/dist/hub/defaults.d.ts +13 -0
- package/dist/hub/defaults.d.ts.map +1 -0
- package/dist/hub/discovery.d.ts +29 -0
- package/dist/hub/discovery.d.ts.map +1 -0
- package/dist/hub/index.d.ts +15 -0
- package/dist/hub/index.d.ts.map +1 -0
- package/dist/hub/index.js +1044 -0
- package/dist/hub/native-transport.d.ts +17 -0
- package/dist/hub/native-transport.d.ts.map +1 -0
- package/dist/hub/runtime-handlers.d.ts +11 -0
- package/dist/hub/runtime-handlers.d.ts.map +1 -0
- package/dist/hub/server.d.ts +86 -0
- package/dist/hub/server.d.ts.map +1 -0
- package/dist/hub/session-client.d.ts +87 -0
- package/dist/hub/session-client.d.ts.map +1 -0
- package/dist/hub/start-shared-server.d.ts +19 -0
- package/dist/hub/start-shared-server.d.ts.map +1 -0
- package/dist/hub/transport.d.ts +8 -0
- package/dist/hub/transport.d.ts.map +1 -0
- package/dist/hub/ui-client.d.ts +44 -0
- package/dist/hub/ui-client.d.ts.map +1 -0
- package/dist/hub/workspace.d.ts +4 -0
- package/dist/hub/workspace.d.ts.map +1 -0
- package/dist/index.d.ts +52 -39
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +557 -533
- package/dist/llms/configured-provider-registry.d.ts +28 -0
- package/dist/llms/configured-provider-registry.d.ts.map +1 -0
- package/dist/llms/provider-defaults.d.ts +27 -0
- package/dist/llms/provider-defaults.d.ts.map +1 -0
- package/dist/llms/provider-settings.d.ts +202 -0
- package/dist/llms/provider-settings.d.ts.map +1 -0
- package/dist/llms/runtime-config.d.ts +4 -0
- package/dist/llms/runtime-config.d.ts.map +1 -0
- package/dist/llms/runtime-registry.d.ts +20 -0
- package/dist/llms/runtime-registry.d.ts.map +1 -0
- package/dist/llms/runtime-types.d.ts +85 -0
- package/dist/llms/runtime-types.d.ts.map +1 -0
- package/dist/runtime/history.d.ts +4 -0
- package/dist/runtime/history.d.ts.map +1 -0
- package/dist/runtime/host.d.ts +8 -0
- package/dist/runtime/host.d.ts.map +1 -0
- package/dist/runtime/rules.d.ts +1 -0
- package/dist/runtime/rules.d.ts.map +1 -1
- package/dist/runtime/runtime-builder.d.ts.map +1 -1
- package/dist/runtime/runtime-host.d.ts +103 -0
- package/dist/runtime/runtime-host.d.ts.map +1 -0
- package/dist/{session → runtime}/runtime-oauth-token-manager.d.ts +1 -1
- package/dist/{session → runtime}/runtime-oauth-token-manager.d.ts.map +1 -1
- package/dist/runtime/session-runtime.d.ts +3 -21
- package/dist/runtime/session-runtime.d.ts.map +1 -1
- package/dist/{session/session-agent-events.d.ts → services/agent-events.d.ts} +4 -4
- package/dist/services/agent-events.d.ts.map +1 -0
- package/dist/services/config.d.ts +3 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/global-settings.d.ts +12 -0
- package/dist/services/global-settings.d.ts.map +1 -0
- package/dist/services/local-runtime-bootstrap.d.ts +47 -0
- package/dist/services/local-runtime-bootstrap.d.ts.map +1 -0
- package/dist/services/plugin-tools.d.ts +16 -0
- package/dist/services/plugin-tools.d.ts.map +1 -0
- package/dist/{providers → services/providers}/local-provider-registry.d.ts +4 -4
- package/dist/services/providers/local-provider-registry.d.ts.map +1 -0
- package/dist/{providers → services/providers}/local-provider-service.d.ts +13 -13
- package/dist/services/providers/local-provider-service.d.ts.map +1 -0
- package/dist/{session → services}/session-artifacts.d.ts +0 -4
- package/dist/services/session-artifacts.d.ts.map +1 -0
- package/dist/{session/utils/helpers.d.ts → services/session-data.d.ts} +19 -27
- package/dist/services/session-data.d.ts.map +1 -0
- package/dist/{session → services}/session-telemetry.d.ts +2 -2
- package/dist/services/session-telemetry.d.ts.map +1 -0
- package/dist/{storage → services/storage}/file-team-store.d.ts +2 -2
- package/dist/services/storage/file-team-store.d.ts.map +1 -0
- package/dist/{storage → services/storage}/provider-settings-legacy-migration.d.ts +1 -1
- package/dist/services/storage/provider-settings-legacy-migration.d.ts.map +1 -0
- package/dist/{storage → services/storage}/provider-settings-manager.d.ts +1 -1
- package/dist/services/storage/provider-settings-manager.d.ts.map +1 -0
- package/dist/{storage → services/storage}/sqlite-session-store.d.ts +3 -3
- package/dist/services/storage/sqlite-session-store.d.ts.map +1 -0
- package/dist/{storage → services/storage}/sqlite-team-store.d.ts +2 -2
- package/dist/services/storage/sqlite-team-store.d.ts.map +1 -0
- package/dist/{storage → services/storage}/team-store.d.ts +1 -1
- package/dist/services/storage/team-store.d.ts.map +1 -0
- package/dist/services/telemetry/ITelemetryAdapter.d.ts.map +1 -0
- package/dist/services/telemetry/OpenTelemetryAdapter.d.ts.map +1 -0
- package/dist/services/telemetry/OpenTelemetryProvider.d.ts.map +1 -0
- package/dist/services/telemetry/TelemetryLoggerSink.d.ts.map +1 -0
- package/dist/services/telemetry/TelemetryService.d.ts.map +1 -0
- package/dist/services/telemetry/core-events.d.ts.map +1 -0
- package/dist/services/telemetry/distinct-id.d.ts.map +1 -0
- package/dist/services/telemetry/index.d.ts.map +1 -0
- package/dist/services/telemetry/index.js +28 -0
- package/dist/{session/utils → services}/usage.d.ts +1 -1
- package/dist/services/usage.d.ts.map +1 -0
- package/dist/services/workspace/file-indexer.d.ts.map +1 -0
- package/dist/services/workspace/index.d.ts.map +1 -0
- package/dist/services/workspace/mention-enricher.d.ts.map +1 -0
- package/dist/services/workspace-manifest.d.ts +16 -0
- package/dist/services/workspace-manifest.d.ts.map +1 -0
- package/dist/session/file-session-service.d.ts +4 -1
- package/dist/session/file-session-service.d.ts.map +1 -1
- package/dist/session/persistence-service.d.ts +15 -25
- package/dist/session/persistence-service.d.ts.map +1 -1
- package/dist/session/session-manifest-store.d.ts +22 -0
- package/dist/session/session-manifest-store.d.ts.map +1 -0
- package/dist/session/session-row.d.ts +93 -0
- package/dist/session/session-row.d.ts.map +1 -0
- package/dist/session/session-service.d.ts +8 -109
- package/dist/session/session-service.d.ts.map +1 -1
- package/dist/session/session-team-coordination.d.ts +4 -4
- package/dist/session/session-team-coordination.d.ts.map +1 -1
- package/dist/session/subagent-session-manager.d.ts +36 -0
- package/dist/session/subagent-session-manager.d.ts.map +1 -0
- package/dist/session/team-persistence-store.d.ts +24 -0
- package/dist/session/team-persistence-store.d.ts.map +1 -0
- package/dist/transports/hub.d.ts +47 -0
- package/dist/transports/hub.d.ts.map +1 -0
- package/dist/{session/default-session-manager.d.ts → transports/local.d.ts} +30 -16
- package/dist/transports/local.d.ts.map +1 -0
- package/dist/transports/remote.d.ts +10 -0
- package/dist/transports/remote.d.ts.map +1 -0
- package/dist/transports/runtime-host-support.d.ts +22 -0
- package/dist/transports/runtime-host-support.d.ts.map +1 -0
- package/dist/{chat → types}/chat-schema.d.ts +10 -12
- package/dist/types/chat-schema.d.ts.map +1 -0
- package/dist/types/config.d.ts +10 -9
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/provider-settings.d.ts +4 -5
- package/dist/types/provider-settings.d.ts.map +1 -1
- package/dist/{session/utils/types.d.ts → types/session.d.ts} +16 -6
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/sessions.d.ts +19 -0
- package/dist/types/sessions.d.ts.map +1 -1
- package/dist/types/storage.d.ts +1 -3
- package/dist/types/storage.d.ts.map +1 -1
- package/dist/types.d.ts +14 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +22 -13
- package/src/ClineCore.ts +183 -85
- package/src/account/index.ts +3 -3
- package/src/account/rpc.ts +12 -12
- package/src/auth/cline.ts +1 -1
- package/src/auth/codex.ts +1 -1
- package/src/auth/oca.ts +1 -1
- package/src/cron/index.ts +5 -0
- package/src/cron/resource-limiter.ts +46 -0
- package/src/cron/schedule-command-service.ts +193 -0
- package/src/cron/schedule-service.ts +703 -0
- package/src/cron/scheduler.ts +637 -0
- package/src/cron/sqlite-schedule-store.ts +708 -0
- package/src/extensions/config/agent-config-loader.ts +18 -12
- package/src/extensions/config/agent-config-parser.ts +1 -1
- package/src/extensions/config/hooks-config-loader.ts +1 -2
- package/src/extensions/config/index.ts +0 -4
- package/src/extensions/config/runtime-commands.ts +6 -0
- package/src/extensions/config/user-instruction-config-loader.ts +1 -4
- package/src/extensions/context/agentic-compaction.ts +3 -3
- package/src/extensions/context/basic-compaction.ts +2 -2
- package/src/extensions/context/compaction-shared.ts +5 -4
- package/src/extensions/context/compaction.ts +3 -3
- package/src/extensions/plugin/plugin-config-loader.ts +17 -2
- package/src/extensions/plugin/plugin-loader.ts +48 -4
- package/src/extensions/plugin/plugin-module-import.ts +0 -2
- package/src/extensions/plugin/plugin-sandbox-bootstrap.ts +93 -39
- package/src/extensions/plugin/plugin-sandbox.ts +47 -27
- package/src/extensions/plugin/plugin-targeting.ts +32 -0
- package/src/{tools → extensions/tools}/definitions.ts +31 -50
- package/src/{tools → extensions/tools}/executors/apply-patch.ts +69 -80
- package/src/{tools → extensions/tools}/executors/file-read.ts +29 -4
- package/src/{tools → extensions/tools}/executors/search.ts +196 -4
- package/src/{tools → extensions/tools}/index.ts +10 -0
- package/src/{tools → extensions/tools}/model-tool-routing.ts +1 -1
- package/src/{tools → extensions/tools}/presets.ts +31 -47
- package/src/extensions/tools/runtime.ts +261 -0
- package/src/{tools → extensions/tools}/schemas.ts +4 -2
- package/src/{team → extensions/tools/team}/multi-agent.ts +80 -17
- package/src/{team → extensions/tools/team}/spawn-agent-tool.ts +1 -7
- package/src/{team → extensions/tools/team}/subagent-prompts.ts +2 -2
- package/src/{team → extensions/tools/team}/team-tools.ts +84 -53
- package/src/{tools → extensions/tools}/types.ts +5 -3
- package/src/{runtime → hooks}/checkpoint-hooks.ts +27 -0
- package/src/{runtime → hooks}/hook-file-hooks.ts +14 -13
- package/src/hooks/index.ts +0 -7
- package/src/hooks/subprocess-runner.ts +1 -1
- package/src/hooks/subprocess.ts +57 -257
- package/src/hub/browser-websocket.ts +137 -0
- package/src/hub/client.ts +574 -0
- package/src/hub/connect.ts +156 -0
- package/src/hub/daemon-entry.ts +87 -0
- package/src/hub/daemon.ts +181 -0
- package/src/hub/defaults.ts +43 -0
- package/src/hub/discovery.ts +247 -0
- package/src/hub/index.ts +14 -0
- package/src/hub/native-transport.ts +31 -0
- package/src/hub/runtime-handlers.ts +140 -0
- package/src/hub/server.ts +1888 -0
- package/src/hub/session-client.ts +460 -0
- package/src/hub/start-shared-server.ts +58 -0
- package/src/hub/transport.ts +14 -0
- package/src/hub/ui-client.ts +122 -0
- package/src/hub/workspace.ts +19 -0
- package/src/index.ts +264 -199
- package/src/llms/configured-provider-registry.ts +193 -0
- package/src/llms/provider-defaults.ts +637 -0
- package/src/llms/provider-settings.ts +263 -0
- package/src/llms/runtime-config.ts +43 -0
- package/src/llms/runtime-registry.ts +171 -0
- package/src/llms/runtime-types.ts +121 -0
- package/src/runtime/history.ts +237 -0
- package/src/runtime/host.ts +200 -0
- package/src/runtime/index.ts +1 -0
- package/src/runtime/rules.ts +12 -0
- package/src/runtime/runtime-builder.ts +37 -29
- package/src/runtime/runtime-host.ts +206 -0
- package/src/{session → runtime}/runtime-oauth-token-manager.ts +12 -16
- package/src/runtime/session-runtime.ts +2 -26
- package/src/{session/session-agent-events.ts → services/agent-events.ts} +7 -7
- package/src/services/config.ts +5 -0
- package/src/services/global-settings.ts +122 -0
- package/src/services/local-runtime-bootstrap.ts +318 -0
- package/src/services/plugin-tools.ts +85 -0
- package/src/{providers → services/providers}/local-provider-registry.ts +6 -6
- package/src/{providers → services/providers}/local-provider-service.ts +46 -41
- package/src/{session → services}/session-artifacts.ts +7 -19
- package/src/{session/utils/helpers.ts → services/session-data.ts} +90 -80
- package/src/{session → services}/session-telemetry.ts +7 -9
- package/src/services/storage/artifact-store.ts +1 -0
- package/src/{storage → services/storage}/file-team-store.ts +2 -2
- package/src/{storage → services/storage}/provider-settings-legacy-migration.ts +6 -4
- package/src/{storage → services/storage}/provider-settings-manager.ts +3 -3
- package/src/services/storage/session-store.ts +1 -0
- package/src/{storage → services/storage}/sqlite-session-store.ts +7 -12
- package/src/{storage → services/storage}/sqlite-team-store.ts +4 -4
- package/src/{storage → services/storage}/team-store.ts +1 -1
- package/src/{session/utils → services}/usage.ts +1 -1
- package/src/{input → services/workspace}/file-indexer.ts +26 -2
- package/src/{input → services/workspace}/mention-enricher.ts +1 -1
- package/src/{session → services}/workspace-manifest.ts +18 -0
- package/src/session/file-session-service.ts +10 -8
- package/src/session/index.ts +10 -23
- package/src/session/persistence-service.ts +144 -528
- package/src/session/session-manifest-store.ts +158 -0
- package/src/session/session-row.ts +199 -0
- package/src/session/session-service.ts +43 -389
- package/src/session/session-team-coordination.ts +14 -7
- package/src/session/subagent-session-manager.ts +397 -0
- package/src/session/team-persistence-store.ts +176 -0
- package/src/session/workspace-manager.ts +1 -1
- package/src/transports/hub.ts +656 -0
- package/src/{session/default-session-manager.ts → transports/local.ts} +263 -200
- package/src/transports/remote.ts +26 -0
- package/src/transports/runtime-host-support.ts +140 -0
- package/src/{chat → types}/chat-schema.ts +4 -5
- package/src/types/config.ts +10 -9
- package/src/types/provider-settings.ts +11 -7
- package/src/{session/utils/types.ts → types/session.ts} +16 -5
- package/src/types/sessions.ts +21 -0
- package/src/types/storage.ts +1 -6
- package/src/types.ts +52 -19
- package/dist/chat/chat-schema.d.ts.map +0 -1
- package/dist/hooks/persistent.d.ts +0 -64
- package/dist/hooks/persistent.d.ts.map +0 -1
- package/dist/input/file-indexer.d.ts.map +0 -1
- package/dist/input/index.d.ts.map +0 -1
- package/dist/input/mention-enricher.d.ts.map +0 -1
- package/dist/prompt/default-system.d.ts +0 -2
- package/dist/prompt/default-system.d.ts.map +0 -1
- package/dist/providers/local-provider-registry.d.ts.map +0 -1
- package/dist/providers/local-provider-service.d.ts.map +0 -1
- package/dist/runtime/checkpoint-hooks.d.ts.map +0 -1
- package/dist/runtime/hook-file-hooks.d.ts.map +0 -1
- package/dist/session/default-session-manager.d.ts.map +0 -1
- package/dist/session/rpc-runtime-ensure.d.ts +0 -53
- package/dist/session/rpc-runtime-ensure.d.ts.map +0 -1
- package/dist/session/rpc-session-service.d.ts +0 -13
- package/dist/session/rpc-session-service.d.ts.map +0 -1
- package/dist/session/rpc-spawn-lease.d.ts +0 -8
- package/dist/session/rpc-spawn-lease.d.ts.map +0 -1
- package/dist/session/session-agent-events.d.ts.map +0 -1
- package/dist/session/session-artifacts.d.ts.map +0 -1
- package/dist/session/session-config-builder.d.ts +0 -16
- package/dist/session/session-config-builder.d.ts.map +0 -1
- package/dist/session/session-host.d.ts +0 -15
- package/dist/session/session-host.d.ts.map +0 -1
- package/dist/session/session-manager.d.ts +0 -62
- package/dist/session/session-manager.d.ts.map +0 -1
- package/dist/session/session-telemetry.d.ts.map +0 -1
- package/dist/session/sqlite-rpc-session-backend.d.ts +0 -31
- package/dist/session/sqlite-rpc-session-backend.d.ts.map +0 -1
- package/dist/session/utils/helpers.d.ts.map +0 -1
- package/dist/session/utils/types.d.ts.map +0 -1
- package/dist/session/utils/usage.d.ts.map +0 -1
- package/dist/session/workspace-manifest.d.ts +0 -5
- package/dist/session/workspace-manifest.d.ts.map +0 -1
- package/dist/storage/file-team-store.d.ts.map +0 -1
- package/dist/storage/provider-settings-legacy-migration.d.ts.map +0 -1
- package/dist/storage/provider-settings-manager.d.ts.map +0 -1
- package/dist/storage/sqlite-session-store.d.ts.map +0 -1
- package/dist/storage/sqlite-team-store.d.ts.map +0 -1
- package/dist/storage/team-store.d.ts.map +0 -1
- package/dist/team/delegated-agent.d.ts.map +0 -1
- package/dist/team/index.d.ts.map +0 -1
- package/dist/team/multi-agent.d.ts.map +0 -1
- package/dist/team/projections.d.ts.map +0 -1
- package/dist/team/runtime.d.ts.map +0 -1
- package/dist/team/spawn-agent-tool.d.ts.map +0 -1
- package/dist/team/subagent-prompts.d.ts.map +0 -1
- package/dist/team/team-tools.d.ts.map +0 -1
- package/dist/telemetry/ITelemetryAdapter.d.ts.map +0 -1
- package/dist/telemetry/OpenTelemetryAdapter.d.ts.map +0 -1
- package/dist/telemetry/OpenTelemetryProvider.d.ts.map +0 -1
- package/dist/telemetry/TelemetryLoggerSink.d.ts.map +0 -1
- package/dist/telemetry/TelemetryService.d.ts.map +0 -1
- package/dist/telemetry/core-events.d.ts.map +0 -1
- package/dist/telemetry/distinct-id.d.ts.map +0 -1
- package/dist/telemetry/index.d.ts.map +0 -1
- package/dist/telemetry/index.js +0 -15
- package/dist/tools/constants.d.ts.map +0 -1
- package/dist/tools/definitions.d.ts.map +0 -1
- package/dist/tools/executors/apply-patch-parser.d.ts.map +0 -1
- package/dist/tools/executors/apply-patch.d.ts.map +0 -1
- package/dist/tools/executors/bash.d.ts.map +0 -1
- package/dist/tools/executors/editor.d.ts.map +0 -1
- package/dist/tools/executors/file-read.d.ts.map +0 -1
- package/dist/tools/executors/index.d.ts.map +0 -1
- package/dist/tools/executors/search.d.ts.map +0 -1
- package/dist/tools/executors/web-fetch.d.ts.map +0 -1
- package/dist/tools/helpers.d.ts.map +0 -1
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/model-tool-routing.d.ts.map +0 -1
- package/dist/tools/presets.d.ts.map +0 -1
- package/dist/tools/schemas.d.ts.map +0 -1
- package/dist/tools/types.d.ts.map +0 -1
- package/src/ClineCore.test.ts +0 -150
- package/src/account/cline-account-service.test.ts +0 -185
- package/src/account/featurebase-token.test.ts +0 -175
- package/src/account/rpc.test.ts +0 -63
- package/src/auth/bounded-ttl-cache.test.ts +0 -38
- package/src/auth/client.test.ts +0 -69
- package/src/auth/cline.test.ts +0 -267
- package/src/auth/codex.test.ts +0 -170
- package/src/auth/oca.test.ts +0 -340
- package/src/auth/server.test.ts +0 -287
- package/src/auth/utils.test.ts +0 -128
- package/src/extensions/config/agent-config-loader.test.ts +0 -236
- package/src/extensions/config/hooks-config-loader.test.ts +0 -20
- package/src/extensions/config/runtime-commands.test.ts +0 -115
- package/src/extensions/config/unified-config-file-watcher.test.ts +0 -196
- package/src/extensions/config/user-instruction-config-loader.test.ts +0 -246
- package/src/extensions/context/compaction.test.ts +0 -483
- package/src/extensions/mcp/config-loader.test.ts +0 -238
- package/src/extensions/mcp/manager.test.ts +0 -105
- package/src/extensions/plugin/plugin-config-loader.test.ts +0 -182
- package/src/extensions/plugin/plugin-loader.test.ts +0 -292
- package/src/extensions/plugin/plugin-sandbox.test.ts +0 -423
- package/src/hooks/persistent.ts +0 -661
- package/src/input/file-indexer.d.ts +0 -11
- package/src/input/file-indexer.test.ts +0 -127
- package/src/input/mention-enricher.test.ts +0 -85
- package/src/prompt/default-system.ts +0 -21
- package/src/providers/local-provider-service.test.ts +0 -1062
- package/src/runtime/checkpoint-hooks.test.ts +0 -168
- package/src/runtime/hook-file-hooks.test.ts +0 -311
- package/src/runtime/runtime-builder.team-persistence.test.ts +0 -242
- package/src/runtime/runtime-builder.test.ts +0 -616
- package/src/runtime/runtime-parity.test.ts +0 -143
- package/src/session/default-session-manager.e2e.test.ts +0 -384
- package/src/session/default-session-manager.test.ts +0 -2473
- package/src/session/persistence-service.test.ts +0 -241
- package/src/session/rpc-runtime-ensure.ts +0 -521
- package/src/session/rpc-session-service.ts +0 -107
- package/src/session/rpc-spawn-lease.test.ts +0 -49
- package/src/session/rpc-spawn-lease.ts +0 -122
- package/src/session/runtime-oauth-token-manager.test.ts +0 -137
- package/src/session/session-config-builder.ts +0 -172
- package/src/session/session-host.test.ts +0 -89
- package/src/session/session-host.ts +0 -213
- package/src/session/session-manager.ts +0 -74
- package/src/session/session-service.team-persistence.test.ts +0 -48
- package/src/session/sqlite-rpc-session-backend.ts +0 -303
- package/src/session/utils/helpers.test.ts +0 -160
- package/src/storage/artifact-store.ts +0 -1
- package/src/storage/provider-settings-legacy-migration.test.ts +0 -424
- package/src/storage/provider-settings-manager.test.ts +0 -191
- package/src/storage/session-store.ts +0 -1
- package/src/team/multi-agent.lifecycle.test.ts +0 -201
- package/src/team/spawn-agent-tool.test.ts +0 -387
- package/src/team/team-tools.test.ts +0 -906
- package/src/telemetry/OpenTelemetryAdapter.test.ts +0 -157
- package/src/telemetry/OpenTelemetryProvider.test.ts +0 -326
- package/src/telemetry/TelemetryLoggerSink.test.ts +0 -42
- package/src/telemetry/TelemetryService.test.ts +0 -134
- package/src/telemetry/distinct-id.test.ts +0 -57
- package/src/tools/definitions.test.ts +0 -780
- package/src/tools/executors/bash.test.ts +0 -87
- package/src/tools/executors/editor.test.ts +0 -35
- package/src/tools/executors/file-read.test.ts +0 -49
- package/src/tools/model-tool-routing.test.ts +0 -86
- package/src/tools/presets.test.ts +0 -70
- /package/dist/{tools → extensions/tools}/constants.d.ts +0 -0
- /package/dist/{tools → extensions/tools}/executors/apply-patch-parser.d.ts +0 -0
- /package/dist/{tools → extensions/tools}/executors/bash.d.ts +0 -0
- /package/dist/{tools → extensions/tools}/executors/editor.d.ts +0 -0
- /package/dist/{tools → extensions/tools}/executors/file-read.d.ts +0 -0
- /package/dist/{tools → extensions/tools}/executors/index.d.ts +0 -0
- /package/dist/{tools → extensions/tools}/executors/web-fetch.d.ts +0 -0
- /package/dist/{tools → extensions/tools}/helpers.d.ts +0 -0
- /package/dist/{tools → extensions/tools}/schemas.d.ts +0 -0
- /package/dist/{team → extensions/tools/team}/delegated-agent.d.ts +0 -0
- /package/dist/{team → extensions/tools/team}/index.d.ts +0 -0
- /package/dist/{team → extensions/tools/team}/projections.d.ts +0 -0
- /package/dist/{team → extensions/tools/team}/runtime.d.ts +0 -0
- /package/dist/{team → extensions/tools/team}/subagent-prompts.d.ts +0 -0
- /package/dist/{telemetry → services/telemetry}/ITelemetryAdapter.d.ts +0 -0
- /package/dist/{telemetry → services/telemetry}/OpenTelemetryAdapter.d.ts +0 -0
- /package/dist/{telemetry → services/telemetry}/OpenTelemetryProvider.d.ts +0 -0
- /package/dist/{telemetry → services/telemetry}/TelemetryLoggerSink.d.ts +0 -0
- /package/dist/{telemetry → services/telemetry}/TelemetryService.d.ts +0 -0
- /package/dist/{telemetry → services/telemetry}/core-events.d.ts +0 -0
- /package/dist/{telemetry → services/telemetry}/distinct-id.d.ts +0 -0
- /package/dist/{telemetry → services/telemetry}/index.d.ts +0 -0
- /package/dist/{input → services/workspace}/file-indexer.d.ts +0 -0
- /package/dist/{input → services/workspace}/index.d.ts +0 -0
- /package/dist/{input → services/workspace}/mention-enricher.d.ts +0 -0
- /package/src/{tools → extensions/tools}/constants.ts +0 -0
- /package/src/{tools → extensions/tools}/executors/apply-patch-parser.ts +0 -0
- /package/src/{tools → extensions/tools}/executors/bash.ts +0 -0
- /package/src/{tools → extensions/tools}/executors/editor.ts +0 -0
- /package/src/{tools → extensions/tools}/executors/index.ts +0 -0
- /package/src/{tools → extensions/tools}/executors/web-fetch.ts +0 -0
- /package/src/{tools → extensions/tools}/helpers.ts +0 -0
- /package/src/{team → extensions/tools/team}/delegated-agent.ts +0 -0
- /package/src/{team → extensions/tools/team}/index.ts +0 -0
- /package/src/{team → extensions/tools/team}/projections.ts +0 -0
- /package/src/{team → extensions/tools/team}/runtime.ts +0 -0
- /package/src/{storage → services/storage}/index.ts +0 -0
- /package/src/{telemetry → services/telemetry}/ITelemetryAdapter.ts +0 -0
- /package/src/{telemetry → services/telemetry}/OpenTelemetryAdapter.ts +0 -0
- /package/src/{telemetry → services/telemetry}/OpenTelemetryProvider.ts +0 -0
- /package/src/{telemetry → services/telemetry}/TelemetryLoggerSink.ts +0 -0
- /package/src/{telemetry → services/telemetry}/TelemetryService.ts +0 -0
- /package/src/{telemetry → services/telemetry}/core-events.ts +0 -0
- /package/src/{telemetry → services/telemetry}/distinct-id.ts +0 -0
- /package/src/{telemetry → services/telemetry}/index.ts +0 -0
- /package/src/{input → services/workspace}/index.ts +0 -0
|
@@ -4,12 +4,11 @@ import {
|
|
|
4
4
|
TEAM_AWAIT_TIMEOUT_MS,
|
|
5
5
|
TEAM_RUN_MESSAGE_PREVIEW_LIMIT,
|
|
6
6
|
TEAM_RUN_TEXT_PREVIEW_LIMIT,
|
|
7
|
+
TEAM_TASK_IGNORED_FIELDS_BY_ACTION,
|
|
7
8
|
type TeamAttachOutcomeFragmentInput,
|
|
8
9
|
TeamAttachOutcomeFragmentInputSchema,
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
type TeamAwaitRunInput,
|
|
12
|
-
TeamAwaitRunInputSchema,
|
|
10
|
+
type TeamAwaitRunsInput,
|
|
11
|
+
TeamAwaitRunsInputSchema,
|
|
13
12
|
type TeamBroadcastInput,
|
|
14
13
|
TeamBroadcastInputSchema,
|
|
15
14
|
type TeamCancelRunInput,
|
|
@@ -24,8 +23,8 @@ import {
|
|
|
24
23
|
TeamListOutcomesInputSchema,
|
|
25
24
|
type TeamListRunsInput,
|
|
26
25
|
TeamListRunsInputSchema,
|
|
27
|
-
type
|
|
28
|
-
|
|
26
|
+
type TeamMissionLogInput,
|
|
27
|
+
TeamMissionLogInputSchema,
|
|
29
28
|
type TeamReadMailboxInput,
|
|
30
29
|
TeamReadMailboxInputSchema,
|
|
31
30
|
type TeamReviewOutcomeFragmentInput,
|
|
@@ -113,6 +112,24 @@ function summarizeRun(run: TeamRunRecord): TeamRunToolSummary {
|
|
|
113
112
|
};
|
|
114
113
|
}
|
|
115
114
|
|
|
115
|
+
function assertAwaitedRunSucceeded(run: TeamRunRecord): void {
|
|
116
|
+
if (run.status === "failed") {
|
|
117
|
+
throw new Error(
|
|
118
|
+
`Run "${run.id}" failed${run.error ? `: ${run.error}` : ""}`,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
if (run.status === "cancelled") {
|
|
122
|
+
throw new Error(
|
|
123
|
+
`Run "${run.id}" was cancelled${run.error ? `: ${run.error}` : ""}`,
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
if (run.status === "interrupted") {
|
|
127
|
+
throw new Error(
|
|
128
|
+
`Run "${run.id}" was interrupted${run.error ? `: ${run.error}` : ""}`,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
116
133
|
export type TeamTeammateRuntimeConfig = DelegatedAgentRuntimeConfig;
|
|
117
134
|
|
|
118
135
|
export interface CreateAgentTeamsToolsOptions {
|
|
@@ -144,6 +161,27 @@ export interface BootstrapAgentTeamsResult {
|
|
|
144
161
|
restoredTeammates: string[];
|
|
145
162
|
}
|
|
146
163
|
|
|
164
|
+
export const TEAM_TOOL_NAMES = [
|
|
165
|
+
"team_spawn_teammate",
|
|
166
|
+
"team_shutdown_teammate",
|
|
167
|
+
"team_status",
|
|
168
|
+
"team_task",
|
|
169
|
+
"team_run_task",
|
|
170
|
+
"team_cancel_run",
|
|
171
|
+
"team_list_runs",
|
|
172
|
+
"team_await_runs",
|
|
173
|
+
"team_send_message",
|
|
174
|
+
"team_broadcast",
|
|
175
|
+
"team_read_mailbox",
|
|
176
|
+
"team_mission_log",
|
|
177
|
+
"team_cleanup",
|
|
178
|
+
"team_create_outcome",
|
|
179
|
+
"team_attach_outcome_fragment",
|
|
180
|
+
"team_review_outcome_fragment",
|
|
181
|
+
"team_finalize_outcome",
|
|
182
|
+
"team_list_outcomes",
|
|
183
|
+
] as const;
|
|
184
|
+
|
|
147
185
|
function spawnTeamTeammate(
|
|
148
186
|
options: Omit<CreateAgentTeamsToolsOptions, "requesterId" | "allowSpawn"> & {
|
|
149
187
|
requesterId: string;
|
|
@@ -244,7 +282,6 @@ export function createAgentTeamsTools(
|
|
|
244
282
|
const spec: TeamTeammateSpec = {
|
|
245
283
|
agentId: validatedInput.agentId,
|
|
246
284
|
rolePrompt: validatedInput.rolePrompt,
|
|
247
|
-
maxIterations: validatedInput.maxIterations,
|
|
248
285
|
};
|
|
249
286
|
spawnTeamTeammate({
|
|
250
287
|
runtime: options.runtime,
|
|
@@ -312,12 +349,26 @@ export function createAgentTeamsTools(
|
|
|
312
349
|
createTool<TeamTaskInput, TeamTaskToolResult>({
|
|
313
350
|
name: "team_task",
|
|
314
351
|
description:
|
|
315
|
-
"Manage shared team tasks
|
|
352
|
+
"Manage shared team tasks with action-specific payloads. " +
|
|
353
|
+
"create requires title and description, with optional dependsOn and assignee. " +
|
|
354
|
+
"list accepts optional status, assignee. " +
|
|
355
|
+
"claim requires taskId. complete requires taskId and summary. block requires taskId and reason. " +
|
|
356
|
+
"Do not include fields from other actions.",
|
|
316
357
|
inputSchema: zodToJsonSchema(TeamTaskInputSchema),
|
|
317
358
|
execute: async (input) => {
|
|
318
359
|
const validatedInput = validateWithZod(TeamTaskInputSchema, input);
|
|
319
360
|
switch (validatedInput.action) {
|
|
320
361
|
case "create": {
|
|
362
|
+
const ignoredFieldSet = new Set(
|
|
363
|
+
TEAM_TASK_IGNORED_FIELDS_BY_ACTION.create ?? [],
|
|
364
|
+
);
|
|
365
|
+
const ignoredFields = Object.entries(
|
|
366
|
+
input as Record<string, unknown>,
|
|
367
|
+
)
|
|
368
|
+
.filter(
|
|
369
|
+
([field, value]) => ignoredFieldSet.has(field) && value != null,
|
|
370
|
+
)
|
|
371
|
+
.map(([field]) => field);
|
|
321
372
|
const task = options.runtime.createTask({
|
|
322
373
|
title: validatedInput.title!,
|
|
323
374
|
description: validatedInput.description!,
|
|
@@ -329,6 +380,12 @@ export function createAgentTeamsTools(
|
|
|
329
380
|
action: "create",
|
|
330
381
|
taskId: task.id,
|
|
331
382
|
status: task.status,
|
|
383
|
+
...(ignoredFields.length > 0
|
|
384
|
+
? {
|
|
385
|
+
ignoredFields,
|
|
386
|
+
note: `Ignored fields for action=create: ${ignoredFields.join(", ")}`,
|
|
387
|
+
}
|
|
388
|
+
: {}),
|
|
332
389
|
};
|
|
333
390
|
}
|
|
334
391
|
case "list":
|
|
@@ -337,8 +394,6 @@ export function createAgentTeamsTools(
|
|
|
337
394
|
tasks: options.runtime.listTaskItems({
|
|
338
395
|
status: validatedInput.status,
|
|
339
396
|
assignee: validatedInput.assignee,
|
|
340
|
-
unassignedOnly: validatedInput.unassignedOnly,
|
|
341
|
-
readyOnly: validatedInput.readyOnly,
|
|
342
397
|
}),
|
|
343
398
|
};
|
|
344
399
|
case "claim": {
|
|
@@ -486,44 +541,19 @@ export function createAgentTeamsTools(
|
|
|
486
541
|
);
|
|
487
542
|
|
|
488
543
|
tools.push(
|
|
489
|
-
createTool<
|
|
490
|
-
name: "
|
|
544
|
+
createTool<TeamAwaitRunsInput, TeamRunToolSummary | TeamRunToolSummary[]>({
|
|
545
|
+
name: "team_await_runs",
|
|
491
546
|
description:
|
|
492
|
-
"Wait for one
|
|
493
|
-
inputSchema: zodToJsonSchema(
|
|
547
|
+
"Wait for async teammate runs. Provide runId to wait for one run, or omit it to wait for all active async runs. Uses a long timeout for legitimate teammate work.",
|
|
548
|
+
inputSchema: zodToJsonSchema(TeamAwaitRunsInputSchema),
|
|
494
549
|
timeoutMs: TEAM_AWAIT_TIMEOUT_MS,
|
|
495
550
|
execute: async (input) => {
|
|
496
|
-
const validatedInput = validateWithZod(
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
);
|
|
502
|
-
}
|
|
503
|
-
if (run.status === "cancelled") {
|
|
504
|
-
throw new Error(
|
|
505
|
-
`Run "${run.id}" was cancelled${run.error ? `: ${run.error}` : ""}`,
|
|
506
|
-
);
|
|
507
|
-
}
|
|
508
|
-
if (run.status === "interrupted") {
|
|
509
|
-
throw new Error(
|
|
510
|
-
`Run "${run.id}" was interrupted${run.error ? `: ${run.error}` : ""}`,
|
|
511
|
-
);
|
|
551
|
+
const validatedInput = validateWithZod(TeamAwaitRunsInputSchema, input);
|
|
552
|
+
if (validatedInput.runId) {
|
|
553
|
+
const run = await options.runtime.awaitRun(validatedInput.runId);
|
|
554
|
+
assertAwaitedRunSucceeded(run);
|
|
555
|
+
return summarizeRun(run);
|
|
512
556
|
}
|
|
513
|
-
return summarizeRun(run);
|
|
514
|
-
},
|
|
515
|
-
}) as Tool,
|
|
516
|
-
);
|
|
517
|
-
|
|
518
|
-
tools.push(
|
|
519
|
-
createTool<TeamAwaitAllRunsInput, TeamRunToolSummary[]>({
|
|
520
|
-
name: "team_await_all_runs",
|
|
521
|
-
description:
|
|
522
|
-
"Wait for all active async runs to complete. Uses a long timeout for legitimate teammate work.",
|
|
523
|
-
inputSchema: zodToJsonSchema(TeamAwaitAllRunsInputSchema),
|
|
524
|
-
timeoutMs: TEAM_AWAIT_TIMEOUT_MS,
|
|
525
|
-
execute: async (input) => {
|
|
526
|
-
validateWithZod(TeamAwaitAllRunsInputSchema, input);
|
|
527
557
|
const runs = await options.runtime.awaitAllRuns();
|
|
528
558
|
const failedRuns = runs.filter((run) =>
|
|
529
559
|
["failed", "cancelled", "interrupted"].includes(run.status),
|
|
@@ -547,7 +577,7 @@ export function createAgentTeamsTools(
|
|
|
547
577
|
tools.push(
|
|
548
578
|
createTool<TeamSendMessageInput, { id: string; toAgentId: string }>({
|
|
549
579
|
name: "team_send_message",
|
|
550
|
-
description: "Send a
|
|
580
|
+
description: "Send a mailbox message to a specific teammate.",
|
|
551
581
|
inputSchema: zodToJsonSchema(TeamSendMessageInputSchema),
|
|
552
582
|
execute: async (input) => {
|
|
553
583
|
const validatedInput = validateWithZod(
|
|
@@ -569,7 +599,7 @@ export function createAgentTeamsTools(
|
|
|
569
599
|
tools.push(
|
|
570
600
|
createTool<TeamBroadcastInput, { delivered: number }>({
|
|
571
601
|
name: "team_broadcast",
|
|
572
|
-
description: "Broadcast a
|
|
602
|
+
description: "Broadcast a message to all teammates.",
|
|
573
603
|
inputSchema: zodToJsonSchema(TeamBroadcastInputSchema),
|
|
574
604
|
execute: async (input) => {
|
|
575
605
|
const validatedInput = validateWithZod(TeamBroadcastInputSchema, input);
|
|
@@ -579,7 +609,6 @@ export function createAgentTeamsTools(
|
|
|
579
609
|
validatedInput.body,
|
|
580
610
|
{
|
|
581
611
|
taskId: validatedInput.taskId ?? undefined,
|
|
582
|
-
includeLead: validatedInput.includeLead ?? undefined,
|
|
583
612
|
},
|
|
584
613
|
);
|
|
585
614
|
return { delivered: messages.length };
|
|
@@ -602,7 +631,6 @@ export function createAgentTeamsTools(
|
|
|
602
631
|
);
|
|
603
632
|
return options.runtime.listMailbox(options.requesterId, {
|
|
604
633
|
unreadOnly: validatedInput.unreadOnly,
|
|
605
|
-
limit: validatedInput.limit,
|
|
606
634
|
markRead: true,
|
|
607
635
|
});
|
|
608
636
|
},
|
|
@@ -610,12 +638,15 @@ export function createAgentTeamsTools(
|
|
|
610
638
|
);
|
|
611
639
|
|
|
612
640
|
tools.push(
|
|
613
|
-
createTool<
|
|
614
|
-
name: "
|
|
615
|
-
description: "Append a mission log update for
|
|
616
|
-
inputSchema: zodToJsonSchema(
|
|
641
|
+
createTool<TeamMissionLogInput, { id: string }>({
|
|
642
|
+
name: "team_mission_log",
|
|
643
|
+
description: "Append a mission log update for your team.",
|
|
644
|
+
inputSchema: zodToJsonSchema(TeamMissionLogInputSchema),
|
|
617
645
|
execute: async (input) => {
|
|
618
|
-
const validatedInput = validateWithZod(
|
|
646
|
+
const validatedInput = validateWithZod(
|
|
647
|
+
TeamMissionLogInputSchema,
|
|
648
|
+
input,
|
|
649
|
+
);
|
|
619
650
|
const entry = options.runtime.appendMissionLog({
|
|
620
651
|
agentId: options.requesterId,
|
|
621
652
|
taskId: validatedInput.taskId || undefined,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Type definitions for executors, configuration, and results.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { ToolContext } from "@clinebot/shared";
|
|
7
|
+
import type { ImageContent, TextContent, ToolContext } from "@clinebot/shared";
|
|
8
8
|
import type {
|
|
9
9
|
ApplyPatchInput,
|
|
10
10
|
EditFileInput,
|
|
@@ -23,7 +23,7 @@ export interface ToolOperationResult {
|
|
|
23
23
|
/** The query/input that was executed */
|
|
24
24
|
query: string;
|
|
25
25
|
/** The result content (if successful) */
|
|
26
|
-
result:
|
|
26
|
+
result: unknown;
|
|
27
27
|
/** Error message (if failed) */
|
|
28
28
|
error?: string;
|
|
29
29
|
/** Whether the operation succeeded */
|
|
@@ -32,6 +32,8 @@ export interface ToolOperationResult {
|
|
|
32
32
|
duration?: number;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
export type FileReadResultContent = string | Array<TextContent | ImageContent>;
|
|
36
|
+
|
|
35
37
|
// =============================================================================
|
|
36
38
|
// Executor Interfaces
|
|
37
39
|
// =============================================================================
|
|
@@ -46,7 +48,7 @@ export interface ToolOperationResult {
|
|
|
46
48
|
export type FileReadExecutor = (
|
|
47
49
|
request: ReadFileRequest,
|
|
48
50
|
context: ToolContext,
|
|
49
|
-
) => Promise<
|
|
51
|
+
) => Promise<FileReadResultContent>;
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* Executor for searching the codebase
|
|
@@ -86,6 +86,33 @@ async function runGit(
|
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Deletes all private git refs under refs/cline/checkpoints/{sessionId}/ that
|
|
91
|
+
* were created by the checkpoint system to keep stash objects reachable.
|
|
92
|
+
* Errors are swallowed — if the cwd is not a git repo or the refs don't exist,
|
|
93
|
+
* the delete is a no-op.
|
|
94
|
+
*/
|
|
95
|
+
export async function deleteCheckpointRefs(
|
|
96
|
+
cwd: string | null | undefined,
|
|
97
|
+
sessionId: string,
|
|
98
|
+
): Promise<void> {
|
|
99
|
+
if (!cwd) return;
|
|
100
|
+
const prefix = `refs/cline/checkpoints/${sessionId}/`;
|
|
101
|
+
try {
|
|
102
|
+
const { stdout } = await runGit(cwd, [
|
|
103
|
+
"for-each-ref",
|
|
104
|
+
"--format=%(refname)",
|
|
105
|
+
prefix,
|
|
106
|
+
]);
|
|
107
|
+
const refs = stdout.trim().split("\n").filter(Boolean);
|
|
108
|
+
await Promise.allSettled(
|
|
109
|
+
refs.map((ref) => runGit(cwd, ["update-ref", "-d", ref])),
|
|
110
|
+
);
|
|
111
|
+
} catch {
|
|
112
|
+
// Not a git repo or git not available — ignore.
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
89
116
|
export function createCheckpointHooks(
|
|
90
117
|
options: CreateCheckpointHooksOptions,
|
|
91
118
|
): AgentHooks {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { appendFileSync, readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
3
4
|
import type { AgentHooks } from "@clinebot/agents";
|
|
4
5
|
import {
|
|
5
6
|
augmentNodeCommandForDebug,
|
|
6
7
|
type BasicLogger,
|
|
7
8
|
type HookSessionContext,
|
|
9
|
+
type WorkspaceInfo,
|
|
8
10
|
withResolvedClineBuildEnv,
|
|
9
11
|
} from "@clinebot/shared";
|
|
10
|
-
import {
|
|
12
|
+
import { ensureHookLogDir } from "@clinebot/shared/storage";
|
|
11
13
|
import { listHookConfigFiles } from "../extensions/config/hooks-config-loader";
|
|
12
14
|
import type { HookEventName, HookEventPayload } from "../hooks";
|
|
13
15
|
|
|
@@ -42,10 +44,11 @@ type AgentHookSessionShutdownContext = Parameters<
|
|
|
42
44
|
type HookRuntimeOptions = {
|
|
43
45
|
cwd: string;
|
|
44
46
|
workspacePath: string;
|
|
45
|
-
hookLogPath?: string;
|
|
46
47
|
rootSessionId?: string;
|
|
47
48
|
logger?: BasicLogger;
|
|
48
49
|
toolCallTimeoutMs?: number;
|
|
50
|
+
/** Structured git + path metadata forwarded into every hook payload. */
|
|
51
|
+
workspaceInfo?: WorkspaceInfo;
|
|
49
52
|
};
|
|
50
53
|
|
|
51
54
|
function mapParams(input: unknown): Record<string, string> {
|
|
@@ -147,10 +150,6 @@ function isAbortReason(reason?: string): boolean {
|
|
|
147
150
|
);
|
|
148
151
|
}
|
|
149
152
|
|
|
150
|
-
function ensureHookLogDir(filePath: string): void {
|
|
151
|
-
ensureParentDir(filePath);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
153
|
function createPayloadBase(
|
|
155
154
|
ctx: HookContextBase,
|
|
156
155
|
options: HookRuntimeOptions,
|
|
@@ -159,7 +158,6 @@ function createPayloadBase(
|
|
|
159
158
|
process.env.CLINE_USER_ID?.trim() || process.env.USER?.trim() || "unknown";
|
|
160
159
|
const sessionContext: HookSessionContext = {
|
|
161
160
|
rootSessionId: options.rootSessionId || ctx.conversationId,
|
|
162
|
-
hookLogPath: options.hookLogPath,
|
|
163
161
|
};
|
|
164
162
|
return {
|
|
165
163
|
clineVersion: process.env.CLINE_VERSION?.trim() || "",
|
|
@@ -167,6 +165,7 @@ function createPayloadBase(
|
|
|
167
165
|
taskId: ctx.conversationId,
|
|
168
166
|
sessionContext,
|
|
169
167
|
workspaceRoots: options.workspacePath ? [options.workspacePath] : [],
|
|
168
|
+
workspaceInfo: options.workspaceInfo,
|
|
170
169
|
userId,
|
|
171
170
|
agent_id: ctx.agentId,
|
|
172
171
|
parent_agent_id: ctx.parentAgentId,
|
|
@@ -275,7 +274,7 @@ async function runHookCommand(
|
|
|
275
274
|
}
|
|
276
275
|
const command = augmentNodeCommandForDebug(options.command, {
|
|
277
276
|
env: options.env,
|
|
278
|
-
debugRole: "hook
|
|
277
|
+
debugRole: "hook",
|
|
279
278
|
});
|
|
280
279
|
const child = spawn(command[0], command.slice(1), {
|
|
281
280
|
cwd: options.cwd,
|
|
@@ -400,7 +399,7 @@ function inferHookCommand(path: string): string[] {
|
|
|
400
399
|
lowered.endsWith(".cjs")
|
|
401
400
|
) {
|
|
402
401
|
return augmentNodeCommandForDebug(["node", path], {
|
|
403
|
-
debugRole: "hook
|
|
402
|
+
debugRole: "hook",
|
|
404
403
|
});
|
|
405
404
|
}
|
|
406
405
|
if (
|
|
@@ -503,15 +502,15 @@ function runAsyncHookCommands(options: {
|
|
|
503
502
|
}
|
|
504
503
|
|
|
505
504
|
export function createHookAuditHooks(options: {
|
|
506
|
-
hookLogPath: string;
|
|
507
505
|
rootSessionId?: string;
|
|
508
506
|
workspacePath: string;
|
|
507
|
+
workspaceInfo?: WorkspaceInfo;
|
|
509
508
|
}): AgentHooks {
|
|
510
509
|
const runtimeOptions: HookRuntimeOptions = {
|
|
511
510
|
cwd: options.workspacePath,
|
|
512
511
|
workspacePath: options.workspacePath,
|
|
513
|
-
hookLogPath: options.hookLogPath,
|
|
514
512
|
rootSessionId: options.rootSessionId,
|
|
513
|
+
workspaceInfo: options.workspaceInfo,
|
|
515
514
|
};
|
|
516
515
|
|
|
517
516
|
const append = (payload: HookEventPayload): void => {
|
|
@@ -519,8 +518,10 @@ export function createHookAuditHooks(options: {
|
|
|
519
518
|
ts: new Date().toISOString(),
|
|
520
519
|
...payload,
|
|
521
520
|
})}\n`;
|
|
522
|
-
|
|
523
|
-
|
|
521
|
+
const envPath = process.env.CLINE_HOOKS_LOG_PATH?.trim() || undefined;
|
|
522
|
+
const logPath = envPath ?? join(ensureHookLogDir(), "hooks.jsonl");
|
|
523
|
+
ensureHookLogDir(logPath);
|
|
524
|
+
appendFileSync(logPath, line, "utf8");
|
|
524
525
|
};
|
|
525
526
|
|
|
526
527
|
return {
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
createPersistentSubprocessHooks,
|
|
3
|
-
PersistentHookClient,
|
|
4
|
-
type PersistentHookClientOptions,
|
|
5
|
-
type PersistentSubprocessHookControl,
|
|
6
|
-
type PersistentSubprocessHooksOptions,
|
|
7
|
-
} from "./persistent";
|
|
8
1
|
export {
|
|
9
2
|
createSubprocessHooks,
|
|
10
3
|
type HookEventName,
|
|
@@ -113,7 +113,7 @@ export async function runSubprocessEvent(
|
|
|
113
113
|
): Promise<RunSubprocessEventResult | undefined> {
|
|
114
114
|
const command = augmentNodeCommandForDebug(options.command, {
|
|
115
115
|
env: options.env,
|
|
116
|
-
debugRole: "hook
|
|
116
|
+
debugRole: "hook",
|
|
117
117
|
});
|
|
118
118
|
if (!Array.isArray(command) || command.length === 0) {
|
|
119
119
|
throw new Error("runSubprocessEvent requires a non-empty command");
|