@wowok/agent-mcp 2.6.3 → 2.6.4

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.
Files changed (192) hide show
  1. package/dist/customer/customer-advice.d.ts +31 -0
  2. package/dist/customer/customer-advice.js +129 -0
  3. package/dist/customer/index.d.ts +2 -0
  4. package/dist/customer/index.js +2 -0
  5. package/dist/customer/info-puzzle.d.ts +8 -1
  6. package/dist/customer/info-puzzle.js +30 -5
  7. package/dist/customer/order-monitor.d.ts +2 -0
  8. package/dist/customer/order-monitor.js +3 -2
  9. package/dist/customer/post-purchase.d.ts +2 -0
  10. package/dist/customer/post-purchase.js +6 -5
  11. package/dist/customer/preorder-compare.d.ts +24 -0
  12. package/dist/customer/preorder-compare.js +34 -0
  13. package/dist/customer/reminder-system.d.ts +2 -0
  14. package/dist/customer/reminder-system.js +2 -1
  15. package/dist/customer/risk-assessment.js +4 -3
  16. package/dist/customer/types.d.ts +5 -0
  17. package/dist/examples/arbitration-dispute-create.json +41 -0
  18. package/dist/examples/arbitration-vote-weighted.json +35 -0
  19. package/dist/examples/arbitration-voting-guard-add.json +38 -0
  20. package/dist/examples/demand-present-service.json +33 -0
  21. package/dist/examples/gen-passport-verify-guard.json +48 -0
  22. package/dist/examples/guard-template-balance-check.json +36 -15
  23. package/dist/examples/guard-template-time-lock.json +33 -12
  24. package/dist/examples/insurance-guard-claim-timelock.json +75 -0
  25. package/dist/examples/insurance-guard-withdraw-allocation.json +96 -0
  26. package/dist/examples/insurance-machine-create-publish.json +75 -0
  27. package/dist/examples/insurance-service-allocators-publish.json +56 -0
  28. package/dist/examples/machine-multisig-threshold.json +86 -0
  29. package/dist/examples/machine-template-7node-rental.json +99 -94
  30. package/dist/examples/payment-scenario-bound.json +45 -0
  31. package/dist/examples/rental-ziroom-machine-create.json +126 -114
  32. package/dist/examples/rental-ziroom-permission-create.json +10 -3
  33. package/dist/examples/rental-ziroom-service-create.json +27 -18
  34. package/dist/examples/retail-adv-guard-customer-win-create.json +80 -0
  35. package/dist/examples/retail-adv-guard-messenger-proof-create.json +65 -0
  36. package/dist/examples/retail-adv-guard-reward-timeout-create.json +92 -0
  37. package/dist/examples/retail-adv-reward-guard-add.json +51 -0
  38. package/dist/examples/retail-myshop-allocation-activate.json +55 -0
  39. package/dist/examples/retail-myshop-arbitration-create.json +40 -0
  40. package/dist/examples/retail-myshop-contact-create.json +43 -0
  41. package/dist/examples/retail-myshop-order-create.json +56 -0
  42. package/dist/examples/retail-myshop-progress-operate.json +38 -0
  43. package/dist/examples/retail-myshop-reward-create.json +35 -0
  44. package/dist/examples/service-discount-issue.json +46 -0
  45. package/dist/examples/threebody-guard-create.json +56 -0
  46. package/dist/examples/threebody-machine-create.json +72 -0
  47. package/dist/examples/threebody-permission-create.json +38 -0
  48. package/dist/examples/threebody-service-allocators.json +49 -0
  49. package/dist/examples/travel-guard-time-lock.json +69 -0
  50. package/dist/examples/travel-guard-weather-oracle.json +70 -0
  51. package/dist/examples/travel-machine-create.json +136 -0
  52. package/dist/examples/travel-repository-create.json +47 -0
  53. package/dist/examples/travel-service-create.json +102 -0
  54. package/dist/examples/travel-treasury-create.json +34 -0
  55. package/dist/examples/treasury-deposit.json +37 -0
  56. package/dist/examples/treasury-withdraw.json +38 -0
  57. package/dist/extensions/business-modules.d.ts +49 -0
  58. package/dist/extensions/business-modules.js +287 -0
  59. package/dist/extensions/capability-manifest.js +192 -5
  60. package/dist/extensions/constraint-registry.js +3 -1
  61. package/dist/extensions/modes.js +10 -4
  62. package/dist/extensions/registry.d.ts +14 -9
  63. package/dist/extensions/registry.js +69 -14
  64. package/dist/extensions/types.d.ts +1 -0
  65. package/dist/knowledge/fund-layer.d.ts +67 -1
  66. package/dist/knowledge/fund-layer.js +561 -12
  67. package/dist/knowledge/guard-templates.d.ts +10 -0
  68. package/dist/knowledge/guard-templates.js +50 -0
  69. package/dist/knowledge/index.d.ts +2 -2
  70. package/dist/knowledge/index.js +2 -2
  71. package/dist/knowledge/machine-risk.js +4 -1
  72. package/dist/knowledge/progress-context.js +1 -1
  73. package/dist/knowledge/progress-ledger.js +3 -3
  74. package/dist/knowledge/progress-templates.js +1 -1
  75. package/dist/knowledge/progress-translation.js +1 -1
  76. package/dist/knowledge/safety-rules.d.ts +83 -1
  77. package/dist/knowledge/safety-rules.js +166 -2
  78. package/dist/knowledge/scenario-modes.d.ts +1 -1
  79. package/dist/knowledge/scenario-modes.js +13 -11
  80. package/dist/knowledge/template-registry.d.ts +48 -0
  81. package/dist/knowledge/template-registry.js +341 -0
  82. package/dist/knowledge/tool-constraints.js +6 -6
  83. package/dist/knowledge/tools-reference.js +11 -8
  84. package/dist/participation/merchant-interest.d.ts +32 -0
  85. package/dist/participation/merchant-interest.js +100 -0
  86. package/dist/participation/radar-core.d.ts +104 -0
  87. package/dist/participation/radar-core.js +269 -0
  88. package/dist/project/context-assembly.js +8 -0
  89. package/dist/project/edit-planner.js +27 -56
  90. package/dist/project/evaluation.d.ts +36 -0
  91. package/dist/project/evaluation.js +422 -56
  92. package/dist/project/game-theory.d.ts +43 -0
  93. package/dist/project/game-theory.js +177 -0
  94. package/dist/project/graph-builder.js +1 -0
  95. package/dist/project/handlers.d.ts +38 -0
  96. package/dist/project/handlers.js +65 -35
  97. package/dist/project/intent-analyzer.d.ts +71 -0
  98. package/dist/project/intent-analyzer.js +149 -0
  99. package/dist/project/machine-nodes.d.ts +2 -0
  100. package/dist/project/machine-nodes.js +36 -0
  101. package/dist/project/merchant-guide.d.ts +165 -0
  102. package/dist/project/merchant-guide.js +264 -0
  103. package/dist/project/mode-actions.d.ts +199 -0
  104. package/dist/project/mode-actions.js +309 -0
  105. package/dist/project/participation-radar.d.ts +18 -0
  106. package/dist/project/participation-radar.js +428 -0
  107. package/dist/project/pipeline-actions.d.ts +101 -0
  108. package/dist/project/pipeline-actions.js +109 -0
  109. package/dist/project/semantic-graph.d.ts +95 -0
  110. package/dist/project/semantic-graph.js +245 -0
  111. package/dist/schema/call/allocation.d.ts +11 -11
  112. package/dist/schema/call/allocation.js +11 -1
  113. package/dist/schema/call/arbitration.d.ts +21 -21
  114. package/dist/schema/call/arbitration.js +17 -9
  115. package/dist/schema/call/base.d.ts +2 -2
  116. package/dist/schema/call/base.js +1 -1
  117. package/dist/schema/call/bridge.d.ts +127 -127
  118. package/dist/schema/call/bridge.js +12 -12
  119. package/dist/schema/call/contact.d.ts +3 -3
  120. package/dist/schema/call/demand.d.ts +3 -3
  121. package/dist/schema/call/guard.d.ts +11 -11
  122. package/dist/schema/call/guard.js +1 -1
  123. package/dist/schema/call/machine.d.ts +216 -21
  124. package/dist/schema/call/machine.js +1 -1
  125. package/dist/schema/call/order.d.ts +7 -7
  126. package/dist/schema/call/payment.d.ts +3 -3
  127. package/dist/schema/call/permission.d.ts +3 -3
  128. package/dist/schema/call/personal.d.ts +337 -3
  129. package/dist/schema/call/personal.js +10 -0
  130. package/dist/schema/call/progress.d.ts +177 -9
  131. package/dist/schema/call/progress.js +7 -3
  132. package/dist/schema/call/proof.d.ts +6 -6
  133. package/dist/schema/call/repository.d.ts +3 -3
  134. package/dist/schema/call/reward.d.ts +57 -57
  135. package/dist/schema/call/semantic.js +41 -1
  136. package/dist/schema/call/service.d.ts +114 -114
  137. package/dist/schema/call/service.js +11 -2
  138. package/dist/schema/call/treasury.d.ts +57 -57
  139. package/dist/schema/messenger/index.js +4 -1
  140. package/dist/schema/operations.d.ts +713 -291
  141. package/dist/schema/operations.js +33 -0
  142. package/dist/schema/project/index.d.ts +4635 -100
  143. package/dist/schema/project/index.js +868 -1
  144. package/dist/schema/query/index.d.ts +363 -19
  145. package/dist/schema/query/index.js +25 -3
  146. package/dist/schema/schema-query/index.d.ts +13 -7
  147. package/dist/schema/schema-query/index.js +29 -5
  148. package/dist/schema/trust/index.d.ts +1012 -6
  149. package/dist/schema/trust/index.js +212 -11
  150. package/dist/schema/utils/skills-recommendation.js +1 -0
  151. package/dist/schema-query/index.d.ts +4 -1
  152. package/dist/schema-query/index.js +255 -1
  153. package/dist/schemas/bridge_operation.schema.json +14 -7
  154. package/dist/schemas/guard2file.schema.json +2 -0
  155. package/dist/schemas/index.json +1 -1
  156. package/dist/schemas/machineNode2file.schema.json +2 -0
  157. package/dist/schemas/messenger_operation.schema.json +1 -1
  158. package/dist/schemas/onchain_operations.schema.json +143 -15
  159. package/dist/schemas/onchain_operations_allocation.schema.json +2 -1
  160. package/dist/schemas/onchain_operations_arbitration.schema.json +7 -5
  161. package/dist/schemas/onchain_operations_contact.schema.json +1 -0
  162. package/dist/schemas/onchain_operations_demand.schema.json +1 -0
  163. package/dist/schemas/onchain_operations_gen_passport.schema.json +2 -0
  164. package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -0
  165. package/dist/schemas/onchain_operations_guard.schema.json +578 -0
  166. package/dist/schemas/onchain_operations_machine.schema.json +1 -0
  167. package/dist/schemas/onchain_operations_order.schema.json +4 -3
  168. package/dist/schemas/onchain_operations_payment.schema.json +1 -0
  169. package/dist/schemas/onchain_operations_permission.schema.json +1 -0
  170. package/dist/schemas/onchain_operations_personal.schema.json +37 -0
  171. package/dist/schemas/onchain_operations_progress.schema.json +90 -3
  172. package/dist/schemas/onchain_operations_proof.schema.json +1 -0
  173. package/dist/schemas/onchain_operations_repository.schema.json +1 -0
  174. package/dist/schemas/onchain_operations_reward.schema.json +1 -0
  175. package/dist/schemas/onchain_operations_service.schema.json +4 -3
  176. package/dist/schemas/onchain_operations_treasury.schema.json +1 -0
  177. package/dist/schemas/project_operation.output.json +2243 -1
  178. package/dist/schemas/project_operation.schema.json +683 -1
  179. package/dist/schemas/query_toolkit.output.json +1 -1
  180. package/dist/schemas/query_toolkit.schema.json +37 -0
  181. package/dist/schemas/schema_query.output.json +1 -1
  182. package/dist/schemas/schema_query.schema.json +30 -5
  183. package/dist/schemas/trust_score.output.json +392 -1
  184. package/dist/schemas/trust_score.schema.json +275 -1
  185. package/dist/tools/handlers/onchain.js +73 -8
  186. package/dist/tools/handlers/project.js +46 -0
  187. package/dist/tools/handlers/query.js +117 -2
  188. package/dist/tools/handlers/schema-query.js +41 -0
  189. package/dist/tools/handlers/trust.js +192 -6
  190. package/dist/tools/index.js +52 -9
  191. package/dist/tools/wrap.js +194 -15
  192. package/package.json +2 -2
