@clinebot/core 0.0.33 → 0.0.35
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 +12 -8
- package/dist/ClineCore.d.ts +48 -29
- package/dist/ClineCore.d.ts.map +1 -1
- package/dist/auth/client.d.ts +19 -0
- package/dist/auth/client.d.ts.map +1 -1
- package/dist/auth/cline.d.ts.map +1 -1
- package/dist/auth/oca.d.ts.map +1 -1
- package/dist/auth/server.d.ts +32 -0
- package/dist/auth/server.d.ts.map +1 -1
- package/dist/auth/types.d.ts +29 -0
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/extensions/config/agent-config-loader.d.ts +2 -2
- 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/user-instruction-config-loader.d.ts +2 -2
- package/dist/extensions/config/user-instruction-config-loader.d.ts.map +1 -1
- package/dist/extensions/index.d.ts +2 -1
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/plugin/plugin-config-loader.d.ts +2 -1
- package/dist/extensions/plugin/plugin-config-loader.d.ts.map +1 -1
- package/dist/extensions/plugin/plugin-load-report.d.ts +19 -0
- package/dist/extensions/plugin/plugin-load-report.d.ts.map +1 -0
- package/dist/extensions/plugin/plugin-loader.d.ts +6 -0
- package/dist/extensions/plugin/plugin-loader.d.ts.map +1 -1
- package/dist/extensions/plugin/plugin-sandbox.d.ts +2 -1
- package/dist/extensions/plugin/plugin-sandbox.d.ts.map +1 -1
- package/dist/extensions/plugin-sandbox-bootstrap.js +242 -242
- package/dist/extensions/tools/constants.d.ts.map +1 -0
- 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/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/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/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 +1 -2
- package/dist/extensions/tools/presets.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/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 +0 -2
- package/dist/hooks/hook-file-hooks.d.ts.map +1 -0
- package/dist/hooks/subprocess.d.ts +3 -130
- package/dist/hooks/subprocess.d.ts.map +1 -1
- package/dist/index.d.ts +38 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +386 -384
- package/dist/runtime/history.d.ts +4 -0
- package/dist/runtime/history.d.ts.map +1 -0
- package/dist/runtime/host.d.ts +9 -0
- package/dist/runtime/host.d.ts.map +1 -0
- package/dist/{session → runtime}/rpc-runtime-ensure.d.ts +13 -1
- package/dist/{session → runtime}/rpc-runtime-ensure.d.ts.map +1 -1
- package/dist/{session → runtime}/rpc-spawn-lease.d.ts.map +1 -1
- package/dist/runtime/runtime-builder.d.ts +1 -1
- package/dist/runtime/runtime-builder.d.ts.map +1 -1
- package/dist/{session/session-manager.d.ts → runtime/runtime-host.d.ts} +55 -12
- 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 +2 -2
- package/dist/runtime/session-runtime.d.ts.map +1 -1
- package/dist/runtime/subprocess-sandbox.d.ts +2 -0
- package/dist/runtime/subprocess-sandbox.d.ts.map +1 -1
- package/dist/runtime/tool-approval.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/local-runtime-bootstrap.d.ts +41 -0
- package/dist/services/local-runtime-bootstrap.d.ts.map +1 -0
- package/dist/services/providers/local-provider-registry.d.ts.map +1 -0
- package/dist/services/providers/local-provider-service.d.ts.map +1 -0
- package/dist/{session → services}/session-artifacts.d.ts +2 -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/{telemetry → services/telemetry}/index.js +6 -6
- 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.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 +8 -6
- package/dist/session/persistence-service.d.ts.map +1 -1
- package/dist/session/rpc-session-service.d.ts +3 -0
- package/dist/session/rpc-session-service.d.ts.map +1 -1
- package/dist/session/session-service.d.ts +8 -9
- 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/sqlite-rpc-session-backend.d.ts.map +1 -1
- package/dist/{session/default-session-manager.d.ts → transports/local.d.ts} +24 -14
- package/dist/transports/local.d.ts.map +1 -0
- package/dist/transports/rpc.d.ts +51 -0
- package/dist/transports/rpc.d.ts.map +1 -0
- package/dist/transports/runtime-host-support.d.ts +21 -0
- package/dist/transports/runtime-host-support.d.ts.map +1 -0
- package/dist/types/chat-schema.d.ts.map +1 -0
- package/dist/types/config.d.ts +3 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/{session/utils/types.d.ts → types/session.d.ts} +15 -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 +7 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -12
- package/src/ClineCore.test.ts +95 -19
- package/src/ClineCore.ts +120 -50
- package/src/auth/client.test.ts +29 -0
- package/src/auth/client.ts +21 -0
- package/src/auth/cline.ts +3 -1
- package/src/auth/codex.ts +1 -1
- package/src/auth/oca.ts +3 -1
- package/src/auth/server.test.ts +287 -0
- package/src/auth/server.ts +50 -1
- package/src/auth/types.ts +29 -0
- package/src/extensions/config/agent-config-loader.test.ts +3 -3
- package/src/extensions/config/agent-config-loader.ts +1 -5
- 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/user-instruction-config-loader.ts +0 -4
- package/src/extensions/index.ts +6 -0
- package/src/extensions/plugin/plugin-config-loader.test.ts +39 -0
- package/src/extensions/plugin/plugin-config-loader.ts +18 -10
- package/src/extensions/plugin/plugin-load-report.ts +20 -0
- package/src/extensions/plugin/plugin-loader.test.ts +45 -0
- package/src/extensions/plugin/plugin-loader.ts +57 -3
- package/src/extensions/plugin/plugin-sandbox-bootstrap.ts +158 -86
- package/src/extensions/plugin/plugin-sandbox.test.ts +70 -0
- package/src/extensions/plugin/plugin-sandbox.ts +17 -6
- package/src/{tools → extensions/tools}/definitions.ts +1 -1
- package/src/extensions/tools/executors/file-read.test.ts +125 -0
- package/src/{tools → extensions/tools}/executors/file-read.ts +29 -4
- package/src/{tools → extensions/tools}/executors/search.ts +1 -1
- package/src/{tools → extensions/tools}/model-tool-routing.ts +1 -1
- package/src/{tools → extensions/tools}/presets.ts +2 -3
- package/src/extensions/tools/team/multi-agent.lifecycle.test.ts +455 -0
- package/src/{team → extensions/tools/team}/multi-agent.ts +80 -17
- package/src/{team → extensions/tools/team}/spawn-agent-tool.test.ts +0 -6
- 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.test.ts +146 -30
- package/src/{team → extensions/tools/team}/team-tools.ts +98 -69
- 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.test.ts +42 -7
- package/src/{runtime → hooks}/hook-file-hooks.ts +6 -11
- package/src/hooks/subprocess.ts +48 -257
- package/src/index.ts +178 -158
- package/src/runtime/history.test.ts +114 -0
- package/src/runtime/history.ts +237 -0
- package/src/runtime/host.test.ts +230 -0
- package/src/runtime/host.ts +362 -0
- package/src/runtime/rpc-runtime-ensure.test.ts +123 -0
- package/src/{session → runtime}/rpc-runtime-ensure.ts +165 -27
- package/src/{session → runtime}/rpc-spawn-lease.test.ts +33 -1
- package/src/{session → runtime}/rpc-spawn-lease.ts +54 -20
- package/src/runtime/runtime-builder.team-persistence.test.ts +6 -3
- package/src/runtime/runtime-builder.test.ts +101 -4
- package/src/runtime/runtime-builder.ts +125 -86
- package/src/runtime/runtime-host.ts +178 -0
- package/src/{session → runtime}/runtime-oauth-token-manager.ts +1 -1
- package/src/runtime/runtime-parity.test.ts +1 -1
- package/src/runtime/session-runtime.ts +2 -2
- package/src/runtime/subprocess-sandbox.ts +26 -23
- package/src/runtime/tool-approval.ts +13 -15
- package/src/{session/session-agent-events.ts → services/agent-events.ts} +7 -7
- package/src/services/config.ts +5 -0
- package/src/services/local-runtime-bootstrap.ts +280 -0
- package/src/{providers → services/providers}/local-provider-service.ts +4 -4
- package/src/{session → services}/session-artifacts.ts +23 -19
- package/src/{session/utils/helpers.test.ts → services/session-data.test.ts} +1 -1
- package/src/{session/utils/helpers.ts → services/session-data.ts} +76 -72
- 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.test.ts +1 -1
- package/src/{storage → services/storage}/provider-settings-legacy-migration.ts +2 -2
- package/src/{storage → services/storage}/provider-settings-manager.ts +2 -2
- 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.test.ts +30 -1
- package/src/{input → services/workspace}/file-indexer.ts +26 -2
- package/src/{input → services/workspace}/mention-enricher.test.ts +21 -0
- package/src/{input → services/workspace}/mention-enricher.ts +1 -1
- package/src/session/file-session-service.ts +9 -7
- package/src/session/index.ts +25 -17
- package/src/session/persistence-service.test.ts +121 -24
- package/src/session/persistence-service.ts +118 -102
- package/src/session/rpc-session-service.ts +9 -2
- package/src/session/session-service.team-persistence.test.ts +1 -1
- package/src/session/session-service.ts +32 -19
- package/src/session/session-team-coordination.ts +13 -6
- package/src/session/sqlite-rpc-session-backend.ts +4 -6
- package/src/session/workspace-manager.ts +1 -1
- package/src/{session/default-session-manager.e2e.test.ts → transports/local.e2e.test.ts} +13 -17
- package/src/{session/default-session-manager.test.ts → transports/local.test.ts} +316 -230
- package/src/{session/default-session-manager.ts → transports/local.ts} +138 -172
- package/src/transports/rpc.test.ts +82 -0
- package/src/transports/rpc.ts +665 -0
- package/src/transports/runtime-host-support.ts +86 -0
- package/src/types/config.ts +3 -2
- package/src/{session/utils/types.ts → types/session.ts} +18 -5
- package/src/types/sessions.ts +21 -0
- package/src/types/storage.ts +1 -6
- package/src/types.ts +25 -18
- package/dist/chat/chat-schema.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/runtime/team-runtime-registry.d.ts +0 -13
- package/dist/runtime/team-runtime-registry.d.ts.map +0 -1
- package/dist/session/default-session-manager.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.map +0 -1
- package/dist/session/session-telemetry.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.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/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/prompt/default-system.ts +0 -21
- package/src/runtime/team-runtime-registry.ts +0 -43
- package/src/session/session-config-builder.ts +0 -126
- 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/storage/artifact-store.ts +0 -1
- package/src/storage/session-store.ts +0 -1
- package/src/team/multi-agent.lifecycle.test.ts +0 -201
- package/src/tools/executors/file-read.test.ts +0 -49
- /package/dist/{tools → extensions/tools}/constants.d.ts +0 -0
- /package/dist/{tools → extensions/tools}/definitions.d.ts +0 -0
- /package/dist/{tools → extensions/tools}/executors/apply-patch-parser.d.ts +0 -0
- /package/dist/{tools → extensions/tools}/executors/apply-patch.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/search.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}/index.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/{team → extensions/tools/team}/team-tools.d.ts +0 -0
- /package/dist/{session → runtime}/rpc-spawn-lease.d.ts +0 -0
- /package/dist/{providers → services/providers}/local-provider-registry.d.ts +0 -0
- /package/dist/{providers → services/providers}/local-provider-service.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/dist/{session → services}/workspace-manifest.d.ts +0 -0
- /package/dist/{chat → types}/chat-schema.d.ts +0 -0
- /package/src/{tools → extensions/tools}/constants.ts +0 -0
- /package/src/{tools → extensions/tools}/definitions.test.ts +0 -0
- /package/src/{tools → extensions/tools}/executors/apply-patch-parser.ts +0 -0
- /package/src/{tools → extensions/tools}/executors/apply-patch.ts +0 -0
- /package/src/{tools → extensions/tools}/executors/bash.test.ts +0 -0
- /package/src/{tools → extensions/tools}/executors/bash.ts +0 -0
- /package/src/{tools → extensions/tools}/executors/editor.test.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/{tools → extensions/tools}/index.ts +0 -0
- /package/src/{tools → extensions/tools}/model-tool-routing.test.ts +0 -0
- /package/src/{tools → extensions/tools}/presets.test.ts +0 -0
- /package/src/{tools → extensions/tools}/schemas.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/{runtime → hooks}/checkpoint-hooks.test.ts +0 -0
- /package/src/{session → runtime}/runtime-oauth-token-manager.test.ts +0 -0
- /package/src/{providers → services/providers}/local-provider-registry.ts +0 -0
- /package/src/{providers → services/providers}/local-provider-service.test.ts +0 -0
- /package/src/{storage → services/storage}/index.ts +0 -0
- /package/src/{storage → services/storage}/provider-settings-manager.test.ts +0 -0
- /package/src/{telemetry → services/telemetry}/ITelemetryAdapter.ts +0 -0
- /package/src/{telemetry → services/telemetry}/OpenTelemetryAdapter.test.ts +0 -0
- /package/src/{telemetry → services/telemetry}/OpenTelemetryAdapter.ts +0 -0
- /package/src/{telemetry → services/telemetry}/OpenTelemetryProvider.test.ts +0 -0
- /package/src/{telemetry → services/telemetry}/OpenTelemetryProvider.ts +0 -0
- /package/src/{telemetry → services/telemetry}/TelemetryLoggerSink.test.ts +0 -0
- /package/src/{telemetry → services/telemetry}/TelemetryLoggerSink.ts +0 -0
- /package/src/{telemetry → services/telemetry}/TelemetryService.test.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.test.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}/file-indexer.d.ts +0 -0
- /package/src/{input → services/workspace}/index.ts +0 -0
- /package/src/{session → services}/workspace-manifest.ts +0 -0
- /package/src/{chat → types}/chat-schema.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 {
|
|
@@ -244,7 +261,6 @@ export function createAgentTeamsTools(
|
|
|
244
261
|
const spec: TeamTeammateSpec = {
|
|
245
262
|
agentId: validatedInput.agentId,
|
|
246
263
|
rolePrompt: validatedInput.rolePrompt,
|
|
247
|
-
maxIterations: validatedInput.maxIterations,
|
|
248
264
|
};
|
|
249
265
|
spawnTeamTeammate({
|
|
250
266
|
runtime: options.runtime,
|
|
@@ -312,12 +328,26 @@ export function createAgentTeamsTools(
|
|
|
312
328
|
createTool<TeamTaskInput, TeamTaskToolResult>({
|
|
313
329
|
name: "team_task",
|
|
314
330
|
description:
|
|
315
|
-
"Manage shared team tasks
|
|
331
|
+
"Manage shared team tasks with action-specific payloads. " +
|
|
332
|
+
"create requires title and description, with optional dependsOn and assignee. " +
|
|
333
|
+
"list accepts optional status, assignee. " +
|
|
334
|
+
"claim requires taskId. complete requires taskId and summary. block requires taskId and reason. " +
|
|
335
|
+
"Do not include fields from other actions.",
|
|
316
336
|
inputSchema: zodToJsonSchema(TeamTaskInputSchema),
|
|
317
337
|
execute: async (input) => {
|
|
318
338
|
const validatedInput = validateWithZod(TeamTaskInputSchema, input);
|
|
319
339
|
switch (validatedInput.action) {
|
|
320
340
|
case "create": {
|
|
341
|
+
const ignoredFieldSet = new Set(
|
|
342
|
+
TEAM_TASK_IGNORED_FIELDS_BY_ACTION.create ?? [],
|
|
343
|
+
);
|
|
344
|
+
const ignoredFields = Object.entries(
|
|
345
|
+
input as Record<string, unknown>,
|
|
346
|
+
)
|
|
347
|
+
.filter(
|
|
348
|
+
([field, value]) => ignoredFieldSet.has(field) && value != null,
|
|
349
|
+
)
|
|
350
|
+
.map(([field]) => field);
|
|
321
351
|
const task = options.runtime.createTask({
|
|
322
352
|
title: validatedInput.title!,
|
|
323
353
|
description: validatedInput.description!,
|
|
@@ -329,6 +359,12 @@ export function createAgentTeamsTools(
|
|
|
329
359
|
action: "create",
|
|
330
360
|
taskId: task.id,
|
|
331
361
|
status: task.status,
|
|
362
|
+
...(ignoredFields.length > 0
|
|
363
|
+
? {
|
|
364
|
+
ignoredFields,
|
|
365
|
+
note: `Ignored fields for action=create: ${ignoredFields.join(", ")}`,
|
|
366
|
+
}
|
|
367
|
+
: {}),
|
|
332
368
|
};
|
|
333
369
|
}
|
|
334
370
|
case "list":
|
|
@@ -337,8 +373,6 @@ export function createAgentTeamsTools(
|
|
|
337
373
|
tasks: options.runtime.listTaskItems({
|
|
338
374
|
status: validatedInput.status,
|
|
339
375
|
assignee: validatedInput.assignee,
|
|
340
|
-
unassignedOnly: validatedInput.unassignedOnly,
|
|
341
|
-
readyOnly: validatedInput.readyOnly,
|
|
342
376
|
}),
|
|
343
377
|
};
|
|
344
378
|
case "claim": {
|
|
@@ -383,6 +417,11 @@ export function createAgentTeamsTools(
|
|
|
383
417
|
}) as Tool,
|
|
384
418
|
);
|
|
385
419
|
|
|
420
|
+
// Track in-flight sync runs per agent for dedup
|
|
421
|
+
// (Claude sometimes emits duplicate tool_use blocks in a single response;
|
|
422
|
+
// we execute the first and return an informative "duplicate ignored" to the rest)
|
|
423
|
+
const pendingSyncRuns = new Set<string>();
|
|
424
|
+
|
|
386
425
|
tools.push(
|
|
387
426
|
createTool<
|
|
388
427
|
TeamRunTaskInput,
|
|
@@ -417,22 +456,36 @@ export function createAgentTeamsTools(
|
|
|
417
456
|
runId: run.id,
|
|
418
457
|
};
|
|
419
458
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
);
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
459
|
+
|
|
460
|
+
/// Deduplication guard: reject a duplicate sync call for the same agent
|
|
461
|
+
// that was already dispatched in this same parallel tool-call batch.
|
|
462
|
+
if (pendingSyncRuns.has(validatedInput.agentId)) {
|
|
463
|
+
throw new Error(
|
|
464
|
+
`Duplicate team_run_task call detected for agent "${validatedInput.agentId}". ` +
|
|
465
|
+
`Only one call per agent is allowed per turn. Discard this duplicate result.`,
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
pendingSyncRuns.add(validatedInput.agentId);
|
|
469
|
+
try {
|
|
470
|
+
const result = await options.runtime.routeToTeammate(
|
|
471
|
+
validatedInput.agentId,
|
|
472
|
+
validatedInput.task,
|
|
473
|
+
{
|
|
474
|
+
taskId: validatedInput.taskId || undefined,
|
|
475
|
+
fromAgentId: options.requesterId,
|
|
476
|
+
continueConversation:
|
|
477
|
+
validatedInput.continueConversation || undefined,
|
|
478
|
+
},
|
|
479
|
+
);
|
|
480
|
+
return {
|
|
481
|
+
agentId: validatedInput.agentId,
|
|
482
|
+
mode: "sync",
|
|
483
|
+
text: result.text,
|
|
484
|
+
iterations: result.iterations,
|
|
485
|
+
};
|
|
486
|
+
} finally {
|
|
487
|
+
pendingSyncRuns.delete(validatedInput.agentId);
|
|
488
|
+
}
|
|
436
489
|
},
|
|
437
490
|
}) as Tool,
|
|
438
491
|
);
|
|
@@ -467,44 +520,19 @@ export function createAgentTeamsTools(
|
|
|
467
520
|
);
|
|
468
521
|
|
|
469
522
|
tools.push(
|
|
470
|
-
createTool<
|
|
471
|
-
name: "
|
|
523
|
+
createTool<TeamAwaitRunsInput, TeamRunToolSummary | TeamRunToolSummary[]>({
|
|
524
|
+
name: "team_await_runs",
|
|
472
525
|
description:
|
|
473
|
-
"Wait for one
|
|
474
|
-
inputSchema: zodToJsonSchema(
|
|
526
|
+
"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.",
|
|
527
|
+
inputSchema: zodToJsonSchema(TeamAwaitRunsInputSchema),
|
|
475
528
|
timeoutMs: TEAM_AWAIT_TIMEOUT_MS,
|
|
476
529
|
execute: async (input) => {
|
|
477
|
-
const validatedInput = validateWithZod(
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
);
|
|
483
|
-
}
|
|
484
|
-
if (run.status === "cancelled") {
|
|
485
|
-
throw new Error(
|
|
486
|
-
`Run "${run.id}" was cancelled${run.error ? `: ${run.error}` : ""}`,
|
|
487
|
-
);
|
|
488
|
-
}
|
|
489
|
-
if (run.status === "interrupted") {
|
|
490
|
-
throw new Error(
|
|
491
|
-
`Run "${run.id}" was interrupted${run.error ? `: ${run.error}` : ""}`,
|
|
492
|
-
);
|
|
530
|
+
const validatedInput = validateWithZod(TeamAwaitRunsInputSchema, input);
|
|
531
|
+
if (validatedInput.runId) {
|
|
532
|
+
const run = await options.runtime.awaitRun(validatedInput.runId);
|
|
533
|
+
assertAwaitedRunSucceeded(run);
|
|
534
|
+
return summarizeRun(run);
|
|
493
535
|
}
|
|
494
|
-
return summarizeRun(run);
|
|
495
|
-
},
|
|
496
|
-
}) as Tool,
|
|
497
|
-
);
|
|
498
|
-
|
|
499
|
-
tools.push(
|
|
500
|
-
createTool<TeamAwaitAllRunsInput, TeamRunToolSummary[]>({
|
|
501
|
-
name: "team_await_all_runs",
|
|
502
|
-
description:
|
|
503
|
-
"Wait for all active async runs to complete. Uses a long timeout for legitimate teammate work.",
|
|
504
|
-
inputSchema: zodToJsonSchema(TeamAwaitAllRunsInputSchema),
|
|
505
|
-
timeoutMs: TEAM_AWAIT_TIMEOUT_MS,
|
|
506
|
-
execute: async (input) => {
|
|
507
|
-
validateWithZod(TeamAwaitAllRunsInputSchema, input);
|
|
508
536
|
const runs = await options.runtime.awaitAllRuns();
|
|
509
537
|
const failedRuns = runs.filter((run) =>
|
|
510
538
|
["failed", "cancelled", "interrupted"].includes(run.status),
|
|
@@ -528,7 +556,7 @@ export function createAgentTeamsTools(
|
|
|
528
556
|
tools.push(
|
|
529
557
|
createTool<TeamSendMessageInput, { id: string; toAgentId: string }>({
|
|
530
558
|
name: "team_send_message",
|
|
531
|
-
description: "Send a
|
|
559
|
+
description: "Send a mailbox message to a specific teammate.",
|
|
532
560
|
inputSchema: zodToJsonSchema(TeamSendMessageInputSchema),
|
|
533
561
|
execute: async (input) => {
|
|
534
562
|
const validatedInput = validateWithZod(
|
|
@@ -550,7 +578,7 @@ export function createAgentTeamsTools(
|
|
|
550
578
|
tools.push(
|
|
551
579
|
createTool<TeamBroadcastInput, { delivered: number }>({
|
|
552
580
|
name: "team_broadcast",
|
|
553
|
-
description: "Broadcast a
|
|
581
|
+
description: "Broadcast a message to all teammates.",
|
|
554
582
|
inputSchema: zodToJsonSchema(TeamBroadcastInputSchema),
|
|
555
583
|
execute: async (input) => {
|
|
556
584
|
const validatedInput = validateWithZod(TeamBroadcastInputSchema, input);
|
|
@@ -560,7 +588,6 @@ export function createAgentTeamsTools(
|
|
|
560
588
|
validatedInput.body,
|
|
561
589
|
{
|
|
562
590
|
taskId: validatedInput.taskId ?? undefined,
|
|
563
|
-
includeLead: validatedInput.includeLead ?? undefined,
|
|
564
591
|
},
|
|
565
592
|
);
|
|
566
593
|
return { delivered: messages.length };
|
|
@@ -583,7 +610,6 @@ export function createAgentTeamsTools(
|
|
|
583
610
|
);
|
|
584
611
|
return options.runtime.listMailbox(options.requesterId, {
|
|
585
612
|
unreadOnly: validatedInput.unreadOnly,
|
|
586
|
-
limit: validatedInput.limit,
|
|
587
613
|
markRead: true,
|
|
588
614
|
});
|
|
589
615
|
},
|
|
@@ -591,12 +617,15 @@ export function createAgentTeamsTools(
|
|
|
591
617
|
);
|
|
592
618
|
|
|
593
619
|
tools.push(
|
|
594
|
-
createTool<
|
|
595
|
-
name: "
|
|
596
|
-
description: "Append a mission log update for
|
|
597
|
-
inputSchema: zodToJsonSchema(
|
|
620
|
+
createTool<TeamMissionLogInput, { id: string }>({
|
|
621
|
+
name: "team_mission_log",
|
|
622
|
+
description: "Append a mission log update for your team.",
|
|
623
|
+
inputSchema: zodToJsonSchema(TeamMissionLogInputSchema),
|
|
598
624
|
execute: async (input) => {
|
|
599
|
-
const validatedInput = validateWithZod(
|
|
625
|
+
const validatedInput = validateWithZod(
|
|
626
|
+
TeamMissionLogInputSchema,
|
|
627
|
+
input,
|
|
628
|
+
);
|
|
600
629
|
const entry = options.runtime.appendMissionLog({
|
|
601
630
|
agentId: options.requesterId,
|
|
602
631
|
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 {
|
|
@@ -50,7 +50,12 @@ describe("createHookConfigFileHooks", () => {
|
|
|
50
50
|
});
|
|
51
51
|
expect(hooks).toBeUndefined();
|
|
52
52
|
} finally {
|
|
53
|
-
await rm(workspace, {
|
|
53
|
+
await rm(workspace, {
|
|
54
|
+
recursive: true,
|
|
55
|
+
force: true,
|
|
56
|
+
maxRetries: 3,
|
|
57
|
+
retryDelay: 250,
|
|
58
|
+
});
|
|
54
59
|
}
|
|
55
60
|
});
|
|
56
61
|
|
|
@@ -78,7 +83,12 @@ describe("createHookConfigFileHooks", () => {
|
|
|
78
83
|
});
|
|
79
84
|
expect(control).toMatchObject({ cancel: true, context: "legacy-ok" });
|
|
80
85
|
} finally {
|
|
81
|
-
await rm(workspace, {
|
|
86
|
+
await rm(workspace, {
|
|
87
|
+
recursive: true,
|
|
88
|
+
force: true,
|
|
89
|
+
maxRetries: 3,
|
|
90
|
+
retryDelay: 250,
|
|
91
|
+
});
|
|
82
92
|
}
|
|
83
93
|
});
|
|
84
94
|
|
|
@@ -106,7 +116,12 @@ describe("createHookConfigFileHooks", () => {
|
|
|
106
116
|
});
|
|
107
117
|
expect(control).toMatchObject({ cancel: false, context: "shebang-ok" });
|
|
108
118
|
} finally {
|
|
109
|
-
await rm(workspace, {
|
|
119
|
+
await rm(workspace, {
|
|
120
|
+
recursive: true,
|
|
121
|
+
force: true,
|
|
122
|
+
maxRetries: 3,
|
|
123
|
+
retryDelay: 250,
|
|
124
|
+
});
|
|
110
125
|
}
|
|
111
126
|
});
|
|
112
127
|
|
|
@@ -137,7 +152,12 @@ describe("createHookConfigFileHooks", () => {
|
|
|
137
152
|
context: "needs-review",
|
|
138
153
|
});
|
|
139
154
|
} finally {
|
|
140
|
-
await rm(workspace, {
|
|
155
|
+
await rm(workspace, {
|
|
156
|
+
recursive: true,
|
|
157
|
+
force: true,
|
|
158
|
+
maxRetries: 3,
|
|
159
|
+
retryDelay: 250,
|
|
160
|
+
});
|
|
141
161
|
}
|
|
142
162
|
});
|
|
143
163
|
|
|
@@ -168,7 +188,12 @@ describe("createHookConfigFileHooks", () => {
|
|
|
168
188
|
context: "python-ok",
|
|
169
189
|
});
|
|
170
190
|
} finally {
|
|
171
|
-
await rm(workspace, {
|
|
191
|
+
await rm(workspace, {
|
|
192
|
+
recursive: true,
|
|
193
|
+
force: true,
|
|
194
|
+
maxRetries: 3,
|
|
195
|
+
retryDelay: 250,
|
|
196
|
+
});
|
|
172
197
|
}
|
|
173
198
|
});
|
|
174
199
|
|
|
@@ -201,7 +226,12 @@ describe("createHookConfigFileHooks", () => {
|
|
|
201
226
|
context: "powershell-ok",
|
|
202
227
|
});
|
|
203
228
|
} finally {
|
|
204
|
-
await rm(workspace, {
|
|
229
|
+
await rm(workspace, {
|
|
230
|
+
recursive: true,
|
|
231
|
+
force: true,
|
|
232
|
+
maxRetries: 3,
|
|
233
|
+
retryDelay: 250,
|
|
234
|
+
});
|
|
205
235
|
}
|
|
206
236
|
},
|
|
207
237
|
);
|
|
@@ -231,7 +261,12 @@ describe("createHookConfigFileHooks", () => {
|
|
|
231
261
|
expect(payload.hookName).toBe("agent_error");
|
|
232
262
|
expect(payload.error?.message).toBe("401 unauthorized");
|
|
233
263
|
} finally {
|
|
234
|
-
await rm(workspace, {
|
|
264
|
+
await rm(workspace, {
|
|
265
|
+
recursive: true,
|
|
266
|
+
force: true,
|
|
267
|
+
maxRetries: 3,
|
|
268
|
+
retryDelay: 250,
|
|
269
|
+
});
|
|
235
270
|
}
|
|
236
271
|
});
|
|
237
272
|
|
|
@@ -1,5 +1,6 @@
|
|
|
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,
|
|
@@ -7,7 +8,7 @@ import {
|
|
|
7
8
|
type HookSessionContext,
|
|
8
9
|
withResolvedClineBuildEnv,
|
|
9
10
|
} from "@clinebot/shared";
|
|
10
|
-
import {
|
|
11
|
+
import { ensureHookLogDir } from "@clinebot/shared/storage";
|
|
11
12
|
import { listHookConfigFiles } from "../extensions/config/hooks-config-loader";
|
|
12
13
|
import type { HookEventName, HookEventPayload } from "../hooks";
|
|
13
14
|
|
|
@@ -42,7 +43,6 @@ type AgentHookSessionShutdownContext = Parameters<
|
|
|
42
43
|
type HookRuntimeOptions = {
|
|
43
44
|
cwd: string;
|
|
44
45
|
workspacePath: string;
|
|
45
|
-
hookLogPath?: string;
|
|
46
46
|
rootSessionId?: string;
|
|
47
47
|
logger?: BasicLogger;
|
|
48
48
|
toolCallTimeoutMs?: number;
|
|
@@ -147,10 +147,6 @@ function isAbortReason(reason?: string): boolean {
|
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
function ensureHookLogDir(filePath: string): void {
|
|
151
|
-
ensureParentDir(filePath);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
150
|
function createPayloadBase(
|
|
155
151
|
ctx: HookContextBase,
|
|
156
152
|
options: HookRuntimeOptions,
|
|
@@ -159,7 +155,6 @@ function createPayloadBase(
|
|
|
159
155
|
process.env.CLINE_USER_ID?.trim() || process.env.USER?.trim() || "unknown";
|
|
160
156
|
const sessionContext: HookSessionContext = {
|
|
161
157
|
rootSessionId: options.rootSessionId || ctx.conversationId,
|
|
162
|
-
hookLogPath: options.hookLogPath,
|
|
163
158
|
};
|
|
164
159
|
return {
|
|
165
160
|
clineVersion: process.env.CLINE_VERSION?.trim() || "",
|
|
@@ -503,14 +498,12 @@ function runAsyncHookCommands(options: {
|
|
|
503
498
|
}
|
|
504
499
|
|
|
505
500
|
export function createHookAuditHooks(options: {
|
|
506
|
-
hookLogPath: string;
|
|
507
501
|
rootSessionId?: string;
|
|
508
502
|
workspacePath: string;
|
|
509
503
|
}): AgentHooks {
|
|
510
504
|
const runtimeOptions: HookRuntimeOptions = {
|
|
511
505
|
cwd: options.workspacePath,
|
|
512
506
|
workspacePath: options.workspacePath,
|
|
513
|
-
hookLogPath: options.hookLogPath,
|
|
514
507
|
rootSessionId: options.rootSessionId,
|
|
515
508
|
};
|
|
516
509
|
|
|
@@ -519,8 +512,10 @@ export function createHookAuditHooks(options: {
|
|
|
519
512
|
ts: new Date().toISOString(),
|
|
520
513
|
...payload,
|
|
521
514
|
})}\n`;
|
|
522
|
-
|
|
523
|
-
|
|
515
|
+
const envPath = process.env.CLINE_HOOKS_LOG_PATH?.trim() || undefined;
|
|
516
|
+
const logPath = envPath ?? join(ensureHookLogDir(), "hooks.jsonl");
|
|
517
|
+
ensureHookLogDir(logPath);
|
|
518
|
+
appendFileSync(logPath, line, "utf8");
|
|
524
519
|
};
|
|
525
520
|
|
|
526
521
|
return {
|