@clinebot/core 0.0.18 → 0.0.21
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/dist/account/cline-account-service.d.ts +3 -2
- package/dist/account/cline-account-service.d.ts.map +1 -0
- package/dist/account/index.d.ts +1 -0
- package/dist/account/index.d.ts.map +1 -0
- package/dist/account/rpc.d.ts +1 -0
- package/dist/account/rpc.d.ts.map +1 -0
- package/dist/account/types.d.ts +1 -0
- package/dist/account/types.d.ts.map +1 -0
- package/dist/agents/agent-config-loader.d.ts +1 -0
- package/dist/agents/agent-config-loader.d.ts.map +1 -0
- package/dist/agents/agent-config-parser.d.ts +1 -0
- package/dist/agents/agent-config-parser.d.ts.map +1 -0
- package/dist/agents/hooks-config-loader.d.ts +1 -0
- package/dist/agents/hooks-config-loader.d.ts.map +1 -0
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/plugin-config-loader.d.ts +1 -0
- package/dist/agents/plugin-config-loader.d.ts.map +1 -0
- package/dist/agents/plugin-loader.d.ts +1 -0
- package/dist/agents/plugin-loader.d.ts.map +1 -0
- package/dist/agents/plugin-sandbox.d.ts +1 -0
- package/dist/agents/plugin-sandbox.d.ts.map +1 -0
- package/dist/agents/unified-config-file-watcher.d.ts +1 -0
- package/dist/agents/unified-config-file-watcher.d.ts.map +1 -0
- package/dist/agents/user-instruction-config-loader.d.ts +1 -0
- package/dist/agents/user-instruction-config-loader.d.ts.map +1 -0
- package/dist/auth/client.d.ts +1 -0
- package/dist/auth/client.d.ts.map +1 -0
- package/dist/auth/cline.d.ts +1 -0
- package/dist/auth/cline.d.ts.map +1 -0
- package/dist/auth/codex.d.ts +1 -0
- package/dist/auth/codex.d.ts.map +1 -0
- package/dist/auth/oca.d.ts +1 -0
- package/dist/auth/oca.d.ts.map +1 -0
- package/dist/auth/server.d.ts +1 -0
- package/dist/auth/server.d.ts.map +1 -0
- package/dist/auth/types.d.ts +1 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/utils.d.ts +1 -0
- package/dist/auth/utils.d.ts.map +1 -0
- package/dist/chat/chat-schema.d.ts +13 -12
- package/dist/chat/chat-schema.d.ts.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.node.d.ts +2 -0
- package/dist/index.node.d.ts.map +1 -0
- package/dist/index.node.js +303 -302
- package/dist/input/file-indexer.d.ts +1 -0
- package/dist/input/file-indexer.d.ts.map +1 -0
- package/dist/input/index.d.ts +1 -0
- package/dist/input/index.d.ts.map +1 -0
- package/dist/input/mention-enricher.d.ts +1 -0
- package/dist/input/mention-enricher.d.ts.map +1 -0
- package/dist/mcp/config-loader.d.ts +1 -0
- package/dist/mcp/config-loader.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/manager.d.ts +1 -0
- package/dist/mcp/manager.d.ts.map +1 -0
- package/dist/mcp/types.d.ts +1 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/providers/local-provider-registry.d.ts +36 -0
- package/dist/providers/local-provider-registry.d.ts.map +1 -0
- package/dist/providers/local-provider-service.d.ts +2 -1
- package/dist/providers/local-provider-service.d.ts.map +1 -0
- package/dist/runtime/commands.d.ts +1 -0
- package/dist/runtime/commands.d.ts.map +1 -0
- package/dist/runtime/hook-file-hooks.d.ts +1 -0
- package/dist/runtime/hook-file-hooks.d.ts.map +1 -0
- package/dist/runtime/rules.d.ts +1 -0
- package/dist/runtime/rules.d.ts.map +1 -0
- package/dist/runtime/runtime-builder.d.ts +1 -0
- package/dist/runtime/runtime-builder.d.ts.map +1 -0
- package/dist/runtime/sandbox/subprocess-sandbox.d.ts +1 -0
- package/dist/runtime/sandbox/subprocess-sandbox.d.ts.map +1 -0
- package/dist/runtime/session-runtime.d.ts +2 -0
- package/dist/runtime/session-runtime.d.ts.map +1 -0
- package/dist/runtime/skills.d.ts +1 -0
- package/dist/runtime/skills.d.ts.map +1 -0
- package/dist/runtime/tool-approval.d.ts +1 -0
- package/dist/runtime/tool-approval.d.ts.map +1 -0
- package/dist/runtime/workflows.d.ts +1 -0
- package/dist/runtime/workflows.d.ts.map +1 -0
- package/dist/session/default-session-manager.d.ts +4 -0
- package/dist/session/default-session-manager.d.ts.map +1 -0
- package/dist/session/file-session-service.d.ts +1 -0
- package/dist/session/file-session-service.d.ts.map +1 -0
- package/dist/session/rpc-session-service.d.ts +1 -0
- package/dist/session/rpc-session-service.d.ts.map +1 -0
- package/dist/session/rpc-spawn-lease.d.ts +1 -0
- package/dist/session/rpc-spawn-lease.d.ts.map +1 -0
- package/dist/session/runtime-oauth-token-manager.d.ts +1 -0
- package/dist/session/runtime-oauth-token-manager.d.ts.map +1 -0
- package/dist/session/session-agent-events.d.ts +20 -1
- package/dist/session/session-agent-events.d.ts.map +1 -0
- package/dist/session/session-artifacts.d.ts +1 -0
- package/dist/session/session-artifacts.d.ts.map +1 -0
- package/dist/session/session-config-builder.d.ts +1 -0
- package/dist/session/session-config-builder.d.ts.map +1 -0
- package/dist/session/session-graph.d.ts +1 -0
- package/dist/session/session-graph.d.ts.map +1 -0
- package/dist/session/session-host.d.ts +1 -0
- package/dist/session/session-host.d.ts.map +1 -0
- package/dist/session/session-manager.d.ts +1 -0
- package/dist/session/session-manager.d.ts.map +1 -0
- package/dist/session/session-manifest.d.ts +2 -1
- package/dist/session/session-manifest.d.ts.map +1 -0
- package/dist/session/session-service.d.ts +1 -0
- package/dist/session/session-service.d.ts.map +1 -0
- package/dist/session/session-team-coordination.d.ts +1 -0
- package/dist/session/session-team-coordination.d.ts.map +1 -0
- package/dist/session/session-telemetry.d.ts +3 -1
- package/dist/session/session-telemetry.d.ts.map +1 -0
- package/dist/session/sqlite-rpc-session-backend.d.ts +1 -0
- package/dist/session/sqlite-rpc-session-backend.d.ts.map +1 -0
- package/dist/session/unified-session-persistence-service.d.ts +1 -0
- package/dist/session/unified-session-persistence-service.d.ts.map +1 -0
- package/dist/session/utils/helpers.d.ts +1 -0
- package/dist/session/utils/helpers.d.ts.map +1 -0
- package/dist/session/utils/types.d.ts +1 -0
- package/dist/session/utils/types.d.ts.map +1 -0
- package/dist/session/utils/usage.d.ts +1 -0
- package/dist/session/utils/usage.d.ts.map +1 -0
- package/dist/session/workspace-manager.d.ts +1 -0
- package/dist/session/workspace-manager.d.ts.map +1 -0
- package/dist/session/workspace-manifest.d.ts +1 -0
- package/dist/session/workspace-manifest.d.ts.map +1 -0
- package/dist/storage/file-team-store.d.ts +1 -0
- package/dist/storage/file-team-store.d.ts.map +1 -0
- package/dist/storage/provider-settings-legacy-migration.d.ts +1 -0
- package/dist/storage/provider-settings-legacy-migration.d.ts.map +1 -0
- package/dist/storage/provider-settings-manager.d.ts +1 -0
- package/dist/storage/provider-settings-manager.d.ts.map +1 -0
- package/dist/storage/sqlite-session-store.d.ts +1 -0
- package/dist/storage/sqlite-session-store.d.ts.map +1 -0
- package/dist/storage/sqlite-team-store.d.ts +1 -0
- package/dist/storage/sqlite-team-store.d.ts.map +1 -0
- package/dist/storage/team-store.d.ts +1 -0
- package/dist/storage/team-store.d.ts.map +1 -0
- package/dist/team/index.d.ts +1 -0
- package/dist/team/index.d.ts.map +1 -0
- package/dist/team/projections.d.ts +1 -0
- package/dist/team/projections.d.ts.map +1 -0
- package/dist/telemetry/ITelemetryAdapter.d.ts +1 -0
- package/dist/telemetry/ITelemetryAdapter.d.ts.map +1 -0
- package/dist/telemetry/LoggerTelemetryAdapter.d.ts +1 -0
- package/dist/telemetry/LoggerTelemetryAdapter.d.ts.map +1 -0
- package/dist/telemetry/OpenTelemetryAdapter.d.ts +1 -0
- package/dist/telemetry/OpenTelemetryAdapter.d.ts.map +1 -0
- package/dist/telemetry/OpenTelemetryProvider.d.ts +1 -0
- package/dist/telemetry/OpenTelemetryProvider.d.ts.map +1 -0
- package/dist/telemetry/TelemetryService.d.ts +1 -0
- package/dist/telemetry/TelemetryService.d.ts.map +1 -0
- package/dist/telemetry/core-events.d.ts +55 -22
- package/dist/telemetry/core-events.d.ts.map +1 -0
- package/dist/telemetry/opentelemetry.d.ts +1 -0
- package/dist/telemetry/opentelemetry.d.ts.map +1 -0
- package/dist/tools/constants.d.ts +1 -0
- package/dist/tools/constants.d.ts.map +1 -0
- package/dist/tools/definitions.d.ts +8 -1
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/executors/apply-patch-parser.d.ts +1 -0
- package/dist/tools/executors/apply-patch-parser.d.ts.map +1 -0
- package/dist/tools/executors/apply-patch.d.ts +1 -0
- package/dist/tools/executors/apply-patch.d.ts.map +1 -0
- package/dist/tools/executors/bash.d.ts +2 -1
- package/dist/tools/executors/bash.d.ts.map +1 -0
- package/dist/tools/executors/editor.d.ts +1 -0
- package/dist/tools/executors/editor.d.ts.map +1 -0
- package/dist/tools/executors/file-read.d.ts +1 -0
- package/dist/tools/executors/file-read.d.ts.map +1 -0
- package/dist/tools/executors/index.d.ts +14 -7
- package/dist/tools/executors/index.d.ts.map +1 -0
- package/dist/tools/executors/search.d.ts +1 -0
- package/dist/tools/executors/search.d.ts.map +1 -0
- package/dist/tools/executors/web-fetch.d.ts +1 -0
- package/dist/tools/executors/web-fetch.d.ts.map +1 -0
- package/dist/tools/helpers.d.ts +15 -0
- package/dist/tools/helpers.d.ts.map +1 -0
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/model-tool-routing.d.ts +1 -0
- package/dist/tools/model-tool-routing.d.ts.map +1 -0
- package/dist/tools/presets.d.ts +1 -0
- package/dist/tools/presets.d.ts.map +1 -0
- package/dist/tools/schemas.d.ts +41 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/types.d.ts +3 -2
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/types/common.d.ts +1 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/events.d.ts +1 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/provider-settings.d.ts +1 -0
- package/dist/types/provider-settings.d.ts.map +1 -0
- package/dist/types/sessions.d.ts +1 -0
- package/dist/types/sessions.d.ts.map +1 -0
- package/dist/types/storage.d.ts +1 -0
- package/dist/types/storage.d.ts.map +1 -0
- package/dist/types/workspace.d.ts +1 -0
- package/dist/types/workspace.d.ts.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +8 -6
- package/src/account/cline-account-service.test.ts +0 -101
- package/src/account/cline-account-service.ts +0 -287
- package/src/account/index.ts +0 -22
- package/src/account/rpc.test.ts +0 -62
- package/src/account/rpc.ts +0 -172
- package/src/account/types.ts +0 -98
- package/src/agents/agent-config-loader.test.ts +0 -236
- package/src/agents/agent-config-loader.ts +0 -108
- package/src/agents/agent-config-parser.ts +0 -198
- package/src/agents/hooks-config-loader.test.ts +0 -20
- package/src/agents/hooks-config-loader.ts +0 -118
- package/src/agents/index.ts +0 -85
- package/src/agents/plugin-config-loader.test.ts +0 -140
- package/src/agents/plugin-config-loader.ts +0 -97
- package/src/agents/plugin-loader.test.ts +0 -228
- package/src/agents/plugin-loader.ts +0 -172
- package/src/agents/plugin-sandbox-bootstrap.ts +0 -445
- package/src/agents/plugin-sandbox.test.ts +0 -317
- package/src/agents/plugin-sandbox.ts +0 -341
- package/src/agents/unified-config-file-watcher.test.ts +0 -196
- package/src/agents/unified-config-file-watcher.ts +0 -483
- package/src/agents/user-instruction-config-loader.test.ts +0 -158
- package/src/agents/user-instruction-config-loader.ts +0 -438
- package/src/auth/client.test.ts +0 -40
- package/src/auth/client.ts +0 -25
- package/src/auth/cline.test.ts +0 -130
- package/src/auth/cline.ts +0 -420
- package/src/auth/codex.test.ts +0 -170
- package/src/auth/codex.ts +0 -491
- package/src/auth/oca.test.ts +0 -215
- package/src/auth/oca.ts +0 -573
- package/src/auth/server.ts +0 -216
- package/src/auth/types.ts +0 -81
- package/src/auth/utils.test.ts +0 -128
- package/src/auth/utils.ts +0 -247
- package/src/chat/chat-schema.ts +0 -82
- package/src/index.node.ts +0 -285
- package/src/index.ts +0 -211
- package/src/input/file-indexer.d.ts +0 -11
- package/src/input/file-indexer.test.ts +0 -127
- package/src/input/file-indexer.ts +0 -327
- package/src/input/index.ts +0 -7
- package/src/input/mention-enricher.test.ts +0 -85
- package/src/input/mention-enricher.ts +0 -122
- package/src/mcp/config-loader.test.ts +0 -238
- package/src/mcp/config-loader.ts +0 -219
- package/src/mcp/index.ts +0 -26
- package/src/mcp/manager.test.ts +0 -106
- package/src/mcp/manager.ts +0 -262
- package/src/mcp/types.ts +0 -88
- package/src/providers/local-provider-service.ts +0 -608
- package/src/runtime/commands.test.ts +0 -98
- package/src/runtime/commands.ts +0 -83
- package/src/runtime/hook-file-hooks.test.ts +0 -237
- package/src/runtime/hook-file-hooks.ts +0 -859
- package/src/runtime/index.ts +0 -37
- package/src/runtime/rules.ts +0 -34
- package/src/runtime/runtime-builder.team-persistence.test.ts +0 -202
- package/src/runtime/runtime-builder.test.ts +0 -371
- package/src/runtime/runtime-builder.ts +0 -589
- package/src/runtime/runtime-parity.test.ts +0 -143
- package/src/runtime/sandbox/subprocess-sandbox.ts +0 -231
- package/src/runtime/session-runtime.ts +0 -46
- package/src/runtime/skills.ts +0 -44
- package/src/runtime/tool-approval.ts +0 -104
- package/src/runtime/workflows.test.ts +0 -119
- package/src/runtime/workflows.ts +0 -45
- package/src/session/default-session-manager.e2e.test.ts +0 -384
- package/src/session/default-session-manager.test.ts +0 -1741
- package/src/session/default-session-manager.ts +0 -1233
- package/src/session/file-session-service.ts +0 -280
- package/src/session/index.ts +0 -42
- 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/runtime-oauth-token-manager.ts +0 -272
- package/src/session/session-agent-events.ts +0 -159
- package/src/session/session-artifacts.ts +0 -106
- package/src/session/session-config-builder.ts +0 -113
- package/src/session/session-graph.ts +0 -92
- package/src/session/session-host.test.ts +0 -29
- package/src/session/session-host.ts +0 -242
- package/src/session/session-manager.ts +0 -69
- package/src/session/session-manifest.ts +0 -29
- package/src/session/session-service.team-persistence.test.ts +0 -48
- package/src/session/session-service.ts +0 -673
- package/src/session/session-team-coordination.ts +0 -229
- package/src/session/session-telemetry.ts +0 -95
- package/src/session/sqlite-rpc-session-backend.ts +0 -303
- package/src/session/unified-session-persistence-service.test.ts +0 -85
- package/src/session/unified-session-persistence-service.ts +0 -996
- package/src/session/utils/helpers.ts +0 -139
- package/src/session/utils/types.ts +0 -57
- package/src/session/utils/usage.ts +0 -32
- package/src/session/workspace-manager.ts +0 -98
- package/src/session/workspace-manifest.ts +0 -100
- package/src/storage/artifact-store.ts +0 -1
- package/src/storage/file-team-store.ts +0 -257
- package/src/storage/index.ts +0 -11
- package/src/storage/provider-settings-legacy-migration.test.ts +0 -307
- package/src/storage/provider-settings-legacy-migration.ts +0 -689
- package/src/storage/provider-settings-manager.test.ts +0 -145
- package/src/storage/provider-settings-manager.ts +0 -150
- package/src/storage/session-store.ts +0 -1
- package/src/storage/sqlite-session-store.ts +0 -275
- package/src/storage/sqlite-team-store.ts +0 -454
- package/src/storage/team-store.ts +0 -40
- package/src/team/index.ts +0 -4
- package/src/team/projections.ts +0 -285
- package/src/telemetry/ITelemetryAdapter.ts +0 -94
- package/src/telemetry/LoggerTelemetryAdapter.test.ts +0 -42
- package/src/telemetry/LoggerTelemetryAdapter.ts +0 -114
- package/src/telemetry/OpenTelemetryAdapter.test.ts +0 -157
- package/src/telemetry/OpenTelemetryAdapter.ts +0 -348
- package/src/telemetry/OpenTelemetryProvider.test.ts +0 -113
- package/src/telemetry/OpenTelemetryProvider.ts +0 -322
- package/src/telemetry/TelemetryService.test.ts +0 -134
- package/src/telemetry/TelemetryService.ts +0 -141
- package/src/telemetry/core-events.ts +0 -344
- package/src/telemetry/opentelemetry.ts +0 -20
- package/src/tools/constants.ts +0 -35
- package/src/tools/definitions.test.ts +0 -658
- package/src/tools/definitions.ts +0 -726
- package/src/tools/executors/apply-patch-parser.ts +0 -520
- package/src/tools/executors/apply-patch.ts +0 -359
- package/src/tools/executors/bash.ts +0 -205
- package/src/tools/executors/editor.test.ts +0 -35
- package/src/tools/executors/editor.ts +0 -219
- package/src/tools/executors/file-read.test.ts +0 -49
- package/src/tools/executors/file-read.ts +0 -110
- package/src/tools/executors/index.ts +0 -75
- package/src/tools/executors/search.ts +0 -278
- package/src/tools/executors/web-fetch.ts +0 -259
- package/src/tools/index.ts +0 -168
- package/src/tools/model-tool-routing.test.ts +0 -86
- package/src/tools/model-tool-routing.ts +0 -132
- package/src/tools/presets.test.ts +0 -62
- package/src/tools/presets.ts +0 -168
- package/src/tools/schemas.ts +0 -284
- package/src/tools/types.ts +0 -328
- package/src/types/common.ts +0 -14
- package/src/types/config.ts +0 -84
- package/src/types/events.ts +0 -74
- package/src/types/index.ts +0 -24
- package/src/types/provider-settings.ts +0 -43
- package/src/types/sessions.ts +0 -16
- package/src/types/storage.ts +0 -64
- package/src/types/workspace.ts +0 -7
- package/src/types.ts +0 -128
package/src/runtime/index.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
type AvailableRuntimeCommand,
|
|
3
|
-
listAvailableRuntimeCommandsFromWatcher,
|
|
4
|
-
resolveRuntimeSlashCommandFromWatcher,
|
|
5
|
-
} from "./commands";
|
|
6
|
-
export {
|
|
7
|
-
formatRulesForSystemPrompt,
|
|
8
|
-
isRuleEnabled,
|
|
9
|
-
listEnabledRulesFromWatcher,
|
|
10
|
-
loadRulesForSystemPromptFromWatcher,
|
|
11
|
-
} from "./rules";
|
|
12
|
-
export { createTeamName, DefaultRuntimeBuilder } from "./runtime-builder";
|
|
13
|
-
export {
|
|
14
|
-
type SandboxCallOptions,
|
|
15
|
-
SubprocessSandbox,
|
|
16
|
-
type SubprocessSandboxOptions,
|
|
17
|
-
} from "./sandbox/subprocess-sandbox";
|
|
18
|
-
export type {
|
|
19
|
-
BuiltRuntime,
|
|
20
|
-
RuntimeBuilder,
|
|
21
|
-
RuntimeBuilderInput,
|
|
22
|
-
SessionRuntime,
|
|
23
|
-
} from "./session-runtime";
|
|
24
|
-
export {
|
|
25
|
-
type AvailableSkill,
|
|
26
|
-
listAvailableSkillsFromWatcher,
|
|
27
|
-
resolveSkillsSlashCommandFromWatcher,
|
|
28
|
-
} from "./skills";
|
|
29
|
-
export {
|
|
30
|
-
type DesktopToolApprovalOptions,
|
|
31
|
-
requestDesktopToolApproval,
|
|
32
|
-
} from "./tool-approval";
|
|
33
|
-
export {
|
|
34
|
-
type AvailableWorkflow,
|
|
35
|
-
listAvailableWorkflowsFromWatcher,
|
|
36
|
-
resolveWorkflowSlashCommandFromWatcher,
|
|
37
|
-
} from "./workflows";
|
package/src/runtime/rules.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { RuleConfig, UserInstructionConfigWatcher } from "../agents";
|
|
2
|
-
|
|
3
|
-
export function isRuleEnabled(rule: RuleConfig): boolean {
|
|
4
|
-
return rule.disabled !== true;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function formatRulesForSystemPrompt(
|
|
8
|
-
rules: ReadonlyArray<RuleConfig>,
|
|
9
|
-
): string {
|
|
10
|
-
if (rules.length === 0) {
|
|
11
|
-
return "";
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const renderedRules = rules
|
|
15
|
-
.map((rule) => `## ${rule.name}\n${rule.instructions}`)
|
|
16
|
-
.join("\n\n");
|
|
17
|
-
return `\n\n# Rules\n${renderedRules}`;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function listEnabledRulesFromWatcher(
|
|
21
|
-
watcher: UserInstructionConfigWatcher,
|
|
22
|
-
): RuleConfig[] {
|
|
23
|
-
const snapshot = watcher.getSnapshot("rule");
|
|
24
|
-
return [...snapshot.values()]
|
|
25
|
-
.map((record) => record.item as RuleConfig)
|
|
26
|
-
.filter(isRuleEnabled)
|
|
27
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function loadRulesForSystemPromptFromWatcher(
|
|
31
|
-
watcher: UserInstructionConfigWatcher,
|
|
32
|
-
): string {
|
|
33
|
-
return formatRulesForSystemPrompt(listEnabledRulesFromWatcher(watcher));
|
|
34
|
-
}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from "vitest";
|
|
2
|
-
|
|
3
|
-
const createBuiltinToolsMock = vi.fn(() => []);
|
|
4
|
-
const bootstrapAgentTeamsMock = vi.fn(() => ({
|
|
5
|
-
tools: [],
|
|
6
|
-
restoredFromPersistence: true,
|
|
7
|
-
restoredTeammates: ["restored-1"],
|
|
8
|
-
}));
|
|
9
|
-
|
|
10
|
-
let runtimeInstance: MockAgentTeamsRuntime | undefined;
|
|
11
|
-
class MockAgentTeamsRuntime {
|
|
12
|
-
private readonly onTeamEvent?: (event: any) => void;
|
|
13
|
-
|
|
14
|
-
constructor(options: { onTeamEvent?: (event: any) => void }) {
|
|
15
|
-
this.onTeamEvent = options.onTeamEvent;
|
|
16
|
-
runtimeInstance = this;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
emit(event: any): void {
|
|
20
|
-
this.onTeamEvent?.(event);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
hydrateState = vi.fn();
|
|
24
|
-
exportState = vi.fn(() => ({
|
|
25
|
-
members: [],
|
|
26
|
-
tasks: [],
|
|
27
|
-
mailbox: [],
|
|
28
|
-
missionLog: [],
|
|
29
|
-
runs: [],
|
|
30
|
-
outcomes: [],
|
|
31
|
-
outcomeFragments: [],
|
|
32
|
-
}));
|
|
33
|
-
markStaleRunsInterrupted = vi.fn();
|
|
34
|
-
getTeammateIds = vi.fn(() => []);
|
|
35
|
-
shutdownTeammate = vi.fn();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
vi.mock("@clinebot/agents", () => ({
|
|
39
|
-
AgentTeamsRuntime: MockAgentTeamsRuntime,
|
|
40
|
-
bootstrapAgentTeams: bootstrapAgentTeamsMock,
|
|
41
|
-
}));
|
|
42
|
-
|
|
43
|
-
vi.mock("../default-tools", () => ({
|
|
44
|
-
ALL_DEFAULT_TOOL_NAMES: [],
|
|
45
|
-
createBuiltinTools: createBuiltinToolsMock,
|
|
46
|
-
ToolPresets: {
|
|
47
|
-
development: {},
|
|
48
|
-
readonly: {},
|
|
49
|
-
},
|
|
50
|
-
}));
|
|
51
|
-
|
|
52
|
-
let teamStoreInstance: MockTeamStore | undefined;
|
|
53
|
-
class MockTeamStore {
|
|
54
|
-
constructor() {
|
|
55
|
-
teamStoreInstance = this;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
loadRuntime = vi.fn(() => ({
|
|
59
|
-
state: {
|
|
60
|
-
teamId: "team_1",
|
|
61
|
-
teamName: "test",
|
|
62
|
-
members: [],
|
|
63
|
-
tasks: [],
|
|
64
|
-
mailbox: [],
|
|
65
|
-
missionLog: [],
|
|
66
|
-
runs: [],
|
|
67
|
-
outcomes: [],
|
|
68
|
-
outcomeFragments: [],
|
|
69
|
-
},
|
|
70
|
-
teammates: [
|
|
71
|
-
{
|
|
72
|
-
agentId: "restored-1",
|
|
73
|
-
rolePrompt: "Persisted teammate",
|
|
74
|
-
modelId: "claude-sonnet-4-5-20250929",
|
|
75
|
-
maxIterations: 4,
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
interruptedRunIds: ["run_00001"],
|
|
79
|
-
}));
|
|
80
|
-
handleTeamEvent = vi.fn();
|
|
81
|
-
persistRuntime = vi.fn();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
vi.mock("../storage/team-store", () => ({
|
|
85
|
-
createLocalTeamStore: () => new MockTeamStore(),
|
|
86
|
-
}));
|
|
87
|
-
|
|
88
|
-
describe("DefaultRuntimeBuilder team persistence boundary", () => {
|
|
89
|
-
it("persists teammate specs and runtime state from team events", async () => {
|
|
90
|
-
const { DefaultRuntimeBuilder } = await import("./runtime-builder");
|
|
91
|
-
const onTeamRestored = vi.fn();
|
|
92
|
-
|
|
93
|
-
new DefaultRuntimeBuilder().build({
|
|
94
|
-
config: {
|
|
95
|
-
providerId: "anthropic",
|
|
96
|
-
modelId: "claude-sonnet-4-6",
|
|
97
|
-
apiKey: "key",
|
|
98
|
-
headers: {
|
|
99
|
-
Authorization: "Bearer team-token",
|
|
100
|
-
},
|
|
101
|
-
systemPrompt: "test",
|
|
102
|
-
cwd: process.cwd(),
|
|
103
|
-
enableTools: false,
|
|
104
|
-
enableSpawnAgent: false,
|
|
105
|
-
enableAgentTeams: true,
|
|
106
|
-
},
|
|
107
|
-
onTeamRestored,
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
expect(bootstrapAgentTeamsMock).toHaveBeenCalledWith(
|
|
111
|
-
expect.objectContaining({
|
|
112
|
-
restoredFromPersistence: true,
|
|
113
|
-
restoredTeammates: [expect.objectContaining({ agentId: "restored-1" })],
|
|
114
|
-
teammateRuntime: expect.objectContaining({
|
|
115
|
-
headers: {
|
|
116
|
-
Authorization: "Bearer team-token",
|
|
117
|
-
},
|
|
118
|
-
}),
|
|
119
|
-
}),
|
|
120
|
-
);
|
|
121
|
-
expect(onTeamRestored).toHaveBeenCalledTimes(1);
|
|
122
|
-
expect(runtimeInstance).toBeDefined();
|
|
123
|
-
expect(teamStoreInstance).toBeDefined();
|
|
124
|
-
if (!runtimeInstance || !teamStoreInstance) {
|
|
125
|
-
throw new Error("Expected mocked runtime and team store instances");
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
expect(runtimeInstance.markStaleRunsInterrupted).toHaveBeenCalledWith(
|
|
129
|
-
"runtime_recovered",
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
runtimeInstance.emit({
|
|
133
|
-
type: "teammate_spawned",
|
|
134
|
-
agentId: "python-poet",
|
|
135
|
-
teammate: {
|
|
136
|
-
rolePrompt: "Write concise Python-focused haiku",
|
|
137
|
-
modelId: "claude-sonnet-4-5-20250929",
|
|
138
|
-
maxIterations: 7,
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
expect(teamStoreInstance.handleTeamEvent).toHaveBeenCalledWith(
|
|
142
|
-
expect.any(String),
|
|
143
|
-
expect.objectContaining({
|
|
144
|
-
type: "teammate_spawned",
|
|
145
|
-
agentId: "python-poet",
|
|
146
|
-
}),
|
|
147
|
-
);
|
|
148
|
-
expect(teamStoreInstance.persistRuntime).toHaveBeenCalled();
|
|
149
|
-
|
|
150
|
-
runtimeInstance.emit({
|
|
151
|
-
type: "teammate_shutdown",
|
|
152
|
-
agentId: "python-poet",
|
|
153
|
-
});
|
|
154
|
-
expect(teamStoreInstance.handleTeamEvent).toHaveBeenCalledWith(
|
|
155
|
-
expect.any(String),
|
|
156
|
-
expect.objectContaining({
|
|
157
|
-
type: "teammate_shutdown",
|
|
158
|
-
agentId: "python-poet",
|
|
159
|
-
}),
|
|
160
|
-
);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it("forwards cline workspace metadata to teammate runtime bootstrap config", async () => {
|
|
164
|
-
const { DefaultRuntimeBuilder } = await import("./runtime-builder");
|
|
165
|
-
bootstrapAgentTeamsMock.mockClear();
|
|
166
|
-
|
|
167
|
-
new DefaultRuntimeBuilder().build({
|
|
168
|
-
config: {
|
|
169
|
-
providerId: "cline",
|
|
170
|
-
modelId: "anthropic/claude-sonnet-4.6",
|
|
171
|
-
apiKey: "key",
|
|
172
|
-
systemPrompt: `Base instructions.
|
|
173
|
-
|
|
174
|
-
# Workspace Configuration
|
|
175
|
-
{
|
|
176
|
-
"workspaces": {
|
|
177
|
-
"/repo/demo": {
|
|
178
|
-
"hint": "demo",
|
|
179
|
-
"latestGitBranchName": "main"
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}`,
|
|
183
|
-
cwd: "/repo/demo",
|
|
184
|
-
enableTools: false,
|
|
185
|
-
enableSpawnAgent: false,
|
|
186
|
-
enableAgentTeams: true,
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
expect(bootstrapAgentTeamsMock).toHaveBeenCalledWith(
|
|
191
|
-
expect.objectContaining({
|
|
192
|
-
teammateRuntime: expect.objectContaining({
|
|
193
|
-
providerId: "cline",
|
|
194
|
-
cwd: "/repo/demo",
|
|
195
|
-
clineWorkspaceMetadata: expect.stringContaining(
|
|
196
|
-
"# Workspace Configuration",
|
|
197
|
-
),
|
|
198
|
-
}),
|
|
199
|
-
}),
|
|
200
|
-
);
|
|
201
|
-
});
|
|
202
|
-
});
|
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { tmpdir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import type { Tool } from "@clinebot/agents";
|
|
5
|
-
import { describe, expect, it } from "vitest";
|
|
6
|
-
import { TelemetryService } from "../telemetry/TelemetryService";
|
|
7
|
-
import { DefaultRuntimeBuilder } from "./runtime-builder";
|
|
8
|
-
|
|
9
|
-
function makeSpawnTool(): Tool {
|
|
10
|
-
return {
|
|
11
|
-
name: "spawn_agent",
|
|
12
|
-
description: "Spawn a subagent",
|
|
13
|
-
inputSchema: { type: "object", properties: {}, required: [] },
|
|
14
|
-
execute: async () => ({ ok: true }),
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
describe("DefaultRuntimeBuilder", () => {
|
|
19
|
-
it("includes builtin tools when enabled", () => {
|
|
20
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
21
|
-
config: {
|
|
22
|
-
providerId: "anthropic",
|
|
23
|
-
modelId: "claude-sonnet-4-6",
|
|
24
|
-
apiKey: "key",
|
|
25
|
-
systemPrompt: "test",
|
|
26
|
-
cwd: process.cwd(),
|
|
27
|
-
enableTools: true,
|
|
28
|
-
enableSpawnAgent: false,
|
|
29
|
-
enableAgentTeams: false,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const names = runtime.tools.map((tool) => tool.name);
|
|
34
|
-
expect(names.length).toBeGreaterThan(0);
|
|
35
|
-
expect(names).not.toContain("spawn_agent");
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("forwards runtime logger for downstream agent creation", () => {
|
|
39
|
-
const logger = {
|
|
40
|
-
info: () => {},
|
|
41
|
-
};
|
|
42
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
43
|
-
config: {
|
|
44
|
-
providerId: "anthropic",
|
|
45
|
-
modelId: "claude-sonnet-4-6",
|
|
46
|
-
apiKey: "key",
|
|
47
|
-
systemPrompt: "test",
|
|
48
|
-
cwd: process.cwd(),
|
|
49
|
-
enableTools: false,
|
|
50
|
-
enableSpawnAgent: false,
|
|
51
|
-
enableAgentTeams: false,
|
|
52
|
-
logger,
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
expect(runtime.logger).toBe(logger);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("forwards telemetry for downstream runtime consumers", () => {
|
|
60
|
-
const telemetry = new TelemetryService();
|
|
61
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
62
|
-
config: {
|
|
63
|
-
providerId: "anthropic",
|
|
64
|
-
modelId: "claude-sonnet-4-6",
|
|
65
|
-
apiKey: "key",
|
|
66
|
-
systemPrompt: "test",
|
|
67
|
-
cwd: process.cwd(),
|
|
68
|
-
enableTools: false,
|
|
69
|
-
enableSpawnAgent: false,
|
|
70
|
-
enableAgentTeams: false,
|
|
71
|
-
telemetry,
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
expect(runtime.telemetry).toBe(telemetry);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it("uses readonly preset in plan mode", () => {
|
|
79
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
80
|
-
config: {
|
|
81
|
-
providerId: "anthropic",
|
|
82
|
-
modelId: "claude-sonnet-4-6",
|
|
83
|
-
apiKey: "key",
|
|
84
|
-
systemPrompt: "test",
|
|
85
|
-
cwd: process.cwd(),
|
|
86
|
-
mode: "plan",
|
|
87
|
-
enableTools: true,
|
|
88
|
-
enableSpawnAgent: false,
|
|
89
|
-
enableAgentTeams: false,
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const names = runtime.tools.map((tool) => tool.name);
|
|
94
|
-
expect(names).not.toContain("editor");
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("uses apply_patch instead of editor for codex/gpt model IDs in act mode", () => {
|
|
98
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
99
|
-
config: {
|
|
100
|
-
providerId: "openai",
|
|
101
|
-
modelId: "openai/gpt-5.4",
|
|
102
|
-
apiKey: "key",
|
|
103
|
-
systemPrompt: "test",
|
|
104
|
-
cwd: process.cwd(),
|
|
105
|
-
mode: "act",
|
|
106
|
-
enableTools: true,
|
|
107
|
-
enableSpawnAgent: false,
|
|
108
|
-
enableAgentTeams: false,
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
const names = runtime.tools.map((tool) => tool.name);
|
|
113
|
-
expect(names).toContain("apply_patch");
|
|
114
|
-
expect(names).not.toContain("editor");
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it("keeps editor for non-codex/non-gpt model IDs in act mode", () => {
|
|
118
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
119
|
-
config: {
|
|
120
|
-
providerId: "anthropic",
|
|
121
|
-
modelId: "claude-sonnet-4-6",
|
|
122
|
-
apiKey: "key",
|
|
123
|
-
systemPrompt: "test",
|
|
124
|
-
cwd: process.cwd(),
|
|
125
|
-
mode: "act",
|
|
126
|
-
enableTools: true,
|
|
127
|
-
enableSpawnAgent: false,
|
|
128
|
-
enableAgentTeams: false,
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
const names = runtime.tools.map((tool) => tool.name);
|
|
133
|
-
expect(names).toContain("editor");
|
|
134
|
-
expect(names).not.toContain("apply_patch");
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it("applies custom tool routing rules from session config", () => {
|
|
138
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
139
|
-
config: {
|
|
140
|
-
providerId: "anthropic",
|
|
141
|
-
modelId: "claude-sonnet-4-6",
|
|
142
|
-
apiKey: "key",
|
|
143
|
-
systemPrompt: "test",
|
|
144
|
-
cwd: process.cwd(),
|
|
145
|
-
mode: "act",
|
|
146
|
-
enableTools: true,
|
|
147
|
-
enableSpawnAgent: false,
|
|
148
|
-
enableAgentTeams: false,
|
|
149
|
-
toolRoutingRules: [
|
|
150
|
-
{
|
|
151
|
-
mode: "act",
|
|
152
|
-
providerIdIncludes: ["anthropic"],
|
|
153
|
-
modelIdIncludes: ["claude"],
|
|
154
|
-
enableTools: ["apply_patch"],
|
|
155
|
-
disableTools: ["editor"],
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
const names = runtime.tools.map((tool) => tool.name);
|
|
162
|
-
expect(names).toContain("apply_patch");
|
|
163
|
-
expect(names).not.toContain("editor");
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it("omits builtin tools when disabled", () => {
|
|
167
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
168
|
-
config: {
|
|
169
|
-
providerId: "anthropic",
|
|
170
|
-
modelId: "claude-sonnet-4-6",
|
|
171
|
-
apiKey: "key",
|
|
172
|
-
systemPrompt: "test",
|
|
173
|
-
cwd: process.cwd(),
|
|
174
|
-
enableTools: false,
|
|
175
|
-
enableSpawnAgent: false,
|
|
176
|
-
enableAgentTeams: false,
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
expect(runtime.tools).toEqual([]);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it("adds spawn tool when enabled", () => {
|
|
184
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
185
|
-
config: {
|
|
186
|
-
providerId: "anthropic",
|
|
187
|
-
modelId: "claude-sonnet-4-6",
|
|
188
|
-
apiKey: "key",
|
|
189
|
-
systemPrompt: "test",
|
|
190
|
-
cwd: process.cwd(),
|
|
191
|
-
enableTools: false,
|
|
192
|
-
enableSpawnAgent: true,
|
|
193
|
-
enableAgentTeams: false,
|
|
194
|
-
},
|
|
195
|
-
createSpawnTool: makeSpawnTool,
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
expect(runtime.tools.map((tool) => tool.name)).toContain("spawn_agent");
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it("provides a shutdown helper", () => {
|
|
202
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
203
|
-
config: {
|
|
204
|
-
providerId: "anthropic",
|
|
205
|
-
modelId: "claude-sonnet-4-6",
|
|
206
|
-
apiKey: "key",
|
|
207
|
-
systemPrompt: "test",
|
|
208
|
-
cwd: process.cwd(),
|
|
209
|
-
enableTools: false,
|
|
210
|
-
enableSpawnAgent: false,
|
|
211
|
-
enableAgentTeams: false,
|
|
212
|
-
},
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
expect(() => runtime.shutdown("test")).not.toThrow();
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
it("includes skills tool when workspace skills are available", () => {
|
|
219
|
-
const cwd = mkdtempSync(join(tmpdir(), "runtime-builder-skills-"));
|
|
220
|
-
const skillDir = join(cwd, ".cline", "skills", "commit");
|
|
221
|
-
mkdirSync(skillDir, { recursive: true });
|
|
222
|
-
writeFileSync(
|
|
223
|
-
join(skillDir, "SKILL.md"),
|
|
224
|
-
`---
|
|
225
|
-
name: commit
|
|
226
|
-
description: Create commit message
|
|
227
|
-
---
|
|
228
|
-
Use conventional commits.`,
|
|
229
|
-
"utf8",
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
233
|
-
config: {
|
|
234
|
-
providerId: "anthropic",
|
|
235
|
-
modelId: "claude-sonnet-4-6",
|
|
236
|
-
apiKey: "key",
|
|
237
|
-
systemPrompt: "test",
|
|
238
|
-
cwd,
|
|
239
|
-
enableTools: true,
|
|
240
|
-
enableSpawnAgent: false,
|
|
241
|
-
enableAgentTeams: false,
|
|
242
|
-
},
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
expect(runtime.tools.map((tool) => tool.name)).toContain("skills");
|
|
246
|
-
runtime.shutdown("test");
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
it("marks configured but disabled skills in executor metadata", async () => {
|
|
250
|
-
const cwd = mkdtempSync(join(tmpdir(), "runtime-builder-skills-disabled-"));
|
|
251
|
-
const enabledDir = join(cwd, ".cline", "skills", "commit");
|
|
252
|
-
const disabledDir = join(cwd, ".cline", "skills", "review");
|
|
253
|
-
mkdirSync(enabledDir, { recursive: true });
|
|
254
|
-
mkdirSync(disabledDir, { recursive: true });
|
|
255
|
-
writeFileSync(
|
|
256
|
-
join(enabledDir, "SKILL.md"),
|
|
257
|
-
`---
|
|
258
|
-
name: commit
|
|
259
|
-
---
|
|
260
|
-
Enabled skill.`,
|
|
261
|
-
"utf8",
|
|
262
|
-
);
|
|
263
|
-
writeFileSync(
|
|
264
|
-
join(disabledDir, "SKILL.md"),
|
|
265
|
-
`---
|
|
266
|
-
name: review
|
|
267
|
-
disabled: true
|
|
268
|
-
---
|
|
269
|
-
Disabled skill.`,
|
|
270
|
-
"utf8",
|
|
271
|
-
);
|
|
272
|
-
|
|
273
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
274
|
-
config: {
|
|
275
|
-
providerId: "anthropic",
|
|
276
|
-
modelId: "claude-sonnet-4-6",
|
|
277
|
-
apiKey: "key",
|
|
278
|
-
systemPrompt: "test",
|
|
279
|
-
cwd,
|
|
280
|
-
enableTools: true,
|
|
281
|
-
enableSpawnAgent: false,
|
|
282
|
-
enableAgentTeams: false,
|
|
283
|
-
},
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
const skillsTool = runtime.tools.find((tool) => tool.name === "skills");
|
|
287
|
-
expect(skillsTool).toBeDefined();
|
|
288
|
-
if (!skillsTool) {
|
|
289
|
-
throw new Error("Expected skills tool.");
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
const disabledResult = await skillsTool.execute(
|
|
293
|
-
{ skill: "review" },
|
|
294
|
-
{
|
|
295
|
-
agentId: "agent-1",
|
|
296
|
-
conversationId: "conv-1",
|
|
297
|
-
iteration: 1,
|
|
298
|
-
},
|
|
299
|
-
);
|
|
300
|
-
expect(disabledResult).toContain("configured but disabled");
|
|
301
|
-
|
|
302
|
-
runtime.shutdown("test");
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
it("scopes skills tool to session-configured skills", async () => {
|
|
306
|
-
const cwd = mkdtempSync(join(tmpdir(), "runtime-builder-skills-scoped-"));
|
|
307
|
-
const commitDir = join(cwd, ".cline", "skills", "commit");
|
|
308
|
-
const reviewDir = join(cwd, ".cline", "skills", "review");
|
|
309
|
-
mkdirSync(commitDir, { recursive: true });
|
|
310
|
-
mkdirSync(reviewDir, { recursive: true });
|
|
311
|
-
writeFileSync(
|
|
312
|
-
join(commitDir, "SKILL.md"),
|
|
313
|
-
`---
|
|
314
|
-
name: commit
|
|
315
|
-
---
|
|
316
|
-
Commit skill.`,
|
|
317
|
-
"utf8",
|
|
318
|
-
);
|
|
319
|
-
writeFileSync(
|
|
320
|
-
join(reviewDir, "SKILL.md"),
|
|
321
|
-
`---
|
|
322
|
-
name: review
|
|
323
|
-
---
|
|
324
|
-
Review skill.`,
|
|
325
|
-
"utf8",
|
|
326
|
-
);
|
|
327
|
-
|
|
328
|
-
const runtime = new DefaultRuntimeBuilder().build({
|
|
329
|
-
config: {
|
|
330
|
-
providerId: "anthropic",
|
|
331
|
-
modelId: "claude-sonnet-4-6",
|
|
332
|
-
apiKey: "key",
|
|
333
|
-
systemPrompt: "test",
|
|
334
|
-
cwd,
|
|
335
|
-
enableTools: true,
|
|
336
|
-
enableSpawnAgent: false,
|
|
337
|
-
enableAgentTeams: false,
|
|
338
|
-
skills: ["commit"],
|
|
339
|
-
},
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
const skillsTool = runtime.tools.find((tool) => tool.name === "skills");
|
|
343
|
-
expect(skillsTool).toBeDefined();
|
|
344
|
-
if (!skillsTool) {
|
|
345
|
-
throw new Error("Expected skills tool.");
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
const known = await skillsTool.execute(
|
|
349
|
-
{ skill: "commit" },
|
|
350
|
-
{
|
|
351
|
-
agentId: "agent-1",
|
|
352
|
-
conversationId: "conv-1",
|
|
353
|
-
iteration: 1,
|
|
354
|
-
},
|
|
355
|
-
);
|
|
356
|
-
expect(known).toContain("<command-name>commit</command-name>");
|
|
357
|
-
|
|
358
|
-
const blocked = await skillsTool.execute(
|
|
359
|
-
{ skill: "review" },
|
|
360
|
-
{
|
|
361
|
-
agentId: "agent-1",
|
|
362
|
-
conversationId: "conv-1",
|
|
363
|
-
iteration: 1,
|
|
364
|
-
},
|
|
365
|
-
);
|
|
366
|
-
expect(blocked).toContain('Skill "review" not found.');
|
|
367
|
-
expect(blocked).toContain("Available skills: commit");
|
|
368
|
-
|
|
369
|
-
runtime.shutdown("test");
|
|
370
|
-
});
|
|
371
|
-
});
|