@wowok/agent-mcp 3.4.4 → 3.4.5

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 (191) hide show
  1. package/dist/.build-stamp.json +3 -3
  2. package/dist/chain-semantics/composition-truth.js +1 -1
  3. package/dist/composition/audit.js +1 -1
  4. package/dist/composition/compile.js +1 -1
  5. package/dist/composition/emit-phases.js +1 -1
  6. package/dist/composition/guard-fill.js +1 -1
  7. package/dist/composition/input-normalize.js +1 -1
  8. package/dist/composition/materialize.js +1 -1
  9. package/dist/composition/mode-gates.js +1 -1
  10. package/dist/composition/param-disclosure.js +1 -1
  11. package/dist/composition/plan-run-store.js +1 -0
  12. package/dist/composition/reflux.js +1 -1
  13. package/dist/composition/role-bindings.js +1 -0
  14. package/dist/composition/shape-expand.js +1 -1
  15. package/dist/composition/supply-chain-emit.js +1 -1
  16. package/dist/config/judgment.d.ts +13 -25
  17. package/dist/config/judgment.js +1 -1
  18. package/dist/config/match-policy-file.js +1 -1
  19. package/dist/config/rule-engine.d.ts +4 -10
  20. package/dist/config/rule-engine.js +1 -1
  21. package/dist/config/template-params.js +1 -1
  22. package/dist/evaluation/engine.js +1 -1
  23. package/dist/experience/realtime-feedback.js +1 -1
  24. package/dist/extensions/capability.js +1 -1
  25. package/dist/graph/onchain/expand.js +1 -1
  26. package/dist/graph/onchain/exposure.js +1 -1
  27. package/dist/harness/forward-roster-preflight.js +1 -0
  28. package/dist/keeper/detectors.js +1 -1
  29. package/dist/knowledge/allocator-rail-verifier.js +1 -1
  30. package/dist/knowledge/arb-operation-face.js +1 -1
  31. package/dist/knowledge/arbitration-rail-verifier.js +1 -1
  32. package/dist/knowledge/audit-rules.d.ts +17 -1
  33. package/dist/knowledge/audit-rules.js +1 -1
  34. package/dist/knowledge/baselines/rules/alloc_audit.json.good.sha256 +1 -0
  35. package/dist/knowledge/baselines/rules/allocation.json.good.sha256 +1 -0
  36. package/dist/knowledge/baselines/rules/arb.json.good.sha256 +1 -0
  37. package/dist/knowledge/baselines/rules/arbitration.json.good.sha256 +1 -0
  38. package/dist/knowledge/baselines/rules/bridge.json.good.sha256 +1 -0
  39. package/dist/knowledge/baselines/rules/contact.json.good.sha256 +1 -0
  40. package/dist/knowledge/baselines/rules/demand.json.good.sha256 +1 -0
  41. package/dist/knowledge/baselines/rules/graph.json.good.sha256 +1 -0
  42. package/dist/knowledge/baselines/rules/guard.json.good.sha256 +1 -0
  43. package/dist/knowledge/baselines/rules/machine.json.good.sha256 +1 -0
  44. package/dist/knowledge/baselines/rules/oracle.json.good.sha256 +1 -0
  45. package/dist/knowledge/baselines/rules/order.json.good.sha256 +1 -0
  46. package/dist/knowledge/baselines/rules/payment.json.good.sha256 +1 -0
  47. package/dist/knowledge/baselines/rules/permission.json.good.sha256 +1 -0
  48. package/dist/knowledge/baselines/rules/personal.json.good.sha256 +1 -0
  49. package/dist/knowledge/baselines/rules/plan.json +153 -33
  50. package/dist/knowledge/baselines/rules/plan.json.good +153 -33
  51. package/dist/knowledge/baselines/rules/plan.json.good.sha256 +1 -0
  52. package/dist/knowledge/baselines/rules/progress.json.good.sha256 +1 -0
  53. package/dist/knowledge/baselines/rules/proof.json.good.sha256 +1 -0
  54. package/dist/knowledge/baselines/rules/registrar.json.good.sha256 +1 -0
  55. package/dist/knowledge/baselines/rules/repository.json.good.sha256 +1 -0
  56. package/dist/knowledge/baselines/rules/resource.json.good.sha256 +1 -0
  57. package/dist/knowledge/baselines/rules/reward.json.good.sha256 +1 -0
  58. package/dist/knowledge/baselines/rules/service.json.good.sha256 +1 -0
  59. package/dist/knowledge/baselines/rules/treasury.json.good.sha256 +1 -0
  60. package/dist/knowledge/baselines/rules/util.json.good.sha256 +1 -0
  61. package/dist/knowledge/builtin-templates.d.ts +1 -1
  62. package/dist/knowledge/builtin-templates.js +1 -1
  63. package/dist/knowledge/discount-threshold.js +1 -1
  64. package/dist/knowledge/fee-param-bindings.js +1 -1
  65. package/dist/knowledge/getting-started.js +1 -1
  66. package/dist/knowledge/guard-binding-table.js +1 -1
  67. package/dist/knowledge/guard-design-patterns.js +1 -1
  68. package/dist/knowledge/guard-templates.d.ts +3 -2
  69. package/dist/knowledge/guard-templates.js +1 -1
  70. package/dist/knowledge/index.js +1 -1
  71. package/dist/knowledge/industry-registry.js +1 -1
  72. package/dist/knowledge/jsonrpc-enum.js +1 -1
  73. package/dist/knowledge/knob-docs.js +1 -1
  74. package/dist/knowledge/machine-topology.js +1 -1
  75. package/dist/knowledge/param-schema.js +1 -1
  76. package/dist/knowledge/param-tiers.js +1 -1
  77. package/dist/knowledge/path-oracle/products/alibaba-1688.js +1 -1
  78. package/dist/knowledge/path-oracle/products/amazon.js +1 -1
  79. package/dist/knowledge/path-oracle/products/booking-com.js +1 -1
  80. package/dist/knowledge/path-oracle/products/contra.js +1 -1
  81. package/dist/knowledge/path-oracle/products/costco.js +1 -1
  82. package/dist/knowledge/path-oracle/products/duoduo-maicai.js +1 -1
  83. package/dist/knowledge/path-oracle/products/etsy.js +1 -1
  84. package/dist/knowledge/path-oracle/products/gamefound.js +1 -1
  85. package/dist/knowledge/path-oracle/products/gofundme.js +1 -1
  86. package/dist/knowledge/path-oracle/products/klook.js +1 -1
  87. package/dist/knowledge/path-oracle/products/ninety-nine-designs.js +1 -1
  88. package/dist/knowledge/path-oracle/products/pinduoduo-kuaituantuan.js +1 -1
  89. package/dist/knowledge/path-oracle/products/shansong.js +1 -1
  90. package/dist/knowledge/path-oracle/products/taobao-presale.js +1 -1
  91. package/dist/knowledge/path-oracle/products/upwork-catalog.js +1 -1
  92. package/dist/knowledge/path-oracle/products/upwork.js +1 -1
  93. package/dist/knowledge/pattern-resolutions.js +1 -1
  94. package/dist/knowledge/protocol-facts.js +1 -1
  95. package/dist/knowledge/publish-gate.js +1 -1
  96. package/dist/knowledge/publish-surface-contract.js +1 -1
  97. package/dist/knowledge/template-loader.js +1 -1
  98. package/dist/knowledge/template-registry.js +1 -1
  99. package/dist/knowledge/template-scanner.js +1 -1
  100. package/dist/knowledge/time-units.js +1 -0
  101. package/dist/knowledge/tools-reference.js +1 -1
  102. package/dist/knowledge/workflow-guidance.js +1 -1
  103. package/dist/monitor/MonitorLoop.js +1 -1
  104. package/dist/participation/radar-core.js +1 -1
  105. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  106. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  107. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  108. package/dist/playbooks/service-build/migration-planner.js +1 -1
  109. package/dist/playbooks/service-build/object-panorama.js +1 -1
  110. package/dist/playbooks/service-build/participation-radar.js +1 -1
  111. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  112. package/dist/playbooks/service-build/service-panorama.js +1 -1
  113. package/dist/playbooks/service-build/service-quote.js +1 -1
  114. package/dist/review/index.js +1 -1
  115. package/dist/safety/confirm-gate.js +1 -1
  116. package/dist/schema/benchmark-migration/index.d.ts +110 -2
  117. package/dist/schema/benchmark-migration/index.js +1 -1
  118. package/dist/schema/boundary-coercion.js +1 -0
  119. package/dist/schema/call/arbitration.js +1 -1
  120. package/dist/schema/call/base.js +1 -1
  121. package/dist/schema/call/handler.js +1 -1
  122. package/dist/schema/call/machine.d.ts +56 -8
  123. package/dist/schema/call/order.d.ts +37 -10
  124. package/dist/schema/call/order.js +1 -1
  125. package/dist/schema/call/permission.d.ts +210 -30
  126. package/dist/schema/call/personal.d.ts +56 -8
  127. package/dist/schema/call/progress.d.ts +28 -4
  128. package/dist/schema/call/semantic.js +1 -1
  129. package/dist/schema/call/service.d.ts +84 -12
  130. package/dist/schema/common/index.d.ts +14 -2
  131. package/dist/schema/common/index.js +1 -1
  132. package/dist/schema/evaluation/index.js +1 -1
  133. package/dist/schema/goal/index.d.ts +1 -1
  134. package/dist/schema/goal/planning.js +1 -1
  135. package/dist/schema/local/index.js +1 -1
  136. package/dist/schema/messenger/index.d.ts +168 -24
  137. package/dist/schema/messenger/index.js +1 -1
  138. package/dist/schema/operations.d.ts +655 -22
  139. package/dist/schema/operations.js +1 -1
  140. package/dist/schema/persona/index.d.ts +22 -110
  141. package/dist/schema/query/index.js +1 -1
  142. package/dist/schema/schema-version.js +1 -1
  143. package/dist/schema/workflow/index.d.ts +4 -0
  144. package/dist/schema/workflow/index.js +1 -1
  145. package/dist/schema-query-impl/index.js +1 -1
  146. package/dist/schemas/benchmark_migration_operation.schema.json +1 -1
  147. package/dist/schemas/evaluation_operation.schema.json +1 -1
  148. package/dist/schemas/goal_operation.schema.json +1 -1
  149. package/dist/schemas/guard_rebind_replacement.schema.json +1 -0
  150. package/dist/schemas/index.json +1 -1
  151. package/dist/schemas/messenger_operation.schema.json +1 -1
  152. package/dist/schemas/onchain_operations.schema.json +1 -1
  153. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  154. package/dist/schemas/onchain_operations_arbitration.schema.json +1 -1
  155. package/dist/schemas/onchain_operations_contact.schema.json +1 -1
  156. package/dist/schemas/onchain_operations_demand.schema.json +1 -1
  157. package/dist/schemas/onchain_operations_gen_passport.schema.json +1 -1
  158. package/dist/schemas/onchain_operations_machine.schema.json +1 -1
  159. package/dist/schemas/onchain_operations_order.schema.json +1 -1
  160. package/dist/schemas/onchain_operations_permission.schema.json +1 -1
  161. package/dist/schemas/onchain_operations_personal.schema.json +1 -1
  162. package/dist/schemas/onchain_operations_progress.schema.json +1 -1
  163. package/dist/schemas/onchain_operations_proof.schema.json +1 -1
  164. package/dist/schemas/onchain_operations_repository.schema.json +1 -1
  165. package/dist/schemas/onchain_operations_reward.schema.json +1 -1
  166. package/dist/schemas/onchain_operations_service.schema.json +1 -1
  167. package/dist/schemas/onchain_operations_treasury.schema.json +1 -1
  168. package/dist/schemas/persona_operation.schema.json +1 -1
  169. package/dist/schemas/time_convert.schema.json +1 -0
  170. package/dist/schemas/wip_file.schema.json +1 -1
  171. package/dist/schemas/workflow_operation.schema.json +1 -1
  172. package/dist/tools/handlers/benchmark-migration.js +1 -1
  173. package/dist/tools/handlers/config.js +1 -1
  174. package/dist/tools/handlers/fund-rail-recipe.js +1 -1
  175. package/dist/tools/handlers/guard-rebind-replacement.js +1 -0
  176. package/dist/tools/handlers/local.js +1 -1
  177. package/dist/tools/handlers/mark-namespace.js +1 -1
  178. package/dist/tools/handlers/onchain.js +1 -1
  179. package/dist/tools/handlers/query.js +1 -1
  180. package/dist/tools/handlers/settle-sweep.js +1 -1
  181. package/dist/tools/handlers/time-convert.js +1 -0
  182. package/dist/tools/handlers/wip.js +1 -1
  183. package/dist/tools/handlers/workflow.js +1 -1
  184. package/dist/tools/index.d.ts +1 -0
  185. package/dist/tools/index.js +1 -1
  186. package/dist/tools/registry/business.js +1 -1
  187. package/dist/tools/registry/local.js +1 -1
  188. package/dist/tools/registry/onchain.js +1 -1
  189. package/dist/tools/wip-verify-ledger.js +1 -1
  190. package/dist/tools/wrap.js +1 -1
  191. package/package.json +6 -5
@@ -1 +1 @@
1
- import*as a504a from'@wowok/wowok';const SDK_SCHEMA_VERSION=a504a['SCHEMA_VERSION']??'1.0.0',checkSchemaCompatibility=a504a['checkSchemaCompatibility']??((a,b)=>({'compatible':!![]}));export const MCP_SCHEMA_VERSION='1.2.0';export function getSchemaVersions(){return{'sdk':SDK_SCHEMA_VERSION,'mcp':MCP_SCHEMA_VERSION};}export function checkClientSchemaCompatibility(a,b={}){const c=getSchemaVersions(),d={'compatible':!![],'warnings':[],'errors':[],'versions':c,'client_version':a};if(!a)return d;const e=checkSchemaCompatibility(a,c['sdk']);if(!e['compatible']){d['compatible']=![];const g='SDK\x20schema\x20incompatibility:\x20'+e['reason'];b['mode']==='strict'?d['errors']['push'](g):d['warnings']['push'](g);}const f=checkSchemaCompatibility(a,c['mcp']);if(!f['compatible']){d['compatible']=![];const h='MCP\x20schema\x20incompatibility:\x20'+f['reason'];b['mode']==='strict'?d['errors']['push'](h):d['warnings']['push'](h);}return d;}export function attachSchemaWarning(a,b){if(b['warnings']['length']===0x0&&b['errors']['length']===0x0)return a;const c=[];b['warnings']['length']>0x0&&c['push'](...b['warnings']);b['errors']['length']>0x0&&c['push'](...b['errors']);const d=a['semantic']?{...a['semantic'],'warnings':[...a['semantic']['warnings']||[],...c]}:undefined;return{...a,'semantic':d,'schema_warning':{'compatible':b['compatible'],'warnings':c,'client_version':b['client_version'],'server_versions':b['versions']}};}
1
+ import*as a509a from'@wowok/wowok';const SDK_SCHEMA_VERSION=a509a['SCHEMA_VERSION']??'1.0.0',checkSchemaCompatibility=a509a['checkSchemaCompatibility']??((a,b)=>({'compatible':!![]}));export const MCP_SCHEMA_VERSION='1.2.0';export function getSchemaVersions(){return{'sdk':SDK_SCHEMA_VERSION,'mcp':MCP_SCHEMA_VERSION};}export function checkClientSchemaCompatibility(a,b={}){const c=getSchemaVersions(),d={'compatible':!![],'warnings':[],'errors':[],'versions':c,'client_version':a};if(!a)return d;const e=checkSchemaCompatibility(a,c['sdk']);if(!e['compatible']){d['compatible']=![];const g='SDK\x20schema\x20incompatibility:\x20'+e['reason'];b['mode']==='strict'?d['errors']['push'](g):d['warnings']['push'](g);}const f=checkSchemaCompatibility(a,c['mcp']);if(!f['compatible']){d['compatible']=![];const h='MCP\x20schema\x20incompatibility:\x20'+f['reason'];b['mode']==='strict'?d['errors']['push'](h):d['warnings']['push'](h);}return d;}export function attachSchemaWarning(a,b){if(b['warnings']['length']===0x0&&b['errors']['length']===0x0)return a;const c=[];b['warnings']['length']>0x0&&c['push'](...b['warnings']);b['errors']['length']>0x0&&c['push'](...b['errors']);const d=a['semantic']?{...a['semantic'],'warnings':[...a['semantic']['warnings']||[],...c]}:undefined;return{...a,'semantic':d,'schema_warning':{'compatible':b['compatible'],'warnings':c,'client_version':b['client_version'],'server_versions':b['versions']}};}
@@ -28,6 +28,7 @@ export declare const WorkflowForwardViewSchema: z.ZodObject<{
28
28
  }>;
29
29
  permission_index: z.ZodOptional<z.ZodNumber>;
30
30
  named_operator: z.ZodOptional<z.ZodString>;
