deepthinking-mcp 6.1.1 → 6.1.2

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
@@ -2843,11 +2843,16 @@ var init_ThoughtFactory = __esm({
2843
2843
  bestExplanation: input.bestExplanation
2844
2844
  };
2845
2845
  case "causal":
2846
+ const inputAny = input;
2847
+ const causalGraph = input.causalGraph || {
2848
+ nodes: inputAny.nodes || [],
2849
+ edges: inputAny.edges || []
2850
+ };
2846
2851
  return {
2847
2852
  ...baseThought,
2848
2853
  mode: "causal" /* CAUSAL */,
2849
2854
  thoughtType: toExtendedThoughtType(input.thoughtType, "problem_definition"),
2850
- causalGraph: input.causalGraph,
2855
+ causalGraph,
2851
2856
  interventions: input.interventions || [],
2852
2857
  mechanisms: input.mechanisms || [],
2853
2858
  confounders: input.confounders || []
@@ -3094,6 +3099,10 @@ function causalGraphToDOT(thought, includeLabels, includeMetrics) {
3094
3099
  let dot = "digraph CausalGraph {\n";
3095
3100
  dot += " rankdir=TB;\n";
3096
3101
  dot += " node [shape=box, style=rounded];\n\n";
3102
+ if (!thought.causalGraph || !thought.causalGraph.nodes) {
3103
+ dot += ' NoData [label="No causal graph data"];\n}\n';
3104
+ return dot;
3105
+ }
3097
3106
  for (const node of thought.causalGraph.nodes) {
3098
3107
  const nodeId = sanitizeId(node.id);
3099
3108
  const label = includeLabels ? node.name : nodeId;
@@ -3133,6 +3142,9 @@ function causalGraphToDOT(thought, includeLabels, includeMetrics) {
3133
3142
  function causalGraphToASCII(thought) {
3134
3143
  let ascii = "Causal Graph:\n";
3135
3144
  ascii += "=============\n\n";
3145
+ if (!thought.causalGraph || !thought.causalGraph.nodes) {
3146
+ return ascii + "No causal graph data\n";
3147
+ }
3136
3148
  ascii += "Nodes:\n";
3137
3149
  for (const node of thought.causalGraph.nodes) {
3138
3150
  ascii += ` [${node.type.toUpperCase()}] ${node.name}: ${node.description}
@@ -8412,8 +8424,48 @@ var ProbabilisticSchema = BaseThoughtSchema.extend({
8412
8424
 
8413
8425
  // src/tools/schemas/modes/causal.ts
8414
8426
  init_esm_shims();
8427
+ var CausalNodeSchema = z.object({
8428
+ id: z.string(),
8429
+ name: z.string(),
8430
+ description: z.string().optional(),
8431
+ type: z.enum(["cause", "effect", "mediator", "confounder"]).optional()
8432
+ });
8433
+ var CausalEdgeSchema = z.object({
8434
+ from: z.string(),
8435
+ to: z.string(),
8436
+ type: z.string().optional(),
8437
+ strength: z.number().min(0).max(1).optional()
8438
+ });
8439
+ var CounterfactualSchema = z.object({
8440
+ actual: z.string().optional(),
8441
+ hypothetical: z.string().optional(),
8442
+ consequence: z.string().optional()
8443
+ });
8444
+ var InterventionSchema = z.object({
8445
+ node: z.string(),
8446
+ value: z.string().optional(),
8447
+ effect: z.string().optional()
8448
+ });
8415
8449
  var CausalSchema = BaseThoughtSchema.extend({
8416
- mode: z.enum(["causal", "counterfactual", "abductive"])
8450
+ mode: z.enum(["causal", "counterfactual", "abductive"]),
8451
+ // Causal graph properties (top-level for JSON schema compatibility)
8452
+ nodes: z.array(CausalNodeSchema).optional(),
8453
+ edges: z.array(CausalEdgeSchema).optional(),
8454
+ // Nested causalGraph for backwards compatibility
8455
+ causalGraph: z.object({
8456
+ nodes: z.array(CausalNodeSchema),
8457
+ edges: z.array(CausalEdgeSchema)
8458
+ }).optional(),
8459
+ // Counterfactual properties
8460
+ counterfactual: CounterfactualSchema.optional(),
8461
+ // Intervention properties
8462
+ interventions: z.array(InterventionSchema).optional(),
8463
+ // Observations for abductive reasoning
8464
+ observations: z.array(z.string()).optional(),
8465
+ explanations: z.array(z.object({
8466
+ hypothesis: z.string(),
8467
+ plausibility: z.number().min(0).max(1).optional()
8468
+ })).optional()
8417
8469
  });
8418
8470
 
8419
8471
  // src/tools/schemas/modes/strategic.ts