@@ -82,6 +82,20 @@ export const ProjectOperationInputSchema = z
82
82
  "apply_object_edit",
83
83
  "patch_machine_nodes",
84
84
  "patch_guard_tree",
85
+ "recommend_industry",
86
+ "list_modes",
87
+ "derive_user_mode",
88
+ "evolve_user_mode",
89
+ "register_user_mode",
90
+ "unregister_user_mode",
91
+ "register_custom_metric",
92
+ "register_custom_constraint",
93
+ "list_metrics_constraints",
94
+ "analyze_intent",
95
+ "aggregate_risks",
96
+ "trace_substeps",
97
+ "merchant_guide",
98
+ "participation_radar",
85
99
  ])
86
100
  .describe("Action to perform. Two categories:\n" +
87
101
  "1. Project Entity + Evaluation (15, GLM6): list_projects, create_project, create_project_from_onchain, update_project, get_project_detail, add_object, remove_object, create_version, build_graph, get_graph, evaluate_project, save_evaluation, compare_projects, refresh_objects, get_object_diff. Projects are first-class entities with SQLite persistence, rigid project-object relationships, three-pathway graph construction, and a dual rule-based + LLM-assisted evaluation engine.\n" +
@@ -385,6 +399,301 @@ export const ProjectOperationInputSchema = z
385
399
  " 'set table_name <identifier> <name|none>' | 'set table_submission <identifier> <true|false>'\n" +
386
400
  " 'set root <json_node>' | 'set rely <comma_separated_guard_addresses|none>'\n" +
387
401
  "Operations are applied in order. Both patches are validated (validateMachine/validateGuard) before execution."),
