@gotza02/seq-thinking 1.1.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.
Files changed (106) hide show
  1. package/README.md +149 -0
  2. package/SYSTEM_INSTRUCTIONS.md +50 -0
  3. package/agents_test.log +15 -0
  4. package/dist/__tests__/agents.test.d.ts +2 -0
  5. package/dist/__tests__/agents.test.d.ts.map +1 -0
  6. package/dist/__tests__/agents.test.js +673 -0
  7. package/dist/__tests__/agents.test.js.map +1 -0
  8. package/dist/__tests__/mcp-server.test.d.ts +2 -0
  9. package/dist/__tests__/mcp-server.test.d.ts.map +1 -0
  10. package/dist/__tests__/mcp-server.test.js +315 -0
  11. package/dist/__tests__/mcp-server.test.js.map +1 -0
  12. package/dist/__tests__/sequential-thinking.test.d.ts +2 -0
  13. package/dist/__tests__/sequential-thinking.test.d.ts.map +1 -0
  14. package/dist/__tests__/sequential-thinking.test.js +545 -0
  15. package/dist/__tests__/sequential-thinking.test.js.map +1 -0
  16. package/dist/__tests__/swarm-coordinator.test.d.ts +2 -0
  17. package/dist/__tests__/swarm-coordinator.test.d.ts.map +1 -0
  18. package/dist/__tests__/swarm-coordinator.test.js +606 -0
  19. package/dist/__tests__/swarm-coordinator.test.js.map +1 -0
  20. package/dist/__tests__/types.test.d.ts +2 -0
  21. package/dist/__tests__/types.test.d.ts.map +1 -0
  22. package/dist/__tests__/types.test.js +741 -0
  23. package/dist/__tests__/types.test.js.map +1 -0
  24. package/dist/__tests__/utils.test.d.ts +2 -0
  25. package/dist/__tests__/utils.test.d.ts.map +1 -0
  26. package/dist/__tests__/utils.test.js +264 -0
  27. package/dist/__tests__/utils.test.js.map +1 -0
  28. package/dist/agents/base-agent.d.ts +126 -0
  29. package/dist/agents/base-agent.d.ts.map +1 -0
  30. package/dist/agents/base-agent.js +214 -0
  31. package/dist/agents/base-agent.js.map +1 -0
  32. package/dist/agents/critic-agent.d.ts +134 -0
  33. package/dist/agents/critic-agent.d.ts.map +1 -0
  34. package/dist/agents/critic-agent.js +484 -0
  35. package/dist/agents/critic-agent.js.map +1 -0
  36. package/dist/agents/index.d.ts +11 -0
  37. package/dist/agents/index.d.ts.map +1 -0
  38. package/dist/agents/index.js +11 -0
  39. package/dist/agents/index.js.map +1 -0
  40. package/dist/agents/meta-reasoning-agent.d.ts +143 -0
  41. package/dist/agents/meta-reasoning-agent.d.ts.map +1 -0
  42. package/dist/agents/meta-reasoning-agent.js +532 -0
  43. package/dist/agents/meta-reasoning-agent.js.map +1 -0
  44. package/dist/agents/reasoner-agent.d.ts +75 -0
  45. package/dist/agents/reasoner-agent.d.ts.map +1 -0
  46. package/dist/agents/reasoner-agent.js +226 -0
  47. package/dist/agents/reasoner-agent.js.map +1 -0
  48. package/dist/agents/synthesizer-agent.d.ts +174 -0
  49. package/dist/agents/synthesizer-agent.d.ts.map +1 -0
  50. package/dist/agents/synthesizer-agent.js +583 -0
  51. package/dist/agents/synthesizer-agent.js.map +1 -0
  52. package/dist/index.d.ts +21 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/dist/index.js +27 -0
  55. package/dist/index.js.map +1 -0
  56. package/dist/mcp-server.d.ts +823 -0
  57. package/dist/mcp-server.d.ts.map +1 -0
  58. package/dist/mcp-server.js +377 -0
  59. package/dist/mcp-server.js.map +1 -0
  60. package/dist/sequential-thinking.d.ts +91 -0
  61. package/dist/sequential-thinking.d.ts.map +1 -0
  62. package/dist/sequential-thinking.js +540 -0
  63. package/dist/sequential-thinking.js.map +1 -0
  64. package/dist/swarm-coordinator.d.ts +188 -0
  65. package/dist/swarm-coordinator.d.ts.map +1 -0
  66. package/dist/swarm-coordinator.js +627 -0
  67. package/dist/swarm-coordinator.js.map +1 -0
  68. package/dist/types/index.d.ts +806 -0
  69. package/dist/types/index.d.ts.map +1 -0
  70. package/dist/types/index.js +279 -0
  71. package/dist/types/index.js.map +1 -0
  72. package/dist/utils/index.d.ts +421 -0
  73. package/dist/utils/index.d.ts.map +1 -0
  74. package/dist/utils/index.js +864 -0
  75. package/dist/utils/index.js.map +1 -0
  76. package/dist/utils/llm-adapter.d.ts +23 -0
  77. package/dist/utils/llm-adapter.d.ts.map +1 -0
  78. package/dist/utils/llm-adapter.js +68 -0
  79. package/dist/utils/llm-adapter.js.map +1 -0
  80. package/dist/utils/persistence.d.ts +33 -0
  81. package/dist/utils/persistence.d.ts.map +1 -0
  82. package/dist/utils/persistence.js +108 -0
  83. package/dist/utils/persistence.js.map +1 -0
  84. package/package.json +41 -0
  85. package/src/__tests__/agents.test.ts +858 -0
  86. package/src/__tests__/mcp-server.test.ts +380 -0
  87. package/src/__tests__/sequential-thinking.test.ts +687 -0
  88. package/src/__tests__/swarm-coordinator.test.ts +903 -0
  89. package/src/__tests__/types.test.ts +839 -0
  90. package/src/__tests__/utils.test.ts +322 -0
  91. package/src/agents/base-agent.ts +285 -0
  92. package/src/agents/critic-agent.ts +582 -0
  93. package/src/agents/index.ts +11 -0
  94. package/src/agents/meta-reasoning-agent.ts +672 -0
  95. package/src/agents/reasoner-agent.ts +312 -0
  96. package/src/agents/synthesizer-agent.ts +758 -0
  97. package/src/index.ts +118 -0
  98. package/src/mcp-server.ts +387 -0
  99. package/src/sequential-thinking.ts +560 -0
  100. package/src/swarm-coordinator.ts +744 -0
  101. package/src/types/index.ts +915 -0
  102. package/src/utils/index.ts +1004 -0
  103. package/src/utils/llm-adapter.ts +76 -0
  104. package/src/utils/persistence.ts +108 -0
  105. package/test_output.log +0 -0
  106. package/tsconfig.json +21 -0
