@wowok/agent-mcp 3.1.7 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/config/exposure.d.ts +10 -10
  2. package/dist/config/judgment.d.ts +25 -25
  3. package/dist/config/rule-engine.d.ts +25 -25
  4. package/dist/customer/user-preferences.d.ts +2 -2
  5. package/dist/evaluation/arbitration-game.js +1 -1
  6. package/dist/evaluation/capability.d.ts +1 -1
  7. package/dist/evaluation/extract.js +1 -1
  8. package/dist/evaluation/match-operation.js +1 -1
  9. package/dist/extensions/industry-pack.d.ts +3 -2
  10. package/dist/extensions/industry-pack.js +1 -1
  11. package/dist/extensions/modes.js +1 -1
  12. package/dist/extensions/registry.js +1 -1
  13. package/dist/extensions/types.d.ts +1 -0
  14. package/dist/graph/onchain/analyze.js +1 -1
  15. package/dist/graph/onchain/analyze.spec.js +1 -1
  16. package/dist/graph/onchain/edge-schema.js +1 -1
  17. package/dist/graph/onchain/extract.js +1 -1
  18. package/dist/graph/onchain/field-manifest.js +1 -1
  19. package/dist/graph/onchain/project-relationship.js +1 -1
  20. package/dist/graph/onchain/types.d.ts +1 -1
  21. package/dist/harness/recover.js +1 -1
  22. package/dist/keeper/KeeperScan.d.ts +2 -1
  23. package/dist/keeper/KeeperScan.js +1 -1
  24. package/dist/keeper/detectors.d.ts +9 -0
  25. package/dist/keeper/detectors.js +1 -1
  26. package/dist/keeper/keeper.spec.js +1 -1
  27. package/dist/keeper/types.d.ts +1 -1
  28. package/dist/keeper/types.js +1 -1
  29. package/dist/knowledge/allocation-ledger.d.ts +4 -1
  30. package/dist/knowledge/allocation-ledger.js +1 -1
  31. package/dist/knowledge/allocation-puzzle.d.ts +2 -0
  32. package/dist/knowledge/allocation-puzzle.js +1 -1
  33. package/dist/knowledge/allocation-risk.d.ts +1 -1
  34. package/dist/knowledge/allocation-risk.js +1 -1
  35. package/dist/knowledge/arb-risk.d.ts +3 -1
  36. package/dist/knowledge/arb-risk.js +1 -1
  37. package/dist/knowledge/arbitration-ledger.js +1 -1
  38. package/dist/knowledge/arbitration-risk.js +1 -1
  39. package/dist/knowledge/arbitration-templates.d.ts +1 -0
  40. package/dist/knowledge/arbitration-templates.js +1 -1
  41. package/dist/knowledge/audit-rules.d.ts +13 -2
  42. package/dist/knowledge/audit-rules.js +1 -1
  43. package/dist/knowledge/baselines/rules/allocation.json +50 -1
  44. package/dist/knowledge/baselines/rules/arb.json +20 -1
  45. package/dist/knowledge/baselines/rules/arbitration.json +27 -0
  46. package/dist/knowledge/baselines/rules/guard.json +75 -2
  47. package/dist/knowledge/baselines/rules/machine.json +38 -13
  48. package/dist/knowledge/baselines/rules/order.json +2 -2
  49. package/dist/knowledge/builtin-templates.d.ts +3 -1
  50. package/dist/knowledge/builtin-templates.js +1 -1
  51. package/dist/knowledge/event-semantics.js +1 -1
  52. package/dist/knowledge/fund-layer.js +1 -1
  53. package/dist/knowledge/getting-started.js +1 -1
  54. package/dist/knowledge/guard-anchor-reach.d.ts +19 -0
  55. package/dist/knowledge/guard-anchor-reach.js +1 -0
  56. package/dist/knowledge/guard-bindings.js +1 -1
  57. package/dist/knowledge/guard-design-patterns.d.ts +1 -1
  58. package/dist/knowledge/guard-design-patterns.js +1 -1
  59. package/dist/knowledge/guard-ledger.js +1 -1
  60. package/dist/knowledge/guard-lint.js +1 -1
  61. package/dist/knowledge/guard-render.d.ts +6 -0
  62. package/dist/knowledge/guard-render.js +1 -1
  63. package/dist/knowledge/guard-risk.js +1 -1
  64. package/dist/knowledge/guard-submission-prompt.d.ts +6 -0
  65. package/dist/knowledge/guard-submission-prompt.js +1 -1
  66. package/dist/knowledge/guard-templates.d.ts +1 -1
  67. package/dist/knowledge/guard-templates.js +1 -1
  68. package/dist/knowledge/index.d.ts +4 -4
  69. package/dist/knowledge/index.js +1 -1
  70. package/dist/knowledge/industry-generalizer.js +1 -1
  71. package/dist/knowledge/industry-registry.d.ts +1 -1
  72. package/dist/knowledge/industry-registry.js +1 -1
  73. package/dist/knowledge/jsonrpc-enum.js +1 -1
  74. package/dist/knowledge/machine-ledger.js +1 -1
  75. package/dist/knowledge/machine-risk.js +1 -1
  76. package/dist/knowledge/machine-templates.js +1 -1
  77. package/dist/knowledge/order-ledger.js +1 -1
  78. package/dist/knowledge/order-templates.js +1 -1
  79. package/dist/knowledge/permission-ledger.js +1 -1
  80. package/dist/knowledge/release-sentinel.d.ts +12 -0
  81. package/dist/knowledge/release-sentinel.js +1 -0
  82. package/dist/knowledge/repository-write-semantics.d.ts +27 -0
  83. package/dist/knowledge/repository-write-semantics.js +1 -0
  84. package/dist/knowledge/rule-node-analyzers.d.ts +6 -0
  85. package/dist/knowledge/rule-node-analyzers.js +1 -1
  86. package/dist/knowledge/safety-rules.d.ts +5 -1
  87. package/dist/knowledge/safety-rules.js +1 -1
  88. package/dist/knowledge/scenario-modes.d.ts +10 -1
  89. package/dist/knowledge/scenario-modes.js +1 -1
  90. package/dist/knowledge/service-allocation-semantics.d.ts +36 -0
  91. package/dist/knowledge/service-allocation-semantics.js +1 -0
  92. package/dist/knowledge/strategy-manuals.d.ts +3 -5
  93. package/dist/knowledge/strategy-manuals.js +1 -1
  94. package/dist/knowledge/template-loader.d.ts +28 -12
  95. package/dist/knowledge/template-loader.js +1 -1
  96. package/dist/knowledge/template-registry.js +1 -1
  97. package/dist/knowledge/template-scanner.js +1 -1
  98. package/dist/knowledge/tools-reference.js +1 -1
  99. package/dist/knowledge/workflow-guidance.d.ts +26 -0
  100. package/dist/knowledge/workflow-guidance.js +1 -1
  101. package/dist/monitor/MonitorLoop.js +1 -1
  102. package/dist/participation/allocation-advice.d.ts +38 -0
  103. package/dist/participation/allocation-advice.js +1 -0
  104. package/dist/participation/radar-core.d.ts +2 -0
  105. package/dist/persona/types.d.ts +3 -2
  106. package/dist/persona/types.js +1 -1
  107. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  108. package/dist/playbooks/service-build/intent-analyzer.js +1 -1
  109. package/dist/playbooks/service-build/merchant-guide.d.ts +70 -63
  110. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  111. package/dist/playbooks/service-build/migration-planner.js +1 -1
  112. package/dist/playbooks/service-build/mode-actions.d.ts +5 -0
  113. package/dist/playbooks/service-build/mode-actions.js +1 -1
  114. package/dist/playbooks/service-build/participation-radar.js +1 -1
  115. package/dist/playbooks/service-build/semantic-graph.d.ts +1 -0
  116. package/dist/playbooks/service-build/semantic-graph.js +1 -1
  117. package/dist/playbooks/service-build/service-quote.d.ts +2 -0
  118. package/dist/playbooks/service-build/service-quote.js +1 -0
  119. package/dist/relationship/derivation.d.ts +1 -1
  120. package/dist/safety/confirm-gate.js +1 -1
  121. package/dist/schema/benchmark-migration/index.d.ts +30 -8
  122. package/dist/schema/benchmark-migration/index.js +1 -1
  123. package/dist/schema/call/allocation.d.ts +6 -3
  124. package/dist/schema/call/arbitration.js +1 -1
  125. package/dist/schema/call/base.js +1 -1
  126. package/dist/schema/call/guard.d.ts +8 -8
  127. package/dist/schema/call/machine.d.ts +56 -0
  128. package/dist/schema/call/machine.js +1 -1
  129. package/dist/schema/call/order.js +1 -1
  130. package/dist/schema/call/payment.js +1 -1
  131. package/dist/schema/call/semantic.js +1 -1
  132. package/dist/schema/call/service.d.ts +84 -22
  133. package/dist/schema/call/service.js +1 -1
  134. package/dist/schema/common/index.js +1 -1
  135. package/dist/schema/common/tokentype-short-probe.spec.js +1 -0
  136. package/dist/schema/evaluation/index.d.ts +8 -80
  137. package/dist/schema/evaluation/index.js +1 -1
  138. package/dist/schema/goal/index.d.ts +9 -42
  139. package/dist/schema/goal/planning.d.ts +25 -60
  140. package/dist/schema/goal/planning.js +1 -1
  141. package/dist/schema/intent-radar/index.d.ts +2 -20
  142. package/dist/schema/intent-radar/index.js +1 -1
  143. package/dist/schema/interaction/index.d.ts +1 -1
  144. package/dist/schema/keeper/index.d.ts +3 -0
  145. package/dist/schema/keeper/index.js +1 -1
  146. package/dist/schema/local/index.js +1 -1
  147. package/dist/schema/operations.d.ts +74 -14
  148. package/dist/schema/persona/index.d.ts +279 -384
  149. package/dist/schema/persona/index.js +1 -1
  150. package/dist/schema/query/bi.d.ts +149 -10
  151. package/dist/schema/query/bi.js +1 -1
  152. package/dist/schema/query/index.d.ts +35 -16
  153. package/dist/schema/query/index.js +1 -1
  154. package/dist/schema/schema-query/index.d.ts +4 -4
  155. package/dist/schema/schema-version.js +1 -1
  156. package/dist/schema/watch/index.d.ts +2 -2
  157. package/dist/schema-query-impl/index.d.ts +1 -0
  158. package/dist/schema-query-impl/index.js +1 -1
  159. package/dist/schemas/account_operation.output.json +2 -2
  160. package/dist/schemas/benchmark_migration_operation.output.json +116 -2
  161. package/dist/schemas/benchmark_migration_operation.schema.json +2 -10
  162. package/dist/schemas/bridge_operation.output.json +2 -2
  163. package/dist/schemas/evaluation_operation.schema.json +7 -70
  164. package/dist/schemas/goal_operation.schema.json +6 -39
  165. package/dist/schemas/index.json +1 -1
  166. package/dist/schemas/intent_radar.output.json +4 -20
  167. package/dist/schemas/keeper_operation.output.json +2 -2
  168. package/dist/schemas/keeper_operation.schema.json +9 -4
  169. package/dist/schemas/local_history_operation.output.json +2 -2
  170. package/dist/schemas/local_info_operation.output.json +2 -2
  171. package/dist/schemas/local_mark_operation.output.json +2 -2
  172. package/dist/schemas/messenger_operation.output.json +2 -2
  173. package/dist/schemas/monitor_events.output.json +2 -2
  174. package/dist/schemas/monitor_subscription.output.json +2 -2
  175. package/dist/schemas/onchain_events.output.json +2 -2
  176. package/dist/schemas/onchain_operations.output.json +6 -6
  177. package/dist/schemas/onchain_operations.schema.json +227 -54
  178. package/dist/schemas/onchain_operations_allocation.schema.json +11 -10
  179. package/dist/schemas/onchain_operations_arbitration.schema.json +13 -13
  180. package/dist/schemas/onchain_operations_machine.schema.json +27 -5
  181. package/dist/schemas/onchain_operations_order.schema.json +1 -1
  182. package/dist/schemas/onchain_operations_payment.schema.json +2 -2
  183. package/dist/schemas/onchain_operations_reward.schema.json +1 -1
  184. package/dist/schemas/onchain_operations_service.schema.json +171 -21
  185. package/dist/schemas/onchain_operations_treasury.schema.json +1 -1
  186. package/dist/schemas/onchain_table_data.output.json +57 -4
  187. package/dist/schemas/persona_operation.output.json +11 -88
  188. package/dist/schemas/persona_operation.schema.json +4 -32
  189. package/dist/schemas/query_toolkit.output.json +320 -22
  190. package/dist/schemas/query_toolkit.schema.json +53 -0
  191. package/dist/tools/handlers/benchmark-migration.js +1 -1
  192. package/dist/tools/handlers/config.js +1 -1
  193. package/dist/tools/handlers/dispatch-expectations.spec.js +1 -1
  194. package/dist/tools/handlers/keeper.d.ts +1 -1
  195. package/dist/tools/handlers/onchain.js +1 -1
  196. package/dist/tools/handlers/query.js +1 -1
  197. package/dist/tools/handlers/schema-query.js +1 -1
  198. package/dist/tools/index.js +1 -1
  199. package/dist/tools/move-fn-index.gen.js +1 -1
  200. package/dist/tools/registry/business.js +1 -1
  201. package/dist/tools/wrap.js +1 -1
  202. package/package.json +2 -2
  203. package/dist/knowledge/alloc-audit-policy.spec.js +0 -1
  204. package/dist/knowledge/event-semantics.spec.d.ts +0 -1
  205. package/dist/knowledge/event-semantics.spec.js +0 -1
  206. package/dist/knowledge/facts-sync.spec.d.ts +0 -1
  207. package/dist/knowledge/facts-sync.spec.js +0 -1
  208. package/dist/knowledge/guard-design-patterns.spec.d.ts +0 -1
  209. package/dist/knowledge/guard-design-patterns.spec.js +0 -1
  210. package/dist/knowledge/guard-eval.spec.d.ts +0 -1
  211. package/dist/knowledge/guard-eval.spec.js +0 -1
  212. package/dist/knowledge/rule-node-analyzers.spec.d.ts +0 -1
  213. package/dist/knowledge/rule-node-analyzers.spec.js +0 -1
  214. package/dist/knowledge/safety-rules.extract-amount.spec.d.ts +0 -1
  215. package/dist/knowledge/safety-rules.extract-amount.spec.js +0 -1
  216. package/dist/knowledge/template-loader.spec.d.ts +0 -1
  217. package/dist/knowledge/template-loader.spec.js +0 -1
  218. package/dist/knowledge/template-scanner.spec.d.ts +0 -1
  219. package/dist/knowledge/template-scanner.spec.js +0 -1
  220. /package/dist/{knowledge/alloc-audit-policy.spec.d.ts → schema/common/tokentype-short-probe.spec.d.ts} +0 -0
@@ -3,18 +3,11 @@ import type { Industry } from "../customer/index.js";
3
3
  import { type ArchetypeTemplate } from "./builtin-templates.js";
4
4
  export declare const TEMPLATES_SUBDIR = "templates";
5
5
  export declare function resolveTemplatesDir(): string;
