deepthinking-mcp 3.0.2 → 3.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.
- package/README.md +30 -10
- package/dist/index.js +251 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# DeepThinking MCP v3.0
|
|
1
|
+
# DeepThinking MCP v3.1.0
|
|
2
2
|
|
|
3
|
-
A comprehensive Model Context Protocol (MCP) server featuring **
|
|
3
|
+
A comprehensive Model Context Protocol (MCP) server featuring **14 advanced reasoning modes** with intelligent mode recommendation, visual export capabilities, high-performance validation caching, comprehensive testing, and automated CI/CD for complex problem-solving, analysis, and decision-making.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
DeepThinking MCP v3.
|
|
7
|
+
DeepThinking MCP v3.1 provides a complete toolkit for structured reasoning with 14 specialized modes, an intelligent recommendation system, powerful visual export capabilities, and optimized performance through validation caching:
|
|
8
8
|
|
|
9
9
|
### Core Modes
|
|
10
10
|
- **Sequential**: Iterative refinement with revision capabilities
|
|
@@ -23,6 +23,7 @@ n### Phase 3 Modes (v2.3+)
|
|
|
23
23
|
- **Temporal**: Event timelines, temporal constraints, Allen's interval algebra, causal relations over time
|
|
24
24
|
- **Game Theory**: Nash equilibria, strategic analysis, payoff matrices, dominant strategies, game trees
|
|
25
25
|
- **Evidential**: Dempster-Shafer theory, belief functions, evidence combination, uncertainty intervals
|
|
26
|
+
- **First-Principles**: Deductive reasoning from foundational axioms and principles
|
|
26
27
|
|
|
27
28
|
## Features
|
|
28
29
|
|
|
@@ -45,6 +46,7 @@ n#### Phase 3 Reasoning Modes (v2.3+)
|
|
|
45
46
|
- **Temporal**: Model events, intervals, and temporal relationships using Allen's interval algebra. Track causality over time with timestamps, durations, and temporal constraints. Perfect for timeline analysis, scheduling problems, and understanding event sequences.
|
|
46
47
|
- **Game Theory**: Analyze strategic interactions between rational agents. Define games, players, and strategies. Compute Nash equilibria (pure and mixed), identify dominant strategies, construct payoff matrices, and build extensive-form game trees. Ideal for competitive analysis, mechanism design, and strategic decision-making.
|
|
47
48
|
- **Evidential**: Apply Dempster-Shafer theory for reasoning with uncertain and incomplete evidence. Define hypotheses, collect evidence with reliability scores, assign belief functions with mass assignments, combine evidence using Dempster's rule, compute belief and plausibility intervals, and make decisions under uncertainty. Ideal for sensor fusion, diagnostic reasoning, intelligence analysis, and situations with incomplete information.
|
|
49
|
+
- **First-Principles**: Derive conclusions from foundational axioms and principles using deductive reasoning. Define principles (axioms, definitions, observations), build derivation chains with logical inferences, track confidence levels, and reach conclusions with certainty analysis. Ideal for fundamental analysis, conceptual understanding, and reasoning from basic truths.
|
|
48
50
|
|
|
49
51
|
### Mathematical Enhancements
|
|
50
52
|
- **Symbolic computation** support with LaTeX and symbolic formats
|
|
@@ -192,11 +194,7 @@ Export your reasoning sessions as visual diagrams in multiple formats for presen
|
|
|
192
194
|
- **DOT**: Graphviz format for professional graph visualization and publication-quality diagrams
|
|
193
195
|
- **ASCII**: Plain text diagrams for terminal output, logs, and text-based documentation
|
|
194
196
|
|
|
195
|
-
#### Supported Modes
|
|
196
|
-
- **Causal Mode**: Export causal graphs showing cause-effect relationships with node types (causes, effects, mediators, confounders) and edge strengths
|
|
197
|
-
- **Temporal Mode**: Export timelines as Gantt charts showing events, intervals, and temporal relationships
|
|
198
|
-
- **Game Theory Mode**: Export game trees with strategies, decision nodes, and payoffs
|
|
199
|
-
- **Bayesian Mode**: Export Bayesian networks showing prior/posterior relationships and evidence flow
|
|
197
|
+
#### Supported Modes**All 14 modes now support visual export (100% coverage):**- **Causal Mode**: Export causal graphs showing cause-effect relationships with node types (causes, effects, mediators, confounders) and edge strengths- **Temporal Mode**: Export timelines as Gantt charts showing events, intervals, and temporal relationships- **Game Theory Mode**: Export game trees with strategies, decision nodes, and payoffs- **Bayesian Mode**: Export Bayesian networks showing prior/posterior relationships and evidence flow- **First-Principles Mode**: Export derivation chains showing question → principles → derivation steps → conclusion flow- **All Other Modes**: Generic thought sequence visualization showing reasoning progression for Sequential, Shannon, Mathematics, Physics, Hybrid, Abductive, Counterfactual, Analogical, and Evidential modes
|
|
200
198
|
|
|
201
199
|
#### Visual Export Examples
|
|
202
200
|
|
|
@@ -279,7 +277,7 @@ Visual exports work seamlessly with:
|
|
|
279
277
|
- `thoughtNumber` (number, required): Position in sequence
|
|
280
278
|
- `totalThoughts` (number, required): Estimated total thoughts needed
|
|
281
279
|
- `nextThoughtNeeded` (boolean, required): Whether to continue thinking
|
|
282
|
-
- `mode` (string, optional): `sequential`, `shannon`, `mathematics`, `physics`, `hybrid`, `abductive`, `causal`, `bayesian`, `counterfactual`, `analogical`, or `temporal` (default: `hybrid`)
|
|
280
|
+
- `mode` (string, optional): `sequential`, `shannon`, `mathematics`, `physics`, `hybrid`, `abductive`, `causal`, `bayesian`, `counterfactual`, `analogical`, or `temporal`, `gametheory`, `evidential`, `firstprinciple` (default: `hybrid`)
|
|
283
281
|
|
|
284
282
|
### Mode-Specific Parameters
|
|
285
283
|
|
|
@@ -366,6 +364,26 @@ n#### Temporal Mode
|
|
|
366
364
|
- `combinedBelief`: Belief function resulting from Dempster-Shafer combination (includes conflictMass)
|
|
367
365
|
- `plausibility`: Plausibility function with belief/plausibility values and uncertainty intervals
|
|
368
366
|
- `decisions`: Decision analysis (selectedHypothesis, confidence, reasoning, alternatives)
|
|
367
|
+
n#### First-Principles Mode
|
|
368
|
+
- `question`: The question being answered from first principles
|
|
369
|
+
- `principles`: Array of foundational principles with:
|
|
370
|
+
- `id`: Unique identifier
|
|
371
|
+
- `type`: Principle type (axiom, definition, observation, logical_inference, assumption)
|
|
372
|
+
- `statement`: The principle statement
|
|
373
|
+
- `justification`: Why this principle is valid
|
|
374
|
+
- `dependsOn`: Optional array of principle IDs this depends on
|
|
375
|
+
- `derivationSteps`: Chain of reasoning steps with:
|
|
376
|
+
- `stepNumber`: Step position in derivation
|
|
377
|
+
- `principle`: The principle being applied
|
|
378
|
+
- `inference`: What is inferred from this principle
|
|
379
|
+
- `logicalForm`: Optional formal logic representation
|
|
380
|
+
- `confidence`: Confidence in this step (0-1)
|
|
381
|
+
- `conclusion`: Final conclusion with:
|
|
382
|
+
- `statement`: The conclusion statement
|
|
383
|
+
- `derivationChain`: Array of step numbers leading to conclusion
|
|
384
|
+
- `certainty`: Overall certainty level (0-1)
|
|
385
|
+
- `limitations`: Optional array of known limitations or assumptions
|
|
386
|
+
- `alternativeInterpretations`: Optional array of other possible interpretations
|
|
369
387
|
|
|
370
388
|
### Actions
|
|
371
389
|
- `add_thought` (default): Add a new thought to session
|
|
@@ -748,7 +766,7 @@ deepthinking-mcp/
|
|
|
748
766
|
- ✅ Comprehensive test suite (77 tests)
|
|
749
767
|
- ✅ Enhanced type safety
|
|
750
768
|
|
|
751
|
-
### Phase 3 (Completed - v3.0
|
|
769
|
+
### Phase 3 (Completed - v3.1.0)
|
|
752
770
|
- ✅ Temporal reasoning mode (v2.1)
|
|
753
771
|
- ✅ Game theory mode (v2.2)
|
|
754
772
|
- ✅ Evidential reasoning mode (v2.3)
|
|
@@ -758,6 +776,8 @@ deepthinking-mcp/
|
|
|
758
776
|
- ✅ Performance optimization with validation caching (v3.0)
|
|
759
777
|
- ✅ Integration tests & MCP compliance (v3.0.2)
|
|
760
778
|
- ✅ CI/CD pipeline with GitHub Actions (v3.0.2)
|
|
779
|
+
- ✅ First-Principles reasoning mode (v3.1.0)
|
|
780
|
+
- ✅ Universal visual export support for all 14 modes (v3.1.0)
|
|
761
781
|
|
|
762
782
|
### Phase 4 (Planned)
|
|
763
783
|
- [ ] Math-MCP integration
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { z } from 'zod';
|
|
|
10
10
|
|
|
11
11
|
var ThinkingToolSchema = z.object({
|
|
12
12
|
sessionId: z.string().optional(),
|
|
13
|
-
mode: z.enum(["sequential", "shannon", "mathematics", "physics", "hybrid", "abductive", "causal", "bayesian", "counterfactual", "analogical", "temporal", "gametheory", "evidential"]).default("hybrid"),
|
|
13
|
+
mode: z.enum(["sequential", "shannon", "mathematics", "physics", "hybrid", "abductive", "causal", "bayesian", "counterfactual", "analogical", "temporal", "gametheory", "evidential", "firstprinciple"]).default("hybrid"),
|
|
14
14
|
thought: z.string(),
|
|
15
15
|
thoughtNumber: z.number().int().positive(),
|
|
16
16
|
totalThoughts: z.number().int().positive(),
|
|
@@ -397,9 +397,38 @@ var ThinkingToolSchema = z.object({
|
|
|
397
397
|
risk: z.number()
|
|
398
398
|
}))
|
|
399
399
|
})).optional(),
|
|
400
|
+
// First-principles reasoning properties (v3.1.0)
|
|
401
|
+
question: z.string().optional(),
|
|
402
|
+
principles: z.array(z.object({
|
|
403
|
+
id: z.string(),
|
|
404
|
+
type: z.enum(["axiom", "definition", "observation", "logical_inference", "assumption"]),
|
|
405
|
+
statement: z.string(),
|
|
406
|
+
justification: z.string(),
|
|
407
|
+
dependsOn: z.array(z.string()).optional()
|
|
408
|
+
})).optional(),
|
|
409
|
+
derivationSteps: z.array(z.object({
|
|
410
|
+
stepNumber: z.number(),
|
|
411
|
+
principle: z.object({
|
|
412
|
+
id: z.string(),
|
|
413
|
+
type: z.enum(["axiom", "definition", "observation", "logical_inference", "assumption"]),
|
|
414
|
+
statement: z.string(),
|
|
415
|
+
justification: z.string(),
|
|
416
|
+
dependsOn: z.array(z.string()).optional()
|
|
417
|
+
}),
|
|
418
|
+
inference: z.string(),
|
|
419
|
+
logicalForm: z.string().optional(),
|
|
420
|
+
confidence: z.number().min(0).max(1)
|
|
421
|
+
})).optional(),
|
|
422
|
+
conclusion: z.object({
|
|
423
|
+
statement: z.string(),
|
|
424
|
+
derivationChain: z.array(z.number()),
|
|
425
|
+
certainty: z.number().min(0).max(1),
|
|
426
|
+
limitations: z.array(z.string()).optional()
|
|
427
|
+
}).optional(),
|
|
428
|
+
alternativeInterpretations: z.array(z.string()).optional(),
|
|
400
429
|
action: z.enum(["add_thought", "summarize", "export", "switch_mode", "get_session", "recommend_mode"]).default("add_thought"),
|
|
401
430
|
exportFormat: z.enum(["markdown", "latex", "json", "html", "jupyter", "mermaid", "dot", "ascii"]).optional(),
|
|
402
|
-
newMode: z.enum(["sequential", "shannon", "mathematics", "physics", "hybrid", "abductive", "causal", "bayesian", "counterfactual", "analogical", "temporal", "gametheory", "evidential"]).optional(),
|
|
431
|
+
newMode: z.enum(["sequential", "shannon", "mathematics", "physics", "hybrid", "abductive", "causal", "bayesian", "counterfactual", "analogical", "temporal", "gametheory", "evidential", "firstprinciple"]).optional(),
|
|
403
432
|
// Mode recommendation parameters (v2.4)
|
|
404
433
|
problemType: z.string().optional(),
|
|
405
434
|
problemCharacteristics: z.object({
|
|
@@ -2447,6 +2476,215 @@ Bayes Factor: ${thought.bayesFactor.toFixed(2)}
|
|
|
2447
2476
|
sanitizeId(id) {
|
|
2448
2477
|
return id.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
2449
2478
|
}
|
|
2479
|
+
// ===== Generic Thought Sequence Export =====
|
|
2480
|
+
/**
|
|
2481
|
+
* Export any thought sequence as a flow diagram
|
|
2482
|
+
* Works for sequential, shannon, mathematics, physics, hybrid, abductive,
|
|
2483
|
+
* counterfactual, analogical, and evidential modes
|
|
2484
|
+
*/
|
|
2485
|
+
exportThoughtSequence(thoughts, options) {
|
|
2486
|
+
const { format, colorScheme = "default" } = options;
|
|
2487
|
+
switch (format) {
|
|
2488
|
+
case "mermaid":
|
|
2489
|
+
return this.thoughtSequenceToMermaid(thoughts, colorScheme);
|
|
2490
|
+
case "dot":
|
|
2491
|
+
return this.thoughtSequenceToDOT(thoughts);
|
|
2492
|
+
case "ascii":
|
|
2493
|
+
return this.thoughtSequenceToASCII(thoughts);
|
|
2494
|
+
default:
|
|
2495
|
+
throw new Error(`Unsupported format: ${format}`);
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
thoughtSequenceToMermaid(thoughts, colorScheme) {
|
|
2499
|
+
let mermaid = "graph TD\n";
|
|
2500
|
+
for (let i = 0; i < thoughts.length; i++) {
|
|
2501
|
+
const thought = thoughts[i];
|
|
2502
|
+
const nodeId = `T${i + 1}`;
|
|
2503
|
+
const content = thought.content.substring(0, 60).replace(/\n/g, " ");
|
|
2504
|
+
const label = `${i + 1}. ${content}${thought.content.length > 60 ? "..." : ""}`;
|
|
2505
|
+
mermaid += ` ${nodeId}["${label}"]
|
|
2506
|
+
`;
|
|
2507
|
+
if (i > 0) {
|
|
2508
|
+
mermaid += ` T${i} --> ${nodeId}
|
|
2509
|
+
`;
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
if (colorScheme !== "monochrome" && thoughts.length > 0) {
|
|
2513
|
+
mermaid += "\n";
|
|
2514
|
+
const color = colorScheme === "pastel" ? "#e1f5ff" : "#a8d5ff";
|
|
2515
|
+
mermaid += ` style T1 fill:${color}
|
|
2516
|
+
`;
|
|
2517
|
+
if (thoughts.length > 1) {
|
|
2518
|
+
const endColor = colorScheme === "pastel" ? "#e8f5e9" : "#c8e6c9";
|
|
2519
|
+
mermaid += ` style T${thoughts.length} fill:${endColor}
|
|
2520
|
+
`;
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
return mermaid;
|
|
2524
|
+
}
|
|
2525
|
+
thoughtSequenceToDOT(thoughts) {
|
|
2526
|
+
let dot = "digraph ThoughtSequence {\n";
|
|
2527
|
+
dot += " rankdir=TD;\n";
|
|
2528
|
+
dot += " node [shape=box, style=rounded];\n\n";
|
|
2529
|
+
for (let i = 0; i < thoughts.length; i++) {
|
|
2530
|
+
const thought = thoughts[i];
|
|
2531
|
+
const nodeId = `T${i + 1}`;
|
|
2532
|
+
const content = thought.content.substring(0, 60).replace(/"/g, '\\"').replace(/\n/g, " ");
|
|
2533
|
+
const label = `${i + 1}. ${content}${thought.content.length > 60 ? "..." : ""}`;
|
|
2534
|
+
dot += ` ${nodeId} [label="${label}"];
|
|
2535
|
+
`;
|
|
2536
|
+
if (i > 0) {
|
|
2537
|
+
dot += ` T${i} -> ${nodeId};
|
|
2538
|
+
`;
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
dot += "}\n";
|
|
2542
|
+
return dot;
|
|
2543
|
+
}
|
|
2544
|
+
thoughtSequenceToASCII(thoughts) {
|
|
2545
|
+
let ascii = "Thought Sequence:\n";
|
|
2546
|
+
ascii += "=================\n\n";
|
|
2547
|
+
for (let i = 0; i < thoughts.length; i++) {
|
|
2548
|
+
const thought = thoughts[i];
|
|
2549
|
+
ascii += `${i + 1}. ${thought.content}
|
|
2550
|
+
`;
|
|
2551
|
+
if (i < thoughts.length - 1) {
|
|
2552
|
+
ascii += " \u2193\n";
|
|
2553
|
+
}
|
|
2554
|
+
ascii += "\n";
|
|
2555
|
+
}
|
|
2556
|
+
return ascii;
|
|
2557
|
+
}
|
|
2558
|
+
// ===== First-Principles Export =====
|
|
2559
|
+
/**
|
|
2560
|
+
* Export first-principles reasoning to visual format
|
|
2561
|
+
*/
|
|
2562
|
+
exportFirstPrinciples(thought, options) {
|
|
2563
|
+
const { format, colorScheme = "default" } = options;
|
|
2564
|
+
switch (format) {
|
|
2565
|
+
case "mermaid":
|
|
2566
|
+
return this.firstPrinciplesToMermaid(thought, colorScheme);
|
|
2567
|
+
case "dot":
|
|
2568
|
+
return this.firstPrinciplesToDOT(thought);
|
|
2569
|
+
case "ascii":
|
|
2570
|
+
return this.firstPrinciplesToASCII(thought);
|
|
2571
|
+
default:
|
|
2572
|
+
throw new Error(`Unsupported format: ${format}`);
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
firstPrinciplesToMermaid(thought, colorScheme) {
|
|
2576
|
+
let mermaid = "graph TD\n";
|
|
2577
|
+
mermaid += ` Q["Question: ${thought.question}"]
|
|
2578
|
+
`;
|
|
2579
|
+
for (const principle of thought.principles) {
|
|
2580
|
+
const pid = this.sanitizeId(principle.id);
|
|
2581
|
+
mermaid += ` ${pid}["${principle.type}: ${principle.statement}"]
|
|
2582
|
+
`;
|
|
2583
|
+
}
|
|
2584
|
+
for (const step of thought.derivationSteps) {
|
|
2585
|
+
const sid = `S${step.stepNumber}`;
|
|
2586
|
+
const pid = this.sanitizeId(step.principle.id);
|
|
2587
|
+
mermaid += ` ${sid}["Step ${step.stepNumber}: ${step.inference}"]
|
|
2588
|
+
`;
|
|
2589
|
+
mermaid += ` ${pid} --> ${sid}
|
|
2590
|
+
`;
|
|
2591
|
+
if (step.stepNumber > 1) {
|
|
2592
|
+
mermaid += ` S${step.stepNumber - 1} --> ${sid}
|
|
2593
|
+
`;
|
|
2594
|
+
} else {
|
|
2595
|
+
mermaid += ` Q --> ${pid}
|
|
2596
|
+
`;
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
mermaid += ` C[["Conclusion: ${thought.conclusion.statement}"]]:
|
|
2600
|
+
`;
|
|
2601
|
+
if (thought.derivationSteps.length > 0) {
|
|
2602
|
+
mermaid += ` S${thought.derivationSteps.length} --> C
|
|
2603
|
+
`;
|
|
2604
|
+
}
|
|
2605
|
+
if (colorScheme !== "monochrome") {
|
|
2606
|
+
mermaid += "\n";
|
|
2607
|
+
const qColor = colorScheme === "pastel" ? "#fff3e0" : "#ffeb3b";
|
|
2608
|
+
const cColor = colorScheme === "pastel" ? "#e8f5e9" : "#4caf50";
|
|
2609
|
+
mermaid += ` style Q fill:${qColor}
|
|
2610
|
+
`;
|
|
2611
|
+
mermaid += ` style C fill:${cColor}
|
|
2612
|
+
`;
|
|
2613
|
+
}
|
|
2614
|
+
return mermaid;
|
|
2615
|
+
}
|
|
2616
|
+
firstPrinciplesToDOT(thought) {
|
|
2617
|
+
let dot = "digraph FirstPrinciples {\n";
|
|
2618
|
+
dot += " rankdir=TD;\n";
|
|
2619
|
+
dot += " node [shape=box, style=rounded];\n\n";
|
|
2620
|
+
dot += ` Q [label="Question:\\n${thought.question}", shape=ellipse];
|
|
2621
|
+
`;
|
|
2622
|
+
for (const principle of thought.principles) {
|
|
2623
|
+
const pid = this.sanitizeId(principle.id);
|
|
2624
|
+
dot += ` ${pid} [label="${principle.type}:\\n${principle.statement}"];
|
|
2625
|
+
`;
|
|
2626
|
+
}
|
|
2627
|
+
for (const step of thought.derivationSteps) {
|
|
2628
|
+
const sid = `S${step.stepNumber}`;
|
|
2629
|
+
const pid = this.sanitizeId(step.principle.id);
|
|
2630
|
+
dot += ` ${sid} [label="Step ${step.stepNumber}:\\n${step.inference}"];
|
|
2631
|
+
`;
|
|
2632
|
+
dot += ` ${pid} -> ${sid};
|
|
2633
|
+
`;
|
|
2634
|
+
if (step.stepNumber > 1) {
|
|
2635
|
+
dot += ` S${step.stepNumber - 1} -> ${sid};
|
|
2636
|
+
`;
|
|
2637
|
+
} else {
|
|
2638
|
+
dot += ` Q -> ${pid};
|
|
2639
|
+
`;
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
dot += ` C [label="Conclusion:\\n${thought.conclusion.statement}", shape=doubleoctagon];
|
|
2643
|
+
`;
|
|
2644
|
+
if (thought.derivationSteps.length > 0) {
|
|
2645
|
+
dot += ` S${thought.derivationSteps.length} -> C;
|
|
2646
|
+
`;
|
|
2647
|
+
}
|
|
2648
|
+
dot += "}\n";
|
|
2649
|
+
return dot;
|
|
2650
|
+
}
|
|
2651
|
+
firstPrinciplesToASCII(thought) {
|
|
2652
|
+
let ascii = "First-Principles Reasoning:\n";
|
|
2653
|
+
ascii += "===========================\n\n";
|
|
2654
|
+
ascii += `Question: ${thought.question}
|
|
2655
|
+
|
|
2656
|
+
`;
|
|
2657
|
+
ascii += "Foundational Principles:\n";
|
|
2658
|
+
for (const principle of thought.principles) {
|
|
2659
|
+
ascii += ` \u2022 [${principle.type}] ${principle.statement}
|
|
2660
|
+
`;
|
|
2661
|
+
ascii += ` Justification: ${principle.justification}
|
|
2662
|
+
`;
|
|
2663
|
+
}
|
|
2664
|
+
ascii += "\n";
|
|
2665
|
+
ascii += "Derivation Chain:\n";
|
|
2666
|
+
for (const step of thought.derivationSteps) {
|
|
2667
|
+
ascii += ` ${step.stepNumber}. ${step.inference}
|
|
2668
|
+
`;
|
|
2669
|
+
ascii += ` (From: ${step.principle.statement})
|
|
2670
|
+
`;
|
|
2671
|
+
ascii += ` Confidence: ${(step.confidence * 100).toFixed(0)}%
|
|
2672
|
+
`;
|
|
2673
|
+
}
|
|
2674
|
+
ascii += "\n";
|
|
2675
|
+
ascii += `Conclusion: ${thought.conclusion.statement}
|
|
2676
|
+
`;
|
|
2677
|
+
ascii += `Certainty: ${(thought.conclusion.certainty * 100).toFixed(0)}%
|
|
2678
|
+
`;
|
|
2679
|
+
if (thought.conclusion.limitations && thought.conclusion.limitations.length > 0) {
|
|
2680
|
+
ascii += "\nLimitations:\n";
|
|
2681
|
+
for (const limitation of thought.conclusion.limitations) {
|
|
2682
|
+
ascii += ` \u2022 ${limitation}
|
|
2683
|
+
`;
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
return ascii;
|
|
2687
|
+
}
|
|
2450
2688
|
};
|
|
2451
2689
|
|
|
2452
2690
|
// src/utils/type-guards.ts
|
|
@@ -2637,8 +2875,16 @@ async function handleExport(input) {
|
|
|
2637
2875
|
includeLabels: true,
|
|
2638
2876
|
includeMetrics: true
|
|
2639
2877
|
});
|
|
2878
|
+
} else if (lastThought.mode === "firstprinciple" && "question" in lastThought) {
|
|
2879
|
+
exported2 = visualExporter.exportFirstPrinciples(lastThought, {
|
|
2880
|
+
format,
|
|
2881
|
+
colorScheme: "default"
|
|
2882
|
+
});
|
|
2640
2883
|
} else {
|
|
2641
|
-
|
|
2884
|
+
exported2 = visualExporter.exportThoughtSequence(session.thoughts, {
|
|
2885
|
+
format,
|
|
2886
|
+
colorScheme: "default"
|
|
2887
|
+
});
|
|
2642
2888
|
}
|
|
2643
2889
|
return {
|
|
2644
2890
|
content: [{
|
|
@@ -2873,6 +3119,8 @@ function createThought(input, sessionId) {
|
|
|
2873
3119
|
plausibility: input.plausibility,
|
|
2874
3120
|
decisions: input.decisions || []
|
|
2875
3121
|
};
|
|
3122
|
+
case "firstprinciple":
|
|
3123
|
+
return { ...baseThought, mode: "firstprinciple" /* FIRSTPRINCIPLE */, question: input.question || "", principles: input.principles || [], derivationSteps: input.derivationSteps || [], conclusion: input.conclusion || { statement: "", derivationChain: [], certainty: 0 }, alternativeInterpretations: input.alternativeInterpretations || [] };
|
|
2876
3124
|
case "hybrid":
|
|
2877
3125
|
default:
|
|
2878
3126
|
return {
|