@@ -0,0 +1,806 @@
1
+ /**
2
+ * Core Type Definitions for MCP Sequential Thinking System
3
+ * @module types
4
+ * @version 1.0.0
5
+ */
6
+ /**
7
+ * Enumeration of thought types for classification and routing
8
+ */
9
+ export declare enum ThoughtType {
10
+ /** Proposed explanation or theory */
11
+ HYPOTHESIS = "hypothesis",
12
+ /** Breaking down complex information */
13
+ ANALYSIS = "analysis",
14
+ /** Combining multiple thoughts */
15
+ SYNTHESIS = "synthesis",
16
+ /** Final determination */
17
+ CONCLUSION = "conclusion",
18
+ /** Thinking about the thinking process */
19
+ META_REASONING = "meta_reasoning",
20
+ /** Identifying and fixing errors */
21
+ SELF_CORRECTION = "self_correction",
22
+ /** Expressing doubt or unknowns */
23
+ UNCERTAINTY = "uncertainty",
24
+ /** Inquiry to explore */
25
+ QUESTION = "question",
26
+ /** Supporting information */
27
+ EVIDENCE = "evidence",
28
+ /** Opposing viewpoint */
29
+ COUNTERARGUMENT = "counterargument",
30
+ /** Base premise */
31
+ ASSUMPTION = "assumption",
32
+ /** Where parallel paths diverge */
33
+ BRANCH_POINT = "branch_point",
34
+ /** Where paths converge */
35
+ MERGE_POINT = "merge_point",
36
+ /** Modified version of prior thought */
37
+ REVISION = "revision"
38
+ }
39
+ /**
40
+ * Enumeration of agent types
41
+ */
42
+ export declare enum AgentType {
43
+ /** Reasoning agent */
44
+ REASONER = "reasoner",
45
+ /** Critic/Evaluation agent */
46
+ CRITIC = "critic",
47
+ /** Synthesis agent */
48
+ SYNTHESIZER = "synthesizer",
49
+ /** Domain specialist agent */
50
+ SPECIALIST = "specialist",
51
+ /** Meta-reasoning agent */
52
+ META_REASONING = "meta_reasoning",
53
+ /** Utility agent */
54
+ UTILITY = "utility"
55
+ }
56
+ /**
57
+ * Enumeration of reasoning strategies
58
+ */
59
+ export declare enum ReasoningStrategy {
60
+ /** Step-by-step reasoning */
61
+ CHAIN_OF_THOUGHT = "chain_of_thought",
62
+ /** Explore multiple paths */
63
+ TREE_OF_THOUGHT = "tree_of_thought",
64
+ /** Reason by analogy */
65
+ ANALOGICAL = "analogical",
66
+ /** Inference to best explanation */
67
+ ABDUCTIVE = "abductive"
68
+ }
69
+ /**
70
+ * Enumeration of critic types
71
+ */
72
+ export declare enum CriticType {
73
+ /** Check logical consistency */
74
+ LOGICAL = "logical",
75
+ /** Verify factual accuracy */
76
+ FACTUAL = "factual",
77
+ /** Detect cognitive biases */
78
+ BIAS = "bias",
79
+ /** Check safety concerns */
80
+ SAFETY = "safety"
81
+ }
82
+ /**
83
+ * Enumeration of synthesizer types
84
+ */
85
+ export declare enum SynthesizerType {
86
+ /** Build consensus */
87
+ CONSENSUS = "consensus",
88
+ /** Creative combination */
89
+ CREATIVE = "creative",
90
+ /** Resolve conflicts */
91
+ CONFLICT_RESOLUTION = "conflict_resolution"
92
+ }
93
+ /**
94
+ * Enumeration of message types
95
+ */
96
+ export declare enum MessageType {
97
+ /** Task assignment message */
98
+ TASK_ASSIGNMENT = "task_assignment",
99
+ /** Task result message */
100
+ TASK_RESULT = "task_result",
101
+ /** Broadcast to all agents */
102
+ BROADCAST = "broadcast",
103
+ /** Direct message to specific agent */
104
+ DIRECT = "direct",
105
+ /** Request for consensus */
106
+ CONSENSUS_REQUEST = "consensus_request",
107
+ /** Consensus vote */
108
+ CONSENSUS_VOTE = "consensus_vote",
109
+ /** Conflict notification */
110
+ CONFLICT_NOTIFICATION = "conflict_notification",
111
+ /** Heartbeat/ping */
112
+ HEARTBEAT = "heartbeat"
113
+ }
114
+ /**
115
+ * Enumeration of consensus algorithms
116
+ */
117
+ export declare enum ConsensusAlgorithm {
118
+ /** Simple majority vote */
119
+ MAJORITY_VOTE = "majority_vote",
120
+ /** Weighted by expertise/confidence */
121
+ WEIGHTED_VOTE = "weighted_vote",
122
+ /** Borda count ranking */
123
+ BORDA_COUNT = "borda_count",
124
+ /** Condorcet method */
125
+ CONDORCET = "condorcet",
126
+ /** Iterative Delphi method */
127
+ DELPHI_METHOD = "delphi_method",
128
+ /** Prediction market style */
129
+ PREDICTION_MARKET = "prediction_market"
130
+ }
131
+ /**
132
+ * Enumeration of conflict resolution strategies
133
+ */
134
+ export declare enum ConflictResolutionStrategy {
135
+ /** Facilitated discussion */
136
+ MEDIATION = "mediation",
137
+ /** Third-party decision */
138
+ ARBITRATION = "arbitration",
139
+ /** Voting-based resolution */
140
+ VOTING = "voting",
141
+ /** Escalate to expert */
142
+ EXPERT_ESCALATION = "expert_escalation",
143
+ /** Find middle ground */
144
+ COMPROMISE = "compromise",
145
+ /** Evidence-based resolution */
146
+ EVIDENCE_BASED = "evidence_based"
147
+ }
148
+ /**
149
+ * Enumeration of task statuses
150
+ */
151
+ export declare enum TaskStatus {
152
+ /** Task is pending */
153
+ PENDING = "pending",
154
+ /** Task is assigned to agent */
155
+ ASSIGNED = "assigned",
156
+ /** Task is in progress */
157
+ IN_PROGRESS = "in_progress",
158
+ /** Task is completed */
159
+ COMPLETED = "completed",
160
+ /** Task failed */
161
+ FAILED = "failed",
162
+ /** Task was cancelled */
163
+ CANCELLED = "cancelled"
164
+ }
165
+ /**
166
+ * Enumeration of agent statuses
167
+ */
168
+ export declare enum AgentStatus {
169
+ /** Agent is idle */
170
+ IDLE = "idle",
171
+ /** Agent is busy */
172
+ BUSY = "busy",
173
+ /** Agent is offline */
174
+ OFFLINE = "offline",
175
+ /** Agent is error state */
176
+ ERROR = "error",
177
+ /** Agent is initializing */
178
+ INITIALIZING = "initializing"
179
+ }
180
+ /**
181
+ * Enumeration of branch statuses
182
+ */
183
+ export declare enum BranchStatus {
184
+ /** Branch is active */
185
+ ACTIVE = "active",
186
+ /** Branch is completed */
187
+ COMPLETED = "completed",
188
+ /** Branch is merged */
189
+ MERGED = "merged",
190
+ /** Branch is pruned */
191
+ PRUNED = "pruned",
192
+ /** Branch is abandoned */
193
+ ABANDONED = "abandoned"
194
+ }
195
+ /**
196
+ * Enumeration of session statuses
197
+ */
198
+ export declare enum SessionStatus {
199
+ /** Session is initializing */
200
+ INITIALIZING = "initializing",
201
+ /** Session is active */
202
+ ACTIVE = "active",
203
+ /** Session is paused */
204
+ PAUSED = "paused",
205
+ /** Session is converging */
206
+ CONVERGING = "converging",
207
+ /** Session is completed */
208
+ COMPLETED = "completed",
209
+ /** Session is abandoned */
210
+ ABANDONED = "abandoned"
211
+ }
212
+ /**
213
+ * Enumeration of conflict statuses
214
+ */
215
+ export declare enum ConflictStatus {
216
+ /** Conflict is detected */
217
+ DETECTED = "detected",
218
+ /** Conflict is being analyzed */
219
+ ANALYZING = "analyzing",
220
+ /** Conflict is being resolved */
221
+ RESOLVING = "resolving",
222
+ /** Conflict is resolved */
223
+ RESOLVED = "resolved",
224
+ /** Conflict resolution failed */
225
+ FAILED = "failed"
226
+ }
227
+ /**
228
+ * Confidence score with calibration data
229
+ */
230
+ export interface ConfidenceScore {
231
+ /** Primary score (0.0 - 1.0) */
232
+ overall: number;
233
+ /** Component scores */
234
+ components: {
235
+ /** Internal logic check */
236
+ logicalConsistency: number;
237
+ /** Factual accuracy */
238
+ factualAccuracy: number;
239
+ /** Quality of reasoning */
240
+ reasoningQuality: number;
241
+ /** Strength of evidence */
242
+ evidenceStrength: number;
243
+ };
244
+ /** Uncertainty bounds [lower, upper] */
245
+ uncertaintyBounds: [number, number];
246
+ /** Calibration history */
247
+ calibrationHistory: CalibrationPoint[];
248
+ }
249
+ /**
250
+ * Single calibration data point
251
+ */
252
+ export interface CalibrationPoint {
253
+ /** Timestamp of calibration */
254
+ timestamp: Date;
255
+ /** Prior confidence value */
256
+ priorConfidence: number;
257
+ /** Outcome - was the thought correct? */
258
+ outcome: boolean;
259
+ /** Adjusted confidence after outcome */
260
+ adjustedConfidence: number;
261
+ /** Reason for adjustment */
262
+ reason: string;
263
+ /** Adjustment amount */
264
+ adjustment?: number;
265
+ }
266
+ /**
267
+ * Core thought node structure
268
+ */
269
+ export interface Thought {
270
+ /** Unique identifier */
271
+ id: string;
272
+ /** Session ID */
273
+ sessionId: string;
274
+ /** Thought content */
275
+ content: string;
276
+ /** Sequential position */
277
+ stepNumber: number;
278
+ /** Type of thought */
279
+ thoughtType: ThoughtType;
280
+ /** Confidence score */
281
+ confidence: ConfidenceScore;
282
+ /** Parent thought ID */
283
+ parentThoughtId: string | null;
284
+ /** Child thought IDs */
285
+ childThoughtIds: string[];
286
+ /** Branch ID */
287
+ branchId: string;
288
+ /** Original thought ID if this is a revision */
289
+ revisionOf: string | null;
290
+ /** Revision history */
291
+ revisionHistory: RevisionRecord[];
292
+ /** Metadata */
293
+ metadata: {
294
+ createdAt: Date;
295
+ modifiedAt: Date;
296
+ agentId?: string;
297
+ processingTimeMs: number;
298
+ tokensUsed: number;
299
+ };
300
+ /** Tags */
301
+ tags: string[];
302
+ /** Assumptions */
303
+ assumptions: string[];
304
+ /** Dependencies */
305
+ dependencies: string[];
306
+ }
307
+ /**
308
+ * Revision record for tracking thought evolution
309
+ */
310
+ export interface RevisionRecord {
311
+ /** Previous content */
312
+ previousContent: string;
313
+ /** Revision timestamp */
314
+ revisedAt: Date;
315
+ /** Reason for revision */
316
+ revisionReason: string;
317
+ }
318
+ /**
319
+ * Represents a reasoning branch (parallel hypothesis path)
320
+ */
321
+ export interface ThoughtBranch {
322
+ /** Branch identifier */
323
+ id: string;
324
+ /** Session ID */
325
+ sessionId: string;
326
+ /** Branch name */
327
+ name: string;
328
+ /** Branch description */
329
+ description: string;
330
+ /** Root thought ID */
331
+ rootThoughtId: string;
332
+ /** All thought IDs in branch */
333
+ thoughtIds: string[];
334
+ /** Parent branch ID */
335
+ parentBranchId: string | null;
336
+ /** Child branch IDs */
337
+ childBranchIds: string[];
338
+ /** Branch status */
339
+ status: BranchStatus;
340
+ /** Aggregate confidence */
341
+ confidence: number;
342
+ /** Metadata */
343
+ metadata: {
344
+ createdAt: Date;
345
+ completedAt?: Date;
346
+ prunedAt?: Date;
347
+ pruneReason?: string;
348
+ };
349
+ }
350
+ /**
351
+ * Meta-note: a thought about a thought
352
+ */
353
+ export interface MetaNote {
354
+ /** Unique identifier */
355
+ id: string;
356
+ /** Target thought ID */
357
+ thoughtId: string;
358
+ /** Observation content */
359
+ content: string;
360
+ /** Type of observation */
361
+ observationType: 'pattern' | 'concern' | 'insight' | 'suggestion';
362
+ /** Timestamp */
363
+ timestamp: Date;
364
+ /** Actions triggered by this observation */
365
+ triggeredActions: string[];
366
+ }
367
+ /**
368
+ * Session context
369
+ */
370
+ export interface SessionContext {
371
+ /** Original problem statement */
372
+ originalProblem: string;
373
+ /** Constraints */
374
+ constraints: string[];
375
+ /** Relevant information */
376
+ relevantInformation: string[];
377
+ /** Working memory */
378
+ workingMemory: Map<string, unknown>;
379
+ /** Long-term references */
380
+ longTermReferences: string[];
381
+ }
382
+ /**
383
+ * Session settings
384
+ */
385
+ export interface SessionSettings {
386
+ /** Maximum number of branches */
387
+ maxBranches: number;
388
+ /** Maximum depth */
389
+ maxDepth: number;
390
+ /** Confidence threshold */
391
+ confidenceThreshold: number;
392
+ /** Enable self-correction */
393
+ enableSelfCorrection: boolean;
394
+ /** Enable meta-reasoning */
395
+ enableMetaReasoning: boolean;
396
+ /** Enable parallel hypotheses */
397
+ enableParallelHypotheses: boolean;
398
+ /** Enable adaptive granularity */
399
+ adaptiveGranularity: boolean;
400
+ /** Granularity settings */
401
+ granularitySettings: {
402
+ minStepDetail: number;
403
+ maxStepDetail: number;
404
+ complexityThreshold: number;
405
+ };
406
+ }
407
+ /**
408
+ * Top-level session containing all thoughts for a reasoning task
409
+ */
410
+ export interface ThinkingSession {
411
+ /** Session identifier */
412
+ id: string;
413
+ /** Topic/problem statement */
414
+ topic: string;
415
+ /** Session status */
416
+ status: SessionStatus;
417
+ /** Current branch ID */
418
+ currentBranchId: string;
419
+ /** Branches map */
420
+ branches: Map<string, ThoughtBranch>;
421
+ /** Thoughts map */
422
+ thoughts: Map<string, Thought>;
423
+ /** Meta notes map */
424
+ metaNotes: Map<string, MetaNote>;
425
+ /** Session context */
426
+ context: SessionContext;
427
+ /** Session settings */
428
+ settings: SessionSettings;
429
+ /** Metadata */
430
+ metadata: {
431
+ createdAt: Date;
432
+ lastActivityAt: Date;
433
+ completedAt?: Date;
434
+ totalThoughts: number;
435
+ totalBranches: number;
436
+ };
437
+ }
438
+ /**
439
+ * Agent capability
440
+ */
441
+ export interface AgentCapability {
442
+ /** Capability name */
443
+ name: string;
444
+ /** Description */
445
+ description: string;
446
+ /** Confidence level (0-1) */
447
+ confidence: number;
448
+ /** Performance metrics */
449
+ performanceMetrics: {
450
+ tasksCompleted: number;
451
+ averageQuality: number;
452
+ averageTimeMs: number;
453
+ };
454
+ }
455
+ /**
456
+ * Agent configuration
457
+ */
458
+ export interface AgentConfig {
459
+ /** Agent ID */
460
+ id: string;
461
+ /** Agent name */
462
+ name: string;
463
+ /** Agent type */
464
+ type: AgentType;
465
+ /** Subtype (e.g., critic type) */
466
+ subtype?: string;
467
+ /** Capabilities */
468
+ capabilities: AgentCapability[];
469
+ /** Maximum concurrent tasks */
470
+ maxConcurrentTasks: number;
471
+ /** Confidence threshold */
472
+ confidenceThreshold: number;
473
+ /** Metadata */
474
+ metadata: {
475
+ createdAt: Date;
476
+ version: string;
477
+ config: Record<string, unknown>;
478
+ };
479
+ }
480
+ /**
481
+ * Agent information
482
+ */
483
+ export interface AgentInfo {
484
+ /** Agent configuration */
485
+ config: AgentConfig;
486
+ /** Current status */
487
+ status: AgentStatus;
488
+ /** Current task IDs */
489
+ currentTasks: string[];
490
+ /** Performance history */
491
+ performanceHistory: {
492
+ taskId: string;
493
+ quality: number;
494
+ timeMs: number;
495
+ timestamp: Date;
496
+ }[];
497
+ }
498
+ /**
499
+ * Agent type (alias for AgentInfo)
500
+ */
501
+ export type Agent = AgentInfo;
502
+ /**
503
+ * Agent performance metrics
504
+ */
505
+ export interface AgentMetrics {
506
+ /** Agent ID */
507
+ agentId: string;
508
+ /** Tasks completed */
509
+ tasksCompleted: number;
510
+ /** Average latency in ms */
511
+ averageLatency: number;
512
+ /** Success rate (0-1) */
513
+ successRate: number;
514
+ /** Current load */
515
+ currentLoad: number;
516
+ }
517
+ /**
518
+ * Task requirements
519
+ */
520
+ export interface TaskRequirements {
521
+ /** Required capabilities */
522
+ requiredCapabilities: string[];
523
+ /** Minimum confidence */
524
+ minConfidence: number;
525
+ /** Maximum time in ms */
526
+ maxTimeMs: number;
527
+ }
528
+ /**
529
+ * Task context
530
+ */
531
+ export interface TaskContext {
532
+ /** Task dependencies */
533
+ dependencies: string[];
534
+ /** Priority level */
535
+ priority?: number;
536
+ /** Deadline */
537
+ deadline?: Date;
538
+ /** Associated session ID */
539
+ sessionId?: string;
540
+ /** Parent task ID */
541
+ parentTaskId?: string;
542
+ }
543
+ /**
544
+ * Task definition
545
+ */
546
+ export interface Task {
547
+ /** Unique ID */
548
+ id: string;
549
+ /** Task type */
550
+ type: string;
551
+ /** Task description */
552
+ description: string;
553
+ /** Task input */
554
+ input: unknown;
555
+ /** Task context */
556
+ context: TaskContext;
557
+ /** Task requirements */
558
+ requirements: TaskRequirements;
559
+ /** Required capabilities for this task */
560
+ requiredCapabilities?: string[];
561
+ /** Assigned agent ID */
562
+ assignedAgentId: string | null;
563
+ /** Task status */
564
+ status: TaskStatus;
565
+ /** Task result */
566
+ result: TaskResult | null;
567
+ /** Metadata */
568
+ metadata: {
569
+ createdAt: Date;
570
+ assignedAt?: Date;
571
+ startedAt?: Date;
572
+ completedAt?: Date;
573
+ };
574
+ }
575
+ /**
576
+ * Task result
577
+ */
578
+ export interface TaskResult {
579
+ /** Task ID */
580
+ taskId: string;
581
+ /** Agent ID */
582
+ agentId: string;
583
+ /** Success flag */
584
+ success: boolean;
585
+ /** Output data */
586
+ output: unknown;
587
+ /** Confidence level */
588
+ confidence: number;
589
+ /** Processing time in ms */
590
+ processingTimeMs: number;
591
+ /** Metadata */
592
+ metadata: {
593
+ tokensUsed: number;
594
+ reasoningSteps: number;
595
+ intermediateResults: unknown[];
596
+ error?: string;
597
+ };
598
+ }
599
+ /**
600
+ * Task error
601
+ */
602
+ export interface TaskError {
603
+ /** Error code */
604
+ code: string;
605
+ /** Error message */
606
+ message: string;
607
+ /** Error details */
608
+ details?: Record<string, unknown>;
609
+ }
610
+ /**
611
+ * Swarm message
612
+ */
613
+ export interface SwarmMessage {
614
+ /** Message ID */
615
+ id: string;
616
+ /** Message type */
617
+ type: MessageType;
618
+ /** Sender ID */
619
+ senderId: string;
620
+ /** Recipient ID (null for broadcast) */
621
+ recipientId: string | null;
622
+ /** Message payload */
623
+ payload: unknown;
624
+ /** Message context */
625
+ context: Record<string, unknown>;
626
+ /** Metadata */
627
+ metadata: {
628
+ priority: number;
629
+ ttl: number;
630
+ retryCount: number;
631
+ };
632
+ /** Timestamp */
633
+ timestamp: Date;
634
+ }
635
+ /**
636
+ * Consensus vote
637
+ */
638
+ export interface ConsensusVote {
639
+ /** Agent ID */
640
+ agentId: string;
641
+ /** Proposal ID */
642
+ proposalId: string;
643
+ /** Voted option */
644
+ vote: unknown;
645
+ /** Confidence in vote */
646
+ confidence: number;
647
+ /** Reasoning */
648
+ reasoning: string;
649
+ /** Timestamp */
650
+ timestamp: Date;
651
+ }
652
+ /**
653
+ * Consensus result
654
+ */
655
+ export interface ConsensusResult {
656
+ /** Proposal ID */
657
+ proposalId: string;
658
+ /** Algorithm used */
659
+ algorithm: ConsensusAlgorithm;
660
+ /** Winning option */
661
+ winningOption: unknown;
662
+ /** Confidence level */
663
+ confidence: number;
664
+ /** All votes */
665
+ votes: ConsensusVote[];
666
+ /** Agreement ratio */
667
+ agreementRatio: number;
668
+ /** Dissenting opinions */
669
+ dissentingOpinions: {
670
+ agentId: string;
671
+ opinion: unknown;
672
+ reasoning: string;
673
+ }[];
674
+ /** Metadata */
675
+ metadata: {
676
+ rounds: number;
677
+ totalVotingTimeMs: number;
678
+ convergenceRate: number;
679
+ };
680
+ }
681
+ /**
682
+ * Conflict position
683
+ */
684
+ export interface ConflictPosition {
685
+ /** Agent ID */
686
+ agentId: string;
687
+ /** Position */
688
+ position: unknown;
689
+ /** Confidence */
690
+ confidence: number;
691
+ /** Reasoning */
692
+ reasoning?: string;
693
+ /** Supporting evidence */
694
+ evidence?: string[];
695
+ }
696
+ /**
697
+ * Assignment strategies for task allocation
698
+ */
699
+ export type AssignmentStrategy = 'round_robin' | 'capability_based' | 'load_balanced' | 'performance_based' | 'adaptive' | 'cost_based' | 'fastest_first';
700
+ /**
701
+ * Conflict definition
702
+ */
703
+ export interface Conflict {
704
+ /** Conflict ID */
705
+ id: string;
706
+ /** Conflict type */
707
+ type: string;
708
+ /** Description */
709
+ description: string;
710
+ /** Involved agent IDs */
711
+ involvedAgents: string[];
712
+ /** Conflicting positions */
713
+ conflictingPositions: ConflictPosition[];
714
+ /** Conflict status */
715
+ status: ConflictStatus;
716
+ /** Resolution */
717
+ resolution: ConflictResolution | null;
718
+ /** Metadata */
719
+ metadata: {
720
+ createdAt: Date;
721
+ resolvedAt?: Date;
722
+ resolutionStrategy?: ConflictResolutionStrategy;
723
+ resolverAgentId?: string;
724
+ };
725
+ }
726
+ /**
727
+ * Conflict resolution
728
+ */
729
+ export interface ConflictResolution {
730
+ /** Resolution strategy */
731
+ strategy: ConflictResolutionStrategy;
732
+ /** Resolution result */
733
+ result: unknown;
734
+ /** Confidence in resolution */
735
+ confidence: number;
736
+ /** Reasoning */
737
+ reasoning?: string;
738
+ }
739
+ /**
740
+ * Base error class for sequential thinking errors
741
+ */
742
+ export declare class SequentialThinkingError extends Error {
743
+ constructor(message: string);
744
+ }
745
+ /**
746
+ * Validation error
747
+ */
748
+ export declare class ValidationError extends SequentialThinkingError {
749
+ constructor(message: string);
750
+ }
751
+ /**
752
+ * Not found error
753
+ */
754
+ export declare class NotFoundError extends SequentialThinkingError {
755
+ constructor(message: string);
756
+ }
757
+ /**
758
+ * Timeout error
759
+ */
760
+ export declare class TimeoutError extends SequentialThinkingError {
761
+ constructor(message: string);
762
+ }
763
+ /** UUID string type */
764
+ export type UUID = string;
765
+ /** Timestamp type */
766
+ export type Timestamp = number;
767
+ /** JSON value type */
768
+ export type JSONValue = string | number | boolean | null | JSONObject | JSONArray;
769
+ /** JSON object type */
770
+ export interface JSONObject {
771
+ [key: string]: JSONValue;
772
+ }
773
+ /** JSON array type */
774
+ export interface JSONArray extends Array<JSONValue> {
775
+ }
776
+ /** Nullable type */
777
+ export type Nullable<T> = T | null;
778
+ /** Optional type */
779
+ export type Optional<T> = T | undefined;
780
+ /** Deep partial type */
781
+ export type DeepPartial<T> = {
782
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
783
+ };
784
+ /** Deep readonly type */
785
+ export type DeepReadonly<T> = {
786
+ readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
787
+ };
788
+ /** Result type */
789
+ export type Result<T, E = Error> = {
790
+ success: true;
791
+ data: T;
792
+ } | {
793
+ success: false;
794
+ error: E;
795
+ };
796
+ /** Async result type */
797
+ export type AsyncResult<T, E = Error> = Promise<Result<T, E>>;
798
+ /** Event handler type */
799
+ export type EventHandler<T = unknown> = (event: T) => void | Promise<void>;
800
+ /** Predicate type */
801
+ export type Predicate<T> = (item: T) => boolean;
802
+ /** Comparator type */
803
+ export type Comparator<T> = (a: T, b: T) => number;
804
+ /** Factory type */
805
+ export type Factory<T, Args extends unknown[] = []> = (...args: Args) => T;
806
+ //# sourceMappingURL=index.d.ts.map