gthinking 1.0.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/README.md +283 -0
- package/analysis.ts +986 -0
- package/creativity.ts +1002 -0
- package/dist/analysis.d.ts +52 -0
- package/dist/analysis.d.ts.map +1 -0
- package/dist/analysis.js +792 -0
- package/dist/analysis.js.map +1 -0
- package/dist/creativity.d.ts +80 -0
- package/dist/creativity.d.ts.map +1 -0
- package/dist/creativity.js +778 -0
- package/dist/creativity.js.map +1 -0
- package/dist/engine.d.ts +76 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +675 -0
- package/dist/engine.js.map +1 -0
- package/dist/examples.d.ts +7 -0
- package/dist/examples.d.ts.map +1 -0
- package/dist/examples.js +506 -0
- package/dist/examples.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +126 -0
- package/dist/index.js.map +1 -0
- package/dist/learning.d.ts +72 -0
- package/dist/learning.d.ts.map +1 -0
- package/dist/learning.js +615 -0
- package/dist/learning.js.map +1 -0
- package/dist/planning.d.ts +58 -0
- package/dist/planning.d.ts.map +1 -0
- package/dist/planning.js +824 -0
- package/dist/planning.js.map +1 -0
- package/dist/reasoning.d.ts +72 -0
- package/dist/reasoning.d.ts.map +1 -0
- package/dist/reasoning.js +792 -0
- package/dist/reasoning.js.map +1 -0
- package/dist/search-discovery.d.ts +73 -0
- package/dist/search-discovery.d.ts.map +1 -0
- package/dist/search-discovery.js +505 -0
- package/dist/search-discovery.js.map +1 -0
- package/dist/types.d.ts +535 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +77 -0
- package/dist/types.js.map +1 -0
- package/engine.ts +928 -0
- package/examples.ts +717 -0
- package/index.ts +106 -0
- package/learning.ts +779 -0
- package/package.json +51 -0
- package/planning.ts +1028 -0
- package/reasoning.ts +1019 -0
- package/search-discovery.ts +654 -0
- package/tsconfig.json +25 -0
- package/types.ts +674 -0
package/types.ts
ADDED
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sequential Thinking System - Core Types and Interfaces
|
|
3
|
+
* A comprehensive intelligent thinking framework for complex problem solving
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// CORE ENUMS
|
|
8
|
+
// ============================================================================
|
|
9
|
+
|
|
10
|
+
export enum ThinkingStage {
|
|
11
|
+
SEARCH = 'search',
|
|
12
|
+
ANALYSIS = 'analysis',
|
|
13
|
+
REASONING = 'reasoning',
|
|
14
|
+
LEARNING = 'learning',
|
|
15
|
+
PLANNING = 'planning',
|
|
16
|
+
CREATIVITY = 'creativity',
|
|
17
|
+
SYNTHESIS = 'synthesis',
|
|
18
|
+
EVALUATION = 'evaluation'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export enum ConfidenceLevel {
|
|
22
|
+
VERY_LOW = 0.1,
|
|
23
|
+
LOW = 0.3,
|
|
24
|
+
MEDIUM = 0.5,
|
|
25
|
+
HIGH = 0.7,
|
|
26
|
+
VERY_HIGH = 0.9
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export enum Priority {
|
|
30
|
+
CRITICAL = 1,
|
|
31
|
+
HIGH = 2,
|
|
32
|
+
MEDIUM = 3,
|
|
33
|
+
LOW = 4,
|
|
34
|
+
MINIMAL = 5
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export enum TaskStatus {
|
|
38
|
+
PENDING = 'pending',
|
|
39
|
+
IN_PROGRESS = 'in_progress',
|
|
40
|
+
COMPLETED = 'completed',
|
|
41
|
+
FAILED = 'failed',
|
|
42
|
+
CANCELLED = 'cancelled'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export enum SourceType {
|
|
46
|
+
WEB = 'web',
|
|
47
|
+
DATABASE = 'database',
|
|
48
|
+
API = 'api',
|
|
49
|
+
CACHE = 'cache',
|
|
50
|
+
KNOWLEDGE_BASE = 'knowledge_base',
|
|
51
|
+
USER_INPUT = 'user_input'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export enum ReasoningType {
|
|
55
|
+
DEDUCTIVE = 'deductive',
|
|
56
|
+
INDUCTIVE = 'inductive',
|
|
57
|
+
ABDUCTIVE = 'abductive',
|
|
58
|
+
ANALOGICAL = 'analogical',
|
|
59
|
+
CAUSAL = 'causal',
|
|
60
|
+
COUNTERFACTUAL = 'counterfactual'
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ============================================================================
|
|
64
|
+
// SEARCH & DISCOVERY TYPES
|
|
65
|
+
// ============================================================================
|
|
66
|
+
|
|
67
|
+
export interface SearchQuery {
|
|
68
|
+
id: string;
|
|
69
|
+
query: string;
|
|
70
|
+
sources: SourceType[];
|
|
71
|
+
filters: SearchFilters;
|
|
72
|
+
maxResults: number;
|
|
73
|
+
timeout: number;
|
|
74
|
+
timestamp: Date;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface SearchFilters {
|
|
78
|
+
dateRange?: { start: Date; end: Date };
|
|
79
|
+
domains?: string[];
|
|
80
|
+
excludeDomains?: string[];
|
|
81
|
+
language?: string;
|
|
82
|
+
contentType?: ('article' | 'video' | 'image' | 'pdf' | 'forum')[];
|
|
83
|
+
minCredibility?: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface SearchResult {
|
|
87
|
+
id: string;
|
|
88
|
+
title: string;
|
|
89
|
+
url: string;
|
|
90
|
+
snippet: string;
|
|
91
|
+
source: SourceType;
|
|
92
|
+
credibility: number;
|
|
93
|
+
relevance: number;
|
|
94
|
+
timestamp: Date;
|
|
95
|
+
metadata: ResultMetadata;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface ResultMetadata {
|
|
99
|
+
author?: string;
|
|
100
|
+
publishDate?: Date;
|
|
101
|
+
wordCount?: number;
|
|
102
|
+
readingTime?: number;
|
|
103
|
+
relatedTopics?: string[];
|
|
104
|
+
citations?: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface SearchSession {
|
|
108
|
+
id: string;
|
|
109
|
+
queries: SearchQuery[];
|
|
110
|
+
results: SearchResult[];
|
|
111
|
+
aggregatedResults: AggregatedResult[];
|
|
112
|
+
startTime: Date;
|
|
113
|
+
endTime?: Date;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface AggregatedResult {
|
|
117
|
+
topic: string;
|
|
118
|
+
results: SearchResult[];
|
|
119
|
+
consensusScore: number;
|
|
120
|
+
conflictingInfo: boolean;
|
|
121
|
+
keyInsights: string[];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ============================================================================
|
|
125
|
+
// ANALYSIS TYPES
|
|
126
|
+
// ============================================================================
|
|
127
|
+
|
|
128
|
+
export interface AnalysisRequest {
|
|
129
|
+
id: string;
|
|
130
|
+
content: string;
|
|
131
|
+
analysisTypes: AnalysisType[];
|
|
132
|
+
context?: string;
|
|
133
|
+
depth: 'surface' | 'moderate' | 'deep';
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export type AnalysisType =
|
|
137
|
+
| 'sentiment'
|
|
138
|
+
| 'entity'
|
|
139
|
+
| 'topic'
|
|
140
|
+
| 'keyword'
|
|
141
|
+
| 'summary'
|
|
142
|
+
| 'fact_check'
|
|
143
|
+
| 'comparison'
|
|
144
|
+
| 'trend';
|
|
145
|
+
|
|
146
|
+
export interface AnalysisResult {
|
|
147
|
+
id: string;
|
|
148
|
+
requestId: string;
|
|
149
|
+
type: AnalysisType;
|
|
150
|
+
findings: Finding[];
|
|
151
|
+
confidence: number;
|
|
152
|
+
processingTime: number;
|
|
153
|
+
timestamp: Date;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface Finding {
|
|
157
|
+
id: string;
|
|
158
|
+
type: string;
|
|
159
|
+
value: unknown;
|
|
160
|
+
confidence: number;
|
|
161
|
+
evidence: Evidence[];
|
|
162
|
+
relatedFindings: string[];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface Evidence {
|
|
166
|
+
source: string;
|
|
167
|
+
excerpt: string;
|
|
168
|
+
location: string;
|
|
169
|
+
strength: number;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface ComparisonResult {
|
|
173
|
+
id: string;
|
|
174
|
+
subjects: string[];
|
|
175
|
+
similarities: ComparisonPoint[];
|
|
176
|
+
differences: ComparisonPoint[];
|
|
177
|
+
conclusion: string;
|
|
178
|
+
confidence: number;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface ComparisonPoint {
|
|
182
|
+
aspect: string;
|
|
183
|
+
values: Record<string, unknown>;
|
|
184
|
+
significance: number;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface FactCheckResult {
|
|
188
|
+
claim: string;
|
|
189
|
+
verdict: 'true' | 'false' | 'partially_true' | 'unverifiable';
|
|
190
|
+
confidence: number;
|
|
191
|
+
sources: SearchResult[];
|
|
192
|
+
explanation: string;
|
|
193
|
+
corrections?: string[];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ============================================================================
|
|
197
|
+
// REASONING TYPES
|
|
198
|
+
// ============================================================================
|
|
199
|
+
|
|
200
|
+
export interface ReasoningSession {
|
|
201
|
+
id: string;
|
|
202
|
+
problem: string;
|
|
203
|
+
type: ReasoningType;
|
|
204
|
+
steps: ReasoningStep[];
|
|
205
|
+
conclusion?: string;
|
|
206
|
+
confidence: number;
|
|
207
|
+
startTime: Date;
|
|
208
|
+
endTime?: Date;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface ReasoningStep {
|
|
212
|
+
id: string;
|
|
213
|
+
stepNumber: number;
|
|
214
|
+
premise: string;
|
|
215
|
+
inference: string;
|
|
216
|
+
evidence: Evidence[];
|
|
217
|
+
assumptions: string[];
|
|
218
|
+
confidence: number;
|
|
219
|
+
nextSteps: string[];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface Hypothesis {
|
|
223
|
+
id: string;
|
|
224
|
+
statement: string;
|
|
225
|
+
supportingEvidence: Evidence[];
|
|
226
|
+
contradictingEvidence: Evidence[];
|
|
227
|
+
tests: HypothesisTest[];
|
|
228
|
+
status: 'proposed' | 'testing' | 'confirmed' | 'rejected';
|
|
229
|
+
confidence: number;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface HypothesisTest {
|
|
233
|
+
id: string;
|
|
234
|
+
description: string;
|
|
235
|
+
expectedOutcome: string;
|
|
236
|
+
actualOutcome?: string;
|
|
237
|
+
passed?: boolean;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export interface ChainOfThought {
|
|
241
|
+
id: string;
|
|
242
|
+
initialQuestion: string;
|
|
243
|
+
thoughts: ThoughtNode[];
|
|
244
|
+
finalAnswer?: string;
|
|
245
|
+
completeness: number;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface ThoughtNode {
|
|
249
|
+
id: string;
|
|
250
|
+
content: string;
|
|
251
|
+
parentId?: string;
|
|
252
|
+
children: string[];
|
|
253
|
+
depth: number;
|
|
254
|
+
confidence: number;
|
|
255
|
+
type: 'question' | 'observation' | 'inference' | 'conclusion';
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface ProblemDecomposition {
|
|
259
|
+
id: string;
|
|
260
|
+
originalProblem: string;
|
|
261
|
+
subProblems: SubProblem[];
|
|
262
|
+
dependencies: Dependency[];
|
|
263
|
+
solutionStrategy: string;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export interface SubProblem {
|
|
267
|
+
id: string;
|
|
268
|
+
description: string;
|
|
269
|
+
difficulty: number;
|
|
270
|
+
estimatedTime: number;
|
|
271
|
+
prerequisites: string[];
|
|
272
|
+
status: TaskStatus;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface Dependency {
|
|
276
|
+
from: string;
|
|
277
|
+
to: string;
|
|
278
|
+
type: 'requires' | 'enables' | 'conflicts';
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// ============================================================================
|
|
282
|
+
// LEARNING TYPES
|
|
283
|
+
// ============================================================================
|
|
284
|
+
|
|
285
|
+
export interface LearningContext {
|
|
286
|
+
id: string;
|
|
287
|
+
sessionId: string;
|
|
288
|
+
userId?: string;
|
|
289
|
+
topic: string;
|
|
290
|
+
previousInteractions: Interaction[];
|
|
291
|
+
learnedPatterns: Pattern[];
|
|
292
|
+
knowledgeGraph: KnowledgeGraph;
|
|
293
|
+
preferences: UserPreferences;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export interface Interaction {
|
|
297
|
+
id: string;
|
|
298
|
+
timestamp: Date;
|
|
299
|
+
query: string;
|
|
300
|
+
response: string;
|
|
301
|
+
feedback?: Feedback;
|
|
302
|
+
contextSnapshot: unknown;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface Feedback {
|
|
306
|
+
rating: number;
|
|
307
|
+
comments?: string;
|
|
308
|
+
helpful: boolean;
|
|
309
|
+
corrections?: string[];
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export interface Pattern {
|
|
313
|
+
id: string;
|
|
314
|
+
type: 'query_pattern' | 'response_pattern' | 'error_pattern' | 'success_pattern';
|
|
315
|
+
pattern: string;
|
|
316
|
+
frequency: number;
|
|
317
|
+
successRate: number;
|
|
318
|
+
lastObserved: Date;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface KnowledgeGraph {
|
|
322
|
+
nodes: KnowledgeNode[];
|
|
323
|
+
edges: KnowledgeEdge[];
|
|
324
|
+
version: number;
|
|
325
|
+
lastUpdated: Date;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface KnowledgeNode {
|
|
329
|
+
id: string;
|
|
330
|
+
label: string;
|
|
331
|
+
type: 'concept' | 'entity' | 'fact' | 'rule';
|
|
332
|
+
properties: Record<string, unknown>;
|
|
333
|
+
confidence: number;
|
|
334
|
+
sources: string[];
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export interface KnowledgeEdge {
|
|
338
|
+
from: string;
|
|
339
|
+
to: string;
|
|
340
|
+
relation: string;
|
|
341
|
+
strength: number;
|
|
342
|
+
evidence: string[];
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export interface UserPreferences {
|
|
346
|
+
responseStyle: 'concise' | 'detailed' | 'technical' | 'simple';
|
|
347
|
+
preferredSources: SourceType[];
|
|
348
|
+
topicInterests: string[];
|
|
349
|
+
excludedTopics: string[];
|
|
350
|
+
language: string;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// ============================================================================
|
|
354
|
+
// PLANNING TYPES
|
|
355
|
+
// ============================================================================
|
|
356
|
+
|
|
357
|
+
export interface Plan {
|
|
358
|
+
id: string;
|
|
359
|
+
goal: string;
|
|
360
|
+
tasks: Task[];
|
|
361
|
+
milestones: Milestone[];
|
|
362
|
+
resources: Resource[];
|
|
363
|
+
timeline: Timeline;
|
|
364
|
+
status: TaskStatus;
|
|
365
|
+
createdAt: Date;
|
|
366
|
+
updatedAt: Date;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export interface Task {
|
|
370
|
+
id: string;
|
|
371
|
+
title: string;
|
|
372
|
+
description: string;
|
|
373
|
+
priority: Priority;
|
|
374
|
+
status: TaskStatus;
|
|
375
|
+
estimatedDuration: number;
|
|
376
|
+
actualDuration?: number;
|
|
377
|
+
dependencies: string[];
|
|
378
|
+
subtasks: string[];
|
|
379
|
+
assignedTo?: string;
|
|
380
|
+
tags: string[];
|
|
381
|
+
startTime?: Date;
|
|
382
|
+
endTime?: Date;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export interface Milestone {
|
|
386
|
+
id: string;
|
|
387
|
+
title: string;
|
|
388
|
+
description: string;
|
|
389
|
+
criteria: string[];
|
|
390
|
+
deadline?: Date;
|
|
391
|
+
completedAt?: Date;
|
|
392
|
+
status: TaskStatus;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export interface Resource {
|
|
396
|
+
id: string;
|
|
397
|
+
type: 'human' | 'tool' | 'data' | 'time' | 'budget';
|
|
398
|
+
name: string;
|
|
399
|
+
availability: number;
|
|
400
|
+
cost?: number;
|
|
401
|
+
skills?: string[];
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export interface Timeline {
|
|
405
|
+
startDate: Date;
|
|
406
|
+
endDate?: Date;
|
|
407
|
+
phases: Phase[];
|
|
408
|
+
criticalPath: string[];
|
|
409
|
+
buffer: number;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export interface Phase {
|
|
413
|
+
id: string;
|
|
414
|
+
name: string;
|
|
415
|
+
startDate: Date;
|
|
416
|
+
endDate: Date;
|
|
417
|
+
tasks: string[];
|
|
418
|
+
dependencies: string[];
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
export interface ProgressReport {
|
|
422
|
+
planId: string;
|
|
423
|
+
timestamp: Date;
|
|
424
|
+
overallProgress: number;
|
|
425
|
+
completedTasks: number;
|
|
426
|
+
totalTasks: number;
|
|
427
|
+
onTrack: boolean;
|
|
428
|
+
risks: Risk[];
|
|
429
|
+
nextActions: string[];
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
export interface Risk {
|
|
433
|
+
id: string;
|
|
434
|
+
description: string;
|
|
435
|
+
probability: number;
|
|
436
|
+
impact: number;
|
|
437
|
+
mitigation: string;
|
|
438
|
+
status: 'identified' | 'mitigating' | 'resolved' | 'occurred';
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// ============================================================================
|
|
442
|
+
// CREATIVITY TYPES
|
|
443
|
+
// ============================================================================
|
|
444
|
+
|
|
445
|
+
export interface CreativeSession {
|
|
446
|
+
id: string;
|
|
447
|
+
prompt: string;
|
|
448
|
+
techniques: CreativityTechnique[];
|
|
449
|
+
ideas: Idea[];
|
|
450
|
+
connections: Connection[];
|
|
451
|
+
sessionDuration: number;
|
|
452
|
+
divergentPhase: DivergentPhase;
|
|
453
|
+
convergentPhase: ConvergentPhase;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export type CreativityTechnique =
|
|
457
|
+
| 'brainstorming'
|
|
458
|
+
| 'mind_mapping'
|
|
459
|
+
| 'scamper'
|
|
460
|
+
| 'six_thinking_hats'
|
|
461
|
+
| 'lateral_thinking'
|
|
462
|
+
| 'analogy'
|
|
463
|
+
| 'reverse_thinking'
|
|
464
|
+
| 'random_stimulus';
|
|
465
|
+
|
|
466
|
+
export interface Idea {
|
|
467
|
+
id: string;
|
|
468
|
+
content: string;
|
|
469
|
+
technique: CreativityTechnique;
|
|
470
|
+
novelty: number;
|
|
471
|
+
feasibility: number;
|
|
472
|
+
impact: number;
|
|
473
|
+
relatedIdeas: string[];
|
|
474
|
+
tags: string[];
|
|
475
|
+
generatedAt: Date;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export interface Connection {
|
|
479
|
+
id: string;
|
|
480
|
+
from: string;
|
|
481
|
+
to: string;
|
|
482
|
+
connectionType: 'similarity' | 'contrast' | 'cause_effect' | 'analogy' | 'combination';
|
|
483
|
+
strength: number;
|
|
484
|
+
insight: string;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
export interface DivergentPhase {
|
|
488
|
+
startTime: Date;
|
|
489
|
+
endTime: Date;
|
|
490
|
+
ideaCount: number;
|
|
491
|
+
explorationBreadth: number;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
export interface ConvergentPhase {
|
|
495
|
+
startTime: Date;
|
|
496
|
+
endTime: Date;
|
|
497
|
+
selectedIdeas: string[];
|
|
498
|
+
synthesis: string;
|
|
499
|
+
actionItems: string[];
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
export interface OutOfBoxThinking {
|
|
503
|
+
id: string;
|
|
504
|
+
originalProblem: string;
|
|
505
|
+
reframedProblems: ReframedProblem[];
|
|
506
|
+
unconventionalApproaches: string[];
|
|
507
|
+
breakthroughPotential: number;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export interface ReframedProblem {
|
|
511
|
+
id: string;
|
|
512
|
+
perspective: string;
|
|
513
|
+
reframedStatement: string;
|
|
514
|
+
assumptionsChallenged: string[];
|
|
515
|
+
newPossibilities: string[];
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// ============================================================================
|
|
519
|
+
// SYNTHESIS & EVALUATION TYPES
|
|
520
|
+
// ============================================================================
|
|
521
|
+
|
|
522
|
+
export interface SynthesisResult {
|
|
523
|
+
id: string;
|
|
524
|
+
sources: string[];
|
|
525
|
+
summary: string;
|
|
526
|
+
keyInsights: string[];
|
|
527
|
+
recommendations: Recommendation[];
|
|
528
|
+
confidence: number;
|
|
529
|
+
gaps: string[];
|
|
530
|
+
uncertainties: string[];
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export interface Recommendation {
|
|
534
|
+
id: string;
|
|
535
|
+
action: string;
|
|
536
|
+
rationale: string;
|
|
537
|
+
priority: Priority;
|
|
538
|
+
expectedOutcome: string;
|
|
539
|
+
risks: string[];
|
|
540
|
+
confidence: number;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export interface EvaluationResult {
|
|
544
|
+
id: string;
|
|
545
|
+
target: string;
|
|
546
|
+
criteria: EvaluationCriteria[];
|
|
547
|
+
scores: Record<string, number>;
|
|
548
|
+
overallScore: number;
|
|
549
|
+
strengths: string[];
|
|
550
|
+
weaknesses: string[];
|
|
551
|
+
improvements: string[];
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export interface EvaluationCriteria {
|
|
555
|
+
id: string;
|
|
556
|
+
name: string;
|
|
557
|
+
weight: number;
|
|
558
|
+
description: string;
|
|
559
|
+
minScore: number;
|
|
560
|
+
maxScore: number;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// ============================================================================
|
|
564
|
+
// MAIN ENGINE TYPES
|
|
565
|
+
// ============================================================================
|
|
566
|
+
|
|
567
|
+
export interface SequentialThinkingConfig {
|
|
568
|
+
maxSearchResults: number;
|
|
569
|
+
analysisDepth: 'surface' | 'moderate' | 'deep';
|
|
570
|
+
reasoningComplexity: 'simple' | 'moderate' | 'complex';
|
|
571
|
+
learningEnabled: boolean;
|
|
572
|
+
creativityLevel: 'conservative' | 'balanced' | 'adventurous';
|
|
573
|
+
planningDetail: 'high_level' | 'detailed' | 'granular';
|
|
574
|
+
timeout: number;
|
|
575
|
+
retryAttempts: number;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export interface ThinkingRequest {
|
|
579
|
+
id: string;
|
|
580
|
+
query: string;
|
|
581
|
+
context?: string;
|
|
582
|
+
preferredStages?: ThinkingStage[];
|
|
583
|
+
config?: Partial<SequentialThinkingConfig>;
|
|
584
|
+
timeout?: number;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
export interface ThinkingResponse {
|
|
588
|
+
id: string;
|
|
589
|
+
requestId: string;
|
|
590
|
+
stages: StageResult[];
|
|
591
|
+
finalAnswer: string;
|
|
592
|
+
confidence: number;
|
|
593
|
+
processingTime: number;
|
|
594
|
+
metadata: ResponseMetadata;
|
|
595
|
+
timestamp: Date;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export interface StageResult {
|
|
599
|
+
stage: ThinkingStage;
|
|
600
|
+
status: TaskStatus;
|
|
601
|
+
input: unknown;
|
|
602
|
+
output: unknown;
|
|
603
|
+
processingTime: number;
|
|
604
|
+
confidence: number;
|
|
605
|
+
subResults?: unknown[];
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export interface ResponseMetadata {
|
|
609
|
+
sourcesUsed: number;
|
|
610
|
+
reasoningSteps: number;
|
|
611
|
+
ideasGenerated: number;
|
|
612
|
+
tasksCreated: number;
|
|
613
|
+
knowledgeNodesAccessed: number;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
export interface ThinkingSession {
|
|
617
|
+
id: string;
|
|
618
|
+
requests: ThinkingRequest[];
|
|
619
|
+
responses: ThinkingResponse[];
|
|
620
|
+
context: LearningContext;
|
|
621
|
+
startTime: Date;
|
|
622
|
+
lastActivity: Date;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// ============================================================================
|
|
626
|
+
// EVENT TYPES
|
|
627
|
+
// ============================================================================
|
|
628
|
+
|
|
629
|
+
export interface ThinkingEvent {
|
|
630
|
+
id: string;
|
|
631
|
+
type: ThinkingEventType;
|
|
632
|
+
stage: ThinkingStage;
|
|
633
|
+
timestamp: Date;
|
|
634
|
+
data: unknown;
|
|
635
|
+
sessionId: string;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export type ThinkingEventType =
|
|
639
|
+
| 'stage_start'
|
|
640
|
+
| 'stage_complete'
|
|
641
|
+
| 'stage_error'
|
|
642
|
+
| 'insight_found'
|
|
643
|
+
| 'confidence_update'
|
|
644
|
+
| 'search_result'
|
|
645
|
+
| 'analysis_complete'
|
|
646
|
+
| 'reasoning_step'
|
|
647
|
+
| 'plan_created'
|
|
648
|
+
| 'idea_generated';
|
|
649
|
+
|
|
650
|
+
export interface EventHandler {
|
|
651
|
+
(event: ThinkingEvent): void | Promise<void>;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// ============================================================================
|
|
655
|
+
// ERROR TYPES
|
|
656
|
+
// ============================================================================
|
|
657
|
+
|
|
658
|
+
export class ThinkingError extends Error {
|
|
659
|
+
constructor(
|
|
660
|
+
message: string,
|
|
661
|
+
public stage: ThinkingStage,
|
|
662
|
+
public recoverable: boolean,
|
|
663
|
+
public originalError?: Error
|
|
664
|
+
) {
|
|
665
|
+
super(message);
|
|
666
|
+
this.name = 'ThinkingError';
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export interface ErrorRecoveryStrategy {
|
|
671
|
+
stage: ThinkingStage;
|
|
672
|
+
condition: (error: ThinkingError) => boolean;
|
|
673
|
+
action: (error: ThinkingError, context: unknown) => Promise<unknown>;
|
|
674
|
+
}
|