@clinebot/core 0.0.34 → 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/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/plugin-sandbox-bootstrap.js +248 -248
- 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 +35 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +381 -379
- 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.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/{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 +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/{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 +2 -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/cline.ts +1 -1
- package/src/auth/codex.ts +1 -1
- package/src/auth/oca.ts +1 -1
- 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/plugin/plugin-config-loader.test.ts +6 -4
- 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 +43 -31
- package/src/{team → extensions/tools/team}/team-tools.ts +63 -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 +6 -11
- package/src/hooks/subprocess.ts +48 -257
- package/src/index.ts +167 -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 +3 -4
- package/src/runtime/runtime-builder.ts +13 -21
- 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/{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 +7 -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 +86 -27
- package/src/session/persistence-service.ts +104 -103
- 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} +137 -169
- 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 +2 -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/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/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/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/{runtime → hooks}/hook-file-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
|
@@ -69,8 +69,10 @@ describe("createAgentTeamsTools schema surface", () => {
|
|
|
69
69
|
const createOutcome = tools.find(
|
|
70
70
|
(tool) => tool.name === "team_create_outcome",
|
|
71
71
|
);
|
|
72
|
-
const
|
|
73
|
-
const teamLogUpdate = tools.find(
|
|
72
|
+
const teamAwaitRuns = tools.find((tool) => tool.name === "team_await_runs");
|
|
73
|
+
const teamLogUpdate = tools.find(
|
|
74
|
+
(tool) => tool.name === "team_mission_log",
|
|
75
|
+
);
|
|
74
76
|
|
|
75
77
|
expect(spawn?.inputSchema.type).toBe("object");
|
|
76
78
|
const teamTaskSchema = teamTask?.inputSchema as
|
|
@@ -85,7 +87,7 @@ describe("createAgentTeamsTools schema surface", () => {
|
|
|
85
87
|
expect(teamTaskSchema?.required).toEqual(["action"]);
|
|
86
88
|
expect(send?.inputSchema.type).toBe("object");
|
|
87
89
|
expect(createOutcome?.inputSchema.type).toBe("object");
|
|
88
|
-
expect(
|
|
90
|
+
expect(teamAwaitRuns?.inputSchema.type).toBe("object");
|
|
89
91
|
const schema = teamLogUpdate?.inputSchema as
|
|
90
92
|
| { properties: Record<string, unknown>; required: unknown[] }
|
|
91
93
|
| undefined;
|
|
@@ -243,7 +245,7 @@ describe("createAgentTeamsTools schema surface", () => {
|
|
|
243
245
|
});
|
|
244
246
|
});
|
|
245
247
|
|
|
246
|
-
it("
|
|
248
|
+
it("ignores non-create fields for action=create and reports them back", async () => {
|
|
247
249
|
const runtime = new AgentTeamsRuntime({ teamName: "test-team" });
|
|
248
250
|
const tools = createAgentTeamsTools({
|
|
249
251
|
runtime,
|
|
@@ -252,13 +254,18 @@ describe("createAgentTeamsTools schema surface", () => {
|
|
|
252
254
|
});
|
|
253
255
|
const teamTask = tools.find((tool) => tool.name === "team_task");
|
|
254
256
|
expect(teamTask).toBeDefined();
|
|
257
|
+
if (!teamTask) {
|
|
258
|
+
throw new Error("Expected team_task tool to be defined");
|
|
259
|
+
}
|
|
255
260
|
|
|
256
261
|
await expect(
|
|
257
|
-
teamTask
|
|
262
|
+
teamTask.execute(
|
|
258
263
|
{
|
|
259
|
-
action: "
|
|
260
|
-
|
|
261
|
-
|
|
264
|
+
action: "create",
|
|
265
|
+
title: "Draft TypeScript haiku",
|
|
266
|
+
description: "Write a concise haiku",
|
|
267
|
+
status: "pending",
|
|
268
|
+
summary: "not used",
|
|
262
269
|
},
|
|
263
270
|
{
|
|
264
271
|
agentId: "lead",
|
|
@@ -266,7 +273,13 @@ describe("createAgentTeamsTools schema surface", () => {
|
|
|
266
273
|
iteration: 1,
|
|
267
274
|
},
|
|
268
275
|
),
|
|
269
|
-
).
|
|
276
|
+
).resolves.toMatchObject({
|
|
277
|
+
action: "create",
|
|
278
|
+
status: "pending",
|
|
279
|
+
taskId: expect.stringMatching(/^task_/),
|
|
280
|
+
ignoredFields: ["status", "summary"],
|
|
281
|
+
note: "Ignored fields for action=create: status, summary",
|
|
282
|
+
});
|
|
270
283
|
});
|
|
271
284
|
|
|
272
285
|
it("defaults requiredSections for team_create_outcome", async () => {
|
|
@@ -530,7 +543,7 @@ describe("createAgentTeamsTools runtime behavior", () => {
|
|
|
530
543
|
);
|
|
531
544
|
});
|
|
532
545
|
|
|
533
|
-
it("throws from
|
|
546
|
+
it("throws from team_await_runs when a requested async delegated run fails", async () => {
|
|
534
547
|
const runtime = {
|
|
535
548
|
awaitRun: vi.fn(async () => ({
|
|
536
549
|
id: "run_0001",
|
|
@@ -544,11 +557,11 @@ describe("createAgentTeamsTools runtime behavior", () => {
|
|
|
544
557
|
requesterId: "lead",
|
|
545
558
|
teammateConfigProvider: makeTeammateConfigProvider(),
|
|
546
559
|
});
|
|
547
|
-
const
|
|
548
|
-
expect(
|
|
560
|
+
const awaitRuns = tools.find((tool) => tool.name === "team_await_runs");
|
|
561
|
+
expect(awaitRuns).toBeDefined();
|
|
549
562
|
|
|
550
563
|
await expect(
|
|
551
|
-
|
|
564
|
+
awaitRuns?.execute(
|
|
552
565
|
{ runId: "run_0001" },
|
|
553
566
|
{
|
|
554
567
|
agentId: "lead",
|
|
@@ -559,7 +572,7 @@ describe("createAgentTeamsTools runtime behavior", () => {
|
|
|
559
572
|
).rejects.toThrow('Run "run_0001" failed: Authentication failed');
|
|
560
573
|
});
|
|
561
574
|
|
|
562
|
-
it("throws from
|
|
575
|
+
it("throws from team_await_runs when any delegated run is not successful in all-runs mode", async () => {
|
|
563
576
|
const runtime = {
|
|
564
577
|
awaitAllRuns: vi.fn(async () => [
|
|
565
578
|
{ id: "run_ok", status: "completed" },
|
|
@@ -572,13 +585,11 @@ describe("createAgentTeamsTools runtime behavior", () => {
|
|
|
572
585
|
requesterId: "lead",
|
|
573
586
|
teammateConfigProvider: makeTeammateConfigProvider(),
|
|
574
587
|
});
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
);
|
|
578
|
-
expect(awaitAllRuns).toBeDefined();
|
|
588
|
+
const awaitRuns = tools.find((tool) => tool.name === "team_await_runs");
|
|
589
|
+
expect(awaitRuns).toBeDefined();
|
|
579
590
|
|
|
580
591
|
await expect(
|
|
581
|
-
|
|
592
|
+
awaitRuns?.execute(
|
|
582
593
|
{},
|
|
583
594
|
{
|
|
584
595
|
agentId: "lead",
|
|
@@ -591,7 +602,7 @@ describe("createAgentTeamsTools runtime behavior", () => {
|
|
|
591
602
|
);
|
|
592
603
|
});
|
|
593
604
|
|
|
594
|
-
it("returns compact summaries from
|
|
605
|
+
it("returns compact summaries from team_await_runs without full teammate transcripts", async () => {
|
|
595
606
|
const runtime = {
|
|
596
607
|
awaitRun: vi.fn(async () => ({
|
|
597
608
|
id: "run_0001",
|
|
@@ -633,10 +644,10 @@ describe("createAgentTeamsTools runtime behavior", () => {
|
|
|
633
644
|
requesterId: "lead",
|
|
634
645
|
teammateConfigProvider: makeTeammateConfigProvider(),
|
|
635
646
|
});
|
|
636
|
-
const
|
|
647
|
+
const awaitRuns = tools.find((tool) => tool.name === "team_await_runs");
|
|
637
648
|
|
|
638
649
|
await expect(
|
|
639
|
-
|
|
650
|
+
awaitRuns?.execute(
|
|
640
651
|
{ runId: "run_0001" },
|
|
641
652
|
{
|
|
642
653
|
agentId: "lead",
|
|
@@ -728,19 +739,15 @@ describe("createAgentTeamsTools runtime behavior", () => {
|
|
|
728
739
|
]);
|
|
729
740
|
});
|
|
730
741
|
|
|
731
|
-
it("sets long timeout for team await
|
|
742
|
+
it("sets long timeout for team await tool", () => {
|
|
732
743
|
const runtime = new AgentTeamsRuntime({ teamName: "test-team" });
|
|
733
744
|
const tools = createAgentTeamsTools({
|
|
734
745
|
runtime,
|
|
735
746
|
requesterId: "lead",
|
|
736
747
|
teammateConfigProvider: makeTeammateConfigProvider(),
|
|
737
748
|
});
|
|
738
|
-
const
|
|
739
|
-
|
|
740
|
-
(tool) => tool.name === "team_await_all_runs",
|
|
741
|
-
);
|
|
742
|
-
expect(awaitRun?.timeoutMs).toBe(60 * 60 * 1000);
|
|
743
|
-
expect(awaitAllRuns?.timeoutMs).toBe(60 * 60 * 1000);
|
|
749
|
+
const awaitRuns = tools.find((tool) => tool.name === "team_await_runs");
|
|
750
|
+
expect(awaitRuns?.timeoutMs).toBe(60 * 60 * 1000);
|
|
744
751
|
});
|
|
745
752
|
|
|
746
753
|
it("deduplicates concurrent sync team_run_task calls to the same agent", async () => {
|
|
@@ -847,7 +854,7 @@ describe("createAgentTeamsTools runtime behavior", () => {
|
|
|
847
854
|
expect(result2.text).toBe("Evaluated");
|
|
848
855
|
});
|
|
849
856
|
|
|
850
|
-
it("lists
|
|
857
|
+
it("lists team tasks through team_task list action", async () => {
|
|
851
858
|
const runtime = new AgentTeamsRuntime({ teamName: "test-team" });
|
|
852
859
|
const tools = createAgentTeamsTools({
|
|
853
860
|
runtime,
|
|
@@ -885,7 +892,7 @@ describe("createAgentTeamsTools runtime behavior", () => {
|
|
|
885
892
|
|
|
886
893
|
await expect(
|
|
887
894
|
teamTask?.execute(
|
|
888
|
-
{ action: "list"
|
|
895
|
+
{ action: "list" },
|
|
889
896
|
{
|
|
890
897
|
agentId: "lead",
|
|
891
898
|
conversationId: "conv-1",
|
|
@@ -900,6 +907,11 @@ describe("createAgentTeamsTools runtime behavior", () => {
|
|
|
900
907
|
isReady: true,
|
|
901
908
|
blockedBy: [],
|
|
902
909
|
}),
|
|
910
|
+
expect.objectContaining({
|
|
911
|
+
title: "Blocked task",
|
|
912
|
+
isReady: false,
|
|
913
|
+
blockedBy: [first.taskId],
|
|
914
|
+
}),
|
|
903
915
|
],
|
|
904
916
|
});
|
|
905
917
|
});
|
|
@@ -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": {
|
|
@@ -486,44 +520,19 @@ export function createAgentTeamsTools(
|
|
|
486
520
|
);
|
|
487
521
|
|
|
488
522
|
tools.push(
|
|
489
|
-
createTool<
|
|
490
|
-
name: "
|
|
523
|
+
createTool<TeamAwaitRunsInput, TeamRunToolSummary | TeamRunToolSummary[]>({
|
|
524
|
+
name: "team_await_runs",
|
|
491
525
|
description:
|
|
492
|
-
"Wait for one
|
|
493
|
-
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),
|
|
494
528
|
timeoutMs: TEAM_AWAIT_TIMEOUT_MS,
|
|
495
529
|
execute: async (input) => {
|
|
496
|
-
const validatedInput = validateWithZod(
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
);
|
|
502
|
-
}
|
|
503
|
-
if (run.status === "cancelled") {
|
|
504
|
-
throw new Error(
|
|
505
|
-
`Run "${run.id}" was cancelled${run.error ? `: ${run.error}` : ""}`,
|
|
506
|
-
);
|
|
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);
|
|
507
535
|
}
|
|
508
|
-
if (run.status === "interrupted") {
|
|
509
|
-
throw new Error(
|
|
510
|
-
`Run "${run.id}" was interrupted${run.error ? `: ${run.error}` : ""}`,
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
return summarizeRun(run);
|
|
514
|
-
},
|
|
515
|
-
}) as Tool,
|
|
516
|
-
);
|
|
517
|
-
|
|
518
|
-
tools.push(
|
|
519
|
-
createTool<TeamAwaitAllRunsInput, TeamRunToolSummary[]>({
|
|
520
|
-
name: "team_await_all_runs",
|
|
521
|
-
description:
|
|
522
|
-
"Wait for all active async runs to complete. Uses a long timeout for legitimate teammate work.",
|
|
523
|
-
inputSchema: zodToJsonSchema(TeamAwaitAllRunsInputSchema),
|
|
524
|
-
timeoutMs: TEAM_AWAIT_TIMEOUT_MS,
|
|
525
|
-
execute: async (input) => {
|
|
526
|
-
validateWithZod(TeamAwaitAllRunsInputSchema, input);
|
|
527
536
|
const runs = await options.runtime.awaitAllRuns();
|
|
528
537
|
const failedRuns = runs.filter((run) =>
|
|
529
538
|
["failed", "cancelled", "interrupted"].includes(run.status),
|
|
@@ -547,7 +556,7 @@ export function createAgentTeamsTools(
|
|
|
547
556
|
tools.push(
|
|
548
557
|
createTool<TeamSendMessageInput, { id: string; toAgentId: string }>({
|
|
549
558
|
name: "team_send_message",
|
|
550
|
-
description: "Send a
|
|
559
|
+
description: "Send a mailbox message to a specific teammate.",
|
|
551
560
|
inputSchema: zodToJsonSchema(TeamSendMessageInputSchema),
|
|
552
561
|
execute: async (input) => {
|
|
553
562
|
const validatedInput = validateWithZod(
|
|
@@ -569,7 +578,7 @@ export function createAgentTeamsTools(
|
|
|
569
578
|
tools.push(
|
|
570
579
|
createTool<TeamBroadcastInput, { delivered: number }>({
|
|
571
580
|
name: "team_broadcast",
|
|
572
|
-
description: "Broadcast a
|
|
581
|
+
description: "Broadcast a message to all teammates.",
|
|
573
582
|
inputSchema: zodToJsonSchema(TeamBroadcastInputSchema),
|
|
574
583
|
execute: async (input) => {
|
|
575
584
|
const validatedInput = validateWithZod(TeamBroadcastInputSchema, input);
|
|
@@ -579,7 +588,6 @@ export function createAgentTeamsTools(
|
|
|
579
588
|
validatedInput.body,
|
|
580
589
|
{
|
|
581
590
|
taskId: validatedInput.taskId ?? undefined,
|
|
582
|
-
includeLead: validatedInput.includeLead ?? undefined,
|
|
583
591
|
},
|
|
584
592
|
);
|
|
585
593
|
return { delivered: messages.length };
|
|
@@ -602,7 +610,6 @@ export function createAgentTeamsTools(
|
|
|
602
610
|
);
|
|
603
611
|
return options.runtime.listMailbox(options.requesterId, {
|
|
604
612
|
unreadOnly: validatedInput.unreadOnly,
|
|
605
|
-
limit: validatedInput.limit,
|
|
606
613
|
markRead: true,
|
|
607
614
|
});
|
|
608
615
|
},
|
|
@@ -610,12 +617,15 @@ export function createAgentTeamsTools(
|
|
|
610
617
|
);
|
|
611
618
|
|
|
612
619
|
tools.push(
|
|
613
|
-
createTool<
|
|
614
|
-
name: "
|
|
615
|
-
description: "Append a mission log update for
|
|
616
|
-
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),
|
|
617
624
|
execute: async (input) => {
|
|
618
|
-
const validatedInput = validateWithZod(
|
|
625
|
+
const validatedInput = validateWithZod(
|
|
626
|
+
TeamMissionLogInputSchema,
|
|
627
|
+
input,
|
|
628
|
+
);
|
|
619
629
|
const entry = options.runtime.appendMissionLog({
|
|
620
630
|
agentId: options.requesterId,
|
|
621
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 {
|
|
@@ -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 {
|