deepthinking-mcp 6.0.0 → 6.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/dist/index.js CHANGED
@@ -5198,6 +5198,1104 @@ var init_formal_logic = __esm({
5198
5198
  }
5199
5199
  });
5200
5200
 
5201
+ // src/export/visual/mathematics.ts
5202
+ function exportMathematicsDerivation(thought, options) {
5203
+ const { format, colorScheme = "default", includeLabels = true, includeMetrics = true } = options;
5204
+ switch (format) {
5205
+ case "mermaid":
5206
+ return mathematicsToMermaid(thought, colorScheme, includeLabels, includeMetrics);
5207
+ case "dot":
5208
+ return mathematicsToDOT(thought, includeLabels, includeMetrics);
5209
+ case "ascii":
5210
+ return mathematicsToASCII(thought);
5211
+ default:
5212
+ throw new Error(`Unsupported format: ${format}`);
5213
+ }
5214
+ }
5215
+ function mathematicsToMermaid(thought, colorScheme, includeLabels, includeMetrics) {
5216
+ let mermaid = "graph TB\n";
5217
+ const typeId = sanitizeId(`type_${thought.thoughtType || "proof"}`);
5218
+ const typeLabel = includeLabels ? (thought.thoughtType || "Proof").replace(/_/g, " ") : typeId;
5219
+ mermaid += ` ${typeId}[["${typeLabel}"]]
5220
+ `;
5221
+ if (thought.proofStrategy) {
5222
+ const strategyId = sanitizeId("strategy");
5223
+ const strategyLabel = thought.proofStrategy.type;
5224
+ mermaid += ` ${strategyId}(["${strategyLabel}"])
5225
+ `;
5226
+ mermaid += ` ${typeId} --> ${strategyId}
5227
+ `;
5228
+ let prevStepId = strategyId;
5229
+ thought.proofStrategy.steps.forEach((step, index) => {
5230
+ const stepId = sanitizeId(`step_${index}`);
5231
+ const stepLabel = includeLabels ? step.slice(0, 40) + (step.length > 40 ? "..." : "") : `Step ${index + 1}`;
5232
+ mermaid += ` ${stepId}["${stepLabel}"]
5233
+ `;
5234
+ mermaid += ` ${prevStepId} --> ${stepId}
5235
+ `;
5236
+ prevStepId = stepId;
5237
+ });
5238
+ if (includeMetrics) {
5239
+ const completenessId = sanitizeId("completeness");
5240
+ const completenessLabel = `Completeness: ${(thought.proofStrategy.completeness * 100).toFixed(0)}%`;
5241
+ mermaid += ` ${completenessId}{{${completenessLabel}}}
5242
+ `;
5243
+ mermaid += ` ${prevStepId} --> ${completenessId}
5244
+ `;
5245
+ }
5246
+ }
5247
+ if (thought.mathematicalModel) {
5248
+ const modelId = sanitizeId("model");
5249
+ const modelLabel = thought.mathematicalModel.symbolic || "Mathematical Model";
5250
+ mermaid += ` ${modelId}["${modelLabel}"]
5251
+ `;
5252
+ mermaid += ` ${typeId} --> ${modelId}
5253
+ `;
5254
+ }
5255
+ if (thought.theorems && thought.theorems.length > 0) {
5256
+ thought.theorems.forEach((theorem, index) => {
5257
+ const theoremId = sanitizeId(`theorem_${index}`);
5258
+ const theoremLabel = theorem.name || `Theorem ${index + 1}`;
5259
+ mermaid += ` ${theoremId}[/"${theoremLabel}"/]
5260
+ `;
5261
+ mermaid += ` ${typeId} --> ${theoremId}
5262
+ `;
5263
+ });
5264
+ }
5265
+ if (thought.assumptions && thought.assumptions.length > 0) {
5266
+ const assumptionsId = sanitizeId("assumptions");
5267
+ mermaid += ` ${assumptionsId}>"Assumptions: ${thought.assumptions.length}"]
5268
+ `;
5269
+ }
5270
+ if (colorScheme !== "monochrome") {
5271
+ const colors = colorScheme === "pastel" ? { type: "#e8f4e8", strategy: "#fff3e0"} : { type: "#90EE90", strategy: "#FFD700"};
5272
+ mermaid += `
5273
+ style ${typeId} fill:${colors.type}
5274
+ `;
5275
+ if (thought.proofStrategy) {
5276
+ mermaid += ` style ${sanitizeId("strategy")} fill:${colors.strategy}
5277
+ `;
5278
+ }
5279
+ }
5280
+ return mermaid;
5281
+ }
5282
+ function mathematicsToDOT(thought, includeLabels, includeMetrics) {
5283
+ let dot = "digraph MathematicsDerivation {\n";
5284
+ dot += " rankdir=TB;\n";
5285
+ dot += " node [shape=box, style=rounded];\n\n";
5286
+ const typeId = sanitizeId(`type_${thought.thoughtType || "proof"}`);
5287
+ const typeLabel = includeLabels ? (thought.thoughtType || "Proof").replace(/_/g, " ") : typeId;
5288
+ dot += ` ${typeId} [label="${typeLabel}", shape=doubleoctagon];
5289
+ `;
5290
+ if (thought.proofStrategy) {
5291
+ const strategyId = sanitizeId("strategy");
5292
+ dot += ` ${strategyId} [label="${thought.proofStrategy.type}", shape=ellipse];
5293
+ `;
5294
+ dot += ` ${typeId} -> ${strategyId};
5295
+ `;
5296
+ let prevStepId = strategyId;
5297
+ thought.proofStrategy.steps.forEach((step, index) => {
5298
+ const stepId = sanitizeId(`step_${index}`);
5299
+ const stepLabel = includeLabels ? step.slice(0, 30).replace(/"/g, '\\"') : `Step ${index + 1}`;
5300
+ dot += ` ${stepId} [label="${stepLabel}"];
5301
+ `;
5302
+ dot += ` ${prevStepId} -> ${stepId};
5303
+ `;
5304
+ prevStepId = stepId;
5305
+ });
5306
+ if (includeMetrics) {
5307
+ const completenessId = sanitizeId("completeness");
5308
+ dot += ` ${completenessId} [label="${(thought.proofStrategy.completeness * 100).toFixed(0)}%", shape=diamond];
5309
+ `;
5310
+ dot += ` ${prevStepId} -> ${completenessId};
5311
+ `;
5312
+ }
5313
+ }
5314
+ if (thought.theorems) {
5315
+ thought.theorems.forEach((theorem, index) => {
5316
+ const theoremId = sanitizeId(`theorem_${index}`);
5317
+ dot += ` ${theoremId} [label="${theorem.name || `Theorem ${index + 1}`}", shape=parallelogram];
5318
+ `;
5319
+ dot += ` ${typeId} -> ${theoremId};
5320
+ `;
5321
+ });
5322
+ }
5323
+ dot += "}\n";
5324
+ return dot;
5325
+ }
5326
+ function mathematicsToASCII(thought) {
5327
+ let ascii = "Mathematics Derivation:\n";
5328
+ ascii += "=======================\n\n";
5329
+ ascii += `Type: ${(thought.thoughtType || "proof").replace(/_/g, " ")}
5330
+ `;
5331
+ ascii += `Uncertainty: ${(thought.uncertainty * 100).toFixed(1)}%
5332
+
5333
+ `;
5334
+ if (thought.mathematicalModel) {
5335
+ ascii += "Mathematical Model:\n";
5336
+ ascii += ` LaTeX: ${thought.mathematicalModel.latex}
5337
+ `;
5338
+ ascii += ` Symbolic: ${thought.mathematicalModel.symbolic}
5339
+ `;
5340
+ if (thought.mathematicalModel.ascii) {
5341
+ ascii += ` ASCII: ${thought.mathematicalModel.ascii}
5342
+ `;
5343
+ }
5344
+ ascii += "\n";
5345
+ }
5346
+ if (thought.proofStrategy) {
5347
+ ascii += `Proof Strategy: ${thought.proofStrategy.type}
5348
+ `;
5349
+ ascii += `Completeness: ${(thought.proofStrategy.completeness * 100).toFixed(0)}%
5350
+ `;
5351
+ ascii += "Steps:\n";
5352
+ thought.proofStrategy.steps.forEach((step, index) => {
5353
+ ascii += ` ${index + 1}. ${step}
5354
+ `;
5355
+ });
5356
+ if (thought.proofStrategy.baseCase) {
5357
+ ascii += `Base Case: ${thought.proofStrategy.baseCase}
5358
+ `;
5359
+ }
5360
+ if (thought.proofStrategy.inductiveStep) {
5361
+ ascii += `Inductive Step: ${thought.proofStrategy.inductiveStep}
5362
+ `;
5363
+ }
5364
+ ascii += "\n";
5365
+ }
5366
+ if (thought.theorems && thought.theorems.length > 0) {
5367
+ ascii += "Theorems:\n";
5368
+ thought.theorems.forEach((theorem, index) => {
5369
+ ascii += ` [${index + 1}] ${theorem.name}: ${theorem.statement}
5370
+ `;
5371
+ if (theorem.hypotheses.length > 0) {
5372
+ ascii += ` Hypotheses: ${theorem.hypotheses.join(", ")}
5373
+ `;
5374
+ }
5375
+ ascii += ` Conclusion: ${theorem.conclusion}
5376
+ `;
5377
+ });
5378
+ ascii += "\n";
5379
+ }
5380
+ if (thought.assumptions && thought.assumptions.length > 0) {
5381
+ ascii += "Assumptions:\n";
5382
+ thought.assumptions.forEach((assumption, index) => {
5383
+ ascii += ` ${index + 1}. ${assumption}
5384
+ `;
5385
+ });
5386
+ ascii += "\n";
5387
+ }
5388
+ if (thought.dependencies && thought.dependencies.length > 0) {
5389
+ ascii += "Dependencies:\n";
5390
+ thought.dependencies.forEach((dep, index) => {
5391
+ ascii += ` ${index + 1}. ${dep}
5392
+ `;
5393
+ });
5394
+ }
5395
+ return ascii;
5396
+ }
5397
+ var init_mathematics = __esm({
5398
+ "src/export/visual/mathematics.ts"() {
5399
+ init_esm_shims();
5400
+ init_utils();
5401
+ }
5402
+ });
5403
+
5404
+ // src/export/visual/physics.ts
5405
+ function exportPhysicsVisualization(thought, options) {
5406
+ const { format, colorScheme = "default", includeLabels = true, includeMetrics = true } = options;
5407
+ switch (format) {
5408
+ case "mermaid":
5409
+ return physicsToMermaid(thought, colorScheme, includeLabels, includeMetrics);
5410
+ case "dot":
5411
+ return physicsToDOT(thought, includeLabels, includeMetrics);
5412
+ case "ascii":
5413
+ return physicsToASCII(thought);
5414
+ default:
5415
+ throw new Error(`Unsupported format: ${format}`);
5416
+ }
5417
+ }
5418
+ function physicsToMermaid(thought, colorScheme, includeLabels, includeMetrics) {
5419
+ let mermaid = "graph TB\n";
5420
+ const typeId = sanitizeId(`type_${thought.thoughtType || "physics"}`);
5421
+ const typeLabel = includeLabels ? (thought.thoughtType || "Physics").replace(/_/g, " ") : typeId;
5422
+ mermaid += ` ${typeId}[["${typeLabel}"]]
5423
+ `;
5424
+ if (thought.tensorProperties) {
5425
+ const tensorId = sanitizeId("tensor");
5426
+ const rankLabel = `Rank (${thought.tensorProperties.rank[0]},${thought.tensorProperties.rank[1]})`;
5427
+ mermaid += ` ${tensorId}(["${rankLabel}"])
5428
+ `;
5429
+ mermaid += ` ${typeId} --> ${tensorId}
5430
+ `;
5431
+ const compId = sanitizeId("components");
5432
+ const compLabel = includeLabels ? thought.tensorProperties.components.slice(0, 30) + (thought.tensorProperties.components.length > 30 ? "..." : "") : "Components";
5433
+ mermaid += ` ${compId}["${compLabel}"]
5434
+ `;
5435
+ mermaid += ` ${tensorId} --> ${compId}
5436
+ `;
5437
+ if (thought.tensorProperties.symmetries.length > 0) {
5438
+ const symId = sanitizeId("symmetries");
5439
+ mermaid += ` ${symId}{{"Symmetries: ${thought.tensorProperties.symmetries.length}"}}
5440
+ `;
5441
+ mermaid += ` ${tensorId} --> ${symId}
5442
+ `;
5443
+ }
5444
+ if (thought.tensorProperties.invariants.length > 0) {
5445
+ const invId = sanitizeId("invariants");
5446
+ mermaid += ` ${invId}{{"Invariants: ${thought.tensorProperties.invariants.length}"}}
5447
+ `;
5448
+ mermaid += ` ${tensorId} --> ${invId}
5449
+ `;
5450
+ }
5451
+ }
5452
+ if (thought.physicalInterpretation) {
5453
+ const interpId = sanitizeId("interpretation");
5454
+ const interpLabel = thought.physicalInterpretation.quantity;
5455
+ mermaid += ` ${interpId}[/"${interpLabel}"/]
5456
+ `;
5457
+ mermaid += ` ${typeId} --> ${interpId}
5458
+ `;
5459
+ const unitsId = sanitizeId("units");
5460
+ mermaid += ` ${unitsId}(["${thought.physicalInterpretation.units}"])
5461
+ `;
5462
+ mermaid += ` ${interpId} --> ${unitsId}
5463
+ `;
5464
+ if (thought.physicalInterpretation.conservationLaws.length > 0) {
5465
+ thought.physicalInterpretation.conservationLaws.forEach((law, index) => {
5466
+ const lawId = sanitizeId(`conservation_${index}`);
5467
+ const lawLabel = includeLabels ? law.slice(0, 25) + (law.length > 25 ? "..." : "") : `Law ${index + 1}`;
5468
+ mermaid += ` ${lawId}>"${lawLabel}"]
5469
+ `;
5470
+ mermaid += ` ${interpId} --> ${lawId}
5471
+ `;
5472
+ });
5473
+ }
5474
+ }
5475
+ if (thought.fieldTheoryContext) {
5476
+ const fieldId = sanitizeId("field_theory");
5477
+ mermaid += ` ${fieldId}[("Field Theory")]
5478
+ `;
5479
+ mermaid += ` ${typeId} --> ${fieldId}
5480
+ `;
5481
+ thought.fieldTheoryContext.fields.forEach((field, index) => {
5482
+ const fId = sanitizeId(`field_${index}`);
5483
+ mermaid += ` ${fId}["${field}"]
5484
+ `;
5485
+ mermaid += ` ${fieldId} --> ${fId}
5486
+ `;
5487
+ });
5488
+ const symGroupId = sanitizeId("symmetry_group");
5489
+ mermaid += ` ${symGroupId}{{"${thought.fieldTheoryContext.symmetryGroup}"}}
5490
+ `;
5491
+ mermaid += ` ${fieldId} --> ${symGroupId}
5492
+ `;
5493
+ }
5494
+ if (includeMetrics) {
5495
+ const uncertId = sanitizeId("uncertainty");
5496
+ const uncertLabel = `Uncertainty: ${(thought.uncertainty * 100).toFixed(1)}%`;
5497
+ mermaid += ` ${uncertId}{{${uncertLabel}}}
5498
+ `;
5499
+ }
5500
+ if (thought.assumptions && thought.assumptions.length > 0) {
5501
+ const assumptionsId = sanitizeId("assumptions");
5502
+ mermaid += ` ${assumptionsId}>"Assumptions: ${thought.assumptions.length}"]
5503
+ `;
5504
+ }
5505
+ if (colorScheme !== "monochrome") {
5506
+ const colors = colorScheme === "pastel" ? { type: "#e3f2fd", tensor: "#fff3e0", interp: "#e8f5e9" } : { type: "#87CEEB", tensor: "#FFD700", interp: "#90EE90" };
5507
+ mermaid += `
5508
+ style ${typeId} fill:${colors.type}
5509
+ `;
5510
+ if (thought.tensorProperties) {
5511
+ mermaid += ` style ${sanitizeId("tensor")} fill:${colors.tensor}
5512
+ `;
5513
+ }
5514
+ if (thought.physicalInterpretation) {
5515
+ mermaid += ` style ${sanitizeId("interpretation")} fill:${colors.interp}
5516
+ `;
5517
+ }
5518
+ }
5519
+ return mermaid;
5520
+ }
5521
+ function physicsToDOT(thought, includeLabels, includeMetrics) {
5522
+ let dot = "digraph PhysicsVisualization {\n";
5523
+ dot += " rankdir=TB;\n";
5524
+ dot += " node [shape=box, style=rounded];\n\n";
5525
+ const typeId = sanitizeId(`type_${thought.thoughtType || "physics"}`);
5526
+ const typeLabel = includeLabels ? (thought.thoughtType || "Physics").replace(/_/g, " ") : typeId;
5527
+ dot += ` ${typeId} [label="${typeLabel}", shape=doubleoctagon];
5528
+ `;
5529
+ if (thought.tensorProperties) {
5530
+ const tensorId = sanitizeId("tensor");
5531
+ const rankLabel = `Rank (${thought.tensorProperties.rank[0]},${thought.tensorProperties.rank[1]})`;
5532
+ dot += ` ${tensorId} [label="${rankLabel}", shape=ellipse];
5533
+ `;
5534
+ dot += ` ${typeId} -> ${tensorId};
5535
+ `;
5536
+ const compId = sanitizeId("components");
5537
+ const compLabel = includeLabels ? thought.tensorProperties.components.slice(0, 25).replace(/"/g, '\\"') : "Components";
5538
+ dot += ` ${compId} [label="${compLabel}"];
5539
+ `;
5540
+ dot += ` ${tensorId} -> ${compId};
5541
+ `;
5542
+ const transId = sanitizeId("transformation");
5543
+ dot += ` ${transId} [label="${thought.tensorProperties.transformation}", shape=diamond];
5544
+ `;
5545
+ dot += ` ${tensorId} -> ${transId};
5546
+ `;
5547
+ }
5548
+ if (thought.physicalInterpretation) {
5549
+ const interpId = sanitizeId("interpretation");
5550
+ dot += ` ${interpId} [label="${thought.physicalInterpretation.quantity}", shape=parallelogram];
5551
+ `;
5552
+ dot += ` ${typeId} -> ${interpId};
5553
+ `;
5554
+ const unitsId = sanitizeId("units");
5555
+ dot += ` ${unitsId} [label="${thought.physicalInterpretation.units}", shape=ellipse];
5556
+ `;
5557
+ dot += ` ${interpId} -> ${unitsId};
5558
+ `;
5559
+ thought.physicalInterpretation.conservationLaws.forEach((law, index) => {
5560
+ const lawId = sanitizeId(`conservation_${index}`);
5561
+ const lawLabel = includeLabels ? law.slice(0, 20).replace(/"/g, '\\"') : `Law ${index + 1}`;
5562
+ dot += ` ${lawId} [label="${lawLabel}", shape=hexagon];
5563
+ `;
5564
+ dot += ` ${interpId} -> ${lawId};
5565
+ `;
5566
+ });
5567
+ }
5568
+ if (thought.fieldTheoryContext) {
5569
+ const fieldId = sanitizeId("field_theory");
5570
+ dot += ` ${fieldId} [label="Field Theory", shape=cylinder];
5571
+ `;
5572
+ dot += ` ${typeId} -> ${fieldId};
5573
+ `;
5574
+ thought.fieldTheoryContext.fields.forEach((field, index) => {
5575
+ const fId = sanitizeId(`field_${index}`);
5576
+ dot += ` ${fId} [label="${field}"];
5577
+ `;
5578
+ dot += ` ${fieldId} -> ${fId};
5579
+ `;
5580
+ });
5581
+ const symGroupId = sanitizeId("symmetry_group");
5582
+ dot += ` ${symGroupId} [label="${thought.fieldTheoryContext.symmetryGroup}", shape=diamond];
5583
+ `;
5584
+ dot += ` ${fieldId} -> ${symGroupId};
5585
+ `;
5586
+ }
5587
+ if (includeMetrics) {
5588
+ const uncertId = sanitizeId("uncertainty");
5589
+ dot += ` ${uncertId} [label="${(thought.uncertainty * 100).toFixed(1)}%", shape=diamond];
5590
+ `;
5591
+ }
5592
+ dot += "}\n";
5593
+ return dot;
5594
+ }
5595
+ function physicsToASCII(thought) {
5596
+ let ascii = "Physics Analysis:\n";
5597
+ ascii += "=================\n\n";
5598
+ ascii += `Type: ${(thought.thoughtType || "physics").replace(/_/g, " ")}
5599
+ `;
5600
+ ascii += `Uncertainty: ${(thought.uncertainty * 100).toFixed(1)}%
5601
+
5602
+ `;
5603
+ if (thought.tensorProperties) {
5604
+ ascii += "Tensor Properties:\n";
5605
+ ascii += ` Rank: (${thought.tensorProperties.rank[0]}, ${thought.tensorProperties.rank[1]})
5606
+ `;
5607
+ ascii += ` Components: ${thought.tensorProperties.components}
5608
+ `;
5609
+ ascii += ` LaTeX: ${thought.tensorProperties.latex}
5610
+ `;
5611
+ ascii += ` Transformation: ${thought.tensorProperties.transformation}
5612
+ `;
5613
+ if (thought.tensorProperties.indexStructure) {
5614
+ ascii += ` Index Structure: ${thought.tensorProperties.indexStructure}
5615
+ `;
5616
+ }
5617
+ if (thought.tensorProperties.coordinateSystem) {
5618
+ ascii += ` Coordinate System: ${thought.tensorProperties.coordinateSystem}
5619
+ `;
5620
+ }
5621
+ if (thought.tensorProperties.symmetries.length > 0) {
5622
+ ascii += " Symmetries:\n";
5623
+ thought.tensorProperties.symmetries.forEach((sym, index) => {
5624
+ ascii += ` ${index + 1}. ${sym}
5625
+ `;
5626
+ });
5627
+ }
5628
+ if (thought.tensorProperties.invariants.length > 0) {
5629
+ ascii += " Invariants:\n";
5630
+ thought.tensorProperties.invariants.forEach((inv, index) => {
5631
+ ascii += ` ${index + 1}. ${inv}
5632
+ `;
5633
+ });
5634
+ }
5635
+ ascii += "\n";
5636
+ }
5637
+ if (thought.physicalInterpretation) {
5638
+ ascii += "Physical Interpretation:\n";
5639
+ ascii += ` Quantity: ${thought.physicalInterpretation.quantity}
5640
+ `;
5641
+ ascii += ` Units: ${thought.physicalInterpretation.units}
5642
+ `;
5643
+ if (thought.physicalInterpretation.conservationLaws.length > 0) {
5644
+ ascii += " Conservation Laws:\n";
5645
+ thought.physicalInterpretation.conservationLaws.forEach((law, index) => {
5646
+ ascii += ` ${index + 1}. ${law}
5647
+ `;
5648
+ });
5649
+ }
5650
+ if (thought.physicalInterpretation.constraints && thought.physicalInterpretation.constraints.length > 0) {
5651
+ ascii += " Constraints:\n";
5652
+ thought.physicalInterpretation.constraints.forEach((constraint, index) => {
5653
+ ascii += ` ${index + 1}. ${constraint}
5654
+ `;
5655
+ });
5656
+ }
5657
+ if (thought.physicalInterpretation.observables && thought.physicalInterpretation.observables.length > 0) {
5658
+ ascii += " Observables:\n";
5659
+ thought.physicalInterpretation.observables.forEach((obs, index) => {
5660
+ ascii += ` ${index + 1}. ${obs}
5661
+ `;
5662
+ });
5663
+ }
5664
+ ascii += "\n";
5665
+ }
5666
+ if (thought.fieldTheoryContext) {
5667
+ ascii += "Field Theory Context:\n";
5668
+ ascii += ` Symmetry Group: ${thought.fieldTheoryContext.symmetryGroup}
5669
+ `;
5670
+ if (thought.fieldTheoryContext.fields.length > 0) {
5671
+ ascii += " Fields:\n";
5672
+ thought.fieldTheoryContext.fields.forEach((field, index) => {
5673
+ ascii += ` ${index + 1}. ${field}
5674
+ `;
5675
+ });
5676
+ }
5677
+ if (thought.fieldTheoryContext.interactions.length > 0) {
5678
+ ascii += " Interactions:\n";
5679
+ thought.fieldTheoryContext.interactions.forEach((interaction, index) => {
5680
+ ascii += ` ${index + 1}. ${interaction}
5681
+ `;
5682
+ });
5683
+ }
5684
+ if (thought.fieldTheoryContext.gaugeSymmetries && thought.fieldTheoryContext.gaugeSymmetries.length > 0) {
5685
+ ascii += " Gauge Symmetries:\n";
5686
+ thought.fieldTheoryContext.gaugeSymmetries.forEach((gauge, index) => {
5687
+ ascii += ` ${index + 1}. ${gauge}
5688
+ `;
5689
+ });
5690
+ }
5691
+ ascii += "\n";
5692
+ }
5693
+ if (thought.assumptions && thought.assumptions.length > 0) {
5694
+ ascii += "Assumptions:\n";
5695
+ thought.assumptions.forEach((assumption, index) => {
5696
+ ascii += ` ${index + 1}. ${assumption}
5697
+ `;
5698
+ });
5699
+ ascii += "\n";
5700
+ }
5701
+ if (thought.dependencies && thought.dependencies.length > 0) {
5702
+ ascii += "Dependencies:\n";
5703
+ thought.dependencies.forEach((dep, index) => {
5704
+ ascii += ` ${index + 1}. ${dep}
5705
+ `;
5706
+ });
5707
+ }
5708
+ return ascii;
5709
+ }
5710
+ var init_physics = __esm({
5711
+ "src/export/visual/physics.ts"() {
5712
+ init_esm_shims();
5713
+ init_utils();
5714
+ }
5715
+ });
5716
+
5717
+ // src/export/visual/hybrid.ts
5718
+ function exportHybridOrchestration(thought, options) {
5719
+ const { format, colorScheme = "default", includeLabels = true, includeMetrics = true } = options;
5720
+ switch (format) {
5721
+ case "mermaid":
5722
+ return hybridToMermaid(thought, colorScheme, includeLabels, includeMetrics);
5723
+ case "dot":
5724
+ return hybridToDOT(thought, includeLabels, includeMetrics);
5725
+ case "ascii":
5726
+ return hybridToASCII(thought);
5727
+ default:
5728
+ throw new Error(`Unsupported format: ${format}`);
5729
+ }
5730
+ }
5731
+ function hybridToMermaid(thought, colorScheme, includeLabels, includeMetrics) {
5732
+ let mermaid = "graph TB\n";
5733
+ const hybridId = sanitizeId("hybrid_mode");
5734
+ mermaid += ` ${hybridId}(("Hybrid Mode"))
5735
+ `;
5736
+ const primaryId = sanitizeId(`primary_${thought.primaryMode}`);
5737
+ const primaryLabel = includeLabels ? thought.primaryMode.charAt(0).toUpperCase() + thought.primaryMode.slice(1) : primaryId;
5738
+ mermaid += ` ${primaryId}[["${primaryLabel}"]]
5739
+ `;
5740
+ mermaid += ` ${hybridId} ==> ${primaryId}
5741
+ `;
5742
+ if (thought.secondaryFeatures && thought.secondaryFeatures.length > 0) {
5743
+ const secondaryId = sanitizeId("secondary_features");
5744
+ mermaid += ` ${secondaryId}(["Secondary Features"])
5745
+ `;
5746
+ mermaid += ` ${hybridId} --> ${secondaryId}
5747
+ `;
5748
+ thought.secondaryFeatures.forEach((feature, index) => {
5749
+ const featureId = sanitizeId(`feature_${index}`);
5750
+ const featureLabel = includeLabels ? feature.slice(0, 30) + (feature.length > 30 ? "..." : "") : `Feature ${index + 1}`;
5751
+ mermaid += ` ${featureId}["${featureLabel}"]
5752
+ `;
5753
+ mermaid += ` ${secondaryId} --> ${featureId}
5754
+ `;
5755
+ });
5756
+ }
5757
+ if (thought.switchReason) {
5758
+ const switchId = sanitizeId("switch_reason");
5759
+ const switchLabel = includeLabels ? thought.switchReason.slice(0, 40) + (thought.switchReason.length > 40 ? "..." : "") : "Switch Reason";
5760
+ mermaid += ` ${switchId}>"${switchLabel}"]
5761
+ `;
5762
+ mermaid += ` ${hybridId} -.-> ${switchId}
5763
+ `;
5764
+ }
5765
+ if (thought.stage) {
5766
+ const stageId = sanitizeId(`stage_${thought.stage}`);
5767
+ const stageLabel = thought.stage.replace(/_/g, " ");
5768
+ mermaid += ` ${stageId}{{"Stage: ${stageLabel}"}}
5769
+ `;
5770
+ mermaid += ` ${primaryId} --> ${stageId}
5771
+ `;
5772
+ }
5773
+ if (thought.mathematicalModel) {
5774
+ const modelId = sanitizeId("math_model");
5775
+ const modelLabel = thought.mathematicalModel.symbolic || "Mathematical Model";
5776
+ mermaid += ` ${modelId}["${modelLabel}"]
5777
+ `;
5778
+ mermaid += ` ${primaryId} --> ${modelId}
5779
+ `;
5780
+ }
5781
+ if (thought.tensorProperties) {
5782
+ const tensorId = sanitizeId("tensor");
5783
+ const tensorLabel = `Tensor (${thought.tensorProperties.rank[0]},${thought.tensorProperties.rank[1]})`;
5784
+ mermaid += ` ${tensorId}[/"${tensorLabel}"/]
5785
+ `;
5786
+ mermaid += ` ${primaryId} --> ${tensorId}
5787
+ `;
5788
+ }
5789
+ if (thought.physicalInterpretation) {
5790
+ const physId = sanitizeId("physical");
5791
+ mermaid += ` ${physId}[/"${thought.physicalInterpretation.quantity}"/]
5792
+ `;
5793
+ mermaid += ` ${primaryId} --> ${physId}
5794
+ `;
5795
+ }
5796
+ if (includeMetrics && thought.uncertainty !== void 0) {
5797
+ const uncertId = sanitizeId("uncertainty");
5798
+ const uncertLabel = `Uncertainty: ${(thought.uncertainty * 100).toFixed(1)}%`;
5799
+ mermaid += ` ${uncertId}{{${uncertLabel}}}
5800
+ `;
5801
+ }
5802
+ if (thought.assumptions && thought.assumptions.length > 0) {
5803
+ const assumptionsId = sanitizeId("assumptions");
5804
+ mermaid += ` ${assumptionsId}>"Assumptions: ${thought.assumptions.length}"]
5805
+ `;
5806
+ }
5807
+ if (thought.dependencies && thought.dependencies.length > 0) {
5808
+ const depsId = sanitizeId("dependencies");
5809
+ mermaid += ` ${depsId}>"Dependencies: ${thought.dependencies.length}"]
5810
+ `;
5811
+ }
5812
+ if (colorScheme !== "monochrome") {
5813
+ const colors = colorScheme === "pastel" ? { hybrid: "#e8f4e8", primary: "#e3f2fd", secondary: "#fff3e0" } : { hybrid: "#90EE90", primary: "#87CEEB", secondary: "#FFD700" };
5814
+ mermaid += `
5815
+ style ${hybridId} fill:${colors.hybrid}
5816
+ `;
5817
+ mermaid += ` style ${primaryId} fill:${colors.primary}
5818
+ `;
5819
+ if (thought.secondaryFeatures && thought.secondaryFeatures.length > 0) {
5820
+ mermaid += ` style ${sanitizeId("secondary_features")} fill:${colors.secondary}
5821
+ `;
5822
+ }
5823
+ }
5824
+ return mermaid;
5825
+ }
5826
+ function hybridToDOT(thought, includeLabels, includeMetrics) {
5827
+ let dot = "digraph HybridOrchestration {\n";
5828
+ dot += " rankdir=TB;\n";
5829
+ dot += " node [shape=box, style=rounded];\n\n";
5830
+ const hybridId = sanitizeId("hybrid_mode");
5831
+ dot += ` ${hybridId} [label="Hybrid Mode", shape=doubleoctagon];
5832
+ `;
5833
+ const primaryId = sanitizeId(`primary_${thought.primaryMode}`);
5834
+ const primaryLabel = thought.primaryMode.charAt(0).toUpperCase() + thought.primaryMode.slice(1);
5835
+ dot += ` ${primaryId} [label="${primaryLabel}", shape=box, style="filled,rounded", fillcolor=lightblue];
5836
+ `;
5837
+ dot += ` ${hybridId} -> ${primaryId} [style=bold, penwidth=2];
5838
+ `;
5839
+ if (thought.secondaryFeatures && thought.secondaryFeatures.length > 0) {
5840
+ const secondaryId = sanitizeId("secondary_features");
5841
+ dot += ` ${secondaryId} [label="Secondary Features", shape=ellipse];
5842
+ `;
5843
+ dot += ` ${hybridId} -> ${secondaryId};
5844
+ `;
5845
+ thought.secondaryFeatures.forEach((feature, index) => {
5846
+ const featureId = sanitizeId(`feature_${index}`);
5847
+ const featureLabel = includeLabels ? feature.slice(0, 25).replace(/"/g, '\\"') : `Feature ${index + 1}`;
5848
+ dot += ` ${featureId} [label="${featureLabel}"];
5849
+ `;
5850
+ dot += ` ${secondaryId} -> ${featureId};
5851
+ `;
5852
+ });
5853
+ }
5854
+ if (thought.switchReason) {
5855
+ const switchId = sanitizeId("switch_reason");
5856
+ const switchLabel = includeLabels ? thought.switchReason.slice(0, 30).replace(/"/g, '\\"') : "Switch Reason";
5857
+ dot += ` ${switchId} [label="${switchLabel}", shape=note];
5858
+ `;
5859
+ dot += ` ${hybridId} -> ${switchId} [style=dashed];
5860
+ `;
5861
+ }
5862
+ if (thought.stage) {
5863
+ const stageId = sanitizeId(`stage_${thought.stage}`);
5864
+ dot += ` ${stageId} [label="${thought.stage.replace(/_/g, " ")}", shape=diamond];
5865
+ `;
5866
+ dot += ` ${primaryId} -> ${stageId};
5867
+ `;
5868
+ }
5869
+ if (thought.mathematicalModel) {
5870
+ const modelId = sanitizeId("math_model");
5871
+ const modelLabel = thought.mathematicalModel.symbolic ? thought.mathematicalModel.symbolic.slice(0, 25).replace(/"/g, '\\"') : "Math Model";
5872
+ dot += ` ${modelId} [label="${modelLabel}", shape=parallelogram];
5873
+ `;
5874
+ dot += ` ${primaryId} -> ${modelId};
5875
+ `;
5876
+ }
5877
+ if (thought.tensorProperties) {
5878
+ const tensorId = sanitizeId("tensor");
5879
+ dot += ` ${tensorId} [label="Tensor (${thought.tensorProperties.rank[0]},${thought.tensorProperties.rank[1]})", shape=parallelogram];
5880
+ `;
5881
+ dot += ` ${primaryId} -> ${tensorId};
5882
+ `;
5883
+ }
5884
+ if (thought.physicalInterpretation) {
5885
+ const physId = sanitizeId("physical");
5886
+ dot += ` ${physId} [label="${thought.physicalInterpretation.quantity}", shape=parallelogram];
5887
+ `;
5888
+ dot += ` ${primaryId} -> ${physId};
5889
+ `;
5890
+ }
5891
+ if (includeMetrics && thought.uncertainty !== void 0) {
5892
+ const uncertId = sanitizeId("uncertainty");
5893
+ dot += ` ${uncertId} [label="${(thought.uncertainty * 100).toFixed(1)}%", shape=diamond];
5894
+ `;
5895
+ }
5896
+ dot += "}\n";
5897
+ return dot;
5898
+ }
5899
+ function hybridToASCII(thought) {
5900
+ let ascii = "Hybrid Mode Orchestration:\n";
5901
+ ascii += "==========================\n\n";
5902
+ ascii += `Primary Mode: ${thought.primaryMode.charAt(0).toUpperCase() + thought.primaryMode.slice(1)}
5903
+ `;
5904
+ if (thought.stage) {
5905
+ ascii += `Current Stage: ${thought.stage.replace(/_/g, " ")}
5906
+ `;
5907
+ }
5908
+ if (thought.uncertainty !== void 0) {
5909
+ ascii += `Uncertainty: ${(thought.uncertainty * 100).toFixed(1)}%
5910
+ `;
5911
+ }
5912
+ ascii += "\n";
5913
+ if (thought.switchReason) {
5914
+ ascii += `Switch Reason: ${thought.switchReason}
5915
+
5916
+ `;
5917
+ }
5918
+ if (thought.secondaryFeatures && thought.secondaryFeatures.length > 0) {
5919
+ ascii += "Secondary Features:\n";
5920
+ thought.secondaryFeatures.forEach((feature, index) => {
5921
+ ascii += ` ${index + 1}. ${feature}
5922
+ `;
5923
+ });
5924
+ ascii += "\n";
5925
+ }
5926
+ if (thought.mathematicalModel) {
5927
+ ascii += "Mathematical Model:\n";
5928
+ ascii += ` LaTeX: ${thought.mathematicalModel.latex}
5929
+ `;
5930
+ ascii += ` Symbolic: ${thought.mathematicalModel.symbolic}
5931
+ `;
5932
+ if (thought.mathematicalModel.ascii) {
5933
+ ascii += ` ASCII: ${thought.mathematicalModel.ascii}
5934
+ `;
5935
+ }
5936
+ ascii += "\n";
5937
+ }
5938
+ if (thought.tensorProperties) {
5939
+ ascii += "Tensor Properties:\n";
5940
+ ascii += ` Rank: (${thought.tensorProperties.rank[0]}, ${thought.tensorProperties.rank[1]})
5941
+ `;
5942
+ ascii += ` Components: ${thought.tensorProperties.components}
5943
+ `;
5944
+ ascii += ` Transformation: ${thought.tensorProperties.transformation}
5945
+ `;
5946
+ if (thought.tensorProperties.symmetries.length > 0) {
5947
+ ascii += " Symmetries:\n";
5948
+ thought.tensorProperties.symmetries.forEach((sym, index) => {
5949
+ ascii += ` ${index + 1}. ${sym}
5950
+ `;
5951
+ });
5952
+ }
5953
+ ascii += "\n";
5954
+ }
5955
+ if (thought.physicalInterpretation) {
5956
+ ascii += "Physical Interpretation:\n";
5957
+ ascii += ` Quantity: ${thought.physicalInterpretation.quantity}
5958
+ `;
5959
+ ascii += ` Units: ${thought.physicalInterpretation.units}
5960
+ `;
5961
+ if (thought.physicalInterpretation.conservationLaws.length > 0) {
5962
+ ascii += " Conservation Laws:\n";
5963
+ thought.physicalInterpretation.conservationLaws.forEach((law, index) => {
5964
+ ascii += ` ${index + 1}. ${law}
5965
+ `;
5966
+ });
5967
+ }
5968
+ ascii += "\n";
5969
+ }
5970
+ if (thought.assumptions && thought.assumptions.length > 0) {
5971
+ ascii += "Assumptions:\n";
5972
+ thought.assumptions.forEach((assumption, index) => {
5973
+ ascii += ` ${index + 1}. ${assumption}
5974
+ `;
5975
+ });
5976
+ ascii += "\n";
5977
+ }
5978
+ if (thought.dependencies && thought.dependencies.length > 0) {
5979
+ ascii += "Dependencies:\n";
5980
+ thought.dependencies.forEach((dep, index) => {
5981
+ ascii += ` ${index + 1}. ${dep}
5982
+ `;
5983
+ });
5984
+ ascii += "\n";
5985
+ }
5986
+ if (thought.revisionReason) {
5987
+ ascii += `Revision Reason: ${thought.revisionReason}
5988
+ `;
5989
+ }
5990
+ return ascii;
5991
+ }
5992
+ var init_hybrid = __esm({
5993
+ "src/export/visual/hybrid.ts"() {
5994
+ init_esm_shims();
5995
+ init_utils();
5996
+ }
5997
+ });
5998
+
5999
+ // src/export/visual/metareasoning.ts
6000
+ function exportMetaReasoningVisualization(thought, options) {
6001
+ const { format, colorScheme = "default", includeLabels = true, includeMetrics = true } = options;
6002
+ switch (format) {
6003
+ case "mermaid":
6004
+ return metaReasoningToMermaid(thought, colorScheme, includeLabels, includeMetrics);
6005
+ case "dot":
6006
+ return metaReasoningToDOT(thought, includeLabels, includeMetrics);
6007
+ case "ascii":
6008
+ return metaReasoningToASCII(thought);
6009
+ default:
6010
+ throw new Error(`Unsupported format: ${format}`);
6011
+ }
6012
+ }
6013
+ function metaReasoningToMermaid(thought, colorScheme, includeLabels, includeMetrics) {
6014
+ let mermaid = "graph TB\n";
6015
+ const metaId = sanitizeId("meta_reasoning");
6016
+ mermaid += ` ${metaId}(("Meta-Reasoning"))
6017
+ `;
6018
+ const currentId = sanitizeId("current_strategy");
6019
+ const currentLabel = includeLabels ? thought.currentStrategy.approach : "Current Strategy";
6020
+ mermaid += ` ${currentId}[["${currentLabel}"]]
6021
+ `;
6022
+ mermaid += ` ${metaId} ==> ${currentId}
6023
+ `;
6024
+ const modeId = sanitizeId("current_mode");
6025
+ mermaid += ` ${modeId}(["Mode: ${thought.currentStrategy.mode}"])
6026
+ `;
6027
+ mermaid += ` ${currentId} --> ${modeId}
6028
+ `;
6029
+ const evalId = sanitizeId("evaluation");
6030
+ mermaid += ` ${evalId}{{"Effectiveness: ${(thought.strategyEvaluation.effectiveness * 100).toFixed(0)}%"}}
6031
+ `;
6032
+ mermaid += ` ${currentId} --> ${evalId}
6033
+ `;
6034
+ if (thought.strategyEvaluation.issues.length > 0) {
6035
+ const issuesId = sanitizeId("issues");
6036
+ mermaid += ` ${issuesId}>"Issues: ${thought.strategyEvaluation.issues.length}"]
6037
+ `;
6038
+ mermaid += ` ${evalId} --> ${issuesId}
6039
+ `;
6040
+ }
6041
+ if (thought.strategyEvaluation.strengths.length > 0) {
6042
+ const strengthsId = sanitizeId("strengths");
6043
+ mermaid += ` ${strengthsId}>"Strengths: ${thought.strategyEvaluation.strengths.length}"]
6044
+ `;
6045
+ mermaid += ` ${evalId} --> ${strengthsId}
6046
+ `;
6047
+ }
6048
+ if (thought.alternativeStrategies.length > 0) {
6049
+ const altsId = sanitizeId("alternatives");
6050
+ mermaid += ` ${altsId}(["Alternative Strategies"])
6051
+ `;
6052
+ mermaid += ` ${metaId} --> ${altsId}
6053
+ `;
6054
+ thought.alternativeStrategies.forEach((alt, index) => {
6055
+ const altId = sanitizeId(`alt_${index}`);
6056
+ const altLabel = includeLabels ? `${alt.mode}: ${(alt.recommendationScore * 100).toFixed(0)}%` : `Alt ${index + 1}`;
6057
+ mermaid += ` ${altId}["${altLabel}"]
6058
+ `;
6059
+ mermaid += ` ${altsId} --> ${altId}
6060
+ `;
6061
+ });
6062
+ }
6063
+ const recId = sanitizeId("recommendation");
6064
+ const recLabel = `${thought.recommendation.action}${thought.recommendation.targetMode ? ` \u2192 ${thought.recommendation.targetMode}` : ""}`;
6065
+ mermaid += ` ${recId}[/"${recLabel}"/]
6066
+ `;
6067
+ mermaid += ` ${metaId} ==> ${recId}
6068
+ `;
6069
+ if (includeMetrics) {
6070
+ const confId = sanitizeId("rec_confidence");
6071
+ mermaid += ` ${confId}{{"Confidence: ${(thought.recommendation.confidence * 100).toFixed(0)}%"}}
6072
+ `;
6073
+ mermaid += ` ${recId} --> ${confId}
6074
+ `;
6075
+ }
6076
+ if (includeMetrics) {
6077
+ const qualityId = sanitizeId("quality");
6078
+ const qualityLabel = `Quality: ${(thought.qualityMetrics.overallQuality * 100).toFixed(0)}%`;
6079
+ mermaid += ` ${qualityId}{{"${qualityLabel}"}}
6080
+ `;
6081
+ mermaid += ` ${metaId} -.-> ${qualityId}
6082
+ `;
6083
+ }
6084
+ const resourceId = sanitizeId("resources");
6085
+ mermaid += ` ${resourceId}[("Complexity: ${thought.resourceAllocation.complexityLevel}")]
6086
+ `;
6087
+ mermaid += ` ${metaId} -.-> ${resourceId}
6088
+ `;
6089
+ const sessionId = sanitizeId("session");
6090
+ mermaid += ` ${sessionId}>"Thoughts: ${thought.sessionContext.totalThoughts}"]
6091
+ `;
6092
+ mermaid += ` ${metaId} -.-> ${sessionId}
6093
+ `;
6094
+ if (colorScheme !== "monochrome") {
6095
+ const colors = colorScheme === "pastel" ? { meta: "#f3e5f5", current: "#e3f2fd", rec: "#e8f5e9", alt: "#fff3e0" } : { meta: "#DDA0DD", current: "#87CEEB", rec: "#90EE90", alt: "#FFD700" };
6096
+ mermaid += `
6097
+ style ${metaId} fill:${colors.meta}
6098
+ `;
6099
+ mermaid += ` style ${currentId} fill:${colors.current}
6100
+ `;
6101
+ mermaid += ` style ${recId} fill:${colors.rec}
6102
+ `;
6103
+ if (thought.alternativeStrategies.length > 0) {
6104
+ mermaid += ` style ${sanitizeId("alternatives")} fill:${colors.alt}
6105
+ `;
6106
+ }
6107
+ }
6108
+ return mermaid;
6109
+ }
6110
+ function metaReasoningToDOT(thought, includeLabels, includeMetrics) {
6111
+ let dot = "digraph MetaReasoning {\n";
6112
+ dot += " rankdir=TB;\n";
6113
+ dot += " node [shape=box, style=rounded];\n\n";
6114
+ dot += " subgraph cluster_current {\n";
6115
+ dot += ' label="Current Strategy";\n';
6116
+ dot += " style=filled;\n";
6117
+ dot += " fillcolor=lightblue;\n";
6118
+ const currentId = sanitizeId("current_strategy");
6119
+ const currentLabel = includeLabels ? thought.currentStrategy.approach.slice(0, 30).replace(/"/g, '\\"') : "Current Strategy";
6120
+ dot += ` ${currentId} [label="${currentLabel}"];
6121
+ `;
6122
+ const modeId = sanitizeId("current_mode");
6123
+ dot += ` ${modeId} [label="${thought.currentStrategy.mode}", shape=ellipse];
6124
+ `;
6125
+ dot += ` ${currentId} -> ${modeId};
6126
+ `;
6127
+ if (includeMetrics) {
6128
+ const evalId = sanitizeId("evaluation");
6129
+ dot += ` ${evalId} [label="Eff: ${(thought.strategyEvaluation.effectiveness * 100).toFixed(0)}%", shape=diamond];
6130
+ `;
6131
+ dot += ` ${currentId} -> ${evalId};
6132
+ `;
6133
+ }
6134
+ dot += " }\n\n";
6135
+ if (thought.alternativeStrategies.length > 0) {
6136
+ dot += " subgraph cluster_alternatives {\n";
6137
+ dot += ' label="Alternatives";\n';
6138
+ dot += " style=filled;\n";
6139
+ dot += " fillcolor=lightyellow;\n";
6140
+ thought.alternativeStrategies.forEach((alt, index) => {
6141
+ const altId = sanitizeId(`alt_${index}`);
6142
+ const altLabel = `${alt.mode}\\n${(alt.recommendationScore * 100).toFixed(0)}%`;
6143
+ dot += ` ${altId} [label="${altLabel}"];
6144
+ `;
6145
+ });
6146
+ dot += " }\n\n";
6147
+ }
6148
+ const recId = sanitizeId("recommendation");
6149
+ const recLabel = `${thought.recommendation.action}${thought.recommendation.targetMode ? `\\n\u2192 ${thought.recommendation.targetMode}` : ""}`;
6150
+ dot += ` ${recId} [label="${recLabel}", shape=hexagon, style="filled", fillcolor=lightgreen];
6151
+ `;
6152
+ if (includeMetrics) {
6153
+ const qualityId = sanitizeId("quality");
6154
+ const qualityLabel = `Quality: ${(thought.qualityMetrics.overallQuality * 100).toFixed(0)}%`;
6155
+ dot += ` ${qualityId} [label="${qualityLabel}", shape=diamond];
6156
+ `;
6157
+ }
6158
+ dot += ` ${currentId} -> ${recId} [style=bold, penwidth=2];
6159
+ `;
6160
+ thought.alternativeStrategies.forEach((_, index) => {
6161
+ const altId = sanitizeId(`alt_${index}`);
6162
+ dot += ` ${altId} -> ${recId} [style=dashed];
6163
+ `;
6164
+ });
6165
+ dot += "}\n";
6166
+ return dot;
6167
+ }
6168
+ function metaReasoningToASCII(thought) {
6169
+ let ascii = "Meta-Reasoning Analysis:\n";
6170
+ ascii += "========================\n\n";
6171
+ ascii += "CURRENT STRATEGY\n";
6172
+ ascii += "----------------\n";
6173
+ ascii += `Mode: ${thought.currentStrategy.mode}
6174
+ `;
6175
+ ascii += `Approach: ${thought.currentStrategy.approach}
6176
+ `;
6177
+ ascii += `Thoughts Spent: ${thought.currentStrategy.thoughtsSpent}
6178
+ `;
6179
+ if (thought.currentStrategy.progressIndicators.length > 0) {
6180
+ ascii += "Progress Indicators:\n";
6181
+ thought.currentStrategy.progressIndicators.forEach((ind, index) => {
6182
+ ascii += ` ${index + 1}. ${ind}
6183
+ `;
6184
+ });
6185
+ }
6186
+ ascii += "\n";
6187
+ ascii += "STRATEGY EVALUATION\n";
6188
+ ascii += "-------------------\n";
6189
+ ascii += `Effectiveness: ${(thought.strategyEvaluation.effectiveness * 100).toFixed(1)}%
6190
+ `;
6191
+ ascii += `Efficiency: ${(thought.strategyEvaluation.efficiency * 100).toFixed(1)}%
6192
+ `;
6193
+ ascii += `Confidence: ${(thought.strategyEvaluation.confidence * 100).toFixed(1)}%
6194
+ `;
6195
+ ascii += `Progress Rate: ${thought.strategyEvaluation.progressRate.toFixed(2)} insights/thought
6196
+ `;
6197
+ ascii += `Quality Score: ${(thought.strategyEvaluation.qualityScore * 100).toFixed(1)}%
6198
+ `;
6199
+ if (thought.strategyEvaluation.strengths.length > 0) {
6200
+ ascii += "Strengths:\n";
6201
+ thought.strategyEvaluation.strengths.forEach((s, index) => {
6202
+ ascii += ` + ${index + 1}. ${s}
6203
+ `;
6204
+ });
6205
+ }
6206
+ if (thought.strategyEvaluation.issues.length > 0) {
6207
+ ascii += "Issues:\n";
6208
+ thought.strategyEvaluation.issues.forEach((issue, index) => {
6209
+ ascii += ` - ${index + 1}. ${issue}
6210
+ `;
6211
+ });
6212
+ }
6213
+ ascii += "\n";
6214
+ if (thought.alternativeStrategies.length > 0) {
6215
+ ascii += "ALTERNATIVE STRATEGIES\n";
6216
+ ascii += "----------------------\n";
6217
+ thought.alternativeStrategies.forEach((alt, index) => {
6218
+ ascii += `[${index + 1}] ${alt.mode}
6219
+ `;
6220
+ ascii += ` Reasoning: ${alt.reasoning}
6221
+ `;
6222
+ ascii += ` Expected Benefit: ${alt.expectedBenefit}
6223
+ `;
6224
+ ascii += ` Switching Cost: ${(alt.switchingCost * 100).toFixed(0)}%
6225
+ `;
6226
+ ascii += ` Recommendation Score: ${(alt.recommendationScore * 100).toFixed(0)}%
6227
+ `;
6228
+ });
6229
+ ascii += "\n";
6230
+ }
6231
+ ascii += "RECOMMENDATION\n";
6232
+ ascii += "--------------\n";
6233
+ ascii += `Action: ${thought.recommendation.action}
6234
+ `;
6235
+ if (thought.recommendation.targetMode) {
6236
+ ascii += `Target Mode: ${thought.recommendation.targetMode}
6237
+ `;
6238
+ }
6239
+ ascii += `Justification: ${thought.recommendation.justification}
6240
+ `;
6241
+ ascii += `Confidence: ${(thought.recommendation.confidence * 100).toFixed(1)}%
6242
+ `;
6243
+ ascii += `Expected Improvement: ${thought.recommendation.expectedImprovement}
6244
+ `;
6245
+ ascii += "\n";
6246
+ ascii += "RESOURCE ALLOCATION\n";
6247
+ ascii += "-------------------\n";
6248
+ ascii += `Time Spent: ${thought.resourceAllocation.timeSpent}ms
6249
+ `;
6250
+ ascii += `Thoughts Remaining: ${thought.resourceAllocation.thoughtsRemaining}
6251
+ `;
6252
+ ascii += `Complexity: ${thought.resourceAllocation.complexityLevel}
6253
+ `;
6254
+ ascii += `Urgency: ${thought.resourceAllocation.urgency}
6255
+ `;
6256
+ ascii += `Recommendation: ${thought.resourceAllocation.recommendation}
6257
+ `;
6258
+ ascii += "\n";
6259
+ ascii += "QUALITY METRICS\n";
6260
+ ascii += "---------------\n";
6261
+ ascii += `Logical Consistency: ${(thought.qualityMetrics.logicalConsistency * 100).toFixed(1)}%
6262
+ `;
6263
+ ascii += `Evidence Quality: ${(thought.qualityMetrics.evidenceQuality * 100).toFixed(1)}%
6264
+ `;
6265
+ ascii += `Completeness: ${(thought.qualityMetrics.completeness * 100).toFixed(1)}%
6266
+ `;
6267
+ ascii += `Originality: ${(thought.qualityMetrics.originality * 100).toFixed(1)}%
6268
+ `;
6269
+ ascii += `Clarity: ${(thought.qualityMetrics.clarity * 100).toFixed(1)}%
6270
+ `;
6271
+ ascii += `Overall Quality: ${(thought.qualityMetrics.overallQuality * 100).toFixed(1)}%
6272
+ `;
6273
+ ascii += "\n";
6274
+ ascii += "SESSION CONTEXT\n";
6275
+ ascii += "---------------\n";
6276
+ ascii += `Session ID: ${thought.sessionContext.sessionId}
6277
+ `;
6278
+ ascii += `Total Thoughts: ${thought.sessionContext.totalThoughts}
6279
+ `;
6280
+ ascii += `Mode Switches: ${thought.sessionContext.modeSwitches}
6281
+ `;
6282
+ ascii += `Problem Type: ${thought.sessionContext.problemType}
6283
+ `;
6284
+ ascii += `Modes Used: ${thought.sessionContext.modesUsed.join(", ")}
6285
+ `;
6286
+ if (thought.sessionContext.historicalEffectiveness !== void 0) {
6287
+ ascii += `Historical Effectiveness: ${(thought.sessionContext.historicalEffectiveness * 100).toFixed(1)}%
6288
+ `;
6289
+ }
6290
+ return ascii;
6291
+ }
6292
+ var init_metareasoning = __esm({
6293
+ "src/export/visual/metareasoning.ts"() {
6294
+ init_esm_shims();
6295
+ init_utils();
6296
+ }
6297
+ });
6298
+
5201
6299
  // src/export/visual/index.ts
5202
6300
  var VisualExporter;
5203
6301
  var init_visual = __esm({
@@ -5218,6 +6316,10 @@ var init_visual = __esm({
5218
6316
  init_scientific_method();
5219
6317
  init_optimization();
5220
6318
  init_formal_logic();
6319
+ init_mathematics();
6320
+ init_physics();
6321
+ init_hybrid();
6322
+ init_metareasoning();
5221
6323
  VisualExporter = class {
5222
6324
  exportCausalGraph(thought, options) {
5223
6325
  return exportCausalGraph(thought, options);
@@ -5264,6 +6366,19 @@ var init_visual = __esm({
5264
6366
  exportFormalLogicProof(thought, options) {
5265
6367
  return exportFormalLogicProof(thought, options);
5266
6368
  }
6369
+ // Sprint 2: New visual export wrapper methods
6370
+ exportMathematicsDerivation(thought, options) {
6371
+ return exportMathematicsDerivation(thought, options);
6372
+ }
6373
+ exportPhysicsVisualization(thought, options) {
6374
+ return exportPhysicsVisualization(thought, options);
6375
+ }
6376
+ exportHybridOrchestration(thought, options) {
6377
+ return exportHybridOrchestration(thought, options);
6378
+ }
6379
+ exportMetaReasoningVisualization(thought, options) {
6380
+ return exportMetaReasoningVisualization(thought, options);
6381
+ }
5267
6382
  };
5268
6383
  }
5269
6384
  });
@@ -5395,6 +6510,118 @@ var init_ExportService = __esm({
5395
6510
  colorScheme: "default"
5396
6511
  });
5397
6512
  }
6513
+ if (lastThought.mode === "sequential" /* SEQUENTIAL */ && "buildUpon" in lastThought) {
6514
+ return this.visualExporter.exportSequentialDependencyGraph(lastThought, {
6515
+ format,
6516
+ colorScheme: "default",
6517
+ includeLabels: true,
6518
+ includeMetrics: true
6519
+ });
6520
+ }
6521
+ if (lastThought.mode === "shannon" /* SHANNON */ && "stage" in lastThought) {
6522
+ return this.visualExporter.exportShannonStageFlow(lastThought, {
6523
+ format,
6524
+ colorScheme: "default",
6525
+ includeLabels: true,
6526
+ includeMetrics: true
6527
+ });
6528
+ }
6529
+ if (lastThought.mode === "abductive" /* ABDUCTIVE */ && "hypotheses" in lastThought) {
6530
+ return this.visualExporter.exportAbductiveHypotheses(lastThought, {
6531
+ format,
6532
+ colorScheme: "default",
6533
+ includeLabels: true,
6534
+ includeMetrics: true
6535
+ });
6536
+ }
6537
+ if (lastThought.mode === "counterfactual" /* COUNTERFACTUAL */ && "scenarios" in lastThought) {
6538
+ return this.visualExporter.exportCounterfactualScenarios(lastThought, {
6539
+ format,
6540
+ colorScheme: "default",
6541
+ includeLabels: true,
6542
+ includeMetrics: true
6543
+ });
6544
+ }
6545
+ if (lastThought.mode === "analogical" /* ANALOGICAL */ && "sourceAnalogy" in lastThought) {
6546
+ return this.visualExporter.exportAnalogicalMapping(lastThought, {
6547
+ format,
6548
+ colorScheme: "default",
6549
+ includeLabels: true,
6550
+ includeMetrics: true
6551
+ });
6552
+ }
6553
+ if (lastThought.mode === "evidential" /* EVIDENTIAL */ && "frameOfDiscernment" in lastThought) {
6554
+ return this.visualExporter.exportEvidentialBeliefs(lastThought, {
6555
+ format,
6556
+ colorScheme: "default",
6557
+ includeLabels: true,
6558
+ includeMetrics: true
6559
+ });
6560
+ }
6561
+ if (lastThought.mode === "systemsthinking" /* SYSTEMSTHINKING */ && "systemComponents" in lastThought) {
6562
+ return this.visualExporter.exportSystemsThinkingCausalLoops(lastThought, {
6563
+ format,
6564
+ colorScheme: "default",
6565
+ includeLabels: true,
6566
+ includeMetrics: true
6567
+ });
6568
+ }
6569
+ if (lastThought.mode === "scientificmethod" /* SCIENTIFICMETHOD */ && "hypothesis" in lastThought) {
6570
+ return this.visualExporter.exportScientificMethodExperiment(lastThought, {
6571
+ format,
6572
+ colorScheme: "default",
6573
+ includeLabels: true,
6574
+ includeMetrics: true
6575
+ });
6576
+ }
6577
+ if (lastThought.mode === "optimization" /* OPTIMIZATION */ && "objectiveFunction" in lastThought) {
6578
+ return this.visualExporter.exportOptimizationSolution(lastThought, {
6579
+ format,
6580
+ colorScheme: "default",
6581
+ includeLabels: true,
6582
+ includeMetrics: true
6583
+ });
6584
+ }
6585
+ if (lastThought.mode === "formallogic" /* FORMALLOGIC */ && "premises" in lastThought) {
6586
+ return this.visualExporter.exportFormalLogicProof(lastThought, {
6587
+ format,
6588
+ colorScheme: "default",
6589
+ includeLabels: true,
6590
+ includeMetrics: true
6591
+ });
6592
+ }
6593
+ if (lastThought.mode === "mathematics" /* MATHEMATICS */ && "proofStrategy" in lastThought) {
6594
+ return this.visualExporter.exportMathematicsDerivation(lastThought, {
6595
+ format,
6596
+ colorScheme: "default",
6597
+ includeLabels: true,
6598
+ includeMetrics: true
6599
+ });
6600
+ }
6601
+ if (lastThought.mode === "physics" /* PHYSICS */ && "tensorProperties" in lastThought) {
6602
+ return this.visualExporter.exportPhysicsVisualization(lastThought, {
6603
+ format,
6604
+ colorScheme: "default",
6605
+ includeLabels: true,
6606
+ includeMetrics: true
6607
+ });
6608
+ }
6609
+ if (lastThought.mode === "hybrid" /* HYBRID */ && "primaryMode" in lastThought) {
6610
+ return this.visualExporter.exportHybridOrchestration(lastThought, {
6611
+ format,
6612
+ colorScheme: "default",
6613
+ includeLabels: true,
6614
+ includeMetrics: true
6615
+ });
6616
+ }
6617
+ if (lastThought.mode === "metareasoning" /* METAREASONING */ && "currentStrategy" in lastThought) {
6618
+ return this.visualExporter.exportMetaReasoningVisualization(lastThought, {
6619
+ format,
6620
+ colorScheme: "default",
6621
+ includeLabels: true,
6622
+ includeMetrics: true
6623
+ });
6624
+ }
5398
6625
  const thoughts = session.thoughts.map(
5399
6626
  (t, i) => `Thought ${i + 1} (${t.mode}):
5400
6627
  ${t.content}