402
+ intent: z
403
+ .string()
404
+ .max(2000)
405
+ .optional()
406
+ .describe("Business intent text for recommend_industry (e.g. 'I rent cameras to photographers " +
407
+ "with deposit and damage inspection'). Falls back to project_description / project_name when omitted."),
408
+ mode_source: z
409
+ .string()
410
+ .optional()
411
+ .describe("Source builtin mode name for derive_user_mode (e.g. 'freelance'). Call list_modes to see available modes."),
412
+ mode_name: z
413
+ .string()
414
+ .max(100)
415
+ .optional()
416
+ .describe("Mode name for derive_user_mode (new mode name), evolve_user_mode / unregister_user_mode (existing custom mode), register_user_mode (new mode name). " +
417
+ "Must NOT conflict with builtin mode names."),
418
+ mode_display_name: z
419
+ .string()
420
+ .max(200)
421
+ .optional()
422
+ .describe("Display name for derive_user_mode / register_user_mode. Defaults to mode_name."),
423
+ mode_changes: z
424
+ .record(z.unknown())
425
+ .optional()
426
+ .describe("Mode field overrides for derive_user_mode / evolve_user_mode / register_user_mode. " +
427
+ "For register_user_mode, REQUIRED fields: machine_shape (non-empty array of {name, role}) and key_risk (string). " +
428
+ "Common overrides: machine_shape (array of {name:string, role:string}), config_overrides (per-object config), " +
429
+ "allocator, guards, build_notes, risk_appetite. " +
430
+ "R-M1-11 ENFORCED: machine_shape node names must NOT contain dispute/refund/arb terms — " +
431
+ "disputes flow through Service.arbitrations independently of the Machine."),
432
+ mode_change_description: z
433
+ .string()
434
+ .max(500)
435
+ .optional()
436
+ .describe("Change description for evolve_user_mode (recorded in evolution history)."),
437
+ mode_bump_version: z
438
+ .boolean()
439
+ .optional()
440
+ .describe("Whether evolve_user_mode bumps the patch version (default true: v1.0 → v1.1)."),
441
+ metric_id: z.string().max(100).optional().describe("Unique metric ID for register_custom_metric (e.g. 'seasonality_risk')."),
442
+ metric_display_name: z.string().max(200).optional().describe("Display name for register_custom_metric."),
443
+ metric_description: z.string().max(1000).optional().describe("Description for register_custom_metric."),
444
+ metric_type: z
445
+ .enum(["risk", "benefit"])
446
+ .optional()
447
+ .describe("Metric type for register_custom_metric: 'risk' (negative) or 'benefit' (positive)."),
448
+ metric_scale: z
449
+ .enum(["level", "numeric", "percentage"])
450
+ .optional()
451
+ .describe("Metric scale for register_custom_metric: 'level' (high/medium/low), 'numeric', or 'percentage'."),
452
+ metric_weight: z
453
+ .number()
454
+ .min(0)
455
+ .max(10)
456
+ .optional()
457
+ .describe("Metric weight for register_custom_metric (default 1.0)."),
458
+ constraint_id: z.string().max(100).optional().describe("Unique constraint ID for register_custom_constraint."),
459
+ constraint_display_name: z.string().max(200).optional().describe("Display name for register_custom_constraint."),
460
+ constraint_description: z.string().max(1000).optional().describe("Description for register_custom_constraint."),
461
+ constraint_rule: z
462
+ .discriminatedUnion("type", [
463
+ z.object({ type: z.literal("capability_required"), capability_id: z.string() }).strict(),
464
+ z.object({ type: z.literal("capability_forbidden"), capability_id: z.string() }).strict(),
465
+ z.object({ type: z.literal("numeric_limit"), field: z.string(), max: z.number().optional(), min: z.number().optional() }).strict(),
466
+ z.object({ type: z.literal("condition_required"), condition: z.string(), ai_evaluated: z.literal(true) }).strict(),
467
+ ])
468
+ .optional()
469
+ .describe("Constraint rule for register_custom_constraint. 4 types: " +
470
+ "capability_required/capability_forbidden (capability_id), numeric_limit (field + max/min), " +
471
+ "condition_required (natural-language condition, AI-evaluated)."),
472
+ constraint_severity: z
473
+ .enum(["hard", "soft"])
474
+ .optional()
475
+ .describe("Constraint severity for register_custom_constraint: 'hard' blocks applyTemplate on violation; 'soft' only warns (default 'soft')."),
476
+ constraint_on_violation: z
477
+ .enum(["block", "warn", "log"])
478
+ .optional()
479
+ .describe("Violation action for register_custom_constraint (default 'warn')."),
480
+ metric_type_filter: z
481
+ .enum(["risk", "benefit"])
482
+ .optional()
483
+ .describe("Filter list_metrics_constraints by metric type."),
484
+ scope_filter: z
485
+ .enum(["builtin", "custom"])
486
+ .optional()
487
+ .describe("Filter list_metrics_constraints by scope (builtin or custom)."),
488
+ target_objects: z
489
+ .array(z.string())
490
+ .optional()
491
+ .describe("Optional explicit target objects for analyze_intent (entry_ids or object_type names). " +
492
+ "When provided, puzzle snapshots are restricted to these objects."),
493
+ puzzles: z
494
+ .record(z
495
+ .object({
496
+ puzzle: z.unknown().describe("Puzzle snapshot (opaque — pass through from analyze_intent output unchanged)."),
497
+ completeness: z.unknown().describe("Completeness snapshot (opaque — pass through unchanged)."),
498
+ missing_dimensions: z.array(z.string()).describe("Dimensions still missing for this object."),
499
+ })
500
+ .strict())
501
+ .optional()
502
+ .describe("Per-object puzzle snapshots for aggregate_risks, keyed by object_type. " +
503
+ "Pass the 'puzzles' field from a prior analyze_intent result UNCHANGED. " +
504
+ "When omitted but 'intent' is present, the handler runs analyze_intent first (C1→C2 in one call)."),
505
+ severity_threshold: z
506
+ .enum(["CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO"])
507
+ .optional()
508
+ .describe("Severity threshold for aggregate_risks (default 'HIGH'). Risks at or above this level block deployment (status RISK_BLOCKED)."),
509
+ user_confirmed_high_risks: z
510
+ .array(z.string())
511
+ .optional()
512
+ .describe("IDs of HIGH risks the user has already confirmed in a prior round (aggregate_risks). " +
513
+ "Confirmed HIGH risks no longer trigger RISK_PENDING_CONFIRM."),
514
+ planned_objects: z
515
+ .array(z
516
+ .object({
517
+ object_type: z.string().describe("Wowok object type (e.g. 'service', 'guard', 'machine')."),
518
+ is_new: z.boolean().describe("true when creating a NEW object; false when reusing an existing one."),
519
+ name: z.string().optional().describe("Planned object name (for readable messages)."),
520
+ })
521
+ .strict())
522
+ .optional()
523
+ .describe("Planned objects for aggregate_risks OBJECT_REUSE check (safety-rules). " +
524
+ "Flags NEW objects whose type carries an always/strongly-recommended reuse rule."),
525
+ planned_operations: z
526
+ .array(z
527
+ .object({
528
+ object_type: z.string().describe("Wowok object type (e.g. 'service', 'arbitration')."),
529
+ trigger: z.enum(["create", "publish"]).describe("Lifecycle trigger that locks fields."),
530
+ name: z.string().optional().describe("Object name (for readable messages)."),
531
+ })
532
+ .strict())
533
+ .optional()
534
+ .describe("Planned create/publish operations for aggregate_risks IMMUTABILITY check (safety-rules). " +
535
+ "Warns which fields become permanently locked after each operation."),
536
+ substeps: z
537
+ .array(z
538
+ .object({
539
+ step_id: z.string().describe("Substep id, format 'T<step>.<substep>' e.g. 'T1.1'."),
540
+ parent_step: z.string().describe("Parent step id, format 'T<step>' e.g. 'T1'."),
541
+ object_type: ProjectObjectTypeEnum.describe("Wowok object type this substep operates on."),
542
+ entry_id: z.string().describe("Puzzle entry_id this substep corresponds to."),
543
+ operation_type: z.string().describe("operation_type for onchain_operations."),
544
+ network: z.enum(["testnet", "mainnet"]).describe("Target network."),
545
+ input: z
546
+ .object({
547
+ data: z.record(z.unknown()).describe("Input data payload."),
548
+ input_refs: z.array(z.string()).describe("Upstream substep_ids this substep consumes."),
549
+ })
550
+ .strict(),
551
+ output: z
552
+ .object({
553
+ object_id: z.string().optional(),
554
+ tx_digest: z.string().optional(),
555
+ })
556
+ .catchall(z.unknown())
557
+ .optional()
558
+ .describe("Output data (filled after execution)."),
559
+ timestamp: z.number().describe("Execution timestamp (ms)."),
560
+ status: z.enum(["PENDING", "SUCCESS", "FAILED", "SKIPPED"]).describe("Execution status."),
561
+ failure_reason: z.string().optional().describe("Failure reason (when status='FAILED')."),
562
+ dependencies: z
563
+ .object({
564
+ input_refs: z.array(z.string()),
565
+ output_refs: z
566
+ .array(z
567
+ .object({
568
+ substep_id: z.string().describe("Downstream substep that consumes this output."),
569
+ field_path: z.string().describe("Field path produced by this substep (e.g. 'permission_address')."),
570
+ })
571
+ .strict()),
572
+ })
573
+ .strict()
574
+ .describe("Dependencies (input_refs + output_refs)."),
575
+ retry_info: z
576
+ .object({
577
+ original_step_id: z.string(),
578
+ retry_count: z.number(),
579
+ retry_reason: z.string(),
580
+ })
581
+ .strict()
582
+ .optional()
583
+ .describe("Retry info (when this substep is a retry of an earlier one)."),
584
+ })
585
+ .strict())
586
+ .optional()
587
+ .describe("Substep execution records for trace_substeps (63-spec §2.1). " +
588
+ "Required when action='trace_substeps'. Construct from your deployment execution trace."),
589
+ substep_edges: z
590
+ .array(z
591
+ .object({
592
+ source: z.string().describe("Source substep id."),
593
+ target: z.string().describe("Target substep id (depends on source)."),
594
+ field_path: z.string().describe("Field path flowing along this edge."),
595
+ })
596
+ .strict())
597
+ .optional()
598
+ .describe("Explicit DAG edges for trace_substeps. When omitted, edges are derived from each substep's input_refs."),
599
+ guide_state: z
600
+ .object({
601
+ intent_text: z.string().describe("Step 1: raw merchant business description."),
602
+ confirmed_industry: z.string().optional().describe("Step 2: merchant-confirmed industry id."),
603
+ currency: z.string().optional().describe("Step 5: payment currency (default WOW)."),
604
+ deliverables: z.array(z.unknown()).optional().describe("Step 4: merchant-defined deliverables (opaque passthrough)."),
605
+ payment_override: z.record(z.unknown()).optional().describe("Step 5: payment structure overrides (opaque passthrough)."),
606
+ trust_override: z.record(z.unknown()).optional().describe("Step 6: trust mechanism overrides (opaque passthrough)."),
607
+ adopted_module_ids: z.array(z.string()).optional().describe("Step 6: merchant-confirmed business module ids."),
608
+ })
609
+ .strict()
610
+ .optional()
611
+ .describe("Wizard state from a prior merchant_guide result. Pass back UNCHANGED on " +
612
+ "every subsequent call (same pattern as C1→C2 puzzles). The handler re-runs " +
613
+ "the pipeline deterministically and advances to the furthest reachable step."),
614
+ guide_confirm: z
615
+ .object({
616
+ industry: z.string().optional().describe("Step 2 confirmation: industry id (e.g. 'freelance')."),
617
+ currency: z.string().optional().describe("Step 5 confirmation: payment currency."),
618
+ deliverables: z.array(z.unknown()).optional().describe("Step 4 confirmation: deliverable definitions."),
619
+ payment: z.record(z.unknown()).optional().describe("Step 5 confirmation: { model, triggers, allocation } overrides."),
620
+ trust: z.record(z.unknown()).optional().describe("Step 6 confirmation: { refundPolicy, arbitration, escrow } overrides."),
621
+ adopted_module_ids: z.array(z.string()).optional().describe("Step 6 confirmation: business module ids to adopt (overrides recommendation)."),
622
+ })
623
+ .strict()
624
+ .optional()
625
+ .describe("Merchant decisions for the current wizard step. Merged over guide_state. " +
626
+ "Typical flow: call 1 with intent only → receive step-2 industry options → " +
627
+ "call 2 with guide_state + guide_confirm={industry} → receive full blueprint " +
628
+ "plan (steps 7-10)."),
629
+ radar_account: z
630
+ .string()
631
+ .optional()
632
+ .describe("Account to analyze — address (0x...) or LocalMark name (resolved to an address). " +
633
+ "Required when action='participation_radar'. The perspective (customer/operator/observer) " +
634
+ "is DERIVED from on-chain data (Order.builder + PermissionPerm grants) — never asserted by this field."),
635
+ radar_targets: z
636
+ .array(z
637
+ .object({
638
+ progress: z
639
+ .string()
640
+ .describe("Progress object address (0x...) or LocalMark name. The Progress carries the current node + bound Machine."),
641
+ order: z
642
+ .string()
643
+ .optional()
644
+ .describe("Order object address or LocalMark name (optional but recommended — enables order-holder detection, " +
645
+ "service-level compensation/reward claims, and dispute context)."),
646
+ })
647
+ .strict())
648
+ .min(1)
649
+ .max(20)
650
+ .optional()
651
+ .describe("In-flight orders to analyze (1-20). Required when action='participation_radar'. " +
652
+ "Each target is analyzed independently; results are aggregated into one account dashboard."),
653
+ radar_include_alerts: z
654
+ .boolean()
655
+ .optional()
656
+ .describe("Attach order-monitor alerts (progress stall / compensation fund / review & arbitration windows) " +
657
+ "to each per-order result. Default true."),
658
+ radar_monitor_thresholds: z
659
+ .object({
660
+ progress_stall_hours: z
661
+ .number()
662
+ .positive()
663
+ .optional()
664
+ .describe("Progress stall alert threshold in HOURS. Default 0 = auto (expected_node_duration × 2)."),
665
+ compensation_drop_ratio: z
666
+ .number()
667
+ .min(0)
668
+ .max(1)
669
+ .optional()
670
+ .describe("Compensation fund drop alert ratio (0-1). Default 0.3 = alert on ≥30% drop."),
671
+ compensation_coverage_min: z
672
+ .number()
673
+ .min(0)
674
+ .max(1)
675
+ .optional()
676
+ .describe("Minimum compensation coverage ratio vs order amount (0-1). Default 1.0 = must fully cover."),
677
+ messenger_timeout_hours: z
678
+ .number()
679
+ .positive()
680
+ .optional()
681
+ .describe("Messenger no-reply timeout in HOURS. Default 24."),
682
+ review_window_closing_days: z
683
+ .number()
684
+ .positive()
685
+ .optional()
686
+ .describe("Review window near-closing alert threshold in DAYS. Default 3."),
687
+ arb_window_closing_days: z
688
+ .number()
689
+ .positive()
690
+ .optional()
691
+ .describe("Arbitration window near-closing alert threshold in DAYS. Default 3."),
692
+ })
693
+ .strict()
694
+ .optional()
695
+ .describe("Optional per-call overrides for order-monitor alert thresholds (only used when radar_include_alerts is on). " +
696
+ "All fields optional; omitted fields keep defaults. Units: hours/days as marked per field."),
388
697
  })
