gthinking 1.2.1 → 2.1.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/.eslintrc.js +34 -0
- package/ANALYSIS_SUMMARY.md +363 -0
- package/README.md +230 -245
- package/dist/analysis/analysis-engine.d.ts +63 -0
- package/dist/analysis/analysis-engine.d.ts.map +1 -0
- package/dist/analysis/analysis-engine.js +322 -0
- package/dist/analysis/analysis-engine.js.map +1 -0
- package/dist/core/config.d.ts +1419 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +361 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/engine.d.ts +176 -0
- package/dist/core/engine.d.ts.map +1 -0
- package/dist/core/engine.js +604 -0
- package/dist/core/engine.js.map +1 -0
- package/dist/core/errors.d.ts +153 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +287 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/{types.js → core/index.js} +8 -4
- package/dist/core/index.js.map +1 -0
- package/dist/core/pipeline.d.ts +121 -0
- package/dist/core/pipeline.d.ts.map +1 -0
- package/dist/core/pipeline.js +289 -0
- package/dist/core/pipeline.js.map +1 -0
- package/dist/core/rate-limiter.d.ts +58 -0
- package/dist/core/rate-limiter.d.ts.map +1 -0
- package/dist/core/rate-limiter.js +133 -0
- package/dist/core/rate-limiter.js.map +1 -0
- package/dist/core/session-manager.d.ts +96 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +223 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/creativity/creativity-engine.d.ts +6 -0
- package/dist/creativity/creativity-engine.d.ts.map +1 -0
- package/dist/creativity/creativity-engine.js +17 -0
- package/dist/creativity/creativity-engine.js.map +1 -0
- package/dist/index.d.ts +24 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +130 -104
- package/dist/index.js.map +1 -1
- package/dist/learning/learning-engine.d.ts +6 -0
- package/dist/learning/learning-engine.d.ts.map +1 -0
- package/dist/learning/learning-engine.js +17 -0
- package/dist/learning/learning-engine.js.map +1 -0
- package/dist/llm/index.d.ts +10 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +26 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/llm-service.d.ts +109 -0
- package/dist/llm/llm-service.d.ts.map +1 -0
- package/dist/llm/llm-service.js +224 -0
- package/dist/llm/llm-service.js.map +1 -0
- package/dist/llm/providers/base.d.ts +85 -0
- package/dist/llm/providers/base.d.ts.map +1 -0
- package/dist/llm/providers/base.js +57 -0
- package/dist/llm/providers/base.js.map +1 -0
- package/dist/llm/providers/cli.d.ts +23 -0
- package/dist/llm/providers/cli.d.ts.map +1 -0
- package/dist/llm/providers/cli.js +158 -0
- package/dist/llm/providers/cli.js.map +1 -0
- package/dist/llm/providers/gemini.d.ts +30 -0
- package/dist/llm/providers/gemini.d.ts.map +1 -0
- package/dist/llm/providers/gemini.js +168 -0
- package/dist/llm/providers/gemini.js.map +1 -0
- package/dist/llm/sanitization.d.ts +50 -0
- package/dist/llm/sanitization.d.ts.map +1 -0
- package/dist/llm/sanitization.js +149 -0
- package/dist/llm/sanitization.js.map +1 -0
- package/dist/{server.d.ts.map → mcp/server.d.ts.map} +1 -1
- package/dist/mcp/server.js +108 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/planning/planning-engine.d.ts +6 -0
- package/dist/planning/planning-engine.d.ts.map +1 -0
- package/dist/planning/planning-engine.js +17 -0
- package/dist/planning/planning-engine.js.map +1 -0
- package/dist/reasoning/reasoning-engine.d.ts +6 -0
- package/dist/reasoning/reasoning-engine.d.ts.map +1 -0
- package/dist/reasoning/reasoning-engine.js +17 -0
- package/dist/reasoning/reasoning-engine.js.map +1 -0
- package/dist/search/search-engine.d.ts +99 -0
- package/dist/search/search-engine.d.ts.map +1 -0
- package/dist/search/search-engine.js +271 -0
- package/dist/search/search-engine.js.map +1 -0
- package/dist/synthesis/synthesis-engine.d.ts +6 -0
- package/dist/synthesis/synthesis-engine.d.ts.map +1 -0
- package/dist/synthesis/synthesis-engine.js +17 -0
- package/dist/synthesis/synthesis-engine.js.map +1 -0
- package/dist/types/analysis.d.ts +1534 -49
- package/dist/types/analysis.d.ts.map +1 -1
- package/dist/types/analysis.js +250 -0
- package/dist/types/analysis.js.map +1 -1
- package/dist/types/core.d.ts +257 -30
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/core.js +148 -18
- package/dist/types/core.js.map +1 -1
- package/dist/types/creativity.d.ts +2871 -56
- package/dist/types/creativity.d.ts.map +1 -1
- package/dist/types/creativity.js +195 -0
- package/dist/types/creativity.js.map +1 -1
- package/dist/types/index.d.ts +6 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +17 -2
- package/dist/types/index.js.map +1 -1
- package/dist/types/learning.d.ts +851 -61
- package/dist/types/learning.d.ts.map +1 -1
- package/dist/types/learning.js +155 -0
- package/dist/types/learning.js.map +1 -1
- package/dist/types/planning.d.ts +2223 -71
- package/dist/types/planning.d.ts.map +1 -1
- package/dist/types/planning.js +190 -0
- package/dist/types/planning.js.map +1 -1
- package/dist/types/reasoning.d.ts +2209 -72
- package/dist/types/reasoning.d.ts.map +1 -1
- package/dist/types/reasoning.js +200 -1
- package/dist/types/reasoning.js.map +1 -1
- package/dist/types/search.d.ts +981 -53
- package/dist/types/search.d.ts.map +1 -1
- package/dist/types/search.js +137 -0
- package/dist/types/search.js.map +1 -1
- package/dist/types/synthesis.d.ts +583 -37
- package/dist/types/synthesis.d.ts.map +1 -1
- package/dist/types/synthesis.js +138 -0
- package/dist/types/synthesis.js.map +1 -1
- package/dist/utils/cache.d.ts +144 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +288 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/id-generator.d.ts +89 -0
- package/dist/utils/id-generator.d.ts.map +1 -0
- package/dist/utils/id-generator.js +132 -0
- package/dist/utils/id-generator.js.map +1 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +33 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +142 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +248 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/metrics.d.ts +149 -0
- package/dist/utils/metrics.d.ts.map +1 -0
- package/dist/utils/metrics.js +296 -0
- package/dist/utils/metrics.js.map +1 -0
- package/dist/utils/timer.d.ts +7 -0
- package/dist/utils/timer.d.ts.map +1 -0
- package/dist/utils/timer.js +17 -0
- package/dist/utils/timer.js.map +1 -0
- package/dist/utils/validation.d.ts +147 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +275 -0
- package/dist/utils/validation.js.map +1 -0
- package/docs/API.md +411 -0
- package/docs/ARCHITECTURE.md +271 -0
- package/docs/CHANGELOG.md +283 -0
- package/jest.config.js +28 -0
- package/package.json +43 -30
- package/src/analysis/analysis-engine.ts +383 -0
- package/src/core/config.ts +406 -0
- package/src/core/engine.ts +785 -0
- package/src/core/errors.ts +349 -0
- package/src/core/index.ts +12 -0
- package/src/core/pipeline.ts +424 -0
- package/src/core/rate-limiter.ts +155 -0
- package/src/core/session-manager.ts +269 -0
- package/src/creativity/creativity-engine.ts +14 -0
- package/src/index.ts +178 -0
- package/src/learning/learning-engine.ts +14 -0
- package/src/llm/index.ts +10 -0
- package/src/llm/llm-service.ts +285 -0
- package/src/llm/providers/base.ts +146 -0
- package/src/llm/providers/cli.ts +186 -0
- package/src/llm/providers/gemini.ts +201 -0
- package/src/llm/sanitization.ts +178 -0
- package/src/mcp/server.ts +117 -0
- package/src/planning/planning-engine.ts +14 -0
- package/src/reasoning/reasoning-engine.ts +14 -0
- package/src/search/search-engine.ts +333 -0
- package/src/synthesis/synthesis-engine.ts +14 -0
- package/src/types/analysis.ts +337 -0
- package/src/types/core.ts +342 -0
- package/src/types/creativity.ts +268 -0
- package/src/types/index.ts +31 -0
- package/src/types/learning.ts +215 -0
- package/src/types/planning.ts +251 -0
- package/src/types/reasoning.ts +288 -0
- package/src/types/search.ts +192 -0
- package/src/types/synthesis.ts +187 -0
- package/src/utils/cache.ts +363 -0
- package/src/utils/id-generator.ts +135 -0
- package/src/utils/index.ts +22 -0
- package/src/utils/logger.ts +290 -0
- package/src/utils/metrics.ts +380 -0
- package/src/utils/timer.ts +15 -0
- package/src/utils/validation.ts +297 -0
- package/tests/setup.ts +22 -0
- package/tests/unit/cache.test.ts +189 -0
- package/tests/unit/engine.test.ts +179 -0
- package/tests/unit/validation.test.ts +218 -0
- package/tsconfig.json +17 -12
- package/GEMINI.md +0 -68
- package/analysis.ts +0 -1063
- package/creativity.ts +0 -1055
- package/dist/analysis.d.ts +0 -54
- package/dist/analysis.d.ts.map +0 -1
- package/dist/analysis.js +0 -866
- package/dist/analysis.js.map +0 -1
- package/dist/creativity.d.ts +0 -81
- package/dist/creativity.d.ts.map +0 -1
- package/dist/creativity.js +0 -828
- package/dist/creativity.js.map +0 -1
- package/dist/engine.d.ts +0 -90
- package/dist/engine.d.ts.map +0 -1
- package/dist/engine.js +0 -677
- package/dist/engine.js.map +0 -1
- package/dist/examples.d.ts +0 -7
- package/dist/examples.d.ts.map +0 -1
- package/dist/examples.js +0 -506
- package/dist/examples.js.map +0 -1
- package/dist/learning.d.ts +0 -72
- package/dist/learning.d.ts.map +0 -1
- package/dist/learning.js +0 -615
- package/dist/learning.js.map +0 -1
- package/dist/llm-service.d.ts +0 -21
- package/dist/llm-service.d.ts.map +0 -1
- package/dist/llm-service.js +0 -100
- package/dist/llm-service.js.map +0 -1
- package/dist/planning.d.ts +0 -58
- package/dist/planning.d.ts.map +0 -1
- package/dist/planning.js +0 -824
- package/dist/planning.js.map +0 -1
- package/dist/reasoning.d.ts +0 -73
- package/dist/reasoning.d.ts.map +0 -1
- package/dist/reasoning.js +0 -845
- package/dist/reasoning.js.map +0 -1
- package/dist/search-discovery.d.ts +0 -73
- package/dist/search-discovery.d.ts.map +0 -1
- package/dist/search-discovery.js +0 -548
- package/dist/search-discovery.js.map +0 -1
- package/dist/server.js +0 -113
- package/dist/server.js.map +0 -1
- package/dist/types/engine.d.ts +0 -55
- package/dist/types/engine.d.ts.map +0 -1
- package/dist/types/engine.js +0 -3
- package/dist/types/engine.js.map +0 -1
- package/dist/types.d.ts +0 -6
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/engine.ts +0 -947
- package/examples.ts +0 -717
- package/index.ts +0 -106
- package/learning.ts +0 -779
- package/llm-service.ts +0 -120
- package/planning.ts +0 -1028
- package/reasoning.ts +0 -1079
- package/search-discovery.ts +0 -700
- package/server.ts +0 -115
- package/types/analysis.ts +0 -69
- package/types/core.ts +0 -90
- package/types/creativity.ts +0 -72
- package/types/engine.ts +0 -60
- package/types/index.ts +0 -9
- package/types/learning.ts +0 -69
- package/types/planning.ts +0 -85
- package/types/reasoning.ts +0 -92
- package/types/search.ts +0 -58
- package/types/synthesis.ts +0 -42
- package/types.ts +0 -6
- /package/dist/{server.d.ts → mcp/server.d.ts} +0 -0
package/server.ts
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import { thinkingEngine } from './engine';
|
|
6
|
-
import { ThinkingStage } from './types';
|
|
7
|
-
|
|
8
|
-
const server = new McpServer({
|
|
9
|
-
name: "gthinking",
|
|
10
|
-
version: "1.0.0",
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
// Register the main thinking tool
|
|
14
|
-
server.registerTool("think", {
|
|
15
|
-
title: "Sequential Thinking",
|
|
16
|
-
description: "A comprehensive intelligent thinking framework for complex problem solving, research, and analysis.",
|
|
17
|
-
inputSchema: {
|
|
18
|
-
query: z.string().describe("The query or problem to think about"),
|
|
19
|
-
context: z.string().optional().describe("Additional context for the thinking process"),
|
|
20
|
-
depth: z.enum(["surface", "moderate", "deep"]).optional().default("moderate").describe("Depth of analysis"),
|
|
21
|
-
complexity: z.enum(["simple", "moderate", "complex"]).optional().default("moderate").describe("Reasoning complexity"),
|
|
22
|
-
},
|
|
23
|
-
}, async (args) => {
|
|
24
|
-
try {
|
|
25
|
-
const response = await thinkingEngine.think({
|
|
26
|
-
id: `mcp_${Date.now()}`,
|
|
27
|
-
query: args.query,
|
|
28
|
-
context: args.context,
|
|
29
|
-
config: {
|
|
30
|
-
analysisDepth: args.depth as any,
|
|
31
|
-
reasoningComplexity: args.complexity as any,
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
content: [{
|
|
37
|
-
type: "text",
|
|
38
|
-
text: response.finalAnswer
|
|
39
|
-
}]
|
|
40
|
-
};
|
|
41
|
-
} catch (error) {
|
|
42
|
-
return {
|
|
43
|
-
content: [{
|
|
44
|
-
type: "text",
|
|
45
|
-
text: `Error: ${error instanceof Error ? error.message : String(error)}`
|
|
46
|
-
}],
|
|
47
|
-
isError: true
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// Register quick search tool
|
|
53
|
-
server.registerTool("quick_search", {
|
|
54
|
-
title: "Quick Search",
|
|
55
|
-
description: "Fast search and synthesis for current events or quick facts.",
|
|
56
|
-
inputSchema: {
|
|
57
|
-
query: z.string().describe("The search query"),
|
|
58
|
-
},
|
|
59
|
-
}, async (args) => {
|
|
60
|
-
try {
|
|
61
|
-
const response = await thinkingEngine.quickSearch(args.query);
|
|
62
|
-
return {
|
|
63
|
-
content: [{
|
|
64
|
-
type: "text",
|
|
65
|
-
text: response.finalAnswer
|
|
66
|
-
}]
|
|
67
|
-
};
|
|
68
|
-
} catch (error) {
|
|
69
|
-
return {
|
|
70
|
-
content: [{
|
|
71
|
-
type: "text",
|
|
72
|
-
text: `Error: ${error instanceof Error ? error.message : String(error)}`
|
|
73
|
-
}],
|
|
74
|
-
isError: true
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// Register creative solve tool
|
|
80
|
-
server.registerTool("creative_solve", {
|
|
81
|
-
title: "Creative Solve",
|
|
82
|
-
description: "Use creative thinking techniques (SCAMPER, Brainstorming, etc.) to solve a problem.",
|
|
83
|
-
inputSchema: {
|
|
84
|
-
problem: z.string().describe("The problem to solve creatively"),
|
|
85
|
-
},
|
|
86
|
-
}, async (args) => {
|
|
87
|
-
try {
|
|
88
|
-
const response = await thinkingEngine.creativeSolve(args.problem);
|
|
89
|
-
return {
|
|
90
|
-
content: [{
|
|
91
|
-
type: "text",
|
|
92
|
-
text: response.finalAnswer
|
|
93
|
-
}]
|
|
94
|
-
};
|
|
95
|
-
} catch (error) {
|
|
96
|
-
return {
|
|
97
|
-
content: [{
|
|
98
|
-
type: "text",
|
|
99
|
-
text: `Error: ${error instanceof Error ? error.message : String(error)}`
|
|
100
|
-
}],
|
|
101
|
-
isError: true
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
async function runServer() {
|
|
107
|
-
const transport = new StdioServerTransport();
|
|
108
|
-
await server.connect(transport);
|
|
109
|
-
console.error("GThinking MCP Server running on stdio");
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
runServer().catch((error) => {
|
|
113
|
-
console.error("Fatal error running server:", error);
|
|
114
|
-
process.exit(1);
|
|
115
|
-
});
|
package/types/analysis.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
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
|
-
}
|
package/types/creativity.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
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
DELETED
package/types/learning.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
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
|
-
}
|
package/types/planning.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
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
|
-
}
|
package/types/reasoning.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
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
|
-
}
|