@gotza02/seq-thinking 1.1.2 → 1.1.4
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 +64 -95
- package/data/agents/1770106504306-dljh9ef.json +68 -0
- package/data/agents/1770106504310-4oarrst.json +58 -0
- package/data/agents/1770106540588-pvitt55.json +68 -0
- package/data/agents/1770106540595-z2ya871.json +58 -0
- package/data/agents/1770106710890-0e2naq1.json +68 -0
- package/data/agents/1770106710893-r076yxx.json +58 -0
- package/data/agents/1770109212161-4ybd0i7.json +68 -0
- package/data/agents/1770109212166-gkhya8h.json +58 -0
- package/data/agents/1770117726716-lrnm415.json +68 -0
- package/data/agents/1770117726719-w6hsf3v.json +58 -0
- package/data/sessions/1770100622009-5afiuyv.json +499 -0
- package/data/sessions/1770106504312-75zk750.json +107 -0
- package/data/sessions/1770106540597-z8e8soo.json +150 -0
- package/data/sessions/1770106710894-0kxgy5x.json +150 -0
- package/data/sessions/1770109212169-zpddeb9.json +150 -0
- package/data/sessions/1770117726720-frcwj99.json +150 -0
- package/dist/__tests__/sequential-thinking.test.js +21 -21
- package/dist/__tests__/sequential-thinking.test.js.map +1 -1
- package/dist/agents/base-agent.d.ts +1 -0
- package/dist/agents/base-agent.d.ts.map +1 -1
- package/dist/agents/base-agent.js +5 -3
- package/dist/agents/base-agent.js.map +1 -1
- package/dist/agents/meta-reasoning-agent.d.ts +4 -55
- package/dist/agents/meta-reasoning-agent.d.ts.map +1 -1
- package/dist/agents/meta-reasoning-agent.js +41 -333
- package/dist/agents/meta-reasoning-agent.js.map +1 -1
- package/dist/agents/synthesizer-agent.d.ts +3 -17
- package/dist/agents/synthesizer-agent.d.ts.map +1 -1
- package/dist/agents/synthesizer-agent.js +41 -139
- package/dist/agents/synthesizer-agent.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +10 -7
- package/dist/mcp-server.js.map +1 -1
- package/dist/real_world_test.d.ts +2 -0
- package/dist/real_world_test.d.ts.map +1 -0
- package/dist/real_world_test.js +78 -0
- package/dist/real_world_test.js.map +1 -0
- package/dist/sequential-thinking.d.ts +5 -5
- package/dist/sequential-thinking.d.ts.map +1 -1
- package/dist/sequential-thinking.js +68 -32
- package/dist/sequential-thinking.js.map +1 -1
- package/dist/swarm-coordinator.d.ts +1 -1
- package/dist/swarm-coordinator.d.ts.map +1 -1
- package/dist/swarm-coordinator.js +39 -13
- package/dist/swarm-coordinator.js.map +1 -1
- package/dist/utils/llm-adapter.d.ts +2 -2
- package/dist/utils/llm-adapter.d.ts.map +1 -1
- package/dist/utils/llm-adapter.js +57 -33
- package/dist/utils/llm-adapter.js.map +1 -1
- package/dist/utils/logger.d.ts +20 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +49 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/persistence.d.ts.map +1 -1
- package/dist/utils/persistence.js +4 -3
- package/dist/utils/persistence.js.map +1 -1
- package/package.json +1 -1
- package/real_world_test.log +200 -0
- package/real_world_test_dynamic.log +184 -0
- package/real_world_test_real.log +184 -0
- package/src/__tests__/sequential-thinking.test.ts +21 -21
- package/src/agents/base-agent.ts +6 -3
- package/src/agents/meta-reasoning-agent.ts +45 -403
- package/src/agents/synthesizer-agent.ts +48 -165
- package/src/index.ts +1 -1
- package/src/mcp-server.ts +10 -7
- package/src/real_world_test.ts +89 -0
- package/src/sequential-thinking.ts +87 -33
- package/src/swarm-coordinator.ts +41 -13
- package/src/utils/llm-adapter.ts +66 -32
- package/src/utils/logger.ts +56 -0
- package/src/utils/persistence.ts +4 -3
|
@@ -292,9 +292,9 @@ describe('MetaReasoningEngine', () => {
|
|
|
292
292
|
graph = new ThoughtGraph();
|
|
293
293
|
});
|
|
294
294
|
|
|
295
|
-
test('should reflect on session', () => {
|
|
295
|
+
test('should reflect on session', async () => {
|
|
296
296
|
const session = createMockSession();
|
|
297
|
-
const reflection = engine.reflect(session);
|
|
297
|
+
const reflection = await engine.reflect(session);
|
|
298
298
|
|
|
299
299
|
assert.ok(reflection.reflectionType);
|
|
300
300
|
assert.ok(reflection.content);
|
|
@@ -318,18 +318,18 @@ describe('MetaReasoningEngine', () => {
|
|
|
318
318
|
}
|
|
319
319
|
});
|
|
320
320
|
|
|
321
|
-
test('should handle empty session reflection', () => {
|
|
321
|
+
test('should handle empty session reflection', async () => {
|
|
322
322
|
const emptySession = createMockSession({ totalThoughts: 0, totalBranches: 0 });
|
|
323
|
-
const reflection = engine.reflect(emptySession);
|
|
323
|
+
const reflection = await engine.reflect(emptySession);
|
|
324
324
|
|
|
325
325
|
assert.ok(reflection);
|
|
326
326
|
assert.ok(Array.isArray(reflection.insights));
|
|
327
327
|
assert.ok(Array.isArray(reflection.recommendations));
|
|
328
328
|
});
|
|
329
329
|
|
|
330
|
-
test('should handle session with multiple branches', () => {
|
|
330
|
+
test('should handle session with multiple branches', async () => {
|
|
331
331
|
const session = createMockSession({ totalThoughts: 10, totalBranches: 3 });
|
|
332
|
-
const reflection = engine.reflect(session);
|
|
332
|
+
const reflection = await engine.reflect(session);
|
|
333
333
|
|
|
334
334
|
assert.ok(reflection.insights.length > 0 || reflection.recommendations.length > 0);
|
|
335
335
|
});
|
|
@@ -344,11 +344,11 @@ describe('SelfCorrectionEngine', () => {
|
|
|
344
344
|
graph = new ThoughtGraph();
|
|
345
345
|
});
|
|
346
346
|
|
|
347
|
-
test('should detect issues in thought', () => {
|
|
347
|
+
test('should detect issues in thought', async () => {
|
|
348
348
|
const sessionId = 'test-session';
|
|
349
349
|
const thought = graph.createThought(sessionId, 'Test thought with potential issues');
|
|
350
350
|
|
|
351
|
-
const issues = engine.detectIssues(thought, graph);
|
|
351
|
+
const issues = await engine.detectIssues(thought, graph);
|
|
352
352
|
|
|
353
353
|
assert.ok(Array.isArray(issues));
|
|
354
354
|
issues.forEach(issue => {
|
|
@@ -359,14 +359,14 @@ describe('SelfCorrectionEngine', () => {
|
|
|
359
359
|
});
|
|
360
360
|
});
|
|
361
361
|
|
|
362
|
-
test('should detect no issues in well-formed thought', () => {
|
|
362
|
+
test('should detect no issues in well-formed thought', async () => {
|
|
363
363
|
const sessionId = 'test-session';
|
|
364
364
|
const thought = graph.createThought(sessionId, 'Well-formed thought with clear reasoning', {
|
|
365
365
|
confidence: 0.95,
|
|
366
366
|
assumptions: ['valid-assumption'],
|
|
367
367
|
});
|
|
368
368
|
|
|
369
|
-
const issues = engine.detectIssues(thought, graph);
|
|
369
|
+
const issues = await engine.detectIssues(thought, graph);
|
|
370
370
|
|
|
371
371
|
// Should either return empty array or only low severity issues
|
|
372
372
|
issues.forEach(issue => {
|
|
@@ -418,30 +418,30 @@ describe('AdaptiveGranularityEngine', () => {
|
|
|
418
418
|
engine = new AdaptiveGranularityEngine();
|
|
419
419
|
});
|
|
420
420
|
|
|
421
|
-
test('should calculate granularity for simple topic', () => {
|
|
421
|
+
test('should calculate granularity for simple topic', async () => {
|
|
422
422
|
const context = createMockContext();
|
|
423
|
-
const result = engine.calculateGranularity('Simple topic', context, 1);
|
|
423
|
+
const result = await engine.calculateGranularity('Simple topic', context, 1);
|
|
424
424
|
|
|
425
425
|
assert.ok(typeof result.detail === 'number');
|
|
426
426
|
assert.ok(result.detail > 0 && result.detail <= 1);
|
|
427
427
|
assert.ok(result.reasoning);
|
|
428
428
|
});
|
|
429
429
|
|
|
430
|
-
test('should calculate granularity for complex topic', () => {
|
|
430
|
+
test('should calculate granularity for complex topic', async () => {
|
|
431
431
|
const context = createMockContext();
|
|
432
432
|
const complexTopic = 'Analyze the implications of quantum computing on cryptographic systems';
|
|
433
|
-
const result = engine.calculateGranularity(complexTopic, context, 1);
|
|
433
|
+
const result = await engine.calculateGranularity(complexTopic, context, 1);
|
|
434
434
|
|
|
435
435
|
assert.ok(result.detail > 0);
|
|
436
436
|
assert.ok(result.reasoning.length > 0);
|
|
437
437
|
});
|
|
438
438
|
|
|
439
|
-
test('should adjust granularity based on depth', () => {
|
|
439
|
+
test('should adjust granularity based on depth', async () => {
|
|
440
440
|
const context = createMockContext();
|
|
441
441
|
const topic = 'Test topic';
|
|
442
442
|
|
|
443
|
-
const shallow = engine.calculateGranularity(topic, context, 1);
|
|
444
|
-
const deep = engine.calculateGranularity(topic, context, 10);
|
|
443
|
+
const shallow = await engine.calculateGranularity(topic, context, 1);
|
|
444
|
+
const deep = await engine.calculateGranularity(topic, context, 10);
|
|
445
445
|
|
|
446
446
|
// Deeper depth might suggest different granularity
|
|
447
447
|
assert.ok(typeof shallow.detail === 'number');
|
|
@@ -458,7 +458,7 @@ describe('AdaptiveGranularityEngine', () => {
|
|
|
458
458
|
assert.ok(recommendation.reasoning);
|
|
459
459
|
});
|
|
460
460
|
|
|
461
|
-
test('should handle empty context', () => {
|
|
461
|
+
test('should handle empty context', async () => {
|
|
462
462
|
const emptyContext: SessionContext = {
|
|
463
463
|
originalProblem: '',
|
|
464
464
|
constraints: [],
|
|
@@ -467,13 +467,13 @@ describe('AdaptiveGranularityEngine', () => {
|
|
|
467
467
|
longTermReferences: [],
|
|
468
468
|
};
|
|
469
469
|
|
|
470
|
-
const result = engine.calculateGranularity('Topic', emptyContext, 1);
|
|
470
|
+
const result = await engine.calculateGranularity('Topic', emptyContext, 1);
|
|
471
471
|
|
|
472
472
|
assert.ok(typeof result.detail === 'number');
|
|
473
473
|
assert.ok(result.reasoning);
|
|
474
474
|
});
|
|
475
475
|
|
|
476
|
-
test('should handle very complex context', () => {
|
|
476
|
+
test('should handle very complex context', async () => {
|
|
477
477
|
const complexContext: SessionContext = {
|
|
478
478
|
originalProblem: 'Complex multi-faceted problem',
|
|
479
479
|
constraints: Array(20).fill('constraint'),
|
|
@@ -482,7 +482,7 @@ describe('AdaptiveGranularityEngine', () => {
|
|
|
482
482
|
longTermReferences: Array(10).fill('ref'),
|
|
483
483
|
};
|
|
484
484
|
|
|
485
|
-
const result = engine.calculateGranularity('Complex topic', complexContext, 5);
|
|
485
|
+
const result = await engine.calculateGranularity('Complex topic', complexContext, 5);
|
|
486
486
|
|
|
487
487
|
assert.ok(typeof result.detail === 'number');
|
|
488
488
|
assert.ok(result.detail > 0 && result.detail <= 1);
|
package/src/agents/base-agent.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type TaskResult,
|
|
14
14
|
type SwarmMessage
|
|
15
15
|
} from '../types/index.js';
|
|
16
|
+
import { Logger } from '../utils/logger.js';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Abstract base class for all agents
|
|
@@ -142,11 +143,11 @@ export abstract class BaseAgent {
|
|
|
142
143
|
const result = handler(message);
|
|
143
144
|
if (result instanceof Promise) {
|
|
144
145
|
result.catch(error => {
|
|
145
|
-
|
|
146
|
+
Logger.error(`Error in message handler for agent ${this.id}`, { error });
|
|
146
147
|
});
|
|
147
148
|
}
|
|
148
149
|
} catch (error) {
|
|
149
|
-
|
|
150
|
+
Logger.error(`Error in message handler for agent ${this.id}`, { error });
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
}
|
|
@@ -254,6 +255,7 @@ export abstract class BaseAgent {
|
|
|
254
255
|
tokensUsed?: number;
|
|
255
256
|
reasoningSteps?: number;
|
|
256
257
|
intermediateResults?: unknown[];
|
|
258
|
+
error?: string;
|
|
257
259
|
} = {}
|
|
258
260
|
): TaskResult {
|
|
259
261
|
return {
|
|
@@ -266,7 +268,8 @@ export abstract class BaseAgent {
|
|
|
266
268
|
metadata: {
|
|
267
269
|
tokensUsed: metadata.tokensUsed || 0,
|
|
268
270
|
reasoningSteps: metadata.reasoningSteps || 1,
|
|
269
|
-
intermediateResults: metadata.intermediateResults || []
|
|
271
|
+
intermediateResults: metadata.intermediateResults || [],
|
|
272
|
+
error: metadata.error
|
|
270
273
|
}
|
|
271
274
|
};
|
|
272
275
|
}
|