389
698
  .strict();
390
699
  const AssembleContextResultSchema = z
@@ -480,6 +789,17 @@ const RecommendedCreationOrderItemSchema = z.object({
480
789
  reason: z.string().describe("Why this step is here, including dependencies and irreversibility notes."),
481
790
  required: z.boolean().describe("Whether this step is mandatory for a working deployment."),
482
791
  }).strict();
792
+ const RecommendedIndustryItemSchema = z.object({
793
+ industry: z.string().describe("Recommended builtin industry mode name."),
794
+ similarity: z.number().describe("Trait similarity 0-1 (10-dim industry trait match)."),
795
+ matched_traits: z.array(z.string()).describe("Trait dimensions that matched."),
796
+ reference_examples: z.array(z.object({
797
+ file: z.string().describe("Example file name (fetch via schema_query search_examples)."),
798
+ title: z.string(),
799
+ operation_type: z.string(),
800
+ verified: z.boolean(),
801
+ }).strict()).describe("Verified reference examples for this industry (top 3)."),
802
+ }).strict();
483
803
  const CreateProjectResultSchema = z
484
804
  .object({
485
805
  action: z.literal("create_project"),
@@ -494,10 +814,24 @@ const CreateProjectResultSchema = z
494
814
  steps_count: z.number().describe("Number of deployment steps in the template."),
495
815
  scenarios_count: z.number().describe("Number of scenarios in the template."),
496
816
  key_risk: z.string().nullable().optional().describe("Industry-specific key risk note (or null)."),
497
- }).strict().optional().describe("Blueprint summary — present when industry template applied successfully. Objects have status='draft' and address='draft:<name>'."),
817
+ intent_inference: z.object({
818
+ traits: z.record(z.string(), z.unknown()).describe("10-dimension inferred industry traits (unmatched traits use neutral defaults)."),
819
+ confidence: z.number().describe("Inference confidence 0-1 (matched trait count / 10)."),
820
+ matched_keywords: z.array(z.string()).describe("Keywords that triggered trait inference."),
821
+ top_matches: z.array(z.object({
822
+ industry: z.string(),
823
+ similarity: z.number().describe("Trait similarity 0-1."),
824
+ }).strict()).describe("Top-3 similar industries by trait similarity."),
825
+ }).strict().optional().describe("Intent inference summary (E.3) — present when industry template applied."),
826
+ industry_mismatch_hint: z.string().optional().describe("Advisory hint — present when intent inference suggests a different industry fits the description better (non-blocking)."),
827
+ }).strict().optional().describe("Blueprint summary — present when industry template applied successfully. Objects have status='draft' and address='draft:<name>'. Full steps/scenarios persisted as project document doc_type='blueprint'."),
498
828
  blueprint_warning: z.string().optional().describe("Warning message — present when industry template application failed. Project is created without blueprint; use add_object to manually add objects."),
