@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
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import type { CoreAgentMode } from "../../types/config";
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_MODEL_TOOL_ROUTING_RULES,
|
|
4
|
+
resolveToolRoutingConfig,
|
|
5
|
+
} from "./model-tool-routing";
|
|
6
|
+
import { resolveToolPresetName, ToolPresets } from "./presets";
|
|
7
|
+
import { createSpawnAgentTool } from "./team/spawn-agent-tool";
|
|
8
|
+
import { TEAM_TOOL_NAMES } from "./team/team-tools";
|
|
9
|
+
import type { DefaultToolsConfig } from "./types";
|
|
10
|
+
|
|
11
|
+
export interface ToolCatalogEntry {
|
|
12
|
+
id: string;
|
|
13
|
+
description: string;
|
|
14
|
+
defaultEnabled: boolean;
|
|
15
|
+
headlessToolNames: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface BuiltinToolAvailabilityContext {
|
|
19
|
+
mode?: CoreAgentMode;
|
|
20
|
+
providerId?: string;
|
|
21
|
+
modelId?: string;
|
|
22
|
+
enableSpawnAgent?: boolean;
|
|
23
|
+
enableAgentTeams?: boolean;
|
|
24
|
+
disabledToolIds?: ReadonlySet<string>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type RuntimeToolCatalogEntry = Omit<ToolCatalogEntry, "defaultEnabled">;
|
|
28
|
+
|
|
29
|
+
const BASE_TOOL_CATALOG: readonly RuntimeToolCatalogEntry[] = [
|
|
30
|
+
{
|
|
31
|
+
id: "read_files",
|
|
32
|
+
description:
|
|
33
|
+
"Read the full content of text or image files at the provided absolute paths, or return only an inclusive one-based line range when start_line/end_line are provided.",
|
|
34
|
+
headlessToolNames: ["read_files"],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "search_codebase",
|
|
38
|
+
description:
|
|
39
|
+
"Perform regex pattern searches across the codebase for code patterns, definitions, imports, and other text matches.",
|
|
40
|
+
headlessToolNames: ["search_codebase"],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "run_commands",
|
|
44
|
+
description:
|
|
45
|
+
"Run shell commands from the root of the workspace for listing files, checking git status, builds, tests, and similar tasks.",
|
|
46
|
+
headlessToolNames: ["run_commands"],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "editor",
|
|
50
|
+
description:
|
|
51
|
+
"Make controlled filesystem edits on text files with create, replace, and insert operations.",
|
|
52
|
+
headlessToolNames: ["editor"],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "fetch_web_content",
|
|
56
|
+
description:
|
|
57
|
+
"Fetch URL content and analyze it with a prompt describing what to extract.",
|
|
58
|
+
headlessToolNames: ["fetch_web_content"],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "skills",
|
|
62
|
+
description:
|
|
63
|
+
"Execute a configured skill within the main conversation when a matching skill exists for the task.",
|
|
64
|
+
headlessToolNames: ["skills"],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "ask_question",
|
|
68
|
+
description:
|
|
69
|
+
"Ask the user a single clarifying question with 2-5 selectable options.",
|
|
70
|
+
headlessToolNames: ["ask_question"],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "spawn_agent",
|
|
74
|
+
description: createSpawnAgentTool({ configProvider: {} as never })
|
|
75
|
+
.description,
|
|
76
|
+
headlessToolNames: ["spawn_agent"],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: "teams",
|
|
80
|
+
description:
|
|
81
|
+
"Enable team collaboration tools for teammate management, task coordination, mailbox messaging, mission logs, and outcomes.",
|
|
82
|
+
headlessToolNames: [...TEAM_TOOL_NAMES],
|
|
83
|
+
},
|
|
84
|
+
] as const;
|
|
85
|
+
|
|
86
|
+
const TOOL_NAME_TO_FLAG: Partial<
|
|
87
|
+
Record<
|
|
88
|
+
string,
|
|
89
|
+
keyof Pick<
|
|
90
|
+
DefaultToolsConfig,
|
|
91
|
+
| "enableReadFiles"
|
|
92
|
+
| "enableSearch"
|
|
93
|
+
| "enableBash"
|
|
94
|
+
| "enableWebFetch"
|
|
95
|
+
| "enableApplyPatch"
|
|
96
|
+
| "enableEditor"
|
|
97
|
+
| "enableSkills"
|
|
98
|
+
| "enableAskQuestion"
|
|
99
|
+
| "enableSubmitAndExit"
|
|
100
|
+
>
|
|
101
|
+
>
|
|
102
|
+
> = {
|
|
103
|
+
read_files: "enableReadFiles",
|
|
104
|
+
search_codebase: "enableSearch",
|
|
105
|
+
run_commands: "enableBash",
|
|
106
|
+
fetch_web_content: "enableWebFetch",
|
|
107
|
+
apply_patch: "enableApplyPatch",
|
|
108
|
+
editor: "enableEditor",
|
|
109
|
+
skills: "enableSkills",
|
|
110
|
+
ask_question: "enableAskQuestion",
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
function resolveContextMode(
|
|
114
|
+
mode?: BuiltinToolAvailabilityContext["mode"],
|
|
115
|
+
): CoreAgentMode {
|
|
116
|
+
return mode === "plan" || mode === "yolo" ? mode : "act";
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
type ResolvedToolFlags = Pick<
|
|
120
|
+
DefaultToolsConfig,
|
|
121
|
+
| "enableReadFiles"
|
|
122
|
+
| "enableSearch"
|
|
123
|
+
| "enableBash"
|
|
124
|
+
| "enableWebFetch"
|
|
125
|
+
| "enableApplyPatch"
|
|
126
|
+
| "enableEditor"
|
|
127
|
+
| "enableSkills"
|
|
128
|
+
| "enableAskQuestion"
|
|
129
|
+
| "enableSubmitAndExit"
|
|
130
|
+
> & {
|
|
131
|
+
enableSpawnAgent?: boolean;
|
|
132
|
+
enableAgentTeams?: boolean;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
function resolvePresetFlags(context: BuiltinToolAvailabilityContext): {
|
|
136
|
+
mode: CoreAgentMode;
|
|
137
|
+
flags: ResolvedToolFlags;
|
|
138
|
+
} {
|
|
139
|
+
const mode = resolveContextMode(context.mode);
|
|
140
|
+
const preset = ToolPresets[resolveToolPresetName({ mode })];
|
|
141
|
+
const routed = resolveToolRoutingConfig(
|
|
142
|
+
context.providerId ?? "",
|
|
143
|
+
context.modelId ?? "",
|
|
144
|
+
mode,
|
|
145
|
+
DEFAULT_MODEL_TOOL_ROUTING_RULES,
|
|
146
|
+
);
|
|
147
|
+
return {
|
|
148
|
+
mode,
|
|
149
|
+
flags: {
|
|
150
|
+
...preset,
|
|
151
|
+
...routed,
|
|
152
|
+
...(typeof context.enableSpawnAgent === "boolean"
|
|
153
|
+
? { enableSpawnAgent: context.enableSpawnAgent }
|
|
154
|
+
: {}),
|
|
155
|
+
...(typeof context.enableAgentTeams === "boolean"
|
|
156
|
+
? { enableAgentTeams: context.enableAgentTeams }
|
|
157
|
+
: {}),
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function isEntryEnabledByDefault(
|
|
163
|
+
entryId: string,
|
|
164
|
+
context: BuiltinToolAvailabilityContext,
|
|
165
|
+
): boolean {
|
|
166
|
+
if (context.disabledToolIds?.has(entryId)) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const { flags } = resolvePresetFlags(context);
|
|
171
|
+
if (entryId === "spawn_agent") {
|
|
172
|
+
return flags.enableSpawnAgent === true;
|
|
173
|
+
}
|
|
174
|
+
if (entryId === "teams") {
|
|
175
|
+
return flags.enableAgentTeams === true;
|
|
176
|
+
}
|
|
177
|
+
if (entryId === "editor") {
|
|
178
|
+
return flags.enableEditor === true || flags.enableApplyPatch === true;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const flag = TOOL_NAME_TO_FLAG[entryId];
|
|
182
|
+
return flag ? flags[flag] === true : false;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function buildCatalogEntry(
|
|
186
|
+
entry: RuntimeToolCatalogEntry,
|
|
187
|
+
context: BuiltinToolAvailabilityContext,
|
|
188
|
+
): ToolCatalogEntry {
|
|
189
|
+
if (entry.id === "editor") {
|
|
190
|
+
const { flags } = resolvePresetFlags(context);
|
|
191
|
+
const usesApplyPatch =
|
|
192
|
+
flags.enableApplyPatch === true && flags.enableEditor !== true;
|
|
193
|
+
return {
|
|
194
|
+
...entry,
|
|
195
|
+
defaultEnabled: isEntryEnabledByDefault(entry.id, context),
|
|
196
|
+
headlessToolNames: [usesApplyPatch ? "apply_patch" : "editor"],
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return {
|
|
201
|
+
...entry,
|
|
202
|
+
defaultEnabled: isEntryEnabledByDefault(entry.id, context),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export function getCoreBuiltinToolCatalog(
|
|
207
|
+
context: BuiltinToolAvailabilityContext = {},
|
|
208
|
+
): ToolCatalogEntry[] {
|
|
209
|
+
return BASE_TOOL_CATALOG.map((entry) => buildCatalogEntry(entry, context));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export function getCoreDefaultEnabledToolIds(
|
|
213
|
+
context: BuiltinToolAvailabilityContext = {},
|
|
214
|
+
): string[] {
|
|
215
|
+
return getCoreBuiltinToolCatalog(context)
|
|
216
|
+
.filter((entry) => entry.defaultEnabled)
|
|
217
|
+
.map((entry) => entry.id);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export function resolveCoreSelectedToolIds(input: {
|
|
221
|
+
enabled: boolean;
|
|
222
|
+
allowlist?: string[];
|
|
223
|
+
availabilityContext?: BuiltinToolAvailabilityContext;
|
|
224
|
+
}): Set<string> {
|
|
225
|
+
if (!input.enabled) {
|
|
226
|
+
return new Set();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const catalog = getCoreBuiltinToolCatalog(input.availabilityContext);
|
|
230
|
+
const known = new Set(catalog.map((entry) => entry.id));
|
|
231
|
+
if (!input.allowlist || input.allowlist.length === 0) {
|
|
232
|
+
return new Set(
|
|
233
|
+
catalog.filter((entry) => entry.defaultEnabled).map((entry) => entry.id),
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
for (const id of input.allowlist) {
|
|
238
|
+
if (!known.has(id)) {
|
|
239
|
+
throw new Error(
|
|
240
|
+
`Unknown tool "${id}". Available tools: ${catalog.map((entry) => entry.id).join(", ")}`,
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return new Set(input.allowlist);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export function getCoreHeadlessToolNames(
|
|
248
|
+
selectedToolIds: ReadonlySet<string>,
|
|
249
|
+
context: BuiltinToolAvailabilityContext = {},
|
|
250
|
+
): string[] {
|
|
251
|
+
return getCoreBuiltinToolCatalog(context)
|
|
252
|
+
.filter((entry) => selectedToolIds.has(entry.id))
|
|
253
|
+
.flatMap((entry) => entry.headlessToolNames);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function getCoreAcpToolNames(
|
|
257
|
+
selectedToolIds: ReadonlySet<string>,
|
|
258
|
+
context: BuiltinToolAvailabilityContext = {},
|
|
259
|
+
): string[] {
|
|
260
|
+
return getCoreHeadlessToolNames(selectedToolIds, context);
|
|
261
|
+
}
|
|
@@ -228,10 +228,12 @@ export const ApplyPatchInputSchema = z
|
|
|
228
228
|
input: z
|
|
229
229
|
.string()
|
|
230
230
|
.min(1)
|
|
231
|
-
.describe(
|
|
231
|
+
.describe(
|
|
232
|
+
"The freeform apply_patch payload in the canonical patch grammar (e.g *** Begin Patch, *** Update File:, @@, and *** End Patch).",
|
|
233
|
+
),
|
|
232
234
|
})
|
|
233
235
|
.describe(
|
|
234
|
-
"Modify or create a text file by applying patches. Prefer
|
|
236
|
+
"Modify or create a text file by applying patches using the canonical apply_patch diff grammar. Prefer sending the patch body directly rather than wrapping it in shell syntax. IMPORTANT: large patches can time out, so use small chunks and multiple calls when possible.",
|
|
235
237
|
);
|
|
236
238
|
export const ApplyPatchInputUnionSchema = z.union([
|
|
237
239
|
ApplyPatchInputSchema,
|
|
@@ -138,6 +138,23 @@ export interface SpawnTeammateOptions {
|
|
|
138
138
|
config: TeamMemberConfig;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
function isAbortLikeError(error: unknown): boolean {
|
|
142
|
+
if (
|
|
143
|
+
typeof DOMException !== "undefined" &&
|
|
144
|
+
error instanceof DOMException &&
|
|
145
|
+
error.name === "AbortError"
|
|
146
|
+
) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
if (!(error instanceof Error)) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
return (
|
|
153
|
+
error.name === "AbortError" ||
|
|
154
|
+
error.message.toLowerCase().includes("aborted")
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
141
158
|
// =============================================================================
|
|
142
159
|
// AgentTeam
|
|
143
160
|
// =============================================================================
|
|
@@ -484,6 +501,7 @@ interface TeamMemberState extends TeamMemberSnapshot {
|
|
|
484
501
|
runningCount: number;
|
|
485
502
|
lastMissionStep: number;
|
|
486
503
|
lastMissionAt: number;
|
|
504
|
+
pendingSteerMessage?: string;
|
|
487
505
|
}
|
|
488
506
|
|
|
489
507
|
export class AgentTeamsRuntime {
|
|
@@ -568,8 +586,6 @@ export class AgentTeamsRuntime {
|
|
|
568
586
|
listTaskItems(options?: {
|
|
569
587
|
status?: TeamTaskStatus;
|
|
570
588
|
assignee?: string;
|
|
571
|
-
unassignedOnly?: boolean;
|
|
572
|
-
readyOnly?: boolean;
|
|
573
589
|
}): TeamTaskListItem[] {
|
|
574
590
|
return Array.from(this.tasks.values())
|
|
575
591
|
.map((task) => {
|
|
@@ -590,12 +606,6 @@ export class AgentTeamsRuntime {
|
|
|
590
606
|
if (options?.assignee && task.assignee !== options.assignee) {
|
|
591
607
|
return false;
|
|
592
608
|
}
|
|
593
|
-
if (options?.unassignedOnly && !!task.assignee) {
|
|
594
|
-
return false;
|
|
595
|
-
}
|
|
596
|
-
if (options?.readyOnly && !task.isReady) {
|
|
597
|
-
return false;
|
|
598
|
-
}
|
|
599
609
|
return true;
|
|
600
610
|
});
|
|
601
611
|
}
|
|
@@ -825,6 +835,15 @@ export class AgentTeamsRuntime {
|
|
|
825
835
|
const wrappedConfig: TeamMemberConfig = {
|
|
826
836
|
...config,
|
|
827
837
|
apiTimeoutMs: TEAMMATE_API_TIMEOUT_MS,
|
|
838
|
+
consumePendingUserMessage: () => {
|
|
839
|
+
const member = this.members.get(agentId);
|
|
840
|
+
if (!member || !member.pendingSteerMessage) {
|
|
841
|
+
return undefined;
|
|
842
|
+
}
|
|
843
|
+
const message = member.pendingSteerMessage;
|
|
844
|
+
member.pendingSteerMessage = undefined;
|
|
845
|
+
return message;
|
|
846
|
+
},
|
|
828
847
|
onEvent: (event: AgentEvent) => {
|
|
829
848
|
config.onEvent?.(event);
|
|
830
849
|
this.emitEvent({ type: TeamMessageType.AgentEvent, agentId, event });
|
|
@@ -870,7 +889,13 @@ export class AgentTeamsRuntime {
|
|
|
870
889
|
if (!member || member.role !== "teammate") {
|
|
871
890
|
throw new Error(`Teammate "${agentId}" was not found`);
|
|
872
891
|
}
|
|
873
|
-
|
|
892
|
+
try {
|
|
893
|
+
member.agent?.abort();
|
|
894
|
+
} catch (error) {
|
|
895
|
+
if (!isAbortLikeError(error)) {
|
|
896
|
+
throw error;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
874
899
|
member.status = "stopped";
|
|
875
900
|
this.emitEvent({ type: TeamMessageType.TeammateShutdown, agentId, reason });
|
|
876
901
|
}
|
|
@@ -986,9 +1011,17 @@ export class AgentTeamsRuntime {
|
|
|
986
1011
|
this.emitEvent({ type: TeamMessageType.TaskStart, agentId, message });
|
|
987
1012
|
|
|
988
1013
|
try {
|
|
1014
|
+
const unreadMail = this.listMailbox(agentId, {
|
|
1015
|
+
unreadOnly: true,
|
|
1016
|
+
markRead: true,
|
|
1017
|
+
});
|
|
1018
|
+
const enrichedMessage =
|
|
1019
|
+
unreadMail.length > 0
|
|
1020
|
+
? `${this.buildMailboxNotification(unreadMail)}\n\n${message}`
|
|
1021
|
+
: message;
|
|
989
1022
|
const result = options?.continueConversation
|
|
990
|
-
? await member.agent.continue(
|
|
991
|
-
: await member.agent.run(
|
|
1023
|
+
? await member.agent.continue(enrichedMessage)
|
|
1024
|
+
: await member.agent.run(enrichedMessage);
|
|
992
1025
|
this.emitEvent({ type: TeamMessageType.TaskEnd, agentId, result });
|
|
993
1026
|
this.recordProgressStep(
|
|
994
1027
|
agentId,
|
|
@@ -1254,7 +1287,8 @@ export class AgentTeamsRuntime {
|
|
|
1254
1287
|
if (!this.members.has(fromAgentId)) {
|
|
1255
1288
|
throw new Error(`Unknown sender "${fromAgentId}"`);
|
|
1256
1289
|
}
|
|
1257
|
-
|
|
1290
|
+
const recipient = this.members.get(toAgentId);
|
|
1291
|
+
if (!recipient) {
|
|
1258
1292
|
throw new Error(`Unknown recipient "${toAgentId}"`);
|
|
1259
1293
|
}
|
|
1260
1294
|
const message: TeamMailboxMessage = {
|
|
@@ -1272,6 +1306,13 @@ export class AgentTeamsRuntime {
|
|
|
1272
1306
|
type: TeamMessageType.TeamMessage,
|
|
1273
1307
|
message: { ...message },
|
|
1274
1308
|
});
|
|
1309
|
+
if (
|
|
1310
|
+
recipient.role === "teammate" &&
|
|
1311
|
+
recipient.runningCount > 0 &&
|
|
1312
|
+
recipient.agent
|
|
1313
|
+
) {
|
|
1314
|
+
recipient.pendingSteerMessage = `[MAILBOX] You got a message from ${fromAgentId}. Subject: "${subject}". Use the team_read_mailbox tool to read it at your convenience.`;
|
|
1315
|
+
}
|
|
1275
1316
|
return { ...message };
|
|
1276
1317
|
}
|
|
1277
1318
|
|
|
@@ -1279,15 +1320,14 @@ export class AgentTeamsRuntime {
|
|
|
1279
1320
|
fromAgentId: string,
|
|
1280
1321
|
subject: string,
|
|
1281
1322
|
body: string,
|
|
1282
|
-
options?: {
|
|
1323
|
+
options?: { taskId?: string },
|
|
1283
1324
|
): TeamMailboxMessage[] {
|
|
1284
|
-
const includeLead = options?.includeLead ?? false;
|
|
1285
1325
|
const messages: TeamMailboxMessage[] = [];
|
|
1286
1326
|
for (const member of this.members.values()) {
|
|
1287
1327
|
if (member.agentId === fromAgentId) {
|
|
1288
1328
|
continue;
|
|
1289
1329
|
}
|
|
1290
|
-
if (
|
|
1330
|
+
if (member.role === "lead") {
|
|
1291
1331
|
continue;
|
|
1292
1332
|
}
|
|
1293
1333
|
messages.push(
|
|
@@ -1458,7 +1498,13 @@ export class AgentTeamsRuntime {
|
|
|
1458
1498
|
|
|
1459
1499
|
for (const member of this.members.values()) {
|
|
1460
1500
|
if (member.role === "teammate") {
|
|
1461
|
-
|
|
1501
|
+
try {
|
|
1502
|
+
member.agent?.abort();
|
|
1503
|
+
} catch (error) {
|
|
1504
|
+
if (!isAbortLikeError(error)) {
|
|
1505
|
+
throw error;
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1462
1508
|
}
|
|
1463
1509
|
}
|
|
1464
1510
|
|
|
@@ -1526,7 +1572,7 @@ export class AgentTeamsRuntime {
|
|
|
1526
1572
|
this.appendMissionLog({
|
|
1527
1573
|
agentId,
|
|
1528
1574
|
kind: "done",
|
|
1529
|
-
summary: `
|
|
1575
|
+
summary: `Completed a delegated run (${event.iterations} iterations)`,
|
|
1530
1576
|
});
|
|
1531
1577
|
return;
|
|
1532
1578
|
}
|
|
@@ -1638,6 +1684,23 @@ export class AgentTeamsRuntime {
|
|
|
1638
1684
|
});
|
|
1639
1685
|
}
|
|
1640
1686
|
|
|
1687
|
+
private buildMailboxNotification(messages: TeamMailboxMessage[]): string {
|
|
1688
|
+
if (messages.length === 0) {
|
|
1689
|
+
return "";
|
|
1690
|
+
}
|
|
1691
|
+
const lines: string[] = [
|
|
1692
|
+
`[MAILBOX] You have ${messages.length} unread message(s):`,
|
|
1693
|
+
];
|
|
1694
|
+
for (const msg of messages) {
|
|
1695
|
+
lines.push(
|
|
1696
|
+
`--- Message from ${msg.fromAgentId} | subject: ${msg.subject} ---`,
|
|
1697
|
+
);
|
|
1698
|
+
lines.push(msg.body);
|
|
1699
|
+
}
|
|
1700
|
+
lines.push("---");
|
|
1701
|
+
return lines.join("\n");
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1641
1704
|
private emitEvent(event: TeamEvent): void {
|
|
1642
1705
|
try {
|
|
1643
1706
|
this.onTeamEvent?.(event);
|
|
@@ -32,12 +32,6 @@ export const SpawnAgentInputSchema = z.object({
|
|
|
32
32
|
.string()
|
|
33
33
|
.describe("System prompt defining the sub-agent's behavior"),
|
|
34
34
|
task: z.string().describe("Task for the sub-agent to complete"),
|
|
35
|
-
maxIterations: z
|
|
36
|
-
.number()
|
|
37
|
-
.int()
|
|
38
|
-
.min(1)
|
|
39
|
-
.optional()
|
|
40
|
-
.describe("Max iterations for the sub-agent"),
|
|
41
35
|
});
|
|
42
36
|
|
|
43
37
|
export type SpawnAgentInput = z.infer<typeof SpawnAgentInputSchema>;
|
|
@@ -136,7 +130,7 @@ export function createSpawnAgentTool(
|
|
|
136
130
|
prompt: input.systemPrompt,
|
|
137
131
|
configProvider: config.configProvider,
|
|
138
132
|
tools,
|
|
139
|
-
maxIterations:
|
|
133
|
+
maxIterations: config.defaultMaxIterations,
|
|
140
134
|
parentAgentId: context.agentId,
|
|
141
135
|
abortSignal: context.abortSignal,
|
|
142
136
|
onEvent: config.onSubAgentEvent,
|
|
@@ -11,7 +11,7 @@ export function buildTeammateSystemPrompt(
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
return buildClineSystemPrompt({
|
|
14
|
-
ide: config.clineIdeName?.trim() || "Terminal
|
|
14
|
+
ide: config.clineIdeName?.trim() || "Terminal",
|
|
15
15
|
workspaceRoot: config.cwd?.trim() || "/",
|
|
16
16
|
providerId: config.providerId,
|
|
17
17
|
rules: `# Team Teammate Role\n${trimmedPrompt}`,
|
|
@@ -31,7 +31,7 @@ export function buildSubAgentSystemPrompt(
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
return buildClineSystemPrompt({
|
|
34
|
-
ide: "Terminal
|
|
34
|
+
ide: config.clineIdeName || "Terminal",
|
|
35
35
|
workspaceRoot: config.cwd?.trim() || "/",
|
|
36
36
|
providerId: config.providerId,
|
|
37
37
|
overridePrompt: trimmedPrompt,
|