aws-runtime-bridge 1.9.33 → 1.9.40
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/adapter/AcodeSdkAdapter.d.ts +35 -1
- package/dist/adapter/AcodeSdkAdapter.d.ts.map +1 -1
- package/dist/adapter/AcodeSdkAdapter.js +417 -40
- package/dist/adapter/ClaudeSdkAdapter.d.ts +6 -0
- package/dist/adapter/ClaudeSdkAdapter.d.ts.map +1 -1
- package/dist/adapter/ClaudeSdkAdapter.js +23 -1
- package/dist/adapter/idle-poll-loop.d.ts +2 -1
- package/dist/adapter/idle-poll-loop.d.ts.map +1 -1
- package/dist/adapter/types.d.ts +65 -3
- package/dist/adapter/types.d.ts.map +1 -1
- package/dist/adapter/types.js +5 -4
- package/dist/index.js +4 -0
- package/dist/routes/acode-todos.d.ts +11 -0
- package/dist/routes/acode-todos.d.ts.map +1 -0
- package/dist/routes/acode-todos.js +75 -0
- package/dist/routes/memory.d.ts +1 -1
- package/dist/routes/memory.d.ts.map +1 -1
- package/dist/routes/memory.js +3 -3
- package/dist/routes/pty.d.ts.map +1 -1
- package/dist/routes/pty.js +9 -0
- package/dist/routes/sub-agents.d.ts +14 -0
- package/dist/routes/sub-agents.d.ts.map +1 -0
- package/dist/routes/sub-agents.js +253 -0
- package/dist/routes/terminal.d.ts +9 -1
- package/dist/routes/terminal.d.ts.map +1 -1
- package/dist/routes/terminal.js +207 -22
- package/dist/services/agent-event-store.d.ts +1 -0
- package/dist/services/agent-event-store.d.ts.map +1 -1
- package/dist/services/event-delta-pusher.js +4 -4
- package/dist/services/session-output.d.ts +3 -0
- package/dist/services/session-output.d.ts.map +1 -1
- package/dist/services/session-output.js +38 -2
- package/dist/services/sub-agent-manager-instance.d.ts +4 -0
- package/dist/services/sub-agent-manager-instance.d.ts.map +1 -0
- package/dist/services/sub-agent-manager-instance.js +12 -0
- package/dist/services/workspace-files.d.ts +1 -0
- package/dist/services/workspace-files.d.ts.map +1 -1
- package/dist/services/workspace-files.js +57 -1
- package/package/acode/dist/ask-user-question-tool.d.ts +47 -0
- package/package/acode/dist/ask-user-question-tool.d.ts.map +1 -0
- package/package/acode/dist/ask-user-question-tool.js +233 -0
- package/package/acode/dist/built-in-file-tools.d.ts +2 -0
- package/package/acode/dist/built-in-file-tools.d.ts.map +1 -1
- package/package/acode/dist/compaction.d.ts +206 -0
- package/package/acode/dist/compaction.d.ts.map +1 -0
- package/package/acode/dist/compaction.js +664 -0
- package/package/acode/dist/config.d.ts +6 -1
- package/package/acode/dist/config.d.ts.map +1 -1
- package/package/acode/dist/config.js +27 -2
- package/package/acode/dist/index.d.ts +4 -0
- package/package/acode/dist/index.d.ts.map +1 -1
- package/package/acode/dist/index.js +4 -0
- package/package/acode/dist/runtime.d.ts +137 -0
- package/package/acode/dist/runtime.d.ts.map +1 -1
- package/package/acode/dist/runtime.js +974 -172
- package/package/acode/dist/skill-tool.d.ts +30 -0
- package/package/acode/dist/skill-tool.d.ts.map +1 -0
- package/package/acode/dist/skill-tool.js +174 -0
- package/package/acode/dist/sub-agent-manager.d.ts +169 -0
- package/package/acode/dist/sub-agent-manager.d.ts.map +1 -0
- package/package/acode/dist/sub-agent-manager.js +535 -0
- package/package/acode/dist/sub-agent-store.d.ts +33 -0
- package/package/acode/dist/sub-agent-store.d.ts.map +1 -0
- package/package/acode/dist/sub-agent-store.js +109 -0
- package/package/acode/dist/sub-agent-tools.d.ts +72 -0
- package/package/acode/dist/sub-agent-tools.d.ts.map +1 -0
- package/package/acode/dist/sub-agent-tools.js +429 -0
- package/package/acode/dist/sub-agent-types.d.ts +81 -0
- package/package/acode/dist/sub-agent-types.d.ts.map +1 -0
- package/package/acode/dist/sub-agent-types.js +8 -0
- package/package/acode/dist/todo-store.d.ts +42 -0
- package/package/acode/dist/todo-store.d.ts.map +1 -0
- package/package/acode/dist/todo-store.js +68 -0
- package/package/acode/dist/todo-tool.d.ts +6 -0
- package/package/acode/dist/todo-tool.d.ts.map +1 -0
- package/package/acode/dist/todo-tool.js +138 -0
- package/package/acode/dist/types.d.ts +22 -1
- package/package/acode/dist/types.d.ts.map +1 -1
- package/package/acode/package.json +13 -2
- package/package/aws-client-agent-mcp/dist/context-manager.test.js +0 -3
- package/package/aws-client-agent-mcp/dist/context-manager.test.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.d.ts +83 -50
- package/package/aws-client-agent-mcp/dist/mcp-server.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.js +451 -346
- package/package/aws-client-agent-mcp/dist/mcp-server.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.test.js +259 -241
- package/package/aws-client-agent-mcp/dist/mcp-server.test.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/mcp-tools.d.ts +1 -19
- package/package/aws-client-agent-mcp/dist/mcp-tools.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/mcp-tools.js +4 -77
- package/package/aws-client-agent-mcp/dist/mcp-tools.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/memory-store.d.ts +17 -40
- package/package/aws-client-agent-mcp/dist/memory-store.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/memory-store.js +62 -149
- package/package/aws-client-agent-mcp/dist/memory-store.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/memory-store.test.js +175 -164
- package/package/aws-client-agent-mcp/dist/memory-store.test.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/memory-tools.d.ts +3 -9
- package/package/aws-client-agent-mcp/dist/memory-tools.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/memory-tools.js +28 -55
- package/package/aws-client-agent-mcp/dist/memory-tools.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/message-buffer.d.ts +27 -9
- package/package/aws-client-agent-mcp/dist/message-buffer.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/message-buffer.js +100 -23
- package/package/aws-client-agent-mcp/dist/message-buffer.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/server-memory-store.d.ts +1 -14
- package/package/aws-client-agent-mcp/dist/server-memory-store.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/server-memory-store.js +7 -18
- package/package/aws-client-agent-mcp/dist/server-memory-store.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/status-reporter.d.ts.map +1 -1
- package/package/aws-client-agent-mcp/dist/status-reporter.js +8 -5
- package/package/aws-client-agent-mcp/dist/status-reporter.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/status-reporter.test.js +93 -0
- package/package/aws-client-agent-mcp/dist/status-reporter.test.js.map +1 -1
- package/package/aws-client-agent-mcp/dist/types.d.ts +3 -25
- package/package/aws-client-agent-mcp/dist/types.d.ts.map +1 -1
- package/package.json +17 -7
- package/dist/adapter/AcodeSdkAdapter.test.d.ts +0 -2
- package/dist/adapter/AcodeSdkAdapter.test.d.ts.map +0 -1
- package/dist/adapter/AcodeSdkAdapter.test.js +0 -2000
- package/dist/adapter/AdapterRegistry.test.d.ts +0 -5
- package/dist/adapter/AdapterRegistry.test.d.ts.map +0 -1
- package/dist/adapter/AdapterRegistry.test.js +0 -118
- package/dist/adapter/ClaudeSdkAdapter.test.d.ts +0 -2
- package/dist/adapter/ClaudeSdkAdapter.test.d.ts.map +0 -1
- package/dist/adapter/ClaudeSdkAdapter.test.js +0 -311
- package/dist/adapter/CodexSdkAdapter.test.d.ts +0 -2
- package/dist/adapter/CodexSdkAdapter.test.d.ts.map +0 -1
- package/dist/adapter/CodexSdkAdapter.test.js +0 -270
- package/dist/adapter/OpencodeSdkAdapter.test.d.ts +0 -2
- package/dist/adapter/OpencodeSdkAdapter.test.d.ts.map +0 -1
- package/dist/adapter/OpencodeSdkAdapter.test.js +0 -158
- package/dist/adapter/acode-tool-names.test.d.ts +0 -2
- package/dist/adapter/acode-tool-names.test.d.ts.map +0 -1
- package/dist/adapter/acode-tool-names.test.js +0 -28
- package/dist/adapter/adapter.test.d.ts +0 -5
- package/dist/adapter/adapter.test.d.ts.map +0 -1
- package/dist/adapter/adapter.test.js +0 -180
- package/dist/adapter/idle-poll-loop.test.d.ts +0 -2
- package/dist/adapter/idle-poll-loop.test.d.ts.map +0 -1
- package/dist/adapter/idle-poll-loop.test.js +0 -85
- package/dist/adapter/types.test.d.ts +0 -2
- package/dist/adapter/types.test.d.ts.map +0 -1
- package/dist/adapter/types.test.js +0 -50
- package/dist/adapters/cc-switch/mcp-acode.test.d.ts +0 -2
- package/dist/adapters/cc-switch/mcp-acode.test.d.ts.map +0 -1
- package/dist/adapters/cc-switch/mcp-acode.test.js +0 -80
- package/dist/adapters/cc-switch/mcp-claudecode.test.d.ts +0 -2
- package/dist/adapters/cc-switch/mcp-claudecode.test.d.ts.map +0 -1
- package/dist/adapters/cc-switch/mcp-claudecode.test.js +0 -75
- package/dist/adapters/cc-switch/mcp-codex.test.d.ts +0 -2
- package/dist/adapters/cc-switch/mcp-codex.test.d.ts.map +0 -1
- package/dist/adapters/cc-switch/mcp-codex.test.js +0 -126
- package/dist/adapters/cc-switch/mcp-opencode.test.d.ts +0 -2
- package/dist/adapters/cc-switch/mcp-opencode.test.d.ts.map +0 -1
- package/dist/adapters/cc-switch/mcp-opencode.test.js +0 -62
- package/dist/adapters/cc-switch/skill-directory.test.d.ts +0 -2
- package/dist/adapters/cc-switch/skill-directory.test.d.ts.map +0 -1
- package/dist/adapters/cc-switch/skill-directory.test.js +0 -74
- package/dist/config.test.d.ts +0 -2
- package/dist/config.test.d.ts.map +0 -1
- package/dist/config.test.js +0 -107
- package/dist/routes/ai-sources.test.d.ts +0 -2
- package/dist/routes/ai-sources.test.d.ts.map +0 -1
- package/dist/routes/ai-sources.test.js +0 -169
- package/dist/routes/file-browser.test.d.ts +0 -5
- package/dist/routes/file-browser.test.d.ts.map +0 -1
- package/dist/routes/file-browser.test.js +0 -155
- package/dist/routes/git.test.d.ts +0 -2
- package/dist/routes/git.test.d.ts.map +0 -1
- package/dist/routes/git.test.js +0 -330
- package/dist/routes/instance.test.d.ts +0 -5
- package/dist/routes/instance.test.d.ts.map +0 -1
- package/dist/routes/instance.test.js +0 -389
- package/dist/routes/mcp.test.d.ts +0 -5
- package/dist/routes/mcp.test.d.ts.map +0 -1
- package/dist/routes/mcp.test.js +0 -92
- package/dist/routes/memory-route-wiring.test.d.ts +0 -2
- package/dist/routes/memory-route-wiring.test.d.ts.map +0 -1
- package/dist/routes/memory-route-wiring.test.js +0 -15
- package/dist/routes/memory.test.d.ts +0 -2
- package/dist/routes/memory.test.d.ts.map +0 -1
- package/dist/routes/memory.test.js +0 -177
- package/dist/routes/properties.test.d.ts +0 -5
- package/dist/routes/properties.test.d.ts.map +0 -1
- package/dist/routes/properties.test.js +0 -72
- package/dist/routes/pty.test.d.ts +0 -2
- package/dist/routes/pty.test.d.ts.map +0 -1
- package/dist/routes/pty.test.js +0 -82
- package/dist/routes/runtime-binding.test.d.ts +0 -2
- package/dist/routes/runtime-binding.test.d.ts.map +0 -1
- package/dist/routes/runtime-binding.test.js +0 -32
- package/dist/routes/sessions.test.d.ts +0 -5
- package/dist/routes/sessions.test.d.ts.map +0 -1
- package/dist/routes/sessions.test.js +0 -86
- package/dist/routes/skills.test.d.ts +0 -5
- package/dist/routes/skills.test.d.ts.map +0 -1
- package/dist/routes/skills.test.js +0 -50
- package/dist/routes/system-metrics.test.d.ts +0 -2
- package/dist/routes/system-metrics.test.d.ts.map +0 -1
- package/dist/routes/system-metrics.test.js +0 -16
- package/dist/routes/terminal.stop-options.test.d.ts +0 -2
- package/dist/routes/terminal.stop-options.test.d.ts.map +0 -1
- package/dist/routes/terminal.stop-options.test.js +0 -39
- package/dist/routes/terminal.test.d.ts +0 -2
- package/dist/routes/terminal.test.d.ts.map +0 -1
- package/dist/routes/terminal.test.js +0 -746
- package/dist/routes/yml.test.d.ts +0 -5
- package/dist/routes/yml.test.d.ts.map +0 -1
- package/dist/routes/yml.test.js +0 -58
- package/dist/services/ai-source-apply.test.d.ts +0 -2
- package/dist/services/ai-source-apply.test.d.ts.map +0 -1
- package/dist/services/ai-source-apply.test.js +0 -138
- package/dist/services/auto-register.test.d.ts +0 -2
- package/dist/services/auto-register.test.d.ts.map +0 -1
- package/dist/services/auto-register.test.js +0 -184
- package/dist/services/aws-client-agent-mcp.test.d.ts +0 -2
- package/dist/services/aws-client-agent-mcp.test.d.ts.map +0 -1
- package/dist/services/aws-client-agent-mcp.test.js +0 -242
- package/dist/services/bridge-package-publish-hooks.test.d.ts +0 -2
- package/dist/services/bridge-package-publish-hooks.test.d.ts.map +0 -1
- package/dist/services/bridge-package-publish-hooks.test.js +0 -136
- package/dist/services/cc-switch-discovery.test.d.ts +0 -2
- package/dist/services/cc-switch-discovery.test.d.ts.map +0 -1
- package/dist/services/cc-switch-discovery.test.js +0 -56
- package/dist/services/cli-commands.test.d.ts +0 -2
- package/dist/services/cli-commands.test.d.ts.map +0 -1
- package/dist/services/cli-commands.test.js +0 -230
- package/dist/services/instance-init-service.test.d.ts +0 -2
- package/dist/services/instance-init-service.test.d.ts.map +0 -1
- package/dist/services/instance-init-service.test.js +0 -140
- package/dist/services/instance-state.test.d.ts +0 -2
- package/dist/services/instance-state.test.d.ts.map +0 -1
- package/dist/services/instance-state.test.js +0 -245
- package/dist/services/mcp-launch-binding-queue.test.d.ts +0 -2
- package/dist/services/mcp-launch-binding-queue.test.d.ts.map +0 -1
- package/dist/services/mcp-launch-binding-queue.test.js +0 -181
- package/dist/services/runtime-binding.test.d.ts +0 -2
- package/dist/services/runtime-binding.test.d.ts.map +0 -1
- package/dist/services/runtime-binding.test.js +0 -78
- package/dist/services/runtime-lifecycle-policy.test.d.ts +0 -2
- package/dist/services/runtime-lifecycle-policy.test.d.ts.map +0 -1
- package/dist/services/runtime-lifecycle-policy.test.js +0 -41
- package/dist/services/session-output.test.d.ts +0 -5
- package/dist/services/session-output.test.d.ts.map +0 -1
- package/dist/services/session-output.test.js +0 -177
- package/dist/services/startup-config-wizard.test.d.ts +0 -2
- package/dist/services/startup-config-wizard.test.d.ts.map +0 -1
- package/dist/services/startup-config-wizard.test.js +0 -184
- package/dist/services/terminal-persistence.test.d.ts +0 -5
- package/dist/services/terminal-persistence.test.d.ts.map +0 -1
- package/dist/services/terminal-persistence.test.js +0 -159
- package/dist/services/tool-installer.test.d.ts +0 -2
- package/dist/services/tool-installer.test.d.ts.map +0 -1
- package/dist/services/tool-installer.test.js +0 -225
- package/dist/services/workspace-files.test.d.ts +0 -2
- package/dist/services/workspace-files.test.d.ts.map +0 -1
- package/dist/services/workspace-files.test.js +0 -648
- package/dist/services/workspace-watch.test.d.ts +0 -2
- package/dist/services/workspace-watch.test.d.ts.map +0 -1
- package/dist/services/workspace-watch.test.js +0 -38
- package/dist/utils/file-utils.test.d.ts +0 -2
- package/dist/utils/file-utils.test.d.ts.map +0 -1
- package/dist/utils/file-utils.test.js +0 -244
- package/dist/utils/logger.test.d.ts +0 -2
- package/dist/utils/logger.test.d.ts.map +0 -1
- package/dist/utils/logger.test.js +0 -93
- package/dist/utils/sdk-package-loader.test.d.ts +0 -2
- package/dist/utils/sdk-package-loader.test.d.ts.map +0 -1
- package/dist/utils/sdk-package-loader.test.js +0 -84
- package/dist/utils/validation.test.d.ts +0 -2
- package/dist/utils/validation.test.d.ts.map +0 -1
- package/dist/utils/validation.test.js +0 -88
- package/dist/utils/yaml-utils.test.d.ts +0 -2
- package/dist/utils/yaml-utils.test.d.ts.map +0 -1
- package/dist/utils/yaml-utils.test.js +0 -363
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { IdlePollLoop } from './idle-poll-loop.js';
|
|
3
|
-
afterEach(() => {
|
|
4
|
-
vi.useRealTimers();
|
|
5
|
-
});
|
|
6
|
-
describe('IdlePollLoop', () => {
|
|
7
|
-
it('dispatches poll commands immediately when the session is waiting for input', async () => {
|
|
8
|
-
const dispatchPollingPrompt = vi.fn();
|
|
9
|
-
const loop = new IdlePollLoop({
|
|
10
|
-
getStatus: () => 'waiting_input',
|
|
11
|
-
getCommand: () => 'poll_message',
|
|
12
|
-
isPollingCommand: (command) => command.includes('poll_message'),
|
|
13
|
-
dispatchPollingPrompt,
|
|
14
|
-
dispatchRegularIdleCommand: vi.fn(),
|
|
15
|
-
});
|
|
16
|
-
loop.start();
|
|
17
|
-
expect(dispatchPollingPrompt).toHaveBeenCalledTimes(1);
|
|
18
|
-
expect(dispatchPollingPrompt).toHaveBeenCalledWith('poll_message');
|
|
19
|
-
});
|
|
20
|
-
it('supports an explicit poll command delay for compatibility', async () => {
|
|
21
|
-
vi.useFakeTimers();
|
|
22
|
-
const dispatchPollingPrompt = vi.fn();
|
|
23
|
-
const loop = new IdlePollLoop({
|
|
24
|
-
getStatus: () => 'waiting_input',
|
|
25
|
-
getCommand: () => 'poll_message',
|
|
26
|
-
isPollingCommand: (command) => command.includes('poll_message'),
|
|
27
|
-
dispatchPollingPrompt,
|
|
28
|
-
dispatchRegularIdleCommand: vi.fn(),
|
|
29
|
-
pollDelayMs: 1500,
|
|
30
|
-
});
|
|
31
|
-
loop.start();
|
|
32
|
-
await vi.advanceTimersByTimeAsync(1499);
|
|
33
|
-
expect(dispatchPollingPrompt).not.toHaveBeenCalled();
|
|
34
|
-
await vi.advanceTimersByTimeAsync(1);
|
|
35
|
-
expect(dispatchPollingPrompt).toHaveBeenCalledTimes(1);
|
|
36
|
-
expect(dispatchPollingPrompt).toHaveBeenCalledWith('poll_message');
|
|
37
|
-
});
|
|
38
|
-
it('does not dispatch when the session is busy', () => {
|
|
39
|
-
const dispatchPollingPrompt = vi.fn();
|
|
40
|
-
const loop = new IdlePollLoop({
|
|
41
|
-
getStatus: () => 'thinking',
|
|
42
|
-
getCommand: () => 'poll_message',
|
|
43
|
-
isPollingCommand: (command) => command.includes('poll_message'),
|
|
44
|
-
dispatchPollingPrompt,
|
|
45
|
-
dispatchRegularIdleCommand: vi.fn(),
|
|
46
|
-
});
|
|
47
|
-
loop.start();
|
|
48
|
-
expect(dispatchPollingPrompt).not.toHaveBeenCalled();
|
|
49
|
-
});
|
|
50
|
-
it('keeps only one delayed regular idle command scheduled', async () => {
|
|
51
|
-
vi.useFakeTimers();
|
|
52
|
-
const dispatchRegularIdleCommand = vi.fn();
|
|
53
|
-
const loop = new IdlePollLoop({
|
|
54
|
-
getStatus: () => 'waiting_input',
|
|
55
|
-
getCommand: () => 'continue',
|
|
56
|
-
isPollingCommand: () => false,
|
|
57
|
-
dispatchPollingPrompt: vi.fn(),
|
|
58
|
-
dispatchRegularIdleCommand,
|
|
59
|
-
regularIdleDelayMs: 1500,
|
|
60
|
-
});
|
|
61
|
-
loop.start();
|
|
62
|
-
loop.start();
|
|
63
|
-
await vi.advanceTimersByTimeAsync(1499);
|
|
64
|
-
expect(dispatchRegularIdleCommand).not.toHaveBeenCalled();
|
|
65
|
-
await vi.advanceTimersByTimeAsync(1);
|
|
66
|
-
expect(dispatchRegularIdleCommand).toHaveBeenCalledTimes(1);
|
|
67
|
-
expect(dispatchRegularIdleCommand).toHaveBeenCalledWith('continue');
|
|
68
|
-
});
|
|
69
|
-
it('can cancel a scheduled regular idle command', async () => {
|
|
70
|
-
vi.useFakeTimers();
|
|
71
|
-
const dispatchRegularIdleCommand = vi.fn();
|
|
72
|
-
const loop = new IdlePollLoop({
|
|
73
|
-
getStatus: () => 'waiting_input',
|
|
74
|
-
getCommand: () => 'continue',
|
|
75
|
-
isPollingCommand: () => false,
|
|
76
|
-
dispatchPollingPrompt: vi.fn(),
|
|
77
|
-
dispatchRegularIdleCommand,
|
|
78
|
-
regularIdleDelayMs: 1500,
|
|
79
|
-
});
|
|
80
|
-
loop.start();
|
|
81
|
-
loop.stop();
|
|
82
|
-
await vi.advanceTimersByTimeAsync(1500);
|
|
83
|
-
expect(dispatchRegularIdleCommand).not.toHaveBeenCalled();
|
|
84
|
-
});
|
|
85
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../../src/adapter/types.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { getToolActionInfo, isTransientClipboardPasteFilePath, redactTransientClipboardPastePaths, redactTransientClipboardPastePathsInValue, } from './types.js';
|
|
3
|
-
describe('getToolActionInfo', () => {
|
|
4
|
-
it('reports poll_message as an idle MCP listening tool call', () => {
|
|
5
|
-
expect(getToolActionInfo('poll_message')).toEqual({
|
|
6
|
-
actionType: 'idle',
|
|
7
|
-
actionLabel: '监听消息',
|
|
8
|
-
actionDetail: 'aws-mcp/poll_message',
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
it('reports prefixed poll_message as a canonical idle MCP listening tool call', () => {
|
|
12
|
-
expect(getToolActionInfo('aws-mcp__poll_message')).toEqual({
|
|
13
|
-
actionType: 'idle',
|
|
14
|
-
actionLabel: '监听消息',
|
|
15
|
-
actionDetail: 'aws-mcp/poll_message',
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
it('redacts transient mini-term paste paths from file action details', () => {
|
|
19
|
-
const info = getToolActionInfo('read', {
|
|
20
|
-
path: 'C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt',
|
|
21
|
-
});
|
|
22
|
-
expect(info).toEqual({
|
|
23
|
-
actionType: 'read_file',
|
|
24
|
-
actionLabel: '读取文件',
|
|
25
|
-
actionDetail: '[temp clipboard paste file]',
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
it('redacts transient mini-term paste paths inside displayed tool input values', () => {
|
|
29
|
-
expect(redactTransientClipboardPastePathsInValue({
|
|
30
|
-
command: 'type "C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt"',
|
|
31
|
-
})).toEqual({
|
|
32
|
-
command: 'type "[temp clipboard paste file]"',
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
it('keeps normal project paths unchanged', () => {
|
|
36
|
-
const info = getToolActionInfo('read', {
|
|
37
|
-
path: 'D:\\code\\AgentsWorkStudio\\README.md',
|
|
38
|
-
});
|
|
39
|
-
expect(info.actionDetail).toBe('D:\\code\\AgentsWorkStudio\\README.md');
|
|
40
|
-
});
|
|
41
|
-
it('detects only standalone transient mini-term paste file paths', () => {
|
|
42
|
-
expect(isTransientClipboardPasteFilePath('"C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt"')).toBe(true);
|
|
43
|
-
expect(isTransientClipboardPasteFilePath('type "C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt"')).toBe(false);
|
|
44
|
-
expect(isTransientClipboardPasteFilePath('D:\\code\\AgentsWorkStudio\\README.md')).toBe(false);
|
|
45
|
-
});
|
|
46
|
-
it('redacts transient mini-term paste paths before terminal display/status output', () => {
|
|
47
|
-
expect(redactTransientClipboardPastePaths('C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt')).toBe('[temp clipboard paste file]');
|
|
48
|
-
expect(redactTransientClipboardPastePaths('type "C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt"')).toBe('type "[temp clipboard paste file]"');
|
|
49
|
-
});
|
|
50
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-acode.test.d.ts","sourceRoot":"","sources":["../../../src/adapters/cc-switch/mcp-acode.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
5
|
-
import { AcodeMcpAdapter } from './mcp-acode.js';
|
|
6
|
-
let tempDir;
|
|
7
|
-
let configPath;
|
|
8
|
-
function buildServer(name = 'agents-work-studio') {
|
|
9
|
-
return {
|
|
10
|
-
id: 'mcp_test',
|
|
11
|
-
name,
|
|
12
|
-
server: {
|
|
13
|
-
type: 'stdio',
|
|
14
|
-
command: 'cmd',
|
|
15
|
-
args: ['/c', 'node', 'D:\\code\\AgentsWorkStudio\\aws-runtime-bridge\\package\\aws-client-agent-mcp\\dist\\index.js'],
|
|
16
|
-
env: {
|
|
17
|
-
AWS_SERVER_URL: 'ws://localhost:8080/ws/agent',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
apps: {
|
|
21
|
-
acode: true,
|
|
22
|
-
claude: false,
|
|
23
|
-
claudecode: false,
|
|
24
|
-
codex: false,
|
|
25
|
-
gemini: false,
|
|
26
|
-
opencode: false,
|
|
27
|
-
openclaw: false,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
beforeEach(async () => {
|
|
32
|
-
tempDir = await mkdtemp(path.join(os.tmpdir(), 'acode-mcp-adapter-'));
|
|
33
|
-
configPath = path.join(tempDir, '.acode', 'config.json');
|
|
34
|
-
});
|
|
35
|
-
afterEach(async () => {
|
|
36
|
-
await rm(tempDir, { recursive: true, force: true });
|
|
37
|
-
});
|
|
38
|
-
describe('AcodeMcpAdapter', () => {
|
|
39
|
-
it('syncs MCP servers into ACode config mcpServers while preserving provider config', async () => {
|
|
40
|
-
const adapter = new AcodeMcpAdapter(configPath);
|
|
41
|
-
await mkdir(path.dirname(configPath), { recursive: true });
|
|
42
|
-
await writeFile(configPath, JSON.stringify({ provider: { default: { model: 'test-model' } } }), 'utf-8');
|
|
43
|
-
await adapter.syncServer(buildServer());
|
|
44
|
-
const written = JSON.parse(await readFile(configPath, 'utf-8'));
|
|
45
|
-
expect(written.provider?.default).toEqual({ model: 'test-model' });
|
|
46
|
-
expect(written.mcpServers?.['agents-work-studio']).toMatchObject({
|
|
47
|
-
type: 'stdio',
|
|
48
|
-
command: 'cmd',
|
|
49
|
-
args: ['/c', 'node', 'D:\\code\\AgentsWorkStudio\\aws-runtime-bridge\\package\\aws-client-agent-mcp\\dist\\index.js'],
|
|
50
|
-
env: {
|
|
51
|
-
AWS_SERVER_URL: 'ws://localhost:8080/ws/agent',
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
it('imports and removes ACode MCP servers', async () => {
|
|
56
|
-
const adapter = new AcodeMcpAdapter(configPath);
|
|
57
|
-
await mkdir(path.dirname(configPath), { recursive: true });
|
|
58
|
-
await writeFile(configPath, JSON.stringify({
|
|
59
|
-
mcpServers: {
|
|
60
|
-
'agents-work-studio': {
|
|
61
|
-
type: 'stdio',
|
|
62
|
-
command: 'cmd',
|
|
63
|
-
args: ['/c', 'node', 'old.js'],
|
|
64
|
-
},
|
|
65
|
-
playwright: {
|
|
66
|
-
type: 'stdio',
|
|
67
|
-
command: 'npx',
|
|
68
|
-
args: ['@playwright/mcp@latest'],
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
}), 'utf-8');
|
|
72
|
-
const imported = await adapter.importServers();
|
|
73
|
-
await adapter.removeServer(buildServer());
|
|
74
|
-
const written = JSON.parse(await readFile(configPath, 'utf-8'));
|
|
75
|
-
expect(imported).toHaveLength(2);
|
|
76
|
-
expect(imported[0]?.apps.acode).toBe(true);
|
|
77
|
-
expect(written.mcpServers?.['agents-work-studio']).toBeUndefined();
|
|
78
|
-
expect(written.mcpServers?.playwright).toBeDefined();
|
|
79
|
-
});
|
|
80
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-claudecode.test.d.ts","sourceRoot":"","sources":["../../../src/adapters/cc-switch/mcp-claudecode.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
5
|
-
import { ClaudecodeMcpAdapter } from './mcp-claudecode.js';
|
|
6
|
-
let tempDir;
|
|
7
|
-
let configPath;
|
|
8
|
-
function buildServer(name = 'agents-work-studio') {
|
|
9
|
-
return {
|
|
10
|
-
id: 'mcp_test',
|
|
11
|
-
name,
|
|
12
|
-
server: {
|
|
13
|
-
type: 'stdio',
|
|
14
|
-
command: 'cmd',
|
|
15
|
-
args: ['/c', 'node', 'D:\\code\\AgentsWorkStudio\\aws-runtime-bridge\\package\\aws-client-agent-mcp\\dist\\index.js'],
|
|
16
|
-
env: {
|
|
17
|
-
AWS_SERVER_URL: 'ws://localhost:8080/ws/agent',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
apps: {
|
|
21
|
-
acode: false,
|
|
22
|
-
claude: false,
|
|
23
|
-
claudecode: true,
|
|
24
|
-
codex: false,
|
|
25
|
-
gemini: false,
|
|
26
|
-
opencode: false,
|
|
27
|
-
openclaw: false,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
beforeEach(async () => {
|
|
32
|
-
tempDir = await mkdtemp(path.join(os.tmpdir(), 'claudecode-mcp-adapter-'));
|
|
33
|
-
configPath = path.join(tempDir, '.claude.json');
|
|
34
|
-
});
|
|
35
|
-
afterEach(async () => {
|
|
36
|
-
await rm(tempDir, { recursive: true, force: true });
|
|
37
|
-
});
|
|
38
|
-
describe('ClaudecodeMcpAdapter', () => {
|
|
39
|
-
it('syncs MCP servers into Claude Code global mcpServers', async () => {
|
|
40
|
-
const adapter = new ClaudecodeMcpAdapter(configPath);
|
|
41
|
-
await adapter.syncServer(buildServer());
|
|
42
|
-
const written = JSON.parse(await readFile(configPath, 'utf-8'));
|
|
43
|
-
expect(written.mcpServers?.['agents-work-studio']).toMatchObject({
|
|
44
|
-
type: 'stdio',
|
|
45
|
-
command: 'cmd',
|
|
46
|
-
args: ['/c', 'node', 'D:\\code\\AgentsWorkStudio\\aws-runtime-bridge\\package\\aws-client-agent-mcp\\dist\\index.js'],
|
|
47
|
-
env: {
|
|
48
|
-
AWS_SERVER_URL: 'ws://localhost:8080/ws/agent',
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
it('removes MCP servers from Claude Code global mcpServers while preserving other settings', async () => {
|
|
53
|
-
const adapter = new ClaudecodeMcpAdapter(configPath);
|
|
54
|
-
await writeFile(configPath, JSON.stringify({
|
|
55
|
-
env: { ANTHROPIC_MODEL: 'test' },
|
|
56
|
-
mcpServers: {
|
|
57
|
-
'agents-work-studio': {
|
|
58
|
-
command: 'cmd',
|
|
59
|
-
args: ['/c', 'node', 'old.js'],
|
|
60
|
-
type: 'stdio',
|
|
61
|
-
},
|
|
62
|
-
playwright: {
|
|
63
|
-
command: 'cmd',
|
|
64
|
-
args: ['/c', 'npx', '@playwright/mcp@latest'],
|
|
65
|
-
type: 'stdio',
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
}), 'utf-8');
|
|
69
|
-
await adapter.removeServer(buildServer());
|
|
70
|
-
const written = JSON.parse(await readFile(configPath, 'utf-8'));
|
|
71
|
-
expect(written.env?.ANTHROPIC_MODEL).toBe('test');
|
|
72
|
-
expect(written.mcpServers?.['agents-work-studio']).toBeUndefined();
|
|
73
|
-
expect(written.mcpServers?.playwright).toBeDefined();
|
|
74
|
-
});
|
|
75
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-codex.test.d.ts","sourceRoot":"","sources":["../../../src/adapters/cc-switch/mcp-codex.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
5
|
-
import { CodexMcpAdapter } from './mcp-codex.js';
|
|
6
|
-
let tempDir;
|
|
7
|
-
let configPath;
|
|
8
|
-
function buildServer(name = 'aws-client-agent-mcp') {
|
|
9
|
-
return {
|
|
10
|
-
id: 'mcp_test',
|
|
11
|
-
name,
|
|
12
|
-
server: {
|
|
13
|
-
type: 'stdio',
|
|
14
|
-
command: 'node',
|
|
15
|
-
args: ['D:\\code\\AgentsWorkStudio\\aws-runtime-bridge\\package\\cc-switch-sdk\\dist\\index.js'],
|
|
16
|
-
env: {
|
|
17
|
-
AWS_AGENT_ID: 'agent-1',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
apps: {
|
|
21
|
-
acode: false,
|
|
22
|
-
claude: false,
|
|
23
|
-
claudecode: false,
|
|
24
|
-
codex: true,
|
|
25
|
-
gemini: false,
|
|
26
|
-
opencode: false,
|
|
27
|
-
openclaw: false,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
beforeEach(async () => {
|
|
32
|
-
tempDir = await mkdtemp(path.join(os.tmpdir(), 'codex-mcp-adapter-'));
|
|
33
|
-
configPath = path.join(tempDir, 'config.toml');
|
|
34
|
-
});
|
|
35
|
-
afterEach(async () => {
|
|
36
|
-
await rm(tempDir, { recursive: true, force: true });
|
|
37
|
-
});
|
|
38
|
-
describe('CodexMcpAdapter', () => {
|
|
39
|
-
it('creates a Codex config with an MCP block when none exists', async () => {
|
|
40
|
-
const adapter = new CodexMcpAdapter(configPath);
|
|
41
|
-
await adapter.syncServer(buildServer());
|
|
42
|
-
const written = await readFile(configPath, 'utf-8');
|
|
43
|
-
expect(written).toContain('[mcp_servers."aws-client-agent-mcp"]');
|
|
44
|
-
expect(written).toContain('command = "node"');
|
|
45
|
-
expect(written).toContain('args = ["D:\\\\code\\\\AgentsWorkStudio\\\\aws-runtime-bridge\\\\package\\\\cc-switch-sdk\\\\dist\\\\index.js"]');
|
|
46
|
-
expect(written).toContain('[mcp_servers."aws-client-agent-mcp".env]');
|
|
47
|
-
expect(written).toContain('AWS_AGENT_ID = "agent-1"');
|
|
48
|
-
});
|
|
49
|
-
it('preserves unrelated Codex model/provider config while appending MCP config', async () => {
|
|
50
|
-
const existing = [
|
|
51
|
-
'# user comment',
|
|
52
|
-
'model = "gpt-5.1"',
|
|
53
|
-
'model_provider = "custom"',
|
|
54
|
-
'',
|
|
55
|
-
'[model_providers.custom]',
|
|
56
|
-
'name = "Custom"',
|
|
57
|
-
'base_url = "https://example.test/v1"',
|
|
58
|
-
'',
|
|
59
|
-
].join('\n');
|
|
60
|
-
await writeFile(configPath, existing, 'utf-8');
|
|
61
|
-
const adapter = new CodexMcpAdapter(configPath);
|
|
62
|
-
await adapter.syncServer(buildServer());
|
|
63
|
-
const written = await readFile(configPath, 'utf-8');
|
|
64
|
-
expect(written).toContain(existing.trimEnd());
|
|
65
|
-
expect(written).toContain('[mcp_servers."aws-client-agent-mcp"]');
|
|
66
|
-
});
|
|
67
|
-
it('updates an existing MCP block without duplicating it', async () => {
|
|
68
|
-
const adapter = new CodexMcpAdapter(configPath);
|
|
69
|
-
await adapter.syncServer(buildServer());
|
|
70
|
-
await adapter.syncServer({
|
|
71
|
-
...buildServer(),
|
|
72
|
-
server: {
|
|
73
|
-
type: 'stdio',
|
|
74
|
-
command: 'node',
|
|
75
|
-
args: ['new-index.js'],
|
|
76
|
-
env: {
|
|
77
|
-
AWS_AGENT_ID: 'agent-2',
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
const written = await readFile(configPath, 'utf-8');
|
|
82
|
-
expect(written.match(/\[mcp_servers\."aws-client-agent-mcp"\]/g)).toHaveLength(1);
|
|
83
|
-
expect(written).toContain('args = ["new-index.js"]');
|
|
84
|
-
expect(written).toContain('AWS_AGENT_ID = "agent-2"');
|
|
85
|
-
expect(written).not.toContain('agent-1');
|
|
86
|
-
});
|
|
87
|
-
it('removes the MCP block and its nested env table only', async () => {
|
|
88
|
-
const adapter = new CodexMcpAdapter(configPath);
|
|
89
|
-
await writeFile(configPath, [
|
|
90
|
-
'model = "gpt-5.1"',
|
|
91
|
-
'',
|
|
92
|
-
'[mcp_servers."aws-client-agent-mcp"]',
|
|
93
|
-
'command = "node"',
|
|
94
|
-
'args = ["old.js"]',
|
|
95
|
-
'',
|
|
96
|
-
'[mcp_servers."aws-client-agent-mcp".env]',
|
|
97
|
-
'AWS_AGENT_ID = "agent-1"',
|
|
98
|
-
'',
|
|
99
|
-
'[model_providers.custom]',
|
|
100
|
-
'name = "Custom"',
|
|
101
|
-
'',
|
|
102
|
-
].join('\n'), 'utf-8');
|
|
103
|
-
await adapter.removeServer(buildServer());
|
|
104
|
-
const written = await readFile(configPath, 'utf-8');
|
|
105
|
-
expect(written).toContain('model = "gpt-5.1"');
|
|
106
|
-
expect(written).toContain('[model_providers.custom]');
|
|
107
|
-
expect(written).not.toContain('aws-client-agent-mcp');
|
|
108
|
-
expect(written).not.toContain('AWS_AGENT_ID');
|
|
109
|
-
});
|
|
110
|
-
it('imports Codex MCP blocks', async () => {
|
|
111
|
-
const adapter = new CodexMcpAdapter(configPath);
|
|
112
|
-
await adapter.syncServer(buildServer());
|
|
113
|
-
const servers = await adapter.importServers();
|
|
114
|
-
expect(servers).toHaveLength(1);
|
|
115
|
-
expect(servers[0]).toMatchObject({
|
|
116
|
-
name: 'aws-client-agent-mcp',
|
|
117
|
-
apps: { codex: true },
|
|
118
|
-
server: {
|
|
119
|
-
type: 'stdio',
|
|
120
|
-
command: 'node',
|
|
121
|
-
args: ['D:\\code\\AgentsWorkStudio\\aws-runtime-bridge\\package\\cc-switch-sdk\\dist\\index.js'],
|
|
122
|
-
env: { AWS_AGENT_ID: 'agent-1' },
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-opencode.test.d.ts","sourceRoot":"","sources":["../../../src/adapters/cc-switch/mcp-opencode.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
5
|
-
import { OpenCodeMcpAdapter } from './mcp-opencode.js';
|
|
6
|
-
let tempDir;
|
|
7
|
-
let configPath;
|
|
8
|
-
function buildServer(name = 'new-server') {
|
|
9
|
-
return {
|
|
10
|
-
id: 'mcp_test',
|
|
11
|
-
name,
|
|
12
|
-
server: { type: 'stdio', command: 'node', args: ['server.js'] },
|
|
13
|
-
apps: {
|
|
14
|
-
acode: false,
|
|
15
|
-
claude: false,
|
|
16
|
-
claudecode: false,
|
|
17
|
-
codex: false,
|
|
18
|
-
gemini: false,
|
|
19
|
-
opencode: true,
|
|
20
|
-
openclaw: false,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
beforeEach(async () => {
|
|
25
|
-
tempDir = await mkdtemp(path.join(os.tmpdir(), 'opencode-mcp-adapter-'));
|
|
26
|
-
configPath = path.join(tempDir, 'opencode.json');
|
|
27
|
-
});
|
|
28
|
-
afterEach(async () => {
|
|
29
|
-
await rm(tempDir, { recursive: true, force: true });
|
|
30
|
-
});
|
|
31
|
-
describe('OpenCodeMcpAdapter', () => {
|
|
32
|
-
it('imports both current mcp and legacy mcpServers maps', async () => {
|
|
33
|
-
await writeFile(configPath, JSON.stringify({
|
|
34
|
-
mcp: {
|
|
35
|
-
current: { type: 'local', command: ['node', 'current.js'] },
|
|
36
|
-
},
|
|
37
|
-
mcpServers: {
|
|
38
|
-
legacy: { type: 'remote', url: 'http://legacy.example.com/sse' },
|
|
39
|
-
},
|
|
40
|
-
}), 'utf-8');
|
|
41
|
-
const adapter = new OpenCodeMcpAdapter(configPath);
|
|
42
|
-
const imported = await adapter.importServers();
|
|
43
|
-
expect(imported.map((item) => item.name).sort()).toEqual(['current', 'legacy']);
|
|
44
|
-
});
|
|
45
|
-
it('writes merged MCP map back to mcp and removes legacy mcpServers', async () => {
|
|
46
|
-
await writeFile(configPath, JSON.stringify({
|
|
47
|
-
theme: 'dark',
|
|
48
|
-
mcpServers: {
|
|
49
|
-
legacy: { type: 'remote', url: 'http://legacy.example.com/sse' },
|
|
50
|
-
},
|
|
51
|
-
}), 'utf-8');
|
|
52
|
-
const adapter = new OpenCodeMcpAdapter(configPath);
|
|
53
|
-
await adapter.syncServer(buildServer());
|
|
54
|
-
const written = JSON.parse(await readFile(configPath, 'utf-8'));
|
|
55
|
-
expect(written.theme).toBe('dark');
|
|
56
|
-
expect(written.mcpServers).toBeUndefined();
|
|
57
|
-
expect(written.mcp).toMatchObject({
|
|
58
|
-
legacy: { type: 'remote', url: 'http://legacy.example.com/sse' },
|
|
59
|
-
'new-server': { type: 'local', command: ['node', 'server.js'] },
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill-directory.test.d.ts","sourceRoot":"","sources":["../../../src/adapters/cc-switch/skill-directory.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from 'node:fs/promises';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
5
|
-
import { DirectorySkillAdapter } from './skill-directory.js';
|
|
6
|
-
let tempDir;
|
|
7
|
-
let skillsDir;
|
|
8
|
-
async function writeSkill(directory, body) {
|
|
9
|
-
await mkdir(directory, { recursive: true });
|
|
10
|
-
await writeFile(path.join(directory, 'SKILL.md'), body, 'utf-8');
|
|
11
|
-
}
|
|
12
|
-
function buildSkill(name = 'frontend-design') {
|
|
13
|
-
return {
|
|
14
|
-
id: 'skill_test',
|
|
15
|
-
name,
|
|
16
|
-
directory: path.join(tempDir, 'source'),
|
|
17
|
-
description: 'A design skill',
|
|
18
|
-
apps: {
|
|
19
|
-
acode: false,
|
|
20
|
-
claude: false,
|
|
21
|
-
claudecode: true,
|
|
22
|
-
codex: false,
|
|
23
|
-
gemini: false,
|
|
24
|
-
opencode: false,
|
|
25
|
-
openclaw: false,
|
|
26
|
-
},
|
|
27
|
-
installedAt: Date.now(),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
beforeEach(async () => {
|
|
31
|
-
tempDir = await mkdtemp(path.join(os.tmpdir(), 'skill-directory-adapter-'));
|
|
32
|
-
skillsDir = path.join(tempDir, 'skills');
|
|
33
|
-
});
|
|
34
|
-
afterEach(async () => {
|
|
35
|
-
await rm(tempDir, { recursive: true, force: true });
|
|
36
|
-
});
|
|
37
|
-
describe('DirectorySkillAdapter', () => {
|
|
38
|
-
it('imports only skill directories with SKILL.md and parses front matter', async () => {
|
|
39
|
-
await writeSkill(path.join(skillsDir, 'frontend-design'), '---\nname: Frontend Design\ndescription: Polished UI work\n---\n# Skill\n');
|
|
40
|
-
await mkdir(path.join(skillsDir, 'ordinary-folder'), { recursive: true });
|
|
41
|
-
await writeSkill(path.join(skillsDir, '.hidden-skill'), '---\nname: Hidden\n---\n');
|
|
42
|
-
const adapter = new DirectorySkillAdapter('claudecode', skillsDir);
|
|
43
|
-
const imported = await adapter.importSkills();
|
|
44
|
-
expect(imported).toHaveLength(1);
|
|
45
|
-
expect(imported[0]).toMatchObject({
|
|
46
|
-
id: 'skill_import_claudecode_frontend-design',
|
|
47
|
-
name: 'Frontend Design',
|
|
48
|
-
description: 'Polished UI work',
|
|
49
|
-
directory: path.join(skillsDir, 'frontend-design'),
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
it('imports symlinked skill directories', async () => {
|
|
53
|
-
const source = path.join(tempDir, 'linked-source');
|
|
54
|
-
await writeSkill(source, '---\nname: Linked Skill\n---\n# Skill\n');
|
|
55
|
-
await mkdir(skillsDir, { recursive: true });
|
|
56
|
-
await symlink(source, path.join(skillsDir, 'linked-skill'), 'junction');
|
|
57
|
-
const adapter = new DirectorySkillAdapter('opencode', skillsDir);
|
|
58
|
-
const imported = await adapter.importSkills();
|
|
59
|
-
expect(imported).toHaveLength(1);
|
|
60
|
-
expect(imported[0]?.name).toBe('Linked Skill');
|
|
61
|
-
});
|
|
62
|
-
it('syncs and removes skill directories', async () => {
|
|
63
|
-
const source = path.join(tempDir, 'source');
|
|
64
|
-
await writeSkill(source, '# Skill\n');
|
|
65
|
-
await writeFile(path.join(source, 'README.md'), 'hello', 'utf-8');
|
|
66
|
-
const adapter = new DirectorySkillAdapter('codex', skillsDir);
|
|
67
|
-
await adapter.syncSkill(buildSkill('copied-skill'), source, 'copy');
|
|
68
|
-
const copiedReadme = await readFile(path.join(skillsDir, 'copied-skill', 'README.md'), 'utf-8');
|
|
69
|
-
expect(copiedReadme).toBe('hello');
|
|
70
|
-
await adapter.removeSkill(buildSkill('copied-skill'));
|
|
71
|
-
const imported = await adapter.importSkills();
|
|
72
|
-
expect(imported).toHaveLength(0);
|
|
73
|
-
});
|
|
74
|
-
});
|
package/dist/config.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.test.d.ts","sourceRoot":"","sources":["../src/config.test.ts"],"names":[],"mappings":""}
|