499
829
  blueprint_skipped: z.boolean().optional().describe("True when skip_templates=true was passed — no industry blueprint objects were created."),
500
830
  hint: z.string().optional().describe("User-facing hint — guides to next action (e.g. add_object, generate_deployment_doc)."),
831
+ recommended_industries: z.array(RecommendedIndustryItemSchema).optional().describe("Top-3 recommended industry modes inferred from the project description (E.7). " +
832
+ "Present only when no project_industry was given. Each item includes reference examples " +
833
+ "('standing on giants' shoulders'). To apply: call update_project is NOT enough — recreate " +
834
+ "via create_project with project_industry set to get the blueprint."),
501
835
  })
502
836
  .strict();
503
837
  const CreateProjectFromOnchainResultSchema = z
@@ -1095,6 +1429,525 @@ const MigrateToMainnetResultSchema = z
1095
1429
  summary: z.string().describe("Human-readable summary of the migration."),
1096
1430
  })
1097
1431
  .strict();
1432
+ const RecommendIndustryResultSchema = z
1433
+ .object({
1434
+ action: z.literal("recommend_industry"),
1435
+ intent: z.string().describe("The intent text used for inference."),
1436
+ inferred_traits: z.record(z.unknown()).describe("10-dim industry traits inferred from intent."),
1437
+ inference_confidence: z.number().describe("Inference confidence 0-1 (matched trait count / 10)."),
1438
+ matched_keywords: z.array(z.string()).describe("Keywords that triggered trait inference."),
1439
+ recommendations: z.array(RecommendedIndustryItemSchema).describe("Top-3 similar industries + reference examples."),
1440
+ hint: z.string().describe("How to apply the recommendation (create_project with project_industry)."),
1441
+ })
1442
+ .strict();
1443
+ const ModeSummarySchema = z.object({
1444
+ name: z.string(),
1445
+ display_name: z.string(),
1446
+ version: z.string(),
1447
+ derived_from: z.string().nullable().describe("Source builtin mode (derive_user_mode) or null."),
1448
+ owner: z.string().optional().describe("Mode owner (custom modes only)."),
1449
+ key_risk: z.string(),
1450
+ machine_nodes: z.array(z.string()).describe("Machine shape node names."),
1451
+ similar_industries: z.array(z.string()).optional(),
1452
+ evolution_history: z.array(z.object({
1453
+ version: z.string(),
1454
+ changed_at: z.number(),
1455
+ changes: z.array(z.string()),
1456
+ }).strict()).optional(),
1457
+ }).strict();
1458
+ const ListModesResultSchema = z
1459
+ .object({
1460
+ action: z.literal("list_modes"),
1461
+ builtin_modes: z.array(ModeSummarySchema).describe("Builtin industry modes (use name as project_industry)."),
1462
+ user_modes: z.array(ModeSummarySchema).describe("Caller's custom modes (derive/evolve/register)."),
1463
+ owner: z.string().describe("Owner key for custom modes (local single-user)."),
1464
+ hint: z.string(),
1465
+ })
1466
+ .strict();
1467
+ const DeriveUserModeResultSchema = z
1468
+ .object({
1469
+ action: z.literal("derive_user_mode"),
1470
+ mode: ModeSummarySchema.describe("The derived (and registered) custom mode."),
1471
+ hint: z.string(),
1472
+ })
1473
+ .strict();
1474
+ const EvolveUserModeResultSchema = z
1475
+ .object({
1476
+ action: z.literal("evolve_user_mode"),
1477
+ mode: ModeSummarySchema.describe("The evolved custom mode (version bumped)."),
1478
+ hint: z.string(),
1479
+ })
1480
+ .strict();
1481
+ const RegisterUserModeResultSchema = z
1482
+ .object({
1483
+ action: z.literal("register_user_mode"),
1484
+ mode: ModeSummarySchema.describe("The registered fully-custom mode."),
1485
+ hint: z.string(),
1486
+ })
1487
+ .strict();
1488
+ const UnregisterUserModeResultSchema = z
1489
+ .object({
1490
+ action: z.literal("unregister_user_mode"),
1491
+ removed: z.literal(true),
1492
+ mode_name: z.string(),
1493
+ })
1494
+ .strict();
1495
+ const MetricInfoSchema = z.object({
1496
+ metric_id: z.string(),
1497
+ display_name: z.string(),
1498
+ description: z.string(),
1499
+ type: z.enum(["risk", "benefit"]),
1500
+ scale: z.enum(["level", "numeric", "percentage"]),
1501
+ weight: z.number(),
1502
+ scope: z.enum(["builtin", "custom"]),
1503
+ owner: z.string().optional(),
1504
+ }).strict();
1505
+ const RegisterCustomMetricResultSchema = z
1506
+ .object({
1507
+ action: z.literal("register_custom_metric"),
1508
+ metric: MetricInfoSchema.describe("The registered custom metric (globally effective)."),
1509
+ hint: z.string(),
1510
+ })
1511
+ .strict();
1512
+ const ConstraintInfoSchema = z.object({
1513
+ constraint_id: z.string(),
1514
+ display_name: z.string(),
1515
+ description: z.string(),
1516
+ rule: z.record(z.unknown()).describe("Constraint rule (4 types — see constraint_rule input)."),
1517
+ severity: z.enum(["hard", "soft"]),
1518
+ on_violation: z.enum(["block", "warn", "log"]),
1519
+ scope: z.enum(["builtin", "custom"]),
1520
+ owner: z.string().optional(),
1521
+ }).strict();
1522
+ const RegisterCustomConstraintResultSchema = z
1523
+ .object({
1524
+ action: z.literal("register_custom_constraint"),
1525
+ constraint: ConstraintInfoSchema.describe("The registered custom constraint."),
1526
+ hint: z.string(),
1527
+ })
1528
+ .strict();
1529
+ const ListMetricsConstraintsResultSchema = z
1530
+ .object({
1531
+ action: z.literal("list_metrics_constraints"),
1532
+ metrics: z.array(MetricInfoSchema),
1533
+ constraints: z.array(ConstraintInfoSchema),
1534
+ hint: z.string(),
1535
+ })
1536
+ .strict();
1537
+ const KeywordMatchSchema = z
1538
+ .object({
1539
+ keyword: z.string(),
1540
+ category: z.string(),
1541
+ matched_objects: z.array(z.string()),
1542
+ required_level: z.enum(["R", "C", "OPTIONAL"]),
1543
+ match_count: z.number(),
1544
+ })
1545
+ .strict();
1546
+ const AnalyzeIntentResultSchema = z
1547
+ .object({
1548
+ action: z.literal("analyze_intent"),
1549
+ intent_parsed: z
1550
+ .object({
1551
+ primary_object: z.string().describe("Primary object inferred from the intent keywords."),
1552
+ secondary_objects: z.array(z.string()).describe("Supporting objects typically required alongside the primary one."),
1553
+ detected_scenes: z
1554
+ .array(z
1555
+ .object({
1556
+ object: z.string(),
1557
+ scene_id: z.string().describe("Free-form scene id, e.g. 'retail', 'rental_return'."),
1558
+ })
1559
+ .strict())
1560
+ .describe("Scenes detected from the intent (used for template selection)."),
1561
+ industry: z.string().describe("Industry mode resolved from the intent (defaults to 'general')."),
1562
+ keyword_matches: z.array(KeywordMatchSchema).describe("All keyword matches that drove the identification."),
1563
+ })
1564
+ .strict(),
1565
+ puzzles: z
1566
+ .record(z
1567
+ .object({
1568
+ puzzle: z.unknown(),
1569
+ completeness: z.unknown(),
1570
+ missing_dimensions: z.array(z.string()),
1571
+ })
1572
+ .strict())
1573
+ .describe("Per-object puzzle snapshot, keyed by object_type. Pass this UNCHANGED to aggregate_risks."),
1574
+ overall_completeness: z.enum(["complete", "partial", "empty"]),
1575
+ next_step: z.string().describe("Human-readable suggestion for the next puzzle step."),
1576
+ recommended_creation_order: z.array(z.string()).describe("Recommended object creation order (dependency topology)."),
1577
+ warnings: z.array(z.string()),
1578
+ })
1579
+ .strict();
1580
+ const AggregatedRiskSchema = z
1581
+ .object({
1582
+ risk_rule_id: z.string().describe("Unified risk rule id, e.g. 'R-S-01'."),
1583
+ object_type: z.string(),
1584
+ entry_id: z.string().describe("Object entry_id ('*' when cross-object)."),
1585
+ severity: z.enum(["CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO"]),
1586
+ message: z.string(),
1587
+ fix_suggestion: z.string(),
1588
+ details: z
1589
+ .object({
1590
+ field_path: z.string().optional(),
1591
+ actual_value: z.unknown().optional(),
1592
+ expected_value: z.unknown().optional(),
1593
+ rule_source: z.string().optional(),
1594
+ })
1595
+ .strict()
1596
+ .optional(),
1597
+ })
1598
+ .strict();
1599
+ const SafetyFindingSchema = z
1600
+ .object({
1601
+ rule_id: z.string().describe("Safety rule id (e.g. 'REUSE-SERVICE-01', 'IMMUT-001')."),
1602
+ severity: z.enum(["info", "warn"]),
1603
+ message: z.string(),
1604
+ })
1605
+ .strict();
1606
+ const AggregateRisksResultSchema = z
1607
+ .object({
1608
+ action: z.literal("aggregate_risks"),
1609
+ namespace: z
1610
+ .object({
1611
+ prefix: z.string(),
1612
+ version: z.string(),
1613
+ industry: z.string().optional(),
1614
+ })
1615
+ .strict(),
1616
+ findings: z.array(AggregatedRiskSchema).describe("All risks found, sorted (CRITICAL first)."),
1617
+ severity_summary: z.record(z.number()).describe("Counts keyed by severity."),
1618
+ status: z
1619
+ .enum(["RISK_PASSED", "RISK_BLOCKED", "RISK_PENDING_CONFIRM", "RISK_CANCELLED"])
1620
+ .describe("Aggregated status (62-spec §3.2). RISK_BLOCKED = CRITICAL or above-threshold risks present."),
1621
+ pending_confirmations: z
1622
+ .array(z
1623
+ .object({
1624
+ risk_rule_id: z.string(),
1625
+ description: z.string(),
1626
+ fix_suggestion: z.string(),
1627
+ object_type: z.string(),
1628
+ entry_id: z.string(),
1629
+ })
1630
+ .strict())
1631
+ .optional()
1632
+ .describe("HIGH risks awaiting user confirmation (only when status='RISK_PENDING_CONFIRM')."),
1633
+ calibrated_at: z.number().describe("Calibration timestamp (ms)."),
1634
+ fix_suggestions_grouped: z
1635
+ .record(z.array(z
1636
+ .object({
1637
+ risk_rule_id: z.string(),
1638
+ severity: z.enum(["CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO"]),
1639
+ message: z.string(),
1640
+ fix_suggestion: z.string(),
1641
+ entry_id: z.string(),
1642
+ })
1643
+ .strict()))
1644
+ .optional()
1645
+ .describe("Fix suggestions grouped by object_type."),
1646
+ safety_findings: z
1647
+ .array(SafetyFindingSchema)
1648
+ .optional()
1649
+ .describe("OBJECT_REUSE / IMMUTABILITY findings from safety-rules (only when planned_objects / planned_operations were provided)."),
1650
+ intent_echo: z
1651
+ .object({
1652
+ primary_object: z.string(),
1653
+ industry: z.string(),
1654
+ overall_completeness: z.enum(["complete", "partial", "empty"]),
1655
+ })
1656
+ .strict()
1657
+ .optional()
1658
+ .describe("Echo of the auto-run analyze_intent (only when 'puzzles' was omitted and 'intent' was used)."),
1659
+ warnings: z.array(z.string()),
1660
+ })
1661
+ .strict();
1662
+ const TraceSubstepsResultSchema = z
1663
+ .object({
1664
+ action: z.literal("trace_substeps"),
1665
+ namespace: z.object({ prefix: z.string(), version: z.string() }).strict(),
1666
+ network: z.enum(["testnet", "mainnet"]),
1667
+ coherent: z.boolean().describe("True when no dangling inputs, no cycles, no missing outputs, no cross-step breaks."),
1668
+ dangling_inputs: z
1669
+ .array(z.object({ substep_id: z.string(), missing_ref: z.string(), field_path: z.string() }).strict())
1670
+ .describe("Input refs pointing to non-existent substeps."),
1671
+ circular_refs: z
1672
+ .array(z.object({ cycle: z.array(z.string()) }).strict())
1673
+ .describe("Substep id cycles (when present, topological_order is empty)."),
1674
+ missing_outputs: z
1675
+ .array(z
1676
+ .object({
1677
+ substep_id: z.string(),
1678
+ expected_field: z.string(),
1679
+ dependent_substeps: z.array(z.string()),
1680
+ })
1681
+ .strict())
1682
+ .describe("Substeps that should have produced a field but did not."),
1683
+ cross_step_breaks: z
1684
+ .array(z
1685
+ .object({
1686
+ source_step: z.string(),
1687
+ target_step: z.string(),
1688
+ missing_field: z.string(),
1689
+ })
1690
+ .strict())
1691
+ .describe("Upstream step failed → downstream cannot proceed."),
1692
+ step_details: z
1693
+ .array(z
1694
+ .object({
1695
+ parent_step: z.string(),
1696
+ total_substeps: z.number(),
1697
+ successful: z.number(),
1698
+ failed: z.number(),
1699
+ pending: z.number(),
1700
+ skipped: z.number(),
1701
+ substep_ids: z.array(z.string()),
1702
+ })
1703
+ .strict())
1704
+ .describe("Per-step summary, keyed by parent_step."),
1705
+ topological_order: z.array(z.string()).describe("Topological order of substep ids (empty when a cycle exists)."),
1706
+ d10_check: z
1707
+ .object({
1708
+ check_id: z.literal("D-10"),
1709
+ description: z.string(),
1710
+ status: z.enum(["PASS", "FAIL", "WARN"]),
1711
+ notes: z.array(z.string()),
1712
+ })
1713
+ .strict()
1714
+ .describe("D-10 substep linkage completeness verdict."),
1715
+ })
1716
+ .strict();
1717
+ const MerchantGuideResultSchema = z
1718
+ .object({
1719
+ action: z.literal("merchant_guide"),
1720
+ current_step: z.number().describe("Furthest wizard step reached (2 = awaiting industry confirmation; 9 = harness issues found; 10 = plan ready)."),
1721
+ step_name: z.string(),
1722
+ guide_state: z
1723
+ .object({
1724
+ intent_text: z.string(),
1725
+ confirmed_industry: z.string().optional(),
1726
+ currency: z.string().optional(),
1727
+ deliverables: z.array(z.unknown()).optional(),
1728
+ payment_override: z.record(z.unknown()).optional(),
1729
+ trust_override: z.record(z.unknown()).optional(),
1730
+ adopted_module_ids: z.array(z.string()).optional(),
1731
+ })
1732
+ .strict()
1733
+ .describe("Wizard state — pass back UNCHANGED on the next merchant_guide call."),
1734
+ intent_draft: z.unknown().optional().describe("Step 1-2 only: BusinessIntent draft inferred from the description."),
1735
+ industry_options: z
1736
+ .object({
1737
+ inferred: z.string(),
1738
+ confidence: z.number(),
1739
+ similar: z.array(z.string()),
1740
+ })
1741
+ .strict()
1742
+ .optional()
1743
+ .describe("Step 2 only: industry candidates awaiting merchant confirmation."),
1744
+ intent: z.unknown().optional().describe("Steps 7-10: final BusinessIntent after merchant overrides."),
1745
+ adopted_modules: z
1746
+ .array(z
1747
+ .object({
1748
+ id: z.string(),
1749
+ name: z.string(),
1750
+ description: z.string(),
1751
+ requires_keeper: z.boolean(),
1752
+ keeper_hint: z.string().optional(),
1753
+ user_protections: z.array(z.string()),
1754
+ merchant_obligations: z.array(z.string()),
1755
+ })
1756
+ .strict())
1757
+ .optional()
1758
+ .describe("Steps 6-10: adopted business modules with protections/obligations."),
1759
+ blueprint: z
1760
+ .object({
1761
+ nodes: z.array(z.object({ id: z.string(), type: z.string(), purpose: z.string() }).strict()),
1762
+ edges: z.array(z.object({ from: z.string(), to: z.string(), relation: z.string(), required: z.boolean() }).strict()),
1763
+ })
1764
+ .strict()
1765
+ .optional()
1766
+ .describe("Step 7: semantic object graph (nodes + edges)."),
1767
+ evaluation_preview: z.unknown().optional().describe("Step 8: estimated risk/trust/completeness scores + key risks + module boosts."),
1768
+ graph_validation: z
1769
+ .object({
1770
+ valid: z.boolean(),
1771
+ hard_violations: z.array(z.object({ id: z.string(), description: z.string(), fix: z.string().optional() }).strict()),
1772
+ soft_notes: z.array(z.object({ id: z.string(), description: z.string() }).strict()),
1773
+ })
1774
+ .strict()
1775
+ .optional()
1776
+ .describe("Step 8: structural validation of the semantic graph."),
1777
+ harness_check: z
1778
+ .object({
1779
+ module_constraints: z.array(z.object({
1780
+ module: z.string(),
1781
+ plan_satisfied: z.boolean(),
1782
+ missing: z.array(z.string()).optional(),
1783
+ reason: z.string().optional(),
1784
+ estimated_score_boost: z.number(),
1785
+ }).strict()),
1786
+ blocking_issues: z.array(z.object({
1787
+ module: z.string(),
1788
+ missing_constraints: z.array(z.string()).optional(),
1789
+ fix: z.string().optional(),
1790
+ }).strict()),
1791
+ deploy_time_checks: z.array(z.string()),
1792
+ })
1793
+ .strict()
1794
+ .optional()
1795
+ .describe("Step 9: module constraint check at blueprint stage + deploy-time checklist."),
1796
+ game_theory: z
1797
+ .object({
1798
+ summary: z.string(),
1799
+ coverage: z.string().describe("Covered/total scenario count, e.g. '4/5'."),
1800
+ exposed_scenarios: z.array(z.string()),
1801
+ wow_alignments: z.array(z.string()).describe("Active WOW mechanisms aligning merchant/user incentives."),
1802
+ scenarios: z.array(z.object({
1803
+ scenario: z.string(),
1804
+ covered: z.boolean(),
1805
+ conflict: z.string(),
1806
+ user_protection: z.string(),
1807
+ evaluation_metric: z.string(),
1808
+ recommendation: z.string().optional(),
1809
+ }).strict()),
1810
+ })
1811
+ .strict()
1812
+ .optional()
1813
+ .describe("Step 9 (GLM6/93 §2.3): merchant-user adversarial scenario coverage. 5 canonical scenarios checked against the blueprint; exposed scenarios include fix recommendations."),
1814
+ creation_plan: z
1815
+ .array(z.object({
1816
+ order: z.number(),
1817
+ node_id: z.string(),
1818
+ object_type: z.string(),
1819
+ suggested_name: z.string(),
1820
+ depends_on: z.array(z.string()),
1821
+ operation_hint: z.string(),
1822
+ }).strict())
1823
+ .optional()
1824
+ .describe("Step 10: topologically ordered creation plan. NOT executed — materialize via create_project + onchain_operations."),
1825
+ warnings: z.array(z.string()),
1826
+ next_action: z.string().describe("Human-readable guidance for the next call."),
1827
+ })
1828
+ .strict();
1829
+ const RadarMonitorAlertSchema = z
1830
+ .object({
1831
+ id: z.string(),
1832
+ category: z.enum([
1833
+ "progress_stall", "compensation_drop", "compensation_insufficient",
1834
+ "messenger_timeout", "user_action_required", "review_window",
1835
+ "arb_window", "refund_received", "anomaly",
1836
+ ]),
1837
+ severity: z.enum(["info", "warning", "critical"]),
1838
+ title: z.string(),
1839
+ message: z.string(),
1840
+ action: z.string().optional().describe("Suggested next step."),
1841
+ timestamp: z.number(),
1842
+ order_id: z.string().optional(),
1843
+ service_id: z.string().optional(),
1844
+ node: z.string().optional(),
1845
+ metric: z
1846
+ .object({
1847
+ label: z.string(),
1848
+ value: z.number(),
1849
+ threshold: z.number().optional(),
1850
+ unit: z.string().optional(),
1851
+ })
1852
+ .strict()
1853
+ .optional(),
1854
+ })
1855
+ .strict();
1856
+ const RadarForwardSchema = z
1857
+ .object({
1858
+ name: z.string().describe("Forward (operation) name."),
1859
+ to_node: z.string().describe("Target node after execution."),
1860
+ execution_path: z
1861
+ .enum(["order_holder", "permission", "named_operator", "not_available"])
1862
+ .describe("How this account may execute it (not_available if it can't)."),
1863
+ permission_index: z.number().optional().describe("Permission index required (if permission-gated)."),
1864
+ named_operator: z.string().optional().describe("Named operator (LocalMark name) required (if named-gated)."),
1865
+ guard: z.string().optional().describe("Guard address gating this forward."),
1866
+ semantics: z.string().describe("Human explanation of what executing this forward means."),
1867
+ consequence: z.string().optional().describe("Consequence hint (completion fund-release / refund path)."),
1868
+ })
1869
+ .strict();
1870
+ const RadarPendingClaimSchema = z
1871
+ .object({
1872
+ kind: z.enum(["reward", "discount", "compensation", "rating"]),
1873
+ label: z.string(),
1874
+ how: z.string().describe("How to claim (tool + operation hint)."),
1875
+ })
1876
+ .strict();
1877
+ const MerchantInterestAnalysisSchema = z
1878
+ .object({
1879
+ fund_flow: z
1880
+ .array(z.string())
1881
+ .describe("Where money sits and what releases it (escrow, Allocation waterfall, compensation_fund)."),
1882
+ responsibility: z
1883
+ .array(z.string())
1884
+ .describe("What this account is semantically liable for right now (permission-gated forwards, guard obligations)."),
1885
+ leverage: z
1886
+ .array(z.string())
1887
+ .describe("Actions serving the merchant's own interest (settlement speed, evidence pre-upload, Messenger nudge). Informational only."),
1888
+ stakes: z
1889
+ .array(z.string())
1890
+ .describe("Downside exposure (arbitration indemnity, arb-loss record, stall statistics, refund aftermath)."),
1891
+ summary: z.string().describe("One-paragraph merchant-interest summary."),
1892
+ })
1893
+ .strict();
1894
+ const OrderRadarResultSchema = z
1895
+ .object({
1896
+ account: z.string(),
1897
+ progress: z.string(),
1898
+ order: z.string().optional(),
1899
+ current_node: z.string().describe("Current node name ('' = entry, not yet started)."),
1900
+ perspective: z
1901
+ .enum(["customer", "operator", "observer"])
1902
+ .describe("Derived from on-chain data (Order.builder + PermissionPerm grants), never caller-asserted."),
1903
+ roles: z
1904
+ .array(z.object({ label: z.string(), can_act_now: z.boolean() }).strict())
1905
+ .describe("All roles this account holds on this order's workflow."),
1906
+ operable: z.array(RadarForwardSchema).describe("Forwards THIS account can execute NOW (branch options if >1)."),
1907
+ branch_choice: z
1908
+ .object({
1909
+ message: z.string(),
1910
+ options: z.array(z.object({ forward: z.string(), to_node: z.string(), consequence: z.string().optional() }).strict()),
1911
+ })
1912
+ .strict()
1913
+ .optional()
1914
+ .describe("Present when >1 operable forward. AI MUST present options neutrally; the role decides."),
1915
+ waiting_on: z
1916
+ .array(z.object({ role: z.string(), forwards: z.array(z.string()) }).strict())
1917
+ .describe("What the workflow is waiting on from OTHER roles."),
1918
+ pending_claims: z.array(RadarPendingClaimSchema).describe("Unclaimed benefits / post-purchase actions."),
1919
+ interest_hints: z
1920
+ .array(z.string())
1921
+ .describe("Perspective-specific own-interest hints (fund-release trigger, settlement cycle, reputation)."),
1922
+ workflow_unknown: z.boolean().describe("True when Machine data was unavailable — operable/waiting_on unknown."),
1923
+ interest_analysis: MerchantInterestAnalysisSchema.optional().describe("Merchant-side interest analysis (fund_flow/responsibility/leverage/stakes) — present ONLY when perspective='operator' " +
1924
+ "and order data is available. AI MUST surface it as neutral information; the merchant decides."),
1925
+ summary: z.string().describe("One-paragraph AI-ready summary."),
1926
+ attached_alerts: z
1927
+ .array(RadarMonitorAlertSchema)
1928
+ .optional()
1929
+ .describe("Order-monitor alerts (stall/compensation/review-window) when radar_include_alerts=true."),
1930
+ })
1931
+ .strict();
1932
+ const ParticipationRadarResultSchema = z
1933
+ .object({
1934
+ action: z.literal("participation_radar"),
1935
+ account: z.string().describe("Resolved account address."),
1936
+ orders_analyzed: z.number(),
1937
+ actionable: z
1938
+ .array(OrderRadarResultSchema)
1939
+ .describe("Orders where the account can act NOW or has pending claims (customer perspective first)."),
1940
+ waiting: z.array(OrderRadarResultSchema).describe("Orders where the account is only waiting on other roles."),
1941
+ all_pending_claims: z
1942
+ .array(RadarPendingClaimSchema.extend({ progress: z.string() }))
1943
+ .describe("All pending claims across orders, tagged with their Progress address."),
1944
+ unread_messages_total: z.number().describe("Unread Messenger messages total across all conversations of the radar account (local encrypted storage, read-only — never marks messages viewed; 0 with a data_gaps note when the account is not a local messenger account)."),
1945
+ data_gaps: z
1946
+ .array(z.string())
1947
+ .describe("Graceful degradation notes (e.g. 'Order 0x… not found', 'Machine nodes unavailable')."),
1948
+ summary: z.string().describe("Account-level dashboard summary."),
1949
+ })
1950
+ .strict();
1098
1951
  export const ProjectOperationOutputSchema = z
