@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
@@ -1 +1 @@
1
- import{auditService}from'../../knowledge/index.js';import{getExperienceFeedback,recordOperationOutcome}from'../../experience/index.js';import{isEnabled as a372a,listServices}from'../../config/index.js';import{dimensionLabel}from'../../evaluation/standards.js';import{getProfile}from'../../experience/user-profile.js';import{injectEvolutionContext,recordIndustrySignal}from'../../knowledge/flywheel-loop.js';import{WException,getMoveErrorDescription,WErrors}from'@wowok/wowok';import{GUARDQUERY}from'@wowok/wowok';import{getRiskSummary}from'../../knowledge/guard-risk.js';import{evaluateGuardDraft}from'../../knowledge/guard-eval.js';import{derivePuzzleFromCallData,getPuzzleStatusBooleans,getPendingQuestions,generateConfirmationText}from'../../knowledge/guard-puzzle.js';import{inferSceneFromAction}from'../../knowledge/guard-ledger.js';import{matchSemanticPattern}from'../../knowledge/guard-translation.js';import{formatShortAddress}from'../../persona/address-format.js';import{EVENT_SEMANTIC_REGISTRY}from'../../knowledge/event-semantics.js';function deriveAdviceRole(a,b){switch(a){case'order':case'personal':case'demand':return'customer';case'service':case'machine':case'permission':case'reward':case'repository':case'allocator':case'treasury':return'merchant';case'arbitration':if(b?.['vote']!==undefined)return'arbitrator';if(b?.['dispute']!==undefined)return'customer';return undefined;default:return undefined;}}const ERROR_RULES=[{'patterns':[/^(?:error\s*:\s*)?invalid\s+(?:parameter|argument(?:\s+type)?)\b/i],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Check\x20parameter\x20format\x20against\x20the\x20tool\x20schema;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements','detail_overrides':[{'patterns':[/\bis\s+paused\b/i,/\balready\s+published\b/i,/\bis\s+published\b/i,/\bnot\s+published\b/i,/\bis\s+frozen\b/i,/\block\s+duration\b/i,/\bstatus\s+(?:does\s+not\s+)?mismatch\b/i],'error_code':'state_conflict','recovery_hint':'Object\x20state\x20conflicts\x20with\x20the\x20operation\x20—\x20the\x20parameters\x20are\x20not\x20the\x20problem.\x20Query\x20the\x20object\x27s\x20current\x20state\x20with\x20query_toolkit\x20(add\x20no_cache\x20if\x20it\x20was\x20recently\x20changed\x20by\x20another\x20party)\x20and\x20wait\x20for\x20the\x20state\x20to\x20change\x20or\x20adjust\x20the\x20operation'}]},{'patterns':[/transaction\s+expired/i],'error_code':'transaction_expired','retryable':!![],'recovery_hint':'The\x20transaction\x20expired\x20before\x20it\x20could\x20be\x20executed\x20(epoch\x20boundary\x20or\x20validator/gateway\x20outage)\x20—\x20it\x20did\x20NOT\x20land\x20and\x20nothing\x20was\x20committed.\x20Wait\x20with\x20bounded\x20backoff\x20and\x20resubmit\x20the\x20SAME\x20call\x20unchanged;\x20if\x20unsure\x20whether\x20a\x20previous\x20attempt\x20landed,\x20check\x20onchain_events\x20/\x20recent\x20transactions\x20first.\x20A\x20dry_run\x20that\x20passes\x20while\x20the\x20real\x20call\x20keeps\x20failing\x20confirms\x20the\x20fault\x20is\x20chain-side'},{'patterns':[/DEPENDENCY RESOLUTION FAILED/i],'error_code':'object_not_found','retryable':![],'recovery_hint':'A\x20referenced\x20object\x20could\x20not\x20be\x20resolved\x20—\x20read\x20the\x20\x27Original\x20error\x27\x20line\x20for\x20the\x20exact\x20name.\x20Check\x20the\x20spelling\x20in\x20local_mark_list,\x20create\x20the\x20dependency\x20first,\x20or\x20verify\x20env.network\x20matches\x20the\x20object\x27s\x20network'},{'patterns':[/Repository content not ready/i],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'The\x20Repository\x20must\x20already\x20exist\x20before\x20data_add\x20—\x20split\x20the\x20call:\x20first\x20create\x20the\x20Repository\x20(object\x20form,\x20no\x20data_add),\x20then\x20add\x20data\x20in\x20a\x20second\x20call.\x20data_add.name\x20must\x20also\x20match\x20a\x20policy\x20rule\x20name'},{'patterns':[/too\s*many\s*requests/i,/rate\s*limit/i,/\b429\b/,/throttl/i,/faucet.*rate/i,/request.*limit.*exceeded/i],'error_code':'rate_limit','retryable':!![],'recovery_hint':'Rate\x20limit\x20hit\x20(HTTP\x20429).\x20Wait\x20with\x20exponential\x20backoff\x20and\x20retry.\x20To\x20check\x20existing\x20balance,\x20use\x20account_balance\x20query.'},{'patterns':[/gas.*budget.*exceeded/i,/out\s*of\s*gas/i,/gas\s*exceeded/i,/insufficient\s*gas/i,/not\s*enough\s*gas/i,/could not automatically determine a budget/i,/dry run failed.*budget/i,/Maximum gas/i],'error_code':'gas_exceeded','retryable':!![],'recovery_hint':'Gas\x20budget\x20exceeded.\x20Increase\x20the\x20gas_budget\x20parameter\x20or\x20claim\x20more\x20gas\x20tokens,\x20then\x20retry'},{'patterns':[/stock\s*not\s*enough/i,/E_STOCK_NOT_ENOUGH/i],'error_code':'stock_exhausted','retryable':![],'recovery_hint':'Merchant-side\x20stock\x20exhausted\x20(NOT\x20a\x20balance\x20issue).\x20Reduce\x20the\x20quantity,\x20pick\x20another\x20sale\x20item,\x20or\x20ask\x20the\x20merchant\x20to\x20restock'},{'patterns':[/sale\s*(item\s*)?(is\s*)?suspended/i,/E_SALE_SUSPENDED/i],'error_code':'sale_suspended','retryable':![],'recovery_hint':'The\x20sale\x20item\x20is\x20suspended\x20by\x20the\x20merchant.\x20Pick\x20another\x20item\x20or\x20contact\x20the\x20merchant'},{'patterns':[/discount.*time.*(?:window|invalid)/i,/E_DISCOUNT_TIME_INVALID/i],'error_code':'discount_invalid','retryable':![],'recovery_hint':'Discount\x20is\x20outside\x20its\x20[time_start,\x20time_end]\x20validity\x20window.\x20Buy\x20without\x20the\x20discount\x20or\x20ask\x20the\x20merchant\x20for\x20a\x20fresh\x20one'},{'patterns':[/insufficient\s*(balance|coin|fund)/i,/insufficient\s*amount/i,/ENOTENOUGH/i,/not\s*enough\s*(coin|balance)/i,/balance\s*not\s*enough/i,/balance\s+insufficient/i,/balance\s+too\s+low/i,/not\s+enough\s+(coin|balance|fund|gas)/i,/no\s+coins/i,/Insufficient balance/i],'error_code':'insufficient_balance','retryable':!![],'recovery_hint':'Claim\x20faucet\x20tokens\x20via\x20account_operation\x20(faucet)\x20then\x20retry\x20the\x20call'},{'patterns':[/bcs.*(error|fail|invalid)/i,/BCS serialization/i,/serialization\s*(failure|error)/i,/deserialization\s*(failure|error)/i,/invalid bcs type/i,/Out of range.*bcs/i,/not\s+bool/i,/Length out of range/i,/parse object content failed/i],'error_code':'bcs_error','retryable':![],'recovery_hint':'BCS\x20serialization/deserialization\x20error.\x20Verify\x20data\x20types\x20and\x20structure\x20match\x20the\x20expected\x20schema'},{'patterns':[/signature.*(invalid|fail|error|verif)/i,/invalid\s*signature/i,/signature\s*verification\s*failed/i,/bad\s*signature/i,/signing\s*fail/i,/crypto.*signature/i,/ed25519.*(fail|error|invalid)/i,/secp256k1.*(fail|error|invalid)/i,/failed\s+to\s+recover\s+public\s+key/i],'error_code':'signature_error','retryable':![],'recovery_hint':'Signature\x20verification\x20failed.\x20Check\x20that\x20the\x20correct\x20private\x20key\x20and\x20network\x20configuration\x20are\x20correct'},{'patterns':[/config.*(not set|not found|invalid|missing)/i,/RPC\s*not\s*configured/i,/network.*not\s*specified/i,/protocol network not specified/i,/account persistent storage not set/i,/config persistent storage not set/i,/account persistent storage not found/i,/no\s*rpc\s*url/i],'error_code':'config_error','retryable':![],'recovery_hint':'Configuration\x20error.\x20Verify\x20that\x20network,\x20RPC\x20endpoints,\x20and\x20required\x20environment\x20variables\x20are\x20properly\x20configured'},{'patterns':[/wrong\s+network/i,/network\s+mismatch/i,/unsupported\s+network/i,/unrecognized\s+network/i,/invalid\s+network/i,/network\s+not\s+supported/i,/not\s+found\s+on\s+network/i],'error_code':'config_error','retryable':![],'recovery_hint':'The\x20requested\x20network\x20does\x20not\x20match\x20the\x20configured\x20one.\x20Switch\x20to\x20the\x20intended\x20network\x20(user\x20confirmation\x20required)\x20—\x20retrying\x20will\x20not\x20help'},{'patterns':[/timeout/i,/ECONNRESET/i,/ETIMEDOUT/i,/ECONNREFUSED/i,/EAI_AGAIN/i,/RPC\s*(error|failed|unreachable)/i,/socket\s*hang\s*up/i,/fetch\s*failed/i,/connection\s*(refused|reset|lost)/i,/dns\s*(error|fail)/i],'error_code':'network_error','retryable':!![],'recovery_hint':'Retry\x20the\x20call;\x20if\x20it\x20persists,\x20switch\x20RPC\x20endpoint\x20or\x20check\x20connectivity'},{'patterns':[/guard.*(reject|fail|denied|verif)/i,/verification\s*failed/i,/submission.*(invalid|fail|required)/i,/passport.*(invalid|fail|verif)/i,/passport\s+required/i,/move[._-]?abort.*guard/i,/Guard count exceeded limit/i,/Submission size exceeded limit/i,/Submission not found/i,/Guard not found/i,/Impact guard not found/i],'error_code':'guard_rejected','retryable':![],'recovery_hint':'If\x20the\x20Guard\x20defines\x20submission\x20items,\x20fill\x20them\x20(see\x20the\x20\x27submission\x27\x20field)\x20and\x20resubmit\x20via\x20call_with_submission;\x20if\x20it\x20defines\x20none,\x20the\x20Guard\x20rule\x20evaluated\x20false\x20—\x20check\x20the\x20rule\x27s\x20conditions\x20(signer/query/state)\x20against\x20this\x20call'},{'patterns':[/WIP file verification failed/i,/Failed to load WIP file/i,/WIP.*hash\s*mismatch/i,/wip.*hash.*not\s*match/i,/Invalid WIP file structure/i,/wip.*not\s*found/i,/wip.*unreachable/i,/wip_file.*error/i],'error_code':'wip_verification_failed','retryable':![],'recovery_hint':['WIP\x20file\x20must\x20be\x20publicly\x20accessible\x20via\x20HTTP(S)\x20URL\x20—\x20local\x20file\x20paths\x20cannot\x20be\x20stored\x20on-chain.','Deployment\x20options\x20(pick\x20one):','\x20\x201.\x20wip\x20storage\x20service\x20(easiest):\x20wip_file\x20{\x20type:\x20\x27upload\x27\x20}\x20—\x20official\x20free\x20store\x20wip.store.wowok.net\x20(10\x20files/account),','\x20\x20\x20\x20\x20or\x20storage=\x27custom\x27\x20with\x20your\x20own\x20/\x20a\x20third-party\x20wip\x20storage\x20service;\x20use\x20the\x20returned\x20public\x20URL\x20(base_url\x20+\x20/f/{hash}).','\x20\x202.\x20GitHub\x20Pages\x20(free,\x20stable):\x20upload\x20.wip\x20file\x20to\x20a\x20repo,\x20enable\x20Pages,\x20use\x20raw\x20URL.','\x20\x20\x20\x20\x20Example:\x20https://<user>.github.io/<repo>/<file>.wip','\x20\x20\x20\x20\x20Or\x20raw\x20URL:\x20https://raw.githubusercontent.com/<user>/<repo>/<branch>/<file>.wip','\x20\x203.\x20IPFS\x20(free,\x20decentralized):\x20upload\x20via\x20Pinata\x20(https://pinata.cloud)\x20or\x20nft.storage.','\x20\x20\x20\x20\x20Use\x20the\x20ipfs://<CID>\x20or\x20https://<gateway>/ipfs/<CID>\x20URL\x20form.','\x20\x20\x20\x20\x20Common\x20gateways:\x20https://ipfs.io/ipfs/,\x20https://cloudflare-ipfs.com/ipfs/,\x20https://dweb.link/ipfs/','\x20\x204.\x20User\x27s\x20own\x20website:\x20serve\x20the\x20.wip\x20file\x20from\x20your\x20static\x20site.','\x20\x205.\x20Generate\x20a\x20fresh\x20WIP\x20file\x20locally\x20first\x20via\x20wip_file\x20(type=\x27generate\x27),\x20upload\x20it,\x20then\x20re-submit\x20the\x20URL.','After\x20updating\x20the\x20sale\x27s\x20wip\x20URL,\x20re-run\x20the\x20operation.']['join']('\x0a')},{'patterns':[/WIP storage request .* failed: network error/i,/WIP storage (upload|delete|list) failed/i],'error_code':'wip_storage_unavailable','retryable':!![],'recovery_hint':['The\x20wip\x20storage\x20request\x20failed\x20at\x20the\x20transport\x20layer\x20—\x20usually\x20a\x20transient\x20network\x20problem.','Large\x20WIP\x20files\x20(multi-MB,\x20image-heavy)\x20are\x20especially\x20network-sensitive:','\x20\x201.\x20Retry\x20the\x20same\x20request\x20once\x20or\x20twice\x20before\x20investigating\x20further.','\x20\x202.\x20Keep\x20files\x20small:\x20compress\x20images\x20before\x20wip_file\x20type=\x27generate\x27\x20(each\x20image\x20<=\x202MB,\x20total\x20<=\x2010MB).','\x20\x203.\x20If\x20it\x20keeps\x20failing,\x20check\x20connectivity\x20to\x20the\x20storage\x20base\x20URL\x20(e.g.\x20curl\x20-I\x20<base_url>/api/health).','\x20\x204.\x20For\x20heavy\x20media,\x20consider\x20storage=\x27custom\x27\x20with\x20a\x20CDN-backed\x20service\x20near\x20your\x20users.']['join']('\x0a')},{'patterns':[/setting lock duration not exceeded/i,/E_LOCKED_TIME_NOT_ENOUGH/i,/locked time not enough/i,/lock duration not (?:elapsed|exceeded|met)/i],'error_code':'time_lock_not_elapsed','retryable':!![],'recovery_hint':'Service\x20setting_lock_duration\x20has\x20not\x20elapsed\x20since\x20pause.\x20Pause\x20the\x20Service,\x20wait\x20until\x20paused_time\x20+\x20setting_lock_duration\x20<=\x20current\x20time,\x20then\x20retry.'},{'patterns':[/already\s*publish/i,/object\s+is\s+immutable/i,/is\s+in\s+an?\s+immutable\s+state/i,/cannot\s*(modify|change|mutate)/i,/is\s*published/i,/Service already published/i,/Machine already published/i],'error_code':'immutable_violation','retryable':![],'recovery_hint':'Object\x20is\x20in\x20an\x20immutable\x20state\x20(e.g.\x20Service\x20already\x20published).\x20Recreate\x20the\x20object\x20if\x20a\x20different\x20config\x20is\x20needed'},{'patterns':[/no\s+permission/i,/missing\s+permissions?\b/i,/admin\s+permission\s+required/i,/lacks?\s+(?:the\s+)?(?:required\s+)?permission/i,/unauthorized/i,/forbidden/i,/not\s*(the\s*)?owner/i,/access\s*denied/i,/Permission denied/i,/Not the builder/i,/Not admin/i,/No operation permission/i,/Not the holder/i,/not\s+(?:authorized|approved)\b/i,/not\s+allowed/i,/unable\s+to\s+receive\s+object/i],'error_code':'permission_denied','retryable':![],'recovery_hint':'Use\x20an\x20account\x20with\x20the\x20required\x20permission,\x20or\x20pass\x20permission_guard\x20IDs\x20via\x20env.permission_guard'},{'patterns':[/not\s*found/i,/does\s*not\s*exist/i,/ENOTFOUND/i,/no\s*such\s*object/i,/unknown\s*object/i,/account not found/i,/address not found/i,/token not found/i,/Node not found/i,/Policy not found/i,/Reward not found/i],'error_code':'object_not_found','retryable':![],'recovery_hint':'Verify\x20the\x20object\x20ID/name\x20with\x20query_toolkit;\x20local_mark\x20names\x20are\x20case-sensitive'},{'patterns':[/state\s*(conflict|mismatch)/i,/already\s*exist/i,/conflict/i,/duplicate/i,/version\s*mismatch/i,/name exist/i,/Duplicate forward name/i,/Duplicate node previous/i,/already claimed/i,/already specified/i,/already accomplished/i,/already used/i,/Status does not match/i,/does not match/i,/\bnot\s+published\b/i,/\bis\s+paused\b/i,/global\s+pause/i,/\bis\s+listed\b/i,/not\s+listed\b/i,/\blocked\b/i,/\bmismatch\b/i,/already\s+(?:set|minted|listed|verified|authorized)\b/i,/\bnot\s+empty\b/i,/non-zero\s+balance/i,/\bnot\s+match\b/i,/not\s+set\s+for\s+epoch/i,/no\s+allocator\b/i,/not\s+satisfied/i,/invariant\s+violation/i],'error_code':'state_conflict','retryable':![],'recovery_hint':'Object\x20state\x20conflicts\x20with\x20the\x20operation.\x20Query\x20the\x20current\x20state\x20with\x20query_toolkit\x20and\x20adjust\x20parameters'},{'patterns':[/\b(?:coin|fee)\s+not\s+enough\b/i],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'The\x20coin/fee\x20attached\x20to\x20the\x20call\x20is\x20below\x20the\x20required\x20minimum\x20—\x20query\x20the\x20target\x20object\x27s\x20amount/fee\x20requirement\x20and\x20raise\x20the\x20corresponding\x20parameter\x20(this\x20is\x20NOT\x20a\x20wallet-balance/faucet\x20issue)'},{'patterns':[/invalid/i,/missing\s*(field|param|required)/i,/required/i,/expected/i,/malformed/i,/parse\s*error/i,/type\s*mismatch/i,/invalid argument/i,/Invalid value/i,/Invalid data value/i,/Invalid string value/i,/Invalid argument/i,/IsValid/i,/type does not match/i,/value type/i,/exceeds\s*limit/i,/indemnity\s*(exceeds|too\s*large)/i,/max(?:imum)?\b[^\n]*\bexceeded/i,/\bexceeded\s+(?:the\s+)?(?:limit|count)\b/i,/length\s+exceeded/i,/count\s+exceeded/i,/\bsize\s+exceeded\b/i,/\btoo\s+(?:many|long)\b/i,/not\s+(?:address|u64|number)\s+type/i,/not\s+system\s+address/i,/\bempty\b/i,/\bnot\s+equal\b/i,/unequal\s+lengths/i,/index\s+out\s+of\s+bounds?\b/i,/(?:arithmetic\s+)?(?:overflow|underflow)/i,/division\s+by\s+zero/i,/modulo\s+by\s+zero/i,/rate\s+(?:not\s+10000|exceeds)/i,/amount\s+(?:below\s+threshold|exceeds)/i,/store\s+from\s+id\s+not\s+compatible/i,/not\s+supported/i,/bad\s+(?:witness|transaction\s+hash\s+length)/i,/wrong\s+(?:borrow|value|inner\s+version|kiosk)/i,/incorrect\s+amount/i,/input\s+too\s+long/i,/vector\s+not\s+enough/i,/unknown\s+(?:action|requirement)/i,/illegal\s+rule/i,/not\s+zero/i,/no\s+config/i,/not\s+installed/i,/not\s+wow/i],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Check\x20parameter\x20format\x20against\x20the\x20tool\x20schema;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'}],WERROR_MAPPINGS=[{'codes':[WErrors['AccountNotFound'],WErrors['AddressNotFound'],WErrors['TokenNotFoundLocally']],'error_code':'object_not_found','retryable':![],'recovery_hint':'Verify\x20the\x20object\x20ID/name\x20with\x20query_toolkit;\x20local_mark\x20names\x20are\x20case-sensitive'},{'codes':[WErrors['NoPermission']],'error_code':'permission_denied','retryable':![],'recovery_hint':'Use\x20an\x20account\x20with\x20the\x20required\x20permission,\x20or\x20pass\x20permission_guard\x20IDs\x20via\x20env.permission_guard'},{'codes':[WErrors['IsValidDescription'],WErrors['IsValidName'],WErrors['IsValidName_AllowEmpty'],WErrors['IsValidEndpoint'],WErrors['IsValidAddress'],WErrors['IsValidArgType'],WErrors['IsValidTokenType'],WErrors['IsValidUint'],WErrors['IsValidInt'],WErrors['IsValidU8'],WErrors['IsValidU16'],WErrors['IsValidU32'],WErrors['IsValidU64'],WErrors['IsValidU128'],WErrors['IsValidU256'],WErrors['IsValidRate'],WErrors['IsValidArray'],WErrors['IsValidObjects'],WErrors['AllInvalid'],WErrors['InvalidParam'],WErrors['IsValidPermissionIndex'],WErrors['IsValidKey'],WErrors['IsValidIdentifier'],WErrors['IsValidHttpUrl'],WErrors['IsValidBizPermissionIndex'],WErrors['IsValidServiceItemName'],WErrors['IsValidCoinType'],WErrors['IsValidGuardIdentifier'],WErrors['IsValidValue'],WErrors['IsValidValueType'],WErrors['IsValidLocation'],WErrors['WitnessTypeInvalid']],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Check\x20parameter\x20format\x20against\x20the\x20tool\x20schema;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'},{'codes':[WErrors['NewGuardCheckFailed']],'error_code':'guard_rejected','retryable':![],'recovery_hint':'The\x20guard\x20would\x20fail\x20on-chain\x20—\x20the\x20SDK\x20pre-flight\x20simulation\x20blocked\x20the\x20commit\x20before\x20any\x20fee\x20was\x20spent.\x20The\x20message\x20names\x20the\x20abort\x20class\x20(GUARD_*\x20arithmetic/range/parse,\x20or\x20an\x20enriched\x20passport\x20E_*\x20abort).\x20Fix\x20the\x20guard\x20rule\x20or\x20the\x20submissions\x20it\x20expects,\x20re-validate\x20with\x20guard\x20validation\x20(local\x20evaluator\x20reports\x20leaf-level\x20defects),\x20then\x20rebuild\x20the\x20passport'},{'codes':[WErrors['BcsTypeInvalid'],WErrors['ParseObjectContentFailed']],'error_code':'bcs_error','retryable':![],'recovery_hint':'BCS\x20serialization/deserialization\x20error.\x20Verify\x20data\x20types\x20and\x20structure\x20match\x20the\x20expected\x20schema'},{'codes':[WErrors['NetworkInvalid']],'error_code':'config_error','retryable':![],'recovery_hint':'Configuration\x20error.\x20Verify\x20that\x20network,\x20RPC\x20endpoints,\x20and\x20required\x20environment\x20variables\x20are\x20properly\x20configured'},{'codes':[WErrors['AccountPersistentStorageNotSet'],WErrors['ConfigPersistentStorageNotSet'],WErrors['AccountPersistentStorageNotFound']],'error_code':'config_error','retryable':![],'recovery_hint':'Persistent\x20storage\x20not\x20configured.\x20Initialize\x20account\x20storage\x20before\x20performing\x20this\x20operation'},{'codes':[WErrors['AccountNameExist'],WErrors['LocalMarkNameExist']],'error_code':'state_conflict','retryable':![],'recovery_hint':'Object\x20state\x20conflicts\x20with\x20the\x20operation.\x20Query\x20the\x20current\x20state\x20with\x20query_toolkit\x20and\x20adjust\x20parameters'},{'codes':[WErrors['MaxObjectsPerQuery'],WErrors['ResourceTagCountExceeded'],WErrors['AddressCountExceeded'],WErrors['NumberCountExceeded']],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Count\x20limit\x20exceeded.\x20Reduce\x20the\x20number\x20of\x20items\x20per\x20request\x20and\x20retry'}];function isWException(a){return a instanceof WException;}function classifyWException(a){const b=a['getErrorCode'](),c=WERROR_MAPPINGS['find'](e=>e['codes']['includes'](b));if(!c)return undefined;const d={'error_code':c['error_code'],'retryable':c['retryable'],'recovery_hint':c['recovery_hint']};return d;}export const MOVE_ABORT_ERROR_MAP={'service:10':{'error_code':'invalid_parameter','recovery_hint':'Discounts\x20are\x20bound\x20to\x20their\x20receiver\x20and\x20cannot\x20be\x20transferred.\x20Use\x20discount_issue\x20to\x20grant\x20a\x20new\x20discount\x20to\x20the\x20target\x20address'},'service:16':{'error_code':'stock_exhausted'},'service:18':{'error_code':'guard_rejected','recovery_hint':'This\x20Service\x20requires\x20buyers\x20to\x20present\x20a\x20Guard\x20passport\x20(buyer_guard\x20configured).\x20Attach\x20a\x20passport\x20verifying\x20the\x20required\x20guard\x20and\x20resubmit'},'service:25':{'error_code':'state_conflict','recovery_hint':'This\x20operation\x20requires\x20the\x20Service\x20to\x20have\x20an\x20Arbitration\x20bound\x20together\x20with\x20a\x20compensation\x20fund.\x20Configure\x20arbitration\x20and\x20compensation\x20first'},'service:31':{'error_code':'invalid_parameter','recovery_hint':'The\x20submitted\x20wip_hash\x20does\x20not\x20match\x20the\x20Service\x27s\x20current\x20WIP\x20hash\x20—\x20the\x20merchant\x20may\x20have\x20updated\x20the\x20WIP.\x20Re-query\x20the\x20Service\x27s\x20sale\x20info\x20and\x20resubmit\x20with\x20the\x20current\x20wip_hash'},'service:33':{'error_code':'state_conflict','recovery_hint':'The\x20Service\x20cannot\x20bind\x20an\x20Arbitration\x20whose\x20permission\x20is\x20the\x20same\x20as\x20its\x20own\x20—\x20the\x20Service\x20owner\x20would\x20then\x20control\x20dispute\x20resolution,\x20breaking\x20fairness.\x20Use\x20a\x20different\x20Arbitration\x20or\x20change\x20the\x20Service\x27s\x20permission\x20first'},'service:34':{'error_code':'sale_suspended'},'service:35':{'error_code':'discount_invalid'},'service:32':{'error_code':'invalid_parameter','recovery_hint':'The\x20sale\x20item\x20index\x20does\x20not\x20exist\x20on\x20this\x20Service.\x20Query\x20the\x20Service\x27s\x20sale\x20list\x20and\x20use\x20an\x20existing\x20item\x20index'},'service:20':{'error_code':'invalid_parameter','recovery_hint':'The\x20payment\x20attached\x20to\x20this\x20order\x20(total_pay)\x20is\x20less\x20than\x20the\x20order\x20amount\x20—\x20raise\x20total_pay\x20to\x20at\x20least\x20the\x20item\x20price\x20×\x20quantity.\x20If\x20total_pay\x20is\x20already\x20correct,\x20check\x20the\x20wallet\x20with\x20account_balance\x20(this\x20is\x20NOT\x20a\x20faucet/rate\x20issue)'},'arbitration:5':{'error_code':'invalid_parameter','recovery_hint':'The\x20dispute\x20fee\x20attached\x20to\x20this\x20call\x20is\x20below\x20the\x20Arbitration\x27s\x20required\x20fee\x20—\x20query\x20the\x20Arbitration\x27s\x20fee\x20field\x20and\x20raise\x20the\x20fee\x20parameter\x20to\x20at\x20least\x20that\x20amount\x20(this\x20is\x20NOT\x20a\x20wallet-balance/faucet\x20issue)'},'machine:12':{'error_code':'guard_rejected','recovery_hint':'The\x20retained\x20submission\x20identifiers\x20do\x20not\x20exist\x20in\x20the\x20Guard.\x20Query\x20the\x20Guard\x27s\x20submission\x20table\x20and\x20correct\x20the\x20retained_submission\x20list'},'machine:14':{'error_code':'invalid_parameter','recovery_hint':'A\x20Machine\x20forward\x20must\x20define\x20one\x20of\x20namedOperator,\x20permissionIndex,\x20or\x20guard.\x20Set\x20one\x20of\x20them\x20for\x20the\x20forward'},'machine:8':{'error_code':'invalid_parameter','recovery_hint':'No\x20node\x20with\x20that\x20name\x20exists\x20in\x20this\x20Machine.\x20Export\x20the\x20node\x20set\x20via\x20machineNode2file\x20(or\x20query\x20the\x20node\x20table)\x20and\x20use\x20an\x20exact\x20existing\x20node\x20name'},'machine:10':{'error_code':'invalid_parameter','recovery_hint':'The\x20referenced\x20node\x20name\x20does\x20not\x20exist\x20in\x20this\x20Machine.\x20Export\x20the\x20node\x20set\x20via\x20machineNode2file\x20(or\x20query\x20the\x20node\x20table)\x20and\x20use\x20exact\x20existing\x20node\x20names'},'machine:13':{'error_code':'invalid_parameter','recovery_hint':'No\x20forward\x20info\x20matches\x20that\x20node/next_node/forward\x20triple.\x20Query\x20the\x20Machine\x27s\x20node\x20table\x20(onchain_table_data\x20onchain_table_item_machine_node)\x20and\x20use\x20an\x20existing\x20combination'},'progress:8':{'error_code':'invalid_parameter','recovery_hint':'This\x20forward\x20requires\x20a\x20permission_index\x20for\x20non-named-operator\x20holders.\x20Supply\x20the\x20permission_index\x20of\x20a\x20Permission\x20the\x20Machine\x20recognizes'},'order:3':{'error_code':'invalid_parameter','recovery_hint':'This\x20order\x20requires\x20progress\x20specification\x20(the\x20Service\x20is\x20machine-backed).\x20Supply\x20the\x20progress\x20parameters,\x20or\x20query\x20the\x20machine\x20node\x20info\x20for\x20the\x20expected\x20values'},'order:8':{'error_code':'invalid_parameter','recovery_hint':'This\x20order\x20requires\x20allocation\x20specification.\x20Supply\x20the\x20allocation\x20parameters\x20matching\x20the\x20Service\x27s\x20allocator\x20configuration'},'arb:5':{'error_code':'invalid_parameter','recovery_hint':'votes\x20are\x200-based\x20indices\x20of\x20the\x20propositions\x20the\x20voter\x20agrees\x20with\x20—\x20each\x20value\x20must\x20be\x20<\x20the\x20Arb\x27s\x20proposition\x20count.\x20Query\x20the\x20Arb\x27s\x20propositions\x20and\x20resubmit\x20with\x20valid\x20indices\x20(0\x20…\x20N-1)'},'arb:4':{'error_code':'time_lock_not_elapsed','recovery_hint':'The\x20voting\x20deadline\x20has\x20not\x20passed\x20yet.\x20Wait\x20until\x20the\x20deadline\x20elapses,\x20then\x20tally\x20the\x20votes'},'arb:7':{'error_code':'state_conflict','recovery_hint':'The\x20voting\x20deadline\x20has\x20passed\x20—\x20voting\x20is\x20closed.\x20Query\x20the\x20proposition\x20state\x20to\x20see\x20the\x20outcome'},'arb:8':{'error_code':'time_lock_not_elapsed','recovery_hint':'The\x20withdraw\x20duration\x20has\x20not\x20elapsed\x20yet.\x20Wait\x20until\x20the\x20lock\x20duration\x20passes,\x20then\x20withdraw'},'passport:2':{'error_code':'guard_rejected','recovery_hint':'Guards\x20relied\x20upon\x20by\x20this\x20Guard\x20must\x20be\x20added\x20to\x20the\x20Passport\x20first\x20(dependents-before-dependent\x20order).\x20Add\x20the\x20relied-upon\x20guards\x20to\x20the\x20passport,\x20then\x20add\x20this\x20one'},'passport:5':{'error_code':'guard_rejected','recovery_hint':'The\x20passport\x20lacks\x20the\x20required\x20verification\x20for\x20this\x20operation.\x20Complete\x20the\x20verification\x20scene\x20first'},'passport:6':{'error_code':'guard_rejected','recovery_hint':'The\x20guard\x20is\x20not\x20an\x20impact\x20guard\x20of\x20this\x20Passport\x20—\x20its\x20result\x20does\x20not\x20participate\x20in\x20the\x20passport\x20outcome.\x20Query\x20the\x20passport\x27s\x20guard\x20list\x20and\x20use\x20a\x20guard\x20registered\x20with\x20impack=true'},'passport:9':{'error_code':'guard_rejected','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20in\x20this\x20passport.\x20Add\x20the\x20guard\x20to\x20the\x20passport\x20(with\x20impack=true\x20if\x20its\x20result\x20must\x20participate\x20in\x20the\x20outcome),\x20then\x20retry'},'passport:10':{'error_code':'invalid_parameter','recovery_hint':'The\x20submission\x20identifier\x20does\x20not\x20exist\x20in\x20this\x20passport.\x20Query\x20the\x20passport\x27s\x20submission\x20table\x20and\x20use\x20a\x20registered\x20identifier'},'passport:11':{'error_code':'guard_rejected','recovery_hint':'Digest\x20mismatch\x20in\x20proof\x20verification.\x20The\x20proof\x20does\x20not\x20cover\x20the\x20expected\x20content\x20—\x20regenerate\x20the\x20proof\x20against\x20the\x20current\x20target'},'reward:1':{'error_code':'time_lock_not_elapsed','recovery_hint':'The\x20guard-add\x20lock\x20(guard_not_added_expiration_time)\x20is\x20still\x20active\x20and\x20cannot\x20be\x20replaced\x20yet.\x20Wait\x20until\x20it\x20elapses,\x20then\x20set\x20the\x20new\x20lock\x20time'},'reward:2':{'error_code':'invalid_parameter','retryable':![],'recovery_hint':'The\x20guard\x27s\x20expiration_time\x20has\x20already\x20passed\x20and\x20it\x20can\x20no\x20longer\x20be\x20used.\x20Ask\x20the\x20reward\x20issuer\x20to\x20re-add\x20the\x20guard\x20with\x20a\x20later\x20expiration\x20(or\x20use\x20a\x20different\x20guard),\x20then\x20retry'},'reward:10':{'error_code':'time_lock_not_elapsed','recovery_hint':'Guards\x20are\x20locked\x20until\x20guard_not_added_expiration_time\x20elapses.\x20Wait\x20until\x20then\x20before\x20adding\x20guards'},'reward:11':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard-add\x20lock\x20time\x20must\x20be\x20strictly\x20later\x20than\x20the\x20current\x20clock\x20time.\x20Set\x20a\x20future\x20timestamp'},'reward:7':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20in\x20this\x20Reward.\x20Use\x20a\x20guard\x20registered\x20in\x20the\x20Reward\x27s\x20guard\x20table,\x20or\x20have\x20the\x20issuer\x20add\x20it\x20first'},'repository:7':{'error_code':'invalid_parameter','recovery_hint':'The\x20referenced\x20policy\x20does\x20not\x20exist\x20in\x20the\x20repository.\x20Query\x20the\x20repository\x20policies\x20and\x20use\x20a\x20valid\x20policy\x20ID'},'repository:8':{'error_code':'invalid_parameter','recovery_hint':'The\x20referenced\x20policy\x20does\x20not\x20exist\x20in\x20the\x20repository\x20(option\x20is\x20none).\x20Query\x20the\x20repository\x20policies\x20and\x20use\x20a\x20valid\x20policy\x20ID'},'repository:11':{'error_code':'invalid_parameter','recovery_hint':'The\x20policy\x27s\x20guard\x20entry\x20expects\x20id/data\x20from\x20the\x20passport\x20submission\x20(id_from_submission/data_from_submission\x20is\x20set),\x20but\x20this\x20call\x20passes\x20explicit\x20values.\x20Use\x20the\x20submission-based\x20call\x20route,\x20or\x20fix\x20the\x20policy\x20entry'},'repository:12':{'error_code':'guard_rejected','recovery_hint':'The\x20write_guard\x20is\x20not\x20an\x20impact\x20guard\x20in\x20the\x20passport\x20—\x20the\x20passport\x20must\x20verify\x20this\x20guard\x20with\x20impack=true.\x20Rebuild\x20the\x20passport\x20including\x20the\x20write_guard\x20as\x20an\x20impact\x20guard'},'repository:13':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20in\x20the\x20repository\x20policy\x27s\x20guard\x20list.\x20Query\x20the\x20policy\x27s\x20guards\x20and\x20use\x20a\x20registered\x20one'},'repository:14':{'error_code':'invalid_parameter','recovery_hint':'The\x20ID\x20vector\x20is\x20shorter\x20than\x20required\x20—\x20a\x20vector\x20length\x20problem,\x20not\x20a\x20balance\x20problem.\x20Align\x20the\x20vector\x20lengths\x20with\x20the\x20operation\x27s\x20requirement'},'repository:15':{'error_code':'invalid_parameter','recovery_hint':'The\x20data\x20vector\x20is\x20shorter\x20than\x20required\x20—\x20a\x20vector\x20length\x20problem,\x20not\x20a\x20balance\x20problem.\x20Align\x20the\x20vector\x20lengths\x20with\x20the\x20operation\x27s\x20requirement'},'repository:20':{'error_code':'invalid_parameter','recovery_hint':'The\x20policy\x20entry\x20requires\x20the\x20id\x20to\x20come\x20from\x20the\x20passport\x20submission\x20(id_from_submission\x20is\x20set).\x20Use\x20the\x20submission-based\x20call\x20route\x20that\x20supplies\x20the\x20passport'},'repository:21':{'error_code':'invalid_parameter','recovery_hint':'The\x20quote\x20guard\x20must\x20be\x20a\x20depended\x20guard\x20(no\x20relies\x20of\x20its\x20own,\x20immutable,\x20with\x20reputation).\x20Configure\x20the\x20guard\x20accordingly\x20before\x20setting\x20it\x20as\x20the\x20policy\x27s\x20quote\x20guard'},'repository:22':{'error_code':'invalid_parameter','recovery_hint':'The\x20policy\x20requires\x20a\x20write_guard\x20when\x20id_from\x20is\x20None.\x20Set\x20the\x20policy\x27s\x20write_guard\x20or\x20use\x20a\x20non-None\x20id_from'},'repository:23':{'error_code':'invalid_parameter','recovery_hint':'id_from_submission\x20is\x20forbidden\x20when\x20id_from\x20is\x20Clock\x20or\x20Signer\x20(the\x20id\x20is\x20auto-generated).\x20Remove\x20id_from_submission\x20from\x20the\x20policy\x20entry\x20or\x20change\x20id_from'},'permission:7':{'error_code':'invalid_parameter','recovery_hint':'Use\x20a\x20USER_DEFINED\x20index\x20(≥1000)\x20—\x20custom\x20forward\x20permissions\x20work\x20out\x20of\x20the\x20box\x20for\x20the\x20Permission\x27s\x20admin\x20with\x20no\x20prior\x20grant;\x20low\x20indices\x20(0-999)\x20are\x20builtin/reserved\x20and\x20must\x20be\x20granted\x20first\x20(permission\x20add\x20perm\x20by\x20index)\x20before\x20use\x20—\x20audit\x20with\x20onchain_table_data\x20query_type=onchain_table_item_permission_perm'},'arbitration:8':{'error_code':'invalid_parameter','recovery_hint':'This\x20guard\x20is\x20not\x20registered\x20as\x20a\x20voting\x20guard\x20on\x20the\x20Arbitration.\x20Add\x20it\x20to\x20the\x20Arbitration\x27s\x20voting_guard\x20config\x20(with\x20its\x20vote_weight)\x20first,\x20or\x20use\x20an\x20already-registered\x20voting\x20guard'},'demand:4':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20on\x20this\x20Demand.\x20Use\x20a\x20guard\x20registered\x20on\x20the\x20Demand,\x20or\x20configure\x20it\x20first'},'treasury:3':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20as\x20an\x20external\x20deposit\x20guard\x20on\x20this\x20Treasury.\x20Register\x20it\x20in\x20the\x20Treasury\x27s\x20external\x20deposit\x20guard\x20list\x20first'},'treasury:4':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20as\x20an\x20external\x20withdraw\x20guard\x20on\x20this\x20Treasury.\x20Register\x20it\x20in\x20the\x20Treasury\x27s\x20external\x20withdraw\x20guard\x20list\x20first'},'treasury:10':{'error_code':'invalid_parameter','recovery_hint':'An\x20external\x20withdraw\x20can\x20only\x20pay\x20the\x20transaction\x20sender.\x20Either\x20submit\x20the\x20transaction\x20as\x20the\x20recipient\x20address,\x20or\x20use\x20the\x20permissioned\x20withdraw\x20path\x20to\x20pay\x20another\x20address'},'guard:6':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20being\x20relied\x20upon\x20must\x20be\x20a\x20depended\x20guard\x20(no\x20relies\x20of\x20its\x20own,\x20immutable,\x20with\x20reputation).\x20Rely\x20on\x20a\x20terminal\x20guard,\x20not\x20one\x20with\x20its\x20own\x20dependencies'},'guard:7':{'error_code':'invalid_parameter','recovery_hint':'A\x20Guard\x20cannot\x20depend\x20on\x20itself.\x20Remove\x20the\x20self-reference\x20from\x20the\x20relies\x20list'},'guard:9':{'error_code':'invalid_parameter','recovery_hint':'The\x20submission\x20identifier\x27s\x20object\x20type\x20does\x20not\x20match\x20the\x20Guard\x20table\x20entry.\x20Check\x20each\x20identifier\x27s\x20type\x20against\x20the\x20Guard\x27s\x20table'},'guard:10':{'error_code':'invalid_parameter','recovery_hint':'The\x20identifiers\x20and\x20values\x20vectors\x20must\x20have\x20equal\x20lengths.\x20Align\x20the\x20counts'},'guard:11':{'error_code':'guard_rejected','recovery_hint':'The\x20submission\x20identifier\x20is\x20not\x20in\x20the\x20Guard\x27s\x20table.\x20Query\x20the\x20Guard\x27s\x20table\x20identifiers\x20and\x20submit\x20a\x20valid\x20one'},'allocation:5':{'error_code':'invalid_parameter','recovery_hint':'Multiple\x20surplus\x20entries\x20are\x20not\x20supported.\x20Provide\x20at\x20most\x20one\x20surplus\x20entry\x20in\x20the\x20allocation'},'allocation:8':{'error_code':'state_conflict','recovery_hint':'No\x20allocators\x20are\x20configured\x20for\x20this\x20order.\x20The\x20merchant\x20must\x20configure\x20the\x20Service\x27s\x20allocation\x20first'},'allocation:9':{'error_code':'invalid_parameter','recovery_hint':'Payment\x20info\x20is\x20missing\x20for\x20the\x20allocation.\x20Supply\x20the\x20payment\x20parameters\x20required\x20by\x20the\x20order'},'allocation:12':{'error_code':'invalid_parameter','recovery_hint':'The\x20split\x20amount\x20is\x20below\x20the\x20allocator\x27s\x20minimum\x20threshold.\x20Raise\x20the\x20amount\x20or\x20remove\x20the\x20split'},'allocation:15':{'error_code':'invalid_parameter','retryable':![],'recovery_hint':'The\x20GuardIdentifier\x20recipient\x20address\x20submitted\x20via\x20the\x20passport\x20does\x20not\x20match\x20the\x20Allocation\x27s\x20payment_info.for_object\x20anchor.\x20Present\x20a\x20passport\x20whose\x20recipient\x20identifier\x20submits\x20exactly\x20the\x20anchored\x20object\x20address\x20(or\x20redesign\x20the\x20guard\x20so\x20its\x20submission\x20is\x20constrained\x20to\x20that\x20address);\x20the\x20anchor\x20itself\x20cannot\x20be\x20changed\x20after\x20create'},'transfer:0':{'error_code':'invalid_parameter','recovery_hint':'A\x20shared\x20non-new\x20object\x20was\x20passed\x20where\x20only\x20newly-created\x20objects\x20are\x20allowed'},'coin:3':{'error_code':'state_conflict','recovery_hint':'The\x20operation\x20is\x20disallowed\x20while\x20the\x20coin\x20is\x20globally\x20paused.\x20Wait\x20for\x20the\x20pause\x20to\x20be\x20lifted'},'kiosk:4':{'error_code':'state_conflict','recovery_hint':'The\x20item\x20is\x20listed\x20exclusively\x20on\x20another\x20marketplace.\x20Delist\x20it\x20there\x20before\x20this\x20operation'},'token:5':{'error_code':'insufficient_balance','recovery_hint':'The\x20token\x20balance\x20cannot\x20be\x20consumed\x20(a\x20locked\x20portion\x20exists).\x20Unlock\x20or\x20acquire\x20more\x20balance\x20first'},'package:0':{'error_code':'invalid_parameter','recovery_hint':'Not\x20a\x20one-time\x20witness\x20—\x20the\x20module\x20initializer\x20pattern\x20is\x20invalid'},'package:1':{'error_code':'invalid_parameter','recovery_hint':'The\x20witness\x20is\x20too\x20permissive\x20for\x20this\x20operation'},'package:4':{'error_code':'invalid_parameter','recovery_hint':'Wrong\x20upgrade\x20cap\x20for\x20this\x20package\x20upgrade'},'balance:2':{'error_code':'insufficient_balance'},'kiosk:2':{'error_code':'insufficient_balance'},'transfer_policy:5':{'error_code':'insufficient_balance'},'token:7':{'error_code':'immutable_violation','recovery_hint':'This\x20token\x20operation\x20requires\x20the\x20immutable\x20confirmation\x20flow\x20to\x20be\x20completed\x20first.\x20Run\x20the\x20token\x27s\x20immutable\x20confirm,\x20then\x20retry'},'u64:1':{'error_code':'invalid_parameter','recovery_hint':'Arithmetic\x20overflow\x20—\x20the\x20computed\x20value\x20exceeds\x20u64.\x20Reduce\x20the\x20amounts'},'u64:2':{'error_code':'invalid_parameter','recovery_hint':'Arithmetic\x20underflow\x20—\x20the\x20computed\x20value\x20goes\x20below\x20zero.\x20Check\x20the\x20subtraction\x20inputs'},'u64:3':{'error_code':'invalid_parameter','recovery_hint':'Division\x20by\x20zero\x20—\x20the\x20divisor\x20is\x20zero.\x20Guard\x20the\x20divisor\x20before\x20dividing'},'u64:4':{'error_code':'invalid_parameter','recovery_hint':'Modulo\x20by\x20zero\x20—\x20the\x20divisor\x20is\x20zero.\x20Guard\x20the\x20divisor\x20before\x20the\x20modulo'},'bcs:0':{'error_code':'bcs_error','recovery_hint':'BCS\x20value\x20out\x20of\x20range'},'bcs:1':{'error_code':'bcs_error','recovery_hint':'BCS\x20value\x20is\x20not\x20a\x20bool'},'bcs:2':{'error_code':'bcs_error','recovery_hint':'BCS\x20length\x20out\x20of\x20range'},'address:0':{'error_code':'invalid_parameter','recovery_hint':'Address\x20parse\x20error\x20—\x20the\x20byte\x20length\x20is\x20not\x2032'},'hex:0':{'error_code':'invalid_parameter','recovery_hint':'Invalid\x20hex\x20length'},'hex:1':{'error_code':'invalid_parameter','recovery_hint':'Not\x20a\x20valid\x20hex\x20character'}};function canonicalDefaultFor(a){const b=ERROR_RULES['find'](c=>c['error_code']===a);if(b)return{'retryable':b['retryable'],'recovery_hint':b['recovery_hint']};return{'retryable':![],'recovery_hint':'Inspect\x20the\x20full\x20error\x20message;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'};}function classifyMoveAbort(a){const b=MOVE_ABORT_ERROR_MAP[a['module']+':'+a['code']];if(!b)return undefined;const c=canonicalDefaultFor(b['error_code']),d=b['recovery_hint']??c['recovery_hint'],e={'error_code':b['error_code'],'retryable':b['retryable']??c['retryable'],'recovery_hint':a['description']&&!d['includes'](a['description'])?d+'.\x20Details:\x20'+a['description']:d,'move_abort_info':a};return e;}function isWowokSystemAddress(a){const b=a['toLowerCase']()['replace'](/^0x/,'')['replace'](/^0+(?=.)/,'');return b==='1'||b==='2';}export function normalizeErrorMessage(a){if(typeof a==='string')return a;if(a&&typeof a==='object'){const b=a;if(typeof b['message']==='string'&&b['message'])return b['message'];if(typeof b['error']==='string'&&b['error'])return b['error'];try{return JSON['stringify'](a);}catch{return String(a);}}if(a===undefined||a===null)return'';return String(a);}function extractMoveAbortInfo(a){const b=normalizeErrorMessage(a);if(!b)return undefined;const c=b['match'](/MoveAbort\(.*,\s*(\d+)\s*\)/),d=b['match'](/name:\s*Identifier\("([^"]+)"\)/),e=b['match'](/address:\s*([0-9a-fA-Fx]+)/);if(c&&d&&e){const i=parseInt(c[0x1],0xa),j=d[0x1]['toLowerCase'](),k=e[0x1]['toLowerCase']();if(isWowokSystemAddress(k)){const l=getMoveErrorDescription(j,i)??undefined;return{'module':j,'code':i,'description':l};}}const f=b['match'](/abort code:\s*(\d+)/),g=b['match'](/'0x[0-9a-fA-F]+::([^:]+)::[^']+'/),h=b['match'](/'(0x[0-9a-fA-F]+)::/);if(f&&g&&h){const m=parseInt(f[0x1],0xa),n=g[0x1]['toLowerCase'](),o=h[0x1]['toLowerCase']();if(isWowokSystemAddress(o)){const p=getMoveErrorDescription(n,m)??undefined;return{'module':n,'code':m,'description':p};}}return undefined;}export function classifyError(a,b){const c=normalizeErrorMessage(a),d=extractMoveAbortInfo(c);if(d){const g=classifyMoveAbort(d);if(g)return g;}if(b!==undefined&&isWException(b)){const h=classifyWException(b);if(h)return d&&(h['move_abort_info']=d,d['description']&&h['recovery_hint']&&!h['recovery_hint']['includes'](d['description'])&&(h['recovery_hint']=h['recovery_hint']+'.\x20Details:\x20'+d['description'])),h;}if(!c)return{'error_code':'unknown','retryable':![]};const e=d?.['description']?c+'\x0a'+d['description']:c;for(const i of ERROR_RULES){const j=i['patterns']['find'](o=>o['test'](e));if(!j)continue;let k=i['error_code'],l=i['retryable'],m=i['recovery_hint'];if(i['detail_overrides']){const o=e['match'](j),p=o?e['slice'](o['index']+o[0x0]['length']):'',q=i['detail_overrides']['find'](r=>r['patterns']['some'](s=>s['test'](p)));q&&(k=q['error_code'],l=q['retryable']??i['retryable'],m=q['recovery_hint']??i['recovery_hint']);}const n={'error_code':k,'retryable':l,'recovery_hint':m};return d&&(n['move_abort_info']=d,d['description']&&(n['recovery_hint']=n['recovery_hint']+'.\x20Details:\x20'+d['description'])),n;}const f={'error_code':'unknown','retryable':![],'recovery_hint':'Inspect\x20the\x20full\x20error\x20message;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'};return d&&(f['move_abort_info']=d,d['description']&&(f['recovery_hint']=d['description']+'.\x20'+f['recovery_hint'])),f;}const INTENT_RULES=[{'operation_type':'service','signals':a=>a?.['publish']===!![],'intent':'publish_service','confidence':0.95},{'operation_type':'service','signals':a=>a?.['name']&&a?.['publish']===undefined,'intent':'create_service','confidence':0.9},{'operation_type':'service','intent':'modify_service','confidence':0.7},{'operation_type':'machine','intent':'configure_machine','confidence':0.9},{'operation_type':'progress','intent':'update_progress','confidence':0.9},{'operation_type':'order','signals':a=>a?.['arb_confirm']!==undefined||a?.['arb_objection']!==undefined||a?.['arb_claim_compensation']!==undefined,'intent':'apply_arbitration','confidence':0.9},{'operation_type':'order','intent':'manage_order','confidence':0.85},{'operation_type':'payment','signals':a=>a?.['receive']===!![],'intent':'claim_escrow_payment','confidence':0.95},{'operation_type':'payment','intent':'send_payment','confidence':0.9},{'operation_type':'reward','intent':'manage_reward','confidence':0.9},{'operation_type':'demand','intent':'post_demand','confidence':0.9},{'operation_type':'treasury','intent':'manage_treasury','confidence':0.9},{'operation_type':'allocation','intent':'allocate_funds','confidence':0.9},{'operation_type':'permission','intent':'manage_permission','confidence':0.9},{'operation_type':'guard','intent':'configure_guard','confidence':0.9},{'operation_type':'arbitration','intent':'manage_arbitration','confidence':0.9},{'operation_type':'contact','intent':'manage_contact','confidence':0.9},{'operation_type':'repository','intent':'manage_repository','confidence':0.9},{'operation_type':'personal','intent':'manage_personal','confidence':0.9},{'operation_type':'gen_passport','intent':'generate_passport','confidence':0.95},{'operation_type':'proof','intent':'create_proof','confidence':0.9},{'operation_type':'gen_proof','intent':'generate_proof','confidence':0.95},{'operation_type':'bridge_cross_chain_wow_to_evm','intent':'cross_chain_wow_to_evm_deposit','confidence':0.95},{'operation_type':'bridge_cross_chain_evm_to_wow','intent':'cross_chain_evm_to_wow_deposit','confidence':0.95},{'operation_type':'bridge_claim_wow_to_evm','intent':'claim_wow_to_evm','confidence':0.95},{'operation_type':'bridge_withdraw','intent':'withdraw_from_evm_account','confidence':0.9},{'operation_type':'bridge_query_active_evm_account','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_supported_evm_chains','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_supported_tokens','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_transfer_list','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_transfer_status','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_manage_evm_rpc','intent':'manage_evm_rpc','confidence':0.9},{'operation_type':'account_new','intent':'create_account','confidence':0.95},{'operation_type':'account_faucet','intent':'claim_faucet','confidence':0.95},{'operation_type':'account_balance','intent':'query_balance','confidence':0.9},{'operation_type':'mark_add','intent':'create_local_mark','confidence':0.9},{'operation_type':'mark_remove','intent':'remove_local_mark','confidence':0.9},{'operation_type':'mark_query','intent':'query_local_marks','confidence':0.9},{'operation_type':'local_info','intent':'query_local_info','confidence':0.9},{'operation_type':'query_toolkit','intent':'query_objects','confidence':0.85},{'operation_type':'onchain_events','intent':'query_events','confidence':0.85},{'operation_type':'onchain_table_data','intent':'query_table_data','confidence':0.85}];export function inferIntent(a,b){const c=INTENT_RULES['filter'](f=>f['operation_type']===a),d=c['find'](f=>f['signals']&&f['signals'](b));if(d)return d['intent'];const e=c['find'](f=>!f['signals']);return e?.['intent']??a;}function inferStatus(a){if(a['kind']==='error')return'failed';if(a['kind']==='transaction')return a['executed']?'success':'failed';return'success';}const OBJECT_TYPE_TO_ROLE={'service':'Service','machine':'Machine','progress':'Progress','permission':'Permission','guard':'Guard','order':'Order','arb':'ArbCase','arbitration':'Arbitration','messenger':'Messenger','contact':'Contact','demand':'Demand','reward':'Reward','personal':'Personal','repository':'Repository','treasury':'Treasury','discount':'Discount','allocation':'Allocation','payment':'Payment','passport':'Passport','proof':'Proof'};export function objectTypeToRole(a){if(!a)return'Other';const b=a['replace'](/<.*>/,'')['trim'](),c=b['split']('::'),d=(c[c['length']-0x1]||'')['toLowerCase']();return OBJECT_TYPE_TO_ROLE[d]??'Other';}export function tagObjectRoles(a){if(!Array['isArray'](a))return[];return a['filter'](b=>b&&(b['objectId']||b['object']?.['objectId']))['map'](b=>{const d=b['objectId']||b['object']?.['objectId'],e=b['objectType']||b['object']?.['objectType']||'',f=b['type']||'';return{'id':d,'role':objectTypeToRole(e),'immutable':e['includes']('Service')&&f==='published'};});}const GAS_COIN_PATTERNS=[/::wow::WOW$/i],SMALL_AMOUNT_THRESHOLD=BigInt(0xf4240);function isNegative(a){return String(a??'0')['startsWith']('-');}function hasEventMatch(a,b){if(!Array['isArray'](a))return![];return a['some'](c=>b['test'](String(c?.['type']??c?.['event_type']??'')));}function isGasCoin(a){if(!a)return![];return GAS_COIN_PATTERNS['some'](b=>b['test'](a));}function absAmount(a){try{return BigInt(String(a)['replace']('-','')||'0');}catch{return BigInt(0x0);}}const FUND_ROLE_RULES=[{'when':a=>hasEventMatch(a['events'],/order::OrderPaidEvent/i),'role':'payment','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/order::OrderRefundedEvent|order::RefundEvent/i),'role':'refund','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/reward::RewardClaimedEvent|reward::ClaimedEvent/i),'role':'reward','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/arbitration::CompensationEvent|arbitration::RefundEvent/i),'role':'compensation','confidence':0.9},{'when':a=>hasEventMatch(a['events'],/treasury::DepositEvent/i),'role':'deposit','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/treasury::WithdrawEvent|treasury::ReleaseEvent/i),'role':'release','confidence':0.9},{'when':a=>a['operation_type']==='payment'&&a['data']?.['receive']===!![],'role':'release','confidence':0.95},{'when':a=>a['operation_type']==='payment'&&isNegative(a['amount']),'role':'payment','confidence':0.95},{'when':a=>a['operation_type']==='payment'&&!isNegative(a['amount']),'role':'refund','confidence':0.9},{'when':a=>a['operation_type']==='reward'&&isNegative(a['amount']),'role':'reward','confidence':0.95},{'when':a=>a['operation_type']==='reward'&&!isNegative(a['amount']),'role':'release','confidence':0.9},{'when':a=>a['operation_type']==='treasury'&&isNegative(a['amount']),'role':'deposit','confidence':0.95},{'when':a=>a['operation_type']==='treasury'&&!isNegative(a['amount']),'role':'release','confidence':0.9},{'when':a=>a['operation_type']==='allocation'&&isNegative(a['amount']),'role':'payment','confidence':0.85},{'when':a=>a['operation_type']==='allocation'&&!isNegative(a['amount']),'role':'release','confidence':0.85},{'when':a=>a['operation_type']==='arbitration'&&(a['data']?.['compensation']!==undefined||a['data']?.['arb']===!![]),'role':'compensation','confidence':0.9},{'when':a=>a['operation_type']==='order'&&isNegative(a['amount'])&&a['data']?.['buy']!==undefined,'role':'payment','confidence':0.9},{'when':a=>a['operation_type']==='order'&&!isNegative(a['amount'])&&(a['data']?.['refund']!==undefined||a['data']?.['arb']!==undefined),'role':'refund','confidence':0.85},{'when':a=>{if(isNegative(a['amount']))return![];const b=absAmount(a['amount']);return isGasCoin(a['coinType'])&&b>BigInt(0x0)&&b<SMALL_AMOUNT_THRESHOLD;},'role':'gas','confidence':0.7},{'when':a=>{if(isNegative(a['amount']))return![];return a['sender']!==undefined&&a['recipient']!==undefined&&a['sender']===a['recipient']&&a['sender']!=='';},'role':'change','confidence':0.7},{'when':a=>isNegative(a['amount']),'role':'payment','confidence':0.7},{'when':a=>!isNegative(a['amount'])&&absAmount(a['amount'])===BigInt(0x0),'role':'other','confidence':0.5},{'when':a=>!isNegative(a['amount']),'role':'release','confidence':0.7},{'when':()=>!![],'role':'other','confidence':0.3}];export function tagFundRoles(a,b,c,d){if(!Array['isArray'](a))return[];return a['filter'](e=>e&&(e['amount']!==undefined||e['coinType']))['map'](e=>{const f={'operation_type':b,'amount':String(e['amount']??'0'),'coinType':e['coinType'],'data':c??{},'events':d,'sender':e['sender'],'recipient':e['recipient']},g=FUND_ROLE_RULES['find'](i=>i['when'](f)),h=g?.['role']??'other';return{'amount':f['amount'],'coinType':e['coinType']||'','role':h,'from':e['sender']??null,'to':e['recipient']??null};});}const EVENT_SEMANTIC_RULES=EVENT_SEMANTIC_REGISTRY['map'](a=>({'pattern':new RegExp(a['move_type']['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'i'),'business_meaning':a['business_meaning'],'category':a['category'],'side_effect':a['side_effect']}));function extractRelatedObject(a){if(!a||typeof a!=='object')return undefined;const b=a['fields']??a['payload']??a;if(typeof b!=='object')return undefined;for(const c of['object','object_id','objectId','parent','demand','service','order','machine','payment','progress','arb','allocation','resource','id']){const d=b[c];if(typeof d==='string'&&d['startsWith']('0x')&&d['length']>=0x6)return d;}return undefined;}const BUILTIN_EVENT_TYPE_MAP=Object['fromEntries'](EVENT_SEMANTIC_REGISTRY['map'](a=>[a['name'],a['move_type']]));export function eventToSemantic(a){const b=String(a?.['type']??a?.['event_type']??''),c=String(a?.['type_raw']??''),d=[c,b,BUILTIN_EVENT_TYPE_MAP[b]??'']['filter'](Boolean),e=EVENT_SEMANTIC_RULES['find'](h=>d['some'](i=>h['pattern']['test'](i)));if(!e)return{'event_type':b,'business_meaning':'Unknown\x20event','category':'other'};const f=e['extractRelatedObject']?e['extractRelatedObject'](a):extractRelatedObject(a),g={'event_type':b,'business_meaning':e['business_meaning'],'category':e['category']};if(f)g['related_object']=f;if(e['side_effect'])g['side_effect']=e['side_effect'];return g;}export function annotateEvents(a){if(!Array['isArray'](a))return[];return a['map'](eventToSemantic);}export function referencesExistingObject(a){return typeof a?.['object']==='string';}function evidenceHolds(a,b,c){switch(a){case'receipt':return c?c['executed']:!![];case'chain_read':return!![];case'creation_only':return!referencesExistingObject(b);}}const NEXT_ACTION_RULES=[{'when':a=>a==='service','evidence':'creation_only','action':'publish\x20the\x20Service\x20when\x20configuration\x20is\x20complete','reason':'Service\x20must\x20be\x20published\x20before\x20customers\x20can\x20order','tool':'onchain_operations\x20(service\x20with\x20publish:true)','priority':'recommended'},{'when':a=>a==='service','evidence':'creation_only','action':'add\x20Machine\x20nodes\x20to\x20define\x20the\x20service\x20workflow','reason':'Machine\x20drives\x20order\x20state\x20transitions','tool':'onchain_operations\x20(machine)','priority':'recommended'},{'when':a=>a==='machine','evidence':'receipt','action':'bind\x20Progress\x20to\x20track\x20order\x20execution','reason':'Progress\x20provides\x20customer-visible\x20status\x20updates','tool':'onchain_operations\x20(progress)','priority':'recommended'},{'when':a=>a==='order','evidence':'receipt','action':'wait\x20for\x20customer\x20payment\x20or\x20proceed\x20to\x20allocation','reason':'Order\x20lifecycle:\x20payment\x20→\x20allocation\x20→\x20completion','priority':'optional'},{'when':(a,b)=>a==='order'&&b?.['transfer_to']!==undefined,'evidence':'receipt','action':'inform\x20the\x20end\x20customer\x20about\x20the\x20supplier/sub-contractor\x20who\x20will\x20fulfill\x20this\x20order','reason':'O-5\x20procurement\x20sub-order\x20transparency:\x20customers\x20have\x20the\x20right\x20to\x20know\x20who\x20fulfills\x20their\x20order','tool':'messenger_operation\x20(notify\x20customer)','priority':'recommended'},{'when':a=>a==='demand','evidence':'receipt','action':'wait\x20for\x20presenter\x20submissions\x20or\x20evaluate\x20existing\x20ones','reason':'Demand\x20lifecycle:\x20presenters\x20submit\x20solutions\x20for\x20reward','priority':'optional'},{'when':a=>a==='reward','evidence':'receipt','action':'deposit\x20funds\x20into\x20the\x20reward\x20pool','reason':'Reward\x20pool\x20must\x20be\x20funded\x20before\x20claimants\x20can\x20withdraw','tool':'onchain_operations\x20(treasury)','priority':'recommended'},{'when':a=>a==='bridge_cross_chain_wow_to_evm','evidence':'receipt','action':'poll\x20query_transfer_status\x20until\x20bridge\x20signs\x20(~1-5\x20min),\x20then\x20call\x20claim_wow_to_evm\x20to\x20complete','reason':'Cross-chain\x20WOW→EVM\x20is\x20a\x202-step\x20process:\x20deposit\x20first,\x20then\x20claim\x20after\x20bridge\x20confirmation','tool':'bridge_operation\x20(query_transfer_status,\x20then\x20claim_wow_to_evm)','priority':'required'},{'when':a=>a==='bridge_cross_chain_evm_to_wow','evidence':'receipt','action':'poll\x20query_transfer_status\x20to\x20monitor\x20auto-claim\x20progress\x20(~10-20\x20min)','reason':'EVM→WOW\x20cross-chain\x20auto-claims;\x20monitor\x20progress\x20but\x20no\x20manual\x20action\x20needed','tool':'bridge_operation\x20(query_transfer_status)','priority':'recommended'},{'when':a=>a==='bridge_claim_wow_to_evm','evidence':'receipt','action':'verify\x20recipient\x20EVM\x20balance\x20updated','reason':'Claim\x20completes\x20the\x20cross-chain\x20transfer;\x20verify\x20funds\x20arrived\x20on\x20EVM\x20side','tool':'bridge_operation\x20(query_active_evm_account)','priority':'recommended'},{'when':a=>a==='bridge_withdraw','evidence':'receipt','action':'verify\x20WOW\x20balance\x20updated','reason':'Withdrawal\x20moves\x20funds\x20from\x20active\x20EVM\x20account\x20to\x20WOW;\x20verify\x20balance','tool':'account_operation\x20(balance)','priority':'recommended'},{'when':a=>a==='account_new','evidence':'receipt','action':'claim\x20faucet\x20tokens\x20for\x20gas\x20if\x20on\x20testnet,\x20then\x20proceed\x20to\x20create\x20Service','reason':'New\x20account\x20needs\x20gas\x20tokens\x20before\x20on-chain\x20operations','tool':'account_operation\x20(faucet)','priority':'recommended'},{'when':a=>a==='account_faucet','evidence':'receipt','action':'proceed\x20to\x20create\x20Permission\x20and\x20Service\x20objects','reason':'Account\x20is\x20now\x20funded;\x20start\x20building\x20your\x20service','tool':'onchain_operations\x20(permission,\x20service)','priority':'recommended'},{'when':a=>a==='query_toolkit','evidence':'chain_read','action':'use\x20the\x20queried\x20object\x20data\x20to\x20plan\x20next\x20operations','reason':'Query\x20results\x20reveal\x20current\x20object\x20states\x20for\x20decision-making','priority':'optional'}];function inferNextActions(a,b,c,d){return NEXT_ACTION_RULES['filter'](e=>e['when'](a,b,c)&&evidenceHolds(e['evidence'],b,d))['map'](e=>({'action':e['action'],'reason':e['reason'],'tool':e['tool'],'priority':e['priority']}));}const WARNING_RULES=[{'when':(a,b)=>a==='service'&&b?.['order_allocators']===undefined,'evidence':'creation_only','message':'order_allocators\x20not\x20configured;\x20order\x20funds\x20cannot\x20be\x20distributed\x20automatically'},{'when':(a,b)=>a==='reward'&&(b?.['balance']==='0'||b?.['balance']===0x0),'evidence':'receipt','message':'Reward\x20pool\x20balance\x20is\x20zero;\x20claimants\x20cannot\x20withdraw'},{'when':(a,b)=>a==='order'&&b?.['transfer_to']!==undefined,'evidence':'receipt','message':'[TRANSPARENCY]\x20Order\x20ownership\x20is\x20being\x20transferred\x20(likely\x20to\x20a\x20supplier/sub-contractor).\x20'+'Ensure\x20the\x20end\x20customer\x20is\x20informed\x20about\x20who\x20fulfills\x20their\x20order\x20—\x20this\x20builds\x20trust\x20and\x20is\x20required\x20for\x20procurement\x20sub-orders.'}];function inferWarnings(a,b,c){return WARNING_RULES['filter'](d=>d['when'](a,b)&&evidenceHolds(d['evidence'],b,c))['map'](d=>d['message']);}function composeSummary(a,b,c,d,e){const f=a['replace'](/_/g,'\x20');if(b==='failed')return'Failed\x20to\x20'+f;if(b==='pending_input')return f+'\x20requires\x20Guard\x20submission\x20to\x20proceed';const g=[];if(c['length'])g['push']('created\x20'+c['length']+'\x20object(s)');if(d['length'])g['push']('modified\x20'+d['length']+'\x20object(s)');if(e['length']){if(a==='allocate_funds'){const h=e['map'](i=>{const j=i['amount'],k=shortCoinType(i['coinType']),l=i['to']?shortAddr(i['to']):null,m=i['from']?shortAddr(i['from']):null;if(l)return j+'\x20'+k+'\x20→\x20'+l;if(m)return j+'\x20'+k+'\x20from\x20'+m;return j+'\x20'+k;})['join'](';\x20');g['push']('distributed:\x20'+h);}else g['push'](e['length']+'\x20fund\x20movement(s)');}return'Successfully\x20'+f+(g['length']?'\x20('+g['join'](',\x20')+')':'');}function shortAddr(a){return formatShortAddress(a);}function shortCoinType(a){if(!a)return'coin';const b=a['split']('::');return b[b['length']-0x1]||a;}const ADVICE_PRIORITY_RANK={'required':0x0,'recommended':0x1,'info':0x2,'reminder':0x3};function evaluationFromPayload(a){const b=a?.['evaluation']??a?.['result']?.['evaluation'];return b&&typeof b==='object'&&b['trust']&&b['risk']&&Array['isArray'](b['coverage'])?b:undefined;}function dimensionEvidence(a){const c=[dimensionLabel(a['rule_id'])+'\x20'+a['score']+'/100'];if(a['reason'])c['push'](a['reason']);if(a['mismatched']&&a['mismatched']['length']>0x0)c['push']('missing/unmet:\x20'+a['mismatched']['join'](',\x20'));return c['join']('\x20—\x20');}function buildCustomerAdvice(a,c,d,e,f){if(!a372a('customer_intelligence'))return undefined;let g;if(a==='service'&&c?.['order_new'])g='preorder';else{if(a==='query_toolkit'||a==='onchain_table_data'||a==='onchain_events')g='browse';else return undefined;}const h=e??evaluationFromPayload(d);if(!h)return undefined;const i=[],j=(s,t,u,v)=>{i['push']({'id':s,'stage':g,'priority':t,'message':u,...v?{'action':v}:{}});},k=[...new Set([...h['trust']['red_flags']??[],...h['risk']['red_flags']??[]])];k['length']>0x0&&(f?j('advice_red_flags','required','Advisory\x20—\x20the\x20order\x20already\x20executed,\x20so\x20this\x20could\x20not\x20prevent\x20payment\x20('+k['length']+'\x20structural\x20red\x20flag(s)):\x20'+k['join'](';\x20')+'.\x20Raise\x20them\x20with\x20the\x20merchant\x20before\x20relying\x20on\x20the\x20order','Discuss\x20the\x20red\x20flags\x20with\x20the\x20merchant\x20via\x20Messenger;\x20for\x20future\x20orders\x20pick\x20another\x20service\x20if\x20unresolved'):j('advice_red_flags','required','Pre-payment\x20advisory\x20(the\x20gate\x20does\x20not\x20stop\x20the\x20payment)\x20—\x20'+k['length']+'\x20structural\x20red\x20flag(s):\x20'+k['join'](';\x20'),'Resolve\x20the\x20red\x20flags\x20with\x20the\x20merchant\x20or\x20pick\x20another\x20service\x20before\x20paying'));const l=(h['trust']['breakdown']??[])['filter'](s=>!s['red_flag']&&s['score']<0x46)['sort']((s,t)=>s['score']-t['score'])['slice'](0x0,0x2);for(const s of l){j('advice_trust_'+s['rule_id'],'recommended',dimensionEvidence(s),'Discuss\x20this\x20evidence\x20with\x20the\x20merchant\x20via\x20Messenger\x20before\x20ordering');}const m=(h['risk']['breakdown']??[])['filter'](t=>!t['red_flag']&&t['score']<0x64)['sort']((t,u)=>t['score']-u['score'])['slice'](0x0,0x2);for(const t of m){j('advice_risk_'+t['rule_id'],'recommended',dimensionEvidence(t),'Require\x20the\x20merchant\x20to\x20address\x20the\x20structural\x20findings\x20or\x20accept\x20the\x20stated\x20risk');}h['unverified']&&h['unverified']['length']>0x0&&j('advice_unverified','info','Unverifiable\x20dimensions\x20(excluded\x20from\x20the\x20score\x20due\x20to\x20fetch\x20gaps):\x20'+h['unverified']['map'](dimensionLabel)['join'](',\x20')+'\x20—\x20treat\x20them\x20as\x20unknown,\x20not\x20as\x20passed','Request\x20the\x20missing\x20material\x20from\x20the\x20merchant\x20or\x20verify\x20it\x20on-chain');for(const u of h['coverage']??[]){u['required']&&u['state']==='gap'&&j('advice_coverage_'+u['slot'],'info','Coverage\x20gap:\x20required\x20material\x20\x22'+u['slot']+'\x22\x20could\x20not\x20be\x20fetched\x20—\x20the\x20corresponding\x20evaluation\x20input\x20is\x20unknown');}i['length']===0x0&&j('advice_clean','info','No\x20adverse\x20findings\x20in\x20the\x20graph\x20evaluation\x20—\x20'+h['trust']['summary']+'\x20—\x20'+h['risk']['summary']);const n=[...i]['sort']((v,w)=>(ADVICE_PRIORITY_RANK[v['priority']]??0x9)-(ADVICE_PRIORITY_RANK[w['priority']]??0x9))['slice'](0x0,0x8),o=[];for(const v of n){if(v['action']&&!o['includes'](v['action']))o['push'](v['action']);}const p=getProfile(),q=p['risk_appetite']==='conservative'?0x46:p['risk_appetite']==='aggressive'?0x1e:0x32;return h['trust']['total']<q&&!o['some'](w=>w['includes']('below\x20your\x20risk\x20appetite'))&&o['push']('Trust\x20'+h['trust']['total']+'/100\x20is\x20below\x20your\x20risk\x20appetite\x20('+q+')\x20—\x20'+h['trust']['summary']),{'risk_score':h['risk']['total'],'risk_level':h['risk']['level'],'recommendations':o,'reminders':n};}function buildGuardAdvice(a,b,c,d){try{if(a==='guard')return buildGuardCreateAdvice(b);if(a==='gen_passport'){const f=d?.['passport_test'];if(f&&typeof f['result']==='boolean'){const i=f['result']===!![],j=(f['info']??[])['filter'](k=>k['impack']!==![]&&k['result']===![])['map'](k=>k['guard']);return{'current_round':'R8','test_result':{'status':i?'pass':'fail','passport_id':f['passport_id'],'failure_node':i?undefined:j['length']?'Guard\x20evaluated\x20false:\x20'+j['slice'](0x0,0x3)['join'](',\x20')+(j['length']>0x3?'\x20(+'+(j['length']-0x3)+'\x20more)':''):'Passport\x20result\x20is\x20false\x20on-chain','guard_results':f['info']?.['map'](k=>({'guard':k['guard'],'result':k['result']===!![],...k['impack']!==undefined?{'impack':k['impack']}:{}}))}};}const g=typeof c?.['error']==='string'?c['error']:undefined,h=g?'fail':'not_tested';return{'current_round':'R8','test_result':{'status':h,'passport_id':h==='fail'?undefined:c?.['passport'],'failure_node':g?g['slice'](0x0,0x78):'Guard\x20outcome\x20unknown\x20—\x20the\x20Passport\x20could\x20not\x20be\x20read\x20back\x20(dry-run\x20or\x20read\x20failure).\x20Query\x20the\x20Passport\x20object\x20or\x20re-run\x20without\x20dry_run\x20to\x20learn\x20the\x20real\x20result'}};}const e=typeof c?.['error']==='string'?c['error']:'';if(e['includes']('GUARD')||e['includes']('Guard')||e['includes']('guard'))return{'risk_warnings':['Guard\x20verification\x20failed:\x20'+e['slice'](0x0,0xc8),'Suggestion:\x20if\x20the\x20Guard\x20defines\x20submission\x20items,\x20check\x20that\x20the\x20submitted\x20data\x20matches\x20the\x20Guard\x20table\x20declaration\x20and\x20resubmit\x20via\x20call_with_submission;\x20if\x20it\x20defines\x20none,\x20the\x20Guard\x20rule\x20evaluated\x20false\x20—\x20inspect\x20the\x20rule\x27s\x20conditions\x20(signer/query/state)\x20against\x20this\x20call,\x20or\x20query\x20the\x20Guard\x20definition\x20(guard2file)\x20to\x20see\x20which\x20condition\x20failed']};return undefined;}catch{return undefined;}}function buildGuardCreateAdvice(a){if(!a)return undefined;const b=convertCallDataToPuzzleInput(a),c=derivePuzzleFromCallData(b),d=getPuzzleStatusBooleans(c);let e,f,g;a['binding_hint']?.['action']&&(e=inferSceneFromAction(a['binding_hint']['action']),e&&(f=e['name'],g=e['special_constraints']));let h;const i=a['binding_hint']?.['rule_sentence']||a['binding_hint']?.['action']||'';if(i){const r=matchSemanticPattern(i);r['length']>0x0&&(h=r['map'](s=>s['id']+':\x20'+s['pattern_name']));}let j;try{const s=generateConfirmationText(c);!s['startsWith']('[Puzzle\x20incomplete]')&&(j=s);}catch{}let k;const l=getPendingQuestions(c);l['length']>0x0&&(k=l);let m;if(e){const t=mapSceneToObjectType(e);if(t){const u=GUARDQUERY['filter'](v=>v['objectType']===t)['slice'](0x0,0xa)['map'](v=>({'id':v['id'],'name':v['name'],'objectType':String(v['objectType']),'returnType':String(v['return']),'description':v['description']}));u['length']>0x0&&(m=u);}}const n=evaluateGuardDraft({'table':a['table']??[],'root':a['root'],'rely':a['rely']})['assessment'];let o,p;if(n){const v=getRiskSummary(n);o={'overall_risk':v['risk_count']>0x0?n['overall_risk']:'info','risk_count':v['risk_count'],'critical_count':v['critical_count'],'high_count':v['high_count'],'needs_human_review':v['needs_human_review'],'top_risks':v['top_risks'],'stakeholder_advice':n['stakeholder_advice']};const w=n['risks']['map'](x=>'['+x['level']['toUpperCase']()+']\x20'+x['title']+':\x20'+x['description']);w['length']>0x0&&(p=w);}const q={'current_round':'R7','puzzle_status':d};if(e)q['matched_scene']=e['id'];if(f)q['scene_description']=f;if(g)q['scene_constraints']=g;if(h)q['suggested_patterns']=h;if(m)q['available_queries']=m;if(p)q['risk_warnings']=p;if(k)q['pending_questions']=k;if(j)q['confirmation_text']=j;if(o)q['risk_assessment']=o;return q;}function convertCallDataToPuzzleInput(a){const b={};Array['isArray'](a['table'])&&(b['table']=a['table']['map'](c=>({'identifier':c['identifier'],'b_submission':c['b_submission'],'value_type':typeof c['value_type']==='string'?c['value_type']:String(c['value_type']),'value':convertValueSnapshot(c['value']),'name':c['name']??'','object_type':c['object_type']})));if(a['root']&&typeof a['root']==='object'){const c=a['root'];if(c['type']!=='file'&&c['type']!=='node')b['root']=convertNodeToSnapshot(a['root']);else c['type']==='node'&&a['root']['node']&&(b['root']=convertNodeToSnapshot(a['root']['node']));}a['rely']&&Array['isArray'](a['rely']['guards'])&&(b['rely']={'guards':a['rely']['guards']['map'](d=>typeof d==='string'?d:String(d)),'logic_or':a['rely']['logic_or']});if(a['binding_hint']){const d=a['binding_hint'],e={'action':d['action'],'host_object':d['host_object'],'binding_field':d['binding_field']};if(d['rule_sentence']!==undefined)e['rule_sentence']=d['rule_sentence'];if(d['failure_conditions']!==undefined)e['failure_conditions']=d['failure_conditions'];if(d['circular_reference']!==undefined)e['circular_reference']=d['circular_reference'];b['binding_hint']=e;}return b;}function convertNodeToSnapshot(a){if(!a||typeof a!=='object')return{'type':'unknown'};const b={'type':String(a['type']??'unknown')};typeof a['identifier']==='number'&&(b['identifier']=a['identifier']);a['query']!==undefined&&(b['query']=typeof a['query']==='number'?a['query']:String(a['query']));if(a['object']&&typeof a['object']==='object'){const c={'identifier':Number(a['object']['identifier'])};typeof a['object']['convert_witness']==='number'&&(c['convert_witness']=a['object']['convert_witness']),b['object']=c;}Array['isArray'](a['parameters'])&&(b['parameters']=a['parameters']['map'](d=>convertNodeToSnapshot(d)));if(typeof a['context']==='string'){const d=a['context'];(d==='Clock'||d==='Guard'||d==='Signer')&&(b['context']=d);}return Array['isArray'](a['nodes'])&&(b['nodes']=a['nodes']['map'](e=>convertNodeToSnapshot(e))),a['node']&&(b['node']=convertNodeToSnapshot(a['node'])),a['nodeLeft']&&(b['nodeLeft']=convertNodeToSnapshot(a['nodeLeft'])),a['nodeRight']&&(b['nodeRight']=convertNodeToSnapshot(a['nodeRight'])),b;}function convertValueSnapshot(a){if(a===undefined||a===null)return undefined;if(typeof a==='string'||typeof a==='number'||typeof a==='boolean')return a;if(Array['isArray'](a)){const b=a['every'](e=>typeof e==='string');if(b)return a;const c=a['every'](e=>typeof e==='number');if(c)return a;const d=a['every'](e=>typeof e==='boolean');if(d)return a;return JSON['stringify'](a);}return JSON['stringify'](a);}function mapSceneToObjectType(a){const b=a['host_object'];if(b==='Standalone')return undefined;return b;}export function buildSemantic(a,b){if(!b)return undefined;const c=inferIntent(b['operation_type'],b['data']),d=inferStatus(a),e=tagObjectRoles(a['created']),g=tagObjectRoles(a['modified']),h=tagFundRoles(a['balanceChanges'],b['operation_type'],b['data'],a['events']),i=annotateEvents(a['events']),j=inferNextActions(b['operation_type'],b['data'],d,a),k=inferWarnings(b['operation_type'],b['data'],a);b['pre_warnings']&&b['pre_warnings']['length']>0x0&&k['push'](...b['pre_warnings']);if(b['operation_type']==='service'&&b['data']?.['publish']===!![]){const r=auditService(b['data']);for(const s of r){const t=s['severity']==='error'?'[AUDIT\x20ERROR]\x20':s['severity']==='warning'?'[AUDIT]\x20':'[INFO]\x20';k['push'](t+s['message']);}}let l;const m=a372a('experience_layer');if(m)try{const u=getExperienceFeedback(b['operation_type'],b['data'],c);u&&(l=u);const v=d==='success'?'success':d==='failed'?'failed':'partial',w=[...e,...g]['map'](y=>y['id'])['filter'](Boolean),x=inferErrorCodeForSignal(a);recordOperationOutcome(b['operation_type'],b['data'],c,v,x,w);}catch{}let n;if(a372a('industry_evolution'))try{const y=typeof b['data']?.['industry']==='string'&&b['data']['industry']['trim']()?b['data']['industry']['trim']():undefined;if(y&&!m){const z=d==='success'?{'success':!![]}:{'success':![],'error_code':inferErrorCodeForSignal(a)};recordIndustrySignal(y,{'type':b['operation_type'],'data':b['data']},z);}if(y){const A=injectEvolutionContext(undefined,y,deriveAdviceRole(b['operation_type'],b['data']));A&&(A['industry_signal']||A['evolution_advice']||A['confidence']>0x0)&&(n=A);}}catch{}let o;if(a372a('semantic_rich'))try{const B=listServices(),C=B['filter'](E=>E['enabled'])['map'](E=>E['name']),D=B['filter'](E=>!E['enabled'])['map'](E=>E['name']);o={'active':C,'inactive':D['length']?D:undefined};}catch{}let p;try{p=buildCustomerAdvice(b['operation_type'],b['data'],a['raw'],b['evaluation']??evaluationFromPayload(a['raw']),a['executed']);}catch{}let q;try{q=buildGuardAdvice(b['operation_type'],b['data'],a['raw'],b);}catch{}return{'intent':c,'status':d,'summary':composeSummary(c,d,e,g,h),'created':e['length']?e:undefined,'modified':g['length']?g:undefined,'released':h['length']?h:undefined,'events':i['length']?i:undefined,'next_actions':j['length']?j:undefined,'warnings':k['length']?k:undefined,'experience':l,'service_status':o,'customer_advice':p,'evolution_context':n,'guard_advice':q};}function inferErrorCodeForSignal(a){if(a['error'])return a['error']['slice'](0x0,0x40);return undefined;}export function buildDataSemantic(a,b,c,d){if(!b)return undefined;const e=inferIntent(b['operation_type'],b['data']),f=[];b['pre_warnings']&&b['pre_warnings']['length']>0x0&&f['push'](...b['pre_warnings']);let g;if(c)g='failed';else{g='success';if(Array['isArray'](a)&&a['length']===0x0)g='partial',f['push']('no\x20results\x20found');else{if(a===null||a===undefined)g='partial',f['push']('no\x20results\x20found');else{if(typeof a==='object'&&!Array['isArray'](a)){const n=Object['values'](a);n['length']>0x0&&n['every'](o=>Array['isArray'](o)?o['length']===0x0:o===null||o===undefined)&&(g='partial',f['push']('no\x20results\x20found'));}}}}const h=inferNextActions(b['operation_type'],b['data'],g);let i;if(!c&&b['operation_type']==='onchain_events'){const o=Array['isArray'](a)?a:a?.['data']&&Array['isArray'](a['data'])?a['data']:null;if(o){i=annotateEvents(o);if(i['length']===0x0)i=undefined;}}const j=e['replace'](/_/g,'\x20');let k;if(g==='failed')k=d?'Failed\x20to\x20'+j+':\x20'+d:'Failed\x20to\x20'+j;else g==='partial'?k=j+'\x20completed\x20with\x20no\x20results':k='Successfully\x20'+j;let l;if(a372a('semantic_rich'))try{const p=listServices(),q=p['filter'](t=>t['enabled'])['map'](t=>t['name']),r=p['filter'](t=>!t['enabled'])['map'](t=>t['name']);l={'active':q,'inactive':r['length']?r:undefined};}catch{}let m;if(!c)try{m=buildCustomerAdvice(b['operation_type'],b['data'],a,b['evaluation']??evaluationFromPayload(a));}catch{}return{'intent':e,'status':g,'summary':k,'events':i,'next_actions':h['length']?h:undefined,'warnings':f['length']?f:undefined,'service_status':l,'customer_advice':m};}
1
+ import{getExperienceFeedback,recordOperationOutcome}from'../../experience/index.js';import{isEnabled as a369a,listServices}from'../../config/index.js';import{dimensionLabel}from'../../evaluation/standards.js';import{getProfile}from'../../experience/user-profile.js';import{injectEvolutionContext,recordIndustrySignal}from'../../knowledge/flywheel-loop.js';import{WException,getMoveErrorDescription,WErrors}from'@wowok/wowok';import{GUARDQUERY}from'@wowok/wowok';import{getRiskSummary}from'../../knowledge/guard-risk.js';import{evaluateGuardDraft}from'../../knowledge/guard-eval.js';import{derivePuzzleFromCallData,getPuzzleStatusBooleans,getPendingQuestions,generateConfirmationText}from'../../knowledge/guard-puzzle.js';import{inferSceneFromAction}from'../../knowledge/guard-ledger.js';import{matchSemanticPattern}from'../../knowledge/guard-translation.js';import{formatShortAddress}from'../../persona/address-format.js';import{EVENT_SEMANTIC_REGISTRY}from'../../knowledge/event-semantics.js';function deriveAdviceRole(a,b){switch(a){case'order':case'personal':case'demand':return'customer';case'service':case'machine':case'permission':case'reward':case'repository':case'allocator':case'treasury':return'merchant';case'arbitration':if(b?.['vote']!==undefined)return'arbitrator';if(b?.['dispute']!==undefined)return'customer';return undefined;default:return undefined;}}const ERROR_RULES=[{'patterns':[/^(?:error\s*:\s*)?invalid\s+(?:parameter|argument(?:\s+type)?)\b/i],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Check\x20parameter\x20format\x20against\x20the\x20tool\x20schema;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements','detail_overrides':[{'patterns':[/\bis\s+paused\b/i,/\balready\s+published\b/i,/\bis\s+published\b/i,/\bnot\s+published\b/i,/\bis\s+frozen\b/i,/\block\s+duration\b/i,/\bstatus\s+(?:does\s+not\s+)?mismatch\b/i],'error_code':'state_conflict','recovery_hint':'Object\x20state\x20conflicts\x20with\x20the\x20operation\x20—\x20the\x20parameters\x20are\x20not\x20the\x20problem.\x20Query\x20the\x20object\x27s\x20current\x20state\x20with\x20query_toolkit\x20(add\x20no_cache\x20if\x20it\x20was\x20recently\x20changed\x20by\x20another\x20party)\x20and\x20wait\x20for\x20the\x20state\x20to\x20change\x20or\x20adjust\x20the\x20operation'}]},{'patterns':[/transaction\s+expired/i],'error_code':'transaction_expired','retryable':!![],'recovery_hint':'The\x20transaction\x20expired\x20before\x20it\x20could\x20be\x20executed\x20(epoch\x20boundary\x20or\x20validator/gateway\x20outage)\x20—\x20it\x20did\x20NOT\x20land\x20and\x20nothing\x20was\x20committed.\x20Wait\x20with\x20bounded\x20backoff\x20and\x20resubmit\x20the\x20SAME\x20call\x20unchanged;\x20if\x20unsure\x20whether\x20a\x20previous\x20attempt\x20landed,\x20check\x20onchain_events\x20/\x20recent\x20transactions\x20first.\x20A\x20dry_run\x20that\x20passes\x20while\x20the\x20real\x20call\x20keeps\x20failing\x20confirms\x20the\x20fault\x20is\x20chain-side'},{'patterns':[/\barity\s*mismatch\b/i,/transaction\s+resolution\s+failed/i],'error_code':'config_error','retryable':![],'recovery_hint':'The\x20chain\x20rejected\x20the\x20transaction\x20at\x20PTB\x20resolution\x20—\x20a\x20command\x20in\x20the\x20batch\x20passes\x20the\x20wrong\x20number\x20or\x20shape\x20of\x20arguments\x20for\x20its\x20target\x20function.\x20This\x20is\x20almost\x20always\x20an\x20SDK/chain\x20version\x20drift\x20(the\x20deployed\x20framework\x27s\x20function\x20signatures\x20changed\x20while\x20the\x20installed\x20package\x20build\x20is\x20older),\x20NOT\x20a\x20parameter\x20mistake:\x20upgrading/rebuilding\x20the\x20@wowok\x20packages\x20to\x20match\x20the\x20deployed\x20framework\x20is\x20the\x20fix.\x20To\x20audit,\x20fetch\x20the\x20target\x20signature\x20with\x20w_getMoveFunctionArgTypes(\x27<package>::<module>::<function>\x27)\x20and\x20compare\x20the\x20returned\x20arg-type\x20list\x20against\x20the\x20arguments\x20the\x20failing\x20command\x20built'},{'patterns':[/DEPENDENCY RESOLUTION FAILED/i],'error_code':'object_not_found','retryable':![],'recovery_hint':'A\x20referenced\x20object\x20could\x20not\x20be\x20resolved\x20—\x20read\x20the\x20\x27Original\x20error\x27\x20line\x20for\x20the\x20exact\x20name.\x20Check\x20the\x20spelling\x20in\x20local_mark_list,\x20create\x20the\x20dependency\x20first,\x20or\x20verify\x20env.network\x20matches\x20the\x20object\x27s\x20network'},{'patterns':[/Repository content not ready/i],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'The\x20Repository\x20must\x20already\x20exist\x20before\x20data_add\x20—\x20split\x20the\x20call:\x20first\x20create\x20the\x20Repository\x20(object\x20form,\x20no\x20data_add),\x20then\x20add\x20data\x20in\x20a\x20second\x20call.\x20data_add.name\x20must\x20also\x20match\x20a\x20policy\x20rule\x20name'},{'patterns':[/too\s*many\s*requests/i,/rate\s*limit/i,/\b429\b/,/throttl/i,/faucet.*rate/i,/request.*limit.*exceeded/i],'error_code':'rate_limit','retryable':!![],'recovery_hint':'Rate\x20limit\x20hit\x20(HTTP\x20429).\x20Wait\x20with\x20exponential\x20backoff\x20and\x20retry.\x20To\x20check\x20existing\x20balance,\x20use\x20account_balance\x20query.'},{'patterns':[/gas.*budget.*exceeded/i,/out\s*of\s*gas/i,/gas\s*exceeded/i,/insufficient\s*gas/i,/not\s*enough\s*gas/i,/could not automatically determine a budget/i,/dry run failed.*budget/i,/Maximum gas/i],'error_code':'gas_exceeded','retryable':!![],'recovery_hint':'Gas\x20budget\x20exceeded.\x20Increase\x20the\x20gas_budget\x20parameter\x20or\x20claim\x20more\x20gas\x20tokens,\x20then\x20retry'},{'patterns':[/stock\s*not\s*enough/i,/E_STOCK_NOT_ENOUGH/i],'error_code':'stock_exhausted','retryable':![],'recovery_hint':'Merchant-side\x20stock\x20exhausted\x20(NOT\x20a\x20balance\x20issue).\x20Reduce\x20the\x20quantity,\x20pick\x20another\x20sale\x20item,\x20or\x20ask\x20the\x20merchant\x20to\x20restock'},{'patterns':[/sale\s*(item\s*)?(is\s*)?suspended/i,/E_SALE_SUSPENDED/i],'error_code':'sale_suspended','retryable':![],'recovery_hint':'The\x20sale\x20item\x20is\x20suspended\x20by\x20the\x20merchant.\x20Pick\x20another\x20item\x20or\x20contact\x20the\x20merchant'},{'patterns':[/discount.*time.*(?:window|invalid)/i,/E_DISCOUNT_TIME_INVALID/i],'error_code':'discount_invalid','retryable':![],'recovery_hint':'Discount\x20is\x20outside\x20its\x20[time_start,\x20time_end]\x20validity\x20window.\x20Buy\x20without\x20the\x20discount\x20or\x20ask\x20the\x20merchant\x20for\x20a\x20fresh\x20one'},{'patterns':[/insufficient\s*(balance|coin|fund)/i,/insufficient\s*amount/i,/ENOTENOUGH/i,/not\s*enough\s*(coin|balance)/i,/balance\s*not\s*enough/i,/balance\s+insufficient/i,/balance\s+too\s+low/i,/not\s+enough\s+(coin|balance|fund|gas)/i,/no\s+coins/i,/Insufficient balance/i],'error_code':'insufficient_balance','retryable':!![],'recovery_hint':'Claim\x20faucet\x20tokens\x20via\x20account_operation\x20(faucet)\x20then\x20retry\x20the\x20call'},{'patterns':[/bcs.*(error|fail|invalid)/i,/BCS serialization/i,/serialization\s*(failure|error)/i,/deserialization\s*(failure|error)/i,/invalid bcs type/i,/Out of range.*bcs/i,/not\s+bool/i,/Length out of range/i,/parse object content failed/i],'error_code':'bcs_error','retryable':![],'recovery_hint':'BCS\x20serialization/deserialization\x20error.\x20Verify\x20data\x20types\x20and\x20structure\x20match\x20the\x20expected\x20schema'},{'patterns':[/signature.*(invalid|fail|error|verif)/i,/invalid\s*signature/i,/signature\s*verification\s*failed/i,/bad\s*signature/i,/signing\s*fail/i,/crypto.*signature/i,/ed25519.*(fail|error|invalid)/i,/secp256k1.*(fail|error|invalid)/i,/failed\s+to\s+recover\s+public\s+key/i],'error_code':'signature_error','retryable':![],'recovery_hint':'Signature\x20verification\x20failed.\x20Check\x20that\x20the\x20correct\x20private\x20key\x20and\x20network\x20configuration\x20are\x20correct'},{'patterns':[/config.*(not set|not found|invalid|missing)/i,/RPC\s*not\s*configured/i,/network.*not\s*specified/i,/protocol network not specified/i,/account persistent storage not set/i,/config persistent storage not set/i,/account persistent storage not found/i,/no\s*rpc\s*url/i],'error_code':'config_error','retryable':![],'recovery_hint':'Configuration\x20error.\x20Verify\x20that\x20network,\x20RPC\x20endpoints,\x20and\x20required\x20environment\x20variables\x20are\x20properly\x20configured'},{'patterns':[/wrong\s+network/i,/network\s+mismatch/i,/unsupported\s+network/i,/unrecognized\s+network/i,/invalid\s+network/i,/network\s+not\s+supported/i,/not\s+found\s+on\s+network/i],'error_code':'config_error','retryable':![],'recovery_hint':'The\x20requested\x20network\x20does\x20not\x20match\x20the\x20configured\x20one.\x20Switch\x20to\x20the\x20intended\x20network\x20(user\x20confirmation\x20required)\x20—\x20retrying\x20will\x20not\x20help'},{'patterns':[/fetch\s*failed/i],'error_code':'network_error','retryable':![],'recovery_hint':'The\x20request\x20failed\x20at\x20transport\x20level\x20(\x27fetch\x20failed\x27)\x20and\x20the\x20submission\x20state\x20is\x20UNKNOWN\x20—\x20'+'the\x20transaction\x20may\x20or\x20may\x20not\x20have\x20been\x20submitted.\x20Do\x20NOT\x20blindly\x20retry:\x20first\x20query\x20the\x20target\x20'+'object/order\x20on-chain\x20to\x20confirm\x20whether\x20the\x20operation\x20took\x20effect,\x20then\x20retry\x20only\x20if\x20it\x20did\x20not.\x20'+'Retrying\x20without\x20checking\x20risks\x20a\x20duplicate\x20transaction\x20(e.g.\x20double\x20fund\x20allocation)'},{'patterns':[/timeout/i,/ECONNRESET/i,/ETIMEDOUT/i,/ECONNREFUSED/i,/EAI_AGAIN/i,/RPC\s*(error|failed|unreachable)/i,/socket\s*hang\s*up/i,/connection\s*(refused|reset|lost)/i,/dns\s*(error|fail)/i],'error_code':'network_error','retryable':!![],'recovery_hint':'Retry\x20the\x20call;\x20if\x20it\x20persists,\x20switch\x20RPC\x20endpoint\x20or\x20check\x20connectivity'},{'patterns':[/guard.*(reject|fail|denied|verif)/i,/verification\s*failed/i,/submission.*(invalid|fail|required)/i,/passport.*(invalid|fail|verif)/i,/passport\s+required/i,/move[._-]?abort.*guard/i,/Guard count exceeded limit/i,/Submission size exceeded limit/i,/Submission not found/i,/Guard not found/i,/Impact guard not found/i],'error_code':'guard_rejected','retryable':![],'recovery_hint':'If\x20the\x20Guard\x20defines\x20submission\x20items,\x20fill\x20them\x20(see\x20the\x20\x27submission\x27\x20field)\x20and\x20resubmit\x20via\x20call_with_submission;\x20if\x20it\x20defines\x20none,\x20the\x20Guard\x20rule\x20evaluated\x20false\x20—\x20check\x20the\x20rule\x27s\x20conditions\x20(signer/query/state)\x20against\x20this\x20call'},{'patterns':[/WIP file verification failed/i,/Failed to load WIP file/i,/WIP.*hash\s*mismatch/i,/wip.*hash.*not\s*match/i,/Invalid WIP file structure/i,/wip.*not\s*found/i,/wip.*unreachable/i,/wip_file.*error/i],'error_code':'wip_verification_failed','retryable':![],'recovery_hint':['WIP\x20file\x20must\x20be\x20publicly\x20accessible\x20via\x20HTTP(S)\x20URL\x20—\x20local\x20file\x20paths\x20cannot\x20be\x20stored\x20on-chain.','Deployment\x20options\x20(pick\x20one):','\x20\x201.\x20wip\x20storage\x20service\x20(easiest):\x20wip_file\x20{\x20type:\x20\x27upload\x27\x20}\x20—\x20official\x20free\x20store\x20wip.store.wowok.net\x20(10\x20files/account),','\x20\x20\x20\x20\x20or\x20storage=\x27custom\x27\x20with\x20your\x20own\x20/\x20a\x20third-party\x20wip\x20storage\x20service;\x20use\x20the\x20returned\x20public\x20URL\x20(base_url\x20+\x20/f/{hash}).','\x20\x202.\x20GitHub\x20Pages\x20(free,\x20stable):\x20upload\x20.wip\x20file\x20to\x20a\x20repo,\x20enable\x20Pages,\x20use\x20raw\x20URL.','\x20\x20\x20\x20\x20Example:\x20https://<user>.github.io/<repo>/<file>.wip','\x20\x20\x20\x20\x20Or\x20raw\x20URL:\x20https://raw.githubusercontent.com/<user>/<repo>/<branch>/<file>.wip','\x20\x203.\x20IPFS\x20(free,\x20decentralized):\x20upload\x20via\x20Pinata\x20(https://pinata.cloud)\x20or\x20nft.storage.','\x20\x20\x20\x20\x20Use\x20the\x20ipfs://<CID>\x20or\x20https://<gateway>/ipfs/<CID>\x20URL\x20form.','\x20\x20\x20\x20\x20Common\x20gateways:\x20https://ipfs.io/ipfs/,\x20https://cloudflare-ipfs.com/ipfs/,\x20https://dweb.link/ipfs/','\x20\x204.\x20User\x27s\x20own\x20website:\x20serve\x20the\x20.wip\x20file\x20from\x20your\x20static\x20site.','\x20\x205.\x20Generate\x20a\x20fresh\x20WIP\x20file\x20locally\x20first\x20via\x20wip_file\x20(type=\x27generate\x27),\x20upload\x20it,\x20then\x20re-submit\x20the\x20URL.','After\x20updating\x20the\x20sale\x27s\x20wip\x20URL,\x20re-run\x20the\x20operation.']['join']('\x0a')},{'patterns':[/WIP storage request .* failed: network error/i,/WIP storage (upload|delete|list) failed/i],'error_code':'wip_storage_unavailable','retryable':!![],'recovery_hint':['The\x20wip\x20storage\x20request\x20failed\x20at\x20the\x20transport\x20layer\x20—\x20usually\x20a\x20transient\x20network\x20problem.','Large\x20WIP\x20files\x20(multi-MB,\x20image-heavy)\x20are\x20especially\x20network-sensitive:','\x20\x201.\x20Retry\x20the\x20same\x20request\x20once\x20or\x20twice\x20before\x20investigating\x20further.','\x20\x202.\x20Keep\x20files\x20small:\x20compress\x20images\x20before\x20wip_file\x20type=\x27generate\x27\x20(each\x20image\x20<=\x202MB,\x20total\x20<=\x2010MB).','\x20\x203.\x20If\x20it\x20keeps\x20failing,\x20check\x20connectivity\x20to\x20the\x20storage\x20base\x20URL\x20(e.g.\x20curl\x20-I\x20<base_url>/api/health).','\x20\x204.\x20For\x20heavy\x20media,\x20consider\x20storage=\x27custom\x27\x20with\x20a\x20CDN-backed\x20service\x20near\x20your\x20users.']['join']('\x0a')},{'patterns':[/setting lock duration not exceeded/i,/E_LOCKED_TIME_NOT_ENOUGH/i,/locked time not enough/i,/lock duration not (?:elapsed|exceeded|met)/i],'error_code':'time_lock_not_elapsed','retryable':!![],'recovery_hint':'Service\x20setting_lock_duration\x20has\x20not\x20elapsed\x20since\x20pause.\x20Pause\x20the\x20Service,\x20wait\x20until\x20paused_time\x20+\x20setting_lock_duration\x20<=\x20current\x20time,\x20then\x20retry.'},{'patterns':[/already\s*publish/i,/object\s+is\s+immutable/i,/is\s+in\s+an?\s+immutable\s+state/i,/cannot\s*(modify|change|mutate)/i,/is\s*published/i,/Service already published/i,/Machine already published/i],'error_code':'immutable_violation','retryable':![],'recovery_hint':'Object\x20is\x20in\x20an\x20immutable\x20state\x20(e.g.\x20Service\x20already\x20published).\x20Recreate\x20the\x20object\x20if\x20a\x20different\x20config\x20is\x20needed'},{'patterns':[/no\s+permission/i,/missing\s+permissions?\b/i,/admin\s+permission\s+required/i,/lacks?\s+(?:the\s+)?(?:required\s+)?permission/i,/unauthorized/i,/forbidden/i,/not\s*(the\s*)?owner/i,/access\s*denied/i,/Permission denied/i,/Not the builder/i,/Not admin/i,/No operation permission/i,/Not the holder/i,/not\s+(?:authorized|approved)\b/i,/not\s+allowed/i,/unable\s+to\s+receive\s+object/i],'error_code':'permission_denied','retryable':![],'recovery_hint':'Use\x20an\x20account\x20with\x20the\x20required\x20permission,\x20or\x20pass\x20permission_guard\x20IDs\x20via\x20env.permission_guard'},{'patterns':[/not\s*found/i,/does\s*not\s*exist/i,/ENOTFOUND/i,/no\s*such\s*object/i,/unknown\s*object/i,/account not found/i,/address not found/i,/token not found/i,/Node not found/i,/Policy not found/i,/Reward not found/i],'error_code':'object_not_found','retryable':![],'recovery_hint':'Verify\x20the\x20object\x20ID/name\x20with\x20query_toolkit;\x20local_mark\x20names\x20are\x20case-sensitive'},{'patterns':[/state\s*(conflict|mismatch)/i,/already\s*exist/i,/conflict/i,/duplicate/i,/version\s*mismatch/i,/name exist/i,/Duplicate forward name/i,/Duplicate node previous/i,/already claimed/i,/already specified/i,/already accomplished/i,/already used/i,/Status does not match/i,/does not match/i,/\bnot\s+published\b/i,/\bis\s+paused\b/i,/global\s+pause/i,/\bis\s+listed\b/i,/not\s+listed\b/i,/\blocked\b/i,/\bmismatch\b/i,/already\s+(?:set|minted|listed|verified|authorized)\b/i,/\bnot\s+empty\b/i,/non-zero\s+balance/i,/\bnot\s+match\b/i,/not\s+set\s+for\s+epoch/i,/no\s+allocator\b/i,/not\s+satisfied/i,/invariant\s+violation/i],'error_code':'state_conflict','retryable':![],'recovery_hint':'Object\x20state\x20conflicts\x20with\x20the\x20operation.\x20Query\x20the\x20current\x20state\x20with\x20query_toolkit\x20and\x20adjust\x20parameters'},{'patterns':[/\b(?:coin|fee)\s+not\s+enough\b/i],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'The\x20coin/fee\x20attached\x20to\x20the\x20call\x20is\x20below\x20the\x20required\x20minimum\x20—\x20query\x20the\x20target\x20object\x27s\x20amount/fee\x20requirement\x20and\x20raise\x20the\x20corresponding\x20parameter\x20(this\x20is\x20NOT\x20a\x20wallet-balance/faucet\x20issue)'},{'patterns':[/invalid/i,/missing\s*(field|param|required)/i,/required/i,/expected/i,/malformed/i,/parse\s*error/i,/type\s*mismatch/i,/invalid argument/i,/Invalid value/i,/Invalid data value/i,/Invalid string value/i,/Invalid argument/i,/IsValid/i,/type does not match/i,/value type/i,/exceeds\s*limit/i,/indemnity\s*(exceeds|too\s*large)/i,/max(?:imum)?\b[^\n]*\bexceeded/i,/\bexceeded\s+(?:the\s+)?(?:limit|count)\b/i,/length\s+exceeded/i,/count\s+exceeded/i,/\bsize\s+exceeded\b/i,/\btoo\s+(?:many|long)\b/i,/not\s+(?:address|u64|number)\s+type/i,/not\s+system\s+address/i,/\bempty\b/i,/\bnot\s+equal\b/i,/unequal\s+lengths/i,/index\s+out\s+of\s+bounds?\b/i,/(?:arithmetic\s+)?(?:overflow|underflow)/i,/division\s+by\s+zero/i,/modulo\s+by\s+zero/i,/rate\s+(?:not\s+10000|exceeds)/i,/amount\s+(?:below\s+threshold|exceeds)/i,/store\s+from\s+id\s+not\s+compatible/i,/not\s+supported/i,/bad\s+(?:witness|transaction\s+hash\s+length)/i,/wrong\s+(?:borrow|value|inner\s+version|kiosk)/i,/incorrect\s+amount/i,/input\s+too\s+long/i,/vector\s+not\s+enough/i,/unknown\s+(?:action|requirement)/i,/illegal\s+rule/i,/not\s+zero/i,/no\s+config/i,/not\s+installed/i,/not\s+wow/i],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Check\x20parameter\x20format\x20against\x20the\x20tool\x20schema;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'}],WERROR_MAPPINGS=[{'codes':[WErrors['AccountNotFound'],WErrors['AddressNotFound'],WErrors['TokenNotFoundLocally']],'error_code':'object_not_found','retryable':![],'recovery_hint':'Verify\x20the\x20object\x20ID/name\x20with\x20query_toolkit;\x20local_mark\x20names\x20are\x20case-sensitive'},{'codes':[WErrors['NoPermission']],'error_code':'permission_denied','retryable':![],'recovery_hint':'Use\x20an\x20account\x20with\x20the\x20required\x20permission,\x20or\x20pass\x20permission_guard\x20IDs\x20via\x20env.permission_guard'},{'codes':[WErrors['IsValidDescription'],WErrors['IsValidName'],WErrors['IsValidName_AllowEmpty'],WErrors['IsValidEndpoint'],WErrors['IsValidAddress'],WErrors['IsValidArgType'],WErrors['IsValidTokenType'],WErrors['IsValidUint'],WErrors['IsValidInt'],WErrors['IsValidU8'],WErrors['IsValidU16'],WErrors['IsValidU32'],WErrors['IsValidU64'],WErrors['IsValidU128'],WErrors['IsValidU256'],WErrors['IsValidRate'],WErrors['IsValidArray'],WErrors['IsValidObjects'],WErrors['AllInvalid'],WErrors['InvalidParam'],WErrors['IsValidPermissionIndex'],WErrors['IsValidKey'],WErrors['IsValidIdentifier'],WErrors['IsValidHttpUrl'],WErrors['IsValidBizPermissionIndex'],WErrors['IsValidServiceItemName'],WErrors['IsValidCoinType'],WErrors['IsValidGuardIdentifier'],WErrors['IsValidValue'],WErrors['IsValidValueType'],WErrors['IsValidLocation'],WErrors['WitnessTypeInvalid']],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Check\x20parameter\x20format\x20against\x20the\x20tool\x20schema;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'},{'codes':[WErrors['NewGuardCheckFailed']],'error_code':'guard_rejected','retryable':![],'recovery_hint':'The\x20guard\x20would\x20fail\x20on-chain\x20—\x20the\x20SDK\x20pre-flight\x20simulation\x20blocked\x20the\x20commit\x20before\x20any\x20fee\x20was\x20spent.\x20The\x20message\x20names\x20the\x20abort\x20class\x20(GUARD_*\x20arithmetic/range/parse,\x20or\x20an\x20enriched\x20passport\x20E_*\x20abort).\x20Fix\x20the\x20guard\x20rule\x20or\x20the\x20submissions\x20it\x20expects,\x20re-validate\x20with\x20guard\x20validation\x20(local\x20evaluator\x20reports\x20leaf-level\x20defects),\x20then\x20rebuild\x20the\x20passport'},{'codes':[WErrors['BcsTypeInvalid'],WErrors['ParseObjectContentFailed']],'error_code':'bcs_error','retryable':![],'recovery_hint':'BCS\x20serialization/deserialization\x20error.\x20Verify\x20data\x20types\x20and\x20structure\x20match\x20the\x20expected\x20schema'},{'codes':[WErrors['NetworkInvalid']],'error_code':'config_error','retryable':![],'recovery_hint':'Configuration\x20error.\x20Verify\x20that\x20network,\x20RPC\x20endpoints,\x20and\x20required\x20environment\x20variables\x20are\x20properly\x20configured'},{'codes':[WErrors['AccountPersistentStorageNotSet'],WErrors['ConfigPersistentStorageNotSet'],WErrors['AccountPersistentStorageNotFound']],'error_code':'config_error','retryable':![],'recovery_hint':'Persistent\x20storage\x20not\x20configured.\x20Initialize\x20account\x20storage\x20before\x20performing\x20this\x20operation'},{'codes':[WErrors['AccountNameExist'],WErrors['LocalMarkNameExist']],'error_code':'state_conflict','retryable':![],'recovery_hint':'Object\x20state\x20conflicts\x20with\x20the\x20operation.\x20Query\x20the\x20current\x20state\x20with\x20query_toolkit\x20and\x20adjust\x20parameters'},{'codes':[WErrors['MaxObjectsPerQuery'],WErrors['ResourceTagCountExceeded'],WErrors['AddressCountExceeded'],WErrors['NumberCountExceeded']],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Count\x20limit\x20exceeded.\x20Reduce\x20the\x20number\x20of\x20items\x20per\x20request\x20and\x20retry'}];function isWException(a){return a instanceof WException;}function classifyWException(a){const b=a['getErrorCode'](),c=WERROR_MAPPINGS['find'](e=>e['codes']['includes'](b));if(!c)return undefined;const d={'error_code':c['error_code'],'retryable':c['retryable'],'recovery_hint':c['recovery_hint']};return d;}export const MOVE_ABORT_ERROR_MAP={'service:10':{'error_code':'invalid_parameter','recovery_hint':'Discounts\x20are\x20bound\x20to\x20their\x20receiver\x20and\x20cannot\x20be\x20transferred.\x20Use\x20discount_issue\x20to\x20grant\x20a\x20new\x20discount\x20to\x20the\x20target\x20address'},'service:16':{'error_code':'stock_exhausted'},'service:18':{'error_code':'guard_rejected','recovery_hint':'This\x20Service\x20requires\x20buyers\x20to\x20present\x20a\x20Guard\x20passport\x20(buyer_guard\x20configured).\x20Attach\x20a\x20passport\x20verifying\x20the\x20required\x20guard\x20and\x20resubmit'},'service:25':{'error_code':'state_conflict','recovery_hint':'This\x20operation\x20requires\x20the\x20Service\x20to\x20have\x20an\x20Arbitration\x20bound\x20together\x20with\x20a\x20compensation\x20fund.\x20Configure\x20arbitration\x20and\x20compensation\x20first'},'service:27':{'error_code':'state_conflict','recovery_hint':'The\x20ruled\x20compensation\x20exceeds\x20the\x20Service\x27s\x20compensation_fund\x20balance\x20—\x20the\x20pool\x20is\x20empty\x20or\x20underfunded.\x20The\x20claim\x20was\x20NOT\x20consumed\x20(the\x20abort\x20happens\x20before\x20any\x20transfer).\x20Merchant\x20must\x20top\x20up\x20via\x20service\x20compensation_fund_add\x20(>=\x20the\x20ruled\x20indemnity),\x20then\x20re-run\x20arb_claim_compensation'},'service:31':{'error_code':'invalid_parameter','recovery_hint':'The\x20submitted\x20wip_hash\x20does\x20not\x20match\x20the\x20Service\x27s\x20current\x20WIP\x20hash\x20—\x20the\x20merchant\x20may\x20have\x20updated\x20the\x20WIP.\x20Re-query\x20the\x20Service\x27s\x20sale\x20info\x20and\x20resubmit\x20with\x20the\x20current\x20wip_hash'},'service:33':{'error_code':'state_conflict','recovery_hint':'The\x20Service\x20cannot\x20bind\x20an\x20Arbitration\x20whose\x20permission\x20is\x20the\x20same\x20as\x20its\x20own\x20—\x20the\x20Service\x20owner\x20would\x20then\x20control\x20dispute\x20resolution,\x20breaking\x20fairness.\x20Use\x20a\x20different\x20Arbitration\x20or\x20change\x20the\x20Service\x27s\x20permission\x20first'},'service:34':{'error_code':'sale_suspended'},'service:35':{'error_code':'discount_invalid'},'service:36':{'error_code':'invalid_parameter','retryable':![],'recovery_hint':'The\x20legacy\x20quote/buy\x20entry\x20points\x20are\x20disabled\x20on\x20chain\x20(E_DEPRECATED_USE_V2\x20—\x20quote\x20used\x20to\x20decrement\x20stock\x20at\x20quote\x20time,\x20a\x20cost-free\x20stock-drain).\x20Rebuild\x20the\x20call\x20on\x20the\x20v2\x20quote/buy\x20pair\x20(quote2\x20/\x20buy2\x20—\x20with\x20the\x20discount-coupon\x20and\x20Passport-gated\x20variants)\x20(SDK:\x20onchain_operations\x20service\x20order_new\x20on\x20the\x20current\x20build).\x20A\x20stale\x20client\x20or\x20a\x20hand-built\x20transaction\x20targeting\x20the\x20old\x20entry\x20is\x20the\x20usual\x20cause'},'service:32':{'error_code':'invalid_parameter','recovery_hint':'The\x20sale\x20item\x20index\x20does\x20not\x20exist\x20on\x20this\x20Service.\x20Query\x20the\x20Service\x27s\x20sale\x20list\x20and\x20use\x20an\x20existing\x20item\x20index'},'service:20':{'error_code':'invalid_parameter','recovery_hint':'The\x20payment\x20attached\x20to\x20this\x20order\x20(total_pay)\x20is\x20less\x20than\x20the\x20order\x20amount\x20—\x20raise\x20total_pay\x20to\x20at\x20least\x20the\x20item\x20price\x20×\x20quantity.\x20If\x20total_pay\x20is\x20already\x20correct,\x20check\x20the\x20wallet\x20with\x20account_balance\x20(this\x20is\x20NOT\x20a\x20faucet/rate\x20issue)'},'arbitration:5':{'error_code':'invalid_parameter','recovery_hint':'The\x20dispute\x20fee\x20attached\x20to\x20this\x20call\x20is\x20below\x20the\x20Arbitration\x27s\x20required\x20fee\x20—\x20query\x20the\x20Arbitration\x27s\x20fee\x20field\x20and\x20raise\x20the\x20fee\x20parameter\x20to\x20at\x20least\x20that\x20amount\x20(this\x20is\x20NOT\x20a\x20wallet-balance/faucet\x20issue)'},'arbitration:4':{'error_code':'state_conflict','recovery_hint':'This\x20Arbitration\x20is\x20paused\x20(new\x20Arbitrations\x20default\x20to\x20paused)\x20—\x20every\x20dispute\x20filing\x20aborts\x20until\x20it\x20is\x20un-paused.\x20The\x20arbitration\x20owner\x20must\x20issue\x20{\x20operation_type:\x27arbitration\x27,\x20data:{\x20object:\x27<arbitration>\x27,\x20pause:false\x20}\x20},\x20then\x20re-file\x20the\x20dispute.\x20Note:\x20un-pausing\x20itself\x20requires\x20permission\x20356\x20on\x20the\x20Arbitration\x27s\x20Permission'},'machine:7':{'error_code':'invalid_parameter','recovery_hint':'A\x20node\x20declares\x20the\x20same\x20prev_node\x20in\x20two\x20of\x20its\x20pairs\x20—\x20transitions\x20from\x20one\x20source\x20node\x20must\x20live\x20in\x20ONE\x20pair\x20as\x20multiple\x20forwards.\x20Merge\x20the\x20competing\x20forwards\x20into\x20a\x20single\x20pair\x20(or\x20use\x20different\x20source\x20nodes)\x20and\x20rebuild\x20the\x20Machine'},'machine:11':{'error_code':'state_conflict','recovery_hint':'This\x20Machine\x20is\x20paused\x20—\x20node\x20and\x20forward\x20mutations\x20are\x20blocked.\x20Un-pause\x20it\x20first\x20with\x20{\x20operation_type:\x27machine\x27,\x20data:{\x20object:\x27<machine>\x27,\x20pause:false\x20}\x20},\x20then\x20retry'},'machine:12':{'error_code':'guard_rejected','recovery_hint':'The\x20retained\x20submission\x20identifiers\x20do\x20not\x20exist\x20in\x20the\x20Guard.\x20Query\x20the\x20Guard\x27s\x20submission\x20table\x20and\x20correct\x20the\x20retained_submission\x20list'},'machine:14':{'error_code':'invalid_parameter','recovery_hint':'A\x20Machine\x20forward\x20must\x20define\x20one\x20of\x20namedOperator,\x20permissionIndex,\x20or\x20guard.\x20Set\x20one\x20of\x20them\x20for\x20the\x20forward'},'machine:8':{'error_code':'invalid_parameter','recovery_hint':'No\x20node\x20with\x20that\x20name\x20exists\x20in\x20this\x20Machine.\x20Export\x20the\x20node\x20set\x20via\x20machineNode2file\x20(or\x20query\x20the\x20node\x20table)\x20and\x20use\x20an\x20exact\x20existing\x20node\x20name'},'machine:10':{'error_code':'invalid_parameter','recovery_hint':'The\x20referenced\x20node\x20name\x20does\x20not\x20exist\x20in\x20this\x20Machine.\x20Export\x20the\x20node\x20set\x20via\x20machineNode2file\x20(or\x20query\x20the\x20node\x20table)\x20and\x20use\x20exact\x20existing\x20node\x20names'},'machine:13':{'error_code':'invalid_parameter','recovery_hint':'No\x20forward\x20info\x20matches\x20that\x20node/next_node/forward\x20triple.\x20Query\x20the\x20Machine\x27s\x20node\x20table\x20(onchain_table_data\x20onchain_table_item_machine_node)\x20and\x20use\x20an\x20existing\x20combination'},'progress:8':{'error_code':'invalid_parameter','recovery_hint':'This\x20forward\x20requires\x20a\x20permission_index\x20for\x20non-named-operator\x20holders.\x20Supply\x20the\x20permission_index\x20of\x20a\x20Permission\x20the\x20Machine\x20recognizes'},'order:3':{'error_code':'invalid_parameter','recovery_hint':'This\x20order\x20requires\x20progress\x20specification\x20(the\x20Service\x20is\x20machine-backed).\x20Supply\x20the\x20progress\x20parameters,\x20or\x20query\x20the\x20machine\x20node\x20info\x20for\x20the\x20expected\x20values'},'order:8':{'error_code':'invalid_parameter','recovery_hint':'This\x20order\x20requires\x20allocation\x20specification.\x20Supply\x20the\x20allocation\x20parameters\x20matching\x20the\x20Service\x27s\x20allocator\x20configuration'},'arb:3':{'error_code':'state_conflict','recovery_hint':'The\x20Arb\x20case\x20is\x20in\x20the\x20wrong\x20lifecycle\x20state\x20for\x20this\x20operation.\x20Query\x20the\x20Arb\x27s\x20current\x20status\x20first,\x20then\x20pick\x20the\x20matching\x20operation:\x20Voting(2)\x20→\x20vote\x20/\x20voting_deadline_change\x20/\x20ruling;\x20Arbitrator_confirming(1)\x20→\x20arbitrator\x20confirm;\x20Arbitrated(3)\x20→\x20claim\x20compensation\x20(closes\x20case)\x20OR\x20objection\x20(re-opens,\x20mutually\x20exclusive\x20with\x20claim);\x20Objectionable(4)/Arbitrator_confirming(1)\x20→\x20reset;\x20after\x20a\x20claim\x20(Finished(5))\x20or\x20withdraw\x20(Withdrawn(6))\x20the\x20case\x20is\x20terminal'},'arb:5':{'error_code':'invalid_parameter','recovery_hint':'votes\x20are\x200-based\x20indices\x20of\x20the\x20propositions\x20the\x20voter\x20agrees\x20with\x20—\x20each\x20value\x20must\x20be\x20<\x20the\x20Arb\x27s\x20proposition\x20count.\x20Query\x20the\x20Arb\x27s\x20propositions\x20and\x20resubmit\x20with\x20valid\x20indices\x20(0\x20…\x20N-1)'},'arb:4':{'error_code':'time_lock_not_elapsed','recovery_hint':'The\x20voting\x20deadline\x20has\x20not\x20passed\x20yet.\x20Wait\x20until\x20the\x20deadline\x20elapses,\x20then\x20tally\x20the\x20votes'},'arb:7':{'error_code':'state_conflict','recovery_hint':'The\x20voting\x20deadline\x20has\x20passed\x20—\x20voting\x20is\x20closed.\x20Query\x20the\x20proposition\x20state\x20to\x20see\x20the\x20outcome'},'arb:8':{'error_code':'time_lock_not_elapsed','recovery_hint':'The\x20withdraw\x20duration\x20has\x20not\x20elapsed\x20yet.\x20Wait\x20until\x20the\x20lock\x20duration\x20passes,\x20then\x20withdraw'},'passport:2':{'error_code':'guard_rejected','recovery_hint':'Guards\x20relied\x20upon\x20by\x20this\x20Guard\x20must\x20be\x20added\x20to\x20the\x20Passport\x20first\x20(dependents-before-dependent\x20order).\x20Add\x20the\x20relied-upon\x20guards\x20to\x20the\x20passport,\x20then\x20add\x20this\x20one'},'passport:5':{'error_code':'guard_rejected','recovery_hint':'The\x20passport\x20lacks\x20the\x20required\x20verification\x20for\x20this\x20operation.\x20Complete\x20the\x20verification\x20scene\x20first'},'passport:6':{'error_code':'guard_rejected','recovery_hint':'The\x20guard\x20is\x20not\x20an\x20impact\x20guard\x20of\x20this\x20Passport\x20—\x20its\x20result\x20does\x20not\x20participate\x20in\x20the\x20passport\x20outcome.\x20Query\x20the\x20passport\x27s\x20guard\x20list\x20and\x20use\x20a\x20guard\x20registered\x20with\x20impack=true'},'passport:9':{'error_code':'guard_rejected','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20in\x20this\x20passport.\x20Add\x20the\x20guard\x20to\x20the\x20passport\x20(with\x20impack=true\x20if\x20its\x20result\x20must\x20participate\x20in\x20the\x20outcome),\x20then\x20retry'},'passport:7':{'error_code':'guard_rejected','recovery_hint':'Passport\x20verification\x20failed\x20—\x20the\x20passport\x27s\x20overall\x20result\x20is\x20false.\x20If\x20the\x20response\x20includes\x20a\x20\x27Guard\x20diagnosis\x20(dry-run)\x27\x20line,\x20it\x20names\x20the\x20first\x20failing\x20impact\x20guard:\x20complete\x20that\x20guard\x27s\x20submission\x20data\x20or\x20satisfy\x20its\x20rule,\x20then\x20regenerate\x20the\x20passport.\x20Otherwise\x20query\x20the\x20passport\x27s\x20guard[]\x20entries\x20and\x20each\x20clause\x27s\x20result\x20and\x20fix\x20the\x20failing\x20clause\x20(or\x20bisect\x20by\x20removing\x20guards)'},'passport:10':{'error_code':'invalid_parameter','recovery_hint':'The\x20submission\x20identifier\x20does\x20not\x20exist\x20in\x20this\x20passport.\x20Query\x20the\x20passport\x27s\x20submission\x20table\x20and\x20use\x20a\x20registered\x20identifier'},'passport:11':{'error_code':'guard_rejected','recovery_hint':'Digest\x20mismatch\x20in\x20proof\x20verification.\x20The\x20proof\x20does\x20not\x20cover\x20the\x20expected\x20content\x20—\x20regenerate\x20the\x20proof\x20against\x20the\x20current\x20target'},'reward:1':{'error_code':'time_lock_not_elapsed','recovery_hint':'The\x20guard-add\x20lock\x20(guard_not_added_expiration_time)\x20is\x20still\x20active\x20and\x20cannot\x20be\x20replaced\x20yet.\x20Wait\x20until\x20it\x20elapses,\x20then\x20set\x20the\x20new\x20lock\x20time'},'reward:2':{'error_code':'invalid_parameter','retryable':![],'recovery_hint':'The\x20guard\x27s\x20expiration_time\x20has\x20already\x20passed\x20and\x20it\x20can\x20no\x20longer\x20be\x20used.\x20Ask\x20the\x20reward\x20issuer\x20to\x20re-add\x20the\x20guard\x20with\x20a\x20later\x20expiration\x20(or\x20use\x20a\x20different\x20guard),\x20then\x20retry'},'reward:10':{'error_code':'time_lock_not_elapsed','recovery_hint':'Guards\x20are\x20locked\x20until\x20guard_not_added_expiration_time\x20elapses.\x20Wait\x20until\x20then\x20before\x20adding\x20guards'},'reward:11':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard-add\x20lock\x20time\x20must\x20be\x20strictly\x20later\x20than\x20the\x20current\x20clock\x20time.\x20Set\x20a\x20future\x20timestamp'},'reward:7':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20in\x20this\x20Reward.\x20Use\x20a\x20guard\x20registered\x20in\x20the\x20Reward\x27s\x20guard\x20table,\x20or\x20have\x20the\x20issuer\x20add\x20it\x20first'},'repository:7':{'error_code':'invalid_parameter','recovery_hint':'The\x20referenced\x20policy\x20does\x20not\x20exist\x20in\x20the\x20repository.\x20Query\x20the\x20repository\x20policies\x20and\x20use\x20a\x20valid\x20policy\x20ID'},'repository:8':{'error_code':'invalid_parameter','recovery_hint':'The\x20referenced\x20policy\x20does\x20not\x20exist\x20in\x20the\x20repository\x20(option\x20is\x20none).\x20Query\x20the\x20repository\x20policies\x20and\x20use\x20a\x20valid\x20policy\x20ID'},'repository:11':{'error_code':'invalid_parameter','recovery_hint':'The\x20policy\x27s\x20guard\x20entry\x20expects\x20id/data\x20from\x20the\x20passport\x20submission\x20(id_from_submission/data_from_submission\x20is\x20set),\x20but\x20this\x20call\x20passes\x20explicit\x20values.\x20Use\x20the\x20submission-based\x20call\x20route,\x20or\x20fix\x20the\x20policy\x20entry'},'repository:12':{'error_code':'guard_rejected','recovery_hint':'The\x20write_guard\x20is\x20not\x20an\x20impact\x20guard\x20in\x20the\x20passport\x20—\x20the\x20passport\x20must\x20verify\x20this\x20guard\x20with\x20impack=true.\x20Rebuild\x20the\x20passport\x20including\x20the\x20write_guard\x20as\x20an\x20impact\x20guard'},'repository:13':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20in\x20the\x20repository\x20policy\x27s\x20guard\x20list.\x20Query\x20the\x20policy\x27s\x20guards\x20and\x20use\x20a\x20registered\x20one'},'repository:14':{'error_code':'invalid_parameter','recovery_hint':'The\x20ID\x20vector\x20is\x20shorter\x20than\x20required\x20—\x20a\x20vector\x20length\x20problem,\x20not\x20a\x20balance\x20problem.\x20Align\x20the\x20vector\x20lengths\x20with\x20the\x20operation\x27s\x20requirement'},'repository:15':{'error_code':'invalid_parameter','recovery_hint':'The\x20data\x20vector\x20is\x20shorter\x20than\x20required\x20—\x20a\x20vector\x20length\x20problem,\x20not\x20a\x20balance\x20problem.\x20Align\x20the\x20vector\x20lengths\x20with\x20the\x20operation\x27s\x20requirement'},'repository:20':{'error_code':'invalid_parameter','recovery_hint':'The\x20policy\x20entry\x20requires\x20the\x20id\x20to\x20come\x20from\x20the\x20passport\x20submission\x20(id_from_submission\x20is\x20set).\x20Use\x20the\x20submission-based\x20call\x20route\x20that\x20supplies\x20the\x20passport'},'repository:21':{'error_code':'invalid_parameter','recovery_hint':'The\x20quote\x20guard\x20must\x20be\x20a\x20depended\x20guard\x20(no\x20relies\x20of\x20its\x20own,\x20immutable,\x20with\x20reputation).\x20Configure\x20the\x20guard\x20accordingly\x20before\x20setting\x20it\x20as\x20the\x20policy\x27s\x20quote\x20guard'},'repository:22':{'error_code':'invalid_parameter','recovery_hint':'The\x20policy\x20requires\x20a\x20write_guard\x20when\x20id_from\x20is\x20None.\x20Set\x20the\x20policy\x27s\x20write_guard\x20or\x20use\x20a\x20non-None\x20id_from'},'repository:23':{'error_code':'invalid_parameter','recovery_hint':'id_from_submission\x20is\x20forbidden\x20when\x20id_from\x20is\x20Clock\x20or\x20Signer\x20(the\x20id\x20is\x20auto-generated).\x20Remove\x20id_from_submission\x20from\x20the\x20policy\x20entry\x20or\x20change\x20id_from'},'permission:7':{'error_code':'invalid_parameter','recovery_hint':'Use\x20a\x20USER_DEFINED\x20index\x20(≥1000)\x20—\x20custom\x20forward\x20permissions\x20work\x20out\x20of\x20the\x20box\x20for\x20the\x20Permission\x27s\x20admin\x20with\x20no\x20prior\x20grant;\x20low\x20indices\x20(0-999)\x20are\x20builtin/reserved\x20and\x20must\x20be\x20granted\x20first\x20(permission\x20add\x20perm\x20by\x20index)\x20before\x20use\x20—\x20audit\x20with\x20onchain_table_data\x20query_type=onchain_table_item_permission_perm'},'arbitration:8':{'error_code':'invalid_parameter','recovery_hint':'This\x20guard\x20is\x20not\x20registered\x20as\x20a\x20voting\x20guard\x20on\x20the\x20Arbitration.\x20Add\x20it\x20to\x20the\x20Arbitration\x27s\x20voting_guard\x20config\x20(with\x20its\x20vote_weight)\x20first,\x20or\x20use\x20an\x20already-registered\x20voting\x20guard'},'demand:4':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20on\x20this\x20Demand.\x20Use\x20a\x20guard\x20registered\x20on\x20the\x20Demand,\x20or\x20configure\x20it\x20first'},'treasury:3':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20as\x20an\x20external\x20deposit\x20guard\x20on\x20this\x20Treasury.\x20Register\x20it\x20in\x20the\x20Treasury\x27s\x20external\x20deposit\x20guard\x20list\x20first'},'treasury:4':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20as\x20an\x20external\x20withdraw\x20guard\x20on\x20this\x20Treasury.\x20Register\x20it\x20in\x20the\x20Treasury\x27s\x20external\x20withdraw\x20guard\x20list\x20first'},'treasury:10':{'error_code':'invalid_parameter','recovery_hint':'An\x20external\x20withdraw\x20can\x20only\x20pay\x20the\x20transaction\x20sender.\x20Either\x20submit\x20the\x20transaction\x20as\x20the\x20recipient\x20address,\x20or\x20use\x20the\x20permissioned\x20withdraw\x20path\x20to\x20pay\x20another\x20address'},'guard:6':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20being\x20relied\x20upon\x20must\x20be\x20a\x20depended\x20guard\x20(no\x20relies\x20of\x20its\x20own,\x20immutable,\x20with\x20reputation).\x20Rely\x20on\x20a\x20terminal\x20guard,\x20not\x20one\x20with\x20its\x20own\x20dependencies'},'guard:7':{'error_code':'invalid_parameter','recovery_hint':'A\x20Guard\x20cannot\x20depend\x20on\x20itself.\x20Remove\x20the\x20self-reference\x20from\x20the\x20relies\x20list'},'guard:9':{'error_code':'invalid_parameter','recovery_hint':'The\x20submission\x20identifier\x27s\x20object\x20type\x20does\x20not\x20match\x20the\x20Guard\x20table\x20entry.\x20Check\x20each\x20identifier\x27s\x20type\x20against\x20the\x20Guard\x27s\x20table'},'guard:10':{'error_code':'invalid_parameter','recovery_hint':'The\x20identifiers\x20and\x20values\x20vectors\x20must\x20have\x20equal\x20lengths.\x20Align\x20the\x20counts'},'guard:11':{'error_code':'guard_rejected','recovery_hint':'The\x20submission\x20identifier\x20is\x20not\x20in\x20the\x20Guard\x27s\x20table.\x20Query\x20the\x20Guard\x27s\x20table\x20identifiers\x20and\x20submit\x20a\x20valid\x20one'},'allocation:5':{'error_code':'invalid_parameter','recovery_hint':'Multiple\x20surplus\x20entries\x20are\x20not\x20supported.\x20Provide\x20at\x20most\x20one\x20surplus\x20entry\x20in\x20the\x20allocation'},'allocation:8':{'error_code':'state_conflict','recovery_hint':'No\x20allocators\x20are\x20configured\x20for\x20this\x20order.\x20The\x20merchant\x20must\x20configure\x20the\x20Service\x27s\x20allocation\x20first'},'allocation:9':{'error_code':'invalid_parameter','recovery_hint':'Payment\x20info\x20is\x20missing\x20for\x20the\x20allocation.\x20Supply\x20the\x20payment\x20parameters\x20required\x20by\x20the\x20order'},'allocation:12':{'error_code':'invalid_parameter','recovery_hint':'The\x20split\x20amount\x20is\x20below\x20the\x20allocator\x27s\x20minimum\x20threshold.\x20Raise\x20the\x20amount\x20or\x20remove\x20the\x20split'},'allocation:15':{'error_code':'invalid_parameter','retryable':![],'recovery_hint':'The\x20GuardIdentifier\x20recipient\x20address\x20submitted\x20via\x20the\x20passport\x20does\x20not\x20match\x20the\x20Allocation\x27s\x20payment_info.for_object\x20anchor.\x20Present\x20a\x20passport\x20whose\x20recipient\x20identifier\x20submits\x20exactly\x20the\x20anchored\x20object\x20address\x20(or\x20redesign\x20the\x20guard\x20so\x20its\x20submission\x20is\x20constrained\x20to\x20that\x20address);\x20the\x20anchor\x20itself\x20cannot\x20be\x20changed\x20after\x20create'},'allocation:16':{'error_code':'state_conflict','retryable':![],'recovery_hint':'This\x20once-trigger\x20key\x20has\x20already\x20been\x20consumed\x20on\x20this\x20Allocation\x20(the\x20guard\x20submitted\x20the\x20reserved\x20identifier\x20255).\x20Use\x20a\x20NEW\x20once-key\x20(e.g.\x20a\x20new\x20order\x20address)\x20so\x20the\x20pass\x20is\x20distinct;\x20if\x20this\x20allocator\x20is\x20meant\x20to\x20run\x20repeatedly,\x20omit\x20the\x20identifier-255\x20submission\x20from\x20the\x20guard'},'allocation:17':{'error_code':'invalid_parameter','retryable':![],'recovery_hint':'One\x20allocator\x20cannot\x20mix\x20net\x20Rate\x20and\x20RateGross\x20entries\x20(their\x20rate\x20bases\x20differ).\x20Split\x20the\x20rate\x20entries\x20into\x20separate\x20allocators\x20—\x20one\x20for\x20net\x20Rate\x20(basis:\x20pool\x20minus\x20fix)\x20and\x20one\x20for\x20RateGross\x20(basis:\x20full\x20pool)'},'transfer:0':{'error_code':'invalid_parameter','recovery_hint':'A\x20shared\x20non-new\x20object\x20was\x20passed\x20where\x20only\x20newly-created\x20objects\x20are\x20allowed'},'coin:3':{'error_code':'state_conflict','recovery_hint':'The\x20operation\x20is\x20disallowed\x20while\x20the\x20coin\x20is\x20globally\x20paused.\x20Wait\x20for\x20the\x20pause\x20to\x20be\x20lifted'},'kiosk:4':{'error_code':'state_conflict','recovery_hint':'The\x20item\x20is\x20listed\x20exclusively\x20on\x20another\x20marketplace.\x20Delist\x20it\x20there\x20before\x20this\x20operation'},'token:5':{'error_code':'insufficient_balance','recovery_hint':'The\x20token\x20balance\x20cannot\x20be\x20consumed\x20(a\x20locked\x20portion\x20exists).\x20Unlock\x20or\x20acquire\x20more\x20balance\x20first'},'package:0':{'error_code':'invalid_parameter','recovery_hint':'Not\x20a\x20one-time\x20witness\x20—\x20the\x20module\x20initializer\x20pattern\x20is\x20invalid'},'package:1':{'error_code':'invalid_parameter','recovery_hint':'The\x20witness\x20is\x20too\x20permissive\x20for\x20this\x20operation'},'package:4':{'error_code':'invalid_parameter','recovery_hint':'Wrong\x20upgrade\x20cap\x20for\x20this\x20package\x20upgrade'},'balance:2':{'error_code':'insufficient_balance'},'kiosk:2':{'error_code':'insufficient_balance'},'transfer_policy:5':{'error_code':'insufficient_balance'},'token:7':{'error_code':'immutable_violation','recovery_hint':'This\x20token\x20operation\x20requires\x20the\x20immutable\x20confirmation\x20flow\x20to\x20be\x20completed\x20first.\x20Run\x20the\x20token\x27s\x20immutable\x20confirm,\x20then\x20retry'},'u64:1':{'error_code':'invalid_parameter','recovery_hint':'Arithmetic\x20overflow\x20—\x20the\x20computed\x20value\x20exceeds\x20u64.\x20Reduce\x20the\x20amounts'},'u64:2':{'error_code':'invalid_parameter','recovery_hint':'Arithmetic\x20underflow\x20—\x20the\x20computed\x20value\x20goes\x20below\x20zero.\x20Check\x20the\x20subtraction\x20inputs'},'u64:3':{'error_code':'invalid_parameter','recovery_hint':'Division\x20by\x20zero\x20—\x20the\x20divisor\x20is\x20zero.\x20Guard\x20the\x20divisor\x20before\x20dividing'},'u64:4':{'error_code':'invalid_parameter','recovery_hint':'Modulo\x20by\x20zero\x20—\x20the\x20divisor\x20is\x20zero.\x20Guard\x20the\x20divisor\x20before\x20the\x20modulo'},'bcs:0':{'error_code':'bcs_error','recovery_hint':'BCS\x20value\x20out\x20of\x20range'},'bcs:1':{'error_code':'bcs_error','recovery_hint':'BCS\x20value\x20is\x20not\x20a\x20bool'},'bcs:2':{'error_code':'bcs_error','recovery_hint':'BCS\x20length\x20out\x20of\x20range'},'address:0':{'error_code':'invalid_parameter','recovery_hint':'Address\x20parse\x20error\x20—\x20the\x20byte\x20length\x20is\x20not\x2032'},'hex:0':{'error_code':'invalid_parameter','recovery_hint':'Invalid\x20hex\x20length'},'hex:1':{'error_code':'invalid_parameter','recovery_hint':'Not\x20a\x20valid\x20hex\x20character'}};function canonicalDefaultFor(a){const b=ERROR_RULES['find'](c=>c['error_code']===a);if(b)return{'retryable':b['retryable'],'recovery_hint':b['recovery_hint']};return{'retryable':![],'recovery_hint':'Inspect\x20the\x20full\x20error\x20message;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'};}function classifyMoveAbort(a){const b=MOVE_ABORT_ERROR_MAP[a['module']+':'+a['code']];if(!b)return undefined;const c=canonicalDefaultFor(b['error_code']),d=b['recovery_hint']??c['recovery_hint'],e={'error_code':b['error_code'],'retryable':b['retryable']??c['retryable'],'recovery_hint':a['description']&&!d['includes'](a['description'])?d+'.\x20Details:\x20'+a['description']:d,'move_abort_info':a};return e;}function isWowokSystemAddress(a){const b=a['toLowerCase']()['replace'](/^0x/,'')['replace'](/^0+(?=.)/,'');return b==='1'||b==='2';}export function normalizeErrorMessage(a){if(typeof a==='string')return a;if(a&&typeof a==='object'){const b=a;if(typeof b['message']==='string'&&b['message'])return b['message'];if(typeof b['error']==='string'&&b['error'])return b['error'];try{return JSON['stringify'](a);}catch{return String(a);}}if(a===undefined||a===null)return'';return String(a);}function extractMoveAbortInfo(a){const b=normalizeErrorMessage(a);if(!b)return undefined;const c=b['match'](/MoveAbort\(.*,\s*(\d+)\s*\)/),d=b['match'](/name:\s*Identifier\("([^"]+)"\)/),e=b['match'](/address:\s*([0-9a-fA-Fx]+)/);if(c&&d&&e){const i=parseInt(c[0x1],0xa),j=d[0x1]['toLowerCase'](),k=e[0x1]['toLowerCase']();if(isWowokSystemAddress(k)){const l=getMoveErrorDescription(j,i)??undefined;return{'module':j,'code':i,'description':l};}}const f=b['match'](/abort code:\s*(\d+)/),g=b['match'](/'0x[0-9a-fA-F]+::([^:]+)::[^']+'/),h=b['match'](/'(0x[0-9a-fA-F]+)::/);if(f&&g&&h){const m=parseInt(f[0x1],0xa),n=g[0x1]['toLowerCase'](),o=h[0x1]['toLowerCase']();if(isWowokSystemAddress(o)){const p=getMoveErrorDescription(n,m)??undefined;return{'module':n,'code':m,'description':p};}}return undefined;}export function classifyError(a,b){const c=normalizeErrorMessage(a),d=extractMoveAbortInfo(c);if(d){const g=classifyMoveAbort(d);if(g)return g;}if(b!==undefined&&isWException(b)){const h=classifyWException(b);if(h){if(h['error_code']==='invalid_parameter'){const i=''+String(b['details']??''),j=ERROR_RULES[0x0],k=j['detail_overrides']?.['find'](l=>l['patterns']['some'](m=>m['test'](i)));k&&(h['error_code']=k['error_code'],h['retryable']=k['retryable']??h['retryable'],h['recovery_hint']=k['recovery_hint']??h['recovery_hint']);}return d&&(h['move_abort_info']=d,d['description']&&h['recovery_hint']&&!h['recovery_hint']['includes'](d['description'])&&(h['recovery_hint']=h['recovery_hint']+'.\x20Details:\x20'+d['description'])),h;}}if(!c)return{'error_code':'unknown','retryable':![]};const e=d?.['description']?c+'\x0a'+d['description']:c;for(const l of ERROR_RULES){const m=l['patterns']['find'](r=>r['test'](e));if(!m)continue;let n=l['error_code'],o=l['retryable'],p=l['recovery_hint'];if(l['detail_overrides']){const r=e['match'](m),s=r?e['slice'](r['index']+r[0x0]['length']):'',t=l['detail_overrides']['find'](u=>u['patterns']['some'](v=>v['test'](s)));t&&(n=t['error_code'],o=t['retryable']??l['retryable'],p=t['recovery_hint']??l['recovery_hint']);}const q={'error_code':n,'retryable':o,'recovery_hint':p};return d&&(q['move_abort_info']=d,d['description']&&(q['recovery_hint']=q['recovery_hint']+'.\x20Details:\x20'+d['description'])),q;}const f={'error_code':'unknown','retryable':![],'recovery_hint':'Inspect\x20the\x20full\x20error\x20message;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'};return d&&(f['move_abort_info']=d,d['description']&&(f['recovery_hint']=d['description']+'.\x20'+f['recovery_hint'])),f;}const INTENT_RULES=[{'operation_type':'service','signals':a=>a?.['publish']===!![],'intent':'publish_service','confidence':0.95},{'operation_type':'service','signals':a=>a?.['name']&&a?.['publish']===undefined,'intent':'create_service','confidence':0.9},{'operation_type':'service','intent':'modify_service','confidence':0.7},{'operation_type':'machine','intent':'configure_machine','confidence':0.9},{'operation_type':'progress','intent':'update_progress','confidence':0.9},{'operation_type':'order','signals':a=>a?.['arb_confirm']!==undefined||a?.['arb_objection']!==undefined||a?.['arb_claim_compensation']!==undefined,'intent':'apply_arbitration','confidence':0.9},{'operation_type':'order','intent':'manage_order','confidence':0.85},{'operation_type':'payment','signals':a=>a?.['receive']===!![],'intent':'claim_escrow_payment','confidence':0.95},{'operation_type':'payment','intent':'send_payment','confidence':0.9},{'operation_type':'reward','intent':'manage_reward','confidence':0.9},{'operation_type':'demand','intent':'post_demand','confidence':0.9},{'operation_type':'treasury','intent':'manage_treasury','confidence':0.9},{'operation_type':'allocation','intent':'allocate_funds','confidence':0.9},{'operation_type':'permission','intent':'manage_permission','confidence':0.9},{'operation_type':'guard','intent':'configure_guard','confidence':0.9},{'operation_type':'arbitration','intent':'manage_arbitration','confidence':0.9},{'operation_type':'contact','intent':'manage_contact','confidence':0.9},{'operation_type':'repository','intent':'manage_repository','confidence':0.9},{'operation_type':'personal','intent':'manage_personal','confidence':0.9},{'operation_type':'gen_passport','intent':'generate_passport','confidence':0.95},{'operation_type':'proof','intent':'create_proof','confidence':0.9},{'operation_type':'gen_proof','intent':'generate_proof','confidence':0.95},{'operation_type':'bridge_cross_chain_wow_to_evm','intent':'cross_chain_wow_to_evm_deposit','confidence':0.95},{'operation_type':'bridge_cross_chain_evm_to_wow','intent':'cross_chain_evm_to_wow_deposit','confidence':0.95},{'operation_type':'bridge_claim_wow_to_evm','intent':'claim_wow_to_evm','confidence':0.95},{'operation_type':'bridge_withdraw','intent':'withdraw_from_evm_account','confidence':0.9},{'operation_type':'bridge_query_active_evm_account','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_supported_evm_chains','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_supported_tokens','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_transfer_list','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_transfer_status','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_manage_evm_rpc','intent':'manage_evm_rpc','confidence':0.9},{'operation_type':'account_new','intent':'create_account','confidence':0.95},{'operation_type':'account_faucet','intent':'claim_faucet','confidence':0.95},{'operation_type':'account_balance','intent':'query_balance','confidence':0.9},{'operation_type':'mark_add','intent':'create_local_mark','confidence':0.9},{'operation_type':'mark_remove','intent':'remove_local_mark','confidence':0.9},{'operation_type':'mark_query','intent':'query_local_marks','confidence':0.9},{'operation_type':'local_info','intent':'query_local_info','confidence':0.9},{'operation_type':'query_toolkit','intent':'query_objects','confidence':0.85},{'operation_type':'onchain_events','intent':'query_events','confidence':0.85},{'operation_type':'onchain_table_data','intent':'query_table_data','confidence':0.85}];export function inferIntent(a,b){const c=INTENT_RULES['filter'](f=>f['operation_type']===a),d=c['find'](f=>f['signals']&&f['signals'](b));if(d)return d['intent'];const e=c['find'](f=>!f['signals']);return e?.['intent']??a;}function inferStatus(a){if(a['kind']==='error')return'failed';if(a['kind']==='transaction')return a['executed']?'success':'failed';return'success';}const OBJECT_TYPE_TO_ROLE={'service':'Service','machine':'Machine','progress':'Progress','permission':'Permission','guard':'Guard','order':'Order','arb':'ArbCase','arbitration':'Arbitration','messenger':'Messenger','contact':'Contact','demand':'Demand','reward':'Reward','personal':'Personal','repository':'Repository','treasury':'Treasury','discount':'Discount','allocation':'Allocation','payment':'Payment','passport':'Passport','proof':'Proof'};export function objectTypeToRole(a){if(!a)return'Other';const b=a['replace'](/<.*>/,'')['trim'](),c=b['split']('::'),d=(c[c['length']-0x1]||'')['toLowerCase']();return OBJECT_TYPE_TO_ROLE[d]??'Other';}export function tagObjectRoles(a){if(!Array['isArray'](a))return[];return a['filter'](b=>b&&(b['objectId']||b['object']?.['objectId']))['map'](b=>{const d=b['objectId']||b['object']?.['objectId'],e=b['objectType']||b['object']?.['objectType']||'',f=b['type']||'';return{'id':d,'role':objectTypeToRole(e),'immutable':e['includes']('Service')&&f==='published'};});}const GAS_COIN_PATTERNS=[/::wow::WOW$/i],SMALL_AMOUNT_THRESHOLD=BigInt(0xf4240);function isNegative(a){return String(a??'0')['startsWith']('-');}function hasEventMatch(a,b){if(!Array['isArray'](a))return![];return a['some'](c=>b['test'](String(c?.['type']??c?.['event_type']??'')));}function isGasCoin(a){if(!a)return![];return GAS_COIN_PATTERNS['some'](b=>b['test'](a));}function absAmount(a){try{return BigInt(String(a)['replace']('-','')||'0');}catch{return BigInt(0x0);}}const FUND_ROLE_RULES=[{'when':a=>hasEventMatch(a['events'],/order::OrderPaidEvent/i),'role':'payment','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/order::OrderRefundedEvent|order::RefundEvent/i),'role':'refund','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/reward::RewardClaimedEvent|reward::ClaimedEvent/i),'role':'reward','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/arbitration::CompensationEvent|arbitration::RefundEvent/i),'role':'compensation','confidence':0.9},{'when':a=>hasEventMatch(a['events'],/treasury::DepositEvent/i),'role':'deposit','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/treasury::WithdrawEvent|treasury::ReleaseEvent/i),'role':'release','confidence':0.9},{'when':a=>a['operation_type']==='payment'&&a['data']?.['receive']===!![],'role':'release','confidence':0.95},{'when':a=>a['operation_type']==='payment'&&isNegative(a['amount']),'role':'payment','confidence':0.95},{'when':a=>a['operation_type']==='payment'&&!isNegative(a['amount']),'role':'refund','confidence':0.9},{'when':a=>a['operation_type']==='reward'&&isNegative(a['amount']),'role':'reward','confidence':0.95},{'when':a=>a['operation_type']==='reward'&&!isNegative(a['amount']),'role':'release','confidence':0.9},{'when':a=>a['operation_type']==='treasury'&&isNegative(a['amount']),'role':'deposit','confidence':0.95},{'when':a=>a['operation_type']==='treasury'&&!isNegative(a['amount']),'role':'release','confidence':0.9},{'when':a=>a['operation_type']==='allocation'&&isNegative(a['amount']),'role':'payment','confidence':0.85},{'when':a=>a['operation_type']==='allocation'&&!isNegative(a['amount']),'role':'release','confidence':0.85},{'when':a=>a['operation_type']==='arbitration'&&(a['data']?.['compensation']!==undefined||a['data']?.['arb']===!![]),'role':'compensation','confidence':0.9},{'when':a=>a['operation_type']==='order'&&isNegative(a['amount'])&&a['data']?.['buy']!==undefined,'role':'payment','confidence':0.9},{'when':a=>a['operation_type']==='order'&&!isNegative(a['amount'])&&(a['data']?.['refund']!==undefined||a['data']?.['arb']!==undefined),'role':'refund','confidence':0.85},{'when':a=>{if(isNegative(a['amount']))return![];const b=absAmount(a['amount']);return isGasCoin(a['coinType'])&&b>BigInt(0x0)&&b<SMALL_AMOUNT_THRESHOLD;},'role':'gas','confidence':0.7},{'when':a=>{if(isNegative(a['amount']))return![];return a['sender']!==undefined&&a['recipient']!==undefined&&a['sender']===a['recipient']&&a['sender']!=='';},'role':'change','confidence':0.7},{'when':a=>isNegative(a['amount']),'role':'payment','confidence':0.7},{'when':a=>!isNegative(a['amount'])&&absAmount(a['amount'])===BigInt(0x0),'role':'other','confidence':0.5},{'when':a=>!isNegative(a['amount']),'role':'release','confidence':0.7},{'when':()=>!![],'role':'other','confidence':0.3}];export function tagFundRoles(a,b,c,d){if(!Array['isArray'](a))return[];return a['filter'](e=>e&&(e['amount']!==undefined||e['coinType']))['map'](e=>{const f={'operation_type':b,'amount':String(e['amount']??'0'),'coinType':e['coinType'],'data':c??{},'events':d,'sender':e['sender'],'recipient':e['recipient']},g=FUND_ROLE_RULES['find'](i=>i['when'](f)),h=g?.['role']??'other';return{'amount':f['amount'],'coinType':e['coinType']||'','role':h,'from':e['sender']??null,'to':e['recipient']??null};});}const EVENT_SEMANTIC_RULES=EVENT_SEMANTIC_REGISTRY['map'](a=>({'pattern':new RegExp(a['move_type']['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'i'),'business_meaning':a['business_meaning'],'category':a['category'],'side_effect':a['side_effect']}));function extractRelatedObject(a){if(!a||typeof a!=='object')return undefined;const b=a['fields']??a['payload']??a;if(typeof b!=='object')return undefined;for(const c of['object','object_id','objectId','parent','demand','service','order','machine','payment','progress','arb','allocation','resource','id']){const d=b[c];if(typeof d==='string'&&d['startsWith']('0x')&&d['length']>=0x6)return d;}return undefined;}const BUILTIN_EVENT_TYPE_MAP=Object['fromEntries'](EVENT_SEMANTIC_REGISTRY['map'](a=>[a['name'],a['move_type']]));export function eventToSemantic(a){const b=String(a?.['type']??a?.['event_type']??''),c=String(a?.['type_raw']??''),d=[c,b,BUILTIN_EVENT_TYPE_MAP[b]??'']['filter'](Boolean),e=EVENT_SEMANTIC_RULES['find'](h=>d['some'](i=>h['pattern']['test'](i)));if(!e)return{'event_type':b,'business_meaning':'Unknown\x20event','category':'other'};const f=e['extractRelatedObject']?e['extractRelatedObject'](a):extractRelatedObject(a),g={'event_type':b,'business_meaning':e['business_meaning'],'category':e['category']};if(f)g['related_object']=f;if(e['side_effect'])g['side_effect']=e['side_effect'];return g;}export function annotateEvents(a){if(!Array['isArray'](a))return[];return a['map'](eventToSemantic);}export function referencesExistingObject(a){return typeof a?.['object']==='string';}function evidenceHolds(a,b,c){switch(a){case'receipt':return c?c['executed']:!![];case'chain_read':return!![];case'creation_only':return!referencesExistingObject(b);}}const NEXT_ACTION_RULES=[{'when':a=>a==='service','evidence':'creation_only','action':'publish\x20the\x20Service\x20when\x20configuration\x20is\x20complete','reason':'Service\x20must\x20be\x20published\x20before\x20customers\x20can\x20order','tool':'onchain_operations\x20(service\x20with\x20publish:true)','priority':'recommended'},{'when':a=>a==='service','evidence':'creation_only','action':'add\x20Machine\x20nodes\x20to\x20define\x20the\x20service\x20workflow','reason':'Machine\x20drives\x20order\x20state\x20transitions','tool':'onchain_operations\x20(machine)','priority':'recommended'},{'when':a=>a==='machine','evidence':'receipt','action':'bind\x20Progress\x20to\x20track\x20order\x20execution','reason':'Progress\x20provides\x20customer-visible\x20status\x20updates','tool':'onchain_operations\x20(progress)','priority':'recommended'},{'when':a=>a==='order','evidence':'receipt','action':'wait\x20for\x20customer\x20payment\x20or\x20proceed\x20to\x20allocation','reason':'Order\x20lifecycle:\x20payment\x20→\x20allocation\x20→\x20completion','priority':'optional'},{'when':(a,b)=>a==='order'&&b?.['transfer_to']!==undefined,'evidence':'receipt','action':'inform\x20the\x20end\x20customer\x20about\x20the\x20supplier/sub-contractor\x20who\x20will\x20fulfill\x20this\x20order','reason':'O-5\x20procurement\x20sub-order\x20transparency:\x20customers\x20have\x20the\x20right\x20to\x20know\x20who\x20fulfills\x20their\x20order','tool':'messenger_operation\x20(notify\x20customer)','priority':'recommended'},{'when':a=>a==='demand','evidence':'receipt','action':'wait\x20for\x20presenter\x20submissions\x20or\x20evaluate\x20existing\x20ones','reason':'Demand\x20lifecycle:\x20presenters\x20submit\x20solutions\x20for\x20reward','priority':'optional'},{'when':a=>a==='reward','evidence':'receipt','action':'deposit\x20funds\x20into\x20the\x20reward\x20pool','reason':'Reward\x20pool\x20must\x20be\x20funded\x20before\x20claimants\x20can\x20withdraw','tool':'onchain_operations\x20(treasury)','priority':'recommended'},{'when':a=>a==='bridge_cross_chain_wow_to_evm','evidence':'receipt','action':'poll\x20query_transfer_status\x20until\x20bridge\x20signs\x20(~1-5\x20min),\x20then\x20call\x20claim_wow_to_evm\x20to\x20complete','reason':'Cross-chain\x20WOW→EVM\x20is\x20a\x202-step\x20process:\x20deposit\x20first,\x20then\x20claim\x20after\x20bridge\x20confirmation','tool':'bridge_operation\x20(query_transfer_status,\x20then\x20claim_wow_to_evm)','priority':'required'},{'when':a=>a==='bridge_cross_chain_evm_to_wow','evidence':'receipt','action':'poll\x20query_transfer_status\x20to\x20monitor\x20auto-claim\x20progress\x20(~10-20\x20min)','reason':'EVM→WOW\x20cross-chain\x20auto-claims;\x20monitor\x20progress\x20but\x20no\x20manual\x20action\x20needed','tool':'bridge_operation\x20(query_transfer_status)','priority':'recommended'},{'when':a=>a==='bridge_claim_wow_to_evm','evidence':'receipt','action':'verify\x20recipient\x20EVM\x20balance\x20updated','reason':'Claim\x20completes\x20the\x20cross-chain\x20transfer;\x20verify\x20funds\x20arrived\x20on\x20EVM\x20side','tool':'bridge_operation\x20(query_active_evm_account)','priority':'recommended'},{'when':a=>a==='bridge_withdraw','evidence':'receipt','action':'verify\x20WOW\x20balance\x20updated','reason':'Withdrawal\x20moves\x20funds\x20from\x20active\x20EVM\x20account\x20to\x20WOW;\x20verify\x20balance','tool':'account_operation\x20(balance)','priority':'recommended'},{'when':a=>a==='account_new','evidence':'receipt','action':'claim\x20faucet\x20tokens\x20for\x20gas\x20if\x20on\x20testnet,\x20then\x20proceed\x20to\x20create\x20Service','reason':'New\x20account\x20needs\x20gas\x20tokens\x20before\x20on-chain\x20operations','tool':'account_operation\x20(faucet)','priority':'recommended'},{'when':a=>a==='account_faucet','evidence':'receipt','action':'proceed\x20to\x20create\x20Permission\x20and\x20Service\x20objects','reason':'Account\x20is\x20now\x20funded;\x20start\x20building\x20your\x20service','tool':'onchain_operations\x20(permission,\x20service)','priority':'recommended'},{'when':a=>a==='query_toolkit','evidence':'chain_read','action':'use\x20the\x20queried\x20object\x20data\x20to\x20plan\x20next\x20operations','reason':'Query\x20results\x20reveal\x20current\x20object\x20states\x20for\x20decision-making','priority':'optional'}];function inferNextActions(a,b,c,d){return NEXT_ACTION_RULES['filter'](e=>e['when'](a,b,c)&&evidenceHolds(e['evidence'],b,d))['map'](e=>({'action':e['action'],'reason':e['reason'],'tool':e['tool'],'priority':e['priority']}));}const WARNING_RULES=[{'when':(a,b)=>a==='service'&&b?.['order_allocators']===undefined,'evidence':'creation_only','message':'order_allocators\x20not\x20configured;\x20order\x20funds\x20cannot\x20be\x20distributed\x20automatically'},{'when':(a,b)=>a==='reward'&&(b?.['balance']==='0'||b?.['balance']===0x0),'evidence':'receipt','message':'Reward\x20pool\x20balance\x20is\x20zero;\x20claimants\x20cannot\x20withdraw'},{'when':(a,b)=>a==='order'&&b?.['transfer_to']!==undefined,'evidence':'receipt','message':'[TRANSPARENCY]\x20Order\x20ownership\x20is\x20being\x20transferred\x20(likely\x20to\x20a\x20supplier/sub-contractor).\x20'+'Ensure\x20the\x20end\x20customer\x20is\x20informed\x20about\x20who\x20fulfills\x20their\x20order\x20—\x20this\x20builds\x20trust\x20and\x20is\x20required\x20for\x20procurement\x20sub-orders.'}];function inferWarnings(a,b,c){return WARNING_RULES['filter'](d=>d['when'](a,b)&&evidenceHolds(d['evidence'],b,c))['map'](d=>d['message']);}function composeSummary(a,b,c,d,e){const f=a['replace'](/_/g,'\x20');if(b==='failed')return'Failed\x20to\x20'+f;if(b==='pending_input')return f+'\x20requires\x20Guard\x20submission\x20to\x20proceed';const g=[];if(c['length'])g['push']('created\x20'+c['length']+'\x20object(s)');if(d['length'])g['push']('modified\x20'+d['length']+'\x20object(s)');if(e['length']){if(a==='allocate_funds'){const h=e['map'](i=>{const j=i['amount'],k=shortCoinType(i['coinType']),l=i['to']?shortAddr(i['to']):null,m=i['from']?shortAddr(i['from']):null;if(l)return j+'\x20'+k+'\x20→\x20'+l;if(m)return j+'\x20'+k+'\x20from\x20'+m;return j+'\x20'+k;})['join'](';\x20');g['push']('distributed:\x20'+h);}else g['push'](e['length']+'\x20fund\x20movement(s)');}return'Successfully\x20'+f+(g['length']?'\x20('+g['join'](',\x20')+')':'');}function shortAddr(a){return formatShortAddress(a);}function shortCoinType(a){if(!a)return'coin';const b=a['split']('::');return b[b['length']-0x1]||a;}const ADVICE_PRIORITY_RANK={'required':0x0,'recommended':0x1,'info':0x2,'reminder':0x3};function evaluationFromPayload(a){const b=a?.['evaluation']??a?.['result']?.['evaluation'];return b&&typeof b==='object'&&b['trust']&&b['risk']&&Array['isArray'](b['coverage'])?b:undefined;}function dimensionEvidence(a){const c=[dimensionLabel(a['rule_id'])+'\x20'+a['score']+'/100'];if(a['reason'])c['push'](a['reason']);if(a['mismatched']&&a['mismatched']['length']>0x0)c['push']('missing/unmet:\x20'+a['mismatched']['join'](',\x20'));return c['join']('\x20—\x20');}function buildCustomerAdvice(a,c,d,e,f){if(!a369a('customer_intelligence'))return undefined;let g;if(a==='service'&&c?.['order_new'])g='preorder';else{if(a==='query_toolkit'||a==='onchain_table_data'||a==='onchain_events')g='browse';else return undefined;}const h=e??evaluationFromPayload(d);if(!h)return undefined;const i=[],j=(s,t,u,v)=>{i['push']({'id':s,'stage':g,'priority':t,'message':u,...v?{'action':v}:{}});},k=[...new Set([...h['trust']['red_flags']??[],...h['risk']['red_flags']??[]])];k['length']>0x0&&(f?j('advice_red_flags','required','Advisory\x20—\x20the\x20order\x20already\x20executed,\x20so\x20this\x20could\x20not\x20prevent\x20payment\x20('+k['length']+'\x20structural\x20red\x20flag(s)):\x20'+k['join'](';\x20')+'.\x20Raise\x20them\x20with\x20the\x20merchant\x20before\x20relying\x20on\x20the\x20order','Discuss\x20the\x20red\x20flags\x20with\x20the\x20merchant\x20via\x20Messenger;\x20for\x20future\x20orders\x20pick\x20another\x20service\x20if\x20unresolved'):j('advice_red_flags','required','Pre-payment\x20advisory\x20(the\x20gate\x20does\x20not\x20stop\x20the\x20payment)\x20—\x20'+k['length']+'\x20structural\x20red\x20flag(s):\x20'+k['join'](';\x20'),'Resolve\x20the\x20red\x20flags\x20with\x20the\x20merchant\x20or\x20pick\x20another\x20service\x20before\x20paying'));const l=(h['trust']['breakdown']??[])['filter'](s=>!s['red_flag']&&s['score']<0x46)['sort']((s,t)=>s['score']-t['score'])['slice'](0x0,0x2);for(const s of l){j('advice_trust_'+s['rule_id'],'recommended',dimensionEvidence(s),'Discuss\x20this\x20evidence\x20with\x20the\x20merchant\x20via\x20Messenger\x20before\x20ordering');}const m=(h['risk']['breakdown']??[])['filter'](t=>!t['red_flag']&&t['score']<0x64)['sort']((t,u)=>t['score']-u['score'])['slice'](0x0,0x2);for(const t of m){j('advice_risk_'+t['rule_id'],'recommended',dimensionEvidence(t),'Require\x20the\x20merchant\x20to\x20address\x20the\x20structural\x20findings\x20or\x20accept\x20the\x20stated\x20risk');}h['unverified']&&h['unverified']['length']>0x0&&j('advice_unverified','info','Unverifiable\x20dimensions\x20(excluded\x20from\x20the\x20score\x20due\x20to\x20fetch\x20gaps):\x20'+h['unverified']['map'](dimensionLabel)['join'](',\x20')+'\x20—\x20treat\x20them\x20as\x20unknown,\x20not\x20as\x20passed','Request\x20the\x20missing\x20material\x20from\x20the\x20merchant\x20or\x20verify\x20it\x20on-chain');for(const u of h['coverage']??[]){u['required']&&u['state']==='gap'&&j('advice_coverage_'+u['slot'],'info','Coverage\x20gap:\x20required\x20material\x20\x22'+u['slot']+'\x22\x20could\x20not\x20be\x20fetched\x20—\x20the\x20corresponding\x20evaluation\x20input\x20is\x20unknown');}i['length']===0x0&&j('advice_clean','info','No\x20adverse\x20findings\x20in\x20the\x20graph\x20evaluation\x20—\x20'+h['trust']['summary']+'\x20—\x20'+h['risk']['summary']);const n=[...i]['sort']((v,w)=>(ADVICE_PRIORITY_RANK[v['priority']]??0x9)-(ADVICE_PRIORITY_RANK[w['priority']]??0x9))['slice'](0x0,0x8),o=[];for(const v of n){if(v['action']&&!o['includes'](v['action']))o['push'](v['action']);}const p=getProfile(),q=p['risk_appetite']==='conservative'?0x46:p['risk_appetite']==='aggressive'?0x1e:0x32;return h['trust']['total']<q&&!o['some'](w=>w['includes']('below\x20your\x20risk\x20appetite'))&&o['push']('Trust\x20'+h['trust']['total']+'/100\x20is\x20below\x20your\x20risk\x20appetite\x20('+q+')\x20—\x20'+h['trust']['summary']),{'risk_score':h['risk']['total'],'risk_level':h['risk']['level'],'recommendations':o,'reminders':n};}function buildGuardAdvice(a,b,c,d){try{if(a==='guard')return buildGuardCreateAdvice(b);if(a==='gen_passport'){const f=d?.['passport_test'];if(f&&typeof f['result']==='boolean'){const i=f['result']===!![],j=(f['info']??[])['filter'](k=>k['impack']!==![]&&k['result']===![])['map'](k=>k['guard']);return{'current_round':'R8','test_result':{'status':i?'pass':'fail','passport_id':f['passport_id'],'failure_node':i?undefined:j['length']?'Guard\x20evaluated\x20false:\x20'+j['slice'](0x0,0x3)['join'](',\x20')+(j['length']>0x3?'\x20(+'+(j['length']-0x3)+'\x20more)':''):'Passport\x20result\x20is\x20false\x20on-chain','guard_results':f['info']?.['map'](k=>({'guard':k['guard'],'result':k['result']===!![],...k['impack']!==undefined?{'impack':k['impack']}:{}}))}};}const g=typeof c?.['error']==='string'?c['error']:undefined,h=g?'fail':'not_tested';return{'current_round':'R8','test_result':{'status':h,'passport_id':h==='fail'?undefined:c?.['passport'],'failure_node':g?g['slice'](0x0,0x78):'Guard\x20outcome\x20unknown\x20—\x20the\x20Passport\x20could\x20not\x20be\x20read\x20back\x20(dry-run\x20or\x20read\x20failure).\x20Query\x20the\x20Passport\x20object\x20or\x20re-run\x20without\x20dry_run\x20to\x20learn\x20the\x20real\x20result'}};}const e=typeof c?.['error']==='string'?c['error']:'';if(e['includes']('GUARD')||e['includes']('Guard')||e['includes']('guard'))return{'risk_warnings':['Guard\x20verification\x20failed:\x20'+e['slice'](0x0,0xc8),'Suggestion:\x20if\x20the\x20Guard\x20defines\x20submission\x20items,\x20check\x20that\x20the\x20submitted\x20data\x20matches\x20the\x20Guard\x20table\x20declaration\x20and\x20resubmit\x20via\x20call_with_submission;\x20if\x20it\x20defines\x20none,\x20the\x20Guard\x20rule\x20evaluated\x20false\x20—\x20inspect\x20the\x20rule\x27s\x20conditions\x20(signer/query/state)\x20against\x20this\x20call,\x20or\x20query\x20the\x20Guard\x20definition\x20(guard2file)\x20to\x20see\x20which\x20condition\x20failed']};return undefined;}catch{return undefined;}}function trimGuardAdviceForCompact(a){const b={};if(a['current_round']!==undefined)b['current_round']=a['current_round'];if(a['puzzle_status']!==undefined)b['puzzle_status']=a['puzzle_status'];if(a['matched_scene']!==undefined)b['matched_scene']=a['matched_scene'];if(a['scene_description']!==undefined)b['scene_description']=a['scene_description'];if(a['suggested_patterns']!==undefined)b['suggested_patterns']=a['suggested_patterns']['slice'](0x0,0x5);if(a['risk_warnings']!==undefined)b['risk_warnings']=a['risk_warnings']['slice'](0x0,0xa);if(a['pending_questions']!==undefined)b['pending_questions']=a['pending_questions']['slice'](0x0,0x5);if(a['confirmation_text']!==undefined)b['confirmation_text']=a['confirmation_text']['slice'](0x0,0x190);if(a['risk_assessment']!==undefined){const {stakeholder_advice:c,...d}=a['risk_assessment'];b['risk_assessment']=d;}if(a['test_result']!==undefined){const {guard_results:e,...f}=a['test_result'];b['test_result']=f;}return b;}function buildGuardCreateAdvice(a){if(!a)return undefined;const b=convertCallDataToPuzzleInput(a),c=derivePuzzleFromCallData(b),d=getPuzzleStatusBooleans(c);let e,f,g;a['binding_hint']?.['action']&&(e=inferSceneFromAction(a['binding_hint']['action']),e&&(f=e['name'],g=e['special_constraints']));let h;const i=a['binding_hint']?.['rule_sentence']||a['binding_hint']?.['action']||'';if(i){const r=matchSemanticPattern(i);r['length']>0x0&&(h=r['map'](s=>s['id']+':\x20'+s['pattern_name']));}let j;try{const s=generateConfirmationText(c);!s['startsWith']('[Puzzle\x20incomplete]')&&(j=s);}catch{}let k;const l=getPendingQuestions(c);l['length']>0x0&&(k=l);let m;if(e){const t=mapSceneToObjectType(e);if(t){const u=GUARDQUERY['filter'](v=>v['objectType']===t)['slice'](0x0,0xa)['map'](v=>({'id':v['id'],'name':v['name'],'objectType':String(v['objectType']),'returnType':String(v['return']),'description':v['description']}));u['length']>0x0&&(m=u);}}const n=evaluateGuardDraft({'table':a['table']??[],'root':a['root'],'rely':a['rely']})['assessment'];let o,p;if(n){const v=getRiskSummary(n);o={'overall_risk':v['risk_count']>0x0?n['overall_risk']:'info','risk_count':v['risk_count'],'critical_count':v['critical_count'],'high_count':v['high_count'],'needs_human_review':v['needs_human_review'],'top_risks':v['top_risks'],'stakeholder_advice':n['stakeholder_advice']};const w=n['risks']['map'](x=>'['+x['level']['toUpperCase']()+']\x20'+x['title']+':\x20'+x['description']);w['length']>0x0&&(p=w);}const q={'current_round':'R7','puzzle_status':d};if(e)q['matched_scene']=e['id'];if(f)q['scene_description']=f;if(g)q['scene_constraints']=g;if(h)q['suggested_patterns']=h;if(m)q['available_queries']=m;if(p)q['risk_warnings']=p;if(k)q['pending_questions']=k;if(j)q['confirmation_text']=j;if(o)q['risk_assessment']=o;return q;}function convertCallDataToPuzzleInput(a){const b={};Array['isArray'](a['table'])&&(b['table']=a['table']['map'](c=>({'identifier':c['identifier'],'b_submission':c['b_submission'],'value_type':typeof c['value_type']==='string'?c['value_type']:String(c['value_type']),'value':convertValueSnapshot(c['value']),'name':c['name']??'','object_type':c['object_type']})));if(a['root']&&typeof a['root']==='object'){const c=a['root'];if(c['type']!=='file'&&c['type']!=='node')b['root']=convertNodeToSnapshot(a['root']);else c['type']==='node'&&a['root']['node']&&(b['root']=convertNodeToSnapshot(a['root']['node']));}a['rely']&&Array['isArray'](a['rely']['guards'])&&(b['rely']={'guards':a['rely']['guards']['map'](d=>typeof d==='string'?d:String(d)),'logic_or':a['rely']['logic_or']});if(a['binding_hint']){const d=a['binding_hint'],e={'action':d['action'],'host_object':d['host_object'],'binding_field':d['binding_field']};if(d['rule_sentence']!==undefined)e['rule_sentence']=d['rule_sentence'];if(d['failure_conditions']!==undefined)e['failure_conditions']=d['failure_conditions'];if(d['circular_reference']!==undefined)e['circular_reference']=d['circular_reference'];b['binding_hint']=e;}return b;}function convertNodeToSnapshot(a){if(!a||typeof a!=='object')return{'type':'unknown'};const b={'type':String(a['type']??'unknown')};typeof a['identifier']==='number'&&(b['identifier']=a['identifier']);a['query']!==undefined&&(b['query']=typeof a['query']==='number'?a['query']:String(a['query']));if(a['object']&&typeof a['object']==='object'){const c={'identifier':Number(a['object']['identifier'])};typeof a['object']['convert_witness']==='number'&&(c['convert_witness']=a['object']['convert_witness']),b['object']=c;}Array['isArray'](a['parameters'])&&(b['parameters']=a['parameters']['map'](d=>convertNodeToSnapshot(d)));if(typeof a['context']==='string'){const d=a['context'];(d==='Clock'||d==='Guard'||d==='Signer')&&(b['context']=d);}return Array['isArray'](a['nodes'])&&(b['nodes']=a['nodes']['map'](e=>convertNodeToSnapshot(e))),a['node']&&(b['node']=convertNodeToSnapshot(a['node'])),a['nodeLeft']&&(b['nodeLeft']=convertNodeToSnapshot(a['nodeLeft'])),a['nodeRight']&&(b['nodeRight']=convertNodeToSnapshot(a['nodeRight'])),b;}function convertValueSnapshot(a){if(a===undefined||a===null)return undefined;if(typeof a==='string'||typeof a==='number'||typeof a==='boolean')return a;if(Array['isArray'](a)){const b=a['every'](e=>typeof e==='string');if(b)return a;const c=a['every'](e=>typeof e==='number');if(c)return a;const d=a['every'](e=>typeof e==='boolean');if(d)return a;return JSON['stringify'](a);}return JSON['stringify'](a);}function mapSceneToObjectType(a){const b=a['host_object'];if(b==='Standalone')return undefined;return b;}export function buildSemantic(a,b){if(!b)return undefined;const c=inferIntent(b['operation_type'],b['data']),d=inferStatus(a),e=tagObjectRoles(a['created']),f=tagObjectRoles(a['modified']),g=tagFundRoles(a['balanceChanges'],b['operation_type'],b['data'],a['events']),h=annotateEvents(a['events']),i=inferNextActions(b['operation_type'],b['data'],d,a),j=inferWarnings(b['operation_type'],b['data'],a);b['pre_warnings']&&b['pre_warnings']['length']>0x0&&j['push'](...b['pre_warnings']);let k;const l=a369a('experience_layer');if(l)try{const q=getExperienceFeedback(b['operation_type'],b['data'],c);q&&(k=q);const r=d==='success'?'success':d==='failed'?'failed':'partial',s=[...e,...f]['map'](u=>u['id'])['filter'](Boolean),t=inferErrorCodeForSignal(a);recordOperationOutcome(b['operation_type'],b['data'],c,r,t,s);}catch{}let m;if(a369a('industry_evolution'))try{const u=typeof b['data']?.['industry']==='string'&&b['data']['industry']['trim']()?b['data']['industry']['trim']():undefined;if(u&&!l){const v=d==='success'?{'success':!![]}:{'success':![],'error_code':inferErrorCodeForSignal(a)};recordIndustrySignal(u,{'type':b['operation_type'],'data':b['data']},v);}if(u){const w=injectEvolutionContext(undefined,u,deriveAdviceRole(b['operation_type'],b['data']));w&&(w['industry_signal']||w['evolution_advice']||w['confidence']>0x0)&&(m=w);}}catch{}let n;if(a369a('semantic_rich'))try{const x=listServices(),y=x['filter'](A=>A['enabled'])['map'](A=>A['name']),z=x['filter'](A=>!A['enabled'])['map'](A=>A['name']);n={'active':y,'inactive':z['length']?z:undefined};}catch{}let o;try{o=buildCustomerAdvice(b['operation_type'],b['data'],a['raw'],b['evaluation']??evaluationFromPayload(a['raw']),a['executed']);}catch{}let p;try{p=buildGuardAdvice(b['operation_type'],b['data'],a['raw'],b),p&&b['response_level']==='compact'&&(p=trimGuardAdviceForCompact(p));}catch{}return{'intent':c,'status':d,'summary':composeSummary(c,d,e,f,g),'created':e['length']?e:undefined,'modified':f['length']?f:undefined,'released':g['length']?g:undefined,'events':h['length']?h:undefined,'next_actions':i['length']?i:undefined,'warnings':j['length']?j:undefined,'experience':k,'service_status':n,'customer_advice':o,'evolution_context':m,'guard_advice':p};}function inferErrorCodeForSignal(a){if(a['error'])return a['error']['slice'](0x0,0x40);return undefined;}export function buildDataSemantic(a,b,c,d){if(!b)return undefined;const e=inferIntent(b['operation_type'],b['data']),f=[];b['pre_warnings']&&b['pre_warnings']['length']>0x0&&f['push'](...b['pre_warnings']);let g;if(c)g='failed';else{g='success';if(Array['isArray'](a)&&a['length']===0x0)g='partial',f['push']('no\x20results\x20found');else{if(a===null||a===undefined)g='partial',f['push']('no\x20results\x20found');else{if(typeof a==='object'&&!Array['isArray'](a)){const n=Object['values'](a);n['length']>0x0&&n['every'](o=>Array['isArray'](o)?o['length']===0x0:o===null||o===undefined)&&(g='partial',f['push']('no\x20results\x20found'));}}}}const h=inferNextActions(b['operation_type'],b['data'],g);let i;if(!c&&b['operation_type']==='onchain_events'){const o=Array['isArray'](a)?a:a?.['data']&&Array['isArray'](a['data'])?a['data']:null;if(o){i=annotateEvents(o);if(i['length']===0x0)i=undefined;}}const j=e['replace'](/_/g,'\x20');let k;if(g==='failed')k=d?'Failed\x20to\x20'+j+':\x20'+d:'Failed\x20to\x20'+j;else g==='partial'?k=j+'\x20completed\x20with\x20no\x20results':k='Successfully\x20'+j;let l;if(a369a('semantic_rich'))try{const p=listServices(),q=p['filter'](t=>t['enabled'])['map'](t=>t['name']),r=p['filter'](t=>!t['enabled'])['map'](t=>t['name']);l={'active':q,'inactive':r['length']?r:undefined};}catch{}let m;if(!c)try{m=buildCustomerAdvice(b['operation_type'],b['data'],a,b['evaluation']??evaluationFromPayload(a));}catch{}return{'intent':e,'status':g,'summary':k,'events':i,'next_actions':h['length']?h:undefined,'warnings':f['length']?f:undefined,'service_status':l,'customer_advice':m};}