gthinking 1.2.0 → 1.2.1
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 +5 -0
- package/dist/engine.d.ts +15 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +9 -11
- package/dist/engine.js.map +1 -1
- package/dist/llm-service.d.ts +1 -0
- package/dist/llm-service.d.ts.map +1 -1
- package/dist/llm-service.js +34 -16
- package/dist/llm-service.js.map +1 -1
- package/dist/types/analysis.d.ts +54 -0
- package/dist/types/analysis.d.ts.map +1 -0
- package/dist/types/analysis.js +3 -0
- package/dist/types/analysis.js.map +1 -0
- package/dist/types/core.d.ts +66 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/core.js +61 -0
- package/dist/types/core.js.map +1 -0
- package/dist/types/creativity.d.ts +58 -0
- package/dist/types/creativity.d.ts.map +1 -0
- package/dist/types/creativity.js +3 -0
- package/dist/types/creativity.js.map +1 -0
- package/dist/types/engine.d.ts +55 -0
- package/dist/types/engine.d.ts.map +1 -0
- package/dist/types/engine.js +3 -0
- package/dist/types/engine.js.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +26 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/learning.d.ts +62 -0
- package/dist/types/learning.d.ts.map +1 -0
- package/dist/types/learning.js +3 -0
- package/dist/types/learning.js.map +1 -0
- package/dist/types/planning.d.ts +78 -0
- package/dist/types/planning.d.ts.map +1 -0
- package/dist/types/planning.js +3 -0
- package/dist/types/planning.js.map +1 -0
- package/dist/types/reasoning.d.ts +83 -0
- package/dist/types/reasoning.d.ts.map +1 -0
- package/dist/types/reasoning.js +13 -0
- package/dist/types/reasoning.js.map +1 -0
- package/dist/types/search.d.ts +56 -0
- package/dist/types/search.d.ts.map +1 -0
- package/dist/types/search.js +3 -0
- package/dist/types/search.js.map +1 -0
- package/dist/types/synthesis.d.ts +39 -0
- package/dist/types/synthesis.d.ts.map +1 -0
- package/dist/types/synthesis.js +3 -0
- package/dist/types/synthesis.js.map +1 -0
- package/dist/types.d.ts +1 -530
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -70
- package/dist/types.js.map +1 -1
- package/engine.ts +22 -8
- package/llm-service.ts +39 -18
- package/package.json +1 -1
- package/types/analysis.ts +69 -0
- package/types/core.ts +90 -0
- package/types/creativity.ts +72 -0
- package/types/engine.ts +60 -0
- package/types/index.ts +9 -0
- package/types/learning.ts +69 -0
- package/types/planning.ts +85 -0
- package/types/reasoning.ts +92 -0
- package/types/search.ts +58 -0
- package/types/synthesis.ts +42 -0
- package/types.ts +1 -669
package/engine.ts
CHANGED
|
@@ -255,6 +255,15 @@ class SynthesisEngine {
|
|
|
255
255
|
// MAIN SEQUENTIAL THINKING ENGINE
|
|
256
256
|
// ============================================================================
|
|
257
257
|
|
|
258
|
+
export interface SequentialThinkingEngineDeps {
|
|
259
|
+
searchEngine?: SearchDiscoveryEngine;
|
|
260
|
+
analysisEngine?: AnalysisEngine;
|
|
261
|
+
reasoningEngine?: ReasoningEngine;
|
|
262
|
+
learningEngine?: LearningEngine;
|
|
263
|
+
planningEngine?: PlanningEngine;
|
|
264
|
+
creativityEngine?: CreativityEngine;
|
|
265
|
+
}
|
|
266
|
+
|
|
258
267
|
export class SequentialThinkingEngine extends EventEmitter {
|
|
259
268
|
private searchEngine: SearchDiscoveryEngine;
|
|
260
269
|
private analysisEngine: AnalysisEngine;
|
|
@@ -267,7 +276,10 @@ export class SequentialThinkingEngine extends EventEmitter {
|
|
|
267
276
|
private config: SequentialThinkingConfig;
|
|
268
277
|
private sessions: Map<string, ThinkingSession> = new Map();
|
|
269
278
|
|
|
270
|
-
constructor(
|
|
279
|
+
constructor(
|
|
280
|
+
config: Partial<SequentialThinkingConfig> = {},
|
|
281
|
+
deps: SequentialThinkingEngineDeps = {}
|
|
282
|
+
) {
|
|
271
283
|
super();
|
|
272
284
|
|
|
273
285
|
this.config = {
|
|
@@ -282,13 +294,15 @@ export class SequentialThinkingEngine extends EventEmitter {
|
|
|
282
294
|
...config
|
|
283
295
|
};
|
|
284
296
|
|
|
285
|
-
// Initialize all engines
|
|
286
|
-
this.searchEngine = new SearchDiscoveryEngine();
|
|
287
|
-
this.analysisEngine = new AnalysisEngine();
|
|
288
|
-
this.reasoningEngine = new ReasoningEngine();
|
|
289
|
-
this.learningEngine = new LearningEngine();
|
|
290
|
-
this.planningEngine = new PlanningEngine();
|
|
291
|
-
this.creativityEngine = new CreativityEngine();
|
|
297
|
+
// Initialize all engines (inject or default)
|
|
298
|
+
this.searchEngine = deps.searchEngine || new SearchDiscoveryEngine();
|
|
299
|
+
this.analysisEngine = deps.analysisEngine || new AnalysisEngine();
|
|
300
|
+
this.reasoningEngine = deps.reasoningEngine || new ReasoningEngine();
|
|
301
|
+
this.learningEngine = deps.learningEngine || new LearningEngine();
|
|
302
|
+
this.planningEngine = deps.planningEngine || new PlanningEngine();
|
|
303
|
+
this.creativityEngine = deps.creativityEngine || new CreativityEngine();
|
|
304
|
+
|
|
305
|
+
// Synthesis engine is internal for now, but could be injected too
|
|
292
306
|
this.synthesisEngine = new SynthesisEngine();
|
|
293
307
|
|
|
294
308
|
// Set up event forwarding
|
package/llm-service.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { promisify } from 'util';
|
|
4
|
-
|
|
5
|
-
const execAsync = promisify(exec);
|
|
2
|
+
import { spawn } from 'child_process';
|
|
6
3
|
|
|
7
4
|
export type LLMProvider = 'gemini' | 'claude' | 'kimi' | 'opencode' | 'openai';
|
|
8
5
|
|
|
@@ -20,6 +17,39 @@ export class LLMService {
|
|
|
20
17
|
this.detectProvider();
|
|
21
18
|
}
|
|
22
19
|
|
|
20
|
+
private async spawnCommand(command: string, args: string[]): Promise<string> {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
const child = spawn(command, args);
|
|
23
|
+
let stdout = '';
|
|
24
|
+
let stderr = '';
|
|
25
|
+
|
|
26
|
+
child.stdout.on('data', (data) => {
|
|
27
|
+
stdout += data.toString();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
child.stderr.on('data', (data) => {
|
|
31
|
+
stderr += data.toString();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
child.on('close', (code) => {
|
|
35
|
+
if (code === 0) {
|
|
36
|
+
resolve(stdout.trim());
|
|
37
|
+
} else {
|
|
38
|
+
// Check if it's just a command not found check (checking 'which')
|
|
39
|
+
if (command === 'which' && code === 1) {
|
|
40
|
+
reject(new Error('Command not found'));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
reject(new Error(`Command '${command}' failed with code ${code}: ${stderr}`));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
child.on('error', (err) => {
|
|
48
|
+
reject(err);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
23
53
|
private async detectProvider() {
|
|
24
54
|
if (process.env.LLM_PROVIDER) {
|
|
25
55
|
this.defaultProvider = process.env.LLM_PROVIDER as LLMProvider;
|
|
@@ -31,7 +61,7 @@ export class LLMService {
|
|
|
31
61
|
|
|
32
62
|
for (const p of providers) {
|
|
33
63
|
try {
|
|
34
|
-
await
|
|
64
|
+
await this.spawnCommand('which', [p]);
|
|
35
65
|
this.defaultProvider = p;
|
|
36
66
|
break;
|
|
37
67
|
} catch (e) {
|
|
@@ -71,28 +101,19 @@ export class LLMService {
|
|
|
71
101
|
}
|
|
72
102
|
|
|
73
103
|
private async callGemini(prompt: string): Promise<string> {
|
|
74
|
-
|
|
75
|
-
const safePrompt = prompt.replace(/"/g, '\\"');
|
|
76
|
-
const { stdout } = await execAsync(`gemini "${safePrompt}"`);
|
|
77
|
-
return stdout.trim();
|
|
104
|
+
return this.spawnCommand('gemini', [prompt]);
|
|
78
105
|
}
|
|
79
106
|
|
|
80
107
|
private async callClaude(prompt: string): Promise<string> {
|
|
81
|
-
|
|
82
|
-
const { stdout } = await execAsync(`claude "${safePrompt}"`);
|
|
83
|
-
return stdout.trim();
|
|
108
|
+
return this.spawnCommand('claude', [prompt]);
|
|
84
109
|
}
|
|
85
110
|
|
|
86
111
|
private async callKimi(prompt: string): Promise<string> {
|
|
87
|
-
|
|
88
|
-
const { stdout } = await execAsync(`kimi "${safePrompt}"`);
|
|
89
|
-
return stdout.trim();
|
|
112
|
+
return this.spawnCommand('kimi', [prompt]);
|
|
90
113
|
}
|
|
91
114
|
|
|
92
115
|
private async callOpenCode(prompt: string): Promise<string> {
|
|
93
|
-
|
|
94
|
-
const { stdout } = await execAsync(`opencode "${safePrompt}"`);
|
|
95
|
-
return stdout.trim();
|
|
116
|
+
return this.spawnCommand('opencode', [prompt]);
|
|
96
117
|
}
|
|
97
118
|
}
|
|
98
119
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { SearchResult } from './search';
|
|
2
|
+
|
|
3
|
+
export interface AnalysisRequest {
|
|
4
|
+
id: string;
|
|
5
|
+
content: string;
|
|
6
|
+
analysisTypes: AnalysisType[];
|
|
7
|
+
context?: string;
|
|
8
|
+
depth: 'surface' | 'moderate' | 'deep';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type AnalysisType =
|
|
12
|
+
| 'sentiment'
|
|
13
|
+
| 'entity'
|
|
14
|
+
| 'topic'
|
|
15
|
+
| 'keyword'
|
|
16
|
+
| 'summary'
|
|
17
|
+
| 'fact_check'
|
|
18
|
+
| 'comparison'
|
|
19
|
+
| 'trend';
|
|
20
|
+
|
|
21
|
+
export interface AnalysisResult {
|
|
22
|
+
id: string;
|
|
23
|
+
requestId: string;
|
|
24
|
+
type: AnalysisType;
|
|
25
|
+
findings: Finding[];
|
|
26
|
+
confidence: number;
|
|
27
|
+
processingTime: number;
|
|
28
|
+
timestamp: Date;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface Finding {
|
|
32
|
+
id: string;
|
|
33
|
+
type: string;
|
|
34
|
+
value: unknown;
|
|
35
|
+
confidence: number;
|
|
36
|
+
evidence: Evidence[];
|
|
37
|
+
relatedFindings: string[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface Evidence {
|
|
41
|
+
source: string;
|
|
42
|
+
excerpt: string;
|
|
43
|
+
location: string;
|
|
44
|
+
strength: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ComparisonResult {
|
|
48
|
+
id: string;
|
|
49
|
+
subjects: string[];
|
|
50
|
+
similarities: ComparisonPoint[];
|
|
51
|
+
differences: ComparisonPoint[];
|
|
52
|
+
conclusion: string;
|
|
53
|
+
confidence: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ComparisonPoint {
|
|
57
|
+
aspect: string;
|
|
58
|
+
values: Record<string, unknown>;
|
|
59
|
+
significance: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface FactCheckResult {
|
|
63
|
+
claim: string;
|
|
64
|
+
verdict: 'true' | 'false' | 'partially_true' | 'unverifiable';
|
|
65
|
+
confidence: number;
|
|
66
|
+
sources: SearchResult[];
|
|
67
|
+
explanation: string;
|
|
68
|
+
corrections?: string[];
|
|
69
|
+
}
|
package/types/core.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Types and Enums
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export enum ThinkingStage {
|
|
6
|
+
SEARCH = 'search',
|
|
7
|
+
ANALYSIS = 'analysis',
|
|
8
|
+
REASONING = 'reasoning',
|
|
9
|
+
LEARNING = 'learning',
|
|
10
|
+
PLANNING = 'planning',
|
|
11
|
+
CREATIVITY = 'creativity',
|
|
12
|
+
SYNTHESIS = 'synthesis',
|
|
13
|
+
EVALUATION = 'evaluation'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum ConfidenceLevel {
|
|
17
|
+
VERY_LOW = 0.1,
|
|
18
|
+
LOW = 0.3,
|
|
19
|
+
MEDIUM = 0.5,
|
|
20
|
+
HIGH = 0.7,
|
|
21
|
+
VERY_HIGH = 0.9
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export enum Priority {
|
|
25
|
+
CRITICAL = 1,
|
|
26
|
+
HIGH = 2,
|
|
27
|
+
MEDIUM = 3,
|
|
28
|
+
LOW = 4,
|
|
29
|
+
MINIMAL = 5
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export enum TaskStatus {
|
|
33
|
+
PENDING = 'pending',
|
|
34
|
+
IN_PROGRESS = 'in_progress',
|
|
35
|
+
COMPLETED = 'completed',
|
|
36
|
+
FAILED = 'failed',
|
|
37
|
+
CANCELLED = 'cancelled'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export enum SourceType {
|
|
41
|
+
WEB = 'web',
|
|
42
|
+
DATABASE = 'database',
|
|
43
|
+
API = 'api',
|
|
44
|
+
CACHE = 'cache',
|
|
45
|
+
KNOWLEDGE_BASE = 'knowledge_base',
|
|
46
|
+
USER_INPUT = 'user_input'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type ThinkingEventType =
|
|
50
|
+
| 'stage_start'
|
|
51
|
+
| 'stage_complete'
|
|
52
|
+
| 'stage_error'
|
|
53
|
+
| 'insight_found'
|
|
54
|
+
| 'confidence_update'
|
|
55
|
+
| 'search_result'
|
|
56
|
+
| 'analysis_complete'
|
|
57
|
+
| 'reasoning_step'
|
|
58
|
+
| 'plan_created'
|
|
59
|
+
| 'idea_generated';
|
|
60
|
+
|
|
61
|
+
export interface ThinkingEvent {
|
|
62
|
+
id: string;
|
|
63
|
+
type: ThinkingEventType;
|
|
64
|
+
stage: ThinkingStage;
|
|
65
|
+
timestamp: Date;
|
|
66
|
+
data: unknown;
|
|
67
|
+
sessionId: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface EventHandler {
|
|
71
|
+
(event: ThinkingEvent): void | Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export class ThinkingError extends Error {
|
|
75
|
+
constructor(
|
|
76
|
+
message: string,
|
|
77
|
+
public stage: ThinkingStage,
|
|
78
|
+
public recoverable: boolean,
|
|
79
|
+
public originalError?: Error
|
|
80
|
+
) {
|
|
81
|
+
super(message);
|
|
82
|
+
this.name = 'ThinkingError';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface ErrorRecoveryStrategy {
|
|
87
|
+
stage: ThinkingStage;
|
|
88
|
+
condition: (error: ThinkingError) => boolean;
|
|
89
|
+
action: (error: ThinkingError, context: unknown) => Promise<unknown>;
|
|
90
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export interface CreativeSession {
|
|
2
|
+
id: string;
|
|
3
|
+
prompt: string;
|
|
4
|
+
techniques: CreativityTechnique[];
|
|
5
|
+
ideas: Idea[];
|
|
6
|
+
connections: Connection[];
|
|
7
|
+
sessionDuration: number;
|
|
8
|
+
divergentPhase: DivergentPhase;
|
|
9
|
+
convergentPhase: ConvergentPhase;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type CreativityTechnique =
|
|
13
|
+
| 'brainstorming'
|
|
14
|
+
| 'mind_mapping'
|
|
15
|
+
| 'scamper'
|
|
16
|
+
| 'six_thinking_hats'
|
|
17
|
+
| 'lateral_thinking'
|
|
18
|
+
| 'analogy'
|
|
19
|
+
| 'reverse_thinking'
|
|
20
|
+
| 'random_stimulus';
|
|
21
|
+
|
|
22
|
+
export interface Idea {
|
|
23
|
+
id: string;
|
|
24
|
+
content: string;
|
|
25
|
+
technique: CreativityTechnique;
|
|
26
|
+
novelty: number;
|
|
27
|
+
feasibility: number;
|
|
28
|
+
impact: number;
|
|
29
|
+
relatedIdeas: string[];
|
|
30
|
+
tags: string[];
|
|
31
|
+
generatedAt: Date;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface Connection {
|
|
35
|
+
id: string;
|
|
36
|
+
from: string;
|
|
37
|
+
to: string;
|
|
38
|
+
connectionType: 'similarity' | 'contrast' | 'cause_effect' | 'analogy' | 'combination';
|
|
39
|
+
strength: number;
|
|
40
|
+
insight: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface DivergentPhase {
|
|
44
|
+
startTime: Date;
|
|
45
|
+
endTime: Date;
|
|
46
|
+
ideaCount: number;
|
|
47
|
+
explorationBreadth: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ConvergentPhase {
|
|
51
|
+
startTime: Date;
|
|
52
|
+
endTime: Date;
|
|
53
|
+
selectedIdeas: string[];
|
|
54
|
+
synthesis: string;
|
|
55
|
+
actionItems: string[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface OutOfBoxThinking {
|
|
59
|
+
id: string;
|
|
60
|
+
originalProblem: string;
|
|
61
|
+
reframedProblems: ReframedProblem[];
|
|
62
|
+
unconventionalApproaches: string[];
|
|
63
|
+
breakthroughPotential: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface ReframedProblem {
|
|
67
|
+
id: string;
|
|
68
|
+
perspective: string;
|
|
69
|
+
reframedStatement: string;
|
|
70
|
+
assumptionsChallenged: string[];
|
|
71
|
+
newPossibilities: string[];
|
|
72
|
+
}
|
package/types/engine.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ThinkingStage, TaskStatus } from './core';
|
|
2
|
+
import { LearningContext } from './learning';
|
|
3
|
+
|
|
4
|
+
export interface SequentialThinkingConfig {
|
|
5
|
+
maxSearchResults: number;
|
|
6
|
+
analysisDepth: 'surface' | 'moderate' | 'deep';
|
|
7
|
+
reasoningComplexity: 'simple' | 'moderate' | 'complex';
|
|
8
|
+
learningEnabled: boolean;
|
|
9
|
+
creativityLevel: 'conservative' | 'balanced' | 'adventurous';
|
|
10
|
+
planningDetail: 'high_level' | 'detailed' | 'granular';
|
|
11
|
+
timeout: number;
|
|
12
|
+
retryAttempts: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ThinkingRequest {
|
|
16
|
+
id: string;
|
|
17
|
+
query: string;
|
|
18
|
+
context?: string;
|
|
19
|
+
preferredStages?: ThinkingStage[];
|
|
20
|
+
config?: Partial<SequentialThinkingConfig>;
|
|
21
|
+
timeout?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ThinkingResponse {
|
|
25
|
+
id: string;
|
|
26
|
+
requestId: string;
|
|
27
|
+
stages: StageResult[];
|
|
28
|
+
finalAnswer: string;
|
|
29
|
+
confidence: number;
|
|
30
|
+
processingTime: number;
|
|
31
|
+
metadata: ResponseMetadata;
|
|
32
|
+
timestamp: Date;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface StageResult {
|
|
36
|
+
stage: ThinkingStage;
|
|
37
|
+
status: TaskStatus;
|
|
38
|
+
input: unknown;
|
|
39
|
+
output: unknown;
|
|
40
|
+
processingTime: number;
|
|
41
|
+
confidence: number;
|
|
42
|
+
subResults?: unknown[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ResponseMetadata {
|
|
46
|
+
sourcesUsed: number;
|
|
47
|
+
reasoningSteps: number;
|
|
48
|
+
ideasGenerated: number;
|
|
49
|
+
tasksCreated: number;
|
|
50
|
+
knowledgeNodesAccessed: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ThinkingSession {
|
|
54
|
+
id: string;
|
|
55
|
+
requests: ThinkingRequest[];
|
|
56
|
+
responses: ThinkingResponse[];
|
|
57
|
+
context: LearningContext;
|
|
58
|
+
startTime: Date;
|
|
59
|
+
lastActivity: Date;
|
|
60
|
+
}
|
package/types/index.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { SourceType } from './core';
|
|
2
|
+
|
|
3
|
+
export interface LearningContext {
|
|
4
|
+
id: string;
|
|
5
|
+
sessionId: string;
|
|
6
|
+
userId?: string;
|
|
7
|
+
topic: string;
|
|
8
|
+
previousInteractions: Interaction[];
|
|
9
|
+
learnedPatterns: Pattern[];
|
|
10
|
+
knowledgeGraph: KnowledgeGraph;
|
|
11
|
+
preferences: UserPreferences;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Interaction {
|
|
15
|
+
id: string;
|
|
16
|
+
timestamp: Date;
|
|
17
|
+
query: string;
|
|
18
|
+
response: string;
|
|
19
|
+
feedback?: Feedback;
|
|
20
|
+
contextSnapshot: unknown;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface Feedback {
|
|
24
|
+
rating: number;
|
|
25
|
+
comments?: string;
|
|
26
|
+
helpful: boolean;
|
|
27
|
+
corrections?: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface Pattern {
|
|
31
|
+
id: string;
|
|
32
|
+
type: 'query_pattern' | 'response_pattern' | 'error_pattern' | 'success_pattern';
|
|
33
|
+
pattern: string;
|
|
34
|
+
frequency: number;
|
|
35
|
+
successRate: number;
|
|
36
|
+
lastObserved: Date;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface KnowledgeGraph {
|
|
40
|
+
nodes: KnowledgeNode[];
|
|
41
|
+
edges: KnowledgeEdge[];
|
|
42
|
+
version: number;
|
|
43
|
+
lastUpdated: Date;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface KnowledgeNode {
|
|
47
|
+
id: string;
|
|
48
|
+
label: string;
|
|
49
|
+
type: 'concept' | 'entity' | 'fact' | 'rule';
|
|
50
|
+
properties: Record<string, unknown>;
|
|
51
|
+
confidence: number;
|
|
52
|
+
sources: string[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface KnowledgeEdge {
|
|
56
|
+
from: string;
|
|
57
|
+
to: string;
|
|
58
|
+
relation: string;
|
|
59
|
+
strength: number;
|
|
60
|
+
evidence: string[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface UserPreferences {
|
|
64
|
+
responseStyle: 'concise' | 'detailed' | 'technical' | 'simple';
|
|
65
|
+
preferredSources: SourceType[];
|
|
66
|
+
topicInterests: string[];
|
|
67
|
+
excludedTopics: string[];
|
|
68
|
+
language: string;
|
|
69
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { TaskStatus, Priority } from './core';
|
|
2
|
+
|
|
3
|
+
export interface Plan {
|
|
4
|
+
id: string;
|
|
5
|
+
goal: string;
|
|
6
|
+
tasks: Task[];
|
|
7
|
+
milestones: Milestone[];
|
|
8
|
+
resources: Resource[];
|
|
9
|
+
timeline: Timeline;
|
|
10
|
+
status: TaskStatus;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface Task {
|
|
16
|
+
id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
priority: Priority;
|
|
20
|
+
status: TaskStatus;
|
|
21
|
+
estimatedDuration: number;
|
|
22
|
+
actualDuration?: number;
|
|
23
|
+
dependencies: string[];
|
|
24
|
+
subtasks: string[];
|
|
25
|
+
assignedTo?: string;
|
|
26
|
+
tags: string[];
|
|
27
|
+
startTime?: Date;
|
|
28
|
+
endTime?: Date;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface Milestone {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
description: string;
|
|
35
|
+
criteria: string[];
|
|
36
|
+
deadline?: Date;
|
|
37
|
+
completedAt?: Date;
|
|
38
|
+
status: TaskStatus;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface Resource {
|
|
42
|
+
id: string;
|
|
43
|
+
type: 'human' | 'tool' | 'data' | 'time' | 'budget';
|
|
44
|
+
name: string;
|
|
45
|
+
availability: number;
|
|
46
|
+
cost?: number;
|
|
47
|
+
skills?: string[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Timeline {
|
|
51
|
+
startDate: Date;
|
|
52
|
+
endDate?: Date;
|
|
53
|
+
phases: Phase[];
|
|
54
|
+
criticalPath: string[];
|
|
55
|
+
buffer: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface Phase {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
startDate: Date;
|
|
62
|
+
endDate: Date;
|
|
63
|
+
tasks: string[];
|
|
64
|
+
dependencies: string[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ProgressReport {
|
|
68
|
+
planId: string;
|
|
69
|
+
timestamp: Date;
|
|
70
|
+
overallProgress: number;
|
|
71
|
+
completedTasks: number;
|
|
72
|
+
totalTasks: number;
|
|
73
|
+
onTrack: boolean;
|
|
74
|
+
risks: Risk[];
|
|
75
|
+
nextActions: string[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface Risk {
|
|
79
|
+
id: string;
|
|
80
|
+
description: string;
|
|
81
|
+
probability: number;
|
|
82
|
+
impact: number;
|
|
83
|
+
mitigation: string;
|
|
84
|
+
status: 'identified' | 'mitigating' | 'resolved' | 'occurred';
|
|
85
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { TaskStatus } from './core';
|
|
2
|
+
import { Evidence } from './analysis';
|
|
3
|
+
|
|
4
|
+
export enum ReasoningType {
|
|
5
|
+
DEDUCTIVE = 'deductive',
|
|
6
|
+
INDUCTIVE = 'inductive',
|
|
7
|
+
ABDUCTIVE = 'abductive',
|
|
8
|
+
ANALOGICAL = 'analogical',
|
|
9
|
+
CAUSAL = 'causal',
|
|
10
|
+
COUNTERFACTUAL = 'counterfactual'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ReasoningSession {
|
|
14
|
+
id: string;
|
|
15
|
+
problem: string;
|
|
16
|
+
type: ReasoningType;
|
|
17
|
+
steps: ReasoningStep[];
|
|
18
|
+
conclusion?: string;
|
|
19
|
+
confidence: number;
|
|
20
|
+
startTime: Date;
|
|
21
|
+
endTime?: Date;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ReasoningStep {
|
|
25
|
+
id: string;
|
|
26
|
+
stepNumber: number;
|
|
27
|
+
premise: string;
|
|
28
|
+
inference: string;
|
|
29
|
+
evidence: Evidence[];
|
|
30
|
+
assumptions: string[];
|
|
31
|
+
confidence: number;
|
|
32
|
+
nextSteps: string[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface Hypothesis {
|
|
36
|
+
id: string;
|
|
37
|
+
statement: string;
|
|
38
|
+
supportingEvidence: Evidence[];
|
|
39
|
+
contradictingEvidence: Evidence[];
|
|
40
|
+
tests: HypothesisTest[];
|
|
41
|
+
status: 'proposed' | 'testing' | 'confirmed' | 'rejected';
|
|
42
|
+
confidence: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface HypothesisTest {
|
|
46
|
+
id: string;
|
|
47
|
+
description: string;
|
|
48
|
+
expectedOutcome: string;
|
|
49
|
+
actualOutcome?: string;
|
|
50
|
+
passed?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ChainOfThought {
|
|
54
|
+
id: string;
|
|
55
|
+
initialQuestion: string;
|
|
56
|
+
thoughts: ThoughtNode[];
|
|
57
|
+
finalAnswer?: string;
|
|
58
|
+
completeness: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ThoughtNode {
|
|
62
|
+
id: string;
|
|
63
|
+
content: string;
|
|
64
|
+
parentId?: string;
|
|
65
|
+
children: string[];
|
|
66
|
+
depth: number;
|
|
67
|
+
confidence: number;
|
|
68
|
+
type: 'question' | 'observation' | 'inference' | 'conclusion';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface ProblemDecomposition {
|
|
72
|
+
id: string;
|
|
73
|
+
originalProblem: string;
|
|
74
|
+
subProblems: SubProblem[];
|
|
75
|
+
dependencies: Dependency[];
|
|
76
|
+
solutionStrategy: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface SubProblem {
|
|
80
|
+
id: string;
|
|
81
|
+
description: string;
|
|
82
|
+
difficulty: number;
|
|
83
|
+
estimatedTime: number;
|
|
84
|
+
prerequisites: string[];
|
|
85
|
+
status: TaskStatus;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface Dependency {
|
|
89
|
+
from: string;
|
|
90
|
+
to: string;
|
|
91
|
+
type: 'requires' | 'enables' | 'conflicts';
|
|
92
|
+
}
|