1099
1952
  .object({
1100
1953
  result: z.discriminatedUnion("action", [
@@ -1128,6 +1981,20 @@ export const ProjectOperationOutputSchema = z
1128
1981
  CloneProjectToNetworkResultSchema,
1129
1982
  MigrateNetworkResultSchema,
1130
1983
  MigrateToMainnetResultSchema,
1984
+ RecommendIndustryResultSchema,
1985
+ ListModesResultSchema,
1986
+ DeriveUserModeResultSchema,
1987
+ EvolveUserModeResultSchema,
1988
+ RegisterUserModeResultSchema,
1989
+ UnregisterUserModeResultSchema,
1990
+ RegisterCustomMetricResultSchema,
1991
+ RegisterCustomConstraintResultSchema,
1992
+ ListMetricsConstraintsResultSchema,
1993
+ AnalyzeIntentResultSchema,
1994
+ AggregateRisksResultSchema,
1995
+ TraceSubstepsResultSchema,
1996
+ MerchantGuideResultSchema,
1997
+ ParticipationRadarResultSchema,
1131
1998
  ]).describe("Query result — shape depends on action"),
1132
1999
  skills_recommended: z.string().optional().describe("Skills recommendation hint (F-10). Informational only — MCP executes " +
1133
2000
  "independently of skills. Present when the action benefits from skills' " +