31
+ roster_note: z.ZodOptional<z.ZodString>;
31
32
  executable_accounts: z.ZodArray<z.ZodObject<{
32
33
  address: z.ZodString;
33
34
  name: z.ZodOptional<z.ZodString>;
@@ -66,6 +67,7 @@ export declare const WorkflowTaskSchema: z.ZodObject<{
66
67
  }>;
67
68
  permission_index: z.ZodOptional<z.ZodNumber>;
68
69
  named_operator: z.ZodOptional<z.ZodString>;
70
+ roster_note: z.ZodOptional<z.ZodString>;
69
71
  executable_accounts: z.ZodArray<z.ZodObject<{
70
72
  address: z.ZodString;
71
73
  name: z.ZodOptional<z.ZodString>;
@@ -325,6 +327,7 @@ export declare const WorkflowOperationResultSchema: z.ZodObject<{
325
327
  }>;
326
328
  permission_index: z.ZodOptional<z.ZodNumber>;
327
329
  named_operator: z.ZodOptional<z.ZodString>;
330
+ roster_note: z.ZodOptional<z.ZodString>;
328
331
  executable_accounts: z.ZodArray<z.ZodObject<{
329
332
  address: z.ZodString;
330
333
  name: z.ZodOptional<z.ZodString>;
@@ -412,6 +415,7 @@ export declare const WorkflowOperationOutputSchema: z.ZodObject<{
412
415
  }>;
413
416
  permission_index: z.ZodOptional<z.ZodNumber>;
414
417
  named_operator: z.ZodOptional<z.ZodString>;
418
+ roster_note: z.ZodOptional<z.ZodString>;
415
419
  executable_accounts: z.ZodArray<z.ZodObject<{
416
420
  address: z.ZodString;
417
421
  name: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- import{z}from'zod';import{isValidLongName,MAX_LONG_NAME_LENGTH}from'@wowok/wowok';import{EntrypointSchema,NameOrAddressSchema}from'../common/index.js';import{SubmissionCallSchema}from'../call/base.js';import{unifyWorkflowInput}from'../envelope-unify.js';export const WorkflowOperateOpSchema=z['enum'](['next','hold','unhold','adminUnhold'])['describe']('Forward\x20operation:\x20\x27next\x27\x20=\x20accomplish\x20the\x20forward;\x20\x27hold\x27\x20=\x20block\x20the\x20forward;\x20'+'\x27unhold\x27\x20=\x20release\x20own\x20hold;\x20\x27adminUnhold\x27\x20=\x20force-release\x20via\x20permission\x20224.');export const WorkflowAccountSchema=z['object']({'address':z['string']()['describe']('Local\x20account\x20address'),'name':z['string']()['optional']()['describe']('Local\x20account\x20name\x20(if\x20any)')})['describe']('A\x20local\x20account\x20that\x20can\x20execute\x20a\x20forward');export const WorkflowForwardViewSchema=z['object']({'next_node':z['string']()['describe']('Target\x20node\x20this\x20forward\x20advances\x20INTO'),'forward':z['string']()['describe']('Forward\x20(operation)\x20name'),'weight':z['number']()['describe']('Forward\x20weight\x20contributed\x20toward\x20the\x20pair\x20threshold'),'threshold':z['number']()['describe']('Pair\x20threshold\x20the\x20forward\x20contributes\x20to'),'guard':z['string']()['optional']()['describe']('Guard\x20bound\x20to\x20this\x20forward\x20—\x20must\x20be\x20verified\x20(passport)\x20before\x20the\x20transition'),'guard_submissions':z['array'](z['object']({'identifier':z['number'](),'name':z['string']()['describe']('Human-readable\x20field\x20name'),'value_type':z['string']()['describe']('Expected\x20value\x20type\x20(Address,\x20U64,\x20String,\x20VecAddress,\x20...)'),'object_type':z['string']()['optional']()['describe']('When\x20value_type\x20is\x20an\x20object\x20address\x20—\x20the\x20expected\x20object\x20type\x20(e.g.\x20Order)')}))['optional']()['describe']('Guard\x20submission\x20fields\x20the\x20user\x20must\x20fill\x20to\x20advance\x20this\x20forward\x20(from\x20the\x20guard\x27s\x20b_submission\x20table\x20items)'),'operator_kind':z['enum'](['order_holder','named_operator','permission_index'])['describe']('How\x20this\x20forward\x27s\x20operator\x20is\x20resolved'),'permission_index':z['number']()['optional']()['describe']('Permission\x20index\x20when\x20operator_kind\x20is\x20\x27permission_index\x27'),'named_operator':z['string']()['optional']()['describe']('NamedOperator\x20namespace\x20when\x20operator_kind\x20is\x20\x27named_operator\x27'),'executable_accounts':z['array'](WorkflowAccountSchema)['describe']('LOCAL\x20accounts\x20that\x20can\x20execute\x20this\x20forward\x20(may\x20be\x20empty\x20—\x20then\x20no\x20local\x20account\x20is\x20authorized)')})['describe']('A\x20reachable\x20forward\x20with\x20its\x20permission\x20+\x20guard\x20+\x20executable\x20local\x20accounts');export const WorkflowTaskSchema=z['object']({'progress':z['string']()['describe']('Progress\x20object\x20address'),'progress_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20progress\x20(local\x20account/mark\x20name,\x20when\x20resolved)'),'current':z['string']()['describe']('Current\x20node\x20of\x20the\x20Progress\x20(\x27\x27\x20=\x20initial)'),'machine':z['string']()['describe']('Machine\x20object\x20address'),'machine_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20machine\x20object\x20(when\x20resolved)'),'task':z['string']()['nullable']()['describe']('Bound\x20task\x20(Order)\x20address,\x20or\x20null'),'task_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20bound\x20Order\x20(when\x20resolved)'),'service':z['string']()['optional']()['describe']('Service\x20address\x20(resolved\x20via\x20the\x20bound\x20Order,\x20if\x20any)'),'service_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20Service\x20object\x20(when\x20resolved)'),'context_repositories':z['array'](z['object']({'address':z['string']()['describe']('Context\x20repository\x20address'),'name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20repository\x20(when\x20resolved)')}))['optional']()['describe']('Context\x20repositories\x20bound\x20to\x20the\x20Progress\x20(zero\x20or\x20more)'),'options':z['array'](WorkflowForwardViewSchema)['describe']('ALL\x20reachable\x20next-node\x20forwards\x20with\x20permission\x20+\x20guard\x20+\x20executable\x20accounts\x20(may\x20be\x20empty\x20for\x20a\x20completed/terminal\x20progress)'),'terminal':z['boolean']()['describe']('True\x20when\x20the\x20current\x20node\x20has\x20no\x20outgoing\x20forwards\x20(workflow\x20is\x20stuck\x20or\x20finished)'),'actionable':z['boolean']()['describe']('True\x20when\x20at\x20least\x20one\x20LOCAL\x20account\x20can\x20execute\x20a\x20forward\x20right\x20now;\x20false\x20for\x20progress\x20that\x20is\x20merely\x20related\x20(e.g.\x20already\x20completed)'),'history_count':z['number']()['optional']()['describe']('On-chain\x20Progress.history\x20length\x20(append-only)\x20—\x200\x20when\x20no\x20migrations\x20yet'),'current_time':z['number']()['optional']()['describe']('Chain\x20clock\x20(ms)\x20when\x20the\x20current\x20node\x20was\x20entered\x20(Progress.current_time)\x20—\x20for\x20elapsed-dwell\x20display')})['describe']('A\x20progress\x20object\x20related\x20to\x20a\x20local\x20account:\x20actionable\x20(a\x20local\x20account\x20can\x20act\x20on\x20it)\x20or\x20related\x20(order\x20holder\x20/\x20named\x20operator\x20/\x20session\x20operator\x20involvement\x20—\x20viewable\x20history)');const WorkflowOperationInputUnion=z['discriminatedUnion']('action',[z['object']({'action':z['literal']('list'),'limit':z['number']()['int']()['min'](0x1)['max'](0x64)['optional']()['describe']('Max\x20progress\x20entries\x20to\x20return,\x20actionable\x20first\x20(default\x2050)'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()}),z['object']({'action':z['literal']('operate'),'progress':NameOrAddressSchema['describe']('Progress\x20object\x20(name\x20or\x20address)\x20to\x20operate\x20on'),'account':z['string']()['optional']()['describe']('Signing\x20account\x20(name\x20or\x20address).\x20Defaults\x20to\x20the\x20first\x20executable\x20local\x20account.'),'operate':z['object']({'operation':z['object']({'next_node_name':z['string']()['describe']('Target\x20node\x20name'),'forward':z['string']()['describe']('Forward\x20name')})['strict'](),'op':WorkflowOperateOpSchema,'message':z['string']()['optional']()['refine'](a=>a===undefined||isValidLongName(a),{'message':'Forward\x20message\x20exceeds\x20the\x20'+MAX_LONG_NAME_LENGTH+'-byte\x20on-chain\x20limit\x20'+'(UTF-8\x20bytes;\x20a\x20CJK\x20character\x20costs\x20~3\x20bytes).\x20Keep\x20the\x20message\x20short\x20'+'(e.g.\x20\x27delivered\x20per\x20route\x20A,\x20POD\x20photo\x20taken\x27)\x20and\x20put\x20long\x20evidence\x20'+'off-chain,\x20referencing\x20it\x20by\x20hash/URL\x20inside\x20the\x20message'})['describe']('Optional\x20human-readable\x20message\x20recorded\x20on-chain\x20(≤256\x20UTF-8\x20bytes\x20—\x20Move\x20LONG_NAME\x20cap,\x20enforced\x20here\x20before\x20the\x20transaction\x20is\x20built)')})['strict']()['describe']('⚠️\x20SINGLE-OPERATOR\x20LOCK:\x20each\x20forward\x20is\x20locked\x20by\x20the\x20FIRST\x20operator\x20that\x20accomplishes\x20it\x20—\x20a\x20different\x20account\x20'+'re-executing\x20the\x20same\x20accomplished\x20forward\x20aborts\x20E_NOT_THE_HOLDER,\x20and\x20the\x20weight\x20is\x20counted\x20only\x20once.\x20'+'Multi-operator\x20cooperation\x20(threshold\x20>\x201)\x20is\x20done\x20via\x20DISTINCT\x20forwards\x20(one\x20per\x20contributor).\x20The\x20workflow\x20'+'\x27list\x27\x20action\x20already\x20hides\x20accomplished\x20forwards\x20and\x20restricts\x20held\x20forwards\x20to\x20their\x20holder.'),'submission':SubmissionCallSchema['optional']()['describe']('Guard\x20submissions\x20for\x20guarded\x20forwards\x20(forward.guard_submissions\x20in\x20the\x20list\x20describes\x20each\x20required\x20field).\x20'+'Fill\x20`submission:\x20[{\x20guard:\x20\x27<guard>\x27,\x20submission:\x20[{\x20identifier,\x20b_submission:\x20true,\x20value_type,\x20value\x20}]\x20}]`\x20'+'with\x20the\x20value\x20the\x20user\x20entered\x20for\x20each\x20b_submission\x20field.'),'confirmed':z['boolean']()['optional']()['describe']('Phase\x202\x20ConfirmGate:\x20set\x20to\x20true\x20to\x20proceed\x20after\x20a\x20\x27pending_confirmation\x27\x20result\x20(required\x20when\x20submitting\x20guard\x20submission\x20data).\x20The\x20operation\x20is\x20NOT\x20executed\x20until\x20you\x20re-call\x20with\x20confirmed=true\x20after\x20user\x20consent.'),'dry_run':z['boolean']()['optional']()['describe']('Phase\x201\x20dry_run:\x20when\x20true,\x20SIMULATE\x20the\x20transaction\x20without\x20signing\x20or\x20submitting.\x20Returns\x20effects\x20+\x20events\x20showing\x20what\x20WOULD\x20happen\x20—\x20no\x20on-chain\x20state\x20is\x20modified,\x20no\x20gas\x20is\x20charged.\x20Use\x20this\x20to\x20verify\x20that\x20a\x20forward\x20(especially\x20a\x20guarded\x20one)\x20will\x20succeed\x20before\x20committing.'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()}),z['object']({'action':z['literal']('task'),'progress':NameOrAddressSchema['describe']('Progress\x20object\x20(name\x20or\x20address)\x20to\x20snapshot'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()}),z['object']({'action':z['literal']('history'),'progress':NameOrAddressSchema['describe']('Progress\x20object\x20(name\x20or\x20address)\x20whose\x20history\x20to\x20sync\x20and\x20view'),'limit':z['number']()['int']()['min'](0x1)['max'](0x1f4)['optional']()['describe']('Max\x20history\x20records\x20to\x20return,\x20newest\x20first\x20(default\x2050)'),'prune':z['boolean']()['optional']()['describe']('Run\x20the\x2090-day\x20retention\x20cleanup\x20of\x20stale\x20progress\x20histories\x20(default\x20true)'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()})])['describe']('workflow_operation\x20input.\x20action=\x27list\x27\x20enumerates\x20progress\x20related\x20to\x20local\x20accounts\x20(actionable\x20first,\x20'+'plus\x20completed/related\x20progress\x20with\x20viewable\x20history);\x20'+'action=\x27task\x27\x20builds\x20the\x20SAME\x20snapshot\x20for\x20ONE\x20progress\x20(options\x20may\x20carry\x20empty\x20executable_accounts\x20—\x20the\x20client\x20grays\x20the\x20actions);\x20'+'action=\x27operate\x27\x20advances/holds/unholds\x20a\x20forward\x20as\x20a\x20chosen\x20local\x20account;\x20'+'action=\x27history\x27\x20incrementally\x20syncs\x20+\x20returns\x20a\x20progress\x27s\x20on-chain\x20history.\x20'+'NETWORK\x20POSITION\x20(single):\x20the\x20native\x20shape\x20takes\x20network\x20at\x20the\x20TOP\x20LEVEL\x20of\x20the\x20input;\x20the\x20onchain\x20progress\x20envelope\x20'+'({operation_type:\x27progress\x27,\x20data,\x20env})\x20takes\x20it\x20in\x20env.\x20A\x20network\x20misplaced\x20inside\x20data\x20(or\x20inside\x20env\x20on\x20the\x20native\x20shape)\x20'+'is\x20REFUSED\x20with\x20a\x20fail-loud\x20error\x20—\x20it\x20never\x20silently\x20falls\x20back\x20to\x20the\x20default\x20network.');export const WorkflowOperationInputSchema=z['preprocess'](unifyWorkflowInput,WorkflowOperationInputUnion);export const WorkflowHistoryForwardSchema=z['object']({'forward':z['string']()['describe']('Forward\x20(operation)\x20name'),'who':z['string']()['nullable']()['describe']('Operator\x20address\x20that\x20performed\x20the\x20forward\x20(null\x20=\x20not\x20yet\x20held)'),'who_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20operator\x20(account\x20name,\x20else\x20LocalMark)'),'msg':z['string']()['describe']('Message\x20recorded\x20with\x20the\x20forward'),'accomplished':z['boolean']()['describe']('Whether\x20the\x20forward\x20was\x20accomplished'),'weight':z['number']()['optional']()['describe']('Forward\x20weight\x20(from\x20the\x20machine\x20config;\x20the\x20chain\x20Holder\x20snapshot\x20stores\x20no\x20per-forward\x20weight)'),'time':z['number']()['describe']('Last\x20operation\x20time\x20(on-chain\x20clock\x20ms)'),'retained_submission':z['array'](z['object']({'identifier':z['number'](),'value_type':z['number'](),'value':z['unknown'](),'display_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20first\x20address-typed\x20value\x20(when\x20resolved)')}))['optional']()['describe']('Retained\x20Guard\x20submission\x20entries')})['describe']('One\x20forward\x20execution\x20inside\x20a\x20session\x20snapshot');export const WorkflowHistorySessionSchema=z['object']({'next_node':z['string']()['describe']('Session\x20target\x20node\x20(the\x20not-yet-migrated\x20direction)'),'weights':z['number']()['describe']('Accumulated\x20forward\x20weight\x20at\x20migration\x20time'),'threshold':z['number']()['describe']('Threshold\x20required\x20to\x20complete\x20the\x20pair'),'forwards':z['array'](WorkflowHistoryForwardSchema)['describe']('Forward\x20executions\x20in\x20this\x20session')})['describe']('Session\x20snapshot\x20captured\x20at\x20migration\x20time');export const WorkflowHistoryRecordSchema=z['object']({'index':z['number']()['describe']('On-chain\x20history\x20index\x20(0-based,\x20append-only)'),'node':z['string']()['describe']('Node\x20migrated\x20FROM'),'next_node':z['string']()['describe']('Node\x20migrated\x20TO'),'time':z['number']()['describe']('Migration\x20time\x20(on-chain\x20clock\x20ms)'),'session':z['array'](WorkflowHistorySessionSchema)['describe']('Full\x20session\x20snapshot\x20at\x20migration')})['describe']('One\x20on-chain\x20Progress\x20history\x20record\x20(a\x20completed\x20migration)');export const WorkflowHistoryViewSchema=z['object']({'progress':z['string']()['describe']('Progress\x20object\x20address'),'current':z['string']()['optional']()['describe']('Current\x20node\x20as\x20of\x20this\x20sync'),'records':z['array'](WorkflowHistoryRecordSchema)['describe']('History\x20records,\x20newest\x20first'),'synced':z['number']()['describe']('Number\x20of\x20records\x20newly\x20synced\x20in\x20this\x20call'),'cursor':z['number']()['describe']('Last\x20synced\x20history\x20index\x20(0-based;\x20-1\x20=\x20none\x20yet)'),'pruned':z['number']()['describe']('Progress\x20entries\x20cleaned\x20by\x20the\x2090-day\x20retention\x20in\x20this\x20call')})['describe']('A\x20progress\x27s\x20synced\x20on-chain\x20history');export const WorkflowOperationResultSchema=z['object']({'action':z['enum'](['list','task','operate','history']),'tasks':z['array'](WorkflowTaskSchema)['optional']()['describe']('Present\x20for\x20action=\x27list\x27\x20and\x20action=\x27task\x27\x20(a\x20one-element\x20array\x20—\x20the\x20same\x20snapshot\x20shape\x20as\x20a\x20list\x20item,\x20built\x20for\x20the\x20requested\x20progress\x20regardless\x20of\x20local-account\x20relation;\x20executable_accounts\x20may\x20be\x20empty\x20when\x20no\x20local\x20account\x20is\x20authorized)'),'operate':z['unknown']()['optional']()['describe']('Present\x20for\x20action=\x27operate\x27\x20(the\x20underlying\x20progress\x20operation\x20result)'),'history':WorkflowHistoryViewSchema['optional']()['describe']('Present\x20for\x20action=\x27history\x27'),'note':z['string']()['optional']()})['describe']('workflow_operation\x20result');export const WorkflowOperationOutputSchema=z['object']({'result':WorkflowOperationResultSchema})['describe']('workflow_operation\x20output\x20envelope');
1
+ import{z}from'zod';import{isValidLongName,MAX_LONG_NAME_LENGTH}from'@wowok/wowok';import{EntrypointSchema,NameOrAddressSchema}from'../common/index.js';import{SubmissionCallSchema}from'../call/base.js';import{unifyWorkflowInput}from'../envelope-unify.js';export const WorkflowOperateOpSchema=z['enum'](['next','hold','unhold','adminUnhold'])['describe']('Forward\x20operation:\x20\x27next\x27\x20=\x20accomplish\x20the\x20forward;\x20\x27hold\x27\x20=\x20block\x20the\x20forward;\x20'+'\x27unhold\x27\x20=\x20release\x20own\x20hold;\x20\x27adminUnhold\x27\x20=\x20force-release\x20via\x20permission\x20224.');export const WorkflowAccountSchema=z['object']({'address':z['string']()['describe']('Local\x20account\x20address'),'name':z['string']()['optional']()['describe']('Local\x20account\x20name\x20(if\x20any)')})['describe']('A\x20local\x20account\x20that\x20can\x20execute\x20a\x20forward');export const WorkflowForwardViewSchema=z['object']({'next_node':z['string']()['describe']('Target\x20node\x20this\x20forward\x20advances\x20INTO'),'forward':z['string']()['describe']('Forward\x20(operation)\x20name'),'weight':z['number']()['describe']('Forward\x20weight\x20contributed\x20toward\x20the\x20pair\x20threshold'),'threshold':z['number']()['describe']('Pair\x20threshold\x20the\x20forward\x20contributes\x20to'),'guard':z['string']()['optional']()['describe']('Guard\x20bound\x20to\x20this\x20forward\x20—\x20must\x20be\x20verified\x20(passport)\x20before\x20the\x20transition'),'guard_submissions':z['array'](z['object']({'identifier':z['number'](),'name':z['string']()['describe']('Human-readable\x20field\x20name'),'value_type':z['string']()['describe']('Expected\x20value\x20type\x20(Address,\x20U64,\x20String,\x20VecAddress,\x20...)'),'object_type':z['string']()['optional']()['describe']('When\x20value_type\x20is\x20an\x20object\x20address\x20—\x20the\x20expected\x20object\x20type\x20(e.g.\x20Order)')}))['optional']()['describe']('Guard\x20submission\x20fields\x20the\x20user\x20must\x20fill\x20to\x20advance\x20this\x20forward\x20(from\x20the\x20guard\x27s\x20b_submission\x20table\x20items)'),'operator_kind':z['enum'](['order_holder','named_operator','permission_index'])['describe']('How\x20this\x20forward\x27s\x20operator\x20is\x20resolved'),'permission_index':z['number']()['optional']()['describe']('Permission\x20index\x20when\x20operator_kind\x20is\x20\x27permission_index\x27'),'named_operator':z['string']()['optional']()['describe']('NamedOperator\x20namespace\x20when\x20operator_kind\x20is\x20\x27named_operator\x27'),'roster_note':z['string']()['optional']()['describe']('F-ZR2-24\x20fail-loud\x20remediation:\x20present\x20ONLY\x20when\x20this\x20named-operator\x20forward\x27s\x20on-chain\x20roster\x20namespace\x20is\x20unseeded\x20for\x20this\x20order\x20(every\x20execution\x20aborts)\x20—\x20carries\x20the\x20exact\x20progress_namedOperator\x20seeding\x20call'),'executable_accounts':z['array'](WorkflowAccountSchema)['describe']('LOCAL\x20accounts\x20that\x20can\x20execute\x20this\x20forward\x20(may\x20be\x20empty\x20—\x20then\x20no\x20local\x20account\x20is\x20authorized)')})['describe']('A\x20reachable\x20forward\x20with\x20its\x20permission\x20+\x20guard\x20+\x20executable\x20local\x20accounts');export const WorkflowTaskSchema=z['object']({'progress':z['string']()['describe']('Progress\x20object\x20address'),'progress_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20progress\x20(local\x20account/mark\x20name,\x20when\x20resolved)'),'current':z['string']()['describe']('Current\x20node\x20of\x20the\x20Progress\x20(\x27\x27\x20=\x20initial)'),'machine':z['string']()['describe']('Machine\x20object\x20address'),'machine_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20machine\x20object\x20(when\x20resolved)'),'task':z['string']()['nullable']()['describe']('Bound\x20task\x20(Order)\x20address,\x20or\x20null'),'task_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20bound\x20Order\x20(when\x20resolved)'),'service':z['string']()['optional']()['describe']('Service\x20address\x20(resolved\x20via\x20the\x20bound\x20Order,\x20if\x20any)'),'service_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20Service\x20object\x20(when\x20resolved)'),'context_repositories':z['array'](z['object']({'address':z['string']()['describe']('Context\x20repository\x20address'),'name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20repository\x20(when\x20resolved)')}))['optional']()['describe']('Context\x20repositories\x20bound\x20to\x20the\x20Progress\x20(zero\x20or\x20more)'),'options':z['array'](WorkflowForwardViewSchema)['describe']('ALL\x20reachable\x20next-node\x20forwards\x20with\x20permission\x20+\x20guard\x20+\x20executable\x20accounts\x20(may\x20be\x20empty\x20for\x20a\x20completed/terminal\x20progress)'),'terminal':z['boolean']()['describe']('True\x20when\x20the\x20current\x20node\x20has\x20no\x20outgoing\x20forwards\x20(workflow\x20is\x20stuck\x20or\x20finished)'),'actionable':z['boolean']()['describe']('True\x20when\x20at\x20least\x20one\x20LOCAL\x20account\x20can\x20execute\x20a\x20forward\x20right\x20now;\x20false\x20for\x20progress\x20that\x20is\x20merely\x20related\x20(e.g.\x20already\x20completed)'),'history_count':z['number']()['optional']()['describe']('On-chain\x20Progress.history\x20length\x20(append-only)\x20—\x200\x20when\x20no\x20migrations\x20yet'),'current_time':z['number']()['optional']()['describe']('Chain\x20clock\x20(ms)\x20when\x20the\x20current\x20node\x20was\x20entered\x20(Progress.current_time)\x20—\x20for\x20elapsed-dwell\x20display')})['describe']('A\x20progress\x20object\x20related\x20to\x20a\x20local\x20account:\x20actionable\x20(a\x20local\x20account\x20can\x20act\x20on\x20it)\x20or\x20related\x20(order\x20holder\x20/\x20named\x20operator\x20/\x20session\x20operator\x20involvement\x20—\x20viewable\x20history)');const WorkflowOperationInputUnion=z['discriminatedUnion']('action',[z['object']({'action':z['literal']('list'),'limit':z['number']()['int']()['min'](0x1)['max'](0x64)['optional']()['describe']('Max\x20progress\x20entries\x20to\x20return,\x20actionable\x20first\x20(default\x2050)'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()}),z['object']({'action':z['literal']('operate'),'progress':NameOrAddressSchema['describe']('Progress\x20object\x20(name\x20or\x20address)\x20to\x20operate\x20on'),'account':z['string']()['optional']()['describe']('Signing\x20account\x20(name\x20or\x20address).\x20Defaults\x20to\x20the\x20first\x20executable\x20local\x20account.'),'operate':z['object']({'operation':z['object']({'next_node_name':z['string']()['describe']('Target\x20node\x20name'),'forward':z['string']()['describe']('Forward\x20name')})['strict'](),'op':WorkflowOperateOpSchema,'message':z['string']()['optional']()['refine'](a=>a===undefined||isValidLongName(a),{'message':'Forward\x20message\x20exceeds\x20the\x20'+MAX_LONG_NAME_LENGTH+'-byte\x20on-chain\x20limit\x20'+'(UTF-8\x20bytes;\x20a\x20CJK\x20character\x20costs\x20~3\x20bytes).\x20Keep\x20the\x20message\x20short\x20'+'(e.g.\x20\x27delivered\x20per\x20route\x20A,\x20POD\x20photo\x20taken\x27)\x20and\x20put\x20long\x20evidence\x20'+'off-chain,\x20referencing\x20it\x20by\x20hash/URL\x20inside\x20the\x20message'})['describe']('Optional\x20human-readable\x20message\x20recorded\x20on-chain\x20(≤256\x20UTF-8\x20bytes\x20—\x20Move\x20LONG_NAME\x20cap,\x20enforced\x20here\x20before\x20the\x20transaction\x20is\x20built)')})['strict']()['describe']('⚠️\x20SINGLE-OPERATOR\x20LOCK:\x20each\x20forward\x20is\x20locked\x20by\x20the\x20FIRST\x20operator\x20that\x20accomplishes\x20it\x20—\x20a\x20different\x20account\x20'+'re-executing\x20the\x20same\x20accomplished\x20forward\x20aborts\x20E_NOT_THE_HOLDER,\x20and\x20the\x20weight\x20is\x20counted\x20only\x20once.\x20'+'Multi-operator\x20cooperation\x20(threshold\x20>\x201)\x20is\x20done\x20via\x20DISTINCT\x20forwards\x20(one\x20per\x20contributor).\x20The\x20workflow\x20'+'\x27list\x27\x20action\x20already\x20hides\x20accomplished\x20forwards\x20and\x20restricts\x20held\x20forwards\x20to\x20their\x20holder.'),'submission':SubmissionCallSchema['optional']()['describe']('Guard\x20submissions\x20for\x20guarded\x20forwards\x20(forward.guard_submissions\x20in\x20the\x20list\x20describes\x20each\x20required\x20field).\x20'+'Fill\x20`submission:\x20[{\x20guard:\x20\x27<guard>\x27,\x20submission:\x20[{\x20identifier,\x20b_submission:\x20true,\x20value_type,\x20value\x20}]\x20}]`\x20'+'with\x20the\x20value\x20the\x20user\x20entered\x20for\x20each\x20b_submission\x20field.'),'confirmed':z['boolean']()['optional']()['describe']('Phase\x202\x20ConfirmGate:\x20set\x20to\x20true\x20to\x20proceed\x20after\x20a\x20\x27pending_confirmation\x27\x20result\x20(required\x20when\x20submitting\x20guard\x20submission\x20data).\x20The\x20operation\x20is\x20NOT\x20executed\x20until\x20you\x20re-call\x20with\x20confirmed=true\x20after\x20user\x20consent.'),'dry_run':z['boolean']()['optional']()['describe']('Phase\x201\x20dry_run:\x20when\x20true,\x20SIMULATE\x20the\x20transaction\x20without\x20signing\x20or\x20submitting.\x20Returns\x20effects\x20+\x20events\x20showing\x20what\x20WOULD\x20happen\x20—\x20no\x20on-chain\x20state\x20is\x20modified,\x20no\x20gas\x20is\x20charged.\x20Use\x20this\x20to\x20verify\x20that\x20a\x20forward\x20(especially\x20a\x20guarded\x20one)\x20will\x20succeed\x20before\x20committing.'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()}),z['object']({'action':z['literal']('task'),'progress':NameOrAddressSchema['describe']('Progress\x20object\x20(name\x20or\x20address)\x20to\x20snapshot'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()}),z['object']({'action':z['literal']('history'),'progress':NameOrAddressSchema['describe']('Progress\x20object\x20(name\x20or\x20address)\x20whose\x20history\x20to\x20sync\x20and\x20view'),'limit':z['number']()['int']()['min'](0x1)['max'](0x1f4)['optional']()['describe']('Max\x20history\x20records\x20to\x20return,\x20newest\x20first\x20(default\x2050)'),'prune':z['boolean']()['optional']()['describe']('Run\x20the\x2090-day\x20retention\x20cleanup\x20of\x20stale\x20progress\x20histories\x20(default\x20true)'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()})])['describe']('workflow_operation\x20input.\x20action=\x27list\x27\x20enumerates\x20progress\x20related\x20to\x20local\x20accounts\x20(actionable\x20first,\x20'+'plus\x20completed/related\x20progress\x20with\x20viewable\x20history);\x20'+'action=\x27task\x27\x20builds\x20the\x20SAME\x20snapshot\x20for\x20ONE\x20progress\x20(options\x20may\x20carry\x20empty\x20executable_accounts\x20—\x20the\x20client\x20grays\x20the\x20actions);\x20'+'action=\x27operate\x27\x20advances/holds/unholds\x20a\x20forward\x20as\x20a\x20chosen\x20local\x20account;\x20'+'action=\x27history\x27\x20incrementally\x20syncs\x20+\x20returns\x20a\x20progress\x27s\x20on-chain\x20history.\x20'+'NETWORK\x20POSITION\x20(single):\x20the\x20native\x20shape\x20takes\x20network\x20at\x20the\x20TOP\x20LEVEL\x20of\x20the\x20input;\x20the\x20onchain\x20progress\x20envelope\x20'+'({operation_type:\x27progress\x27,\x20data,\x20env})\x20takes\x20it\x20in\x20env.\x20A\x20network\x20misplaced\x20inside\x20data\x20(or\x20inside\x20env\x20on\x20the\x20native\x20shape)\x20'+'is\x20REFUSED\x20with\x20a\x20fail-loud\x20error\x20—\x20it\x20never\x20silently\x20falls\x20back\x20to\x20the\x20default\x20network.');export const WorkflowOperationInputSchema=z['preprocess'](unifyWorkflowInput,WorkflowOperationInputUnion);export const WorkflowHistoryForwardSchema=z['object']({'forward':z['string']()['describe']('Forward\x20(operation)\x20name'),'who':z['string']()['nullable']()['describe']('Operator\x20address\x20that\x20performed\x20the\x20forward\x20(null\x20=\x20not\x20yet\x20held)'),'who_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20operator\x20(account\x20name,\x20else\x20LocalMark)'),'msg':z['string']()['describe']('Message\x20recorded\x20with\x20the\x20forward'),'accomplished':z['boolean']()['describe']('Whether\x20the\x20forward\x20was\x20accomplished'),'weight':z['number']()['optional']()['describe']('Forward\x20weight\x20(from\x20the\x20machine\x20config;\x20the\x20chain\x20Holder\x20snapshot\x20stores\x20no\x20per-forward\x20weight)'),'time':z['number']()['describe']('Last\x20operation\x20time\x20(on-chain\x20clock\x20ms)'),'retained_submission':z['array'](z['object']({'identifier':z['number'](),'value_type':z['number'](),'value':z['unknown'](),'display_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20first\x20address-typed\x20value\x20(when\x20resolved)')}))['optional']()['describe']('Retained\x20Guard\x20submission\x20entries')})['describe']('One\x20forward\x20execution\x20inside\x20a\x20session\x20snapshot');export const WorkflowHistorySessionSchema=z['object']({'next_node':z['string']()['describe']('Session\x20target\x20node\x20(the\x20not-yet-migrated\x20direction)'),'weights':z['number']()['describe']('Accumulated\x20forward\x20weight\x20at\x20migration\x20time'),'threshold':z['number']()['describe']('Threshold\x20required\x20to\x20complete\x20the\x20pair'),'forwards':z['array'](WorkflowHistoryForwardSchema)['describe']('Forward\x20executions\x20in\x20this\x20session')})['describe']('Session\x20snapshot\x20captured\x20at\x20migration\x20time');export const WorkflowHistoryRecordSchema=z['object']({'index':z['number']()['describe']('On-chain\x20history\x20index\x20(0-based,\x20append-only)'),'node':z['string']()['describe']('Node\x20migrated\x20FROM'),'next_node':z['string']()['describe']('Node\x20migrated\x20TO'),'time':z['number']()['describe']('Migration\x20time\x20(on-chain\x20clock\x20ms)'),'session':z['array'](WorkflowHistorySessionSchema)['describe']('Full\x20session\x20snapshot\x20at\x20migration')})['describe']('One\x20on-chain\x20Progress\x20history\x20record\x20(a\x20completed\x20migration)');export const WorkflowHistoryViewSchema=z['object']({'progress':z['string']()['describe']('Progress\x20object\x20address'),'current':z['string']()['optional']()['describe']('Current\x20node\x20as\x20of\x20this\x20sync'),'records':z['array'](WorkflowHistoryRecordSchema)['describe']('History\x20records,\x20newest\x20first'),'synced':z['number']()['describe']('Number\x20of\x20records\x20newly\x20synced\x20in\x20this\x20call'),'cursor':z['number']()['describe']('Last\x20synced\x20history\x20index\x20(0-based;\x20-1\x20=\x20none\x20yet)'),'pruned':z['number']()['describe']('Progress\x20entries\x20cleaned\x20by\x20the\x2090-day\x20retention\x20in\x20this\x20call')})['describe']('A\x20progress\x27s\x20synced\x20on-chain\x20history');export const WorkflowOperationResultSchema=z['object']({'action':z['enum'](['list','task','operate','history']),'tasks':z['array'](WorkflowTaskSchema)['optional']()['describe']('Present\x20for\x20action=\x27list\x27\x20and\x20action=\x27task\x27\x20(a\x20one-element\x20array\x20—\x20the\x20same\x20snapshot\x20shape\x20as\x20a\x20list\x20item,\x20built\x20for\x20the\x20requested\x20progress\x20regardless\x20of\x20local-account\x20relation;\x20executable_accounts\x20may\x20be\x20empty\x20when\x20no\x20local\x20account\x20is\x20authorized)'),'operate':z['unknown']()['optional']()['describe']('Present\x20for\x20action=\x27operate\x27\x20(the\x20underlying\x20progress\x20operation\x20result)'),'history':WorkflowHistoryViewSchema['optional']()['describe']('Present\x20for\x20action=\x27history\x27'),'note':z['string']()['optional']()})['describe']('workflow_operation\x20result');export const WorkflowOperationOutputSchema=z['object']({'result':WorkflowOperationResultSchema})['describe']('workflow_operation\x20output\x20envelope');
@@ -1 +1 @@
1
- import{readFileSync,existsSync,writeFileSync,mkdirSync}from'fs';import{resolve,join,dirname}from'path';import{fileURLToPath}from'url';import{GUARDQUERY,ObjectType,ValueType}from'@wowok/wowok';import{TOOLS_REFERENCE,getToolReference,searchToolReference,getToolSequence}from'../knowledge/tools-reference.js';import{GUARD_DESIGN_PATTERNS,getGuardDesignPattern,GUARD_DESIGN_PATTERNS_VERSION,GUARD_SCHEMA_NOTES}from'../knowledge/guard-design-patterns.js';import{OBJECT_REUSE_RULES,CREATE_VS_MODIFY_PATTERN,IMMUTABILITY_RULES,PROTOCOL_SLOT_RULES,OPERATION_TYPE_CLASSIFICATION,OPERATION_CLASS_META,NAMING_CONVENTIONS,SAFETY_RULES_VERSION}from'../knowledge/safety-rules.js';import{listTemplates as a516a,getTemplateDetail,instantiateTemplate,getTemplateCounts,TEMPLATE_OBJECT_TYPES}from'../knowledge/template-registry.js';import{GUARD_TEMPLATES,GUARD_TEMPLATES_VERSION,GUARD_TEMPLATES_COUNT}from'../knowledge/guard-templates.js';import{lintGuard,formatLintResult}from'../knowledge/guard-lint.js';import{renderGuardTreeIndented,renderGuardMermaid,walkGuardTree}from'../knowledge/guard-render.js';import{getGuardQueryByIdOrName}from'../schema/utils/guard-query-utils.js';const __dirname=fileURLToPath(new URL('.',import.meta.url)),SCHEMAS_DIR=resolve(__dirname,'../../dist/schemas'),WORKSPACE_TMP_DIR=resolve(process['cwd'](),'.trae','tmp');export function areSchemasAvailable(){return existsSync(SCHEMAS_DIR)&&existsSync(join(SCHEMAS_DIR,'index.json'));}let schemaIndexCache;export function getSchemaIndex(){if(schemaIndexCache!==undefined)return schemaIndexCache;try{const a=join(SCHEMAS_DIR,'index.json');if(!existsSync(a))return null;const b=readFileSync(a,'utf-8');return schemaIndexCache=JSON['parse'](b),schemaIndexCache;}catch{return null;}}export function listSchemas(){const a=getSchemaIndex();if(!a)return[];return[...a['tools']||[],...a['operations']||[]];}const schemaCache=new Map(),outputSchemaCache=new Map();export function getSchema(a){const b=schemaCache['get'](a);if(b!==undefined)return b;try{let c=join(SCHEMAS_DIR,a+'.schema.json');!existsSync(c)&&(c=join(SCHEMAS_DIR,a+'.json'));if(!existsSync(c))return null;const d=readFileSync(c,'utf-8'),e=JSON['parse'](d),f=resolveSchemaRefs(e);return schemaCache['set'](a,f),f;}catch{return null;}}let outputSchemaResolver=null;export function registerOutputSchemaResolver(a){outputSchemaResolver=a;}export function getOutputSchema(a){const b=outputSchemaCache['get'](a);if(b!==undefined)return b;try{const c=join(SCHEMAS_DIR,a+'.output.json');if(existsSync(c)){const d=readFileSync(c,'utf-8'),e=JSON['parse'](d),f=resolveSchemaRefs(e);return outputSchemaCache['set'](a,f),f;}}catch{}if(!outputSchemaResolver)return null;try{const g=outputSchemaResolver(a);if(!g)return null;const h=resolveSchemaRefs(g);return outputSchemaCache['set'](a,h),h;}catch{return null;}}function guardParamImportance(a){if(!a['required'])return'optional';return a['type']==='address'||a['type']==='vec_address'?'identity-critical':'required';}const GUARD_PARAM_IMPORTANCE_RANK={'identity-critical':0x0,'required':0x1,'optional':0x2};function projectGuardParam(a){return{'name':a['name'],'type':a['type'],'meaning':a['description'],'importance':guardParamImportance(a),'required':a['required'],'default':a['default']??null,'constraint':a['constraint']??null};}function projectGuardTemplate(a){return{'id':a['id'],'scene_id':a['scene_id'],'name':a['name'],'description':a['description'],'verifier_constraint_level':a['verifier_constraint_level']??null,'recommended_patterns':a['recommended_patterns'],'applicable_industries':a['applicable_industries'],'relevant_risks':a['relevant_risks'],'creation_notes':a['creation_notes'],'example_use_case':a['example_use_case'],'parameters':a['parameters']['map'](projectGuardParam)['sort']((c,d)=>GUARD_PARAM_IMPORTANCE_RANK[c['importance']]-GUARD_PARAM_IMPORTANCE_RANK[d['importance']]),'example_table':a['example_table'],'example_root':a['example_root']};}export function getGuardTemplates(a){if(!a)return{'version':GUARD_TEMPLATES_VERSION,'count':GUARD_TEMPLATES_COUNT,'templates':GUARD_TEMPLATES['map'](c=>({'id':c['id'],'scene_id':c['scene_id'],'name':c['name'],'description':c['description'],'verifier_constraint_level':c['verifier_constraint_level']??null,'parameter_count':c['parameters']['length']}))};const b=GUARD_TEMPLATES['find'](c=>c['id']===a||c['name']===a);return b?projectGuardTemplate(b):null;}export function getSchemaField(a,b){const c=getSchema(a);if(!c)return null;const d=b['split']('.')['filter'](Boolean);let e=c;for(const f of d){if(!e||typeof e!=='object')return null;if(e['properties']&&f in e['properties']){e=e['properties'][f];continue;}if(e['items']&&typeof e['items']==='object'){if(/^\d+$/['test'](f)){e=e['items'];continue;}if(e['items']['properties']&&f in e['items']['properties']){e=e['items']['properties'][f];continue;}}if(Array['isArray'](e['oneOf'])||Array['isArray'](e['anyOf'])){const g=e['oneOf']??e['anyOf'];for(const h of g){if(h&&typeof h==='object'&&h['properties']&&f in h['properties']){e=h['properties'][f];break;}}continue;}if(f in e){e=e[f];continue;}return null;}return e;}function resolveSchemaRefs(a,b=new Set()){if(!a||typeof a!=='object')return a;if(Array['isArray'](a))return a['map'](d=>resolveSchemaRefs(d,b));const c={};for(const [d,e]of Object['entries'](a)){if(d==='$ref'&&typeof e==='string'){if(e['startsWith']('#'))c[d]=e;else{const f=loadRefSchema(e,b);f&&Object['assign'](c,resolveSchemaRefs(f,b));}}else typeof e==='object'?c[d]=resolveSchemaRefs(e,b):c[d]=e;}return c;}function loadRefSchema(a,b){if(a['startsWith']('#'))return null;if(b['has'](a))return{'description':'Circular\x20reference\x20to\x20'+a};b['add'](a);try{const c=join(SCHEMAS_DIR,a);if(!existsSync(c))return null;const d=readFileSync(c,'utf-8');return JSON['parse'](d);}catch{return null;}}export function searchSchemas(a){const b=listSchemas(),c=a['toLowerCase']();return b['filter'](d=>{const e=d['name']['toLowerCase']()['includes'](c),f=d['title']?.['toLowerCase']()['includes'](c),g=d['description']?.['toLowerCase']()['includes'](c);return e||f||g;});}export function listOperations(){const a=getSchemaIndex();if(!a)return[];return(a['operations']||[])['filter'](b=>b['name']['startsWith']('onchain_operations_'));}function writeResponseToFile(a,b){try{let c;if(b)c=resolve(process['cwd'](),b);else{!existsSync(WORKSPACE_TMP_DIR)&&mkdirSync(WORKSPACE_TMP_DIR,{'recursive':!![]});const g=Date['now']();c=join(WORKSPACE_TMP_DIR,'schema-'+g+'.json');}const d=dirname(c);!existsSync(d)&&mkdirSync(d,{'recursive':!![]});const f=typeof a==='string'?a:JSON['stringify'](a,null,0x2);return writeFileSync(c,f,'utf-8'),c;}catch(h){return null;}}const INLINE_CHAR_LIMIT=0x20*0x400,AUTO_OVERFLOW_DIR='.wowok/tmp';function unionVariantLabel(a){if(!a||typeof a!=='object')return'variant';const b=a['properties']&&typeof a['properties']==='object'?a['properties']:undefined;if(b)for(const [c,d]of Object['entries'](b)){if(d&&typeof d==='object'&&d['const']!==undefined)return c+'='+String(d['const']);}return typeof a['title']==='string'?a['title']:'variant';}export function buildSchemaSummary(a){const b=[];a&&typeof a['title']==='string'&&b['push']('Title:\x20'+a['title']);const c=a&&typeof a==='object'?a['properties']:undefined;if(c&&typeof c==='object'&&!Array['isArray'](c)){const d=Array['isArray'](a['required'])?a['required']:[],e=Object['keys'](c);b['push']('Top-level\x20fields\x20('+e['length']+',\x20*\x20=\x20required):');for(const f of e['slice'](0x0,0x28)){const g=c[f]??{},h=Array['isArray'](g['type'])?g['type']['join']('|'):g['type']??(g['$ref']?'ref':g['anyOf']||g['oneOf']?'union':'any'),i=d['includes'](f)?'*':'',j=typeof g['description']==='string'&&g['description']['length']>0x0?'\x20—\x20'+g['description']['split']('\x0a')[0x0]['slice'](0x0,0x50):'';b['push']('\x20\x20-\x20'+f+i+':\x20'+h+j);}e['length']>0x28&&b['push']('\x20\x20-\x20...and\x20'+(e['length']-0x28)+'\x20more\x20—\x20use\x20action=\x27get_field\x27\x20with\x20field_path\x20to\x20inspect');}else{if(a&&(Array['isArray'](a['oneOf'])||Array['isArray'](a['anyOf']))){const k=a['oneOf']??a['anyOf'];b['push']('Union\x20of\x20'+k['length']+'\x20variants:');for(const m of k['slice'](0x0,0x28)){const o=m&&typeof m['description']==='string'&&m['description']['length']>0x0?'\x20—\x20'+m['description']['split']('\x0a')[0x0]['slice'](0x0,0x50):'';b['push']('\x20\x20-\x20'+unionVariantLabel(m)+o);}k['length']>0x28&&b['push']('\x20\x20-\x20...and\x20'+(k['length']-0x28)+'\x20more');const l=k['filter'](q=>q&&typeof q==='object'&&q['properties']&&typeof q['properties']==='object');if(l['length']===k['length']&&l['length']>0x0){const q=Object['keys'](l[0x0]['properties'])['filter'](r=>l['every'](s=>Object['prototype']['hasOwnProperty']['call'](s['properties'],r)));b['push'](q['length']>0x0?'Common\x20fields\x20(declared\x20by\x20ALL\x20'+l['length']+'\x20variants):\x20'+q['join'](',\x20')+'.':'No\x20field\x20is\x20declared\x20by\x20all\x20'+l['length']+'\x20variants\x20—\x20each\x20variant\x20takes\x20its\x20own\x20parameters.');}else b['push']('Field\x20names\x20differ\x20per\x20variant\x20—\x20read\x20the\x20variant\x27s\x20own\x20list\x20above.\x20'+'The\x20discriminator\x20(\x22operation\x22\x20and\x20friends)\x20is\x20the\x20only\x20shared\x20key.');for(const r of k['slice'](0x0,0x28)){const s=r&&typeof r==='object'&&r['properties']&&typeof r['properties']==='object'?Object['keys'](r['properties']):[];if(s['length']===0x0)continue;b['push']('\x20\x20\x20\x20'+unionVariantLabel(r)+'\x20fields:\x20'+s['join'](',\x20'));}b['push']('Drill\x20into\x20the\x20variant\x20you\x20need\x20with\x20action=\x27get_field\x27\x20(name\x20+\x20field_path)\x20—\x20the\x20lists\x20above\x20are\x20a\x20summary,\x20not\x20the\x20schema.');}else b['push']('No\x20top-level\x20properties\x20map\x20—\x20use\x20action=\x27get_field\x27\x20with\x20a\x20field_path\x20to\x20inspect\x20this\x20schema.');}return b['join']('\x0a');}export function autoOverflowToFile(a,b){try{const c=JSON['stringify'](a)['length'];if(c<=INLINE_CHAR_LIMIT)return null;const d=process['env']['WOWOK_SCHEMA_TMP_DIR'],e=d?resolve(d):resolve(process['cwd'](),AUTO_OVERFLOW_DIR);!existsSync(e)&&mkdirSync(e,{'recursive':!![]});const f=b['replace'](/[^a-zA-Z0-9_-]/g,'_'),g=f+'.schema.json',h=join(e,g);return writeFileSync(h,JSON['stringify'](a,null,0x2),'utf-8'),{'absolute_path':h,'relative_path':d?h:join(AUTO_OVERFLOW_DIR,g),'bytes':c,'summary':buildSchemaSummary(a)};}catch{return null;}}export function processSchemaQuery(a){const {action:b,name:c,query:d,field_path:f,template:g,output_file:h,object_type:i,params:j}=a;if(b==='get_guard_templates'){const k=getGuardTemplates(g);if(!k)return{'success':![],'action':b,'data':null,'message':'Guard\x20template\x20\x27'+g+'\x27\x20not\x20found\x20in\x20the\x20unified\x20library\x20(v'+GUARD_TEMPLATES_VERSION+').\x20Omit\x20\x27template\x27\x20to\x20list\x20every\x20id.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20guard\x20template\x20ids.','Ids\x20are\x20scene-namespaced\x20—\x20e.g.\x20tpl_buy_guard_*\x20(purchase\x20gates),\x20tpl_machine_*\x20(forward\x20gates),\x20tpl_reward_*\x20(claim\x20gates).\x20Pass\x20a\x20listed\x20id\x20for\x20the\x20full\x20parameterized\x20disclosure\x20(meaning,\x20default,\x20constraint,\x20importance).']};if(h){const l=writeResponseToFile(k,h);if(l)return{'success':!![],'action':b,'data':null,'message':'Guard\x20template'+(g?'\x20\x27'+g+'\x27':'s')+'\x20written\x20to\x20file:\x20'+l,'output_file_path':l,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+l]};}return{'success':!![],'action':b,'data':k,'message':g?'Retrieved\x20Guard\x20template:\x20'+g:'Retrieved\x20'+(Array['isArray'](k['templates'])?k['templates']['length']:0x0)+'\x20Guard\x20templates'};}if(b==='get_templates'){if(!g){const p=a516a(i),q=getTemplateCounts(),r={'total':p['length'],'filter':i??null,'counts_by_object_type':q,'templates':p};if(h){const s=writeResponseToFile(r,h);if(s)return{'success':!![],'action':b,'data':null,'message':p['length']+'\x20templates\x20written\x20to\x20file:\x20'+s,'output_file_path':s,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+s]};}return{'success':!![],'action':b,'data':r,'message':p['length']+'\x20template(s)'+(i?'\x20for\x20object_type=\x27'+i+'\x27':'')+'\x20'+('(total\x20registry:\x20'+Object['values'](q)['reduce']((t,u)=>t+u,0x0)+'\x20across\x20'+TEMPLATE_OBJECT_TYPES['length']+'\x20object\x20types).\x20')+'Provide\x20\x27template\x27\x20(id)\x20for\x20full\x20detail;\x20add\x20\x27params\x27\x20(JSON\x20string)\x20to\x20instantiate.'};}if(!j){const t=getTemplateDetail(g);if(!t)return{'success':![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20not\x20found\x20in\x20the\x20unified\x20registry.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20template\x20metadata\x20(id\x20+\x20object_type\x20+\x20parameters).','Filter\x20by\x20object_type:\x20'+TEMPLATE_OBJECT_TYPES['join'](',\x20')]};if(h){const u=writeResponseToFile(t,h);if(u)return{'success':!![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20detail\x20written\x20to\x20file:\x20'+u,'output_file_path':u,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+u]};}return{'success':!![],'action':b,'data':t,'message':'Template\x20\x27'+g+'\x27\x20('+t['object_type']+',\x20'+(t['instantiable']?'instantiable':'guidance-only')+').\x20'+'To\x20instantiate,\x20call\x20again\x20with\x20\x27params\x27\x20=\x20JSON\x20object\x20of\x20the\x20declared\x20parameters.'};}let m;try{const v=JSON['parse'](j);if(!v||typeof v!=='object'||Array['isArray'](v))return{'success':![],'action':b,'data':null,'message':'\x27params\x27\x20must\x20be\x20a\x20JSON\x20object\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27),\x20got\x20'+(Array['isArray'](v)?'array':typeof v)+'.'};m=v;}catch(w){return{'success':![],'action':b,'data':null,'message':'Failed\x20to\x20parse\x20\x27params\x27\x20as\x20JSON:\x20'+(w instanceof Error?w['message']:String(w)),'suggestions':['Example:\x20params=\x27{\x22whitelist\x22:[\x220xabc...\x22]}\x27']};}const n=instantiateTemplate(g,m);if(!n['ok'])return{'success':![],'action':b,'data':n['guidance']!==undefined?{'guidance':n['guidance']}:null,'message':'Instantiation\x20failed\x20for\x20\x27'+g+'\x27:\x20'+n['error'],'suggestions':n['missing_params']?['Missing\x20required\x20params:\x20'+n['missing_params']['join'](',\x20'),'Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']:['Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']};const o={'object_type':n['object_type'],'template_id':n['template_id'],'body':n['body'],...n['notes']?{'notes':n['notes']}:{}};if(h){const x=writeResponseToFile(o,h);if(x)return{'success':!![],'action':b,'data':null,'message':'Instantiated\x20template\x20\x27'+g+'\x27\x20written\x20to\x20file:\x20'+x,'output_file_path':x,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+x]};}return{'success':!![],'action':b,'data':o,'message':'Instantiated\x20\x27'+g+'\x27\x20('+n['object_type']+').\x20'+'Review\x20the\x20body\x20against\x20the\x20onchain_operations\x20schema\x20before\x20submitting.'};}if(b==='get_tool_reference'){if(c){const z=getToolReference(c);if(!z)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found\x20in\x20the\x20tool\x20reference.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20all\x20tools.','Available\x20tools:\x20'+TOOLS_REFERENCE['map'](B=>B['name'])['join'](',\x20')]};const A=getToolSequence(c);return{'success':!![],'action':b,'data':{'tool':z,'call_sequence':A??null},'message':'Retrieved\x20tool\x20reference:\x20'+c};}if(d){const B=searchToolReference(d);return{'success':!![],'action':b,'data':{'tools':B,'count':B['length']},'message':'Found\x20'+B['length']+'\x20tool(s)\x20matching\x20\x27'+d+'\x27','suggestions':B['length']===0x0?['Try\x20a\x20broader\x20keyword\x20(e.g.\x20\x27onchain\x27,\x20\x27guard\x27,\x20\x27schema\x27),\x20or\x20omit\x20\x27query\x27\x20to\x20list\x20all\x20tools.']:undefined};}const y=TOOLS_REFERENCE['map'](C=>({'name':C['name'],'summary':C['summary'],'actions':C['actions']??[],'notes':C['notes']??[]}));return{'success':!![],'action':b,'data':{'tools':y,'count':y['length']},'message':'Retrieved\x20reference\x20for\x20'+y['length']+'\x20MCP\x20tools.\x20Pass\x20name=\x27<tool>\x27\x20for\x20full\x20detail\x20(params,\x20prerequisites,\x20follow-ups).'};}if(b==='get_guard_design_patterns'){if(c){const D=getGuardDesignPattern(c);if(!D)return{'success':![],'action':b,'data':null,'message':'Guard\x20design\x20pattern\x20\x27'+c+'\x27\x20not\x20found.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20the\x20full\x20catalog.','Available\x20pattern\x20ids:\x20'+GUARD_DESIGN_PATTERNS['map'](E=>E['id'])['join'](',\x20')]};return{'success':!![],'action':b,'data':{'pattern':D},'message':'Retrieved\x20Guard\x20design\x20pattern:\x20'+c};}if(d){const E=GUARD_DESIGN_PATTERNS['filter'](G=>G['host']===d),F=E['length']>0x0?E:GUARD_DESIGN_PATTERNS['filter'](G=>G['business_requirement']['toLowerCase']()['includes'](d['toLowerCase']())||G['logic_summary']['toLowerCase']()['includes'](d['toLowerCase']()));return{'success':!![],'action':b,'data':{'patterns':F,'count':F['length'],'filtered_by':E['length']>0x0?'host':'keyword','schema_notes':GUARD_SCHEMA_NOTES},'message':'Found\x20'+F['length']+'\x20Guard\x20design\x20pattern(s)\x20matching\x20\x27'+d+'\x27','suggestions':F['length']===0x0?['Filter\x20by\x20host:\x20service_buy_guard,\x20service_allocator_guard,\x20machine_forward,\x20progress_submission,\x20reward_claim,\x20repository_write,\x20arbitration_usage,\x20arbitration_voting,\x20gen_passport']:undefined};}const C=GUARD_DESIGN_PATTERNS['map'](G=>({'id':G['id'],'business_requirement':G['business_requirement'],'host':G['host'],'data_source':G['data_source'],'verifier_level':G['verifier_level'],'logic_summary':G['logic_summary'],'key_queries':G['key_queries'],'notes':G['notes']??[]}));return{'success':!![],'action':b,'data':{'patterns':C,'count':C['length'],'version':GUARD_DESIGN_PATTERNS_VERSION,'schema_notes':GUARD_SCHEMA_NOTES},'message':'Retrieved\x20'+C['length']+'\x20Guard\x20design\x20patterns.\x20Pass\x20name=\x27<pattern_id>\x27\x20for\x20full\x20detail\x20(witness\x20types,\x20mitigated\x20risks,\x20industries).'};}if(b==='get_safety_rules')return{'success':!![],'action':b,'data':{'version':SAFETY_RULES_VERSION,'object_reuse_rules':OBJECT_REUSE_RULES,'create_vs_modify_pattern':CREATE_VS_MODIFY_PATTERN,'immutability_rules':IMMUTABILITY_RULES,'protocol_slot_rules':PROTOCOL_SLOT_RULES,'operation_type_classification':OPERATION_TYPE_CLASSIFICATION,'operation_class_meta':OPERATION_CLASS_META,'naming_conventions':NAMING_CONVENTIONS},'message':'Retrieved\x20safety\x20rule\x20tables\x20(reuse\x20/\x20immutability\x20/\x20protocol\x20slots\x20/\x20operation\x20classification\x20/\x20naming).\x20'+'Key\x20points:\x20prefer\x20REUSING\x20existing\x20objects\x20(string\x20reference\x20=\x20reuse,\x20object\x20shape\x20=\x20create);\x20'+'Machine\x20publish\x20locks\x20nodes/pairs/forwards,\x20Service\x20publish\x20locks\x20machine/order_allocators/arbitrations\x20(sales\x20stays\x20mutable);\x20'+'Guard\x20is\x20CREATE-only\x20immutable;\x20on-chain\x20writes\x20require\x20explicit\x20user\x20confirmation;\x20'+'Guards\x20bound\x20on\x20machine\x20forwards\x20MUST\x20declare\x20protocol\x20slot\x20254\x20(task\x20binding),\x20and\x20every\x20allocator\x20{GuardIdentifier:N}\x20leg\x20MUST\x20name\x20a\x20declared\x20b_submission\x20Address\x20slot.'};if(!areSchemasAvailable())return{'success':![],'action':b,'data':null,'message':'Schema\x20files\x20are\x20not\x20available.\x20Please\x20run\x20\x27npm\x20run\x20generate:schemas\x27\x20first.','suggestions':['Run\x20\x27npm\x20run\x20generate:schemas\x27\x20to\x20generate\x20schema\x20files','Ensure\x20the\x20dist/schemas\x20directory\x20exists']};switch(b){case'list':{const G=listSchemas();return{'success':!![],'action':b,'data':G,'message':'Found\x20'+G['length']+'\x20available\x20schemas'};}case'get':{if(!c)return{'success':![],'action':b,'data':null,'message':'Schema\x20name\x20is\x20required\x20for\x20\x27get\x27\x20action','suggestions':['Provide\x20a\x20schema\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};const H=getSchema(c);if(!H){const J=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20not\x20found','suggestions':J['length']>0x0?J['map'](K=>'Did\x20you\x20mean:\x20'+K['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};}if(h){const K=writeResponseToFile(H,h);if(K)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+K,'output_file_path':K,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+K]};}const I=autoOverflowToFile(H,c);if(I)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](I['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':I['absolute_path'],'inline_summary':I['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+I['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+I['relative_path']+'\x27\x20against\x20the\x20workspace\x20root\x20and\x20read\x20that.','Without\x20file\x20access,\x20query\x20specific\x20fields\x20via\x20action=\x27get_field\x27\x20with\x20name=\x27'+c+'\x27\x20and\x20a\x20field_path\x20from\x20the\x20summary\x20below.']};return{'success':!![],'action':b,'data':H,'message':'Retrieved\x20schema:\x20'+c};}case'get_field':{if(!c||!f)return{'success':![],'action':b,'data':null,'message':'Both\x20\x27name\x27\x20and\x20\x27field_path\x27\x20are\x20required\x20for\x20\x27get_field\x27\x20action','suggestions':['Example:\x20{action:\x20\x27get_field\x27,\x20name:\x20\x27onchain_operations_machine\x27,\x20field_path:\x20\x27data.node\x27}','Use\x20\x27get\x27\x20action\x20to\x20retrieve\x20the\x20full\x20schema']};const L=getSchemaField(c,f);if(!L)return{'success':![],'action':b,'data':null,'message':'Field\x20path\x20\x27'+f+'\x27\x20not\x20found\x20in\x20schema\x20\x27'+c+'\x27','suggestions':['Check\x20the\x20field\x20path\x20(dot-separated,\x20e.g.\x20\x27data.node\x27)','Use\x20\x27get\x27\x20action\x20to\x20see\x20the\x20full\x20schema\x20structure']};return{'success':!![],'action':b,'data':L,'message':'Retrieved\x20field\x20\x27'+f+'\x27\x20from\x20schema\x20\x27'+c+'\x27'};}case'search':{if(!d)return{'success':![],'action':b,'data':null,'message':'Search\x20query\x20is\x20required\x20for\x20\x27search\x27\x20action'};const M=searchSchemas(d);return{'success':!![],'action':b,'data':M,'message':'Found\x20'+M['length']+'\x20schemas\x20matching\x20\x27'+d+'\x27'};}case'list_operations':{const N=listOperations();return{'success':!![],'action':b,'data':N,'message':'Found\x20'+N['length']+'\x20on-chain\x20operations'};}case'get_guard_queries':{const O=d?.['trim']()['toLowerCase'](),P=R=>({'id':R['id'],'name':R['name'],'objectType':ObjectType[R['objectType']]??String(R['objectType']),'returnType':ValueType[R['return']]??String(R['return'])});if(O){const R=GUARDQUERY['filter'](S=>S['name']['toLowerCase']()['includes'](O)||S['description']?.['toLowerCase']()['includes'](O)||String(S['id'])===O)['map'](S=>({...P(S),'description':S['description']}));return{'success':!![],'action':b,'data':R,'message':'Found\x20'+R['length']+'\x20GUARDQUERY\x20entries\x20matching\x20\x27'+d+'\x27\x20'+('(of\x20'+GUARDQUERY['length']+'\x20total).\x20Use\x20names,\x20not\x20numeric\x20ids,\x20in\x20Guard\x20trees\x20—\x20')+'names\x20fail\x20loudly\x20at\x20validation\x20when\x20wrong;\x20a\x20wrong-but-existing\x20id\x20silently\x20checks\x20a\x20different\x20field.'};}if(h){const S=GUARDQUERY['map'](U=>({...P(U),'description':U['description']})),T=writeResponseToFile(S,h);if(T)return{'success':!![],'action':b,'data':null,'message':'Full\x20GUARDQUERY\x20catalog\x20('+S['length']+'\x20entries)\x20written\x20to\x20file:\x20'+T,'output_file_path':T,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+T]};}const Q=GUARDQUERY['map'](P);return{'success':!![],'action':b,'data':Q,'message':'GUARDQUERY\x20catalog:\x20'+Q['length']+'\x20entries\x20(compact\x20form\x20—\x20id,\x20name,\x20objectType,\x20returnType).\x20'+'Add\x20query=\x27<keyword>\x27\x20for\x20full\x20entries\x20with\x20descriptions,\x20or\x20output_file\x20to\x20dump\x20all\x20details\x20to\x20a\x20file.\x20'+'Prefer\x20NAME\x20references\x20in\x20Guard\x20trees;\x20a\x20numeric\x20id\x20is\x20resolved\x20verbatim\x20and\x20a\x20wrong-but-existing\x20id\x20'+'silently\x20checks\x20a\x20different\x20field.'};}case'get_output':{if(!c)return{'success':![],'action':b,'data':null,'message':'Tool\x20name\x20is\x20required\x20for\x20\x27get_output\x27\x20action','suggestions':['Provide\x20a\x20tool\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};const U=getOutputSchema(c);if(!U){const W=listSchemas(),X=W['find'](Z=>Z['name']===c);if(X)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20exists\x20but\x20declares\x20no\x20output\x20schema.','suggestions':['Use\x20\x27get\x27\x20action\x20with\x20name=\x27'+c+'\x27\x20to\x20retrieve\x20its\x20input\x20schema']};const Y=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':Y['length']>0x0?Y['map'](Z=>'Did\x20you\x20mean:\x20'+Z['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const Z=writeResponseToFile(U,h);if(Z)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+Z,'output_file_path':Z,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+Z]};}const V=autoOverflowToFile(U,c);if(V)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](V['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':V['absolute_path'],'inline_summary':V['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+V['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+V['relative_path']+'\x27\x20against\x20the\x20workspace\x20root\x20and\x20read\x20that.','Without\x20file\x20access,\x20query\x20specific\x20fields\x20via\x20action=\x27get_field\x27\x20with\x20name=\x27'+c+'\x27\x20and\x20a\x20field_path\x20from\x20the\x20summary\x20below.']};return{'success':!![],'action':b,'data':U,'message':'Retrieved\x20output\x20schema:\x20'+c};}default:return{'success':![],'action':b,'data':null,'message':'Unknown\x20action:\x20'+b,'suggestions':['Use\x20\x27list\x27,\x20\x27get\x27,\x20\x27get_field\x27,\x20\x27get_output\x27,\x20\x27search\x27,\x20\x27list_operations\x27,\x20\x27get_guard_templates\x27,\x20\x27get_tool_reference\x27,\x20\x27get_guard_design_patterns\x27,\x20\x27get_safety_rules\x27,\x20\x27get_templates\x27,\x20or\x20\x27analyze_guard_semantics\x27']};}}const GUARD_SEMANTICS_READING_CHECKLIST=['WHO\x20can\x20satisfy\x20this\x20Guard\x20(identity:\x20Signer\x20bindings,\x20Entity\x20membership,\x20allowlists)?','WHEN\x20can\x20it\x20be\x20satisfied\x20(time:\x20Clock\x20comparisons,\x20deadlines,\x20windows)?','WHAT\x20evidence\x20must\x20the\x20caller\x20submit\x20(b_submission\x20table\x20entries\x20—\x20Payment/Order/Proof\x20objects)?','WHICH\x20on-chain\x20data\x20does\x20it\x20read,\x20and\x20can\x20that\x20data\x20change\x20(Repository\x20entries\x20are\x20MUTABLE\x20—\x20who\x20controls\x20the\x20writes)?','WHAT\x20does\x20the\x20counterparty\x20gain/lose\x20in\x20each\x20branch\x20of\x20the\x20logic\x20tree?','ARE\x20there\x20error-level\x20diagnostics\x20or\x20critical\x20risks\x20(they\x20block\x20or\x20endanger\x20execution)?'];export async function analyzeGuardSemantics(a){const b=await lintGuard(a,{'auto_fix':![]}),c={'root':a['root'],'table':(a['table']??[])['map'](l=>({'identifier':l['identifier'],'name':l['name'],'value_type':l['value_type']??'Address','b_submission':l['b_submission']??![],'value':l['value']})),'guardName':a['description']??null,'rely':a['rely']??null},d=renderGuardTreeIndented(c),e=renderGuardMermaid(a['root']),f=new Set(),g=[],h=new Set();let i=![],j=![];walkGuardTree(a['root'],l=>{if(l['type']==='context'){if(l['context']==='Clock')i=!![];if(l['context']==='Signer')j=!![];}l['type']==='identifier'&&typeof l['identifier']==='number'&&h['add'](l['identifier']);if(l['type']==='query'){const m=l['object'];m&&typeof m==='object'&&typeof m['identifier']==='number'&&h['add'](m['identifier']);const n=l['parameters'];if(Array['isArray'](n))for(const o of n){o&&typeof o==='object'&&typeof o['identifier']==='number'&&h['add'](o['identifier']);}}if(l['type']==='query'&&l['query']!==undefined&&l['query']!==null){if(typeof l['query']==='number'){const q=getGuardQueryByIdOrName(l['query']);if(q)f['add'](q['id']);else g['push'](l['query']);}else{const r=getGuardQueryByIdOrName(l['query']);if(r)f['add'](r['id']);else g['push'](l['query']);}}});const k={'submission_requirements':(a['table']??[])['filter'](l=>l['b_submission']===!![])['map'](l=>({'identifier':l['identifier'],'value_type':l['value_type'],'object_type':l['object_type'],'name':l['name']})),'data_sources':(a['table']??[])['filter'](l=>l['b_submission']!==!![])['map'](l=>({'identifier':l['identifier'],'kind':l['is_system_address']?'system_address':l['object_type']?'object':'fixed_value','value_type':l['value_type'],'object_type':l['object_type'],'name':l['name'],'is_mutable_onchain':l['object_type']==='Repository'})),'query_dependencies':[...f]['sort']((l,m)=>l-m),'unresolved_queries':g,'unresolved_identifiers':[...h]['filter'](l=>!(a['table']??[])['some'](m=>m['identifier']===l))['sort']((l,m)=>l-m),'has_time_conditions':i,'has_signer_constraints':j,'has_rely_composition':Array['isArray'](a['rely']?.['guards'])&&a['rely']['guards']['length']>0x0,'reading_checklist':GUARD_SEMANTICS_READING_CHECKLIST};return{'render':{'tree_indented':d,'mermaid':e},'lint':b,'party_evaluation':k};}export{formatLintResult};
1
+ import{readFileSync,existsSync,writeFileSync,mkdirSync}from'fs';import{resolve,join,dirname}from'path';import{fileURLToPath}from'url';import{GUARDQUERY,ObjectType,ValueType}from'@wowok/wowok';import{TOOLS_REFERENCE,getToolReference,searchToolReference,getToolSequence}from'../knowledge/tools-reference.js';import{GUARD_DESIGN_PATTERNS,getGuardDesignPattern,GUARD_DESIGN_PATTERNS_VERSION,GUARD_SCHEMA_NOTES}from'../knowledge/guard-design-patterns.js';import{OBJECT_REUSE_RULES,CREATE_VS_MODIFY_PATTERN,IMMUTABILITY_RULES,PROTOCOL_SLOT_RULES,OPERATION_TYPE_CLASSIFICATION,OPERATION_CLASS_META,NAMING_CONVENTIONS,SAFETY_RULES_VERSION}from'../knowledge/safety-rules.js';import{listTemplates as a521a,getTemplateDetail,instantiateTemplate,getTemplateCounts,TEMPLATE_OBJECT_TYPES}from'../knowledge/template-registry.js';import{GUARD_TEMPLATES,GUARD_TEMPLATES_VERSION,GUARD_TEMPLATES_COUNT}from'../knowledge/guard-templates.js';import{lintGuard,formatLintResult}from'../knowledge/guard-lint.js';import{renderGuardTreeIndented,renderGuardMermaid,walkGuardTree}from'../knowledge/guard-render.js';import{getGuardQueryByIdOrName}from'../schema/utils/guard-query-utils.js';const __dirname=fileURLToPath(new URL('.',import.meta.url)),SCHEMA_DIR_PROBES=[...typeof process['env']['WOWOK_SCHEMAS_DIR']==='string'&&process['env']['WOWOK_SCHEMAS_DIR']['length']>0x0?[resolve(process['env']['WOWOK_SCHEMAS_DIR'])]:[],resolve(__dirname,'../../dist/schemas'),resolve(__dirname,'../schemas'),resolve(process['cwd'](),'dist/schemas'),resolve(process['cwd'](),'schemas')],SCHEMAS_DIR=SCHEMA_DIR_PROBES['find'](a=>existsSync(join(a,'index.json')))??SCHEMA_DIR_PROBES[0x0],WORKSPACE_TMP_DIR=resolve(process['cwd'](),'.trae','tmp');export function areSchemasAvailable(){return existsSync(SCHEMAS_DIR)&&existsSync(join(SCHEMAS_DIR,'index.json'));}let schemaIndexCache;export function getSchemaIndex(){if(schemaIndexCache!==undefined)return schemaIndexCache;try{const a=join(SCHEMAS_DIR,'index.json');if(!existsSync(a))return null;const b=readFileSync(a,'utf-8');return schemaIndexCache=JSON['parse'](b),schemaIndexCache;}catch{return null;}}export function listSchemas(){const a=getSchemaIndex();if(!a)return[];return[...a['tools']||[],...a['operations']||[]];}const schemaCache=new Map(),outputSchemaCache=new Map();export function getSchema(a){const b=schemaCache['get'](a);if(b!==undefined)return b;try{let c=join(SCHEMAS_DIR,a+'.schema.json');!existsSync(c)&&(c=join(SCHEMAS_DIR,a+'.json'));if(!existsSync(c))return null;const d=readFileSync(c,'utf-8'),e=JSON['parse'](d),f=resolveSchemaRefs(e);return schemaCache['set'](a,f),f;}catch{return null;}}let outputSchemaResolver=null;export function registerOutputSchemaResolver(a){outputSchemaResolver=a;}export function getOutputSchema(a){const b=outputSchemaCache['get'](a);if(b!==undefined)return b;try{const c=join(SCHEMAS_DIR,a+'.output.json');if(existsSync(c)){const d=readFileSync(c,'utf-8'),e=JSON['parse'](d),f=resolveSchemaRefs(e);return outputSchemaCache['set'](a,f),f;}}catch{}if(!outputSchemaResolver)return null;try{const g=outputSchemaResolver(a);if(!g)return null;const h=resolveSchemaRefs(g);return outputSchemaCache['set'](a,h),h;}catch{return null;}}function guardParamImportance(a){if(!a['required'])return'optional';return a['type']==='address'||a['type']==='vec_address'?'identity-critical':'required';}const GUARD_PARAM_IMPORTANCE_RANK={'identity-critical':0x0,'required':0x1,'optional':0x2};function projectGuardParam(a){return{'name':a['name'],'type':a['type'],'meaning':a['description'],'importance':guardParamImportance(a),'required':a['required'],'default':a['default']??null,'constraint':a['constraint']??null};}function projectGuardTemplate(a){return{'id':a['id'],'scene_id':a['scene_id'],'name':a['name'],'description':a['description'],'verifier_constraint_level':a['verifier_constraint_level']??null,'recommended_patterns':a['recommended_patterns'],'applicable_industries':a['applicable_industries'],'relevant_risks':a['relevant_risks'],'creation_notes':a['creation_notes'],'example_use_case':a['example_use_case'],'parameters':a['parameters']['map'](projectGuardParam)['sort']((c,d)=>GUARD_PARAM_IMPORTANCE_RANK[c['importance']]-GUARD_PARAM_IMPORTANCE_RANK[d['importance']]),'example_table':a['example_table'],'example_root':a['example_root']};}export function getGuardTemplates(a){if(!a)return{'version':GUARD_TEMPLATES_VERSION,'count':GUARD_TEMPLATES_COUNT,'templates':GUARD_TEMPLATES['map'](c=>({'id':c['id'],'scene_id':c['scene_id'],'name':c['name'],'description':c['description'],'verifier_constraint_level':c['verifier_constraint_level']??null,'parameter_count':c['parameters']['length']}))};const b=GUARD_TEMPLATES['find'](c=>c['id']===a||c['name']===a);return b?projectGuardTemplate(b):null;}export function getSchemaField(a,b){const c=getSchema(a);if(!c)return null;const d=b['split']('.')['filter'](Boolean);let e=c;for(const f of d){if(!e||typeof e!=='object')return null;if(e['properties']&&f in e['properties']){e=e['properties'][f];continue;}if(e['items']&&typeof e['items']==='object'){if(/^\d+$/['test'](f)){e=e['items'];continue;}if(e['items']['properties']&&f in e['items']['properties']){e=e['items']['properties'][f];continue;}}if(Array['isArray'](e['oneOf'])||Array['isArray'](e['anyOf'])){const g=e['oneOf']??e['anyOf'];for(const h of g){if(h&&typeof h==='object'&&h['properties']&&f in h['properties']){e=h['properties'][f];break;}}continue;}if(f in e){e=e[f];continue;}return null;}return e;}function resolveSchemaRefs(a,b=new Set()){if(!a||typeof a!=='object')return a;if(Array['isArray'](a))return a['map'](d=>resolveSchemaRefs(d,b));const c={};for(const [d,e]of Object['entries'](a)){if(d==='$ref'&&typeof e==='string'){if(e['startsWith']('#'))c[d]=e;else{const f=loadRefSchema(e,b);f&&Object['assign'](c,resolveSchemaRefs(f,b));}}else typeof e==='object'?c[d]=resolveSchemaRefs(e,b):c[d]=e;}return c;}function loadRefSchema(a,b){if(a['startsWith']('#'))return null;if(b['has'](a))return{'description':'Circular\x20reference\x20to\x20'+a};b['add'](a);try{const c=join(SCHEMAS_DIR,a);if(!existsSync(c))return null;const d=readFileSync(c,'utf-8');return JSON['parse'](d);}catch{return null;}}export function searchSchemas(a){const b=listSchemas(),c=a['toLowerCase']();return b['filter'](d=>{const e=d['name']['toLowerCase']()['includes'](c),f=d['title']?.['toLowerCase']()['includes'](c),g=d['description']?.['toLowerCase']()['includes'](c);return e||f||g;});}export function listOperations(){const a=getSchemaIndex();if(!a)return[];return(a['operations']||[])['filter'](b=>b['name']['startsWith']('onchain_operations_'));}function writeResponseToFile(a,b){try{let c;if(b)c=resolve(process['cwd'](),b);else{!existsSync(WORKSPACE_TMP_DIR)&&mkdirSync(WORKSPACE_TMP_DIR,{'recursive':!![]});const g=Date['now']();c=join(WORKSPACE_TMP_DIR,'schema-'+g+'.json');}const d=dirname(c);!existsSync(d)&&mkdirSync(d,{'recursive':!![]});const f=typeof a==='string'?a:JSON['stringify'](a,null,0x2);return writeFileSync(c,f,'utf-8'),c;}catch(h){return null;}}const INLINE_CHAR_LIMIT=0x20*0x400,AUTO_OVERFLOW_DIR='.wowok/tmp';function unionVariantLabel(a){if(!a||typeof a!=='object')return'variant';const b=a['properties']&&typeof a['properties']==='object'?a['properties']:undefined;if(b)for(const [c,d]of Object['entries'](b)){if(d&&typeof d==='object'&&d['const']!==undefined)return c+'='+String(d['const']);}return typeof a['title']==='string'?a['title']:'variant';}export function buildSchemaSummary(a){const b=[];a&&typeof a['title']==='string'&&b['push']('Title:\x20'+a['title']);const c=a&&typeof a==='object'?a['properties']:undefined;if(c&&typeof c==='object'&&!Array['isArray'](c)){const d=Array['isArray'](a['required'])?a['required']:[],e=Object['keys'](c);b['push']('Top-level\x20fields\x20('+e['length']+',\x20*\x20=\x20required):');for(const f of e['slice'](0x0,0x28)){const g=c[f]??{},h=Array['isArray'](g['type'])?g['type']['join']('|'):g['type']??(g['$ref']?'ref':g['anyOf']||g['oneOf']?'union':'any'),i=d['includes'](f)?'*':'',j=typeof g['description']==='string'&&g['description']['length']>0x0?'\x20—\x20'+g['description']['split']('\x0a')[0x0]['slice'](0x0,0x50):'';b['push']('\x20\x20-\x20'+f+i+':\x20'+h+j);}e['length']>0x28&&b['push']('\x20\x20-\x20...and\x20'+(e['length']-0x28)+'\x20more\x20—\x20use\x20action=\x27get_field\x27\x20with\x20field_path\x20to\x20inspect');}else{if(a&&(Array['isArray'](a['oneOf'])||Array['isArray'](a['anyOf']))){const k=a['oneOf']??a['anyOf'];b['push']('Union\x20of\x20'+k['length']+'\x20variants:');for(const m of k['slice'](0x0,0x28)){const o=m&&typeof m['description']==='string'&&m['description']['length']>0x0?'\x20—\x20'+m['description']['split']('\x0a')[0x0]['slice'](0x0,0x50):'';b['push']('\x20\x20-\x20'+unionVariantLabel(m)+o);}k['length']>0x28&&b['push']('\x20\x20-\x20...and\x20'+(k['length']-0x28)+'\x20more');const l=k['filter'](q=>q&&typeof q==='object'&&q['properties']&&typeof q['properties']==='object');if(l['length']===k['length']&&l['length']>0x0){const q=Object['keys'](l[0x0]['properties'])['filter'](r=>l['every'](s=>Object['prototype']['hasOwnProperty']['call'](s['properties'],r)));b['push'](q['length']>0x0?'Common\x20fields\x20(declared\x20by\x20ALL\x20'+l['length']+'\x20variants):\x20'+q['join'](',\x20')+'.':'No\x20field\x20is\x20declared\x20by\x20all\x20'+l['length']+'\x20variants\x20—\x20each\x20variant\x20takes\x20its\x20own\x20parameters.');}else b['push']('Field\x20names\x20differ\x20per\x20variant\x20—\x20read\x20the\x20variant\x27s\x20own\x20list\x20above.\x20'+'The\x20discriminator\x20(\x22operation\x22\x20and\x20friends)\x20is\x20the\x20only\x20shared\x20key.');for(const r of k['slice'](0x0,0x28)){const s=r&&typeof r==='object'&&r['properties']&&typeof r['properties']==='object'?Object['keys'](r['properties']):[];if(s['length']===0x0)continue;b['push']('\x20\x20\x20\x20'+unionVariantLabel(r)+'\x20fields:\x20'+s['join'](',\x20'));}b['push']('Drill\x20into\x20the\x20variant\x20you\x20need\x20with\x20action=\x27get_field\x27\x20(name\x20+\x20field_path)\x20—\x20the\x20lists\x20above\x20are\x20a\x20summary,\x20not\x20the\x20schema.');}else b['push']('No\x20top-level\x20properties\x20map\x20—\x20use\x20action=\x27get_field\x27\x20with\x20a\x20field_path\x20to\x20inspect\x20this\x20schema.');}return b['join']('\x0a');}export function autoOverflowToFile(a,b){try{const c=JSON['stringify'](a)['length'];if(c<=INLINE_CHAR_LIMIT)return null;const d=process['env']['WOWOK_SCHEMA_TMP_DIR'],e=d?resolve(d):resolve(process['cwd'](),AUTO_OVERFLOW_DIR);!existsSync(e)&&mkdirSync(e,{'recursive':!![]});const f=b['replace'](/[^a-zA-Z0-9_-]/g,'_'),g=f+'.schema.json',h=join(e,g);return writeFileSync(h,JSON['stringify'](a,null,0x2),'utf-8'),{'absolute_path':h,'relative_path':d?h:join(AUTO_OVERFLOW_DIR,g),'bytes':c,'summary':buildSchemaSummary(a)};}catch{return null;}}export function processSchemaQuery(a){const {action:b,name:c,query:d,field_path:f,template:g,output_file:h,object_type:i,params:j}=a;if(b==='get_guard_templates'){const k=getGuardTemplates(g);if(!k)return{'success':![],'action':b,'data':null,'message':'Guard\x20template\x20\x27'+g+'\x27\x20not\x20found\x20in\x20the\x20unified\x20library\x20(v'+GUARD_TEMPLATES_VERSION+').\x20Omit\x20\x27template\x27\x20to\x20list\x20every\x20id.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20guard\x20template\x20ids.','Ids\x20are\x20scene-namespaced\x20—\x20e.g.\x20tpl_buy_guard_*\x20(purchase\x20gates),\x20tpl_machine_*\x20(forward\x20gates),\x20tpl_reward_*\x20(claim\x20gates).\x20Pass\x20a\x20listed\x20id\x20for\x20the\x20full\x20parameterized\x20disclosure\x20(meaning,\x20default,\x20constraint,\x20importance).']};if(h){const l=writeResponseToFile(k,h);if(l)return{'success':!![],'action':b,'data':null,'message':'Guard\x20template'+(g?'\x20\x27'+g+'\x27':'s')+'\x20written\x20to\x20file:\x20'+l,'output_file_path':l,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+l]};}return{'success':!![],'action':b,'data':k,'message':g?'Retrieved\x20Guard\x20template:\x20'+g:'Retrieved\x20'+(Array['isArray'](k['templates'])?k['templates']['length']:0x0)+'\x20Guard\x20templates'};}if(b==='get_templates'){if(!g){const p=a521a(i),q=getTemplateCounts(),r={'total':p['length'],'filter':i??null,'counts_by_object_type':q,'templates':p};if(h){const s=writeResponseToFile(r,h);if(s)return{'success':!![],'action':b,'data':null,'message':p['length']+'\x20templates\x20written\x20to\x20file:\x20'+s,'output_file_path':s,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+s]};}return{'success':!![],'action':b,'data':r,'message':p['length']+'\x20template(s)'+(i?'\x20for\x20object_type=\x27'+i+'\x27':'')+'\x20'+('(total\x20registry:\x20'+Object['values'](q)['reduce']((t,u)=>t+u,0x0)+'\x20across\x20'+TEMPLATE_OBJECT_TYPES['length']+'\x20object\x20types).\x20')+'Provide\x20\x27template\x27\x20(id)\x20for\x20full\x20detail;\x20add\x20\x27params\x27\x20(JSON\x20string)\x20to\x20instantiate.'};}if(!j){const t=getTemplateDetail(g);if(!t)return{'success':![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20not\x20found\x20in\x20the\x20unified\x20registry.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20template\x20metadata\x20(id\x20+\x20object_type\x20+\x20parameters).','Filter\x20by\x20object_type:\x20'+TEMPLATE_OBJECT_TYPES['join'](',\x20')]};if(h){const u=writeResponseToFile(t,h);if(u)return{'success':!![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20detail\x20written\x20to\x20file:\x20'+u,'output_file_path':u,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+u]};}return{'success':!![],'action':b,'data':t,'message':'Template\x20\x27'+g+'\x27\x20('+t['object_type']+',\x20'+(t['instantiable']?'instantiable':'guidance-only')+').\x20'+'To\x20instantiate,\x20call\x20again\x20with\x20\x27params\x27\x20=\x20JSON\x20object\x20of\x20the\x20declared\x20parameters.'};}let m;try{const v=JSON['parse'](j);if(!v||typeof v!=='object'||Array['isArray'](v))return{'success':![],'action':b,'data':null,'message':'\x27params\x27\x20must\x20be\x20a\x20JSON\x20object\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27),\x20got\x20'+(Array['isArray'](v)?'array':typeof v)+'.'};m=v;}catch(w){return{'success':![],'action':b,'data':null,'message':'Failed\x20to\x20parse\x20\x27params\x27\x20as\x20JSON:\x20'+(w instanceof Error?w['message']:String(w)),'suggestions':['Example:\x20params=\x27{\x22whitelist\x22:[\x220xabc...\x22]}\x27']};}const n=instantiateTemplate(g,m);if(!n['ok'])return{'success':![],'action':b,'data':n['guidance']!==undefined?{'guidance':n['guidance']}:null,'message':'Instantiation\x20failed\x20for\x20\x27'+g+'\x27:\x20'+n['error'],'suggestions':n['missing_params']?['Missing\x20required\x20params:\x20'+n['missing_params']['join'](',\x20'),'Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']:['Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']};const o={'object_type':n['object_type'],'template_id':n['template_id'],'body':n['body'],...n['notes']?{'notes':n['notes']}:{}};if(h){const x=writeResponseToFile(o,h);if(x)return{'success':!![],'action':b,'data':null,'message':'Instantiated\x20template\x20\x27'+g+'\x27\x20written\x20to\x20file:\x20'+x,'output_file_path':x,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+x]};}return{'success':!![],'action':b,'data':o,'message':'Instantiated\x20\x27'+g+'\x27\x20('+n['object_type']+').\x20'+'Review\x20the\x20body\x20against\x20the\x20onchain_operations\x20schema\x20before\x20submitting.'};}if(b==='get_tool_reference'){if(c){const z=getToolReference(c);if(!z)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found\x20in\x20the\x20tool\x20reference.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20all\x20tools.','Available\x20tools:\x20'+TOOLS_REFERENCE['map'](B=>B['name'])['join'](',\x20')]};const A=getToolSequence(c);return{'success':!![],'action':b,'data':{'tool':z,'call_sequence':A??null},'message':'Retrieved\x20tool\x20reference:\x20'+c};}if(d){const B=searchToolReference(d);return{'success':!![],'action':b,'data':{'tools':B,'count':B['length']},'message':'Found\x20'+B['length']+'\x20tool(s)\x20matching\x20\x27'+d+'\x27','suggestions':B['length']===0x0?['Try\x20a\x20broader\x20keyword\x20(e.g.\x20\x27onchain\x27,\x20\x27guard\x27,\x20\x27schema\x27),\x20or\x20omit\x20\x27query\x27\x20to\x20list\x20all\x20tools.']:undefined};}const y=TOOLS_REFERENCE['map'](C=>({'name':C['name'],'summary':C['summary'],'actions':C['actions']??[],'notes':C['notes']??[]}));return{'success':!![],'action':b,'data':{'tools':y,'count':y['length']},'message':'Retrieved\x20reference\x20for\x20'+y['length']+'\x20MCP\x20tools.\x20Pass\x20name=\x27<tool>\x27\x20for\x20full\x20detail\x20(params,\x20prerequisites,\x20follow-ups).'};}if(b==='get_guard_design_patterns'){if(c){const D=getGuardDesignPattern(c);if(!D)return{'success':![],'action':b,'data':null,'message':'Guard\x20design\x20pattern\x20\x27'+c+'\x27\x20not\x20found.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20the\x20full\x20catalog.','Available\x20pattern\x20ids:\x20'+GUARD_DESIGN_PATTERNS['map'](E=>E['id'])['join'](',\x20')]};return{'success':!![],'action':b,'data':{'pattern':D},'message':'Retrieved\x20Guard\x20design\x20pattern:\x20'+c};}if(d){const E=GUARD_DESIGN_PATTERNS['filter'](G=>G['host']===d),F=E['length']>0x0?E:GUARD_DESIGN_PATTERNS['filter'](G=>G['business_requirement']['toLowerCase']()['includes'](d['toLowerCase']())||G['logic_summary']['toLowerCase']()['includes'](d['toLowerCase']()));return{'success':!![],'action':b,'data':{'patterns':F,'count':F['length'],'filtered_by':E['length']>0x0?'host':'keyword','schema_notes':GUARD_SCHEMA_NOTES},'message':'Found\x20'+F['length']+'\x20Guard\x20design\x20pattern(s)\x20matching\x20\x27'+d+'\x27','suggestions':F['length']===0x0?['Filter\x20by\x20host:\x20service_buy_guard,\x20service_allocator_guard,\x20machine_forward,\x20progress_submission,\x20reward_claim,\x20repository_write,\x20arbitration_usage,\x20arbitration_voting,\x20gen_passport']:undefined};}const C=GUARD_DESIGN_PATTERNS['map'](G=>({'id':G['id'],'business_requirement':G['business_requirement'],'host':G['host'],'data_source':G['data_source'],'verifier_level':G['verifier_level'],'logic_summary':G['logic_summary'],'key_queries':G['key_queries'],'notes':G['notes']??[]}));return{'success':!![],'action':b,'data':{'patterns':C,'count':C['length'],'version':GUARD_DESIGN_PATTERNS_VERSION,'schema_notes':GUARD_SCHEMA_NOTES},'message':'Retrieved\x20'+C['length']+'\x20Guard\x20design\x20patterns.\x20Pass\x20name=\x27<pattern_id>\x27\x20for\x20full\x20detail\x20(witness\x20types,\x20mitigated\x20risks,\x20industries).'};}if(b==='get_safety_rules')return{'success':!![],'action':b,'data':{'version':SAFETY_RULES_VERSION,'object_reuse_rules':OBJECT_REUSE_RULES,'create_vs_modify_pattern':CREATE_VS_MODIFY_PATTERN,'immutability_rules':IMMUTABILITY_RULES,'protocol_slot_rules':PROTOCOL_SLOT_RULES,'operation_type_classification':OPERATION_TYPE_CLASSIFICATION,'operation_class_meta':OPERATION_CLASS_META,'naming_conventions':NAMING_CONVENTIONS},'message':'Retrieved\x20safety\x20rule\x20tables\x20(reuse\x20/\x20immutability\x20/\x20protocol\x20slots\x20/\x20operation\x20classification\x20/\x20naming).\x20'+'Key\x20points:\x20prefer\x20REUSING\x20existing\x20objects\x20(string\x20reference\x20=\x20reuse,\x20object\x20shape\x20=\x20create);\x20'+'Machine\x20publish\x20locks\x20nodes/pairs/forwards,\x20Service\x20publish\x20locks\x20machine/order_allocators/arbitrations\x20(sales\x20stays\x20mutable);\x20'+'Guard\x20is\x20CREATE-only\x20immutable;\x20on-chain\x20writes\x20require\x20explicit\x20user\x20confirmation;\x20'+'Guards\x20bound\x20on\x20machine\x20forwards\x20MUST\x20declare\x20protocol\x20slot\x20254\x20(task\x20binding),\x20and\x20every\x20allocator\x20{GuardIdentifier:N}\x20leg\x20MUST\x20name\x20a\x20declared\x20b_submission\x20Address\x20slot.'};if(!areSchemasAvailable())return{'success':![],'action':b,'data':null,'message':'Schema\x20files\x20are\x20not\x20available\x20—\x20no\x20probed\x20location\x20holds\x20an\x20index.json.\x20Probed:\x20'+SCHEMA_DIR_PROBES['join']('\x20;\x20')+'.','suggestions':['Run\x20\x27npm\x20run\x20generate:schemas\x27\x20(or\x20\x27npm\x20run\x20build\x27)\x20to\x20generate\x20the\x20schema\x20files','Set\x20WOWOK_SCHEMAS_DIR\x20to\x20the\x20absolute\x20directory\x20that\x20contains\x20index.json\x20and\x20restart\x20the\x20MCP\x20server','Ensure\x20the\x20dist/schemas\x20directory\x20exists\x20next\x20to\x20the\x20server\x27s\x20dist/\x20root']};switch(b){case'list':{const G=listSchemas();return{'success':!![],'action':b,'data':G,'message':'Found\x20'+G['length']+'\x20available\x20schemas'};}case'get':{if(!c)return{'success':![],'action':b,'data':null,'message':'Schema\x20name\x20is\x20required\x20for\x20\x27get\x27\x20action','suggestions':['Provide\x20a\x20schema\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};const H=getSchema(c);if(!H){const J=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20not\x20found','suggestions':J['length']>0x0?J['map'](K=>'Did\x20you\x20mean:\x20'+K['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};}if(h){const K=writeResponseToFile(H,h);if(K)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+K,'output_file_path':K,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+K]};}const I=autoOverflowToFile(H,c);if(I)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](I['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':I['absolute_path'],'inline_summary':I['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+I['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+I['relative_path']+'\x27\x20against\x20the\x20workspace\x20root\x20and\x20read\x20that.','Without\x20file\x20access,\x20query\x20specific\x20fields\x20via\x20action=\x27get_field\x27\x20with\x20name=\x27'+c+'\x27\x20and\x20a\x20field_path\x20from\x20the\x20summary\x20below.']};return{'success':!![],'action':b,'data':H,'message':'Retrieved\x20schema:\x20'+c};}case'get_field':{if(!c||!f)return{'success':![],'action':b,'data':null,'message':'Both\x20\x27name\x27\x20and\x20\x27field_path\x27\x20are\x20required\x20for\x20\x27get_field\x27\x20action','suggestions':['Example:\x20{action:\x20\x27get_field\x27,\x20name:\x20\x27onchain_operations_machine\x27,\x20field_path:\x20\x27data.node\x27}','Use\x20\x27get\x27\x20action\x20to\x20retrieve\x20the\x20full\x20schema']};const L=getSchemaField(c,f);if(!L)return{'success':![],'action':b,'data':null,'message':'Field\x20path\x20\x27'+f+'\x27\x20not\x20found\x20in\x20schema\x20\x27'+c+'\x27','suggestions':['Check\x20the\x20field\x20path\x20(dot-separated,\x20e.g.\x20\x27data.node\x27)','Use\x20\x27get\x27\x20action\x20to\x20see\x20the\x20full\x20schema\x20structure']};return{'success':!![],'action':b,'data':L,'message':'Retrieved\x20field\x20\x27'+f+'\x27\x20from\x20schema\x20\x27'+c+'\x27'};}case'search':{if(!d)return{'success':![],'action':b,'data':null,'message':'Search\x20query\x20is\x20required\x20for\x20\x27search\x27\x20action'};const M=searchSchemas(d);return{'success':!![],'action':b,'data':M,'message':'Found\x20'+M['length']+'\x20schemas\x20matching\x20\x27'+d+'\x27'};}case'list_operations':{const N=listOperations();return{'success':!![],'action':b,'data':N,'message':'Found\x20'+N['length']+'\x20on-chain\x20operations'};}case'get_guard_queries':{const O=d?.['trim']()['toLowerCase'](),P=R=>({'id':R['id'],'name':R['name'],'objectType':ObjectType[R['objectType']]??String(R['objectType']),'returnType':ValueType[R['return']]??String(R['return'])});if(O){const R=GUARDQUERY['filter'](S=>S['name']['toLowerCase']()['includes'](O)||S['description']?.['toLowerCase']()['includes'](O)||String(S['id'])===O)['map'](S=>({...P(S),'description':S['description']}));return{'success':!![],'action':b,'data':R,'message':'Found\x20'+R['length']+'\x20GUARDQUERY\x20entries\x20matching\x20\x27'+d+'\x27\x20'+('(of\x20'+GUARDQUERY['length']+'\x20total).\x20Use\x20names,\x20not\x20numeric\x20ids,\x20in\x20Guard\x20trees\x20—\x20')+'names\x20fail\x20loudly\x20at\x20validation\x20when\x20wrong;\x20a\x20wrong-but-existing\x20id\x20silently\x20checks\x20a\x20different\x20field.'};}if(h){const S=GUARDQUERY['map'](U=>({...P(U),'description':U['description']})),T=writeResponseToFile(S,h);if(T)return{'success':!![],'action':b,'data':null,'message':'Full\x20GUARDQUERY\x20catalog\x20('+S['length']+'\x20entries)\x20written\x20to\x20file:\x20'+T,'output_file_path':T,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+T]};}const Q=GUARDQUERY['map'](P);return{'success':!![],'action':b,'data':Q,'message':'GUARDQUERY\x20catalog:\x20'+Q['length']+'\x20entries\x20(compact\x20form\x20—\x20id,\x20name,\x20objectType,\x20returnType).\x20'+'Add\x20query=\x27<keyword>\x27\x20for\x20full\x20entries\x20with\x20descriptions,\x20or\x20output_file\x20to\x20dump\x20all\x20details\x20to\x20a\x20file.\x20'+'Prefer\x20NAME\x20references\x20in\x20Guard\x20trees;\x20a\x20numeric\x20id\x20is\x20resolved\x20verbatim\x20and\x20a\x20wrong-but-existing\x20id\x20'+'silently\x20checks\x20a\x20different\x20field.'};}case'get_output':{if(!c)return{'success':![],'action':b,'data':null,'message':'Tool\x20name\x20is\x20required\x20for\x20\x27get_output\x27\x20action','suggestions':['Provide\x20a\x20tool\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};const U=getOutputSchema(c);if(!U){const W=listSchemas(),X=W['find'](Z=>Z['name']===c);if(X)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20exists\x20but\x20declares\x20no\x20output\x20schema.','suggestions':['Use\x20\x27get\x27\x20action\x20with\x20name=\x27'+c+'\x27\x20to\x20retrieve\x20its\x20input\x20schema']};const Y=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':Y['length']>0x0?Y['map'](Z=>'Did\x20you\x20mean:\x20'+Z['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const Z=writeResponseToFile(U,h);if(Z)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+Z,'output_file_path':Z,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+Z]};}const V=autoOverflowToFile(U,c);if(V)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](V['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':V['absolute_path'],'inline_summary':V['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+V['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+V['relative_path']+'\x27\x20against\x20the\x20workspace\x20root\x20and\x20read\x20that.','Without\x20file\x20access,\x20query\x20specific\x20fields\x20via\x20action=\x27get_field\x27\x20with\x20name=\x27'+c+'\x27\x20and\x20a\x20field_path\x20from\x20the\x20summary\x20below.']};return{'success':!![],'action':b,'data':U,'message':'Retrieved\x20output\x20schema:\x20'+c};}default:return{'success':![],'action':b,'data':null,'message':'Unknown\x20action:\x20'+b,'suggestions':['Use\x20\x27list\x27,\x20\x27get\x27,\x20\x27get_field\x27,\x20\x27get_output\x27,\x20\x27search\x27,\x20\x27list_operations\x27,\x20\x27get_guard_templates\x27,\x20\x27get_tool_reference\x27,\x20\x27get_guard_design_patterns\x27,\x20\x27get_safety_rules\x27,\x20\x27get_templates\x27,\x20or\x20\x27analyze_guard_semantics\x27']};}}const GUARD_SEMANTICS_READING_CHECKLIST=['WHO\x20can\x20satisfy\x20this\x20Guard\x20(identity:\x20Signer\x20bindings,\x20Entity\x20membership,\x20allowlists)?','WHEN\x20can\x20it\x20be\x20satisfied\x20(time:\x20Clock\x20comparisons,\x20deadlines,\x20windows)?','WHAT\x20evidence\x20must\x20the\x20caller\x20submit\x20(b_submission\x20table\x20entries\x20—\x20Payment/Order/Proof\x20objects)?','WHICH\x20on-chain\x20data\x20does\x20it\x20read,\x20and\x20can\x20that\x20data\x20change\x20(Repository\x20entries\x20are\x20MUTABLE\x20—\x20who\x20controls\x20the\x20writes)?','WHAT\x20does\x20the\x20counterparty\x20gain/lose\x20in\x20each\x20branch\x20of\x20the\x20logic\x20tree?','ARE\x20there\x20error-level\x20diagnostics\x20or\x20critical\x20risks\x20(they\x20block\x20or\x20endanger\x20execution)?'];export async function analyzeGuardSemantics(a){const b=await lintGuard(a,{'auto_fix':![]}),c={'root':a['root'],'table':(a['table']??[])['map'](l=>({'identifier':l['identifier'],'name':l['name'],'value_type':l['value_type']??'Address','b_submission':l['b_submission']??![],'value':l['value']})),'guardName':a['description']??null,'rely':a['rely']??null},d=renderGuardTreeIndented(c),e=renderGuardMermaid(a['root']),f=new Set(),g=[],h=new Set();let i=![],j=![];walkGuardTree(a['root'],l=>{if(l['type']==='context'){if(l['context']==='Clock')i=!![];if(l['context']==='Signer')j=!![];}l['type']==='identifier'&&typeof l['identifier']==='number'&&h['add'](l['identifier']);if(l['type']==='query'){const m=l['object'];m&&typeof m==='object'&&typeof m['identifier']==='number'&&h['add'](m['identifier']);const n=l['parameters'];if(Array['isArray'](n))for(const o of n){o&&typeof o==='object'&&typeof o['identifier']==='number'&&h['add'](o['identifier']);}}if(l['type']==='query'&&l['query']!==undefined&&l['query']!==null){if(typeof l['query']==='number'){const q=getGuardQueryByIdOrName(l['query']);if(q)f['add'](q['id']);else g['push'](l['query']);}else{const r=getGuardQueryByIdOrName(l['query']);if(r)f['add'](r['id']);else g['push'](l['query']);}}});const k={'submission_requirements':(a['table']??[])['filter'](l=>l['b_submission']===!![])['map'](l=>({'identifier':l['identifier'],'value_type':l['value_type'],'object_type':l['object_type'],'name':l['name']})),'data_sources':(a['table']??[])['filter'](l=>l['b_submission']!==!![])['map'](l=>({'identifier':l['identifier'],'kind':l['is_system_address']?'system_address':l['object_type']?'object':'fixed_value','value_type':l['value_type'],'object_type':l['object_type'],'name':l['name'],'is_mutable_onchain':l['object_type']==='Repository'})),'query_dependencies':[...f]['sort']((l,m)=>l-m),'unresolved_queries':g,'unresolved_identifiers':[...h]['filter'](l=>!(a['table']??[])['some'](m=>m['identifier']===l))['sort']((l,m)=>l-m),'has_time_conditions':i,'has_signer_constraints':j,'has_rely_composition':Array['isArray'](a['rely']?.['guards'])&&a['rely']['guards']['length']>0x0,'reading_checklist':GUARD_SEMANTICS_READING_CHECKLIST};return{'render':{'tree_indented':d,'mermaid':e},'lint':b,'party_evaluation':k};}export{formatLintResult};
@@ -1 +1 @@
1
- {"$schema":"http://json-schema.org/draft-07/schema#","$id":"https://wowok.net/schemas/benchmark_migration_operation.json","title":"Template Migration - Industry Templates & Competitor Migration","description":"MD industry-archetype templates (hot-loaded from .wowok/templates/, 30 built-in archetypes across 10 industries), pre-deploy risk scan, and one-click competitor migration. Actions: template_list (list loaded templates, optional industry filter), template_get (full template by template_id), template_generate (creation plan from a template via the merchant-guide pipeline; scan-first, CRITICAL blocks; never on-chain), template_scan (pre-deploy risk scan of one template; CRITICAL blocks generation/apply), plan_execute (one-click deployment: materialize the plan returned by template_generate — plan required; resumes a failed run with completed_steps/previous_outputs instead of re-running from scratch), migration_import (competitor URL/description -> MigrationLog with mapped/unmapped/manual_review entries), migration_review (surface the MigrationLog for user confirmation), migration_apply (run the approved template through the merchant-guide pipeline; scan-first, CRITICAL blocks; default network testnet).","type":"object","properties":{"action":{"type":"string","enum":["template_list","template_get","template_generate","template_scan","migration_import","migration_review","migration_apply","plan_execute"],"description":"Action: 'template_list' = list the loaded MD industry templates (optional industry filter); 'template_get' = fetch one template by id (template_id required); 'template_generate' = generate a creation plan from a template via the merchant-guide pipeline (template_id required; scan-first — CRITICAL findings block; never executes on-chain); 'template_scan' = pre-deploy risk scan of one template (template_id required; returns risk_level/findings/red_flags plus a drift face — disk-vs-catalog provenance of the scanned body; CRITICAL blocks generation/apply); 'migration_import' = competitor URL/description → migration plan + MigrationLog (description required); 'migration_review' = surface the MigrationLog for user confirmation (log required); 'migration_apply' = run the approved template through the merchant-guide pipeline (template_id required; scan-first — CRITICAL findings block; default network testnet); 'plan_execute' = ONE-CLICK DEPLOYMENT (AR-5, bsn7 T-06/R-01): materialize the plan returned by template_generate on-chain — preflight freeze gate, topological create/publish/configure, readback. Resumable: on a mid-run failure, re-send with completed_steps + previous_outputs from the failed response instead of re-running from scratch (duplicate objects)."},"template_id":{"description":"Template id '<industry>/<variant>' (required for template_get / template_generate / template_scan / migration_apply), e.g. 'retail/scale-marketplace'.","type":"string"},"industry":{"description":"Industry filter for template_list; industry hint for migration_import. Any registered industry is accepted (builtin: crowdfunding, delivery, education, freelance, group_buy, licensing, rental, retail, subscription, travel; plus custom industries registered via industry packs). Aliases are resolved (e.g. 'ecommerce' → 'retail').","type":"string"},"description":{"description":"Natural-language business/competitor description (required for migration_import; used by template_generate as the intent text).","type":"string"},"semantic_ir":{"description":"Canonical Semantic IR produced by the CALLING agent for a NON-ENGLISH (or lexicon-outside) description — this server runs no LLM. The server validates it, then reuses it on the same deterministic surfaces as recommend_industry: (a) migration_import narrows template matching to the IR-resolved industry and, when discovery.tags are supplied, selects the business-model VARIANT by canonical tag coverage (an explicit product_ref or 'industry' hint still wins); (b) template_generate / migration_apply read the numeric claim 'reward_pool_amount' as the review-reward pool prefill — explicit fee_overrides > IR claim > the English regex fallback. Shape: {schema_version: 2 (1 still accepted), locale: '<BCP-47>', traits?, domains?, claims?: [{key, value, confidence?}], discovery?: {industry?, tags?: string[], product_ref?, english_summary?, confidence?}, provenance: {source: 'caller_llm'}}. discovery.tags use the CLOSED language-neutral vocabulary returned by template_list.discovery_vocabulary (canonical English business-model tokens; never locale words — translate in the caller). discovery.product_ref is a benchmark-product slug, discovery.industry a registered industry, and discovery.english_summary is a canonical English restatement used only for keyword fallback. Unknown traits/domains/claims/tags/industries/product_refs are dropped and reported in semantic_ir_issues; spans and quotes must be copied verbatim from the description (unlocatable evidence is dropped).","type":"object","properties":{"schema_version":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2}]},"locale":{"type":"string","minLength":2,"maxLength":35},"traits":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"trait":{"type":"string","maxLength":64},"value":{"anyOf":[{"type":"boolean"},{"type":"string","maxLength":32}]},"confidence":{"type":"number"},"span":{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":9007199254740991},"end":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["start","end"],"additionalProperties":false},"quote":{"type":"string","maxLength":300}},"required":["trait","value","confidence"],"additionalProperties":false}},"domains":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"domain":{"type":"string","maxLength":64},"confidence":{"type":"number"},"span":{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":9007199254740991},"end":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["start","end"],"additionalProperties":false},"quote":{"type":"string","maxLength":300}},"required":["domain"],"additionalProperties":false}},"claims":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","maxLength":64},"value":{"type":"number"},"confidence":{"type":"number"},"span":{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":9007199254740991},"end":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["start","end"],"additionalProperties":false},"quote":{"type":"string","maxLength":300}},"required":["key","value"],"additionalProperties":false}},"discovery":{"type":"object","properties":{"industry":{"type":"string","maxLength":64},"tags":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":64}},"product_ref":{"type":"string","maxLength":64},"english_summary":{"type":"string","maxLength":600},"confidence":{"type":"number"}},"additionalProperties":false},"provenance":{"type":"object","properties":{"source":{"type":"string","enum":["caller_llm","human"]},"model":{"type":"string","maxLength":120},"prompt_version":{"type":"string","maxLength":60},"generated_at":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["source"],"additionalProperties":false}},"required":["schema_version","locale","provenance"],"additionalProperties":false},"url":{"description":"Competitor store/profile URL for migration_import (recorded as provenance only).","type":"string"},"fee_overrides":{"description":"Template fee-parameter overrides for template_generate (e.g. commission_rate_bps).","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"number"},{"type":"string"}]}},"guard_resolutions":{"description":"Judgment-layer resolutions for pending guard designs (C6-DEEP), keyed by plan.pending_guard_designs[].key. A blocked migration_apply/template_generate lists every unresolved design — resolve each here (kind 'inline' with the Guard table+root, or kind 'template' with a tpl_* id) and re-run the action. Advisory designs that do not apply to this shop may be resolved with {kind:'omit'} instead (run75747 F-38: honored only for designs with no inbound binding; an omit of a bound design is refused with GUARD_OMIT_UNSUPPORTED). The audit freeze gate still decides: resolutions only unblock a plan whose closed audit is clean.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"template"},"template_id":{"type":"string","description":"A 'tpl_*' guard template id to fill (template fee_params + params feed the fill)."},"params":{"description":"Extra fill params over the merged fee_params.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["kind","template_id"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"inline"},"description":{"description":"Guard description (defaults to the pending design's purpose).","type":"string"},"table":{"minItems":1,"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"description":"Guard passport table rows (identifier/b_submission/value_type/...)."},"root":{"type":"object","properties":{"type":{"type":"string"}},"required":["type"],"additionalProperties":{},"description":"Guard logic root node (a typed tree node)."}},"required":["kind","table","root"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"omit"}},"required":["kind"],"additionalProperties":false}]}},"review_mode":{"description":"Per-build review-rail mode (v53 templates). Absent = the template's declared review_mode applies.","type":"string","enum":["review","review_reward","none"]},"reward_funding":{"description":"Review reward pool funding, smallest-unit string. HARD-REQUIRED when the effective review mode is review_reward (INV-4): template_generate refuses the build up-front with error_code 'reward_funding_required' rather than promising an unfunded incentive — pass this, or drop the mode explicitly (review_mode 'review' keeps the rail without the bounty; 'none' removes the rail). The compile kernel also blocks with REVIEW_REWARD_UNFUNDED — this input gate just fails before the pipeline runs.","type":"string"},"reward_claim_amount":{"description":"Per-claim reward bounty mounted on the claim guard_add, smallest-unit string. Schema-required on the mount (BK15-F09): compile blocks with REVIEW_REWARD_AMOUNT_MISSING when absent — the kernel never fabricates a real-money parameter.","type":"string"},"experience_compensation_mode":{"description":"Per-build goodwill (experience-compensation) track mode (K3 C-11). Absent = the template's declared experience_compensation_mode applies — delivery/on-demand-errand and delivery/restaurant-marketplace ship 'reward' as the catalog default. 'reward' arms an independent PRE-FUNDED Reward pool buyers claim proactively for late/SLA-miss failures (nothing is ever deducted from the merchant — the chain has no debit primitive); 'none' drops the track.","type":"string","enum":["reward","none"]},"experience_pool_funding":{"description":"Experience-compensation pool funding, smallest-unit string. HARD-REQUIRED when the effective experience_compensation_mode is 'reward' (K3 C-11, INV-4 family): template_generate refuses the build up-front rather than promising an unfunded goodwill pool — plan it as ~expected failures x fee_param experience_claim_amount. The compile kernel also blocks with EXPERIENCE_COMPENSATION_UNFUNDED — this input gate just fails before the pipeline runs. (N2, K4R-261103 / ssd F-01: this key is a COMPILE INPUT, never a fee_param — a value mis-passed via fee_overrides is auto-rescued to this channel and echoed.)","type":"string"},"price_rebate_mode":{"description":"Per-build price-rebate track mode (stage2 #1 P-11). Absent = the template's declared price_rebate_mode applies (delivery/restaurant-marketplace ships 'reward'). 'reward' arms an independent PRE-FUNDED rebate pool for the overcharge/mispricing remedy; 'none' drops the track. Set 'none' to build without the rebate budget.","type":"string","enum":["reward","none"]},"price_rebate_pool_funding":{"description":"Price-rebate pool funding, smallest-unit string. HARD-REQUIRED when the effective price_rebate_mode is 'reward' — the compile kernel blocks with PRICE_REBATE_UNFUNDED otherwise. Plan it as ~expected rebates x fee_param price_rebate_claim_amount. COMPILE INPUT, never a fee_param — pass it here, not via fee_overrides.","type":"string"},"compensation_fund":{"description":"Arbitration compensation-pool funding, smallest-unit string (N1, K4R-261103 / ddmq F-22). HARD-REQUIRED on any build that mounts an arb-ruling-won edge (tpl_forward_arb_ruling_won): its claimed_by sequencing seal makes the award claim the enforcement step, and an unfunded claim aborts code 27 — compile blocks with COMPENSATION_FUND_REQUIRED. Plan it at >= 3x a typical order (the chain's award ceiling is MAX_INDEMNITY_MULTIPLE = 3x the order value basis). Compile INPUT, never a fee_param; the fee_overrides spelling also lands here via the inputs spread.","type":"string"},"after_sales_mode":{"description":"Per-build after-sales mode (D12 refactor 4). Absent = the template's declared after_sales_mode applies. Declaring a mode with no backing rail in machine_shape is a compile blocker (AFTER_SALES_RAIL_MISSING).","type":"string","enum":["return","exchange","warranty","none"]},"acceptance_mode":{"description":"Per-build acceptance/judging mode (D12 refactor 2). Absent = the template's declared acceptance_mode applies. A judge-decided mode (contest/bounty/agent) without arbitration_mode 'third_party' is a compile blocker (ACCEPTANCE_JUDGE_NOT_INDEPENDENT); a finite revision_rounds_max with no counter Repository guard is a compile blocker (ACCEPTANCE_REVISION_UNBOUNDED).","type":"string","enum":["milestone","contest","bounty","agent","none"]},"installment_mode":{"description":"Per-build installment/deposit mode (D12 refactor 3). Absent = the template's declared installment_mode applies. A capture forward with no fund-gate Guard is a compile blocker (INSTALLMENT_FUNDING_UNGATED); a deposit-held state with no exit rail is a compile blocker (INSTALLMENT_DEPOSIT_STRANDED).","type":"string","enum":["deposit_balance","milestone_n","none"]},"affiliate_mode":{"description":"Per-build affiliate commission overlay (D12 batch 5). Absent = the template's declared affiliate_mode applies. A declared commission overlay with no commission rail is a compile blocker (AFFILIATE_RAIL_MISSING); a commission with no post-lock no-clawback disclosure build_note is a compile blocker (AFFILIATE_CLAWBACK_UNDISCLOSED).","type":"string","enum":["commission","none"]},"crowdfunding_mode":{"description":"Per-build crowdfunding campaign overlay (D12 batch 7). Absent = the template's declared crowdfunding_mode applies. A declared threshold/flexible overlay with no two-leg escrow-exit gate (release XOR refund, D-BUG-2) is a compile blocker (CROWDFUNDING_THRESHOLD_GATE_MISSING); a threshold gate whose aggregate is NOT a writer-bound sum-where (id_from signer) is a compile blocker (CROWDFUNDING_AGGREGATE_UNBOUND); a missing L-04/L-01/L-05 disclosure build_note is a compile blocker (CROWDFUNDING_DISCLOSURE_MISSING).","type":"string","enum":["threshold","flexible","none"]},"logistics_mode":{"description":"Per-build fulfillment topology (K3 batch C, K-2). Absent = the template's declared logistics_mode applies. A declared topology the machine_shape cannot honor is a compile blocker: courier with no named_operator handover rail (LOGISTICS_COURIER_RAIL_MISSING) or a pooled delivery fee (LOGISTICS_COURIER_FEE_POOLED); pickup_point without the absolute batch cutoff or the unclaimed-goods exit window (LOGISTICS_PICKUP_CUTOFF_MISSING); carrier without tracking evidence (LOGISTICS_CARRIER_EVIDENCE_MISSING); any physical mode without a transit-loss story (LOGISTICS_TRANSIT_LOSS_UNCOVERED); courier/pickup_point without the two dispatch disclosures (LOGISTICS_DISPATCH_UNDISCLOSED).","type":"string","enum":["none","carrier","merchant_managed","courier","pickup_point"]},"sales":{"description":"The sellable SKU catalog (upwc-cat-261017 CAT-A1 / PLAN-SALES-01). REQUIRED for template_generate (A-2, amz9-ln-261023): an empty/absent catalog is refused up-front with error_code 'sales_required' — the published Service would freeze with sales: [] and every order_new aborts; PLAN-SALES-01 is now an INPUT error on this action, not a post-hoc audit finding. migration_apply keeps the audit-finding posture (it confirms an already-reviewed import). Item shape follows the chain's SaleItem: { name, price, quantity?, wip_hash? } with price in smallest units. OPTIONAL per item: a structured `incentive` object (G-07: { amount, conditions, basis, claim_window }, all strings) declaring the buyer-perceivable reward terms — carried verbatim into the compiled plan's service_sales step for quote-time disclosure; it is plan metadata only and never an on-chain SaleItem field.","type":"array","items":{"type":"object","properties":{"incentive":{"type":"object","properties":{"amount":{"type":"string","description":"Incentive amount as a buyer-readable string (e.g. \"5 USDC\" or \"1000000000 WOW smallest units\"). Quote-time disclosure only — fund the actual rail separately (e.g. the template's review_reward_pool)."},"conditions":{"type":"string","description":"What the buyer must do to earn it (e.g. \"leave a written + rated review of the delivered work\"). Must be perceptible BEFORE the order is placed."},"basis":{"type":"string","description":"Accrual scope: \"per-order\" / \"once-per-buyer\" / \"once-per-buyer-per-order\". Matches the claim guard's replay semantics — a recipient-only gate is once-per-buyer-for-life, an order-scoped stamp is per-order (SV-2)."},"claim_window":{"type":"string","description":"How long the buyer has to claim (e.g. \"14 days from the review\"). Mirror the reward claim guard's window fee_param so the quote never promises more than the rail pays."}},"required":["amount","conditions","basis","claim_window"],"additionalProperties":false,"description":"Optional structured incentive for one sale item (G-07): buyer-perceivable reward terms carried to the compiled plan for quote-time disclosure. DECLARATION ONLY — the chain SaleItem has no such field; the actual payout rail is configured separately."}},"additionalProperties":{},"description":"One sellable SKU in the plan catalog: the chain SaleItem fields plus the optional structured `incentive` declaration (G-07). Unknown keys pass through so chain-side fields can evolve without schema changes."}},"allow_unpinned_wip":{"description":"Explicit risk acceptance (F-07, 2026-11-04): ship SKUs whose .wip detail file carries NO hash pin. template_generate REFUSES an unpinned catalog by default (CRITICAL input gap — the SDK aborts a sale configure whose wip is empty, and an unpinned SKU gives buyers no delivery-integrity guarantee). Preferred cures: pass per-SKU wip_hash (from the wip_file generate/upload/verify flow — the session ledger backfills it automatically when THIS process uploaded or verified the file), or declare product_detail_source so the kernel resolves the sources. Set true ONLY after the user explicitly accepts an unpinned catalog; the wip_anchor face in the response is then marked acknowledged:true instead of blocking.","type":"boolean"},"allow_external_wip_host":{"description":"Explicit risk acceptance (ruling 2, ss10-mn-261109-ujydea / F-SS10-07): ship a sales row whose wip is NOT a public https URL under store.wowok.net (a local path, http://, a data: URL, or a foreign host). template_generate REFUSES such rows by default with '[wip_hosting_required]' — buyers fetch the wip at order time, so an unhosted URI is unreachable evidence and order_new aborts for them. Preferred cure: wip_file generate+upload (the returned store.wowok.net URL is backfilled automatically). Set true ONLY after the user explicitly accepts the unhosted wip (e.g. a sanctioned self-hosting flow); the refusal does not re-grade — plan_execute still runs the hosting-discipline faces.","type":"boolean"},"log":{"description":"A prior MigrationLog (required for migration_review).","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"network":{"description":"Target network for migration_import / migration_apply (default testnet; mainnet requires explicit user confirmation; 'localnet' is a provenance label for locally validated plans — the pipeline never executes on-chain).","type":"string","enum":["testnet","mainnet","localnet"]},"plan":{"description":"The creation plan to execute (required for plan_execute): pass the object returned under 'plan' by template_generate VERBATIM — mutating steps by hand is what the 32-manual-write era did. Alternatively pass {root:'file', path:'<plan.json>'} to read the plan from disk (HAR-P1-14: avoids echoing a 38-40-step plan through the tool-call arguments; the file must contain the plan envelope or the bare plan as JSON). Executing requires verdict.buildable=true; a blocked plan is refused at the freeze gate.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"completed_steps":{"description":"plan_execute resume (AR-5): step ids already EXECUTED in a prior run. Those steps are adopted, not re-executed. A run that did not complete returns a ready-to-pass `resume` payload (completed_steps/previous_outputs) — pass it back verbatim instead of deriving the lists by hand.","type":"array","items":{"type":"string"}},"previous_outputs":{"description":"plan_execute resume (AR-5): step id -> created on-chain address map from the prior run's outputs field, so $ref bindings resolve against the objects that ALREADY exist.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"resume_from_step":{"description":"plan_execute resume (W5-08): the FIRST step to (re-)execute — every step BEFORE it in plan order is adopted from previous_outputs. Lighter than enumerating completed_steps: pass the first step whose status is NOT 'executed' in the failed response, plus previous_outputs. Unknown ids are refused — the resume channel binds to the COMPLETE plan, never to one slice's step list.","type":"string"},"retry_override":{"description":"plan_execute (W5-08): authorizes ONE more round for a step that failed with the IDENTICAL error in 2+ consecutive rounds (a further unchanged re-run is refused pre-execution). The note is mandatory and audit-trailed.","type":"object","properties":{"step_id":{"type":"string","minLength":1,"description":"The step named in the RETRY_LOCKED refusal (the repeated-failure guard's lock)."},"note":{"type":"string","minLength":1,"description":"Why one more round is justified — mandatory, echoed into the response as retry_override_applied for audit."}},"required":["step_id","note"],"additionalProperties":false},"override_stale_build":{"description":"plan_execute (O-F49): the ONLY bypass for the verdict hard gate. The gate refuses execution when the plan carries verdict.buildable:false or the running build state is UNVERIFIED (stale_build — the dist lags the workspace src). Pass true ONLY to consciously accept that risk; the override is audited into the response as verdict_override. Prefer rebuilding (pnpm build in the mcp workspace) and re-running template_generate.","type":"boolean"},"arbitration_vote_policy":{"description":"Compile-time voting-surface choice (O-F26, TRIAGE-261109 item D roster-first): 'party_panel' SKIPS the constant-true injection and binds a roster/party voting guard (tpl_voting_guard_party_only / tpl_voting_guard_numeric_weight) — the prescribed posture for commercial venues; 'open' (one-click default) keeps the kernel's constant Bool-true open-vote injection for third_party venues (any Passport holder may vote), is scanner-red-flagged, and publishes ONLY through the ack path (materialize carries arbitration_open_vote_ack for plans that configure voting_guard; identity-less guards bound outside a plan BLOCK publish).","type":"string","enum":["open","party_panel"]},"reward_claim_opens_after_days":{"description":"Reward-window knob (TPL-04, ptrn8-mn-261108): when the reward claim window is EXPLICITLY given, the kernel derives the claim-open moment from it (it always beats the sales-window-derived default of max(14, after-sales+1) days). Only meaningful for review_reward templates; integer days.","type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"reward_claim_closes_after_days":{"description":"Reward-window knob (TPL-04, ptrn8-mn-261108): explicit claim-window span in days (beats the default 14-day span). Bound to the reward guard's closes_after_days via the fee-param bindings.","type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"reward_rating_floor":{"description":"Reward-eligibility knob (TPL-04, ptrn8-mn-261108): explicit minimum rating for a reward claim (beats the template default, e.g. 4). Rides the reward guard's rating_floor leg.","type":"integer","minimum":1,"maximum":5},"env":{"description":"Environment for on-chain execution (plan_execute): forwarded to the executor (e.g. { network: 'testnet' }).","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"accounts":{"description":"Per-step signing accounts (BSW-F04): named envs for steps that declare an `account` (currently 'arb_controller' — the independent third-party Arbitration controller, E_ARBITRATION_PERMISSION_CONFLICT=33). e.g. { arb_controller: { network: 'testnet' } }. A step declaring an account missing from this map FAILS — the default signer is never silently reused for an account-bound step.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"timeout_ms":{"description":"plan_execute wall-clock budget for the WHOLE run (ktt4 RT-08): set it BELOW your transport timeout when the plan is too big for one window (~50 steps x ~6s each). The budget is checked BEFORE each step — a step is never interrupted mid-flight — and an exhausted budget stops the run CLEANLY, returning the partial steps/outputs that resume directly (re-send with completed_steps = every stepId whose status is 'executed', previous_outputs = outputs). Omit to run to completion (subject to your transport timeout).","type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["action"],"additionalProperties":false}
1
+ {"$schema":"http://json-schema.org/draft-07/schema#","$id":"https://wowok.net/schemas/benchmark_migration_operation.json","title":"Template Migration - Industry Templates & Competitor Migration","description":"MD industry-archetype templates (hot-loaded from .wowok/templates/, 30 built-in archetypes across 10 industries), pre-deploy risk scan, and one-click competitor migration. Actions: template_list (list loaded templates, optional industry filter), template_get (full template by template_id), template_generate (creation plan from a template via the merchant-guide pipeline; scan-first, CRITICAL blocks; never on-chain), template_scan (pre-deploy risk scan of one template; CRITICAL blocks generation/apply), plan_execute (one-click deployment: materialize the plan returned by template_generate — plan required; resumes a failed run with completed_steps/previous_outputs instead of re-running from scratch), migration_import (competitor URL/description -> MigrationLog with mapped/unmapped/manual_review entries), migration_review (surface the MigrationLog for user confirmation), migration_apply (run the approved template through the merchant-guide pipeline; scan-first, CRITICAL blocks; default network testnet).","type":"object","properties":{"action":{"type":"string","enum":["template_list","template_get","template_generate","template_scan","migration_import","migration_review","migration_apply","plan_execute","plan_status"],"description":"Action: 'template_list' = list the loaded MD industry templates (optional industry filter); 'template_get' = fetch one template by id (template_id required); 'template_generate' = generate a creation plan from a template via the merchant-guide pipeline (template_id required; scan-first — CRITICAL findings block; never executes on-chain); 'template_scan' = pre-deploy risk scan of one template (template_id required; returns risk_level/findings/red_flags plus a drift face — disk-vs-catalog provenance of the scanned body; CRITICAL blocks generation/apply); 'migration_import' = competitor URL/description → migration plan + MigrationLog (description required); 'migration_review' = surface the MigrationLog for user confirmation (log required); 'migration_apply' = run the approved template through the merchant-guide pipeline (template_id required; scan-first — CRITICAL findings block; default network testnet); 'plan_execute' = ONE-CLICK DEPLOYMENT (AR-5, bsn7 T-06/R-01): materialize the plan returned by template_generate on-chain — preflight freeze gate, topological create/publish/configure, readback. Resumable: on a mid-run failure, re-send with completed_steps + previous_outputs from the failed response instead of re-running from scratch (duplicate objects). A re-issued IDENTICAL plan AUTO-RESUMES from its durable per-step checkpoint (D-④) — adopted steps are never re-executed; 'plan_status' = query a durable run WITHOUT re-running (run_id required; or pass plan to find its latest unfinished run; no args = list recent runs)."},"run_id":{"description":"Durable-run id for action='plan_status' (D-④): the plan_execute response's durable_run.run_id. Without run_id, passing `plan` resolves that plan's LATEST unfinished run; with neither, the response lists the most recent runs.","type":"string"},"template_id":{"description":"Template id '<industry>/<variant>' (required for template_get / template_generate / template_scan / migration_apply), e.g. 'retail/scale-marketplace'.","type":"string"},"industry":{"description":"Industry filter for template_list; industry hint for migration_import. Any registered industry is accepted (builtin: crowdfunding, delivery, education, freelance, group_buy, licensing, rental, retail, subscription, travel; plus custom industries registered via industry packs). Aliases are resolved (e.g. 'ecommerce' → 'retail').","type":"string"},"description":{"description":"Natural-language business/competitor description (required for migration_import; used by template_generate as the intent text).","type":"string"},"semantic_ir":{"description":"Canonical Semantic IR produced by the CALLING agent for a NON-ENGLISH (or lexicon-outside) description — this server runs no LLM. The server validates it, then reuses it on the same deterministic surfaces as recommend_industry: (a) migration_import narrows template matching to the IR-resolved industry and, when discovery.tags are supplied, selects the business-model VARIANT by canonical tag coverage (an explicit product_ref or 'industry' hint still wins); (b) template_generate / migration_apply read the numeric claim 'reward_pool_amount' as the review-reward pool prefill — explicit fee_overrides > IR claim > the English regex fallback. Shape: {schema_version: 2 (1 still accepted), locale: '<BCP-47>', traits?, domains?, claims?: [{key, value, confidence?}], discovery?: {industry?, tags?: string[], product_ref?, english_summary?, confidence?}, provenance: {source: 'caller_llm'}}. discovery.tags use the CLOSED language-neutral vocabulary returned by template_list.discovery_vocabulary (canonical English business-model tokens; never locale words — translate in the caller). discovery.product_ref is a benchmark-product slug, discovery.industry a registered industry, and discovery.english_summary is a canonical English restatement used only for keyword fallback. Unknown traits/domains/claims/tags/industries/product_refs are dropped and reported in semantic_ir_issues; spans and quotes must be copied verbatim from the description (unlocatable evidence is dropped).","type":"object","properties":{"schema_version":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2}]},"locale":{"type":"string","minLength":2,"maxLength":35},"traits":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"trait":{"type":"string","maxLength":64},"value":{"anyOf":[{"type":"boolean"},{"type":"string","maxLength":32}]},"confidence":{"type":"number"},"span":{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":9007199254740991},"end":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["start","end"],"additionalProperties":false},"quote":{"type":"string","maxLength":300}},"required":["trait","value","confidence"],"additionalProperties":false}},"domains":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"domain":{"type":"string","maxLength":64},"confidence":{"type":"number"},"span":{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":9007199254740991},"end":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["start","end"],"additionalProperties":false},"quote":{"type":"string","maxLength":300}},"required":["domain"],"additionalProperties":false}},"claims":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","maxLength":64},"value":{"type":"number"},"confidence":{"type":"number"},"span":{"type":"object","properties":{"start":{"type":"integer","minimum":0,"maximum":9007199254740991},"end":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["start","end"],"additionalProperties":false},"quote":{"type":"string","maxLength":300}},"required":["key","value"],"additionalProperties":false}},"discovery":{"type":"object","properties":{"industry":{"type":"string","maxLength":64},"tags":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":64}},"product_ref":{"type":"string","maxLength":64},"english_summary":{"type":"string","maxLength":600},"confidence":{"type":"number"}},"additionalProperties":false},"provenance":{"type":"object","properties":{"source":{"type":"string","enum":["caller_llm","human"]},"model":{"type":"string","maxLength":120},"prompt_version":{"type":"string","maxLength":60},"generated_at":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["source"],"additionalProperties":false}},"required":["schema_version","locale","provenance"],"additionalProperties":false},"url":{"description":"Competitor store/profile URL for migration_import (recorded as provenance only).","type":"string"},"fee_overrides":{"description":"Template fee-parameter overrides for template_generate (e.g. commission_rate_bps). Object values are JSON-stringified at the boundary (product_detail_source accepts a literal object).","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"number"},{"type":"string"}]}},"guard_resolutions":{"description":"Judgment-layer resolutions for pending guard designs (C6-DEEP), keyed by plan.pending_guard_designs[].key. A blocked migration_apply/template_generate lists every unresolved design — resolve each here (kind 'inline' with the Guard table+root, or kind 'template' with a tpl_* id) and re-run the action. Advisory designs that do not apply to this shop may be resolved with {kind:'omit'} instead (run75747 F-38: honored only for designs with no inbound binding; an omit of a bound design is refused with GUARD_OMIT_UNSUPPORTED). The audit freeze gate still decides: resolutions only unblock a plan whose closed audit is clean.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"template"},"template_id":{"type":"string","description":"A 'tpl_*' guard template id to fill (template fee_params + params feed the fill)."},"params":{"description":"Extra fill params over the merged fee_params.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["kind","template_id"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"inline"},"description":{"description":"Guard description (defaults to the pending design's purpose).","type":"string"},"table":{"minItems":1,"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"description":"Guard passport table rows (identifier/b_submission/value_type/...)."},"root":{"type":"object","properties":{"type":{"type":"string"}},"required":["type"],"additionalProperties":{},"description":"Guard logic root node (a typed tree node)."}},"required":["kind","table","root"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"omit"}},"required":["kind"],"additionalProperties":false}]}},"clause_dispositions":{"description":"Clause-ledger dispositions (user-ruling B): mark a PENDING clause as not_applicable with your stated reason (keyed by the ledger entry key echoed by migration_review / a refused migration_apply), e.g. { \"fact:sales-tax-vat-handling\": { disposition: \"not_applicable\", reason: \"buyer-side obligation, out of scope\" } }. Unknown keys or terminal-state keys are REFUSED (fail-loud). Implemented entries resolve by declaring the build mode/override the entry names instead — no mark needed.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"disposition":{"type":"string","const":"not_applicable"},"reason":{"type":"string","minLength":1}},"required":["disposition","reason"],"additionalProperties":false}},"staff_addresses":{"description":"Merchant staff/writer addresses (0x…). DUAL LANDING at generation: (1) pre-fills the evidence-write allowlist (allowed_writers), clearing the WRITER_ACCOUNT_ADDRESS fail-loud sentinel in the SAME call; (2) arms the kernel's F-19 permission grants — each address joins the used machine permission rails (arb ruling-execution rails deliberately excluded) so keeper/customer-service duties work on the first tap instead of aborting E_PERMISSION_DENIED. Malformed (non-0x) entries block the compile (STAFF_ADDRESS_INVALID) rather than being silently skipped. Beats the sentinel default; an explicit guard_resolutions/params override still wins.","type":"array","items":{"type":"string"}},"arb_executors":{"description":"Independent arbitration-executor addresses (0x…). Arms the kernel input arb_executors: each address is granted the tpl_forward_arb_* ruling-execution permission rails at deploy (P0-3), so a won/dismissed ruling is executable at first tap WITHOUT merchant-staff involvement. Keep this roster INDEPENDENT of the merchant's own addresses — the deploy signer stays armed as a fallback; a conflicted grant silently self-deals rulings (the chain refuses arb-vs-Service Permission collisions, E_ARBITRATION_PERMISSION_CONFLICT, not conflicted executors), leaving the venue untrustworthy. Malformed (non-0x) entries block the compile (STAFF_ADDRESS_INVALID) rather than being silently skipped.","type":"array","items":{"type":"string"}},"arb_panel":{"description":"Arbitration voting-panel addresses (0x…) for a third_party venue. THREE landings at generation: (1) injects tpl_voting_guard_party_only with this roster as the party_panel vec (absent an explicit tpl_voting_guard_* design) and FLIPS the default arbitration_vote_policy to party_panel — a venue that names its voters is closed by construction; (2) grants permission index 358 (the vote domain) on the arb Permission to the same roster at deploy, so panel votes pass BOTH layers on the first tap; (3) disclosed at publish. Keep the roster INDEPENDENT of the merchant's own addresses. Malformed (non-0x) entries block the compile (STAFF_ADDRESS_INVALID).","type":"array","items":{"type":"string"}},"review_mode":{"description":"Per-build review-rail mode (v53 templates). Absent = the template's declared review_mode applies.","type":"string","enum":["review","review_reward","none"]},"reward_funding":{"description":"Review reward pool funding, smallest-unit string. HARD-REQUIRED when the effective review mode is review_reward (INV-4): template_generate refuses the build up-front with error_code 'reward_funding_required' rather than promising an unfunded incentive — pass this, or drop the mode explicitly (review_mode 'review' keeps the rail without the bounty; 'none' removes the rail). The compile kernel also blocks with REVIEW_REWARD_UNFUNDED — this input gate just fails before the pipeline runs.","type":"string"},"reward_claim_amount":{"description":"Per-claim reward bounty mounted on the claim guard_add, smallest-unit string. Schema-required on the mount (BK15-F09): compile blocks with REVIEW_REWARD_AMOUNT_MISSING when absent — the kernel never fabricates a real-money parameter.","type":"string"},"experience_compensation_mode":{"description":"Per-build goodwill (experience-compensation) track mode (K3 C-11). Absent = the template's declared experience_compensation_mode applies — delivery/on-demand-errand and delivery/restaurant-marketplace ship 'reward' as the catalog default. 'reward' arms an independent PRE-FUNDED Reward pool buyers claim proactively for late/SLA-miss failures (nothing is ever deducted from the merchant — the chain has no debit primitive); 'none' drops the track.","type":"string","enum":["reward","none"]},"experience_pool_funding":{"description":"Experience-compensation pool funding, smallest-unit string. HARD-REQUIRED when the effective experience_compensation_mode is 'reward' (K3 C-11, INV-4 family): template_generate refuses the build up-front rather than promising an unfunded goodwill pool — plan it as ~expected failures x fee_param experience_claim_amount. The compile kernel also blocks with EXPERIENCE_COMPENSATION_UNFUNDED — this input gate just fails before the pipeline runs. (N2, K4R-261103 / ssd F-01: this key is a COMPILE INPUT, never a fee_param — a value mis-passed via fee_overrides is auto-rescued to this channel and echoed.)","type":"string"},"price_rebate_mode":{"description":"Per-build price-rebate track mode (stage2 #1 P-11). Absent = the template's declared price_rebate_mode applies (delivery/restaurant-marketplace ships 'reward'). 'reward' arms an independent PRE-FUNDED rebate pool for the overcharge/mispricing remedy; 'none' drops the track. Set 'none' to build without the rebate budget.","type":"string","enum":["reward","none"]},"price_rebate_pool_funding":{"description":"Price-rebate pool funding, smallest-unit string. HARD-REQUIRED when the effective price_rebate_mode is 'reward' — the compile kernel blocks with PRICE_REBATE_UNFUNDED otherwise. Plan it as ~expected rebates x fee_param price_rebate_claim_amount. COMPILE INPUT, never a fee_param — pass it here, not via fee_overrides.","type":"string"},"compensation_fund":{"description":"Arbitration compensation-pool funding, smallest-unit string (N1, K4R-261103 / ddmq F-22). HARD-REQUIRED on any build that mounts an arb-ruling-won edge (tpl_forward_arb_ruling_won): its claimed_by sequencing seal makes the award claim the enforcement step, and an unfunded claim aborts code 27 — compile blocks with COMPENSATION_FUND_REQUIRED. Plan it at >= 3x a typical order (the chain's award ceiling is MAX_INDEMNITY_MULTIPLE = 3x the order value basis). Compile INPUT, never a fee_param; the fee_overrides spelling also lands here via the inputs spread.","type":"string"},"after_sales_mode":{"description":"Per-build after-sales mode (D12 refactor 4). Absent = the template's declared after_sales_mode applies. Declaring a mode with no backing rail in machine_shape is a compile blocker (AFTER_SALES_RAIL_MISSING).","type":"string","enum":["return","exchange","warranty","none"]},"acceptance_mode":{"description":"Per-build acceptance/judging mode (D12 refactor 2). Absent = the template's declared acceptance_mode applies. A judge-decided mode (contest/bounty/agent) without arbitration_mode 'third_party' is a compile blocker (ACCEPTANCE_JUDGE_NOT_INDEPENDENT); a finite revision_rounds_max with no counter Repository guard is a compile blocker (ACCEPTANCE_REVISION_UNBOUNDED).","type":"string","enum":["milestone","contest","bounty","agent","none"]},"installment_mode":{"description":"Per-build installment/deposit mode (D12 refactor 3). Absent = the template's declared installment_mode applies. A capture forward with no fund-gate Guard is a compile blocker (INSTALLMENT_FUNDING_UNGATED); a deposit-held state with no exit rail is a compile blocker (INSTALLMENT_DEPOSIT_STRANDED).","type":"string","enum":["deposit_balance","milestone_n","none"]},"affiliate_mode":{"description":"Per-build affiliate commission overlay (D12 batch 5). Absent = the template's declared affiliate_mode applies. A declared commission overlay with no commission rail is a compile blocker (AFFILIATE_RAIL_MISSING); a commission with no post-lock no-clawback disclosure build_note is a compile blocker (AFFILIATE_CLAWBACK_UNDISCLOSED).","type":"string","enum":["commission","none"]},"crowdfunding_mode":{"description":"Per-build crowdfunding campaign overlay (D12 batch 7). Absent = the template's declared crowdfunding_mode applies. A declared threshold/flexible overlay with no two-leg escrow-exit gate (release XOR refund, D-BUG-2) is a compile blocker (CROWDFUNDING_THRESHOLD_GATE_MISSING); a threshold gate whose aggregate is NOT a writer-bound sum-where (id_from signer) is a compile blocker (CROWDFUNDING_AGGREGATE_UNBOUND); a missing L-04/L-01/L-05 disclosure build_note is a compile blocker (CROWDFUNDING_DISCLOSURE_MISSING).","type":"string","enum":["threshold","flexible","none"]},"logistics_mode":{"description":"Per-build fulfillment topology (K3 batch C, K-2). Absent = the template's declared logistics_mode applies. A declared topology the machine_shape cannot honor is a compile blocker: courier with no named_operator handover rail (LOGISTICS_COURIER_RAIL_MISSING) or a pooled delivery fee (LOGISTICS_COURIER_FEE_POOLED); pickup_point without the absolute batch cutoff or the unclaimed-goods exit window (LOGISTICS_PICKUP_CUTOFF_MISSING); carrier without tracking evidence (LOGISTICS_CARRIER_EVIDENCE_MISSING); any physical mode without a transit-loss story (LOGISTICS_TRANSIT_LOSS_UNCOVERED); courier/pickup_point without the two dispatch disclosures (LOGISTICS_DISPATCH_UNDISCLOSED).","type":"string","enum":["none","carrier","merchant_managed","courier","pickup_point"]},"sales":{"description":"The sellable SKU catalog (upwc-cat-261017 CAT-A1 / PLAN-SALES-01). REQUIRED for template_generate (A-2, amz9-ln-261023): an empty/absent catalog is refused up-front with error_code 'sales_required' — the published Service would freeze with sales: [] and every order_new aborts; PLAN-SALES-01 is now an INPUT error on this action, not a post-hoc audit finding. migration_apply keeps the audit-finding posture (it confirms an already-reviewed import). Item shape follows the chain's SaleItem: { name, price, quantity?, wip_hash? } with price in smallest units. OPTIONAL per item: a structured `incentive` object (G-07: { amount, conditions, basis, claim_window }, all strings) declaring the buyer-perceivable reward terms — carried verbatim into the compiled plan's service_sales step for quote-time disclosure; it is plan metadata only and never an on-chain SaleItem field.","type":"array","items":{"type":"object","properties":{"incentive":{"type":"object","properties":{"amount":{"type":"string","description":"Incentive amount as a buyer-readable string (e.g. \"5 USDC\" or \"1000000000 WOW smallest units\"). Quote-time disclosure only — fund the actual rail separately (e.g. the template's review_reward_pool)."},"conditions":{"type":"string","description":"What the buyer must do to earn it (e.g. \"leave a written + rated review of the delivered work\"). Must be perceptible BEFORE the order is placed."},"basis":{"type":"string","description":"Accrual scope: \"per-order\" / \"once-per-buyer\" / \"once-per-buyer-per-order\". Matches the claim guard's replay semantics — a recipient-only gate is once-per-buyer-for-life, an order-scoped stamp is per-order (SV-2)."},"claim_window":{"type":"string","description":"How long the buyer has to claim (e.g. \"14 days from the review\"). Mirror the reward claim guard's window fee_param so the quote never promises more than the rail pays."}},"required":["amount","conditions","basis","claim_window"],"additionalProperties":false,"description":"Optional structured incentive for one sale item (G-07): buyer-perceivable reward terms carried to the compiled plan for quote-time disclosure. DECLARATION ONLY — the chain SaleItem has no such field; the actual payout rail is configured separately."}},"additionalProperties":{},"description":"One sellable SKU in the plan catalog: the chain SaleItem fields plus the optional structured `incentive` declaration (G-07). Unknown keys pass through so chain-side fields can evolve without schema changes."}},"allow_unpinned_wip":{"description":"Explicit risk acceptance (F-07, 2026-11-04): ship SKUs whose .wip detail file carries NO hash pin. template_generate REFUSES an unpinned catalog by default (CRITICAL input gap — the SDK aborts a sale configure whose wip is empty, and an unpinned SKU gives buyers no delivery-integrity guarantee). Preferred cures: pass per-SKU wip_hash (from the wip_file generate/upload/verify flow — the session ledger backfills it automatically when THIS process uploaded or verified the file), or declare product_detail_source so the kernel resolves the sources. Set true ONLY after the user explicitly accepts an unpinned catalog; the wip_anchor face in the response is then marked acknowledged:true instead of blocking.","type":"boolean"},"allow_external_wip_host":{"description":"Explicit risk acceptance (ruling 2, ss10-mn-261109-ujydea / F-SS10-07): ship a sales row whose wip is NOT a public https URL under store.wowok.net (a local path, http://, a data: URL, or a foreign host). template_generate REFUSES such rows by default with '[wip_hosting_required]' — buyers fetch the wip at order time, so an unhosted URI is unreachable evidence and order_new aborts for them. Preferred cure: wip_file generate+upload (the returned store.wowok.net URL is backfilled automatically). Set true ONLY after the user explicitly accepts the unhosted wip (e.g. a sanctioned self-hosting flow); the refusal does not re-grade — plan_execute still runs the hosting-discipline faces.","type":"boolean"},"log":{"description":"A prior MigrationLog (required for migration_review).","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"network":{"description":"Target network for migration_import / migration_apply (default testnet; mainnet requires explicit user confirmation; 'localnet' is a provenance label for locally validated plans — the pipeline never executes on-chain).","type":"string","enum":["testnet","mainnet","localnet"]},"plan":{"description":"The creation plan to execute (required for plan_execute): pass the object returned under 'plan' by template_generate VERBATIM — mutating steps by hand is what the 32-manual-write era did. Alternatively pass {root:'file', path:'<plan.json>'} to read the plan from disk (HAR-P1-14: avoids echoing a 38-40-step plan through the tool-call arguments; the file must contain the plan envelope or the bare plan as JSON). Executing requires verdict.buildable=true; a blocked plan is refused at the freeze gate.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"completed_steps":{"description":"plan_execute resume (AR-5): step ids already EXECUTED in a prior run. Those steps are adopted, not re-executed. A run that did not complete returns a ready-to-pass `resume` payload (completed_steps/previous_outputs) — pass it back verbatim instead of deriving the lists by hand.","type":"array","items":{"type":"string"}},"previous_outputs":{"description":"plan_execute resume (AR-5): step id -> created on-chain address map from the prior run's outputs field, so $ref bindings resolve against the objects that ALREADY exist.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"resume_from_step":{"description":"plan_execute resume (W5-08): the FIRST step to (re-)execute — every step BEFORE it in plan order is adopted from previous_outputs. Lighter than enumerating completed_steps: pass the first step whose status is NOT 'executed' in the failed response, plus previous_outputs. Unknown ids are refused — the resume channel binds to the COMPLETE plan, never to one slice's step list.","type":"string"},"retry_override":{"description":"plan_execute (W5-08): authorizes ONE more round for a step that failed with the IDENTICAL error in 2+ consecutive rounds (a further unchanged re-run is refused pre-execution). The note is mandatory and audit-trailed.","type":"object","properties":{"step_id":{"type":"string","minLength":1,"description":"The step named in the RETRY_LOCKED refusal (the repeated-failure guard's lock)."},"note":{"type":"string","minLength":1,"description":"Why one more round is justified — mandatory, echoed into the response as retry_override_applied for audit."}},"required":["step_id","note"],"additionalProperties":false},"override_stale_build":{"description":"plan_execute (O-F49): the ONLY bypass for the verdict hard gate. The gate refuses execution when the plan carries verdict.buildable:false or the running build state is UNVERIFIED (stale_build — the dist lags the workspace src). Pass true ONLY to consciously accept that risk; the override is audited into the response as verdict_override. Prefer rebuilding (pnpm build in the mcp workspace) and re-running template_generate.","type":"boolean"},"arbitration_vote_policy":{"description":"Compile-time voting-surface choice (O-F26, TRIAGE-261109 item D roster-first): 'party_panel' SKIPS the constant-true injection and binds a roster/party voting guard (tpl_voting_guard_party_only / tpl_voting_guard_numeric_weight) — the prescribed posture for commercial venues; 'open' (one-click default) keeps the kernel's constant Bool-true open-vote injection for third_party venues (any Passport holder may vote), is scanner-red-flagged, and publishes ONLY through the ack path (materialize carries arbitration_open_vote_ack for plans that configure voting_guard; identity-less guards bound outside a plan BLOCK publish).","type":"string","enum":["open","party_panel"]},"reward_claim_opens_after_days":{"description":"Reward-window knob (TPL-04, ptrn8-mn-261108; fractional-day amendment R-TIME-LOCAL-CONST 2026-11-11): when the reward claim window is EXPLICITLY given, the kernel derives the claim-open moment from it (it always beats the sales-window-derived default of max(14, after-sales+1) days). Only meaningful for review_reward templates. Fractional days ARE legal — the compile-time fold converts the value to ONE millisecond constant (0.006944 days ≈ 10 min); whole-day-only was the WINDOW-TRUNCATION-ZERO root cause class and is no longer enforced.","type":"number","exclusiveMinimum":0},"reward_opens_policy":{"description":"Reward-window OPENING policy (F-22 card 1, user ruling 2026-11-11): 'after_sales_close' (default) derives the claim-open AFTER the store's after-sales window closed, floored at 14 days (tbs7 F-04 claim-and-return anti-arbitrage; the test profile folds the floor to one test minute — it is a production economic control, not a reachability one). 'after_review' opens the bounty AT the review entry — review pays immediately; it REQUIRES the rating credential leg (reward_rating_floor >= 1, S14 default 4) and the merchant accepts the claim-and-return arbitrage exposure by declaration. An explicit reward_claim_opens_after_days/_ms answer beats either policy.","type":"string","enum":["after_sales_close","after_review"]},"reward_claim_closes_after_days":{"description":"Reward-window knob (TPL-04, ptrn8-mn-261108; fractional-day amendment R-TIME-LOCAL-CONST 2026-11-11): explicit claim-window span in days (beats the default 14-day span). Bound to the reward guard's closes_after_days via the fee-param bindings. Fractional days ARE legal — the compile-time fold converts the value to ONE millisecond constant (0.006944 days ≈ 10 min).","type":"number","exclusiveMinimum":0},"reward_claim_opens_after_ms":{"description":"Millisecond spelling of the reward claim OPEN leg (R-TIME-LOCAL-CONST 2026-11-11): REPLACES reward_claim_opens_after_days when given — one window, one length, ms wins over days. Use this for sub-day windows on mainnet (e.g. 300000 = 5 min). Must pair with reward_claim_closes_after_ms.","type":"number","exclusiveMinimum":0},"reward_claim_closes_after_ms":{"description":"Millisecond spelling of the reward claim window SPAN (R-TIME-LOCAL-CONST 2026-11-11): REPLACES reward_claim_closes_after_days when given (e.g. 2400000 = 40 min). Must pair with reward_claim_opens_after_ms.","type":"number","exclusiveMinimum":0},"reward_rating_floor":{"description":"Reward-eligibility knob (TPL-04, ptrn8-mn-261108): explicit minimum rating for a reward claim (beats the template default, e.g. 4). Rides the reward guard's rating_floor leg.","type":"integer","minimum":1,"maximum":5},"env":{"description":"Environment for on-chain execution (plan_execute): forwarded to the executor (e.g. { network: 'testnet' }).","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"accounts":{"description":"Per-step signing accounts (BSW-F04): named envs for steps that declare an `account` (currently 'arb_controller' — the independent third-party Arbitration controller, E_ARBITRATION_PERMISSION_CONFLICT=33). e.g. { arb_controller: { network: 'testnet' } }. The map or any entry may be a JSON-encoded string (coerced at the boundary). A step declaring an account missing from this map FAILS — the default signer is never silently reused for an account-bound step.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"acknowledge_third_party_payees":{"description":"plan_execute payee-ownership acknowledgment (A4①, ddmc3 F-D3-01): every Entity settlement recipient must resolve to an account registered on this device, or be listed here as an INTENDED third-party payee (mark name or 0x address — e.g. an arbitrator, collaborator or platform share). Unlisted recipients at foreign addresses REFUSE the run (the ddmc3 shape: a settlement leg resolved to another session's account and 100% of the proceeds paid a stranger — order_allocators freezes at Service publish, so a wrong payee is unfixable on-chain). The acknowledgment is audited into the response as payee_ownership.acknowledged_third_party.","type":"array","items":{"type":"string"}},"timeout_ms":{"description":"plan_execute wall-clock budget for the WHOLE run (ktt4 RT-08): set it BELOW your transport timeout when the plan is too big for one window (~50 steps x ~6s each). The budget is checked BEFORE each step — a step is never interrupted mid-flight — and an exhausted budget stops the run CLEANLY, returning the partial steps/outputs that resume directly (re-send with completed_steps = every stepId whose status is 'executed', previous_outputs = outputs). Omit to run to completion (subject to your transport timeout).","type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["action"],"additionalProperties":false}