@gotza02/seq-thinking 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -27
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp-server.js +1 -1
- package/package.json +8 -2
- package/agents_test.log +0 -15
- package/data/agents/1770106504306-dljh9ef.json +0 -68
- package/data/agents/1770106504310-4oarrst.json +0 -58
- package/data/agents/1770106540588-pvitt55.json +0 -68
- package/data/agents/1770106540595-z2ya871.json +0 -58
- package/data/agents/1770106710890-0e2naq1.json +0 -68
- package/data/agents/1770106710893-r076yxx.json +0 -58
- package/data/agents/1770109212161-4ybd0i7.json +0 -68
- package/data/agents/1770109212166-gkhya8h.json +0 -58
- package/data/agents/1770117726716-lrnm415.json +0 -68
- package/data/agents/1770117726719-w6hsf3v.json +0 -58
- package/data/sessions/1770100622009-5afiuyv.json +0 -499
- package/data/sessions/1770106504312-75zk750.json +0 -107
- package/data/sessions/1770106540597-z8e8soo.json +0 -150
- package/data/sessions/1770106710894-0kxgy5x.json +0 -150
- package/data/sessions/1770109212169-zpddeb9.json +0 -150
- package/data/sessions/1770117726720-frcwj99.json +0 -150
- package/real_world_test.log +0 -200
- package/real_world_test_dynamic.log +0 -184
- package/real_world_test_real.log +0 -184
- package/src/__tests__/agents.test.ts +0 -858
- package/src/__tests__/mcp-server.test.ts +0 -380
- package/src/__tests__/sequential-thinking.test.ts +0 -687
- package/src/__tests__/swarm-coordinator.test.ts +0 -903
- package/src/__tests__/types.test.ts +0 -839
- package/src/__tests__/utils.test.ts +0 -322
- package/src/agents/base-agent.ts +0 -288
- package/src/agents/critic-agent.ts +0 -582
- package/src/agents/index.ts +0 -11
- package/src/agents/meta-reasoning-agent.ts +0 -314
- package/src/agents/reasoner-agent.ts +0 -312
- package/src/agents/synthesizer-agent.ts +0 -641
- package/src/index.ts +0 -118
- package/src/mcp-server.ts +0 -391
- package/src/real_world_test.ts +0 -89
- package/src/sequential-thinking.ts +0 -614
- package/src/swarm-coordinator.ts +0 -772
- package/src/types/index.ts +0 -915
- package/src/utils/index.ts +0 -1004
- package/src/utils/llm-adapter.ts +0 -110
- package/src/utils/logger.ts +0 -56
- package/src/utils/persistence.ts +0 -109
- package/test_output.log +0 -0
- package/tsconfig.json +0 -21
|
@@ -1,380 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Server Test Suite
|
|
3
|
-
* Tests for MCP server including tool registration, operation handlers, and error handling
|
|
4
|
-
*/
|
|
5
|
-
import { test, describe, beforeEach } from 'node:test';
|
|
6
|
-
import assert from 'node:assert';
|
|
7
|
-
import { MCPServer } from '../mcp-server.js';
|
|
8
|
-
|
|
9
|
-
describe('MCPServer', () => {
|
|
10
|
-
let server: MCPServer;
|
|
11
|
-
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
server = new MCPServer();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
test('should create server instance', () => {
|
|
17
|
-
assert.ok(server);
|
|
18
|
-
assert.ok(server instanceof MCPServer);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('should start server', async () => {
|
|
22
|
-
// Start may be async and implementation-dependent
|
|
23
|
-
// We test that it doesn't throw
|
|
24
|
-
try {
|
|
25
|
-
// Server start might require actual transport, so we just verify the method exists
|
|
26
|
-
assert.ok(typeof server.start === 'function');
|
|
27
|
-
} catch (error) {
|
|
28
|
-
// Starting may fail in test environment without proper transport
|
|
29
|
-
assert.ok(error instanceof Error);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test('should have sequential thinking handler', () => {
|
|
34
|
-
// Verify server has the expected handlers by checking the instance
|
|
35
|
-
assert.ok(server);
|
|
36
|
-
// The handlers are private, but we can verify the server structure
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test('should have swarm coordination handler', () => {
|
|
40
|
-
assert.ok(server);
|
|
41
|
-
// The handlers are private, but we can verify the server structure
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
describe('MCP Server Tool Registration', () => {
|
|
46
|
-
test('should support sequential_thinking tool', () => {
|
|
47
|
-
const server = new MCPServer();
|
|
48
|
-
assert.ok(server);
|
|
49
|
-
// Tool registration happens in constructor/setupHandlers
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test('should support swarm_coordination tool', () => {
|
|
53
|
-
const server = new MCPServer();
|
|
54
|
-
assert.ok(server);
|
|
55
|
-
// Tool registration happens in constructor/setupHandlers
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test('should support session_management tool', () => {
|
|
59
|
-
const server = new MCPServer();
|
|
60
|
-
assert.ok(server);
|
|
61
|
-
// Tool registration happens in constructor/setupHandlers
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test('should support thought_graph tool', () => {
|
|
65
|
-
const server = new MCPServer();
|
|
66
|
-
assert.ok(server);
|
|
67
|
-
// Tool registration happens in constructor/setupHandlers
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('MCP Server Operations', () => {
|
|
72
|
-
let server: MCPServer;
|
|
73
|
-
|
|
74
|
-
beforeEach(() => {
|
|
75
|
-
server = new MCPServer();
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test('should handle create_session operation', async () => {
|
|
79
|
-
// This would test the actual handler if we could access it
|
|
80
|
-
// For now, we verify the server structure
|
|
81
|
-
assert.ok(server);
|
|
82
|
-
|
|
83
|
-
// The operation would look like:
|
|
84
|
-
// const result = await server.handleOperation('create_session', { topic: 'Test' });
|
|
85
|
-
// assert.ok(result.sessionId);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
test('should handle add_thought operation', async () => {
|
|
89
|
-
assert.ok(server);
|
|
90
|
-
// Would test: server.handleOperation('add_thought', { sessionId, content })
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
test('should handle get_session operation', async () => {
|
|
94
|
-
assert.ok(server);
|
|
95
|
-
// Would test: server.handleOperation('get_session', { sessionId })
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
test('should handle complete_session operation', async () => {
|
|
99
|
-
assert.ok(server);
|
|
100
|
-
// Would test: server.handleOperation('complete_session', { sessionId })
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
test('should handle register_agent operation', async () => {
|
|
104
|
-
assert.ok(server);
|
|
105
|
-
// Would test: server.handleOperation('register_agent', { config })
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
test('should handle submit_task operation', async () => {
|
|
109
|
-
assert.ok(server);
|
|
110
|
-
// Would test: server.handleOperation('submit_task', { type, description, input })
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
test('should handle reach_consensus operation', async () => {
|
|
114
|
-
assert.ok(server);
|
|
115
|
-
// Would test: server.handleOperation('reach_consensus', { proposal, options })
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test('should handle identify_conflict operation', async () => {
|
|
119
|
-
assert.ok(server);
|
|
120
|
-
// Would test: server.handleOperation('identify_conflict', { type, description })
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
describe('MCP Server Error Handling', () => {
|
|
125
|
-
let server: MCPServer;
|
|
126
|
-
|
|
127
|
-
beforeEach(() => {
|
|
128
|
-
server = new MCPServer();
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
test('should handle invalid operation', async () => {
|
|
132
|
-
assert.ok(server);
|
|
133
|
-
// Would test error response for invalid operation
|
|
134
|
-
// const result = await server.handleOperation('invalid_op', {});
|
|
135
|
-
// assert.ok(result.error);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
test('should handle missing parameters', async () => {
|
|
139
|
-
assert.ok(server);
|
|
140
|
-
// Would test error response for missing required parameters
|
|
141
|
-
// const result = await server.handleOperation('create_session', {});
|
|
142
|
-
// assert.ok(result.error);
|
|
143
|
-
// assert.ok(result.error.includes('topic'));
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
test('should handle invalid session id', async () => {
|
|
147
|
-
assert.ok(server);
|
|
148
|
-
// Would test error response for non-existent session
|
|
149
|
-
// const result = await server.handleOperation('get_session', { sessionId: 'invalid' });
|
|
150
|
-
// assert.ok(result.error);
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
test('should handle invalid agent id', async () => {
|
|
154
|
-
assert.ok(server);
|
|
155
|
-
// Would test error response for non-existent agent
|
|
156
|
-
// const result = await server.handleOperation('get_agent', { agentId: 'invalid' });
|
|
157
|
-
// assert.ok(result.error);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
test('should handle operation timeout', async () => {
|
|
161
|
-
assert.ok(server);
|
|
162
|
-
// Would test timeout handling for long-running operations
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
test('should handle concurrent operations', async () => {
|
|
166
|
-
assert.ok(server);
|
|
167
|
-
// Would test handling multiple simultaneous operations
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
describe('MCP Server Integration', () => {
|
|
172
|
-
test('should create session and add thoughts', async () => {
|
|
173
|
-
const server = new MCPServer();
|
|
174
|
-
assert.ok(server);
|
|
175
|
-
|
|
176
|
-
// Integration test flow:
|
|
177
|
-
// 1. Create session
|
|
178
|
-
// 2. Add multiple thoughts
|
|
179
|
-
// 3. Get session status
|
|
180
|
-
// 4. Complete session
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
test('should register agents and submit tasks', async () => {
|
|
184
|
-
const server = new MCPServer();
|
|
185
|
-
assert.ok(server);
|
|
186
|
-
|
|
187
|
-
// Integration test flow:
|
|
188
|
-
// 1. Register multiple agents
|
|
189
|
-
// 2. Submit tasks
|
|
190
|
-
// 3. Verify task assignment
|
|
191
|
-
// 4. Get swarm stats
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
test('should handle full reasoning workflow', async () => {
|
|
195
|
-
const server = new MCPServer();
|
|
196
|
-
assert.ok(server);
|
|
197
|
-
|
|
198
|
-
// Full workflow:
|
|
199
|
-
// 1. Create thinking session
|
|
200
|
-
// 2. Add initial thought
|
|
201
|
-
// 3. Register reasoner agent
|
|
202
|
-
// 4. Submit reasoning task
|
|
203
|
-
// 5. Add reasoning result as thought
|
|
204
|
-
// 6. Register critic agent
|
|
205
|
-
// 7. Submit evaluation task
|
|
206
|
-
// 8. Complete session
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
test('should handle consensus workflow', async () => {
|
|
210
|
-
const server = new MCPServer();
|
|
211
|
-
assert.ok(server);
|
|
212
|
-
|
|
213
|
-
// Consensus workflow:
|
|
214
|
-
// 1. Register multiple agents
|
|
215
|
-
// 2. Submit consensus request
|
|
216
|
-
// 3. Verify consensus result
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
test('should handle conflict resolution workflow', async () => {
|
|
220
|
-
const server = new MCPServer();
|
|
221
|
-
assert.ok(server);
|
|
222
|
-
|
|
223
|
-
// Conflict resolution workflow:
|
|
224
|
-
// 1. Register agents with conflicting positions
|
|
225
|
-
// 2. Identify conflict
|
|
226
|
-
// 3. Resolve conflict
|
|
227
|
-
// 4. Verify resolution
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
describe('MCP Server State Management', () => {
|
|
232
|
-
test('should maintain session state', () => {
|
|
233
|
-
const server = new MCPServer();
|
|
234
|
-
assert.ok(server);
|
|
235
|
-
|
|
236
|
-
// Session state should persist across operations
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
test('should maintain agent registry', () => {
|
|
240
|
-
const server = new MCPServer();
|
|
241
|
-
assert.ok(server);
|
|
242
|
-
|
|
243
|
-
// Agent registry should persist across operations
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
test('should maintain task queue', () => {
|
|
247
|
-
const server = new MCPServer();
|
|
248
|
-
assert.ok(server);
|
|
249
|
-
|
|
250
|
-
// Task queue should persist across operations
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
describe('MCP Server Performance', () => {
|
|
255
|
-
test('should handle multiple sessions efficiently', async () => {
|
|
256
|
-
const server = new MCPServer();
|
|
257
|
-
assert.ok(server);
|
|
258
|
-
|
|
259
|
-
// Performance test: create many sessions
|
|
260
|
-
const sessionCount = 100;
|
|
261
|
-
// Would test: creating 100 sessions quickly
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
test('should handle many thoughts efficiently', async () => {
|
|
265
|
-
const server = new MCPServer();
|
|
266
|
-
assert.ok(server);
|
|
267
|
-
|
|
268
|
-
// Performance test: add many thoughts to a session
|
|
269
|
-
const thoughtCount = 1000;
|
|
270
|
-
// Would test: adding 1000 thoughts quickly
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
test('should handle many agents efficiently', async () => {
|
|
274
|
-
const server = new MCPServer();
|
|
275
|
-
assert.ok(server);
|
|
276
|
-
|
|
277
|
-
// Performance test: register many agents
|
|
278
|
-
const agentCount = 50;
|
|
279
|
-
// Would test: registering 50 agents quickly
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
test('should handle many tasks efficiently', async () => {
|
|
283
|
-
const server = new MCPServer();
|
|
284
|
-
assert.ok(server);
|
|
285
|
-
|
|
286
|
-
// Performance test: submit many tasks
|
|
287
|
-
const taskCount = 100;
|
|
288
|
-
// Would test: submitting 100 tasks quickly
|
|
289
|
-
});
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
describe('MCP Server Edge Cases', () => {
|
|
293
|
-
test('should handle empty topic', async () => {
|
|
294
|
-
const server = new MCPServer();
|
|
295
|
-
assert.ok(server);
|
|
296
|
-
// Would test: create_session with empty topic
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
test('should handle very long topic', async () => {
|
|
300
|
-
const server = new MCPServer();
|
|
301
|
-
assert.ok(server);
|
|
302
|
-
// Would test: create_session with 10000 character topic
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
test('should handle special characters in content', async () => {
|
|
306
|
-
const server = new MCPServer();
|
|
307
|
-
assert.ok(server);
|
|
308
|
-
// Would test: add_thought with special characters
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
test('should handle unicode content', async () => {
|
|
312
|
-
const server = new MCPServer();
|
|
313
|
-
assert.ok(server);
|
|
314
|
-
// Would test: add_thought with unicode characters
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
test('should handle nested objects in input', async () => {
|
|
318
|
-
const server = new MCPServer();
|
|
319
|
-
assert.ok(server);
|
|
320
|
-
// Would test: submit_task with deeply nested input
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
test('should handle circular references gracefully', async () => {
|
|
324
|
-
const server = new MCPServer();
|
|
325
|
-
assert.ok(server);
|
|
326
|
-
// Would test: handling circular references in input
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
test('should handle very large payloads', async () => {
|
|
330
|
-
const server = new MCPServer();
|
|
331
|
-
assert.ok(server);
|
|
332
|
-
// Would test: handling 1MB+ payloads
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
describe('MCP Server Security', () => {
|
|
337
|
-
test('should validate input types', async () => {
|
|
338
|
-
const server = new MCPServer();
|
|
339
|
-
assert.ok(server);
|
|
340
|
-
// Would test: type validation on inputs
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
test('should sanitize string inputs', async () => {
|
|
344
|
-
const server = new MCPServer();
|
|
345
|
-
assert.ok(server);
|
|
346
|
-
// Would test: string sanitization
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
test('should limit input size', async () => {
|
|
350
|
-
const server = new MCPServer();
|
|
351
|
-
assert.ok(server);
|
|
352
|
-
// Would test: input size limits
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
test('should prevent injection attacks', async () => {
|
|
356
|
-
const server = new MCPServer();
|
|
357
|
-
assert.ok(server);
|
|
358
|
-
// Would test: injection attack prevention
|
|
359
|
-
});
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
describe('MCP Server Resource Cleanup', () => {
|
|
363
|
-
test('should cleanup completed sessions', async () => {
|
|
364
|
-
const server = new MCPServer();
|
|
365
|
-
assert.ok(server);
|
|
366
|
-
// Would test: automatic cleanup of old sessions
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
test('should cleanup inactive agents', async () => {
|
|
370
|
-
const server = new MCPServer();
|
|
371
|
-
assert.ok(server);
|
|
372
|
-
// Would test: automatic cleanup of inactive agents
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
test('should cleanup completed tasks', async () => {
|
|
376
|
-
const server = new MCPServer();
|
|
377
|
-
assert.ok(server);
|
|
378
|
-
// Would test: automatic cleanup of completed tasks
|
|
379
|
-
});
|
|
380
|
-
});
|