6
- export declare const INDUSTRY_VALUES: readonly ["freelance", "rental", "education", "travel", "subscription", "retail"];
7
6
  export declare const TemplateFrontmatterSchema: z.ZodObject<{
8
7
  id: z.ZodString;
9
- industry: z.ZodEnum<{
10
- freelance: "freelance";
11
- rental: "rental";
12
- education: "education";
13
- travel: "travel";
14
- subscription: "subscription";
15
- retail: "retail";
16
- }>;
8
+ industry: z.ZodString;
17
9
  variant: z.ZodString;
10
+ product_ref: z.ZodOptional<z.ZodString>;
18
11
  archetype: z.ZodEnum<{
19
12
  leader: "leader";
20
13
  challenger: "challenger";
@@ -23,14 +16,25 @@ export declare const TemplateFrontmatterSchema: z.ZodObject<{
23
16
  machine_shape: z.ZodArray<z.ZodObject<{
24
17
  name: z.ZodString;
25
18
  role: z.ZodString;
19
+ operator: z.ZodOptional<z.ZodEnum<{
20
+ merchant: "merchant";
21
+ order_payer: "order_payer";
22
+ }>>;
23
+ semantic_role: z.ZodOptional<z.ZodEnum<{
24
+ active: "active";
25
+ draft: "draft";
26
+ delivered: "delivered";
27
+ final: "final";
28
+ cancelled: "cancelled";
29
+ }>>;
26
30
  }, z.core.$strip>>;
27
31
  guards: z.ZodArray<z.ZodObject<{
28
32
  template_id: z.ZodString;
29
33
  host: z.ZodEnum<{
30
34
  reward: "reward";
31
35
  service: "service";
32
- machine: "machine";
33
36
  arbitration: "arbitration";
37
+ machine: "machine";
34
38
  repository: "repository";
35
39
  }>;
36
40
  purpose: z.ZodString;
@@ -41,14 +45,18 @@ export declare const TemplateFrontmatterSchema: z.ZodObject<{
41
45
  entity: "entity";
42
46
  signer: "signer";
43
47
  }>;
48
+ refund_track: z.ZodOptional<z.ZodEnum<{
49
+ order_anchored: "order_anchored";
50
+ }>>;
44
51
  count: z.ZodNumber;
45
52
  mode: z.ZodEnum<{
46
53
  amount: "amount";
47
54
  surplus: "surplus";
48
55
  rate: "rate";
49
56
  }>;
57
+ once_per_order: z.ZodOptional<z.ZodBoolean>;
50
58
  description: z.ZodString;
51
- }, z.core.$strip>;
59
+ }, z.core.$strict>;
52
60
  fee_params: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
53
61
  trust_mechanisms: z.ZodArray<z.ZodString>;
54
62
  keeper_dependencies: z.ZodArray<z.ZodString>;
@@ -62,6 +70,7 @@ export declare const TemplateFrontmatterSchema: z.ZodObject<{
62
70
  user_inputs: z.ZodArray<z.ZodString>;
63
71
  key_risk: z.ZodString;
64
72
  build_notes: z.ZodArray<z.ZodString>;
73
+ time_anchors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
65
74
  }, z.core.$strict>;
66
75
  export type TemplateFrontmatter = z.infer<typeof TemplateFrontmatterSchema>;
67
76
  export interface IndustryTemplate extends TemplateFrontmatter {
@@ -72,8 +81,15 @@ export declare function parseTemplateFile(raw: string): {
72
81
  frontmatter: Record<string, unknown>;
73
82
  body: string;
74
83
  };
84
+ export declare const TEMPLATE_SENTINEL_KIND = "industry-template";
75
85
  export declare function renderTemplateFile(t: ArchetypeTemplate): string;
76
- export declare function seedBuiltinTemplates(): string[];
86
+ export interface TemplateSeedResult {
87
+ template: string;
88
+ status: "written" | "updated" | "current" | "skipped_user_file" | "skipped_user_modified" | "error";
89
+ path: string;
90
+ detail?: string;
91
+ }
92
+ export declare function seedBuiltinTemplates(): TemplateSeedResult[];
77
93
  export declare function reloadTemplates(): void;
78
94
  export declare function loadAndValidate(file: string): IndustryTemplate;
79
95
  export declare function listTemplates(): {
@@ -1 +1 @@
1
- import{existsSync,mkdirSync,readdirSync,readFileSync,renameSync,rmdirSync,statSync,writeFileSync}from'node:fs';import{join}from'node:path';import{z}from'zod';import{getWowokDataDir,getWowokIndustryDir}from'@wowok/wowok';import{BUILTIN_TEMPLATES}from'./builtin-templates.js';export const TEMPLATES_SUBDIR='templates';export function resolveTemplatesDir(){return process['env']['WOWOK_TEMPLATES_DIR']||getWowokIndustryDir();}function resolveLegacyTemplatesDir(){return process['env']['WOWOK_LEGACY_TEMPLATES_DIR']||join(getWowokDataDir(),'templates');}export const INDUSTRY_VALUES=['freelance','rental','education','travel','subscription','retail'];const MachineNodeSchema=z['object']({'name':z['string']()['min'](0x1),'role':z['string']()['min'](0x1)}),GuardRefSchema=z['object']({'template_id':z['string']()['min'](0x1),'host':z['enum'](['service','machine','reward','repository','arbitration']),'purpose':z['string']()['min'](0x1)}),AllocatorSchema=z['object']({'recipient':z['enum'](['signer','entity','fixed']),'count':z['number']()['int']()['positive'](),'mode':z['enum'](['amount','rate','surplus']),'description':z['string']()['min'](0x1)});export const TemplateFrontmatterSchema=z['object']({'id':z['string']()['regex'](/^[a-z][a-z0-9_-]*\/[a-z][a-z0-9_-]*$/,'id\x20must\x20be\x20\x27<industry>/<variant>\x27'),'industry':z['enum'](INDUSTRY_VALUES),'variant':z['string']()['regex'](/^[a-z][a-z0-9_-]*$/),'archetype':z['enum'](['leader','challenger']),'phase':z['number']()['int']()['min'](0x1)['max'](0x3),'machine_shape':z['array'](MachineNodeSchema)['min'](0x1),'guards':z['array'](GuardRefSchema),'allocator':AllocatorSchema,'fee_params':z['record'](z['string'](),z['union']([z['number'](),z['string']()])),'trust_mechanisms':z['array'](z['string']()),'keeper_dependencies':z['array'](z['string']()),'recommended_role':z['enum'](['merchant','supplier','both']),'role_rationale':z['string']()['min'](0x1),'differences':z['array'](z['string']()),'user_inputs':z['array'](z['string']()),'key_risk':z['string']()['min'](0x1),'build_notes':z['array'](z['string']())})['strict']();export function parseTemplateFile(a){const b=a['replace'](/^\uFEFF/,''),c=b['split'](/\r?\n/);if(c[0x0]?.['trim']()!=='---')throw new Error('template\x20must\x20start\x20with\x20a\x20\x27---\x27\x20frontmatter\x20block');let d=-0x1;for(let f=0x1;f<c['length'];f++){if(c[f]['trim']()==='---'){d=f;break;}}if(d===-0x1)throw new Error('unterminated\x20frontmatter\x20block\x20(missing\x20closing\x20\x27---\x27)');const e={};for(let g=0x1;g<d;g++){const h=c[g];if(!h['trim']()||h['trim']()['startsWith']('#'))continue;const j=h['indexOf'](':');if(j===-0x1)throw new Error('invalid\x20frontmatter\x20line\x20'+(g+0x1)+':\x20\x27'+h['trim']()+'\x27\x20(expected\x20\x27key:\x20value\x27)');const k=h['slice'](0x0,j)['trim'](),l=h['slice'](j+0x1)['trim']();if(!k)throw new Error('invalid\x20frontmatter\x20line\x20'+(g+0x1)+':\x20empty\x20key');if(l['startsWith']('[')||l['startsWith']('{'))try{e[k]=JSON['parse'](l);}catch(m){throw new Error('frontmatter\x20key\x20\x27'+k+'\x27\x20is\x20not\x20valid\x20JSON:\x20'+m['message']);}else/^-?\d+(\.\d+)?$/['test'](l)?e[k]=Number(l):e[k]=l;}return{'frontmatter':e,'body':c['slice'](d+0x1)['join']('\x0a')['trim']()};}function frontmatterLine(a,b){if(typeof b==='number')return a+':\x20'+b;if(typeof b==='string')return a+':\x20'+b;return a+':\x20'+JSON['stringify'](b);}export function renderTemplateFile(a){const b=[['id',a['id']],['industry',a['industry']],['variant',a['variant']],['archetype',a['archetype']],['phase',a['phase']],['recommended_role',a['recommended_role']],['role_rationale',a['role_rationale']],['key_risk',a['key_risk']],['machine_shape',a['machine_shape']],['guards',a['guards']],['allocator',a['allocator']],['fee_params',a['fee_params']],['trust_mechanisms',a['trust_mechanisms']],['keeper_dependencies',a['keeper_dependencies']],['differences',a['differences']],['user_inputs',a['user_inputs']],['build_notes',a['build_notes']]],c=['---',...b['map'](([e,f])=>frontmatterLine(e,f)),'---'],d=['','#\x20'+a['industry']+'\x20/\x20'+a['variant']+'\x20('+a['archetype']+')','','>\x20Industry\x20archetype\x20template.\x20Editable\x20and\x20migratable:\x20the\x20frontmatter\x20is','>\x20zod-validated\x20on\x20every\x20load;\x20the\x20body\x20is\x20free-form\x20guidance\x20for\x20the\x20AI.','','##\x20Key\x20risk','',a['key_risk'],'','##\x20Differences\x20vs\x20the\x20sibling\x20variant','',...a['differences']['map'](e=>'-\x20'+e),'','##\x20User\x20inputs\x20(inject\x20at\x20build\x20time)','',...a['user_inputs']['map'](e=>'-\x20'+e),'','##\x20Risk-avoidance\x20checklist\x20(R1-R10)','',...a['trust_mechanisms']['map'](e=>'-\x20'+e),'','##\x20Build\x20notes','',...a['build_notes']['map'](e=>'-\x20'+e),''];return[...c,...d]['join']('\x0a');}let seeded=![];function migrateLegacyTemplates(a){const b=resolveLegacyTemplatesDir();if(b===a)return;if(!existsSync(b))return;try{for(const c of readdirSync(b,{'withFileTypes':!![]})){if(!c['isDirectory']())continue;const d=join(b,c['name']),e=join(a,c['name'],TEMPLATES_SUBDIR);for(const g of readdirSync(d,{'withFileTypes':!![]})){if(!g['isFile']()||!g['name']['endsWith']('.md'))continue;const h=join(e,g['name']);if(existsSync(h))continue;mkdirSync(e,{'recursive':!![]}),renameSync(join(d,g['name']),h);}try{rmdirSync(d);}catch{}}try{rmdirSync(b);}catch{}}catch{}}export function seedBuiltinTemplates(){const a=[],b=resolveTemplatesDir();migrateLegacyTemplates(b);for(const c of BUILTIN_TEMPLATES){const d=join(b,c['industry'],TEMPLATES_SUBDIR),e=join(d,c['variant']+'.md');if(existsSync(e))continue;try{mkdirSync(d,{'recursive':!![]}),writeFileSync(e,renderTemplateFile(c),'utf-8'),a['push'](e);}catch{}}return a;}const cache=new Map();export function reloadTemplates(){cache['clear'](),seeded=![];}export function loadAndValidate(a){const b=readFileSync(a,'utf-8');let c;try{c=parseTemplateFile(b);}catch(e){throw new Error('template\x20\x27'+a+'\x27\x20failed\x20to\x20parse:\x20'+e['message']);}const d=TemplateFrontmatterSchema['safeParse'](c['frontmatter']);if(!d['success']){const f=d['error']['issues']['map'](g=>(g['path']['join']('.')||'<root>')+':\x20'+g['message'])['join'](';\x20');throw new Error('template\x20\x27'+a+'\x27\x20failed\x20validation:\x20'+f);}return{...d['data'],'body':c['body'],'source_path':a};}function templateFilesOnDisk(a){const b=[];if(!existsSync(a))return b;for(const c of readdirSync(a,{'withFileTypes':!![]})){if(!c['isDirectory']())continue;const d=join(a,c['name'],TEMPLATES_SUBDIR);if(!existsSync(d))continue;for(const e of readdirSync(d,{'withFileTypes':!![]})){if(e['isFile']()&&e['name']['endsWith']('.md'))b['push'](join(d,e['name']));}}return b['sort']();}export function listTemplates(){!seeded&&(seedBuiltinTemplates(),seeded=!![]);const a=resolveTemplatesDir(),b=[],c=[],d=new Set();for(const e of templateFilesOnDisk(a)){d['add'](e);try{const f=statSync(e)['mtimeMs'],g=cache['get'](e);if(g&&g['mtimeMs']===f){b['push'](g['template']);continue;}const h=loadAndValidate(e);cache['set'](e,{'mtimeMs':f,'template':h}),b['push'](h);}catch(i){cache['delete'](e),c['push'](i['message']);}}for(const j of[...cache['keys']()]){if(!d['has'](j))cache['delete'](j);}return b['sort']((k,l)=>k['id']['localeCompare'](l['id'])),{'templates':b,'errors':c};}export function getTemplate(a){return listTemplates()['templates']['find'](b=>b['id']===a);}export function getTemplatesByIndustry(a){return listTemplates()['templates']['filter'](b=>b['industry']===a);}
1
+ import{existsSync,mkdirSync,readdirSync,readFileSync,renameSync,rmdirSync,statSync,writeFileSync}from'node:fs';import{join}from'node:path';import{z}from'zod';import{getWowokDataDir,getWowokIndustryDir}from'@wowok/wowok';import{SUPPORTED_INDUSTRIES}from'../customer/user-preferences.js';import{isRegisteredIndustry}from'./industry-registry.js';import{BUILTIN_TEMPLATES,BUILTIN_TEMPLATES_VERSION}from'./builtin-templates.js';import{classifyRelease,releaseBodyHash,releaseSentinelLine,stripReleaseSentinel}from'./release-sentinel.js';export const TEMPLATES_SUBDIR='templates';export function resolveTemplatesDir(){return process['env']['WOWOK_TEMPLATES_DIR']||getWowokIndustryDir();}function resolveLegacyTemplatesDir(){return process['env']['WOWOK_LEGACY_TEMPLATES_DIR']||join(getWowokDataDir(),'templates');}const MachineNodeSchema=z['object']({'name':z['string']()['min'](0x1),'role':z['string']()['min'](0x1),'operator':z['enum'](['merchant','order_payer'])['optional'](),'semantic_role':z['enum'](['draft','active','delivered','final','cancelled'])['optional']()}),GuardRefSchema=z['object']({'template_id':z['string']()['regex'](/^(pattern\.[a-z0-9_]+|tpl_[a-z0-9_]+)$/,'guard\x20template_id\x20must\x20be\x20a\x20\x27pattern.*\x27\x20design\x20pattern\x20or\x20\x27tpl_*\x27\x20guard\x20template'),'host':z['enum'](['service','machine','reward','repository','arbitration']),'purpose':z['string']()['min'](0x1)}),AllocatorSchema=z['object']({'recipient':z['enum'](['signer','entity','fixed']),'refund_track':z['enum'](['order_anchored'])['optional'](),'count':z['number']()['int']()['positive'](),'mode':z['enum'](['amount','rate','surplus']),'once_per_order':z['boolean']()['optional'](),'description':z['string']()['min'](0x1)})['strict'](),IndustryNameSchema=z['string']()['regex'](/^[a-z][a-z0-9_]*$/,'industry\x20must\x20be\x20lowercase\x20snake_case\x20(a-z,\x200-9,\x20_)')['refine'](a=>isRegisteredIndustry(a),{'message':'unknown\x20industry\x20—\x20register\x20it\x20first\x20via\x20an\x20industry\x20pack\x20'+'(industry_pack_operation\x20action=\x27scaffold\x27)\x20or\x20the\x20industry\x20generalizer;\x20'+('builtin\x20industries:\x20'+SUPPORTED_INDUSTRIES['join'](',\x20'))});export const TemplateFrontmatterSchema=z['object']({'id':z['string']()['regex'](/^[a-z][a-z0-9_-]*\/[a-z][a-z0-9_-]*$/,'id\x20must\x20be\x20\x27<industry>/<variant>\x27'),'industry':IndustryNameSchema,'variant':z['string']()['regex'](/^[a-z][a-z0-9_-]*$/),'product_ref':z['string']()['regex'](/^[a-z][a-z0-9._-]*$/,'product_ref\x20must\x20be\x20a\x20lowercase\x20product\x20slug')['optional'](),'archetype':z['enum'](['leader','challenger']),'phase':z['number']()['int']()['min'](0x1)['max'](0x3),'machine_shape':z['array'](MachineNodeSchema)['min'](0x1),'guards':z['array'](GuardRefSchema),'allocator':AllocatorSchema,'fee_params':z['record'](z['string'](),z['union']([z['number'](),z['string']()])),'trust_mechanisms':z['array'](z['string']()),'keeper_dependencies':z['array'](z['string']()),'recommended_role':z['enum'](['merchant','supplier','both']),'role_rationale':z['string']()['min'](0x1),'differences':z['array'](z['string']()),'user_inputs':z['array'](z['string']()),'key_risk':z['string']()['min'](0x1),'build_notes':z['array'](z['string']()),'time_anchors':z['record'](z['string'](),z['string']())['optional']()})['strict']();export function parseTemplateFile(a){const b=a['replace'](/^\uFEFF/,'')['replace'](/^<!-- builtin:[a-z0-9-]+:v\d+:[0-9a-f]+ -->\r?\n/,''),c=b['split'](/\r?\n/);if(c[0x0]?.['trim']()!=='---')throw new Error('template\x20must\x20start\x20with\x20a\x20\x27---\x27\x20frontmatter\x20block');let d=-0x1;for(let f=0x1;f<c['length'];f++){if(c[f]['trim']()==='---'){d=f;break;}}if(d===-0x1)throw new Error('unterminated\x20frontmatter\x20block\x20(missing\x20closing\x20\x27---\x27)');const e={};for(let g=0x1;g<d;g++){const h=c[g];if(!h['trim']()||h['trim']()['startsWith']('#'))continue;const j=h['indexOf'](':');if(j===-0x1)throw new Error('invalid\x20frontmatter\x20line\x20'+(g+0x1)+':\x20\x27'+h['trim']()+'\x27\x20(expected\x20\x27key:\x20value\x27)');const k=h['slice'](0x0,j)['trim'](),l=h['slice'](j+0x1)['trim']();if(!k)throw new Error('invalid\x20frontmatter\x20line\x20'+(g+0x1)+':\x20empty\x20key');if(l['startsWith']('[')||l['startsWith']('{'))try{e[k]=JSON['parse'](l);}catch(m){throw new Error('frontmatter\x20key\x20\x27'+k+'\x27\x20is\x20not\x20valid\x20JSON:\x20'+m['message']);}else/^-?\d+(\.\d+)?$/['test'](l)?e[k]=Number(l):e[k]=l;}return{'frontmatter':e,'body':c['slice'](d+0x1)['join']('\x0a')['trim']()};}function frontmatterLine(a,b){if(typeof b==='number')return a+':\x20'+b;if(typeof b==='string')return a+':\x20'+b;return a+':\x20'+JSON['stringify'](b);}export const TEMPLATE_SENTINEL_KIND='industry-template';function canonicalTemplateContent(a){const b=[['id',a['id']],['industry',a['industry']],['variant',a['variant']],['product_ref',a['product_ref']],['archetype',a['archetype']],['phase',a['phase']],['recommended_role',a['recommended_role']],['role_rationale',a['role_rationale']],['key_risk',a['key_risk']],['machine_shape',a['machine_shape']],['guards',a['guards']],['allocator',a['allocator']],['fee_params',a['fee_params']],['trust_mechanisms',a['trust_mechanisms']],['keeper_dependencies',a['keeper_dependencies']],['differences',a['differences']],['user_inputs',a['user_inputs']],['build_notes',a['build_notes']],...a['time_anchors']?[['time_anchors',a['time_anchors']]]:[]],c=['---',...b['map'](([e,f])=>frontmatterLine(e,f)),'---'],d=['','#\x20'+a['industry']+'\x20/\x20'+a['variant']+'\x20('+a['archetype']+')','','>\x20Industry\x20archetype\x20template.\x20Editable\x20and\x20migratable:\x20the\x20frontmatter\x20is','>\x20zod-validated\x20on\x20every\x20load;\x20the\x20body\x20is\x20free-form\x20guidance\x20for\x20the\x20AI.','','##\x20Key\x20risk','',a['key_risk'],'','##\x20Differences\x20vs\x20the\x20sibling\x20variant','',...a['differences']['map'](e=>'-\x20'+e),'','##\x20User\x20inputs\x20(inject\x20at\x20build\x20time)','',...a['user_inputs']['map'](e=>'-\x20'+e),'','##\x20Risk-avoidance\x20checklist\x20(R1-R10)','',...a['trust_mechanisms']['map'](e=>'-\x20'+e),'','##\x20Build\x20notes','',...a['build_notes']['map'](e=>'-\x20'+e),''];return[...c,...d]['join']('\x0a');}export function renderTemplateFile(a){const b=canonicalTemplateContent(a);return releaseSentinelLine(TEMPLATE_SENTINEL_KIND,BUILTIN_TEMPLATES_VERSION,releaseBodyHash(b))+'\x0a'+b;}let seeded=![];function migrateLegacyTemplates(a){const b=resolveLegacyTemplatesDir();if(b===a)return;if(!existsSync(b))return;try{for(const c of readdirSync(b,{'withFileTypes':!![]})){if(!c['isDirectory']())continue;const d=join(b,c['name']),e=join(a,c['name'],TEMPLATES_SUBDIR);for(const g of readdirSync(d,{'withFileTypes':!![]})){if(!g['isFile']()||!g['name']['endsWith']('.md'))continue;const h=join(e,g['name']);if(existsSync(h))continue;mkdirSync(e,{'recursive':!![]}),renameSync(join(d,g['name']),h);}try{rmdirSync(d);}catch{}}try{rmdirSync(b);}catch{}}catch{}}export function seedBuiltinTemplates(){const a=[],b=resolveTemplatesDir();migrateLegacyTemplates(b);for(const c of BUILTIN_TEMPLATES){const d=join(b,c['industry'],TEMPLATES_SUBDIR),e=join(d,c['variant']+'.md'),f={'template':c['id'],'status':'written','path':e};try{if(!existsSync(e))mkdirSync(d,{'recursive':!![]}),writeFileSync(e,renderTemplateFile(c),'utf-8');else{const {sentinel:g,content:h}=stripReleaseSentinel(readFileSync(e,'utf-8'),TEMPLATE_SENTINEL_KIND);if(!g)f['status']='skipped_user_file',f['detail']='template\x20file\x20exists\x20without\x20builtin\x20sentinel;\x20leaving\x20user\x20file\x20untouched';else{const i=classifyRelease(g,h,BUILTIN_TEMPLATES_VERSION);if(i==='current')f['status']='current';else i==='user_modified'?(f['status']='skipped_user_modified',f['detail']='template\x20file\x20was\x20edited\x20locally;\x20keeping\x20user\x20content\x20and\x20not\x20upgrading'):(writeFileSync(e,renderTemplateFile(c),'utf-8'),f['status']='updated');}}}catch(j){f['status']='error',f['detail']=j['message'];}a['push'](f);}return a;}const cache=new Map();export function reloadTemplates(){cache['clear'](),seeded=![];}export function loadAndValidate(a){const b=readFileSync(a,'utf-8');let c;try{c=parseTemplateFile(b);}catch(e){throw new Error('template\x20\x27'+a+'\x27\x20failed\x20to\x20parse:\x20'+e['message']);}const d=TemplateFrontmatterSchema['safeParse'](c['frontmatter']);if(!d['success']){const f=d['error']['issues']['map'](g=>(g['path']['join']('.')||'<root>')+':\x20'+g['message'])['join'](';\x20');throw new Error('template\x20\x27'+a+'\x27\x20failed\x20validation:\x20'+f);}return{...d['data'],'body':c['body'],'source_path':a};}function templateFilesOnDisk(a){const b=[];if(!existsSync(a))return b;for(const c of readdirSync(a,{'withFileTypes':!![]})){if(!c['isDirectory']())continue;const d=join(a,c['name'],TEMPLATES_SUBDIR);if(!existsSync(d))continue;for(const e of readdirSync(d,{'withFileTypes':!![]})){if(e['isFile']()&&e['name']['endsWith']('.md'))b['push'](join(d,e['name']));}}return b['sort']();}export function listTemplates(){!seeded&&(seedBuiltinTemplates(),seeded=!![]);const a=resolveTemplatesDir(),b=[],c=[],d=new Set();for(const e of templateFilesOnDisk(a)){d['add'](e);try{const f=statSync(e)['mtimeMs'],g=cache['get'](e);if(g&&g['mtimeMs']===f){b['push'](g['template']);continue;}const h=loadAndValidate(e);cache['set'](e,{'mtimeMs':f,'template':h}),b['push'](h);}catch(i){cache['delete'](e),c['push'](i['message']);}}for(const j of[...cache['keys']()]){if(!d['has'](j))cache['delete'](j);}return b['sort']((k,l)=>k['id']['localeCompare'](l['id'])),{'templates':b,'errors':c};}export function getTemplate(a){return listTemplates()['templates']['find'](b=>b['id']===a);}export function getTemplatesByIndustry(a){return listTemplates()['templates']['filter'](b=>b['industry']===a);}
@@ -1 +1 @@
1
- import{GUARD_TEMPLATES,fillGuardTemplate}from'./guard-templates.js';import{MACHINE_TEMPLATES,fillTemplate as a247a}from'./machine-templates.js';import{SERVICE_TEMPLATES,fillServiceTemplate}from'./service-templates.js';import{ORDER_TEMPLATES,fillTemplate as a247b}from'./order-templates.js';import{PROGRESS_TEMPLATES,fillProgressTemplate}from'./progress-templates.js';import{ARBITRATION_TEMPLATES,fillTemplate as a247c}from'./arbitration-templates.js';import{TREASURY_TEMPLATES,fillTemplate as a247d}from'./treasury-templates.js';import{PERMISSION_TEMPLATES,fillTemplate as a247e}from'./permission-templates.js';import{PASSPORT_TEMPLATES,fillTemplate as a247f}from'./passport-templates.js';import{ALLOCATION_TEMPLATES,fillTemplate as a247g}from'./allocation-templates.js';import{CONTACT_TEMPLATES,fillTemplate as a247h}from'./contact-templates.js';import{REWARD_TEMPLATES}from'./reward-templates.js';export const TEMPLATE_REGISTRY_VERSION=0x1;export const TEMPLATE_OBJECT_TYPES=['guard','machine','service','order','progress','arbitration','treasury','permission','passport','allocation','reward','contact'];function normalizeParam(a){return{'name':a['name'],'type':a['type'],'description':a['description']??'','required':a['required'],...a['default']!==undefined?{'default':a['default']}:{},...a['constraint']!==undefined?{'constraint':a['constraint']}:{}};}function guardMeta(a){return{'id':a['id'],'object_type':'guard','name':a['name'],'description':a['description'],'scenes':[a['scene_id']],'industries':a['applicable_industries'],'instantiable':!![],'parameters':a['parameters']['map'](b=>normalizeParam(b))};}function machineMeta(a){return{'id':a['id'],'object_type':'machine','name':a['name'],'description':a['description'],'scenes':[a['scene_id']],'industries':a['applicable_industries'],'instantiable':!![],'parameters':a['parameters']['map'](b=>normalizeParam(b))};}function bodyMeta(a,b,c,d){return{'id':a['id'],'object_type':b,'name':a['name'],'description':a['description'],'scenes':c,'industries':d,'instantiable':!![],'parameters':a['params']['map'](e=>normalizeParam(e))};}function rewardMeta(a){return{'id':a['type'],'object_type':'reward','name':a['name'],'description':a['description'],'scenes':[],'industries':[],'instantiable':![],'parameters':a['parameters']['map'](b=>normalizeParam(b))};}let REGISTRY=null,ID_COLLISIONS=[];function buildRegistry(){const a=new Map(),b=[],c=d=>{if(a['has'](d['meta']['id'])){b['push'](d['meta']['id']);return;}a['set'](d['meta']['id'],d);};for(const d of GUARD_TEMPLATES){c({'meta':guardMeta(d),'raw':d,'notes':d['creation_notes']});}for(const e of MACHINE_TEMPLATES){c({'meta':machineMeta(e),'raw':e,'notes':e['creation_notes']});}for(const f of SERVICE_TEMPLATES){c({'meta':bodyMeta(f,'service',f['applicable_scenes'],f['industry_tags']),'raw':f,'notes':f['notes']});}for(const g of ORDER_TEMPLATES){c({'meta':bodyMeta(g,'order',g['applicable_scenes'],g['industry_tags']),'raw':g,'notes':g['notes']});}for(const h of PROGRESS_TEMPLATES){c({'meta':bodyMeta(h,'progress',h['applicable_scenes'],h['industry_tags']),'raw':h,'notes':h['notes']});}for(const i of ARBITRATION_TEMPLATES){c({'meta':bodyMeta(i,'arbitration',i['applicable_scenes'],i['industry_tags']),'raw':i,'notes':i['notes']});}for(const j of TREASURY_TEMPLATES){c({'meta':bodyMeta(j,'treasury',j['applicable_scenes'],j['industry_tags']),'raw':j,'notes':j['notes']});}for(const k of PERMISSION_TEMPLATES){c({'meta':bodyMeta(k,'permission',k['applicable_scenes'],k['industry_tags']),'raw':k,'notes':k['notes']});}for(const l of PASSPORT_TEMPLATES){c({'meta':bodyMeta(l,'passport',l['applicable_scenarios'],l['industry_tags']),'raw':l,'notes':l['notes']});}for(const m of ALLOCATION_TEMPLATES){c({'meta':bodyMeta(m,'allocation',m['applicable_scenes'],m['industry_tags']),'raw':m,'notes':m['notes']});}for(const n of REWARD_TEMPLATES){c({'meta':rewardMeta(n),'raw':n,'guidance':{'guardCondition':n['guardCondition'],'amountRange':n['amountRange'],'allocationStrategy':n['allocationStrategy'],'example':n['example'],'relevantGuardOps':n['relevantGuardOps']}});}for(const o of CONTACT_TEMPLATES){c({'meta':bodyMeta(o,'contact',o['applicable_scenes'],o['industry_tags']),'raw':o,'notes':o['notes']});}return ID_COLLISIONS=b,a;}function registry(){return!REGISTRY&&(REGISTRY=buildRegistry()),REGISTRY;}export function getTemplateIdCollisions(){return registry(),ID_COLLISIONS;}export function getTemplateCounts(){const a=Object['fromEntries'](TEMPLATE_OBJECT_TYPES['map'](b=>[b,0x0]));for(const b of registry()['values']()){a[b['meta']['object_type']]+=0x1;}return a;}export function listTemplates(a){const b=[...registry()['values']()]['map'](c=>c['meta']);return a?b['filter'](c=>c['object_type']===a):b;}export function getTemplateDetail(a){const b=registry()['get'](a);if(!b)return null;return{...b['meta'],'raw':b['raw'],...b['notes']?{'notes':b['notes']}:{},...b['guidance']?{'guidance':b['guidance']}:{}};}export function findTemplateObjectType(a){return registry()['get'](a)?.['meta']['object_type']??null;}export function instantiateTemplate(a,b){const c=registry()['get'](a);if(!c)return{'ok':![],'object_type':null,'template_id':a,'error':'Template\x20not\x20found:\x20'+a+'.\x20Use\x20get_templates\x20without\x20\x27template\x27\x20to\x20list\x20all\x20template\x20ids.'};const d=c['meta']['object_type'];if(!c['meta']['instantiable'])return{'ok':![],'object_type':d,'template_id':a,'error':'Reward\x20templates\x20are\x20guidance-only\x20(prose\x20guard\x20conditions)\x20and\x20cannot\x20be\x20'+'instantiated\x20into\x20executable\x20JSON.\x20Use\x20the\x20guidance\x20payload\x20to\x20design\x20the\x20'+'Reward\x20+\x20Guard\x20manually.','guidance':c['guidance']};switch(d){case'guard':{const e=fillGuardTemplate(a,b);if(!e['ok'])return{'ok':![],'object_type':d,'template_id':a,'error':e['error'],...e['missing']?{'missing_params':e['missing']}:{}};return{'ok':!![],'object_type':d,'template_id':a,'body':{'table':e['table'],'root':e['root']},...c['notes']?{'notes':c['notes']}:{}};}case'machine':{const f=a247a(a,b);if(!f['success'])return{'ok':![],'object_type':d,'template_id':a,'error':f['validation_errors']?.['join'](';\x20')??'Machine\x20template\x20fill\x20failed',...f['missing_params']?{'missing_params':f['missing_params']}:{}};return{'ok':!![],'object_type':d,'template_id':a,'body':{'nodes':f['filled_nodes'],'pairs':f['filled_pairs']},...c['notes']?{'notes':c['notes']}:{}};}case'service':{const g=fillServiceTemplate(a,b);if(!g['ok'])return{'ok':![],'object_type':d,'template_id':a,'error':g['error']??'Service\x20template\x20fill\x20failed',...g['missing_required']?{'missing_params':g['missing_required']}:{}};return{'ok':!![],'object_type':d,'template_id':a,'body':g['body'],...c['notes']?{'notes':c['notes']}:{}};}case'order':case'arbitration':case'treasury':case'permission':case'passport':case'allocation':case'progress':case'contact':{const h=fillBodyTemplate(d,a,b);if(!h['ok'])return{'ok':![],'object_type':d,'template_id':a,'error':h['error']};return{'ok':!![],'object_type':d,'template_id':a,'body':h['body'],...c['notes']?{'notes':c['notes']}:{}};}default:return{'ok':![],'object_type':d,'template_id':a,'error':'Instantiation\x20not\x20supported\x20for\x20object_type\x20\x27'+d+'\x27'};}}function fillBodyTemplate(a,b,c){switch(a){case'order':return a247b(b,c);case'arbitration':return a247c(b,c);case'treasury':return a247d(b,c);case'permission':return a247e(b,c);case'passport':return a247f(b,c);case'allocation':return a247g(b,c);case'progress':return fillProgressTemplate(b,c);case'contact':return a247h(b,c);default:return{'ok':![],'error':'No\x20body-template\x20fill\x20for\x20\x27'+a+'\x27'};}}
1
+ import{GUARD_TEMPLATES,fillGuardTemplate}from'./guard-templates.js';import{MACHINE_TEMPLATES,fillTemplate as a243a}from'./machine-templates.js';import{SERVICE_TEMPLATES,fillServiceTemplate}from'./service-templates.js';import{ORDER_TEMPLATES,fillTemplate as a243b}from'./order-templates.js';import{PROGRESS_TEMPLATES,fillProgressTemplate}from'./progress-templates.js';import{ARBITRATION_TEMPLATES,fillTemplate as a243c}from'./arbitration-templates.js';import{TREASURY_TEMPLATES,fillTemplate as a243d}from'./treasury-templates.js';import{PERMISSION_TEMPLATES,fillTemplate as a243e}from'./permission-templates.js';import{PASSPORT_TEMPLATES,fillTemplate as a243f}from'./passport-templates.js';import{ALLOCATION_TEMPLATES,fillTemplate as a243g}from'./allocation-templates.js';import{CONTACT_TEMPLATES,fillTemplate as a243h}from'./contact-templates.js';import{REWARD_TEMPLATES}from'./reward-templates.js';export const TEMPLATE_REGISTRY_VERSION=0x1;export const TEMPLATE_OBJECT_TYPES=['guard','machine','service','order','progress','arbitration','treasury','permission','passport','allocation','reward','contact'];function normalizeParam(a){return{'name':a['name'],'type':a['type'],'description':a['description']??'','required':a['required'],...a['default']!==undefined?{'default':a['default']}:{},...a['constraint']!==undefined?{'constraint':a['constraint']}:{}};}function guardMeta(a){return{'id':a['id'],'object_type':'guard','name':a['name'],'description':a['description'],'scenes':[a['scene_id']],'industries':a['applicable_industries'],'instantiable':!![],'parameters':a['parameters']['map'](b=>normalizeParam(b))};}function machineMeta(a){return{'id':a['id'],'object_type':'machine','name':a['name'],'description':a['description'],'scenes':[a['scene_id']],'industries':a['applicable_industries'],'instantiable':!![],'parameters':a['parameters']['map'](b=>normalizeParam(b))};}function bodyMeta(a,b,c,d){return{'id':a['id'],'object_type':b,'name':a['name'],'description':a['description'],'scenes':c,'industries':d,'instantiable':!![],'parameters':a['params']['map'](e=>normalizeParam(e))};}function rewardMeta(a){return{'id':a['type'],'object_type':'reward','name':a['name'],'description':a['description'],'scenes':[],'industries':[],'instantiable':![],'parameters':a['parameters']['map'](b=>normalizeParam(b))};}let REGISTRY=null,ID_COLLISIONS=[];function buildRegistry(){const a=new Map(),b=[],c=d=>{if(a['has'](d['meta']['id'])){b['push'](d['meta']['id']);return;}a['set'](d['meta']['id'],d);};for(const d of GUARD_TEMPLATES){c({'meta':guardMeta(d),'raw':d,'notes':d['creation_notes']});}for(const e of MACHINE_TEMPLATES){c({'meta':machineMeta(e),'raw':e,'notes':e['creation_notes']});}for(const f of SERVICE_TEMPLATES){c({'meta':bodyMeta(f,'service',f['applicable_scenes'],f['industry_tags']),'raw':f,'notes':f['notes']});}for(const g of ORDER_TEMPLATES){c({'meta':bodyMeta(g,'order',g['applicable_scenes'],g['industry_tags']),'raw':g,'notes':g['notes']});}for(const h of PROGRESS_TEMPLATES){c({'meta':bodyMeta(h,'progress',h['applicable_scenes'],h['industry_tags']),'raw':h,'notes':h['notes']});}for(const i of ARBITRATION_TEMPLATES){c({'meta':bodyMeta(i,'arbitration',i['applicable_scenes'],i['industry_tags']),'raw':i,'notes':i['notes']});}for(const j of TREASURY_TEMPLATES){c({'meta':bodyMeta(j,'treasury',j['applicable_scenes'],j['industry_tags']),'raw':j,'notes':j['notes']});}for(const k of PERMISSION_TEMPLATES){c({'meta':bodyMeta(k,'permission',k['applicable_scenes'],k['industry_tags']),'raw':k,'notes':k['notes']});}for(const l of PASSPORT_TEMPLATES){c({'meta':bodyMeta(l,'passport',l['applicable_scenarios'],l['industry_tags']),'raw':l,'notes':l['notes']});}for(const m of ALLOCATION_TEMPLATES){c({'meta':bodyMeta(m,'allocation',m['applicable_scenes'],m['industry_tags']),'raw':m,'notes':m['notes']});}for(const n of REWARD_TEMPLATES){c({'meta':rewardMeta(n),'raw':n,'guidance':{'guardCondition':n['guardCondition'],'amountRange':n['amountRange'],'allocationStrategy':n['allocationStrategy'],'example':n['example'],'relevantGuardOps':n['relevantGuardOps']}});}for(const o of CONTACT_TEMPLATES){c({'meta':bodyMeta(o,'contact',o['applicable_scenes'],o['industry_tags']),'raw':o,'notes':o['notes']});}return ID_COLLISIONS=b,a;}function registry(){return!REGISTRY&&(REGISTRY=buildRegistry()),REGISTRY;}export function getTemplateIdCollisions(){return registry(),ID_COLLISIONS;}export function getTemplateCounts(){const a=Object['fromEntries'](TEMPLATE_OBJECT_TYPES['map'](b=>[b,0x0]));for(const b of registry()['values']()){a[b['meta']['object_type']]+=0x1;}return a;}export function listTemplates(a){const b=[...registry()['values']()]['map'](c=>c['meta']);return a?b['filter'](c=>c['object_type']===a):b;}export function getTemplateDetail(a){const b=registry()['get'](a);if(!b)return null;return{...b['meta'],'raw':b['raw'],...b['notes']?{'notes':b['notes']}:{},...b['guidance']?{'guidance':b['guidance']}:{}};}export function findTemplateObjectType(a){return registry()['get'](a)?.['meta']['object_type']??null;}export function instantiateTemplate(a,b){const c=registry()['get'](a);if(!c)return{'ok':![],'object_type':null,'template_id':a,'error':'Template\x20not\x20found:\x20'+a+'.\x20Use\x20get_templates\x20without\x20\x27template\x27\x20to\x20list\x20all\x20template\x20ids.'};const d=c['meta']['object_type'];if(!c['meta']['instantiable'])return{'ok':![],'object_type':d,'template_id':a,'error':'Reward\x20templates\x20are\x20guidance-only\x20(prose\x20guard\x20conditions)\x20and\x20cannot\x20be\x20'+'instantiated\x20into\x20executable\x20JSON.\x20Use\x20the\x20guidance\x20payload\x20to\x20design\x20the\x20'+'Reward\x20+\x20Guard\x20manually.','guidance':c['guidance']};switch(d){case'guard':{const e=fillGuardTemplate(a,b);if(!e['ok'])return{'ok':![],'object_type':d,'template_id':a,'error':e['error'],...e['missing']?{'missing_params':e['missing']}:{}};return{'ok':!![],'object_type':d,'template_id':a,'body':{'table':e['table'],'root':e['root']},...c['notes']?{'notes':c['notes']}:{}};}case'machine':{const f=a243a(a,b);if(!f['success'])return{'ok':![],'object_type':d,'template_id':a,'error':f['validation_errors']?.['join'](';\x20')??'Machine\x20template\x20fill\x20failed',...f['missing_params']?{'missing_params':f['missing_params']}:{}};return{'ok':!![],'object_type':d,'template_id':a,'body':{'nodes':f['filled_nodes'],'pairs':f['filled_pairs']},...c['notes']?{'notes':c['notes']}:{}};}case'service':{const g=fillServiceTemplate(a,b);if(!g['ok'])return{'ok':![],'object_type':d,'template_id':a,'error':g['error']??'Service\x20template\x20fill\x20failed',...g['missing_required']?{'missing_params':g['missing_required']}:{}};return{'ok':!![],'object_type':d,'template_id':a,'body':g['body'],...c['notes']?{'notes':c['notes']}:{}};}case'order':case'arbitration':case'treasury':case'permission':case'passport':case'allocation':case'progress':case'contact':{const h=fillBodyTemplate(d,a,b);if(!h['ok'])return{'ok':![],'object_type':d,'template_id':a,'error':h['error']};return{'ok':!![],'object_type':d,'template_id':a,'body':h['body'],...c['notes']?{'notes':c['notes']}:{}};}default:return{'ok':![],'object_type':d,'template_id':a,'error':'Instantiation\x20not\x20supported\x20for\x20object_type\x20\x27'+d+'\x27'};}}function fillBodyTemplate(a,b,c){switch(a){case'order':return a243b(b,c);case'arbitration':return a243c(b,c);case'treasury':return a243d(b,c);case'permission':return a243e(b,c);case'passport':return a243f(b,c);case'allocation':return a243g(b,c);case'progress':return fillProgressTemplate(b,c);case'contact':return a243h(b,c);default:return{'ok':![],'error':'No\x20body-template\x20fill\x20for\x20\x27'+a+'\x27'};}}
@@ -1 +1 @@
1
- import{ENTRYPOINT}from'@wowok/wowok';import{buildViewport,runNodeAnalyzers}from'../graph/onchain/index.js';import{makeProposalNode}from'../graph/onchain/proposal-graph.js';import{machineRuleNodeAnalyzer,allocationRuleNodeAnalyzer}from'./rule-node-analyzers.js';const DISPUTE_NODE_REGEX=/(^|_)(disputed?|refund(?:ed)?|arbitration|arb)(_|$)/i;function staticChecks(a){const b=[];for(const e of a['machine_shape']){DISPUTE_NODE_REGEX['test'](e['name'])&&b['push']({'rule_id':'R-M1-11','severity':'critical','title':'Machine\x20node\x20\x27'+e['name']+'\x27\x20models\x20dispute/refund\x20flow','detail':'Disputes\x20are\x20independent\x20of\x20the\x20Machine\x20workflow;\x20refunds\x20route\x20via\x20Allocators\x20triggered\x20by\x20business\x20states.','suggestion':'Remove\x20the\x20node;\x20route\x20refunds\x20via\x20Allocator\x20states\x20(cancelled/returned)\x20and\x20disputes\x20via\x20the\x20Arbitration\x20object.'});}a['machine_shape']['length']===0x0&&b['push']({'rule_id':'R-M1-01','severity':'critical','title':'machine_shape\x20is\x20empty','detail':'No\x20entry\x20node\x20—\x20the\x20Machine\x20cannot\x20start.','suggestion':'Add\x20at\x20least\x20one\x20entry\x20node\x20representing\x20the\x20escrowed\x20state.'});const c=a['guards']['some'](f=>f['template_id']['includes']('refund')||f['template_id']['includes']('cancel'))||/refund/i['test'](a['allocator']['description']);!c&&b['push']({'rule_id':'R1','severity':'high','title':'No\x20refund\x20path\x20detected','detail':'No\x20refund/cancel\x20guard\x20and\x20no\x20refund\x20route\x20in\x20the\x20allocator\x20description.','suggestion':'Add\x20a\x20refund/cancel\x20guard\x20or\x20an\x20allocator\x20refund\x20route\x20before\x20publishing.'});const d=a['guards']['some'](f=>f['host']==='arbitration')||a['trust_mechanisms']['some'](f=>f['startsWith']('R2'));return!d&&b['push']({'rule_id':'R2','severity':'high','title':'No\x20independent\x20Arbitration\x20reference\x20detected','detail':'The\x20template\x20carries\x20no\x20arbitration-hosted\x20guard\x20and\x20no\x20R2\x20trust\x20mechanism.','suggestion':'Mount\x20an\x20independent\x20Arbitration\x20object\x20with\x20its\x20own\x20Permission.'}),a['keeper_dependencies']['length']===0x0&&b['push']({'rule_id':'R9','severity':'medium','title':'No\x20keeper\x20dependencies\x20declared','detail':'Time-driven\x20transitions\x20only\x20ALLOW\x20advancement\x20—\x20someone\x20must\x20run\x20the\x20keepers.','suggestion':'Declare\x20the\x20keeper\x20operations\x20(timeouts,\x20window\x20expiries,\x20settlement\x20triggers).'}),b;}const BRANCH_STATE_REGEX=/(cancel|return|withdraw|exit|expired)/i;function syntheticMachine(a){const b=a['machine_shape']['map'](e=>({'name':e['name'],'description':e['role']})),c=[],d=e=>[{'name':e,'weight':0x1,'named_operator':'order_holder'}];b['length']>0x0&&c['push']({'prev_node':'','next_node':b[0x0]['name'],'threshold':0x1,'forwards':d('enter_'+b[0x0]['name'])});for(let e=0x0;e<b['length']-0x1;e++){const f=b[e]['name'],g=b[e+0x1]['name'];if(BRANCH_STATE_REGEX['test'](g))continue;c['push']({'prev_node':f,'next_node':g,'threshold':0x1,'forwards':d(f+'_to_'+g)});}if(b['length']>0x0)for(const h of b){BRANCH_STATE_REGEX['test'](h['name'])&&c['push']({'prev_node':b[0x0]['name'],'next_node':h['name'],'threshold':0x1,'forwards':d('to_'+h['name'])});}return{'nodes':b,'pairs':c};}function singleNodeGraph(a){return{'network':ENTRYPOINT['Testnet'],'seed':a['id'],'builtAt':Date['now'](),'nodes':new Map([[a['id'],a]]),'edges':[],'out':new Map(),'inc':new Map(),'gaps':[],'truncations':[],'rpcReport':{'batches':0x0,'byChannel':{'objects':0x0,'keyedFields':0x0,'tables':0x0,'events':0x0},'dedupHits':0x0},'budgetExhausted':{}};}function analyzerFindings(a){const b=makeProposalNode('machine',syntheticMachine(a)),c=makeProposalNode('allocation',{}),d=[];for(const e of[b,c]){const g=singleNodeGraph(e),h=buildViewport(g,g['seed'],'neutral');for(const i of runNodeAnalyzers(h,[machineRuleNodeAnalyzer,allocationRuleNodeAnalyzer])){d['push'](i);}}return d;}const SEVERITY_ORDER={'low':0x0,'medium':0x1,'high':0x2,'critical':0x3};export function scanTemplate(a){const b=[...staticChecks(a)];for(const e of analyzerFindings(a)){const g=e['severity']==='info'?'low':e['severity'];b['push']({'rule_id':e['ruleId'],'severity':g,'title':e['title'],'detail':e['detail'],'suggestion':e['suggestion']});}b['sort']((h,i)=>SEVERITY_ORDER[i['severity']]-SEVERITY_ORDER[h['severity']]);const c=b['length']>0x0?b[0x0]['severity']:'low',d=b['filter'](h=>h['severity']==='critical')['map'](h=>''+(h['rule_id']?h['rule_id']+':\x20':'')+h['title']);return{'template_id':a['id'],'risk_level':c,'passed':d['length']===0x0,'findings':b,'red_flags':d};}
1
+ import{ENTRYPOINT}from'@wowok/wowok';import{buildViewport,runNodeAnalyzers}from'../graph/onchain/index.js';import{makeProposalNode}from'../graph/onchain/proposal-graph.js';import{machineRuleNodeAnalyzer,allocationRuleNodeAnalyzer}from'./rule-node-analyzers.js';import{GUARD_TEMPLATES}from'./guard-templates.js';import{GUARD_DESIGN_PATTERNS}from'./guard-design-patterns.js';import{unannotatedBuyerActionNodes}from'./scenario-modes.js';const DISPUTE_NODE_REGEX=/(^|_)(disputed?|arbitration|arb)(_|$)|^(refund|refunded|deposit_refunded|deposit_deducted|cancel|cancelled)$/i,KNOWN_GUARD_REF_IDS=new Set([...GUARD_DESIGN_PATTERNS['map'](a=>a['id']),...GUARD_TEMPLATES['map'](a=>a['id'])]);function guardRefChecks(a){const b=[];for(const c of a['guards']){if(!/^(pattern\.[a-z0-9_]+|tpl_[a-z0-9_]+)$/['test'](c['template_id'])){b['push']({'rule_id':'R-REF-01','severity':'high','title':'Guard\x20reference\x20\x27'+c['template_id']+'\x27\x20is\x20not\x20a\x20resolvable\x20id','detail':'Guard\x20references\x20must\x20name\x20a\x20guard\x20design\x20pattern\x20(\x27pattern.*\x27,\x20'+GUARD_DESIGN_PATTERNS['length']+'\x20available)\x20or\x20a\x20guard\x20template\x20(\x27tpl_*\x27,\x20'+GUARD_TEMPLATES['length']+'\x20available).\x20Bare\x20prose\x20ids\x20dangle:\x20no\x20builder\x20can\x20resolve\x20them,\x20so\x20the\x20AI\x20invents\x20guard\x20logic\x20at\x20build\x20time.','suggestion':'Replace\x20with\x20the\x20semantically\x20nearest\x20pattern.*/tpl_*\x20id\x20(compose\x20multi-condition\x20logic\x20in\x20the\x20purpose\x20text).'});continue;}!KNOWN_GUARD_REF_IDS['has'](c['template_id'])&&b['push']({'rule_id':'R-REF-02','severity':'high','title':'Guard\x20reference\x20\x27'+c['template_id']+'\x27\x20does\x20not\x20exist\x20in\x20any\x20guard\x20catalog','detail':'The\x20id\x20is\x20namespaced\x20correctly\x20but\x20matches\x20no\x20guard\x20design\x20pattern\x20nor\x20guard\x20template\x20—\x20a\x20dangling\x20reference\x20the\x20AI\x20cannot\x20resolve.','suggestion':'Fix\x20the\x20id\x20(typo)\x20or\x20point\x20it\x20at\x20the\x20nearest\x20existing\x20pattern.*/tpl_*\x20entry.'});}return b;}function staticChecks(a){const b=[];for(const h of a['machine_shape']){DISPUTE_NODE_REGEX['test'](h['name'])&&b['push']({'rule_id':'R-M1-11','severity':'critical','title':'Machine\x20node\x20\x27'+h['name']+'\x27\x20models\x20dispute/refund\x20flow','detail':'Disputes\x20are\x20independent\x20of\x20the\x20Machine\x20workflow;\x20refunds\x20route\x20via\x20Allocators\x20triggered\x20by\x20business\x20states.','suggestion':'Remove\x20the\x20node;\x20route\x20refunds\x20via\x20Allocator\x20states\x20(closed_cancel/returned)\x20and\x20disputes\x20via\x20the\x20Arbitration\x20object.'});}for(const i of a['guards']){/time_lock|order_holder|progress_state/['test'](i['template_id'])&&!/order\.service|project bind|service binding/i['test'](i['purpose'])&&b['push']({'rule_id':'R-C3-05','severity':'medium','title':'Guard\x20\x27'+i['template_id']+'\x27\x20consumes\x20a\x20submitted\x20Order\x20without\x20project\x20binding','detail':'Passport\x20submissions\x20are\x20caller-built;\x20without\x20logic_equal[order.service,\x20<service>]\x20a\x20stale\x20order\x20from\x20another\x20project\x20can\x20satisfy\x20the\x20guard\x20for\x20a\x20fresh\x20order.','suggestion':'State\x20the\x20project\x20binding\x20in\x20the\x20guard\x20purpose\x20AND\x20include\x20it\x20in\x20the\x20guard\x20root\x20at\x20build\x20time.'});}a['machine_shape']['length']===0x0&&b['push']({'rule_id':'R-M1-01','severity':'critical','title':'machine_shape\x20is\x20empty','detail':'No\x20entry\x20node\x20—\x20the\x20Machine\x20cannot\x20start.','suggestion':'Add\x20at\x20least\x20one\x20entry\x20node\x20representing\x20the\x20escrowed\x20state.'});const c=a['guards']['some'](j=>/refund|cancel/i['test'](j['template_id'])||/refund|cancel/i['test'](j['purpose']))||/refund/i['test'](a['allocator']['description']);!c&&b['push']({'rule_id':'R1','severity':'high','title':'No\x20refund\x20path\x20detected','detail':'No\x20refund/cancel\x20guard\x20and\x20no\x20refund\x20route\x20in\x20the\x20allocator\x20description.','suggestion':'Add\x20a\x20refund/cancel\x20guard\x20or\x20an\x20allocator\x20refund\x20route\x20before\x20publishing.'});const d=a['guards']['some'](j=>j['host']==='arbitration')||a['trust_mechanisms']['some'](j=>j['startsWith']('R2'));!d&&b['push']({'rule_id':'R2','severity':'high','title':'No\x20independent\x20Arbitration\x20reference\x20detected','detail':'The\x20template\x20carries\x20no\x20arbitration-hosted\x20guard\x20and\x20no\x20R2\x20trust\x20mechanism.','suggestion':'Mount\x20an\x20independent\x20Arbitration\x20object\x20with\x20its\x20own\x20Permission.'});a['keeper_dependencies']['length']===0x0&&b['push']({'rule_id':'R9','severity':'medium','title':'No\x20keeper\x20dependencies\x20declared','detail':'Time-driven\x20transitions\x20only\x20ALLOW\x20advancement\x20—\x20someone\x20must\x20run\x20the\x20keepers.','suggestion':'Declare\x20the\x20keeper\x20operations\x20(timeouts,\x20window\x20expiries,\x20settlement\x20triggers).'});const e=Object['keys'](a['fee_params'])['filter'](j=>/commission|fee|rate_bps/i['test'](j));if(a['allocator']['mode']==='rate'&&e['length']>0x0){const j=a['allocator']['description']['toLowerCase'](),k=/platform|treasury|fee (account|recipient)|to the (platform|service owner)/['test'](j)||/surplus/['test'](j);!k&&b['push']({'rule_id':'R-ALLOC-01','severity':'high','title':'Rate\x20allocator\x20has\x20no\x20declared\x20destination\x20for\x20the\x20platform/fee\x20share','detail':'fee_params\x20carry\x20commission\x20keys\x20('+e['join'](',\x20')+')\x20but\x20the\x20allocator\x20description\x20does\x20not\x20state\x20where\x20the\x20platform\x20share\x20lands.\x20On-chain\x20allocation\x20delivers\x20each\x20Rate\x20to\x20ITS\x20recipient\x20slot;\x20a\x20share\x20bound\x20to\x20the\x20merchant\x20entity\x20pays\x20the\x20merchant\x20—\x20the\x20fee\x20has\x20nowhere\x20to\x20go\x20(verified\x20on\x20testnet:\x20the\x20fee\x20share\x20settled\x20at\x20the\x20merchant\x20owner).','suggestion':'Name\x20the\x20recipient\x20slot\x20per\x20share\x20(platform/treasury\x20entity\x20vs\x20seller\x20surplus)\x20in\x20the\x20allocator\x20description,\x20and\x20bind\x20the\x20platform\x20Rate\x20to\x20a\x20distinct\x20non-merchant\x20entity\x20before\x20publishing.'});}const f=unannotatedBuyerActionNodes(a['machine_shape']);return f['length']>0x0&&b['push']({'rule_id':'R-OPER-01','severity':'medium','title':'Buyer-side\x20node(s)\x20without\x20an\x20operator\x20annotation','detail':'Node(s)\x20'+f['map'](l=>'\x27'+l+'\x27')['join'](',\x20')+'\x20look\x20like\x20order-payer\x20actions\x20but\x20carry\x20no\x20operator\x20field.\x20At\x20build\x20time\x20they\x20default\x20to\x20a\x20merchant\x20permission\x20slot,\x20and\x20the\x20order\x20payer\x20cannot\x20advance\x20them\x20(E_PERMISSION_DENIED).','suggestion':'Annotate\x20true\x20buyer\x20actions\x20with\x20operator:\x20\x22order_payer\x22\x20(an\x20EMPTY\x20namedOperator\x20—\x20the\x20on-chain\x20check\x20resolves\x20it\x20to\x20the\x20order\x20payer);\x20rename\x20merchant-side\x20states\x20(e.g.\x20\x27cancelled\x27\x20->\x20\x27merchant_cancelled\x27)\x20when\x20the\x20actor\x20is\x20NOT\x20the\x20buyer.'}),b;}const PERIOD_COUNT_KEY_REGEX=/^(monthly_allocators|term_count|session_count|segment_count|periods|cycles|installments)$/;function poolPeriodCount(a){for(const [b,c]of Object['entries'](a['fee_params'])){if(PERIOD_COUNT_KEY_REGEX['test'](b)&&typeof c==='number'&&c>=0x2)return c;}return undefined;}function periodicReleaseChecks(a){const b=poolPeriodCount(a);if(b===undefined)return[];const c=[a['allocator']['description'],...a['build_notes'],...a['trust_mechanisms'],...a['guards']['map'](f=>f['purpose'])]['join']('\x20\x0a\x20'),d=[];/surplus/i['test'](c)&&!/no surplus|surplus[^.\n]*(disabled|forbidden|disallowed)|amount mode only|single surplus/i['test'](c)&&d['push']({'rule_id':'R-PER-01','severity':'high','title':'Multi-period\x20pool\x20('+b+'\x20periods)\x20declares\x20Surplus\x20without\x20a\x20terminal-only\x20qualifier','detail':'A\x20Surplus\x20allocator\x20entry\x20runs\x20balance::withdraw_all\x20(allocation.move:288-298).\x20In\x20a\x20pool\x20pre-funded\x20for\x20'+b+'\x20periods\x20it\x20drains\x20every\x20future\x20release,\x20not\x20just\x20the\x20remainder.','suggestion':'Release\x20each\x20period\x20with\x20Amount;\x20if\x20the\x20pool\x20remainder\x20settles\x20in\x20one\x20entry,\x20declare\x20it\x20explicitly\x20as\x20the\x20SINGLE\x20terminal\x20Surplus\x20at\x20the\x20settlement\x20node,\x20or\x20disable\x20Surplus\x20outright.'});const e=/per[- ](month|period|term|session|cycle|segment)|one per (rent )?period|release-sequence lock/i['test'](c);return!e&&d['push']({'rule_id':'R-PER-02','severity':'high','title':'Multi-period\x20pool\x20('+b+'\x20periods)\x20declares\x20no\x20per-period\x20release\x20Guard','detail':'alloc()\x20has\x20no\x20consumed/nonce\x20flag\x20(allocation.move:204-321):\x20two\x20releases\x20bound\x20to\x20the\x20SAME\x20Guard\x20can\x20both\x20fire\x20the\x20same\x20day\x20and\x20drain\x20the\x20pool.\x20The\x20cadence\x20gate\x20must\x20be\x20one\x20Guard\x20per\x20period.','suggestion':'Declare\x20one\x20release\x20Guard\x20per\x20period\x20(per-month/per-term\x20time-lock\x20Guards,\x20each\x20keyed\x20to\x20its\x20own\x20period\x20window)\x20in\x20the\x20guard\x20set.'}),!/threshold[^.\n]*(one|single|per[- ]|month|period|term|session|=\s*0\b|\b0\b|must be 0)/i['test'](c)&&d['push']({'rule_id':'R-PER-03','severity':'medium','title':'Multi-period\x20pool\x20('+b+'\x20periods)\x20does\x20not\x20pin\x20threshold\x20to\x20one\x20period','detail':'alloc()\x20asserts\x20balance\x20>=\x20threshold\x20before\x20EVERY\x20release\x20(allocation.move:206).\x20A\x20threshold\x20sized\x20to\x20the\x20total\x20pool\x20passes\x20the\x20first\x20release\x20and\x20then\x20locks\x20all\x20remaining\x20periods.','suggestion':'State\x20in\x20the\x20allocator\x20description\x20or\x20build\x20notes\x20that\x20threshold\x20=\x20one\x20period\x27s\x20release\x20amount\x20(never\x20the\x20pre-funded\x20total).'}),d;}const MIN_PRICE_KEY_REGEX=/^(?:min_[a-z0-9_]*?(?:price|amount|usd|value)|price_floor)$/,FLOOR_TEXT_REGEX=/fixed (?:fee|charge)[^.\n]*(?:<|less than|below) [^.\n]*(?:lowest|minimum|min)|minimum (?:sku|order|item|unit) (?:price|amount)|(?:below|under|<=)\s*the\s+smallest[^.\n]*(?:order|escrow|booking|price)/i,FIXED_FEE_TEXT_REGEX=/\bamount mode\b|fixed (?:fee|fulfillment|fulfilment|per[- ]order) (?:fee|charge)|\bAmount\b[^.\n]*(?:fee|charge)/i;function fundAnchorChecks(a){const b=[],c=[a['allocator']['description'],...a['build_notes'],...a['trust_mechanisms'],...a['guards']['map'](h=>h['template_id']+'\x20'+h['purpose'])]['join']('\x20\x0a\x20'),d=a['allocator']['refund_track']==='order_anchored'||/allocator_order_anchor/['test'](c)||/guardidentifier\(0\)|order[- ]anchored|for_object/i['test'](c);!d&&b['push']({'rule_id':'R-ANCHOR-01','severity':'critical','title':'Allocator\x20has\x20no\x20order\x20anchor\x20—\x20its\x20Guard\x20cannot\x20bind\x20the\x20paying\x20Order','detail':'Every\x20recipient\x20of\x20this\x20allocator\x20is\x20a\x20fixed\x20party\x20(recipient=\x27'+a['allocator']['recipient']+'\x27,\x20no\x20GuardIdentifier\x20row),\x20so\x20nothing\x20in\x20the\x20Guard\x27s\x20verification\x20context\x20names\x20the\x20Order\x20being\x20settled:\x20Recipient::Entity/Signer\x20are\x20resolved\x20without\x20any\x20submission\x20check\x20(allocation.move:383-388)\x20and\x20the\x20Allocation\x20itself\x20never\x20enters\x20the\x20Guard\x20context.\x20Testnet\x20proved\x20the\x20consequence:\x20a\x20passport\x20built\x20from\x20an\x20ALREADY-SETTLED\x20order\x20of\x20the\x20same\x20Service\x20drained\x20a\x20different\x20order\x27s\x20escrow\x20(CR-01).\x20The\x20identifier-255\x20once-slot\x20does\x20not\x20help\x20—\x20it\x20is\x20stored\x20per\x20Allocation,\x20so\x20a\x20fresh\x20pool\x20has\x20no\x20record.','suggestion':'Adopt\x20pattern.allocator_order_anchor:\x20add\x20one\x20{GuardIdentifier:\x200}\x20row\x20with\x20Rate\x200\x20(pays\x20nothing,\x20makes\x20the\x20submitted\x20Order\x20the\x20Guard\x27s\x20binding\x20target),\x20declare\x20refund_track:\x20\x22order_anchored\x22,\x20and\x20pin\x20the\x20Guard\x20expression\x20to\x20that\x20identifier\x20plus\x20logic_equal[order.service,\x20<this\x20service>].'});const e=a['allocator']['mode']==='amount',f=e||FIXED_FEE_TEXT_REGEX['test'](c),g=Object['keys'](a['fee_params'])['some'](h=>MIN_PRICE_KEY_REGEX['test'](h))||FLOOR_TEXT_REGEX['test'](c);return f&&!g&&b['push']({'rule_id':'R-FIXFEE-01','severity':e?'critical':'high','title':'Fixed\x20Amount\x20fee\x20with\x20no\x20minimum\x20order\x20value\x20—\x20sub-fee\x20orders\x20deadlock\x20permanently','detail':'alloc()\x20asserts\x20balance\x20>=\x20fix\x20before\x20distributing\x20(allocation.move:322):\x20an\x20order\x20escrowed\x20BELOW\x20the\x20fixed\x20fee\x20can\x20never\x20settle,\x20and\x20the\x20terminal\x20nodes\x20(completed/closed_cancel)\x20leave\x20no\x20refund\x20path\x20for\x20it,\x20so\x20buyer\x20funds\x20and\x20the\x20order\x20strand\x20forever\x20(testnet\x20CR-02,\x20reproduced\x20on\x20a\x200.001\x20WOW\x20SKU\x20against\x20a\x200.15\x20WOW\x20fee).','suggestion':'Declare\x20a\x20minimum\x20listing/order\x20value\x20above\x20every\x20fixed\x20leg\x20in\x20fee_params\x20(e.g.\x20min_sku_price)\x20and\x20state\x20it\x20in\x20the\x20allocator\x20description,\x20or\x20model\x20the\x20per-order\x20fee\x20as\x20Rate/RateGross\x20instead\x20of\x20a\x20fixed\x20Amount.'}),a['allocator']['once_per_order']===!![]&&!/per[- ]allocation|per[- ]pool|not cross[- ]order|within (a|the) (pool|allocation)/i['test'](c)&&b['push']({'rule_id':'R-ONCE-SCOPE-01','severity':'medium','title':'once_per_order\x20claim\x20does\x20not\x20state\x20its\x20per-Allocation\x20scope','detail':'The\x20identifier-255\x20once-slot\x20is\x20keyed\x20(guard,\x20allocator,\x20submission)\x20ON\x20ONE\x20Allocation,\x20so\x20replay\x20immunity\x20holds\x20within\x20a\x20single\x20pool\x20only;\x20a\x20second\x20Allocation\x20of\x20the\x20same\x20Service\x20starts\x20with\x20no\x20record.\x20Presenting\x20ONCE\x20as\x20general\x20idempotency\x20is\x20what\x20let\x20testnet\x20CR-01\x20read\x20as\x20\x27already\x20protected\x27.','suggestion':'Say\x20explicitly\x20that\x20255\x20protects\x20one\x20pool,\x20and\x20pair\x20it\x20with\x20the\x20order\x20anchor\x20(R-ANCHOR-01)\x20for\x20cross-order\x20safety.'}),b;}const BRANCH_STATE_REGEX=/(cancel|return|withdraw|exit|expired)/i;function syntheticMachine(a){const b=a['machine_shape']['map'](e=>({'name':e['name'],'description':e['role'],'operator':e['operator']})),c=[],d=(e,f)=>[{'name':e,'weight':0x1,'named_operator':f==='order_payer'?'':'order_holder'}];b['length']>0x0&&c['push']({'prev_node':'','next_node':b[0x0]['name'],'threshold':0x1,'forwards':d('enter_'+b[0x0]['name'],b[0x0]['operator'])});for(let e=0x0;e<b['length']-0x1;e++){const f=b[e]['name'],g=b[e+0x1];if(BRANCH_STATE_REGEX['test'](g['name']))continue;c['push']({'prev_node':f,'next_node':g['name'],'threshold':0x1,'forwards':d(f+'_to_'+g['name'],g['operator'])});}if(b['length']>0x0)for(const h of b){BRANCH_STATE_REGEX['test'](h['name'])&&c['push']({'prev_node':b[0x0]['name'],'next_node':h['name'],'threshold':0x1,'forwards':d('to_'+h['name'],h['operator'])});}return{'nodes':b,'pairs':c};}function singleNodeGraph(a){return{'network':ENTRYPOINT['Testnet'],'seed':a['id'],'builtAt':Date['now'](),'nodes':new Map([[a['id'],a]]),'edges':[],'out':new Map(),'inc':new Map(),'gaps':[],'truncations':[],'rpcReport':{'batches':0x0,'byChannel':{'objects':0x0,'keyedFields':0x0,'tables':0x0,'events':0x0},'dedupHits':0x0},'budgetExhausted':{}};}function analyzerFindings(a){const b=makeProposalNode('machine',syntheticMachine(a)),c=makeProposalNode('allocation',{}),d=[];for(const e of[b,c]){const g=singleNodeGraph(e),h=buildViewport(g,g['seed'],'neutral');for(const i of runNodeAnalyzers(h,[machineRuleNodeAnalyzer,allocationRuleNodeAnalyzer])){d['push'](i);}}return d;}const SEVERITY_ORDER={'low':0x0,'medium':0x1,'high':0x2,'critical':0x3};export function scanTemplate(a){const b=[...staticChecks(a),...guardRefChecks(a),...fundAnchorChecks(a),...periodicReleaseChecks(a)];for(const e of analyzerFindings(a)){const g=e['severity']==='info'?'low':e['severity'];b['push']({'rule_id':e['ruleId'],'severity':g,'title':e['title'],'detail':e['detail'],'suggestion':e['suggestion']});}b['sort']((h,i)=>SEVERITY_ORDER[i['severity']]-SEVERITY_ORDER[h['severity']]);const c=b['length']>0x0?b[0x0]['severity']:'low',d=b['filter'](h=>h['severity']==='critical')['map'](h=>''+(h['rule_id']?h['rule_id']+':\x20':'')+h['title']);return{'template_id':a['id'],'risk_level':c,'passed':d['length']===0x0,'findings':b,'red_flags':d};}
@@ -1 +1 @@
1
- export const TOOLS_REFERENCE=[{'name':'onchain_operations','summary':'On-chain\x20object\x20creation,\x20modification,\x20and\x20publish\x20for\x20all\x2016\x20Wowok\x20object\x20types.','actions':['service','machine','guard','permission','reward','arb','progress','treasury','demand','repository','contact','order','allocation','personal','payment','proof','gen_passport','gen_proof'],'common_params':{'operation_type':'Object\x20type\x20to\x20create/modify\x20(string\x20enum).','data':'Operation\x20payload\x20—\x20shape\x20varies\x20by\x20operation_type.','object':'Object\x20name\x20or\x20address\x20(for\x20modify-by-id).','namedNew':'New\x20object\x20spec\x20(name,\x20description,\x20tags)\x20for\x20create.','env':'Execution\x20environment\x20(account,\x20network,\x20gas_budget).'},'prerequisites':['account_operation\x20(for\x20account\x20setup)'],'follow_ups':['query_toolkit\x20(verify\x20result)','local_mark_operation\x20(tag\x20object)'],'notes':['publish=true\x20is\x20irreversible\x20—\x20use\x20confirm_gate.','Service/Machine\x20require\x20publish\x20after\x20create\x20before\x20they\x20are\x20visible\x20on-chain.','Use\x20schema_query\x20with\x20action=\x27list_operations\x27\x20to\x20see\x20all\x20operation\x20schemas.','NETWORK:\x20by\x20default\x20omit\x20env.network\x20—\x20the\x20operation\x20runs\x20on\x20the\x20user\x27s\x20CURRENT\x20network\x20(the\x20app\x27s\x20active\x20selection);\x20the\x20confirmation\x20card\x20echoes\x20the\x20actual\x20network.\x20Never\x20guess\x20or\x20invent\x20a\x20network\x20on\x20your\x20own\x20initiative.','NETWORK\x20SWITCH\x20(explicit\x20user\x20intent\x20only):\x20when\x20the\x20user\x27s\x20request\x20clearly\x20targets\x20a\x20DIFFERENT\x20network\x20(e.g.\x20\x22create\x20this\x20permission\x20on\x20testnet\x22\x20while\x20the\x20app\x20is\x20on\x20mainnet),\x20set\x20env.network\x20to\x20that\x20network\x20in\x20THIS\x20call\x20—\x20the\x20client\x20pops\x20a\x20mandatory\x20network-switch\x20confirmation\x20card;\x20only\x20after\x20the\x20user\x20approves\x20does\x20the\x20call\x20(and\x20the\x20whole\x20app)\x20run\x20on\x20the\x20new\x20network.\x20If\x20the\x20user\x20declines,\x20do\x20NOT\x20retry\x20on\x20that\x20network\x20—\x20continue\x20on\x20the\x20current\x20one.\x20Read-only\x20queries\x20(query_toolkit\x20context_network)\x20never\x20need\x20this\x20—\x20they\x20select\x20a\x20network\x20per\x20call\x20without\x20switching.']},{'name':'account_operation','summary':'Local\x20wallet\x20management\x20—\x20generate,\x20suspend,\x20resume,\x20faucet,\x20sign\x20data.','actions':['gen','resume','suspend','faucet','operate','sign','list','info'],'common_params':{'name':'Account\x20name\x20(local\x20identifier).','network':'mainnet\x20|\x20testnet\x20(determines\x20RPC).'},'prerequisites':[],'follow_ups':['onchain_operations\x20(use\x20account\x20for\x20signing)'],'notes':['100%\x20LOCAL\x20—\x20keys\x20never\x20leave\x20the\x20device.','faucet\x20only\x20works\x20on\x20testnet.']},{'name':'local_mark_operation','summary':'Local\x20address\x20book\x20—\x20map\x20human-readable\x20names\x20to\x20blockchain\x20addresses\x20with\x20tags.','actions':['add','remove','update','list','query'],'common_params':{'name':'Local\x20name.','address':'Blockchain\x20address.','tags':'Tag\x20array.'},'notes':['100%\x20LOCAL\x20—\x20never\x20on-chain.','Names\x20are\x20accepted\x20by\x20most\x20on-chain\x20query/panorama\x20tools\x20in\x20place\x20of\x20raw\x20addresses.']},{'name':'local_info_operation','summary':'Local\x20private\x20data\x20management\x20—\x20delivery\x20addresses,\x20phone\x20numbers,\x20contacts.','actions':['add','remove','update','list'],'notes':['100%\x20LOCAL\x20—\x20sensitive\x20data,\x20never\x20on-chain.']},{'name':'local_history_operation','summary':'Local\x20Explorer\x20visit\x20history\x20—\x20recently\x20viewed\x20objects,\x20newest\x20first.','actions':['list\x20(default)','add\x20(upsert\x20by\x20key)','remove\x20(by\x20keys)','clear'],'common_params':{'add':'Record\x20visits:\x20{op:\x27add\x27,\x20data:[{key,\x20address,\x20object_type?,\x20network,\x20time}]}.','remove':'Delete\x20entries:\x20{op:\x27remove\x27,\x20keys:[...]}.','clear':'Erase\x20all\x20history:\x20{op:\x27clear\x27}.'},'notes':['100%\x20LOCAL\x20—\x20visit\x20records\x20never\x20leave\x20the\x20device;\x20display\x20names\x20are\x20never\x20stored\x20(resolved\x20live\x20at\x20render).','Omit\x20every\x20operation\x20field\x20to\x20list\x20history\x20(newest\x20first,\x20auto-pruned\x20to\x20last\x2030\x20days\x20/\x20300\x20entries).','detail\x20visits\x20keep\x20the\x20object\x20type\x20tag;\x20each\x20entry\x20stores\x20the\x20stable\x20object\x20key\x20+\x20canonical\x200x\x20address\x20+\x20network\x20+\x20timestamp.']},{'name':'wip_file','summary':'Witness\x20Immutable\x20Promise\x20file\x20operations\x20—\x20generate,\x20verify,\x20sign,\x20convert,\x20and\x20storage\x20(upload/list/delete\x20on\x20the\x20free\x20official\x20store\x20or\x20a\x20custom\x20service).','actions':['generate','verify','sign','wip2html','upload','storage_list','storage_delete'],'notes':['WIP\x20hash\x20must\x20be\x20non-empty\x20—\x20compute\x20actual\x20hash\x20before\x20calling.','Storage\x20decision:\x20storage=\x27store\x27\x20(default)\x20=\x20official\x20FREE\x20store\x20wip.store.wowok.net,\x2010\x20files\x20per\x20account,\x20files\x20retained\x206\x20months\x20(free\x20best-effort\x20service\x20—\x20force\x20majeure\x20excepted;\x20expired\x20files\x20are\x20deleted\x20ONLY\x20by\x20manual\x20admin\x20purge,\x20never\x20automatically);\x20storage=\x27custom\x27\x20+\x20customBaseUrl\x20=\x20your\x20own\x20or\x20a\x20third-party\x20wip\x20storage\x20service\x20(recommended:\x20no\x20store\x20quota,\x20full\x20control).','Network\x20independence:\x20WIP\x20files\x20are\x20off-chain\x20—\x20one\x20upload\x20serves\x20BOTH\x20testnet\x20and\x20mainnet,\x20and\x20storage_list/storage_delete\x20never\x20touch\x20the\x20chain.','Large\x20WIP\x20files\x20(multi-MB,\x20image-heavy)\x20are\x20network-sensitive:\x20compress\x20images\x20before\x20generate,\x20retry\x20transient\x20upload\x20failures,\x20and\x20verify\x20the\x20returned\x20public\x20URL\x20afterwards\x20with\x20type=\x27verify\x27.']},{'name':'messenger_operation','summary':'Encrypted\x20messenger\x20—\x20watch/send\x20messages,\x20WTS,\x20friendslist,\x20blacklist,\x20guardlist.','actions':['watch_conversations','send_message','send_file','send_required_info','watch_messages','save_attachment','generate_wts','verify_wts','sign_wts','wts2html','proof_message','blacklist','friendslist','guardlist','settings','mark_messages_as_viewed','mark_conversation_as_viewed','pull_messages'],'notes':['Requires\x20messenger-enabled\x20account.','30s\x20timeout\x20—\x20network\x20operations.','Attachment\x20messages\x20return\x20byte-free\x20descriptors\x20(msg.attachment;\x20plaintext\x20is\x20undefined).\x20Use\x20save_attachment\x20{messageId}\x20to\x20persist\x20the\x20file\x20(e.g.\x20before\x20verify_wts);\x20bytes\x20are\x20never\x20embedded\x20in\x20message\x20outputs.','send_required_info\x20assembles\x20selected\x20LocalInfo\x20fields\x20into\x20one\x20E2E\x20message\x20(\x27field:\x20value\x27\x20lines)\x20—\x20the\x20dedicated\x20path\x20for\x20delivering\x20customer_required\x20info.','pull_messages\x20supports\x20allAccounts/accounts\x20for\x20one\x20bounded-concurrency\x20fan-out\x20across\x20accounts.']},{'name':'guard2file','summary':'Export\x20a\x20Guard\x20object\x27s\x20definition\x20to\x20local\x20JSON/Markdown\x20for\x20editing.','notes':['Read-only\x20—\x20use\x20query_toolkit\x20for\x20on-chain\x20queries.']},{'name':'machineNode2file','summary':'Export\x20a\x20Machine\x20object\x27s\x20node\x20definition\x20to\x20local\x20JSON/Markdown\x20for\x20editing.','notes':['Read-only\x20—\x20use\x20query_toolkit\x20for\x20on-chain\x20queries.']},{'name':'query_toolkit','summary':'Query\x20toolkit\x20covering\x20local\x20device\x20data,\x20on-chain\x20blockchain\x20data,\x20and\x20one-call\x20business-intelligence\x20panoramas/review\x20packs.','actions':['local_mark_list','account_list','local_info_list','local_names','token_list','account_balance','onchain_personal_profile','onchain_objects','onchain_received','onchain_transaction','onchain_block','onchain_object_history','onchain_address_activity','address_profile','address_profiles','migration_preflight','token_value_convert','onchain_last_updated','service_panorama','machine_panorama','object_panorama','review_pack','assemble_context','reverse_map','participation_radar','onchain_topology'],'notes':['Read-only\x20—\x20safe\x20to\x20call\x20without\x20confirmation.','local_names\x20resolves\x20a\x20batch\x20of\x20addresses\x20to\x20account/local_mark\x20names\x20(canonical\x20name\x20source\x20for\x20display);\x20address_profile(s)\x20is\x20the\x20one-stop\x20\x27who/what\x20is\x20this\x20address\x27\x20query\x20(classification\x20+\x20reputation\x20+\x20memberships\x20+\x20reverse\x20bindings;\x20batch\x20up\x20to\x2050);\x20migration_preflight\x20detects\x20existing\x20builds\x20on\x20another\x20network\x20and\x20returns\x20the\x20testnet→mainnet\x20migration\x20checklist.','BI\x20query\x20types\x20(one-call\x20panoramas):\x20service_panorama\x20(full\x20Service\x20context:\x20workflow\x20graph\x20+\x20guards\x20+\x20trust\x20+\x20supply\x20chain\x20+\x20BusinessReport\x20+\x20recent\x20orders),\x20machine_panorama\x20(head\x20+\x20fields\x20+\x20workflow\x20graph\x20+\x20Progress\x20list),\x20object_panorama\x20(Progress/Demand/Order/Arb/Repository\x20detail\x20pages),\x20review_pack\x20(typed\x20ReviewPack\x20for\x20the\x20client\x27s\x20ReviewPackRenderer),\x20assemble_context\x20(semantic\x20context\x20from\x20on-chain\x20objects),\x20reverse_map\x20(deterministic\x20L4→L1\x20business\x20report\x20—\x20merchant\x20profile\x20/\x20user\x20risk\x20/\x20game\x20theory),\x20participation_radar\x20(in-flight\x20order\x20participation\x20analysis\x20for\x20ONE\x20account).','onchain_topology\x20=\x20graph\x20evaluation\x20of\x20ONE\x20object\x20(trust\x20+\x20risk\x20+\x20completeness\x20+\x20coverage\x20+\x20unverified\x20over\x20its\x20workflow/guard/fund\x20topology)\x20—\x20the\x20unified\x20read-side\x20trust/risk\x20surface;\x20use\x20when\x20the\x20user\x20asks\x20\x27is\x20this\x20service\x20trustworthy?\x27\x20or\x20\x27should\x20I\x20buy?\x27.']},{'name':'onchain_table_data','summary':'Dynamic\x20table\x20data\x20queries\x20—\x20paginated\x20table\x20queries\x20and\x20specific\x20table\x20item\x20lookups.','actions':['onchain_table','onchain_table_item_repository_data','onchain_table_item_permission_perm','onchain_table_item_entity_registrar','onchain_table_item_entity_linker','onchain_table_item_entity_contact','onchain_table_item_object_linker_core','onchain_table_item_object_linker_tx','onchain_table_item_reward_record','onchain_table_item_demand_presenter','onchain_table_item_treasury_history','onchain_table_item_machine_node','onchain_table_item_progress_history','onchain_table_item_address_mark','onchain_table_item_entity_order','onchain_orders_of_user','onchain_orders_of_users','onchain_affiliations_of_object','onchain_table_item_generic'],'notes':['Read-only\x20—\x20safe\x20for\x20exploration.','object_linker\x20core\x20(0xaae)\x20=\x20default\x20reverse\x20lookup\x20(bounded\x20core\x20objects);\x20object_linker\x20tx\x20(0xaaf)\x20=\x20operational\x20reverse\x20lookup\x20(orders/progress,\x20lossy\x20FIFO).','entity_order\x20(0xaa8)\x20=\x20global\x20entity->orders\x20reverse\x20index;\x20onchain_orders_of_user\x20resolves\x20each\x20order\x20to\x20its\x20full\x20on-chain\x20Order\x20object\x20with\x20role\x20attributes\x20(is_owner/is_agent).']},{'name':'onchain_events','summary':'Watch\x20on-chain\x20events\x20by\x20type\x20—\x20arbitration,\x20order,\x20progress,\x20demand,\x20entity.','notes':['Read-only\x20—\x20use\x20cursor\x20for\x20pagination.']},{'name':'wowok_buildin_info','summary':'Protocol\x20info\x20—\x20constants,\x20built-in\x20permissions,\x20common\x20mistakes,\x20guard\x20instructions,\x20network,\x20value\x20types,\x20bridge\x20tokens.','actions':['constants','built-in\x20permissions','common\x20mistakes','guard\x20instructions','current\x20network','value\x20types','mainnet\x20bridge\x20tokens'],'notes':['Read-only\x20—\x20authoritative\x20protocol\x20reference.','Use\x20\x27common\x20mistakes\x27\x20before\x20submitting\x20an\x20operation\x20to\x20learn\x20known\x20field-name/unit/workflow\x20pitfalls.']},{'name':'schema_query','summary':'Look\x20up\x20JSON\x20Schemas\x20for\x20MCP\x20tools\x20and\x20on-chain\x20operations\x20—\x20the\x20authoritative\x20reference.\x20Also\x20serves\x20sunk\x20knowledge:\x20tool\x20reference,\x20Guard\x20design\x20patterns,\x20safety\x20rules.','actions':['list','get','get_output','get_field','search','list_operations','get_guard_templates','get_tool_reference','get_guard_design_patterns','get_safety_rules'],'notes':['Always\x20check\x20schema\x20before\x20calling\x20an\x20unfamiliar\x20tool.','get_field\x20takes\x20a\x20dot-path\x20(field_path)\x20for\x20single-field\x20lookup.','get_tool_reference/get_guard_design_patterns/get_safety_rules\x20expose\x20the\x20knowledge\x20sunk\x20from\x20the\x20wowok-tools/guard/safety\x20skills\x20—\x20no\x20skills\x20installation\x20required.']},{'name':'bridge_operation','summary':'Cross-chain\x20bridge\x20between\x20WOW\x20and\x20EVM\x20(Ethereum\x20mainnet).\x20Mainnet\x20only.','actions':['cross_chain_wow_to_evm','cross_chain_evm_to_wow','withdraw','query_active_evm_account','query_supported_evm_chains','query_supported_tokens','query_transfer_list','query_transfer_status','manage_evm_rpc'],'notes':['Only\x20WOW\x20mainnet\x20provides\x20cross-chain\x20functionality.']},{'name':'config_operation','summary':'Runtime\x20service\x20toggles\x20—\x20enable/disable\x20Phase\x202\x20services\x20without\x20restart.','actions':['list','toggle','enable','disable','reset','info'],'notes':['GLM5:\x20harness\x20is\x20default\x20ON\x20with\x20tiered\x20enforcement\x20(off/lightweight/full).']},{'name':'evaluation_operation','summary':'Pluggable\x20business\x20evaluations\x20—\x20match\x20/\x20compose\x20/\x20game\x20(node\x20+\x20path)\x20/\x20evidence\x20review\x20/\x20discovery\x20/\x20market\x20/\x20arbitration\x20score\x20with\x20user\x20injection.','actions':['demand_match','service_match','capability_gap','compose_service','node_game','arb_game','path_reasoning','evidence_review','discover_services','discover_demands','market_metrics','market_operations','anti_cheat','match_discover','arbitration_score','account_events'],'notes':['Read-only;\x20the\x20role\x20decides\x20and\x20acts\x20via\x20onchain_operations.','path_reasoning\x20=\x20path-level\x20game\x20(full-route\x20enumeration\x20+\x20ranking);\x20node_game\x20=\x20single-node\x20best\x20move.','evidence_review\x20=\x20deterministic\x20off-chain\x20evidence\x20closure\x20gate\x20(auto_pass/auto_reject/manual_review).','discover_services\x20=\x20active\x20supply\x20discovery\x20(GraphQL\x20transport\x20required):\x20enumerate\x20all\x20shared\x20Services,\x20location-gate\x20by\x20sensitivity\x20(strict/near/logistics),\x20ranked\x20+\x20consent-gated\x20scope\x20expansion.\x20Passive\x20side\x20=\x20post\x20a\x20Demand\x20(DemandPresenter).','match_discover\x20=\x20one-shot\x20intent→service\x20orchestration\x20(enumerate\x20+\x20location\x20gate\x20+\x206-dimension\x20scoring);\x20discover_demands\x20=\x20supplier-side\x20demand\x20enumeration;\x20market_metrics/market_operations\x20=\x20market\x20measurement\x20(GraphQL\x20required).','arbitration_score\x20=\x20dual-perspective\x20arbitration\x20trust\x20(user-trust\x20+\x20merchant-fairness,\x20combined\x200-100);\x20anti_cheat\x20=\x20fake-review/wash-order\x20detection;\x20account_events\x20=\x20account\x20attention\x20feed\x20(read-only).']},{'name':'watch_operation','summary':'Identity-centric\x20on-chain\x20console\x20—\x20resolve\x20who\x20the\x20account\x20is\x20against\x20an\x20object,\x20expand\x20its\x20relations,\x20and\x20enumerate\x20actionable\x20operations.','actions':['focus','expand','actions'],'notes':['Read-only;\x20distinct\x20from\x20query_toolkit\x20/\x20onchain_table_data\x20(pure\x20data,\x20no\x20identity).','focus\x20=\x20identity\x20resolution\x20(manifest\x20on-chain\x20role\x20⊕\x20persona)\x20+\x20base\x20data;\x20neutral\x20→\x20objective\x20narration,\x20operative\x20role\x20→\x20game\x20reasoning.','expand\x20=\x20direct\x20relations\x20+\x20Service\x20transparent\x20sub-order\x20purchasing\x20graph\x20(frozen\x20forward\x20guards\x20→\x20purchased\x20sub-services\x20+\x20proofs).','actions\x20=\x20actionable\x20operations\x20with\x20executability\x20judgment\x20(order-holder\x20/\x20permission-index\x20/\x20named-operator\x20paths).']},{'name':'persona_operation','summary':'User\x20identity\x20setting\x20(persona)\x20—\x20preferences,\x20strategy,\x20rules,\x20spec;\x20long-term\x20+\x20current\x20layers\x20+\x20strategy→lever\x20mapping\x20+\x20region\x20hint.','actions':['get','list','set','analyze','apply','sync','remove','strategy','region_hint','distill'],'notes':['Read/write\x20local\x20state;\x20account\x20persona\x20overrides\x20system;\x20current\x20overrides\x20long-term.','strategy\x20resolves\x20merchant\x20strategy\x20statements\x20into\x20deterministic\x20infrastructure\x20levers\x20(discount/reward/buy_guard/machine_design).','region_hint\x20reads\x20the\x20local\x20delivery\x20address\x20as\x20a\x20matching\x20hint;\x20`propose`\x20returns\x20a\x20consent-gated\x20save\x20proposal\x20(never\x20auto-writes).','distill\x20turns\x20one\x20goal\x27s\x20memory\x20(outcome,\x20process\x20problems/feedback,\x20objects)\x20into\x20a\x20CURRENT-layer\x20proposal\x20—\x20never\x20auto-writes;\x20persist\x20via\x20set/apply\x20after\x20user\x20confirmation.\x20Industry\x20pack.json\x20files\x20are\x20read-only\x20knowledge\x20and\x20never\x20receive\x20user\x20data.']},{'name':'employee_operation','summary':'Merchant\x20employee\x20organizational\x20profile\x20(LOCAL)\x20+\x20reaction\x20KPI\x20+\x20liability\x20resolution\x20+\x20incentive\x20suggestion.','actions':['set','get','remove','assess_kpi','resolve_liability','suggest_incentive'],'notes':['LOCAL\x20ONLY\x20—\x20on-chain\x20authorization\x20lives\x20in\x20the\x20merchant\x27s\x20Permission\x20(namedOperator/entity).','assess_kpi:\x20node\x20reaction\x20speed\x20vs\x20budget\x20(explicit\x20>\x20stored\x20profile\x20>\x2048h\x20default).\x20Timestamps\x20explicit\x20OR\x20auto-derived\x20from\x20the\x20progress\x20object\x27s\x20monitored\x20ProgressEvents\x20via\x20`progress`;\x20explicit\x20values\x20override\x20derived.','resolve_liability:\x20internal\x20cost\x20split\x20(merchant/employee,\x20hybrid\x20threshold);\x20outward\x20liability\x20toward\x20the\x20customer\x20is\x20ALWAYS\x20the\x20merchant\x27s;\x20order\x20user\x20must\x20be\x20compensated\x20before\x20the\x20workflow\x20resumes.','suggest_incentive:\x20KPIs\x20+\x20WIP\x20acceptance\x20+\x20liability\x20→\x20Reward\x20suggestion\x20(reward_grant/compensation_offset/correction_notice/none).\x20Suggestion\x20ONLY\x20—\x20merchant\x20confirms\x20and\x20executes\x20the\x20on-chain\x20ops\x20separately.']},{'name':'keeper_operation','summary':'Who-benefits-who-pushes\x20keeper:\x20scans\x20the\x20monitor\x20scope\x20for\x20actionable\x20state\x20(unclaimed\x20payments,\x20advanceable\x20workflow\x20nodes),\x20routes\x20tasks\x20to\x20beneficiaries;\x20manual\x20dismiss/execute\x20+\x20standing\x20auto-execute\x20rules.','actions':['tasks','dismiss','execute','rules','rule_set','rule_remove','config','config_set','scan','status'],'notes':['The\x20chain\x20has\x20NO\x20time-triggered\x20execution\x20—\x20the\x20keeper\x20scans\x20on\x20the\x20monitor\x20loop\x20cadence\x20and\x20surfaces\x20tasks\x20to\x20their\x20beneficiary.','execute\x20runs\x20the\x20on-chain\x20op\x20for\x20one\x20task\x20(user\x20decision);\x20rule_set\x20authorizes\x20auto-execution\x20per\x20detector\x20kind\x20(bounded\x20by\x20config\x20budget/cooldown).','Detectors\x20v1:\x20payment_unclaimed\x20(funds\x20sitting\x20claimable),\x20progress_actionable\x20(a\x20workflow\x20node\x20the\x20beneficiary\x20can\x20advance).']},{'name':'intent_radar','summary':'User\x20business\x20intent\x20×\x20chain\x20event\x20matching\x20—\x20persist\x20intents,\x20score\x20events\x20against\x20them.','actions':['save','list','remove','match'],'notes':['Read-only\x20w.r.t.\x20chain;\x20industry/keywords\x20resolved\x20once\x20at\x20save;\x20events\x20supplied\x20or\x20auto-pulled.']},{'name':'goal_operation','summary':'GoalEngine\x20(K3\x2024)\x20—\x20record\x20a\x20user\x20goal\x20and\x20drive\x20it\x20through\x20the\x20nine-station\x20lifecycle\x20(RECOGNIZE→…→COMPLETE)\x20with\x20monitor\x20auto-binding\x20and\x20plan-approval\x20confirm-gate\x20downgrade;\x20also\x20hosts\x20the\x20C1-C4\x20planning\x20pipeline\x20+\x20merchant\x20onboarding\x20wizard.','actions':['create','list','get','approve','advance','pause','complete','abandon','delete','analyze_intent','aggregate_risks','trace_substeps','merchant_guide'],'common_params':{'id':'Goal\x20id\x20(goal_…)\x20—\x20required\x20for\x20get/approve/advance/pause/complete/abandon/delete.','intent_text':'create:\x20raw\x20user\x20intent;\x20goal_type\x20auto-classified\x20(override\x20with\x20goal_type).','account':'create:\x20bind\x20a\x20local\x20account\x20(preflight;\x20goal\x20starts\x20at\x20\x27bound\x27).','stage':'advance:\x20forward-only\x20target\x20stage;\x20\x27paused\x27\x20holds\x20from\x20anywhere.','objects':'advance:\x20ACT-station\x20objects\x20[{type,\x20object}]\x20(deduped).','force':'complete:\x20skip\x20on-chain\x20completion\x20verification\x20(audited\x20as\x20outcome.forced).'},'follow_ups':['monitor_events\x20(goal\x20progress\x20surfaces\x20in\x20the\x20todo\x20stream)','onchain_operations\x20(execute\x20plan\x20steps\x20with\x20env.plan_approval)'],'notes':['Near-duplicate\x20create\x20ADOPTS\x20the\x20active\x20same-type\x20same-account\x20goal\x20(intent\x20Jaccard\x20≥\x200.6)\x20instead\x20of\x20forking.','approve\x20registers\x20a\x20plan\x20approval:\x20calls\x20carrying\x20env.plan_approval=<goal\x20id>\x20auto-pass\x20fail-open\x20ConfirmGate\x20levels\x20(standard/none);\x20fail-closed\x20levels\x20(irreversible/publish/amount)\x20always\x20still\x20ask.','Entering\x20\x27monitoring\x27\x20auto-binds\x20monitor\x20focus\x20(reason=\x27goal\x27,\x20goal_id-stamped)\x20for\x20the\x20goal\x27s\x20objects;\x20demand\x20goals\x20also\x20open\x20a\x20radar\x20intent.\x20complete/abandon\x20tear\x20down\x20ONLY\x20this\x20goal\x27s\x20bindings.','complete\x20verifies\x20the\x20goal-type\x20completion\x20conjunction\x20against\x20chain\x20state\x20(read-only);\x20force=true\x20bypasses\x20and\x20is\x20audited.','delete\x20removes\x20a\x20terminal\x20goal\x20entirely\x20(record\x20+\x20TaskProcess\x20dir);\x20force=true\x20extends\x20it\x20to\x20non-terminal\x20goals\x20(monitor\x20teardown\x20first).','C1-C4\x20planning\x20pipeline\x20(GLM5-31\x20§V3/V4):\x20analyze_intent\x20(intent\x20→\x20objects\x20+\x20puzzle\x20snapshots)\x20→\x20aggregate_risks\x20(puzzles\x20OR\x20intent\x20→\x20calibrated\x20risks\x20+\x20RISK_BLOCKED\x20status)\x20→\x20trace_substeps\x20(substep\x20records\x20→\x20DAG\x20coherence\x20+\x20D-10\x20verdict);\x20merchant_guide\x20=\x2010-step\x20onboarding\x20wizard\x20(stateless\x20guide_state,\x20never\x20executes\x20on-chain\x20—\x20materialize\x20via\x20onchain_operations).\x20All\x20four\x20are\x20pure\x20transformations.']},{'name':'monitor_events','summary':'Persistent\x20monitor\x20event\x20store\x20(shared\x20with\x20the\x20client\x20Monitor\x20page)\x20—\x20paginated\x20events\x20with\x20read\x20flags;\x20mark\x20read/unread.','actions':['query','mark_read','mark_all_read'],'notes':['Events\x20captured\x20by\x20the\x20resident\x20MonitorLoop\x20(client\x20sidecar,\x20or\x20stdio\x20MCP\x20server\x20with\x20MONITOR_LOOP=1)\x20across\x209\x20modules,\x20stored\x20APPEND-ONLY\x20in\x20SQLite\x20(survives\x20restarts)\x20with\x20per-event\x20read\x20flags.','query\x20=\x20paginated\x20newest-first\x20with\x20module/event_type/since/until\x20filters\x20+\x20module_counts/unread_by_module/total_unread;\x20relevant_only\x20(default\x20true)\x20restricts\x20to\x20scope-closure/focus/filter\x20hits\x20(de-noised\x20todo\x20stream);\x20with_reason\x20attaches\x20the\x20relevance\x20annotation\x20+\x20delivered\x20flag;\x20mark_read\x20=\x20idempotent\x20per-event\x20(\x27<eventSeq>:<txDigest>\x27);\x20mark_all_read\x20=\x20optionally\x20module-scoped.','Cross-process:\x20read\x20state\x20is\x20SHARED\x20with\x20the\x20client\x20app\x20(same\x20SQLite\x20store)\x20—\x20marking\x20read\x20here\x20clears\x20the\x20client\x20Monitor\x20unread\x20badge\x20and\x20vice\x20versa.']},{'name':'monitor_subscription','summary':'Monitor\x20subscription\x20config\x20—\x20scope-closure\x20rules,\x20focus\x20objects,\x20per-type\x20todo\x20switches,\x20conditional\x20filters;\x20scope\x20preview\x20+\x20filter\x20dry-run.','actions':['get','save','reset','scope_preview','test_filter'],'notes':['Single\x20configuration\x20entry\x20point\x20for\x20monitor\x20v4\x20(client\x20settings\x20panel\x20and\x20agents\x20share\x20it);\x20save/reset\x20merge\x20+\x20clamp\x20loop\x20params,\x20then\x20trigger\x20an\x20immediate\x20scope\x20re-resolve\x20and\x20schedule\x20a\x20backfill\x20when\x20the\x20closure\x20changed.','scope_preview\x20lists\x20the\x20resolved\x20closure\x20grouped\x20by\x20layer\x20(accounts/permissions/managed_objects/services/orders/order_children/focus)\x20with\x20pagination\x20—\x20inspect\x20before\x20tuning\x20rule\x20switches.','test_filter\x20dry-runs\x20a\x20filter\x20draft\x20over\x20the\x20most\x20recent\x20captured\x20events\x20(default\x20200,\x20max\x201000)\x20returning\x20matched/scanned\x20counts\x20+\x20up\x20to\x205\x20samples\x20—\x20preview\x20noise\x20BEFORE\x20saving.','Capture\x20is\x20unaffected\x20by\x20delivery\x20switches\x20EXCEPT\x20NewPaymentEvent\x20(captured\x20only\x20when\x20switched\x20ON).']},{'name':'industry_pack_operation','summary':'Industry\x20knowledge\x20pack\x20lifecycle\x20—\x20scaffold\x20(merged\x20v2\x20template),\x20scan/register,\x20layer\x20get,\x20diff,\x20reset-to-template,\x20plus\x20industry-dir\x20file\x20operations\x20and\x20the\x20industry\x20mode\x20registry\x20(GLM6/92\x20§E).','actions':['scaffold','list','scan','resolve','list_files','read_file','write_file','get','diff','reset','delete_file','create_file','create_dir','copy','move','rename','recommend_industry','list_modes','derive_user_mode','evolve_user_mode','register_user_mode','unregister_user_mode','register_custom_metric','register_custom_constraint','list_metrics_constraints'],'notes':['LOCAL\x20ONLY\x20—\x20filesystem\x20+\x20in-memory\x20registry;\x20never\x20mutates\x20chain\x20state.','Merged\x20v2\x20layout:\x20pack.json\x20(annotated\x20with\x20_schema/_doc\x20comment\x20fields\x20+\x20personae)\x20+\x20playbook.md;\x20legacy\x20split-file\x20layouts\x20still\x20read\x20for\x20backward\x20compatibility.','reset\x20restores\x20a\x20file\x20or\x20entire\x20pack\x20folder\x20to\x20its\x20pristine\x20annotated\x20template\x20—\x20user\x20edits\x20beyond\x20the\x20target\x20are\x20preserved.','Mode\x20registry\x20(GLM6/92\x20§E):\x20recommend_industry\x20(top-3\x20similar\x20industries\x20+\x20verified\x20reference\x20examples),\x20list_modes,\x20derive_user_mode\x20(customize\x20a\x20builtin),\x20evolve_user_mode,\x20register_user_mode\x20(fully\x20custom;\x20R-M1-11\x20enforced\x20on\x20machine_shape),\x20unregister_user_mode,\x20register_custom_metric\x20/\x20register_custom_constraint\x20(extend\x20evaluation\x20registries),\x20list_metrics_constraints.']},{'name':'benchmark_migration_operation','summary':'MD\x20industry-archetype\x20templates\x20(hot-loaded\x20from\x20.wowok/industry/<industry>/templates/,\x2012\x20built-ins:\x206\x20industries\x20x\x20leader\x20+\x20challenger)\x20+\x20pre-deploy\x20risk\x20scan\x20+\x20one-click\x20competitor\x20migration\x20(import\x20→\x20review\x20→\x20apply\x20via\x20the\x20merchant-guide\x20pipeline).','actions':['template_list','template_get','template_generate','template_scan','migration_import','migration_review','migration_apply'],'common_params':{'template_id':'Template\x20id\x20\x27<industry>/<variant>\x27\x20(required\x20for\x20template_get\x20/\x20template_generate\x20/\x20template_scan\x20/\x20migration_apply),\x20e.g.\x20\x27retail/scale-marketplace\x27.','industry':'Industry\x20filter\x20for\x20template_list;\x20industry\x20hint\x20for\x20migration_import.','description':'Business/competitor\x20description\x20(required\x20for\x20migration_import;\x20optional\x20intent\x20text\x20for\x20template_generate).','url':'Competitor\x20store/profile\x20URL\x20for\x20migration_import\x20(recorded\x20as\x20provenance\x20only).','fee_overrides':'Template\x20fee-parameter\x20overrides\x20for\x20template_generate.','log':'A\x20prior\x20MigrationLog\x20(required\x20for\x20migration_review).','network':'testnet\x20|\x20mainnet\x20for\x20migration_import\x20/\x20migration_apply\x20(default\x20testnet).'},'notes':['Deterministic\x20knowledge\x20lookups\x20+\x20planning;\x20never\x20mutates\x20chain\x20state\x20—\x20template_generate\x20/\x20migration_apply\x20emit\x20creation\x20plans\x20only\x20(materialize\x20via\x20onchain_operations).','Templates\x20are\x20zod-validated\x20MD\x20files\x20hot-loaded\x20from\x20.wowok/industry/<industry>/templates/\x20(the\x20client\x20industry-drawer\x20tree;\x20root\x20env-overridable\x20via\x20WOWOK_TEMPLATES_DIR);\x20the\x2012\x20built-in\x20archetypes\x20are\x20seeded\x20idempotently\x20and\x20user\x20edits\x20are\x20never\x20overwritten.','template_scan\x20runs\x20the\x20pre-deploy\x20risk\x20scan\x20(synthetic\x20draft\x20topology\x20through\x20the\x20same\x20rule\x20surface\x20as\x20on-chain\x20analyze\x20+\x20static\x20R1-R10\x20checks);\x20CRITICAL\x20findings\x20block\x20template_generate\x20/\x20migration_apply.','migration_import\x20returns\x20a\x20MigrationLog\x20with\x20mapped\x20/\x20unmapped\x20/\x20manual_review\x20entries,\x20WoWok\x20advantages,\x20customizable\x20business-module\x20ids,\x20a\x20merchant-vs-supplier\x20role\x20assessment\x20and\x20a\x20dry-run\x20risk\x20check.','migration_review\x20surfaces\x20counts\x20+\x20risk\x20status\x20for\x20user\x20confirmation\x20before\x20migration_apply.','mainnet\x20requires\x20explicit\x20user\x20confirmation;\x20the\x20default\x20network\x20is\x20testnet.']},{'name':'strategy_review_operation','summary':'Posture-weighted\x20operating\x20scorecard\x20for\x20one\x20(account,\x20industry):\x20collect\x20evidence\x20into\x20append-only\x20local\x20snapshots,\x20assemble\x20periodic\x20reviews\x20with\x20deterministic\x20pricing/posture\x20advice\x20and\x20current-layer-only\x20persona\x20proposals\x20(never\x20auto-applied).','actions':['collect','review','list_snapshots'],'notes':['Chain\x20reads\x20+\x20local\x20SQLite\x20KV\x20snapshots\x20only;\x20never\x20mutates\x20chain\x20state\x20and\x20never\x20writes\x20the\x20persona.','collect\x20gathers\x2013\x20catalog\x20metrics\x20from\x206\x20evidence\x20sources\x20(journey\x20funnel/order\x20flow/market\x20metrics/discovery\x20competitor\x20count/arbitration\x20trust/account\x20attention);\x20source\x20failures\x20degrade\x20metrics\x20to\x20unavailable/error,\x20never\x20zero-filled;\x20snapshot\x20append\x20failure\x20is\x20fail-soft\x20(stored:false).','review\x20does\x20NOT\x20persist:\x20fresh\x20collection\x20+\x20delta\x20against\x20latest\x20stored\x20snapshot;\x200–100\x20score\x20renormalized\x20over\x20available\x20anchored\x20metrics\x20under\x20volume/balanced/margin\x20weights;\x20cadence\x20from\x20the\x20industry\x20catalog\x20(weekly/two-week/monthly);\x20≤2\x20proposals,\x20each\x20target_layer=\x27current\x27\x20with\x20apply_via\x20persona_operation\x20apply\x20—\x20the\x20user\x20must\x20apply\x20explicitly.','Posture\x20resolution:\x20explicit\x20posture\x20arg\x20→\x20merchant\x20posture\x20in\x20the\x20effective\x20persona\x20→\x20balanced.']},{'name':'workspace_operation','summary':'Local\x20workspace\x20directory\x20(`.wowok/workspace`)\x20—\x20generated\x20review\x20files\x20(machine/guard/wts/wip\x20JSON)\x20and\x20user\x20documents:\x20list/read/search/glob/edit/write\x20+\x20file\x20operations.','actions':['resolve','list','read','write','delete','create_file','create_dir','copy','move','rename','search','glob','edit'],'notes':['LOCAL\x20ONLY\x20—\x20filesystem\x20operations\x20confined\x20to\x20the\x20workspace\x20root;\x20never\x20mutates\x20chain\x20state.','read\x20is\x20the\x20supported\x20way\x20to\x20load\x20a\x20generated\x20JSON\x20as\x20AI\x20context\x20before\x20editing/submitting;\x20optional\x20offset/limit\x20line\x20slicing\x20(1-based,\x20max\x202000\x20lines)\x20and\x20encoding=\x27base64\x27\x20for\x20raw\x20bytes\x20(≤10MB).','search:\x20regex\x20content\x20search\x20(pattern;\x20optional\x20path\x20scope,\x20glob\x20basename\x20filter,\x20ignore_case,\x20max_results\x20≤200,\x20context_lines\x20≤5);\x20skips\x20binary-looking\x20and\x20>5MB\x20files.','glob:\x20wildcard\x20listing\x20on\x20workspace-relative\x20paths\x20—\x20\x27**\x27\x20spans\x20directory\x20segments,\x20\x27*\x27\x20stays\x20within\x20one\x20segment,\x20\x27?\x27\x20=\x20one\x20char.','edit:\x20exact\x20string\x20replacement\x20(path\x20+\x20old_string\x20+\x20new_string);\x20errors\x20when\x20old_string\x20is\x20non-unique\x20unless\x20replace_all=true;\x20refuses\x20files\x20>2MB.']},{'name':'workflow_operation','summary':'Local-account\x20workflow\x20view\x20—\x20list\x20active\x20Progress\x20that\x20at\x20least\x20one\x20local\x20account\x20can\x20advance\x20(permission\x20+\x20guard\x20+\x20executable\x20accounts),\x20advance/hold/unhold\x20a\x20forward,\x20and\x20view\x20a\x20progress\x27s\x20on-chain\x20operation\x20history.','actions':['list','operate','history'],'notes':['list:\x20permission-aware\x20—\x20a\x20forward\x20is\x20executable\x20when\x20(a)\x20namedOperator=\x27\x27\x20and\x20account\x20is\x20order\x20holder,\x20(b)\x20namedOperator=name\x20and\x20account\x20is\x20in\x20progress.namedOperator[name],\x20or\x20(c)\x20permissionIndex\x20set\x20and\x20account\x20is\x20in\x20permission.admin/table.','operate:\x20delegates\x20to\x20the\x20on-chain\x20progress\x20operation\x20(guard-aware);\x20op\x20∈\x20next/hold/unhold/adminUnhold.','history:\x20incrementally\x20syncs\x20a\x20progress\x27s\x20ON-CHAIN\x20Progress.history\x20(append-only\x20u64\x20index)\x20into\x20the\x20local\x20SQLite\x20mirror\x20via\x20a\x20per-progress\x20cursor\x20(only\x20new\x20records\x20pulled),\x20returns\x20the\x20migration\x20timeline\x20newest-first\x20with\x20each\x20migration\x27s\x20session\x20snapshot\x20(forwards\x20/\x20operator\x20/\x20weight\x20/\x20time);\x20runs\x2090-day\x20retention\x20cleanup\x20by\x20default.']},{'name':'permission_operation','summary':'Local-account\x20Permission\x20overview\x20—\x20list\x20Permissions\x20related\x20to\x20local\x20accounts\x20(via\x20entity_permission\x20index)\x20with\x20owner/admin/entity\x20breakdown\x20+\x20related\x20objects\x20via\x20object-linker\x20indexes.','actions':['list'],'notes':['Read-only;\x20reverse-looks-up\x20local\x20accounts\x20via\x20entity_permission\x20@0xaad,\x20then\x20merges/dedups\x20permissions.','Related\x20objects\x20resolved\x20via\x20object-linker\x20reverse\x20indexes\x20(0xaae\x20core\x20/\x200xaaf\x20tx)\x20binding\x20edges,\x20grouped\x20by\x20type\x20via\x20first-byte\x20address\x20tag.','Latest\x20update\x20time\x20derived\x20from\x20the\x20Permission\x27s\x20previousTransaction.']},{'name':'ask_user','summary':'Structured\x20user\x20elicitation\x20—\x20ask\x20the\x20user\x20to\x20choose\x20between\x202-8\x20concrete\x20options\x20and\x20receive\x20a\x20validated\x20structured\x20answer\x20(MCP\x202.0\x20elicitation\x20/\x20desktop\x20option\x20card).','common_params':{'question':'The\x20single\x20decision\x20needed\x20from\x20the\x20user\x20(1-1000\x20chars).','options':'2-8\x20self-contained\x20{id,label,description?}\x20choices.','recommended_id':'id\x20of\x20the\x20professionally\x20recommended\x20option\x20(optional).','multi_select':'true\x20when\x20options\x20are\x20combinable\x20(boolean\x20toggle\x20per\x20option).','allow_freeform':'true\x20to\x20permit\x20an\x20additional\x20free-text\x20answer.','context':'Optional\x20short\x20explanation\x20of\x20why\x20the\x20decision\x20is\x20needed.'},'notes':['Use\x20when\x20a\x20business\x20decision\x20belongs\x20to\x20the\x20user\x20and\x20continuing\x20requires\x20it;\x20never\x20guess\x20or\x20silently\x20default\x20an\x20unanswered\x20choice.','Desktop\x20clients\x20render\x20an\x20option\x20card;\x20MCP\x202.0\x20transports\x20fulfil\x20via\x20elicitation/create;\x20unsupported\x20clients\x20should\x20fall\x20back\x20to\x20a\x20numbered\x20prose\x20question.','action\x20decline/cancel\x20means\x20STOP\x20and\x20ask\x20how\x20to\x20proceed\x20in\x20plain\x20text\x20—\x20do\x20not\x20execute\x20a\x20default\x20path.','Not\x20a\x20safety\x20confirmation\x20—\x20irreversible/publish/amount\x20gates\x20remain\x20handled\x20by\x20confirm_gate.']}];export function getToolReference(a){return TOOLS_REFERENCE['find'](b=>b['name']===a);}export function searchToolReference(a){const b=a['toLowerCase']();return TOOLS_REFERENCE['filter'](c=>{if(c['name']['toLowerCase']()['includes'](b))return!![];if(c['summary']['toLowerCase']()['includes'](b))return!![];if(c['actions']?.['some'](d=>d['toLowerCase']()['includes'](b)))return!![];return![];});}export function getToolSequence(a){const b=getToolReference(a);if(!b)return undefined;return{'prerequisites':b['prerequisites']??[],'tool':b['name'],'follow_ups':b['follow_ups']??[]};}
1
+ export const TOOLS_REFERENCE=[{'name':'onchain_operations','summary':'On-chain\x20object\x20creation,\x20modification,\x20and\x20publish\x20for\x20all\x2016\x20Wowok\x20object\x20types.','actions':['service','machine','guard','permission','reward','arb','progress','treasury','demand','repository','contact','order','allocation','personal','payment','proof','gen_passport','gen_proof'],'common_params':{'operation_type':'Object\x20type\x20to\x20create/modify\x20(string\x20enum).','data':'Operation\x20payload\x20—\x20shape\x20varies\x20by\x20operation_type.','object':'Object\x20name\x20or\x20address\x20(for\x20modify-by-id).','namedNew':'New\x20object\x20spec\x20(name,\x20description,\x20tags)\x20for\x20create.','env':'Execution\x20environment\x20(account,\x20network,\x20gas_budget).'},'prerequisites':['account_operation\x20(for\x20account\x20setup)'],'follow_ups':['query_toolkit\x20(verify\x20result)','local_mark_operation\x20(tag\x20object)'],'notes':['publish=true\x20is\x20irreversible\x20—\x20use\x20confirm_gate.','Service/Machine\x20require\x20publish\x20after\x20create\x20before\x20they\x20are\x20visible\x20on-chain.','Use\x20schema_query\x20with\x20action=\x27list_operations\x27\x20to\x20see\x20all\x20operation\x20schemas.','NETWORK:\x20by\x20default\x20omit\x20env.network\x20—\x20the\x20operation\x20runs\x20on\x20the\x20user\x27s\x20CURRENT\x20network\x20(the\x20app\x27s\x20active\x20selection);\x20the\x20confirmation\x20card\x20echoes\x20the\x20actual\x20network.\x20Never\x20guess\x20or\x20invent\x20a\x20network\x20on\x20your\x20own\x20initiative.','NETWORK\x20SWITCH\x20(explicit\x20user\x20intent\x20only):\x20when\x20the\x20user\x27s\x20request\x20clearly\x20targets\x20a\x20DIFFERENT\x20network\x20(e.g.\x20\x22create\x20this\x20permission\x20on\x20testnet\x22\x20while\x20the\x20app\x20is\x20on\x20mainnet),\x20set\x20env.network\x20to\x20that\x20network\x20in\x20THIS\x20call\x20—\x20the\x20client\x20pops\x20a\x20mandatory\x20network-switch\x20confirmation\x20card;\x20only\x20after\x20the\x20user\x20approves\x20does\x20the\x20call\x20(and\x20the\x20whole\x20app)\x20run\x20on\x20the\x20new\x20network.\x20If\x20the\x20user\x20declines,\x20do\x20NOT\x20retry\x20on\x20that\x20network\x20—\x20continue\x20on\x20the\x20current\x20one.\x20Read-only\x20queries\x20(query_toolkit\x20context_network)\x20never\x20need\x20this\x20—\x20they\x20select\x20a\x20network\x20per\x20call\x20without\x20switching.']},{'name':'account_operation','summary':'Local\x20wallet\x20management\x20—\x20generate,\x20suspend,\x20resume,\x20faucet,\x20sign\x20data.','actions':['gen','resume','suspend','faucet','operate','sign','list','info'],'common_params':{'name':'Account\x20name\x20(local\x20identifier).','network':'mainnet\x20|\x20testnet\x20(determines\x20RPC).'},'prerequisites':[],'follow_ups':['onchain_operations\x20(use\x20account\x20for\x20signing)'],'notes':['100%\x20LOCAL\x20—\x20keys\x20never\x20leave\x20the\x20device.','faucet\x20only\x20works\x20on\x20testnet.']},{'name':'local_mark_operation','summary':'Local\x20address\x20book\x20—\x20map\x20human-readable\x20names\x20to\x20blockchain\x20addresses\x20with\x20tags.','actions':['add','remove','update','list','query'],'common_params':{'name':'Local\x20name.','address':'Blockchain\x20address.','tags':'Tag\x20array.'},'notes':['100%\x20LOCAL\x20—\x20never\x20on-chain.','Names\x20are\x20accepted\x20by\x20most\x20on-chain\x20query/panorama\x20tools\x20in\x20place\x20of\x20raw\x20addresses.']},{'name':'local_info_operation','summary':'Local\x20private\x20data\x20management\x20—\x20delivery\x20addresses,\x20phone\x20numbers,\x20contacts.','actions':['add','remove','update','list'],'notes':['100%\x20LOCAL\x20—\x20sensitive\x20data,\x20never\x20on-chain.']},{'name':'local_history_operation','summary':'Local\x20Explorer\x20visit\x20history\x20—\x20recently\x20viewed\x20objects,\x20newest\x20first.','actions':['list\x20(default)','add\x20(upsert\x20by\x20key)','remove\x20(by\x20keys)','clear'],'common_params':{'add':'Record\x20visits:\x20{op:\x27add\x27,\x20data:[{key,\x20address,\x20object_type?,\x20network,\x20time}]}.','remove':'Delete\x20entries:\x20{op:\x27remove\x27,\x20keys:[...]}.','clear':'Erase\x20all\x20history:\x20{op:\x27clear\x27}.'},'notes':['100%\x20LOCAL\x20—\x20visit\x20records\x20never\x20leave\x20the\x20device;\x20display\x20names\x20are\x20never\x20stored\x20(resolved\x20live\x20at\x20render).','Omit\x20every\x20operation\x20field\x20to\x20list\x20history\x20(newest\x20first,\x20auto-pruned\x20to\x20last\x2030\x20days\x20/\x20300\x20entries).','detail\x20visits\x20keep\x20the\x20object\x20type\x20tag;\x20each\x20entry\x20stores\x20the\x20stable\x20object\x20key\x20+\x20canonical\x200x\x20address\x20+\x20network\x20+\x20timestamp.']},{'name':'wip_file','summary':'Witness\x20Immutable\x20Promise\x20file\x20operations\x20—\x20generate,\x20verify,\x20sign,\x20convert,\x20and\x20storage\x20(upload/list/delete\x20on\x20the\x20free\x20official\x20store\x20or\x20a\x20custom\x20service).','actions':['generate','verify','sign','wip2html','upload','storage_list','storage_delete'],'notes':['WIP\x20hash\x20must\x20be\x20non-empty\x20—\x20compute\x20actual\x20hash\x20before\x20calling.','Storage\x20decision:\x20storage=\x27store\x27\x20(default)\x20=\x20official\x20FREE\x20store\x20wip.store.wowok.net,\x2010\x20files\x20per\x20account,\x20files\x20retained\x206\x20months\x20(free\x20best-effort\x20service\x20—\x20force\x20majeure\x20excepted;\x20expired\x20files\x20are\x20deleted\x20ONLY\x20by\x20manual\x20admin\x20purge,\x20never\x20automatically);\x20storage=\x27custom\x27\x20+\x20customBaseUrl\x20=\x20your\x20own\x20or\x20a\x20third-party\x20wip\x20storage\x20service\x20(recommended:\x20no\x20store\x20quota,\x20full\x20control).','Network\x20independence:\x20WIP\x20files\x20are\x20off-chain\x20—\x20one\x20upload\x20serves\x20BOTH\x20testnet\x20and\x20mainnet,\x20and\x20storage_list/storage_delete\x20never\x20touch\x20the\x20chain.','Large\x20WIP\x20files\x20(multi-MB,\x20image-heavy)\x20are\x20network-sensitive:\x20compress\x20images\x20before\x20generate,\x20retry\x20transient\x20upload\x20failures,\x20and\x20verify\x20the\x20returned\x20public\x20URL\x20afterwards\x20with\x20type=\x27verify\x27.']},{'name':'messenger_operation','summary':'Encrypted\x20messenger\x20—\x20watch/send\x20messages,\x20WTS,\x20friendslist,\x20blacklist,\x20guardlist.','actions':['watch_conversations','send_message','send_file','send_required_info','watch_messages','save_attachment','generate_wts','verify_wts','sign_wts','wts2html','proof_message','blacklist','friendslist','guardlist','settings','mark_messages_as_viewed','mark_conversation_as_viewed','pull_messages'],'notes':['Requires\x20messenger-enabled\x20account.','30s\x20timeout\x20—\x20network\x20operations.','Attachment\x20messages\x20return\x20byte-free\x20descriptors\x20(msg.attachment;\x20plaintext\x20is\x20undefined).\x20Use\x20save_attachment\x20{messageId}\x20to\x20persist\x20the\x20file\x20(e.g.\x20before\x20verify_wts);\x20bytes\x20are\x20never\x20embedded\x20in\x20message\x20outputs.','send_required_info\x20assembles\x20selected\x20LocalInfo\x20fields\x20into\x20one\x20E2E\x20message\x20(\x27field:\x20value\x27\x20lines)\x20—\x20the\x20dedicated\x20path\x20for\x20delivering\x20customer_required\x20info.','pull_messages\x20supports\x20allAccounts/accounts\x20for\x20one\x20bounded-concurrency\x20fan-out\x20across\x20accounts.']},{'name':'guard2file','summary':'Export\x20a\x20Guard\x20object\x27s\x20definition\x20to\x20local\x20JSON/Markdown\x20for\x20editing.','notes':['Read-only\x20—\x20use\x20query_toolkit\x20for\x20on-chain\x20queries.']},{'name':'machineNode2file','summary':'Export\x20a\x20Machine\x20object\x27s\x20node\x20definition\x20to\x20local\x20JSON/Markdown\x20for\x20editing.','notes':['Read-only\x20—\x20use\x20query_toolkit\x20for\x20on-chain\x20queries.']},{'name':'query_toolkit','summary':'Query\x20toolkit\x20covering\x20local\x20device\x20data,\x20on-chain\x20blockchain\x20data,\x20and\x20one-call\x20business-intelligence\x20panoramas/review\x20packs.','actions':['local_mark_list','account_list','local_info_list','local_names','token_list','account_balance','onchain_personal_profile','onchain_objects','onchain_received','onchain_transaction','onchain_block','onchain_object_history','onchain_address_activity','address_profile','address_profiles','migration_preflight','token_value_convert','onchain_last_updated','service_panorama','machine_panorama','object_panorama','review_pack','assemble_context','reverse_map','participation_radar','onchain_topology'],'notes':['Read-only\x20—\x20safe\x20to\x20call\x20without\x20confirmation.','local_names\x20resolves\x20a\x20batch\x20of\x20addresses\x20to\x20account/local_mark\x20names\x20(canonical\x20name\x20source\x20for\x20display);\x20address_profile(s)\x20is\x20the\x20one-stop\x20\x27who/what\x20is\x20this\x20address\x27\x20query\x20(classification\x20+\x20reputation\x20+\x20memberships\x20+\x20reverse\x20bindings;\x20batch\x20up\x20to\x2050);\x20migration_preflight\x20detects\x20existing\x20builds\x20on\x20another\x20network\x20and\x20returns\x20the\x20testnet→mainnet\x20migration\x20checklist.','BI\x20query\x20types\x20(one-call\x20panoramas):\x20service_panorama\x20(full\x20Service\x20context:\x20workflow\x20graph\x20+\x20guards\x20+\x20trust\x20+\x20supply\x20chain\x20+\x20BusinessReport\x20+\x20recent\x20orders),\x20machine_panorama\x20(head\x20+\x20fields\x20+\x20workflow\x20graph\x20+\x20Progress\x20list),\x20object_panorama\x20(Progress/Demand/Order/Arb/Repository\x20detail\x20pages),\x20review_pack\x20(typed\x20ReviewPack\x20for\x20the\x20client\x27s\x20ReviewPackRenderer),\x20assemble_context\x20(semantic\x20context\x20from\x20on-chain\x20objects),\x20reverse_map\x20(deterministic\x20L4→L1\x20business\x20report\x20—\x20merchant\x20profile\x20/\x20user\x20risk\x20/\x20game\x20theory),\x20participation_radar\x20(in-flight\x20order\x20participation\x20analysis\x20for\x20ONE\x20account).','onchain_topology\x20=\x20graph\x20evaluation\x20of\x20ONE\x20object\x20(trust\x20+\x20risk\x20+\x20completeness\x20+\x20coverage\x20+\x20unverified\x20over\x20its\x20workflow/guard/fund\x20topology)\x20—\x20the\x20unified\x20read-side\x20trust/risk\x20surface;\x20use\x20when\x20the\x20user\x20asks\x20\x27is\x20this\x20service\x20trustworthy?\x27\x20or\x20\x27should\x20I\x20buy?\x27.']},{'name':'onchain_table_data','summary':'Dynamic\x20table\x20data\x20queries\x20—\x20paginated\x20table\x20queries\x20and\x20specific\x20table\x20item\x20lookups.','actions':['onchain_table','onchain_table_item_repository_data','onchain_table_item_permission_perm','onchain_table_item_entity_registrar','onchain_table_item_entity_linker','onchain_table_item_entity_contact','onchain_table_item_object_linker_core','onchain_table_item_object_linker_tx','onchain_table_item_reward_record','onchain_table_item_demand_presenter','onchain_table_item_treasury_history','onchain_table_item_machine_node','onchain_table_item_progress_history','onchain_table_item_address_mark','onchain_table_item_entity_order','onchain_orders_of_user','onchain_orders_of_users','onchain_affiliations_of_object','onchain_table_item_generic'],'notes':['Read-only\x20—\x20safe\x20for\x20exploration.','object_linker\x20core\x20(0xaae)\x20=\x20default\x20reverse\x20lookup\x20(bounded\x20core\x20objects);\x20object_linker\x20tx\x20(0xaaf)\x20=\x20operational\x20reverse\x20lookup\x20(orders/progress,\x20lossy\x20FIFO).','entity_order\x20(0xaa8)\x20=\x20global\x20entity->orders\x20reverse\x20index;\x20onchain_orders_of_user\x20resolves\x20each\x20order\x20to\x20its\x20full\x20on-chain\x20Order\x20object\x20with\x20role\x20attributes\x20(is_owner/is_agent).']},{'name':'onchain_events','summary':'Watch\x20on-chain\x20events\x20by\x20type\x20—\x20arbitration,\x20order,\x20progress,\x20demand,\x20entity.','notes':['Read-only\x20—\x20use\x20cursor\x20for\x20pagination.']},{'name':'wowok_buildin_info','summary':'Protocol\x20info\x20—\x20constants,\x20built-in\x20permissions,\x20common\x20mistakes,\x20guard\x20instructions,\x20network,\x20value\x20types,\x20bridge\x20tokens.','actions':['constants','built-in\x20permissions','common\x20mistakes','guard\x20instructions','current\x20network','value\x20types','mainnet\x20bridge\x20tokens'],'notes':['Read-only\x20—\x20authoritative\x20protocol\x20reference.','Use\x20\x27common\x20mistakes\x27\x20before\x20submitting\x20an\x20operation\x20to\x20learn\x20known\x20field-name/unit/workflow\x20pitfalls.']},{'name':'schema_query','summary':'Look\x20up\x20JSON\x20Schemas\x20for\x20MCP\x20tools\x20and\x20on-chain\x20operations\x20—\x20the\x20authoritative\x20reference.\x20Also\x20serves\x20sunk\x20knowledge:\x20tool\x20reference,\x20Guard\x20design\x20patterns,\x20safety\x20rules.','actions':['list','get','get_output','get_field','search','list_operations','get_guard_templates','get_tool_reference','get_guard_design_patterns','get_safety_rules'],'notes':['Always\x20check\x20schema\x20before\x20calling\x20an\x20unfamiliar\x20tool.','get_field\x20takes\x20a\x20dot-path\x20(field_path)\x20for\x20single-field\x20lookup.','get_tool_reference/get_guard_design_patterns/get_safety_rules\x20expose\x20the\x20knowledge\x20sunk\x20from\x20the\x20wowok-tools/guard/safety\x20skills\x20—\x20no\x20skills\x20installation\x20required.']},{'name':'bridge_operation','summary':'Cross-chain\x20bridge\x20between\x20WOW\x20and\x20EVM\x20(Ethereum\x20mainnet).\x20Mainnet\x20only.','actions':['cross_chain_wow_to_evm','cross_chain_evm_to_wow','withdraw','query_active_evm_account','query_supported_evm_chains','query_supported_tokens','query_transfer_list','query_transfer_status','manage_evm_rpc'],'notes':['Only\x20WOW\x20mainnet\x20provides\x20cross-chain\x20functionality.']},{'name':'config_operation','summary':'Runtime\x20service\x20toggles\x20—\x20enable/disable\x20Phase\x202\x20services\x20without\x20restart.','actions':['list','toggle','enable','disable','reset','info'],'notes':['GLM5:\x20harness\x20is\x20default\x20ON\x20with\x20tiered\x20enforcement\x20(off/lightweight/full).']},{'name':'evaluation_operation','summary':'Pluggable\x20business\x20evaluations\x20—\x20match\x20/\x20compose\x20/\x20game\x20(node\x20+\x20path)\x20/\x20evidence\x20review\x20/\x20discovery\x20/\x20market\x20/\x20arbitration\x20score\x20with\x20user\x20injection.','actions':['demand_match','service_match','capability_gap','compose_service','node_game','arb_game','path_reasoning','evidence_review','discover_services','discover_demands','market_metrics','market_operations','anti_cheat','match_discover','arbitration_score','account_events'],'notes':['Read-only;\x20the\x20role\x20decides\x20and\x20acts\x20via\x20onchain_operations.','path_reasoning\x20=\x20path-level\x20game\x20(full-route\x20enumeration\x20+\x20ranking);\x20node_game\x20=\x20single-node\x20best\x20move.','evidence_review\x20=\x20deterministic\x20off-chain\x20evidence\x20closure\x20gate\x20(auto_pass/auto_reject/manual_review).','discover_services\x20=\x20active\x20supply\x20discovery\x20(GraphQL\x20transport\x20required):\x20enumerate\x20all\x20shared\x20Services,\x20location-gate\x20by\x20sensitivity\x20(strict/near/logistics),\x20ranked\x20+\x20consent-gated\x20scope\x20expansion.\x20Passive\x20side\x20=\x20post\x20a\x20Demand\x20(DemandPresenter).','match_discover\x20=\x20one-shot\x20intent→service\x20orchestration\x20(enumerate\x20+\x20location\x20gate\x20+\x206-dimension\x20scoring);\x20discover_demands\x20=\x20supplier-side\x20demand\x20enumeration;\x20market_metrics/market_operations\x20=\x20market\x20measurement\x20(GraphQL\x20required).','arbitration_score\x20=\x20dual-perspective\x20arbitration\x20trust\x20(user-trust\x20+\x20merchant-fairness,\x20combined\x200-100);\x20anti_cheat\x20=\x20fake-review/wash-order\x20detection;\x20account_events\x20=\x20account\x20attention\x20feed\x20(read-only).']},{'name':'watch_operation','summary':'Identity-centric\x20on-chain\x20console\x20—\x20resolve\x20who\x20the\x20account\x20is\x20against\x20an\x20object,\x20expand\x20its\x20relations,\x20and\x20enumerate\x20actionable\x20operations.','actions':['focus','expand','actions'],'notes':['Read-only;\x20distinct\x20from\x20query_toolkit\x20/\x20onchain_table_data\x20(pure\x20data,\x20no\x20identity).','focus\x20=\x20identity\x20resolution\x20(manifest\x20on-chain\x20role\x20⊕\x20persona)\x20+\x20base\x20data;\x20neutral\x20→\x20objective\x20narration,\x20operative\x20role\x20→\x20game\x20reasoning.','expand\x20=\x20direct\x20relations\x20+\x20Service\x20transparent\x20sub-order\x20purchasing\x20graph\x20(frozen\x20forward\x20guards\x20→\x20purchased\x20sub-services\x20+\x20proofs).','actions\x20=\x20actionable\x20operations\x20with\x20executability\x20judgment\x20(order-holder\x20/\x20permission-index\x20/\x20named-operator\x20paths).']},{'name':'persona_operation','summary':'User\x20identity\x20setting\x20(persona)\x20—\x20preferences,\x20strategy,\x20rules,\x20spec;\x20long-term\x20+\x20current\x20layers\x20+\x20strategy→lever\x20mapping\x20+\x20region\x20hint.','actions':['get','list','set','analyze','apply','sync','remove','strategy','region_hint','distill'],'notes':['Read/write\x20local\x20state;\x20account\x20persona\x20overrides\x20system;\x20current\x20overrides\x20long-term.','strategy\x20resolves\x20merchant\x20strategy\x20statements\x20into\x20deterministic\x20infrastructure\x20levers\x20(discount/reward/buy_guard/machine_design).','region_hint\x20reads\x20the\x20local\x20delivery\x20address\x20as\x20a\x20matching\x20hint;\x20`propose`\x20returns\x20a\x20consent-gated\x20save\x20proposal\x20(never\x20auto-writes).','distill\x20turns\x20one\x20goal\x27s\x20memory\x20(outcome,\x20process\x20problems/feedback,\x20objects)\x20into\x20a\x20CURRENT-layer\x20proposal\x20—\x20never\x20auto-writes;\x20persist\x20via\x20set/apply\x20after\x20user\x20confirmation.\x20Industry\x20pack.json\x20files\x20are\x20read-only\x20knowledge\x20and\x20never\x20receive\x20user\x20data.']},{'name':'employee_operation','summary':'Merchant\x20employee\x20organizational\x20profile\x20(LOCAL)\x20+\x20reaction\x20KPI\x20+\x20liability\x20resolution\x20+\x20incentive\x20suggestion.','actions':['set','get','remove','assess_kpi','resolve_liability','suggest_incentive'],'notes':['LOCAL\x20ONLY\x20—\x20on-chain\x20authorization\x20lives\x20in\x20the\x20merchant\x27s\x20Permission\x20(namedOperator/entity).','assess_kpi:\x20node\x20reaction\x20speed\x20vs\x20budget\x20(explicit\x20>\x20stored\x20profile\x20>\x2048h\x20default).\x20Timestamps\x20explicit\x20OR\x20auto-derived\x20from\x20the\x20progress\x20object\x27s\x20monitored\x20ProgressEvents\x20via\x20`progress`;\x20explicit\x20values\x20override\x20derived.','resolve_liability:\x20internal\x20cost\x20split\x20(merchant/employee,\x20hybrid\x20threshold);\x20outward\x20liability\x20toward\x20the\x20customer\x20is\x20ALWAYS\x20the\x20merchant\x27s;\x20order\x20user\x20must\x20be\x20compensated\x20before\x20the\x20workflow\x20resumes.','suggest_incentive:\x20KPIs\x20+\x20WIP\x20acceptance\x20+\x20liability\x20→\x20Reward\x20suggestion\x20(reward_grant/compensation_offset/correction_notice/none).\x20Suggestion\x20ONLY\x20—\x20merchant\x20confirms\x20and\x20executes\x20the\x20on-chain\x20ops\x20separately.']},{'name':'keeper_operation','summary':'Who-benefits-who-pushes\x20keeper:\x20scans\x20the\x20monitor\x20scope\x20for\x20actionable\x20state\x20(unclaimed\x20payments,\x20advanceable\x20workflow\x20nodes,\x20unsettled\x20escrow\x20pools),\x20routes\x20tasks\x20to\x20beneficiaries;\x20manual\x20dismiss/execute\x20+\x20standing\x20auto-execute\x20rules.','actions':['tasks','dismiss','execute','rules','rule_set','rule_remove','config','config_set','scan','status'],'notes':['The\x20chain\x20has\x20NO\x20time-triggered\x20execution\x20—\x20the\x20keeper\x20scans\x20on\x20the\x20monitor\x20loop\x20cadence\x20and\x20surfaces\x20tasks\x20to\x20their\x20beneficiary.','execute\x20runs\x20the\x20on-chain\x20op\x20for\x20one\x20task\x20(user\x20decision);\x20rule_set\x20authorizes\x20auto-execution\x20per\x20detector\x20kind\x20(bounded\x20by\x20config\x20budget/cooldown).','Detectors\x20v1:\x20payment_unclaimed\x20(funds\x20sitting\x20claimable),\x20progress_actionable\x20(a\x20workflow\x20node\x20the\x20beneficiary\x20can\x20advance),\x20settlement_pending\x20(an\x20order\x20on\x20a\x20terminal\x20node\x20whose\x20Allocation\x20pool\x20still\x20holds\x20balance\x20and\x20has\x20emitted\x20no\x20Payment\x20—\x20the\x20escrow\x20is\x20frozen\x20until\x20SOMEONE\x20fires\x20the\x20matching\x20guard).','MANUAL\x20SETTLEMENT\x20(base\x20cognition):\x20a\x20completed/refunded\x20order\x20does\x20NOT\x20release\x20funds\x20by\x20itself.\x20The\x20pool\x20drains\x20only\x20when\x20an\x20account\x20executes\x20allocation_operation\x20alloc_by_guard\x20with\x20a\x20guard\x20that\x20satisfies\x20the\x20allocator.\x20The\x20chain\x20never\x20auto-settles\x20(allocation.move\x20has\x20no\x20frequency/expiry\x20trigger).\x20So\x20\x27completed\x20≠\x20paid\x20out\x27:\x20if\x20a\x20terminal\x20order\x27s\x20pool\x20still\x20has\x20balance,\x20the\x20settlement_pending\x20task\x20is\x20the\x20signal\x20—\x20the\x20merchant\x20(completion\x20terminal)\x20or\x20the\x20buyer\x20(refund\x20terminal)\x20must\x20trigger\x20the\x20guard,\x20then\x20recipients\x20claim\x20their\x20CoinWrappers\x20via\x20payment\x20receive.','settlement_pending\x20and\x20progress_actionable\x20are\x20reminder-only\x20(never\x20auto-executed):\x20triggering\x20a\x20guard\x20releases\x20funds\x20to\x20counterparties\x20and\x20the\x20guard\x20semantics\x20must\x20be\x20reviewed\x20by\x20the\x20beneficiary\x20before\x20spending\x20gas.\x20Only\x20payment_unclaimed\x20(claim-to-self)\x20may\x20carry\x20an\x20auto_execute\x20rule.']},{'name':'intent_radar','summary':'User\x20business\x20intent\x20×\x20chain\x20event\x20matching\x20—\x20persist\x20intents,\x20score\x20events\x20against\x20them.','actions':['save','list','remove','match'],'notes':['Read-only\x20w.r.t.\x20chain;\x20industry/keywords\x20resolved\x20once\x20at\x20save;\x20events\x20supplied\x20or\x20auto-pulled.']},{'name':'goal_operation','summary':'GoalEngine\x20(K3\x2024)\x20—\x20record\x20a\x20user\x20goal\x20and\x20drive\x20it\x20through\x20the\x20nine-station\x20lifecycle\x20(RECOGNIZE→…→COMPLETE)\x20with\x20monitor\x20auto-binding\x20and\x20plan-approval\x20confirm-gate\x20downgrade;\x20also\x20hosts\x20the\x20C1-C4\x20planning\x20pipeline\x20+\x20merchant\x20onboarding\x20wizard.','actions':['create','list','get','approve','advance','pause','complete','abandon','delete','analyze_intent','aggregate_risks','trace_substeps','merchant_guide'],'common_params':{'id':'Goal\x20id\x20(goal_…)\x20—\x20required\x20for\x20get/approve/advance/pause/complete/abandon/delete.','intent_text':'create:\x20raw\x20user\x20intent;\x20goal_type\x20auto-classified\x20(override\x20with\x20goal_type).','account':'create:\x20bind\x20a\x20local\x20account\x20(preflight;\x20goal\x20starts\x20at\x20\x27bound\x27).','stage':'advance:\x20forward-only\x20target\x20stage;\x20\x27paused\x27\x20holds\x20from\x20anywhere.','objects':'advance:\x20ACT-station\x20objects\x20[{type,\x20object}]\x20(deduped).','force':'complete:\x20skip\x20on-chain\x20completion\x20verification\x20(audited\x20as\x20outcome.forced).'},'follow_ups':['monitor_events\x20(goal\x20progress\x20surfaces\x20in\x20the\x20todo\x20stream)','onchain_operations\x20(execute\x20plan\x20steps\x20with\x20env.plan_approval)'],'notes':['Near-duplicate\x20create\x20ADOPTS\x20the\x20active\x20same-type\x20same-account\x20goal\x20(intent\x20Jaccard\x20≥\x200.6)\x20instead\x20of\x20forking.','approve\x20registers\x20a\x20plan\x20approval:\x20calls\x20carrying\x20env.plan_approval=<goal\x20id>\x20auto-pass\x20fail-open\x20ConfirmGate\x20levels\x20(standard/none);\x20fail-closed\x20levels\x20(irreversible/publish/amount)\x20always\x20still\x20ask.','Entering\x20\x27monitoring\x27\x20auto-binds\x20monitor\x20focus\x20(reason=\x27goal\x27,\x20goal_id-stamped)\x20for\x20the\x20goal\x27s\x20objects;\x20demand\x20goals\x20also\x20open\x20a\x20radar\x20intent.\x20complete/abandon\x20tear\x20down\x20ONLY\x20this\x20goal\x27s\x20bindings.','complete\x20verifies\x20the\x20goal-type\x20completion\x20conjunction\x20against\x20chain\x20state\x20(read-only);\x20force=true\x20bypasses\x20and\x20is\x20audited.','delete\x20removes\x20a\x20terminal\x20goal\x20entirely\x20(record\x20+\x20TaskProcess\x20dir);\x20force=true\x20extends\x20it\x20to\x20non-terminal\x20goals\x20(monitor\x20teardown\x20first).','C1-C4\x20planning\x20pipeline\x20(GLM5-31\x20§V3/V4):\x20analyze_intent\x20(intent\x20→\x20objects\x20+\x20puzzle\x20snapshots)\x20→\x20aggregate_risks\x20(puzzles\x20OR\x20intent\x20→\x20calibrated\x20risks\x20+\x20RISK_BLOCKED\x20status)\x20→\x20trace_substeps\x20(substep\x20records\x20→\x20DAG\x20coherence\x20+\x20D-10\x20verdict);\x20merchant_guide\x20=\x2010-step\x20onboarding\x20wizard\x20(stateless\x20guide_state,\x20never\x20executes\x20on-chain\x20—\x20materialize\x20via\x20onchain_operations).\x20All\x20four\x20are\x20pure\x20transformations.']},{'name':'monitor_events','summary':'Persistent\x20monitor\x20event\x20store\x20(shared\x20with\x20the\x20client\x20Monitor\x20page)\x20—\x20paginated\x20events\x20with\x20read\x20flags;\x20mark\x20read/unread.','actions':['query','mark_read','mark_all_read'],'notes':['Events\x20captured\x20by\x20the\x20resident\x20MonitorLoop\x20(client\x20sidecar,\x20or\x20stdio\x20MCP\x20server\x20with\x20MONITOR_LOOP=1)\x20across\x209\x20modules,\x20stored\x20APPEND-ONLY\x20in\x20SQLite\x20(survives\x20restarts)\x20with\x20per-event\x20read\x20flags.','query\x20=\x20paginated\x20newest-first\x20with\x20module/event_type/since/until\x20filters\x20+\x20module_counts/unread_by_module/total_unread;\x20relevant_only\x20(default\x20true)\x20restricts\x20to\x20scope-closure/focus/filter\x20hits\x20(de-noised\x20todo\x20stream);\x20with_reason\x20attaches\x20the\x20relevance\x20annotation\x20+\x20delivered\x20flag;\x20mark_read\x20=\x20idempotent\x20per-event\x20(\x27<eventSeq>:<txDigest>\x27);\x20mark_all_read\x20=\x20optionally\x20module-scoped.','Cross-process:\x20read\x20state\x20is\x20SHARED\x20with\x20the\x20client\x20app\x20(same\x20SQLite\x20store)\x20—\x20marking\x20read\x20here\x20clears\x20the\x20client\x20Monitor\x20unread\x20badge\x20and\x20vice\x20versa.']},{'name':'monitor_subscription','summary':'Monitor\x20subscription\x20config\x20—\x20scope-closure\x20rules,\x20focus\x20objects,\x20per-type\x20todo\x20switches,\x20conditional\x20filters;\x20scope\x20preview\x20+\x20filter\x20dry-run.','actions':['get','save','reset','scope_preview','test_filter'],'notes':['Single\x20configuration\x20entry\x20point\x20for\x20monitor\x20v4\x20(client\x20settings\x20panel\x20and\x20agents\x20share\x20it);\x20save/reset\x20merge\x20+\x20clamp\x20loop\x20params,\x20then\x20trigger\x20an\x20immediate\x20scope\x20re-resolve\x20and\x20schedule\x20a\x20backfill\x20when\x20the\x20closure\x20changed.','scope_preview\x20lists\x20the\x20resolved\x20closure\x20grouped\x20by\x20layer\x20(accounts/permissions/managed_objects/services/orders/order_children/focus)\x20with\x20pagination\x20—\x20inspect\x20before\x20tuning\x20rule\x20switches.','test_filter\x20dry-runs\x20a\x20filter\x20draft\x20over\x20the\x20most\x20recent\x20captured\x20events\x20(default\x20200,\x20max\x201000)\x20returning\x20matched/scanned\x20counts\x20+\x20up\x20to\x205\x20samples\x20—\x20preview\x20noise\x20BEFORE\x20saving.','Capture\x20is\x20unaffected\x20by\x20delivery\x20switches\x20EXCEPT\x20NewPaymentEvent\x20(captured\x20only\x20when\x20switched\x20ON).']},{'name':'industry_pack_operation','summary':'Industry\x20knowledge\x20pack\x20lifecycle\x20—\x20scaffold\x20(merged\x20v2\x20template),\x20scan/register,\x20layer\x20get,\x20diff,\x20reset-to-template,\x20plus\x20industry-dir\x20file\x20operations\x20and\x20the\x20industry\x20mode\x20registry\x20(GLM6/92\x20§E).','actions':['scaffold','list','scan','resolve','list_files','read_file','write_file','get','diff','reset','delete_file','create_file','create_dir','copy','move','rename','recommend_industry','list_modes','derive_user_mode','evolve_user_mode','register_user_mode','unregister_user_mode','register_custom_metric','register_custom_constraint','list_metrics_constraints'],'notes':['LOCAL\x20ONLY\x20—\x20filesystem\x20+\x20in-memory\x20registry;\x20never\x20mutates\x20chain\x20state.','Merged\x20v2\x20layout:\x20pack.json\x20(annotated\x20with\x20_schema/_doc\x20comment\x20fields\x20+\x20personae)\x20+\x20playbook.md;\x20legacy\x20split-file\x20layouts\x20still\x20read\x20for\x20backward\x20compatibility.','reset\x20restores\x20a\x20file\x20or\x20entire\x20pack\x20folder\x20to\x20its\x20pristine\x20annotated\x20template\x20—\x20user\x20edits\x20beyond\x20the\x20target\x20are\x20preserved.','Mode\x20registry\x20(GLM6/92\x20§E):\x20recommend_industry\x20(top-3\x20similar\x20industries\x20+\x20verified\x20reference\x20examples),\x20list_modes,\x20derive_user_mode\x20(customize\x20a\x20builtin),\x20evolve_user_mode,\x20register_user_mode\x20(fully\x20custom;\x20R-M1-11\x20enforced\x20on\x20machine_shape),\x20unregister_user_mode,\x20register_custom_metric\x20/\x20register_custom_constraint\x20(extend\x20evaluation\x20registries),\x20list_metrics_constraints.']},{'name':'benchmark_migration_operation','summary':'MD\x20industry-archetype\x20templates\x20(hot-loaded\x20from\x20.wowok/industry/<industry>/templates/,\x2012\x20built-ins:\x206\x20industries\x20x\x20leader\x20+\x20challenger)\x20+\x20pre-deploy\x20risk\x20scan\x20+\x20one-click\x20competitor\x20migration\x20(import\x20→\x20review\x20→\x20apply\x20via\x20the\x20merchant-guide\x20pipeline).','actions':['template_list','template_get','template_generate','template_scan','migration_import','migration_review','migration_apply'],'common_params':{'template_id':'Template\x20id\x20\x27<industry>/<variant>\x27\x20(required\x20for\x20template_get\x20/\x20template_generate\x20/\x20template_scan\x20/\x20migration_apply),\x20e.g.\x20\x27retail/scale-marketplace\x27.','industry':'Industry\x20filter\x20for\x20template_list;\x20industry\x20hint\x20for\x20migration_import.','description':'Business/competitor\x20description\x20(required\x20for\x20migration_import;\x20optional\x20intent\x20text\x20for\x20template_generate).','url':'Competitor\x20store/profile\x20URL\x20for\x20migration_import\x20(recorded\x20as\x20provenance\x20only).','fee_overrides':'Template\x20fee-parameter\x20overrides\x20for\x20template_generate.','log':'A\x20prior\x20MigrationLog\x20(required\x20for\x20migration_review).','network':'testnet\x20|\x20mainnet\x20for\x20migration_import\x20/\x20migration_apply\x20(default\x20testnet).'},'notes':['Deterministic\x20knowledge\x20lookups\x20+\x20planning;\x20never\x20mutates\x20chain\x20state\x20—\x20template_generate\x20/\x20migration_apply\x20emit\x20creation\x20plans\x20only\x20(materialize\x20via\x20onchain_operations).','Templates\x20are\x20zod-validated\x20MD\x20files\x20hot-loaded\x20from\x20.wowok/industry/<industry>/templates/\x20(the\x20client\x20industry-drawer\x20tree;\x20root\x20env-overridable\x20via\x20WOWOK_TEMPLATES_DIR);\x20the\x2012\x20built-in\x20archetypes\x20are\x20seeded\x20idempotently\x20and\x20user\x20edits\x20are\x20never\x20overwritten.','template_scan\x20runs\x20the\x20pre-deploy\x20risk\x20scan\x20(synthetic\x20draft\x20topology\x20through\x20the\x20same\x20rule\x20surface\x20as\x20on-chain\x20analyze\x20+\x20static\x20R1-R10\x20checks);\x20CRITICAL\x20findings\x20block\x20template_generate\x20/\x20migration_apply.','migration_import\x20returns\x20a\x20MigrationLog\x20with\x20mapped\x20/\x20unmapped\x20/\x20manual_review\x20entries,\x20WoWok\x20advantages,\x20customizable\x20business-module\x20ids,\x20a\x20merchant-vs-supplier\x20role\x20assessment\x20and\x20a\x20dry-run\x20risk\x20check.','migration_review\x20surfaces\x20counts\x20+\x20risk\x20status\x20for\x20user\x20confirmation\x20before\x20migration_apply.','mainnet\x20requires\x20explicit\x20user\x20confirmation;\x20the\x20default\x20network\x20is\x20testnet.']},{'name':'strategy_review_operation','summary':'Posture-weighted\x20operating\x20scorecard\x20for\x20one\x20(account,\x20industry):\x20collect\x20evidence\x20into\x20append-only\x20local\x20snapshots,\x20assemble\x20periodic\x20reviews\x20with\x20deterministic\x20pricing/posture\x20advice\x20and\x20current-layer-only\x20persona\x20proposals\x20(never\x20auto-applied).','actions':['collect','review','list_snapshots'],'notes':['Chain\x20reads\x20+\x20local\x20SQLite\x20KV\x20snapshots\x20only;\x20never\x20mutates\x20chain\x20state\x20and\x20never\x20writes\x20the\x20persona.','collect\x20gathers\x2013\x20catalog\x20metrics\x20from\x206\x20evidence\x20sources\x20(journey\x20funnel/order\x20flow/market\x20metrics/discovery\x20competitor\x20count/arbitration\x20trust/account\x20attention);\x20source\x20failures\x20degrade\x20metrics\x20to\x20unavailable/error,\x20never\x20zero-filled;\x20snapshot\x20append\x20failure\x20is\x20fail-soft\x20(stored:false).','review\x20does\x20NOT\x20persist:\x20fresh\x20collection\x20+\x20delta\x20against\x20latest\x20stored\x20snapshot;\x200–100\x20score\x20renormalized\x20over\x20available\x20anchored\x20metrics\x20under\x20volume/balanced/margin\x20weights;\x20cadence\x20from\x20the\x20industry\x20catalog\x20(weekly/two-week/monthly);\x20≤2\x20proposals,\x20each\x20target_layer=\x27current\x27\x20with\x20apply_via\x20persona_operation\x20apply\x20—\x20the\x20user\x20must\x20apply\x20explicitly.','Posture\x20resolution:\x20explicit\x20posture\x20arg\x20→\x20merchant\x20posture\x20in\x20the\x20effective\x20persona\x20→\x20balanced.']},{'name':'workspace_operation','summary':'Local\x20workspace\x20directory\x20(`.wowok/workspace`)\x20—\x20generated\x20review\x20files\x20(machine/guard/wts/wip\x20JSON)\x20and\x20user\x20documents:\x20list/read/search/glob/edit/write\x20+\x20file\x20operations.','actions':['resolve','list','read','write','delete','create_file','create_dir','copy','move','rename','search','glob','edit'],'notes':['LOCAL\x20ONLY\x20—\x20filesystem\x20operations\x20confined\x20to\x20the\x20workspace\x20root;\x20never\x20mutates\x20chain\x20state.','read\x20is\x20the\x20supported\x20way\x20to\x20load\x20a\x20generated\x20JSON\x20as\x20AI\x20context\x20before\x20editing/submitting;\x20optional\x20offset/limit\x20line\x20slicing\x20(1-based,\x20max\x202000\x20lines)\x20and\x20encoding=\x27base64\x27\x20for\x20raw\x20bytes\x20(≤10MB).','search:\x20regex\x20content\x20search\x20(pattern;\x20optional\x20path\x20scope,\x20glob\x20basename\x20filter,\x20ignore_case,\x20max_results\x20≤200,\x20context_lines\x20≤5);\x20skips\x20binary-looking\x20and\x20>5MB\x20files.','glob:\x20wildcard\x20listing\x20on\x20workspace-relative\x20paths\x20—\x20\x27**\x27\x20spans\x20directory\x20segments,\x20\x27*\x27\x20stays\x20within\x20one\x20segment,\x20\x27?\x27\x20=\x20one\x20char.','edit:\x20exact\x20string\x20replacement\x20(path\x20+\x20old_string\x20+\x20new_string);\x20errors\x20when\x20old_string\x20is\x20non-unique\x20unless\x20replace_all=true;\x20refuses\x20files\x20>2MB.']},{'name':'workflow_operation','summary':'Local-account\x20workflow\x20view\x20—\x20list\x20active\x20Progress\x20that\x20at\x20least\x20one\x20local\x20account\x20can\x20advance\x20(permission\x20+\x20guard\x20+\x20executable\x20accounts),\x20advance/hold/unhold\x20a\x20forward,\x20and\x20view\x20a\x20progress\x27s\x20on-chain\x20operation\x20history.','actions':['list','operate','history'],'notes':['list:\x20permission-aware\x20—\x20a\x20forward\x20is\x20executable\x20when\x20(a)\x20namedOperator=\x27\x27\x20and\x20account\x20is\x20order\x20holder,\x20(b)\x20namedOperator=name\x20and\x20account\x20is\x20in\x20progress.namedOperator[name],\x20or\x20(c)\x20permissionIndex\x20set\x20and\x20account\x20is\x20in\x20permission.admin/table.','operate:\x20delegates\x20to\x20the\x20on-chain\x20progress\x20operation\x20(guard-aware);\x20op\x20∈\x20next/hold/unhold/adminUnhold.','history:\x20incrementally\x20syncs\x20a\x20progress\x27s\x20ON-CHAIN\x20Progress.history\x20(append-only\x20u64\x20index)\x20into\x20the\x20local\x20SQLite\x20mirror\x20via\x20a\x20per-progress\x20cursor\x20(only\x20new\x20records\x20pulled),\x20returns\x20the\x20migration\x20timeline\x20newest-first\x20with\x20each\x20migration\x27s\x20session\x20snapshot\x20(forwards\x20/\x20operator\x20/\x20weight\x20/\x20time);\x20runs\x2090-day\x20retention\x20cleanup\x20by\x20default.']},{'name':'permission_operation','summary':'Local-account\x20Permission\x20overview\x20—\x20list\x20Permissions\x20related\x20to\x20local\x20accounts\x20(via\x20entity_permission\x20index)\x20with\x20owner/admin/entity\x20breakdown\x20+\x20related\x20objects\x20via\x20object-linker\x20indexes.','actions':['list'],'notes':['Read-only;\x20reverse-looks-up\x20local\x20accounts\x20via\x20entity_permission\x20@0xaad,\x20then\x20merges/dedups\x20permissions.','Related\x20objects\x20resolved\x20via\x20object-linker\x20reverse\x20indexes\x20(0xaae\x20core\x20/\x200xaaf\x20tx)\x20binding\x20edges,\x20grouped\x20by\x20type\x20via\x20first-byte\x20address\x20tag.','Latest\x20update\x20time\x20derived\x20from\x20the\x20Permission\x27s\x20previousTransaction.']},{'name':'ask_user','summary':'Structured\x20user\x20elicitation\x20—\x20ask\x20the\x20user\x20to\x20choose\x20between\x202-8\x20concrete\x20options\x20and\x20receive\x20a\x20validated\x20structured\x20answer\x20(MCP\x202.0\x20elicitation\x20/\x20desktop\x20option\x20card).','common_params':{'question':'The\x20single\x20decision\x20needed\x20from\x20the\x20user\x20(1-1000\x20chars).','options':'2-8\x20self-contained\x20{id,label,description?}\x20choices.','recommended_id':'id\x20of\x20the\x20professionally\x20recommended\x20option\x20(optional).','multi_select':'true\x20when\x20options\x20are\x20combinable\x20(boolean\x20toggle\x20per\x20option).','allow_freeform':'true\x20to\x20permit\x20an\x20additional\x20free-text\x20answer.','context':'Optional\x20short\x20explanation\x20of\x20why\x20the\x20decision\x20is\x20needed.'},'notes':['Use\x20when\x20a\x20business\x20decision\x20belongs\x20to\x20the\x20user\x20and\x20continuing\x20requires\x20it;\x20never\x20guess\x20or\x20silently\x20default\x20an\x20unanswered\x20choice.','Desktop\x20clients\x20render\x20an\x20option\x20card;\x20MCP\x202.0\x20transports\x20fulfil\x20via\x20elicitation/create;\x20unsupported\x20clients\x20should\x20fall\x20back\x20to\x20a\x20numbered\x20prose\x20question.','action\x20decline/cancel\x20means\x20STOP\x20and\x20ask\x20how\x20to\x20proceed\x20in\x20plain\x20text\x20—\x20do\x20not\x20execute\x20a\x20default\x20path.','Not\x20a\x20safety\x20confirmation\x20—\x20irreversible/publish/amount\x20gates\x20remain\x20handled\x20by\x20confirm_gate.']}];export function getToolReference(a){return TOOLS_REFERENCE['find'](b=>b['name']===a);}export function searchToolReference(a){const b=a['toLowerCase']();return TOOLS_REFERENCE['filter'](c=>{if(c['name']['toLowerCase']()['includes'](b))return!![];if(c['summary']['toLowerCase']()['includes'](b))return!![];if(c['actions']?.['some'](d=>d['toLowerCase']()['includes'](b)))return!![];return![];});}export function getToolSequence(a){const b=getToolReference(a);if(!b)return undefined;return{'prerequisites':b['prerequisites']??[],'tool':b['name'],'follow_ups':b['follow_ups']??[]};}
@@ -16,6 +16,14 @@ export interface GuidanceInput {
16
16
  orderContext?: OrderContext;
17
17
  permissionDescription?: string;
18
18
  nameResolver?: NameResolver;
19
+ just_advanced?: boolean;
20
+ escrow?: TerminalEscrow;
21
+ }
22
+ export interface TerminalEscrow {
23
+ allocation: string;
24
+ balance: string;
25
+ guards: string[];
26
+ refund_terminal: boolean;
19
27
  }
20
28
  export interface OperatorInfo {
21
29
  kind: "order_holder" | "permission_index" | "named_operator";
@@ -109,6 +117,24 @@ export interface EnrichResult {
109
117
  text?: string;
110
118
  }
111
119
  export declare function enrichWorkflowGuidance(opts: EnrichOptions): Promise<EnrichResult | undefined>;
120
+ export interface HoldableEdgeInfo {
121
+ next_node: string;
122
+ forward: string;
123
+ weight: number;
124
+ threshold: number;
125
+ guard?: string;
126
+ kind: ForwardOperatorKind;
127
+ holdable: boolean;
128
+ }
129
+ export declare function resolveHoldableEdges(opts: {
130
+ progressRef: string;
131
+ accountName: string;
132
+ network?: string;
133
+ noCache?: boolean;
134
+ }): Promise<{
135
+ current: string;
136
+ edges: HoldableEdgeInfo[];
137
+ } | undefined>;
112
138
  export declare function mergeGuidanceIntoOutput<T extends {
113
139
  content: any[];
114
140
  structuredContent: any;