ai-cli-mcp 2.1.0 → 2.3.0
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/.claude/settings.local.json +3 -2
- package/package.json +1 -1
- package/src/__tests__/e2e.test.ts +21 -21
- package/src/__tests__/edge-cases.test.ts +12 -12
- package/src/__tests__/error-cases.test.ts +11 -9
- package/src/__tests__/process-management.test.ts +33 -33
- package/src/__tests__/server.test.ts +44 -32
- package/src/__tests__/validation.test.ts +2 -2
- package/src/__tests__/version-print.test.ts +5 -5
- package/src/__tests__/wait.test.ts +264 -0
- package/src/server.ts +158 -36
- package/dist/__tests__/e2e.test.js +0 -238
- package/dist/__tests__/edge-cases.test.js +0 -135
- package/dist/__tests__/error-cases.test.js +0 -296
- package/dist/__tests__/mocks.js +0 -32
- package/dist/__tests__/model-alias.test.js +0 -36
- package/dist/__tests__/process-management.test.js +0 -632
- package/dist/__tests__/server.test.js +0 -665
- package/dist/__tests__/setup.js +0 -11
- package/dist/__tests__/utils/claude-mock.js +0 -80
- package/dist/__tests__/utils/mcp-client.js +0 -104
- package/dist/__tests__/utils/persistent-mock.js +0 -25
- package/dist/__tests__/utils/test-helpers.js +0 -11
- package/dist/__tests__/validation.test.js +0 -212
- package/dist/__tests__/version-print.test.js +0 -69
- package/dist/parsers.js +0 -68
- package/dist/server.js +0 -671
package/package.json
CHANGED
|
@@ -40,13 +40,13 @@ describe('Claude Code MCP E2E Tests', () => {
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
describe('Tool Registration', () => {
|
|
43
|
-
it('should register
|
|
43
|
+
it('should register run tool', async () => {
|
|
44
44
|
const tools = await client.listTools();
|
|
45
45
|
|
|
46
46
|
expect(tools).toHaveLength(4);
|
|
47
|
-
const claudeCodeTool = tools.find((t: any) => t.name === '
|
|
47
|
+
const claudeCodeTool = tools.find((t: any) => t.name === 'run');
|
|
48
48
|
expect(claudeCodeTool).toEqual({
|
|
49
|
-
name: '
|
|
49
|
+
name: 'run',
|
|
50
50
|
description: expect.stringContaining('Claude Code Agent'),
|
|
51
51
|
inputSchema: {
|
|
52
52
|
type: 'object',
|
|
@@ -77,15 +77,15 @@ describe('Claude Code MCP E2E Tests', () => {
|
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
// Verify other tools exist
|
|
80
|
-
expect(tools.some((t: any) => t.name === '
|
|
81
|
-
expect(tools.some((t: any) => t.name === '
|
|
82
|
-
expect(tools.some((t: any) => t.name === '
|
|
80
|
+
expect(tools.some((t: any) => t.name === 'list_processes')).toBe(true);
|
|
81
|
+
expect(tools.some((t: any) => t.name === 'get_result')).toBe(true);
|
|
82
|
+
expect(tools.some((t: any) => t.name === 'kill_process')).toBe(true);
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
describe('Basic Operations', () => {
|
|
87
87
|
it('should execute a simple prompt', async () => {
|
|
88
|
-
const response = await client.callTool('
|
|
88
|
+
const response = await client.callTool('run', {
|
|
89
89
|
prompt: 'create a file called test.txt with content "Hello World"',
|
|
90
90
|
workFolder: testDir,
|
|
91
91
|
});
|
|
@@ -97,8 +97,8 @@ describe('Claude Code MCP E2E Tests', () => {
|
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
it('should handle process management correctly', async () => {
|
|
100
|
-
//
|
|
101
|
-
const response = await client.callTool('
|
|
100
|
+
// run now returns a PID immediately
|
|
101
|
+
const response = await client.callTool('run', {
|
|
102
102
|
prompt: 'error',
|
|
103
103
|
workFolder: testDir,
|
|
104
104
|
});
|
|
@@ -116,7 +116,7 @@ describe('Claude Code MCP E2E Tests', () => {
|
|
|
116
116
|
|
|
117
117
|
it('should reject missing workFolder', async () => {
|
|
118
118
|
await expect(
|
|
119
|
-
client.callTool('
|
|
119
|
+
client.callTool('run', {
|
|
120
120
|
prompt: 'List files in current directory',
|
|
121
121
|
})
|
|
122
122
|
).rejects.toThrow(/workFolder/i);
|
|
@@ -125,7 +125,7 @@ describe('Claude Code MCP E2E Tests', () => {
|
|
|
125
125
|
|
|
126
126
|
describe('Working Directory Handling', () => {
|
|
127
127
|
it('should respect custom working directory', async () => {
|
|
128
|
-
const response = await client.callTool('
|
|
128
|
+
const response = await client.callTool('run', {
|
|
129
129
|
prompt: 'Show current working directory',
|
|
130
130
|
workFolder: testDir,
|
|
131
131
|
});
|
|
@@ -137,7 +137,7 @@ describe('Claude Code MCP E2E Tests', () => {
|
|
|
137
137
|
const nonExistentDir = join(testDir, 'non-existent');
|
|
138
138
|
|
|
139
139
|
await expect(
|
|
140
|
-
client.callTool('
|
|
140
|
+
client.callTool('run', {
|
|
141
141
|
prompt: 'Test prompt',
|
|
142
142
|
workFolder: nonExistentDir,
|
|
143
143
|
})
|
|
@@ -154,8 +154,8 @@ describe('Claude Code MCP E2E Tests', () => {
|
|
|
154
154
|
});
|
|
155
155
|
|
|
156
156
|
describe('Model Alias Handling', () => {
|
|
157
|
-
it('should resolve haiku alias when calling
|
|
158
|
-
const response = await client.callTool('
|
|
157
|
+
it('should resolve haiku alias when calling run', async () => {
|
|
158
|
+
const response = await client.callTool('run', {
|
|
159
159
|
prompt: 'Test with haiku model',
|
|
160
160
|
workFolder: testDir,
|
|
161
161
|
model: 'haiku'
|
|
@@ -173,7 +173,7 @@ describe('Claude Code MCP E2E Tests', () => {
|
|
|
173
173
|
|
|
174
174
|
// Get the PID and check the process
|
|
175
175
|
const pid = parseInt(pidMatch![1]);
|
|
176
|
-
const processes = await client.callTool('
|
|
176
|
+
const processes = await client.callTool('list_processes', {});
|
|
177
177
|
const processesText = processes[0].text;
|
|
178
178
|
const processData = JSON.parse(processesText);
|
|
179
179
|
|
|
@@ -186,7 +186,7 @@ describe('Claude Code MCP E2E Tests', () => {
|
|
|
186
186
|
});
|
|
187
187
|
|
|
188
188
|
it('should pass non-alias model names unchanged', async () => {
|
|
189
|
-
const response = await client.callTool('
|
|
189
|
+
const response = await client.callTool('run', {
|
|
190
190
|
prompt: 'Test with sonnet model',
|
|
191
191
|
workFolder: testDir,
|
|
192
192
|
model: 'sonnet'
|
|
@@ -203,7 +203,7 @@ describe('Claude Code MCP E2E Tests', () => {
|
|
|
203
203
|
const pid = parseInt(pidMatch![1]);
|
|
204
204
|
|
|
205
205
|
// Check the process
|
|
206
|
-
const processes = await client.callTool('
|
|
206
|
+
const processes = await client.callTool('list_processes', {});
|
|
207
207
|
const processesText = processes[0].text;
|
|
208
208
|
const processData = JSON.parse(processesText);
|
|
209
209
|
|
|
@@ -216,7 +216,7 @@ describe('Claude Code MCP E2E Tests', () => {
|
|
|
216
216
|
});
|
|
217
217
|
|
|
218
218
|
it('should work without specifying a model', async () => {
|
|
219
|
-
const response = await client.callTool('
|
|
219
|
+
const response = await client.callTool('run', {
|
|
220
220
|
prompt: 'Test without model parameter',
|
|
221
221
|
workFolder: testDir
|
|
222
222
|
});
|
|
@@ -231,7 +231,7 @@ describe('Claude Code MCP E2E Tests', () => {
|
|
|
231
231
|
describe('Debug Mode', () => {
|
|
232
232
|
it('should log debug information when enabled', async () => {
|
|
233
233
|
// Debug logs go to stderr, which we capture in the client
|
|
234
|
-
const response = await client.callTool('
|
|
234
|
+
const response = await client.callTool('run', {
|
|
235
235
|
prompt: 'Debug test prompt',
|
|
236
236
|
workFolder: testDir,
|
|
237
237
|
});
|
|
@@ -265,7 +265,7 @@ describe('Integration Tests (Local Only)', () => {
|
|
|
265
265
|
it.skip('should create a file with real Claude CLI', async () => {
|
|
266
266
|
await client.connect();
|
|
267
267
|
|
|
268
|
-
const response = await client.callTool('
|
|
268
|
+
const response = await client.callTool('run', {
|
|
269
269
|
prompt: 'Create a file called hello.txt with content "Hello from Claude"',
|
|
270
270
|
workFolder: testDir,
|
|
271
271
|
});
|
|
@@ -279,7 +279,7 @@ describe('Integration Tests (Local Only)', () => {
|
|
|
279
279
|
await client.connect();
|
|
280
280
|
|
|
281
281
|
// Initialize git repo
|
|
282
|
-
const response = await client.callTool('
|
|
282
|
+
const response = await client.callTool('run', {
|
|
283
283
|
prompt: 'Initialize a git repository and create a README.md file',
|
|
284
284
|
workFolder: testDir,
|
|
285
285
|
});
|
|
@@ -39,7 +39,7 @@ describe('Claude Code Edge Cases', () => {
|
|
|
39
39
|
describe('Input Validation', () => {
|
|
40
40
|
it('should reject missing prompt', async () => {
|
|
41
41
|
await expect(
|
|
42
|
-
client.callTool('
|
|
42
|
+
client.callTool('run', {
|
|
43
43
|
workFolder: testDir,
|
|
44
44
|
})
|
|
45
45
|
).rejects.toThrow(/prompt/i);
|
|
@@ -47,7 +47,7 @@ describe('Claude Code Edge Cases', () => {
|
|
|
47
47
|
|
|
48
48
|
it('should reject invalid prompt type', async () => {
|
|
49
49
|
await expect(
|
|
50
|
-
client.callTool('
|
|
50
|
+
client.callTool('run', {
|
|
51
51
|
prompt: 123, // Should be string
|
|
52
52
|
workFolder: testDir,
|
|
53
53
|
})
|
|
@@ -56,7 +56,7 @@ describe('Claude Code Edge Cases', () => {
|
|
|
56
56
|
|
|
57
57
|
it('should reject invalid workFolder type', async () => {
|
|
58
58
|
await expect(
|
|
59
|
-
client.callTool('
|
|
59
|
+
client.callTool('run', {
|
|
60
60
|
prompt: 'Test prompt',
|
|
61
61
|
workFolder: 123, // Should be string
|
|
62
62
|
})
|
|
@@ -65,7 +65,7 @@ describe('Claude Code Edge Cases', () => {
|
|
|
65
65
|
|
|
66
66
|
it('should reject empty prompt', async () => {
|
|
67
67
|
await expect(
|
|
68
|
-
client.callTool('
|
|
68
|
+
client.callTool('run', {
|
|
69
69
|
prompt: '',
|
|
70
70
|
workFolder: testDir,
|
|
71
71
|
})
|
|
@@ -76,7 +76,7 @@ describe('Claude Code Edge Cases', () => {
|
|
|
76
76
|
describe('Special Characters', () => {
|
|
77
77
|
it.skip('should handle prompts with quotes', async () => {
|
|
78
78
|
// Skipping: This test fails in CI when mock is not found at expected path
|
|
79
|
-
const response = await client.callTool('
|
|
79
|
+
const response = await client.callTool('run', {
|
|
80
80
|
prompt: 'Create a file with content "Hello \\"World\\""',
|
|
81
81
|
workFolder: testDir,
|
|
82
82
|
});
|
|
@@ -85,7 +85,7 @@ describe('Claude Code Edge Cases', () => {
|
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
it('should handle prompts with newlines', async () => {
|
|
88
|
-
const response = await client.callTool('
|
|
88
|
+
const response = await client.callTool('run', {
|
|
89
89
|
prompt: 'Create a file with content:\\nLine 1\\nLine 2',
|
|
90
90
|
workFolder: testDir,
|
|
91
91
|
});
|
|
@@ -94,7 +94,7 @@ describe('Claude Code Edge Cases', () => {
|
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
it('should handle prompts with shell special characters', async () => {
|
|
97
|
-
const response = await client.callTool('
|
|
97
|
+
const response = await client.callTool('run', {
|
|
98
98
|
prompt: 'Create a file named test$file.txt',
|
|
99
99
|
workFolder: testDir,
|
|
100
100
|
});
|
|
@@ -113,7 +113,7 @@ describe('Claude Code Edge Cases', () => {
|
|
|
113
113
|
await errorClient.connect();
|
|
114
114
|
|
|
115
115
|
await expect(
|
|
116
|
-
errorClient.callTool('
|
|
116
|
+
errorClient.callTool('run', {
|
|
117
117
|
prompt: 'Test prompt',
|
|
118
118
|
workFolder: testDir,
|
|
119
119
|
})
|
|
@@ -127,7 +127,7 @@ describe('Claude Code Edge Cases', () => {
|
|
|
127
127
|
|
|
128
128
|
// Non-existent directories now throw an error
|
|
129
129
|
await expect(
|
|
130
|
-
client.callTool('
|
|
130
|
+
client.callTool('run', {
|
|
131
131
|
prompt: 'Test prompt',
|
|
132
132
|
workFolder: restrictedDir,
|
|
133
133
|
})
|
|
@@ -138,7 +138,7 @@ describe('Claude Code Edge Cases', () => {
|
|
|
138
138
|
describe('Concurrent Requests', () => {
|
|
139
139
|
it('should handle multiple simultaneous requests', async () => {
|
|
140
140
|
const promises = Array(5).fill(null).map((_, i) =>
|
|
141
|
-
client.callTool('
|
|
141
|
+
client.callTool('run', {
|
|
142
142
|
prompt: `Create file test${i}.txt`,
|
|
143
143
|
workFolder: testDir,
|
|
144
144
|
})
|
|
@@ -155,7 +155,7 @@ describe('Claude Code Edge Cases', () => {
|
|
|
155
155
|
it('should handle very long prompts', async () => {
|
|
156
156
|
const longPrompt = 'Create a file with content: ' + 'x'.repeat(10000);
|
|
157
157
|
|
|
158
|
-
const response = await client.callTool('
|
|
158
|
+
const response = await client.callTool('run', {
|
|
159
159
|
prompt: longPrompt,
|
|
160
160
|
workFolder: testDir,
|
|
161
161
|
});
|
|
@@ -171,7 +171,7 @@ describe('Claude Code Edge Cases', () => {
|
|
|
171
171
|
// Server resolves paths and checks existence
|
|
172
172
|
// The path /etc/passwd may exist but be a file, not a directory
|
|
173
173
|
await expect(
|
|
174
|
-
client.callTool('
|
|
174
|
+
client.callTool('run', {
|
|
175
175
|
prompt: 'Read file',
|
|
176
176
|
workFolder: maliciousPath,
|
|
177
177
|
})
|
|
@@ -33,11 +33,13 @@ vi.mock('@modelcontextprotocol/sdk/types.js', () => ({
|
|
|
33
33
|
MethodNotFound: 'MethodNotFound',
|
|
34
34
|
InvalidParams: 'InvalidParams'
|
|
35
35
|
},
|
|
36
|
-
McpError:
|
|
37
|
-
|
|
38
|
-
(
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
McpError: class extends Error {
|
|
37
|
+
code: any;
|
|
38
|
+
constructor(code: any, message: string) {
|
|
39
|
+
super(message);
|
|
40
|
+
this.code = code;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
41
43
|
}));
|
|
42
44
|
|
|
43
45
|
const mockExistsSync = vi.mocked(existsSync);
|
|
@@ -148,7 +150,7 @@ describe('Error Handling Tests', () => {
|
|
|
148
150
|
try {
|
|
149
151
|
await callToolHandler({
|
|
150
152
|
params: {
|
|
151
|
-
name: '
|
|
153
|
+
name: 'run',
|
|
152
154
|
arguments: {
|
|
153
155
|
prompt: 'test',
|
|
154
156
|
workFolder: '/tmp'
|
|
@@ -160,7 +162,7 @@ describe('Error Handling Tests', () => {
|
|
|
160
162
|
// Check if McpError was called with the process start failure message
|
|
161
163
|
expect(McpError).toHaveBeenCalledWith(
|
|
162
164
|
'InternalError',
|
|
163
|
-
'Failed to start
|
|
165
|
+
'Failed to start claude CLI process'
|
|
164
166
|
);
|
|
165
167
|
}
|
|
166
168
|
});
|
|
@@ -185,7 +187,7 @@ describe('Error Handling Tests', () => {
|
|
|
185
187
|
await expect(
|
|
186
188
|
handler({
|
|
187
189
|
params: {
|
|
188
|
-
name: '
|
|
190
|
+
name: 'run',
|
|
189
191
|
arguments: 'invalid-should-be-object'
|
|
190
192
|
}
|
|
191
193
|
})
|
|
@@ -244,7 +246,7 @@ describe('Error Handling Tests', () => {
|
|
|
244
246
|
await expect(
|
|
245
247
|
handler({
|
|
246
248
|
params: {
|
|
247
|
-
name: '
|
|
249
|
+
name: 'run',
|
|
248
250
|
arguments: {
|
|
249
251
|
prompt: 'test',
|
|
250
252
|
workFolder: '/tmp'
|
|
@@ -88,7 +88,7 @@ describe('Process Management Tests', () => {
|
|
|
88
88
|
return { server, module, handlers };
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
describe('
|
|
91
|
+
describe('run tool with PID return', () => {
|
|
92
92
|
it('should return PID immediately when starting a process', async () => {
|
|
93
93
|
const { handlers } = await setupServer();
|
|
94
94
|
|
|
@@ -104,7 +104,7 @@ describe('Process Management Tests', () => {
|
|
|
104
104
|
const callToolHandler = handlers.get('callTool')!;
|
|
105
105
|
const result = await callToolHandler!({
|
|
106
106
|
params: {
|
|
107
|
-
name: '
|
|
107
|
+
name: 'run',
|
|
108
108
|
arguments: {
|
|
109
109
|
prompt: 'test prompt',
|
|
110
110
|
workFolder: '/tmp'
|
|
@@ -115,7 +115,7 @@ describe('Process Management Tests', () => {
|
|
|
115
115
|
const response = JSON.parse(result.content[0].text);
|
|
116
116
|
expect(response.pid).toBe(12345);
|
|
117
117
|
expect(response.status).toBe('started');
|
|
118
|
-
expect(response.message).toBe('
|
|
118
|
+
expect(response.message).toBe('claude process started successfully');
|
|
119
119
|
});
|
|
120
120
|
|
|
121
121
|
it('should handle process with model parameter', async () => {
|
|
@@ -132,7 +132,7 @@ describe('Process Management Tests', () => {
|
|
|
132
132
|
const callToolHandler = handlers.get('callTool')!;
|
|
133
133
|
await callToolHandler!({
|
|
134
134
|
params: {
|
|
135
|
-
name: '
|
|
135
|
+
name: 'run',
|
|
136
136
|
arguments: {
|
|
137
137
|
prompt: 'test prompt',
|
|
138
138
|
workFolder: '/tmp',
|
|
@@ -167,7 +167,7 @@ describe('Process Management Tests', () => {
|
|
|
167
167
|
const callToolHandler = handlers.get('callTool')!;
|
|
168
168
|
const result = await callToolHandler!({
|
|
169
169
|
params: {
|
|
170
|
-
name: '
|
|
170
|
+
name: 'run',
|
|
171
171
|
arguments: {
|
|
172
172
|
prompt: japanesePrompt,
|
|
173
173
|
workFolder: '/tmp'
|
|
@@ -189,7 +189,7 @@ describe('Process Management Tests', () => {
|
|
|
189
189
|
// Verify the prompt is stored correctly in process manager
|
|
190
190
|
const getResult = await callToolHandler!({
|
|
191
191
|
params: {
|
|
192
|
-
name: '
|
|
192
|
+
name: 'get_result',
|
|
193
193
|
arguments: {
|
|
194
194
|
pid: 12360
|
|
195
195
|
}
|
|
@@ -240,7 +240,7 @@ describe('Process Management Tests', () => {
|
|
|
240
240
|
const callToolHandler = handlers.get('callTool')!;
|
|
241
241
|
const result = await callToolHandler!({
|
|
242
242
|
params: {
|
|
243
|
-
name: '
|
|
243
|
+
name: 'run',
|
|
244
244
|
arguments: {
|
|
245
245
|
prompt: longJapanesePrompt,
|
|
246
246
|
workFolder: '/tmp',
|
|
@@ -260,10 +260,10 @@ describe('Process Management Tests', () => {
|
|
|
260
260
|
expect.any(Object)
|
|
261
261
|
);
|
|
262
262
|
|
|
263
|
-
// Check
|
|
263
|
+
// Check list_processes truncates long prompts correctly
|
|
264
264
|
const listResult = await callToolHandler!({
|
|
265
265
|
params: {
|
|
266
|
-
name: '
|
|
266
|
+
name: 'list_processes',
|
|
267
267
|
arguments: {}
|
|
268
268
|
}
|
|
269
269
|
});
|
|
@@ -298,7 +298,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
298
298
|
const callToolHandler = handlers.get('callTool')!;
|
|
299
299
|
const result = await callToolHandler!({
|
|
300
300
|
params: {
|
|
301
|
-
name: '
|
|
301
|
+
name: 'run',
|
|
302
302
|
arguments: {
|
|
303
303
|
prompt: specialPrompt,
|
|
304
304
|
workFolder: '/tmp'
|
|
@@ -331,7 +331,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
331
331
|
const callToolHandler = handlers.get('callTool')!;
|
|
332
332
|
await expect(callToolHandler!({
|
|
333
333
|
params: {
|
|
334
|
-
name: '
|
|
334
|
+
name: 'run',
|
|
335
335
|
arguments: {
|
|
336
336
|
prompt: 'test prompt',
|
|
337
337
|
workFolder: '/tmp/test'
|
|
@@ -341,7 +341,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
341
341
|
});
|
|
342
342
|
});
|
|
343
343
|
|
|
344
|
-
describe('
|
|
344
|
+
describe('list_processes tool', () => {
|
|
345
345
|
it('should list all processes', async () => {
|
|
346
346
|
const { handlers } = await setupServer();
|
|
347
347
|
|
|
@@ -359,7 +359,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
359
359
|
// Start a process
|
|
360
360
|
await callToolHandler!({
|
|
361
361
|
params: {
|
|
362
|
-
name: '
|
|
362
|
+
name: 'run',
|
|
363
363
|
arguments: {
|
|
364
364
|
prompt: 'test prompt for listing',
|
|
365
365
|
workFolder: '/tmp',
|
|
@@ -378,7 +378,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
378
378
|
// List processes
|
|
379
379
|
const listResult = await callToolHandler!({
|
|
380
380
|
params: {
|
|
381
|
-
name: '
|
|
381
|
+
name: 'list_processes',
|
|
382
382
|
arguments: {}
|
|
383
383
|
}
|
|
384
384
|
});
|
|
@@ -409,7 +409,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
409
409
|
const longPrompt = 'a'.repeat(150);
|
|
410
410
|
await callToolHandler!({
|
|
411
411
|
params: {
|
|
412
|
-
name: '
|
|
412
|
+
name: 'run',
|
|
413
413
|
arguments: {
|
|
414
414
|
prompt: longPrompt,
|
|
415
415
|
workFolder: '/tmp'
|
|
@@ -420,7 +420,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
420
420
|
// List processes
|
|
421
421
|
const listResult = await callToolHandler!({
|
|
422
422
|
params: {
|
|
423
|
-
name: '
|
|
423
|
+
name: 'list_processes',
|
|
424
424
|
arguments: {}
|
|
425
425
|
}
|
|
426
426
|
});
|
|
@@ -431,7 +431,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
431
431
|
});
|
|
432
432
|
});
|
|
433
433
|
|
|
434
|
-
describe('
|
|
434
|
+
describe('get_result tool', () => {
|
|
435
435
|
it('should get process output', async () => {
|
|
436
436
|
const { handlers } = await setupServer();
|
|
437
437
|
|
|
@@ -448,7 +448,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
448
448
|
// Start a process
|
|
449
449
|
await callToolHandler!({
|
|
450
450
|
params: {
|
|
451
|
-
name: '
|
|
451
|
+
name: 'run',
|
|
452
452
|
arguments: {
|
|
453
453
|
prompt: 'test prompt',
|
|
454
454
|
workFolder: '/tmp'
|
|
@@ -468,7 +468,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
468
468
|
// Get result
|
|
469
469
|
const result = await callToolHandler!({
|
|
470
470
|
params: {
|
|
471
|
-
name: '
|
|
471
|
+
name: 'get_result',
|
|
472
472
|
arguments: {
|
|
473
473
|
pid: 12349
|
|
474
474
|
}
|
|
@@ -498,7 +498,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
498
498
|
// Start a process
|
|
499
499
|
await callToolHandler!({
|
|
500
500
|
params: {
|
|
501
|
-
name: '
|
|
501
|
+
name: 'run',
|
|
502
502
|
arguments: {
|
|
503
503
|
prompt: 'test prompt',
|
|
504
504
|
workFolder: '/tmp'
|
|
@@ -519,7 +519,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
519
519
|
// Get result
|
|
520
520
|
const result = await callToolHandler!({
|
|
521
521
|
params: {
|
|
522
|
-
name: '
|
|
522
|
+
name: 'get_result',
|
|
523
523
|
arguments: {
|
|
524
524
|
pid: 12350
|
|
525
525
|
}
|
|
@@ -540,7 +540,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
540
540
|
|
|
541
541
|
await expect(callToolHandler!({
|
|
542
542
|
params: {
|
|
543
|
-
name: '
|
|
543
|
+
name: 'get_result',
|
|
544
544
|
arguments: {
|
|
545
545
|
pid: 99999
|
|
546
546
|
}
|
|
@@ -555,7 +555,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
555
555
|
|
|
556
556
|
await expect(callToolHandler!({
|
|
557
557
|
params: {
|
|
558
|
-
name: '
|
|
558
|
+
name: 'get_result',
|
|
559
559
|
arguments: {
|
|
560
560
|
pid: 'not-a-number'
|
|
561
561
|
}
|
|
@@ -579,7 +579,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
579
579
|
// Start a process
|
|
580
580
|
await callToolHandler!({
|
|
581
581
|
params: {
|
|
582
|
-
name: '
|
|
582
|
+
name: 'run',
|
|
583
583
|
arguments: {
|
|
584
584
|
prompt: 'test prompt',
|
|
585
585
|
workFolder: '/tmp'
|
|
@@ -594,7 +594,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
594
594
|
// Get result
|
|
595
595
|
const result = await callToolHandler!({
|
|
596
596
|
params: {
|
|
597
|
-
name: '
|
|
597
|
+
name: 'get_result',
|
|
598
598
|
arguments: {
|
|
599
599
|
pid: 12355
|
|
600
600
|
}
|
|
@@ -611,7 +611,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
611
611
|
});
|
|
612
612
|
});
|
|
613
613
|
|
|
614
|
-
describe('
|
|
614
|
+
describe('kill_process tool', () => {
|
|
615
615
|
it('should kill a running process', async () => {
|
|
616
616
|
const { handlers } = await setupServer();
|
|
617
617
|
|
|
@@ -628,7 +628,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
628
628
|
// Start a process
|
|
629
629
|
await callToolHandler!({
|
|
630
630
|
params: {
|
|
631
|
-
name: '
|
|
631
|
+
name: 'run',
|
|
632
632
|
arguments: {
|
|
633
633
|
prompt: 'test prompt',
|
|
634
634
|
workFolder: '/tmp'
|
|
@@ -639,7 +639,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
639
639
|
// Kill the process
|
|
640
640
|
const killResult = await callToolHandler!({
|
|
641
641
|
params: {
|
|
642
|
-
name: '
|
|
642
|
+
name: 'kill_process',
|
|
643
643
|
arguments: {
|
|
644
644
|
pid: 12351
|
|
645
645
|
}
|
|
@@ -668,7 +668,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
668
668
|
// Start and complete a process
|
|
669
669
|
await callToolHandler!({
|
|
670
670
|
params: {
|
|
671
|
-
name: '
|
|
671
|
+
name: 'run',
|
|
672
672
|
arguments: {
|
|
673
673
|
prompt: 'test prompt',
|
|
674
674
|
workFolder: '/tmp'
|
|
@@ -682,7 +682,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
682
682
|
// Try to kill the already completed process
|
|
683
683
|
const killResult = await callToolHandler!({
|
|
684
684
|
params: {
|
|
685
|
-
name: '
|
|
685
|
+
name: 'kill_process',
|
|
686
686
|
arguments: {
|
|
687
687
|
pid: 12352
|
|
688
688
|
}
|
|
@@ -702,7 +702,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
702
702
|
|
|
703
703
|
await expect(callToolHandler!({
|
|
704
704
|
params: {
|
|
705
|
-
name: '
|
|
705
|
+
name: 'kill_process',
|
|
706
706
|
arguments: {
|
|
707
707
|
pid: 99999
|
|
708
708
|
}
|
|
@@ -743,7 +743,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
743
743
|
// Start a process
|
|
744
744
|
await callToolHandler!({
|
|
745
745
|
params: {
|
|
746
|
-
name: '
|
|
746
|
+
name: 'run',
|
|
747
747
|
arguments: {
|
|
748
748
|
prompt: 'test prompt',
|
|
749
749
|
workFolder: '/tmp'
|
|
@@ -757,7 +757,7 @@ Unicodeテスト: 🎌 🗾 ✨
|
|
|
757
757
|
// Get result to check error was recorded
|
|
758
758
|
const result = await callToolHandler!({
|
|
759
759
|
params: {
|
|
760
|
-
name: '
|
|
760
|
+
name: 'get_result',
|
|
761
761
|
arguments: {
|
|
762
762
|
pid: 12353
|
|
763
763
|
}
|