@wowok/agent-mcp 3.0.3 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/knowledge/event-semantics.js +1 -1
  3. package/dist/knowledge/guard-puzzle.js +1 -1
  4. package/dist/knowledge/safety-rules.js +1 -1
  5. package/dist/knowledge/service-ledger.js +1 -1
  6. package/dist/knowledge/tools-reference.js +1 -1
  7. package/dist/safety/confirm-gate.js +1 -1
  8. package/dist/schema/call/allocation.d.ts +5 -0
  9. package/dist/schema/call/arbitration.d.ts +5 -0
  10. package/dist/schema/call/base.d.ts +5 -0
  11. package/dist/schema/call/base.js +1 -1
  12. package/dist/schema/call/bridge.d.ts +25 -0
  13. package/dist/schema/call/contact.d.ts +5 -0
  14. package/dist/schema/call/demand.d.ts +5 -0
  15. package/dist/schema/call/guard.d.ts +15 -0
  16. package/dist/schema/call/machine.d.ts +10 -0
  17. package/dist/schema/call/order.d.ts +5 -0
  18. package/dist/schema/call/payment.d.ts +5 -0
  19. package/dist/schema/call/permission.d.ts +5 -0
  20. package/dist/schema/call/personal.d.ts +5 -0
  21. package/dist/schema/call/progress.d.ts +5 -0
  22. package/dist/schema/call/proof.d.ts +10 -0
  23. package/dist/schema/call/repository.d.ts +5 -0
  24. package/dist/schema/call/reward.d.ts +5 -0
  25. package/dist/schema/call/service.d.ts +5 -0
  26. package/dist/schema/call/treasury.d.ts +5 -0
  27. package/dist/schema/common/index.js +1 -1
  28. package/dist/schema/index.d.ts +1 -0
  29. package/dist/schema/index.js +1 -1
  30. package/dist/schema/interaction/index.d.ts +34 -0
  31. package/dist/schema/interaction/index.js +1 -0
  32. package/dist/schema/local/index.js +1 -1
  33. package/dist/schema/messenger/index.d.ts +6 -0
  34. package/dist/schema/messenger/index.js +1 -1
  35. package/dist/schema/operations.d.ts +90 -0
  36. package/dist/schema/operations.js +1 -1
  37. package/dist/schema/query/index.js +1 -1
  38. package/dist/schema/schema-version.js +1 -1
  39. package/dist/schema-query-impl/index.js +1 -1
  40. package/dist/schemas/ask_user.output.json +54 -0
  41. package/dist/schemas/ask_user.schema.json +78 -0
  42. package/dist/schemas/bridge_operation.schema.json +50 -5
  43. package/dist/schemas/guard2file.schema.json +10 -1
  44. package/dist/schemas/index.json +7 -1
  45. package/dist/schemas/machineNode2file.schema.json +10 -1
  46. package/dist/schemas/messenger_operation.output.json +8 -0
  47. package/dist/schemas/messenger_operation.schema.json +8 -0
  48. package/dist/schemas/onchain_events.output.json +2 -2
  49. package/dist/schemas/onchain_operations.schema.json +180 -18
  50. package/dist/schemas/onchain_operations_allocation.schema.json +10 -1
  51. package/dist/schemas/onchain_operations_arbitration.schema.json +10 -1
  52. package/dist/schemas/onchain_operations_contact.schema.json +10 -1
  53. package/dist/schemas/onchain_operations_demand.schema.json +10 -1
  54. package/dist/schemas/onchain_operations_gen_passport.schema.json +10 -1
  55. package/dist/schemas/onchain_operations_gen_proof.schema.json +10 -1
  56. package/dist/schemas/onchain_operations_guard.schema.json +10 -1
  57. package/dist/schemas/onchain_operations_machine.schema.json +10 -1
  58. package/dist/schemas/onchain_operations_order.schema.json +10 -1
  59. package/dist/schemas/onchain_operations_payment.schema.json +10 -1
  60. package/dist/schemas/onchain_operations_permission.schema.json +10 -1
  61. package/dist/schemas/onchain_operations_personal.schema.json +10 -1
  62. package/dist/schemas/onchain_operations_progress.schema.json +10 -1
  63. package/dist/schemas/onchain_operations_proof.schema.json +10 -1
  64. package/dist/schemas/onchain_operations_repository.schema.json +10 -1
  65. package/dist/schemas/onchain_operations_reward.schema.json +10 -1
  66. package/dist/schemas/onchain_operations_service.schema.json +10 -1
  67. package/dist/schemas/onchain_operations_treasury.schema.json +10 -1
  68. package/dist/schemas/query_toolkit.schema.json +1 -1
  69. package/dist/tools/handlers/ask-user.d.ts +3 -0
  70. package/dist/tools/handlers/ask-user.js +1 -0
  71. package/dist/tools/handlers/config.js +1 -1
  72. package/dist/tools/handlers/messenger.js +1 -1
  73. package/dist/tools/handlers/onchain.js +1 -1
  74. package/dist/tools/index.d.ts +2 -2
  75. package/dist/tools/index.js +1 -1
  76. package/dist/tools/registry/bridge.js +1 -1
  77. package/dist/tools/registry/business.js +1 -1
  78. package/dist/tools/registry/interaction.d.ts +2 -0
  79. package/dist/tools/registry/interaction.js +1 -0
  80. package/dist/tools/registry/local.js +1 -1
  81. package/dist/tools/registry/monitor.js +1 -1
  82. package/dist/tools/registry/onchain.js +1 -1
  83. package/dist/tools/registry/query.js +1 -1
  84. package/dist/tools/shared.js +1 -1
  85. package/dist/tools/types.d.ts +7 -1
  86. package/dist/tools/wrap.d.ts +3 -3
  87. package/dist/tools/wrap.js +1 -1
  88. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{McpServer}from'@modelcontextprotocol/server';import{serveStdio}from'@modelcontextprotocol/server/stdio';import{readFileSync}from'fs';const packageJson=JSON['parse'](readFileSync(new URL('../package.json',import.meta.url),'utf-8'));import{OnchainOperationsSchema,WipOperationsSchema,WatchQueryOperationsSchema,AccountOperationSchema,LocalMarkOperationSchema,LocalInfoOperationSchema,LocalHistoryOperationSchema,ProtocolInfoQuerySchema,CallOutputSchema,MessengerOperationInputSchema,MessengerOperationOutputSchema,createServerConfig,createCapabilitiesConfig}from'./schema/index.js';import{areSchemasAvailable,getSchemaIndex}from'./schema-query-impl/index.js';import{listServices}from'./config/index.js';import{registerAllTools,SUB_TOOL_COUNT}from'./tools/index.js';import{monitorLoop}from'./monitor/MonitorLoop.js';import{scanDefaultIndustryPacks}from'./extensions/index.js';process['on']('unhandledRejection',(a,b)=>{const c=a instanceof Error?a['name']+':\x20'+a['message']+'\x0a'+(a['stack']??''):String(a);console['error']('[unhandledRejection]\x20'+new Date()['toISOString']()),console['error']('\x20\x20reason:\x20'+c);}),process['on']('uncaughtException',a=>{console['error']('[uncaughtException]\x20'+new Date()['toISOString']()),console['error']('\x20\x20name:\x20'+a['name']),console['error']('\x20\x20message:\x20'+a['message']),console['error']('\x20\x20stack:\x20'+(a['stack']??''));}),process['on']('beforeExit',a=>{console['error']('[beforeExit]\x20'+new Date()['toISOString']()+'\x20code='+a+'\x20—\x20event\x20loop\x20empty,\x20process\x20would\x20exit'),console['error']('\x20\x20active\x20handles:\x20'+(process['_getActiveHandles']?.()?.['length']??'?')),console['error']('\x20\x20active\x20requests:\x20'+(process['_getActiveRequests']?.()?.['length']??'?'));}),process['on']('exit',a=>{console['error']('[exit]\x20'+new Date()['toISOString']()+'\x20code='+a+'\x20—\x20process\x20exiting');}),process['stdin']['on']('end',()=>{console['error']('[stdin\x20end]\x20'+new Date()['toISOString']()+'\x20—\x20MCP\x20client\x20closed\x20stdin');}),process['stdin']['on']('close',()=>{console['error']('[stdin\x20close]\x20'+new Date()['toISOString']()+'\x20—\x20stdin\x20stream\x20closed');});let keepaliveTimer=null;function startKeepalive(){if(keepaliveTimer)return;keepaliveTimer=setInterval(()=>{const a=process['memoryUsage'](),b=Math['round'](a['heapUsed']/0x400/0x400),c=Math['round'](a['heapTotal']/0x400/0x400),d=Math['round'](a['rss']/0x400/0x400),e=b>0x4b0?'WARNING':b>0x320?'INFO':'DEBUG';console['error']('[memory\x20'+e+']\x20heap='+b+'MB/'+c+'MB\x20rss='+d+'MB');},0xea60);}startKeepalive();const SERVER_DESCRIPTION='WoWok\x20MCP\x20Server\x20-\x20Making\x20It\x20Easy\x20for\x20AI\x20Agents\x20to\x20Communicate,\x20Collaborate,\x20Trade,\x20and\x20Trust.\x0a\x0a##\x20CRITICAL:\x20Unified\x20Single-Tool\x20Architecture\x0a\x0aThis\x20server\x20exposes\x20exactly\x20ONE\x20MCP\x20tool:\x20`wowok`.\x20All\x20'+SUB_TOOL_COUNT+'\x20sub-tools\x20are\x20dispatched\x20internally\x20by\x20the\x20`wowok`\x20handler.\x0a\x0a###\x20Call\x20Format\x0a```\x0awowok({\x20tool:\x20\x22<sub-tool-name>\x22,\x20data:\x20{<sub-tool\x20parameters>}\x20})\x0a```\x0a\x0aAccepted\x20aliases\x20(deprecated):\x20`tool_name`/`name`\x20for\x20`tool`,\x20`args`/`params`\x20for\x20`data`.\x20Inline\x20params\x20(e.g.\x20`{\x20tool:\x20\x22schema_query\x22,\x20action:\x20\x22list\x22\x20}`)\x20are\x20also\x20auto-wrapped\x20into\x20`data`.\x0a\x0a###\x20Schema-Gated\x20Execution\x20(Self-Correcting)\x0aIf\x20your\x20parameters\x20don\x27t\x20match\x20the\x20sub-tool\x27s\x20schema,\x20the\x20response\x20includes:\x0a-\x20`result.status\x20=\x20\x22schema_mismatch\x22`\x0a-\x20`result.errors`\x20=\x20specific\x20validation\x20errors\x0a-\x20`schema.input`\x20=\x20the\x20correct\x20JSON\x20schema\x20for\x20the\x20sub-tool\x0a-\x20`schema.tool`\x20=\x20which\x20sub-tool\x20this\x20schema\x20belongs\x20to\x0a\x0aRead\x20the\x20schema,\x20fix\x20your\x20params,\x20and\x20retry.\x20CACHE\x20the\x20schema\x20in\x20your\x20context\x20for\x20future\x20calls\x20to\x20the\x20SAME\x20sub-tool\x20—\x20you\x20should\x20only\x20need\x20to\x20see\x20each\x20sub-tool\x27s\x20schema\x20once\x20per\x20conversation.\x20No\x20separate\x20`schema_query`\x20call\x20is\x20needed\x20for\x20parameter\x20correction.\x0a\x0a###\x20Unified\x20Response\x20Envelope\x0a```\x0a{\x0a\x20\x20\x22result\x22:\x20{\x20\x22status\x22:\x20\x22success|error|schema_mismatch\x22,\x20\x22data\x22:\x20<sub-tool\x20output>,\x20\x22errors\x22:\x20[...]\x20},\x0a\x20\x20\x22schema\x22:\x20null\x20|\x20{\x20\x22input\x22:\x20<JSON\x20schema>,\x20\x22tool\x22:\x20\x22<sub-tool-name>\x22\x20}\x0a}\x0a```\x0a\x0a##\x20CRITICAL:\x20Schema\x20Discovery\x20Rule\x0a\x0aWhen\x20the\x20current\x20context\x20does\x20not\x20contain\x20a\x20sub-tool\x27s\x20input/output\x20schema,\x20or\x20when\x20you\x20are\x20uncertain\x20whether\x20the\x20schema\x20you\x20have\x20is\x20complete\x20and\x20up-to-date,\x20you\x20MUST\x20query\x20it\x20first\x20before\x20calling\x20the\x20sub-tool.\x20Use\x20`wowok({\x20tool:\x20\x22schema_query\x22,\x20data:\x20{\x20action:\x20\x22get\x22,\x20name:\x20\x22<sub-tool>\x22\x20}\x20})'+'`'+'\x20for\x20operational\x20sub-tool\x20schemas\x20or\x20`wowok({\x20tool:\x20\x22wowok_buildin_info\x22,\x20data:\x20{\x20info:\x20\x22...\x22\x20}\x20})`\x20for\x20protocol\x20constants\x20and\x20reference\x20data.\x20Never\x20guess\x20schema\x20parameters,\x20query\x20instruction\x20IDs,\x20or\x20type\x20codes\x20—\x20always\x20retrieve\x20them\x20from\x20the\x20live\x20server.\x0a\x0a##\x20CRITICAL:\x20Global\x20Unread\x20Messenger\x20Check\x20(every\x20conversation)\x0a\x0aAt\x20the\x20START\x20of\x20EVERY\x20conversation\x20—\x20before\x20answering\x20the\x20user\x27s\x20request,\x20regardless\x20of\x20what\x20it\x20is\x20about\x20—\x20check\x20for\x20unread\x20Messenger\x20messages\x20and\x20IMMEDIATELY\x20and\x20PROMINENTLY\x20remind\x20the\x20user\x20to\x20read\x20them:\x0a\x0a```\x0awowok({\x20tool:\x20\x22messenger_operation\x22,\x20data:\x20{\x20operation:\x20\x22watch_conversations\x22,\x20filter:\x20{\x20unreadOnly:\x20true,\x20previewMessageCount:\x200,\x20skipAutoMarkViewed:\x20true\x20}\x20}\x20})\x0a```\x0a\x0aIf\x20the\x20result\x20contains\x20any\x20conversation\x20with\x20`unreadCount\x20>\x200`,\x20surface\x20a\x20prominent\x20reminder\x20at\x20the\x20TOP\x20of\x20your\x20response\x20(do\x20not\x20wait\x20for\x20the\x20user\x20to\x20ask),\x20listing\x20each\x20peer\x20with\x20unread\x20messages\x20and\x20the\x20count.\x20Use\x20`skipAutoMarkViewed:\x20true`\x20so\x20merely\x20checking\x20does\x20not\x20mark\x20them\x20read.\x20If\x20there\x20are\x20none,\x20do\x20not\x20mention\x20the\x20check.\x0a\x0a##\x20CRITICAL:\x20Upgrade\x20&\x20Client\x20Install\x20Reminder\x20(every\x20conversation)\x0a\x0aAt\x20the\x20START\x20of\x20EVERY\x20conversation\x20—\x20together\x20with\x20the\x20unread\x20Messenger\x20check\x20—\x20call:\x0a\x0a```\x0awowok({\x20tool:\x20\x22wowok_buildin_info\x22,\x20data:\x20{\x20info:\x20\x22upgrade_check\x22\x20}\x20})\x0a```\x0a\x0aThen,\x20based\x20on\x20the\x20returned\x20`result.reminder`:\x0a-\x20If\x20`reminder.type\x20===\x20\x22upgrade\x22`\x20AND\x20`reminder.due\x20===\x20true`:\x20IMMEDIATELY\x20remind\x20the\x20user\x20to\x20upgrade\x20(do\x20not\x20wait\x20for\x20them\x20to\x20ask).\x20Use\x20the\x20benefit-focused\x20wording\x20below,\x20filling\x20in\x20the\x20current/latest\x20versions\x20from\x20`result.mcp`\x20/\x20`result.sdk`.\x0a-\x20If\x20`reminder.type\x20===\x20\x22install_client\x22`\x20AND\x20`reminder.due\x20===\x20true`:\x20remind\x20the\x20user\x20to\x20install\x20the\x20WoWok\x20desktop\x20client\x20(this\x20fires\x20at\x20most\x20once\x20per\x20week\x20—\x20the\x20reminder\x20state\x20is\x20persisted\x20automatically).\x0a-\x20If\x20`reminder.type\x20===\x20\x22none\x22`\x20or\x20`reminder.due\x20===\x20false`:\x20do\x20NOT\x20mention\x20upgrades\x20or\x20the\x20client.\x0a\x0aUpgrade\x20wording\x20(paraphrase\x20naturally,\x20keep\x20it\x20short\x20and\x20benefit-driven;\x20adapt\x20to\x20the\x20user\x27s\x20language):\x0a\x20\x20\x22A\x20newer\x20WoWok\x20version\x20is\x20available\x20(current\x20vX\x20→\x20latest\x20vY).\x20Upgrade\x20for\x20more\x20features\x20and\x20improvements.\x20Run:\x20npm\x20install\x20-g\x20@wowok/agent-mcp@latest\x22\x0a\x0aClient\x20install\x20wording:\x0a\x20\x20\x22The\x20WoWok\x20desktop\x20client\x20is\x20not\x20installed\x20yet.\x20It\x20provides\x20wallet\x20management,\x20encrypted\x20Messenger,\x20project\x20management\x20and\x20more.\x20Download\x20it\x20at\x20https://download.wowok.net\x20to\x20get\x20started.\x22\x0a\x0aIf\x20the\x20upgrade_check\x20itself\x20fails\x20(offline\x20/\x20registry\x20unreachable),\x20skip\x20the\x20reminder\x20—\x20never\x20fabricate\x20version\x20numbers.\x0a\x0a##\x20Token\x20System\x20Overview\x0a\x0a###\x20Default\x20Platform\x20Token:\x20WOW\x0a-\x20Token\x20Type:\x200x2::wow::WOW\x0a-\x20Precision:\x201_000_000_000\x20(9\x20decimal\x20places)\x0a-\x20This\x20is\x20the\x20default\x20token\x20for\x20all\x20operations\x20unless\x20specified\x20otherwise\x0a\x0a###\x20Multi-Token\x20Support\x0aThe\x20platform\x20supports\x20ANY\x20token\x20(e.g.,\x20USDT,\x20USDC,\x20custom\x20tokens).\x20To\x20use\x20non-WOW\x20tokens:\x0a1.\x20Use\x20query_toolkit\x20with\x20query_type=\x27token_list\x27\x20to\x20query\x20available\x20tokens\x20and\x20their\x20precision\x20info\x0a2.\x20Use\x20the\x20token\x27s\x20full\x20type\x20string\x20(e.g.,\x20\x270x2::usdt::USDT\x27)\x20in\x20token_type\x20parameter\x0a3.\x20Each\x20token\x20has\x20its\x20own\x20precision\x20-\x20always\x20verify\x20before\x20operations\x0a\x0a###\x20Token\x20Precision\x20Handling\x0aDifferent\x20tokens\x20have\x20different\x20precisions.\x20ALWAYS\x20query\x20to\x20verify:\x0a-\x20WOW\x20(default):\x201_000_000_000\x20(9\x20decimals)\x0a-\x20Other\x20tokens:\x20Use\x20query_toolkit\x20with\x20query_type=\x27token_list\x27\x20to\x20get\x20actual\x20precision\x0a-\x20Never\x20assume\x20a\x20token\x27s\x20decimal\x20places\x20-\x20always\x20query\x20first\x0a\x0a##\x20CRITICAL:\x20Token\x20Amount\x20Handling\x0a\x0a###\x20Amount\x20Input\x20Rules\x0a1.\x20WITH\x20currency\x20unit\x20(e.g.,\x20\x272WOW\x27,\x20\x2710.5WOW\x27,\x20\x27100USDT\x27):\x0a\x20\x20\x20-\x20Auto-converted\x20using\x20token\x27s\x20precision:\x202WOW\x20->\x202_000_000_000\x0a\x20\x20\x20-\x20Use\x20for:\x20All\x20on-chain\x20token\x20operations\x0a\x20\x20\x20-\x20MUST\x20match\x20the\x20token_type\x20parameter\x0a\x0a2.\x20WITHOUT\x20currency\x20unit\x20(e.g.,\x20\x272\x27,\x20\x27100\x27):\x0a\x20\x20\x20-\x20Used\x20as-is:\x202\x20->\x202\x0a\x20\x20\x20-\x20Use\x20for:\x20Regular\x20numeric\x20parameters\x20(counts,\x20indices,\x20etc.)\x0a\x0a###\x20Multi-Token\x20Operation\x20Examples\x0a-\x20Create\x20USDT-priced\x20Service:\x20token_type=\x270x2::usdt::USDT\x27,\x20amount=\x27100USDT\x27\x0a-\x20Allocate\x20USDC\x20rewards:\x20token_type=\x270x2::usdc::USDC\x27,\x20amount=\x27500USDC\x27\x0a-\x20WOW\x20remains\x20default:\x20omit\x20token_type\x20or\x20use\x20\x270x2::wow::WOW\x27\x0a\x0a###\x20Security\x20Warning\x0aToken\x20amounts\x20are\x20HIGHLY\x20SENSITIVE.\x20Always:\x0a-\x20Confirm\x20user\x27s\x20intent\x20before\x20executing\x20transfers\x0a-\x20Verify\x20token\x20type\x20and\x20amount\x20format\x20(with/without\x20unit)\x0a-\x20Query\x20token\x20precision\x20if\x20unsure\x0a-\x20Double-check\x20large\x20amount\x20transactions\x0a-\x20Never\x20assume\x20decimal\x20places\x20-\x20use\x20explicit\x20token\x20unit\x0a\x0a##\x20Sub-tool\x20Selection\x20Guide\x0a\x0aAll\x20sub-tools\x20are\x20called\x20via\x20`wowok({\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{...}\x20})`.\x20The\x20table\x20below\x20helps\x20pick\x20the\x20correct\x20`tool`\x20value.\x0a\x0a|\x20User\x20Intent\x20|\x20Correct\x20Sub-tool\x20|\x20Wrong\x20Sub-tool\x20(Avoid)\x20|\x0a|------------|------------------|------------------------|\x0a|\x20Create\x20service\x20listing\x20|\x20onchain_operations\x20(service)\x20|\x20query_toolkit\x20|\x0a|\x20Send\x20coins\x20to\x20address\x20|\x20onchain_operations\x20(payment)\x20|\x20account_operation\x20|\x0a|\x20Check\x20my\x20balance\x20|\x20query_toolkit\x20(account_balance)\x20|\x20onchain_operations\x20|\x0a|\x20Manage\x20local\x20wallet\x20|\x20account_operation\x20|\x20onchain_operations\x20|\x0a|\x20Export\x20Guard\x20for\x20edit\x20|\x20guard2file\x20|\x20query_toolkit\x20|\x0a|\x20Send/Watch\x20encrypted\x20message\x20|\x20messenger_operation\x20|\x20onchain_operations\x20|\x0a|\x20Create\x20workflow\x20template\x20|\x20onchain_operations\x20(machine)\x20|\x20wip_file\x20|\x0a|\x20Store\x20my\x20phone\x20number\x20|\x20local_info_operation\x20|\x20onchain_operations\x20|\x0a|\x20Buy\x20service\x20(create\x20order)\x20|\x20onchain_operations\x20(order)\x20|\x20onchain_operations\x20(service)\x20|\x0a|\x20Manage\x20my\x20orders\x20|\x20onchain_operations\x20(order)\x20|\x20query_toolkit\x20|\x0a|\x20Apply\x20for\x20arbitration\x20|\x20onchain_operations\x20(order)\x20|\x20onchain_operations\x20(arbitration)\x20|\x0a|\x20Create\x20reward\x20pool\x20for\x20marketing\x20|\x20onchain_operations\x20(reward)\x20|\x20onchain_operations\x20(treasury)\x20|\x0a|\x20Claim\x20rewards\x20from\x20pool\x20|\x20onchain_operations\x20(reward)\x20|\x20query_toolkit\x20|\x0a|\x20Create\x20fund\x20allocation\x20plan\x20|\x20onchain_operations\x20(allocation)\x20|\x20onchain_operations\x20(treasury)\x20|\x0a|\x20Execute\x20fund\x20distribution\x20|\x20onchain_operations\x20(allocation)\x20|\x20onchain_operations\x20(payment)\x20|\x0a|\x20Post\x20service\x20demand\x20with\x20reward\x20|\x20onchain_operations\x20(demand)\x20|\x20onchain_operations\x20(service)\x20|\x0a|\x20Submit\x20solution\x20for\x20demand\x20|\x20onchain_operations\x20(demand)\x20|\x20onchain_operations\x20(order)\x20|\x0a|\x20Create\x20team\x20treasury\x20|\x20onchain_operations\x20(treasury)\x20|\x20onchain_operations\x20(allocation)\x20|\x0a|\x20Deposit/Withdraw\x20from\x20treasury\x20|\x20onchain_operations\x20(treasury)\x20|\x20onchain_operations\x20(payment)\x20|\x0a|\x20Create\x20access\x20control\x20rules\x20|\x20onchain_operations\x20(permission)\x20|\x20onchain_operations\x20(guard)\x20|\x0a|\x20Create\x20validation\x20rules\x20(Guard)\x20|\x20onchain_operations\x20(guard)\x20|\x20onchain_operations\x20(permission)\x20|\x0a|\x20Export\x20Guard\x20for\x20editing\x20|\x20guard2file\x20|\x20query_toolkit\x20|\x0a|\x20Export\x20Machine\x20nodes\x20for\x20editing\x20|\x20machineNode2file\x20|\x20query_toolkit\x20|\x0a|\x20Query\x20token\x20list\x20and\x20precision\x20|\x20query_toolkit\x20(token_list)\x20|\x20wowok_buildin_info\x20|\x0a|\x20Watch\x20on-chain\x20events\x20|\x20onchain_events\x20|\x20query_toolkit\x20|\x0a|\x20Generate\x20WIP\x20promise\x20file\x20|\x20wip_file\x20(generate)\x20|\x20messenger_operation\x20|\x0a|\x20Sign\x20WIP\x20file\x20|\x20wip_file\x20(sign)\x20|\x20account_operation\x20(signData)\x20|\x0a|\x20Verify\x20WIP\x20file\x20integrity\x20|\x20wip_file\x20(verify)\x20|\x20query_toolkit\x20|\x0a|\x20Send\x20encrypted\x20file\x20via\x20messenger\x20|\x20messenger_operation\x20(send_file)\x20|\x20wip_file\x20|\x0a|\x20Generate\x20Witness\x20Timestamped\x20Sequence\x20(WTS)\x20|\x20messenger_operation\x20(generate_wts)\x20|\x20wip_file\x20|\x0a|\x20Query\x20protocol\x20constants\x20|\x20wowok_buildin_info\x20|\x20query_toolkit\x20|\x0a|\x20Query\x20sub-tool\x20schemas\x20|\x20schema_query\x20|\x20wowok_buildin_info\x20|\x0a|\x20Cross-chain\x20bridge\x20(WOW<->EVM)\x20|\x20bridge_operation\x20|\x20onchain_operations\x20|\x0a|\x20On-chain\x20business\x20intelligence\x20(panoramas,\x20review\x20packs)\x20|\x20query_toolkit\x20|\x20onchain_operations\x20|\x0a|\x20Runtime\x20service\x20toggles\x20|\x20config_operation\x20|\x20—\x20|\x0a|\x20Service\x20trust/risk\x20assessment\x20|\x20trust_score\x20|\x20query_toolkit\x20|\x0a|\x20Query\x20dynamic\x20table\x20data\x20/\x20table\x20items\x20|\x20onchain_table_data\x20|\x20query_toolkit\x20|\x0a|\x20Business\x20evaluation\x20(risk/match/game/evidence)\x20|\x20evaluation_operation\x20|\x20trust_score\x20|\x0a|\x20Set\x20user\x20persona\x20/\x20preferences\x20|\x20persona_operation\x20|\x20local_info_operation\x20|\x0a|\x20Match\x20business\x20intent\x20to\x20chain\x20events\x20|\x20intent_radar\x20|\x20onchain_events\x20|\x0a|\x20Manage\x20employee\x20KPI\x20/\x20liability\x20|\x20employee_operation\x20|\x20onchain_operations\x20|\x0a|\x20Scaffold\x20/\x20register\x20industry\x20pack\x20|\x20industry_pack_operation\x20|\x20persona_operation\x20|\x0a|\x20Read\x20/\x20write\x20local\x20workspace\x20files\x20|\x20workspace_operation\x20|\x20local_info_operation\x20|\x0a|\x20List\x20local-account\x20actionable\x20progress\x20/\x20advance\x20forward\x20|\x20workflow_operation\x20|\x20onchain_operations\x20|\x0a|\x20List\x20Permissions\x20related\x20to\x20local\x20accounts\x20|\x20permission_operation\x20|\x20query_toolkit\x20|\x0a\x0a##\x20Sub-tool\x20Categories\x0a\x0a###\x20LOCAL\x20ONLY\x20(Never\x20touch\x20blockchain):\x0a-\x20account_operation\x0a-\x20local_mark_operation\x0a-\x20local_info_operation\x0a-\x20persona_operation\x0a-\x20employee_operation\x0a-\x20industry_pack_operation\x0a-\x20workspace_operation\x0a\x0a###\x20ON-CHAIN\x20(Blockchain\x20transactions):\x0a-\x20onchain_operations\x0a-\x20workflow_operation\x20(operate\x20advances/holds\x20progress\x20on-chain;\x20list\x20is\x20read-only)\x0a-\x20messenger_operation\x20(some\x20operations)\x0a-\x20wip_file\x20(sign\x20operation)\x0a-\x20bridge_operation\x0a\x0a###\x20QUERY\x20(Read-only):\x0a-\x20query_toolkit\x0a-\x20onchain_events\x0a-\x20onchain_table_data\x0a-\x20wowok_buildin_info\x0a-\x20schema_query\x0a-\x20guard2file\x0a-\x20machineNode2file\x0a-\x20evaluation_operation\x0a-\x20intent_radar\x0a-\x20permission_operation\x0a\x0a###\x20WORKFLOW\x20&\x20ANALYTICS:\x0a-\x20config_operation\x0a-\x20trust_score\x0a';function buildServer(){const a=new McpServer(createServerConfig(packageJson,SERVER_DESCRIPTION),createCapabilitiesConfig());return registerAllTools(a),a;}export{OnchainOperationsSchema,WipOperationsSchema,WatchQueryOperationsSchema,AccountOperationSchema,LocalMarkOperationSchema,LocalInfoOperationSchema,LocalHistoryOperationSchema,ProtocolInfoQuerySchema,CallOutputSchema,MessengerOperationInputSchema,MessengerOperationOutputSchema};async function main(){if(areSchemasAvailable()){const c=getSchemaIndex();c&&console['error']('Schema\x20system\x20ready:\x20'+(c['tools']?.['length']||0x0)+'\x20tools,\x20'+(c['operations']?.['length']||0x0)+'\x20operations');}else console['error']('Schema\x20files\x20not\x20available.\x20Run\x20\x27npm\x20run\x20generate:schemas\x27\x20to\x20generate\x20them.');const a=listServices()['filter'](d=>d['enabled'])['map'](d=>d['name']);console['error']('Phase\x202\x20active\x20services:\x20'+(a['join'](',\x20')||'none'));try{const d=scanDefaultIndustryPacks(),f=d['filter'](g=>g['ok'])['length'];console['error']('Industry\x20packs\x20ready:\x20'+f+'/'+d['length']+'\x20registered\x20at\x20startup');}catch(g){console['error']('[industry]\x20startup\x20bootstrap\x20failed:\x20'+g['message']);}if(process['env']['MONITOR_LOOP']==='1')try{const h=await monitorLoop['start']();console['error']('MonitorLoop\x20started\x20(MONITOR_LOOP=1):\x20'+h['join'](',\x20'));}catch(i){console['error']('[monitor]\x20MonitorLoop\x20start\x20failed:\x20'+(i?.['message']??i));}const b=serveStdio(()=>buildServer());process['on']('SIGINT',async()=>{await monitorLoop['stop']()['catch'](()=>undefined),await b['close'](),process['exit'](0x0);}),process['on']('SIGTERM',async()=>{console['error']('[SIGTERM]\x20'+new Date()['toISOString']()+'\x20—\x20graceful\x20shutdown');try{await monitorLoop['stop']();}catch{}try{await b['close']();}catch{}process['exit'](0x0);});}main()['catch'](console['error']);
2
+ import{McpServer}from'@modelcontextprotocol/server';import{serveStdio}from'@modelcontextprotocol/server/stdio';import{readFileSync}from'fs';const packageJson=JSON['parse'](readFileSync(new URL('../package.json',import.meta.url),'utf-8'));import{OnchainOperationsSchema,WipOperationsSchema,WatchQueryOperationsSchema,AccountOperationSchema,LocalMarkOperationSchema,LocalInfoOperationSchema,LocalHistoryOperationSchema,ProtocolInfoQuerySchema,CallOutputSchema,MessengerOperationInputSchema,MessengerOperationOutputSchema,createServerConfig,createCapabilitiesConfig}from'./schema/index.js';import{areSchemasAvailable,getSchemaIndex}from'./schema-query-impl/index.js';import{listServices}from'./config/index.js';import{registerAllTools,SUB_TOOL_COUNT}from'./tools/index.js';import{monitorLoop}from'./monitor/MonitorLoop.js';import{scanDefaultIndustryPacks}from'./extensions/index.js';process['on']('unhandledRejection',(a,b)=>{const c=a instanceof Error?a['name']+':\x20'+a['message']+'\x0a'+(a['stack']??''):String(a);console['error']('[unhandledRejection]\x20'+new Date()['toISOString']()),console['error']('\x20\x20reason:\x20'+c);}),process['on']('uncaughtException',a=>{console['error']('[uncaughtException]\x20'+new Date()['toISOString']()),console['error']('\x20\x20name:\x20'+a['name']),console['error']('\x20\x20message:\x20'+a['message']),console['error']('\x20\x20stack:\x20'+(a['stack']??''));}),process['on']('beforeExit',a=>{console['error']('[beforeExit]\x20'+new Date()['toISOString']()+'\x20code='+a+'\x20—\x20event\x20loop\x20empty,\x20process\x20would\x20exit'),console['error']('\x20\x20active\x20handles:\x20'+(process['_getActiveHandles']?.()?.['length']??'?')),console['error']('\x20\x20active\x20requests:\x20'+(process['_getActiveRequests']?.()?.['length']??'?'));}),process['on']('exit',a=>{console['error']('[exit]\x20'+new Date()['toISOString']()+'\x20code='+a+'\x20—\x20process\x20exiting');}),process['stdin']['on']('end',()=>{console['error']('[stdin\x20end]\x20'+new Date()['toISOString']()+'\x20—\x20MCP\x20client\x20closed\x20stdin');}),process['stdin']['on']('close',()=>{console['error']('[stdin\x20close]\x20'+new Date()['toISOString']()+'\x20—\x20stdin\x20stream\x20closed');});let keepaliveTimer=null;function startKeepalive(){if(keepaliveTimer)return;keepaliveTimer=setInterval(()=>{const a=process['memoryUsage'](),b=Math['round'](a['heapUsed']/0x400/0x400),c=Math['round'](a['heapTotal']/0x400/0x400),d=Math['round'](a['rss']/0x400/0x400),e=b>0x4b0?'WARNING':b>0x320?'INFO':'DEBUG';console['error']('[memory\x20'+e+']\x20heap='+b+'MB/'+c+'MB\x20rss='+d+'MB');},0xea60);}startKeepalive();const SERVER_DESCRIPTION='WoWok\x20MCP\x20Server\x20-\x20Making\x20It\x20Easy\x20for\x20AI\x20Agents\x20to\x20Communicate,\x20Collaborate,\x20Trade,\x20and\x20Trust.\x0a\x0a##\x20CRITICAL:\x20Unified\x20Single-Tool\x20Architecture\x0a\x0aThis\x20server\x20exposes\x20exactly\x20ONE\x20MCP\x20tool:\x20`wowok`.\x20All\x20'+SUB_TOOL_COUNT+'\x20sub-tools\x20are\x20dispatched\x20internally\x20by\x20the\x20`wowok`\x20handler.\x0a\x0a###\x20Call\x20Format\x0a```\x0awowok({\x20tool:\x20\x22<sub-tool-name>\x22,\x20data:\x20{<sub-tool\x20parameters>}\x20})\x0a```\x0a\x0aAccepted\x20aliases\x20(deprecated):\x20`tool_name`/`name`\x20for\x20`tool`,\x20`args`/`params`\x20for\x20`data`.\x20Inline\x20params\x20(e.g.\x20`{\x20tool:\x20\x22schema_query\x22,\x20action:\x20\x22list\x22\x20}`)\x20are\x20also\x20auto-wrapped\x20into\x20`data`.\x0a\x0a###\x20Schema-Gated\x20Execution\x20(Self-Correcting)\x0aIf\x20your\x20parameters\x20don\x27t\x20match\x20the\x20sub-tool\x27s\x20schema,\x20the\x20response\x20includes:\x0a-\x20`result.status\x20=\x20\x22schema_mismatch\x22`\x0a-\x20`result.errors`\x20=\x20specific\x20validation\x20errors\x0a-\x20`schema.input`\x20=\x20the\x20correct\x20JSON\x20schema\x20for\x20the\x20sub-tool\x0a-\x20`schema.tool`\x20=\x20which\x20sub-tool\x20this\x20schema\x20belongs\x20to\x0a\x0aRead\x20the\x20schema,\x20fix\x20your\x20params,\x20and\x20retry.\x20CACHE\x20the\x20schema\x20in\x20your\x20context\x20for\x20future\x20calls\x20to\x20the\x20SAME\x20sub-tool\x20—\x20you\x20should\x20only\x20need\x20to\x20see\x20each\x20sub-tool\x27s\x20schema\x20once\x20per\x20conversation.\x20No\x20separate\x20`schema_query`\x20call\x20is\x20needed\x20for\x20parameter\x20correction.\x0a\x0a###\x20Unified\x20Response\x20Envelope\x0a```\x0a{\x0a\x20\x20\x22result\x22:\x20{\x20\x22status\x22:\x20\x22success|error|schema_mismatch\x22,\x20\x22data\x22:\x20<sub-tool\x20output>,\x20\x22errors\x22:\x20[...]\x20},\x0a\x20\x20\x22schema\x22:\x20null\x20|\x20{\x20\x22input\x22:\x20<JSON\x20schema>,\x20\x22tool\x22:\x20\x22<sub-tool-name>\x22\x20}\x0a}\x0a```\x0a\x0a##\x20CRITICAL:\x20Schema\x20Discovery\x20Rule\x0a\x0aWhen\x20the\x20current\x20context\x20does\x20not\x20contain\x20a\x20sub-tool\x27s\x20input/output\x20schema,\x20or\x20when\x20you\x20are\x20uncertain\x20whether\x20the\x20schema\x20you\x20have\x20is\x20complete\x20and\x20up-to-date,\x20you\x20MUST\x20query\x20it\x20first\x20before\x20calling\x20the\x20sub-tool.\x20Use\x20`wowok({\x20tool:\x20\x22schema_query\x22,\x20data:\x20{\x20action:\x20\x22get\x22,\x20name:\x20\x22<sub-tool>\x22\x20}\x20})'+'`'+'\x20for\x20operational\x20sub-tool\x20schemas\x20or\x20`wowok({\x20tool:\x20\x22wowok_buildin_info\x22,\x20data:\x20{\x20info:\x20\x22...\x22\x20}\x20})`\x20for\x20protocol\x20constants\x20and\x20reference\x20data.\x20Never\x20guess\x20schema\x20parameters,\x20query\x20instruction\x20IDs,\x20or\x20type\x20codes\x20—\x20always\x20retrieve\x20them\x20from\x20the\x20live\x20server.\x0a\x0a##\x20CRITICAL:\x20Global\x20Unread\x20Messenger\x20Check\x20(every\x20conversation)\x0a\x0aAt\x20the\x20START\x20of\x20EVERY\x20conversation\x20—\x20before\x20answering\x20the\x20user\x27s\x20request,\x20regardless\x20of\x20what\x20it\x20is\x20about\x20—\x20check\x20for\x20unread\x20Messenger\x20messages\x20and\x20IMMEDIATELY\x20and\x20PROMINENTLY\x20remind\x20the\x20user\x20to\x20read\x20them:\x0a\x0a```\x0awowok({\x20tool:\x20\x22messenger_operation\x22,\x20data:\x20{\x20operation:\x20\x22watch_conversations\x22,\x20filter:\x20{\x20unreadOnly:\x20true,\x20previewMessageCount:\x200,\x20skipAutoMarkViewed:\x20true\x20}\x20}\x20})\x0a```\x0a\x0aIf\x20the\x20result\x20contains\x20any\x20conversation\x20with\x20`unreadCount\x20>\x200`,\x20surface\x20a\x20prominent\x20reminder\x20at\x20the\x20TOP\x20of\x20your\x20response\x20(do\x20not\x20wait\x20for\x20the\x20user\x20to\x20ask),\x20listing\x20each\x20peer\x20with\x20unread\x20messages\x20and\x20the\x20count.\x20Use\x20`skipAutoMarkViewed:\x20true`\x20so\x20merely\x20checking\x20does\x20not\x20mark\x20them\x20read.\x20If\x20there\x20are\x20none,\x20do\x20not\x20mention\x20the\x20check.\x0a\x0a##\x20CRITICAL:\x20Upgrade\x20&\x20Client\x20Install\x20Reminder\x20(every\x20conversation)\x0a\x0aAt\x20the\x20START\x20of\x20EVERY\x20conversation\x20—\x20together\x20with\x20the\x20unread\x20Messenger\x20check\x20—\x20call:\x0a\x0a```\x0awowok({\x20tool:\x20\x22wowok_buildin_info\x22,\x20data:\x20{\x20info:\x20\x22upgrade_check\x22\x20}\x20})\x0a```\x0a\x0aThen,\x20based\x20on\x20the\x20returned\x20`result.reminder`:\x0a-\x20If\x20`reminder.type\x20===\x20\x22upgrade\x22`\x20AND\x20`reminder.due\x20===\x20true`:\x20IMMEDIATELY\x20remind\x20the\x20user\x20to\x20upgrade\x20(do\x20not\x20wait\x20for\x20them\x20to\x20ask).\x20Use\x20the\x20benefit-focused\x20wording\x20below,\x20filling\x20in\x20the\x20current/latest\x20versions\x20from\x20`result.mcp`\x20/\x20`result.sdk`.\x0a-\x20If\x20`reminder.type\x20===\x20\x22install_client\x22`\x20AND\x20`reminder.due\x20===\x20true`:\x20remind\x20the\x20user\x20to\x20install\x20the\x20WoWok\x20desktop\x20client\x20(this\x20fires\x20at\x20most\x20once\x20per\x20week\x20—\x20the\x20reminder\x20state\x20is\x20persisted\x20automatically).\x0a-\x20If\x20`reminder.type\x20===\x20\x22none\x22`\x20or\x20`reminder.due\x20===\x20false`:\x20do\x20NOT\x20mention\x20upgrades\x20or\x20the\x20client.\x0a\x0aUpgrade\x20wording\x20(paraphrase\x20naturally,\x20keep\x20it\x20short\x20and\x20benefit-driven;\x20adapt\x20to\x20the\x20user\x27s\x20language):\x0a\x20\x20\x22A\x20newer\x20WoWok\x20version\x20is\x20available\x20(current\x20vX\x20→\x20latest\x20vY).\x20Upgrade\x20for\x20more\x20features\x20and\x20improvements.\x20Run:\x20npm\x20install\x20-g\x20@wowok/agent-mcp@latest\x22\x0a\x0aClient\x20install\x20wording:\x0a\x20\x20\x22The\x20WoWok\x20desktop\x20client\x20is\x20not\x20installed\x20yet.\x20It\x20provides\x20wallet\x20management,\x20encrypted\x20Messenger,\x20project\x20management\x20and\x20more.\x20Download\x20it\x20at\x20https://download.wowok.net\x20to\x20get\x20started.\x22\x0a\x0aIf\x20the\x20upgrade_check\x20itself\x20fails\x20(offline\x20/\x20registry\x20unreachable),\x20skip\x20the\x20reminder\x20—\x20never\x20fabricate\x20version\x20numbers.\x0a\x0a##\x20Token\x20System\x20Overview\x0a\x0a###\x20Default\x20Platform\x20Token:\x20WOW\x0a-\x20Token\x20Type:\x200x2::wow::WOW\x0a-\x20Precision:\x201_000_000_000\x20(9\x20decimal\x20places)\x0a-\x20This\x20is\x20the\x20default\x20token\x20for\x20all\x20operations\x20unless\x20specified\x20otherwise\x0a\x0a###\x20Multi-Token\x20Support\x0aThe\x20platform\x20supports\x20ANY\x20token\x20(e.g.,\x20USDT,\x20USDC,\x20custom\x20tokens).\x20To\x20use\x20non-WOW\x20tokens:\x0a1.\x20Use\x20query_toolkit\x20with\x20query_type=\x27token_list\x27\x20to\x20query\x20available\x20tokens\x20and\x20their\x20precision\x20info\x0a2.\x20Use\x20the\x20token\x27s\x20full\x20type\x20string\x20(e.g.,\x20\x270x2::usdt::USDT\x27)\x20in\x20token_type\x20parameter\x0a3.\x20Each\x20token\x20has\x20its\x20own\x20precision\x20-\x20always\x20verify\x20before\x20operations\x0a\x0a###\x20Token\x20Precision\x20Handling\x0aDifferent\x20tokens\x20have\x20different\x20precisions.\x20ALWAYS\x20query\x20to\x20verify:\x0a-\x20WOW\x20(default):\x201_000_000_000\x20(9\x20decimals)\x0a-\x20Other\x20tokens:\x20Use\x20query_toolkit\x20with\x20query_type=\x27token_list\x27\x20to\x20get\x20actual\x20precision\x0a-\x20Never\x20assume\x20a\x20token\x27s\x20decimal\x20places\x20-\x20always\x20query\x20first\x0a\x0a##\x20CRITICAL:\x20Token\x20Amount\x20Handling\x0a\x0a###\x20Amount\x20Input\x20Rules\x0a1.\x20WITH\x20currency\x20unit\x20(e.g.,\x20\x272WOW\x27,\x20\x2710.5WOW\x27,\x20\x27100USDT\x27):\x0a\x20\x20\x20-\x20Auto-converted\x20using\x20token\x27s\x20precision:\x202WOW\x20->\x202_000_000_000\x0a\x20\x20\x20-\x20Use\x20for:\x20All\x20on-chain\x20token\x20operations\x0a\x20\x20\x20-\x20MUST\x20match\x20the\x20token_type\x20parameter\x0a\x0a2.\x20WITHOUT\x20currency\x20unit\x20(e.g.,\x20\x272\x27,\x20\x27100\x27):\x0a\x20\x20\x20-\x20Used\x20as-is:\x202\x20->\x202\x0a\x20\x20\x20-\x20Use\x20for:\x20Regular\x20numeric\x20parameters\x20(counts,\x20indices,\x20etc.)\x0a\x0a###\x20Multi-Token\x20Operation\x20Examples\x0a-\x20Create\x20USDT-priced\x20Service:\x20token_type=\x270x2::usdt::USDT\x27,\x20amount=\x27100USDT\x27\x0a-\x20Allocate\x20USDC\x20rewards:\x20token_type=\x270x2::usdc::USDC\x27,\x20amount=\x27500USDC\x27\x0a-\x20WOW\x20remains\x20default:\x20omit\x20token_type\x20or\x20use\x20\x270x2::wow::WOW\x27\x0a\x0a###\x20Security\x20Warning\x0aToken\x20amounts\x20are\x20HIGHLY\x20SENSITIVE.\x20Always:\x0a-\x20Confirm\x20user\x27s\x20intent\x20before\x20executing\x20transfers\x0a-\x20Verify\x20token\x20type\x20and\x20amount\x20format\x20(with/without\x20unit)\x0a-\x20Query\x20token\x20precision\x20if\x20unsure\x0a-\x20Double-check\x20large\x20amount\x20transactions\x0a-\x20Never\x20assume\x20decimal\x20places\x20-\x20use\x20explicit\x20token\x20unit\x0a\x0a##\x20Sub-tool\x20Selection\x20Guide\x0a\x0aAll\x20sub-tools\x20are\x20called\x20via\x20`wowok({\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{...}\x20})`.\x20The\x20table\x20below\x20helps\x20pick\x20the\x20correct\x20`tool`\x20value.\x0a\x0a|\x20User\x20Intent\x20|\x20Correct\x20Sub-tool\x20|\x20Wrong\x20Sub-tool\x20(Avoid)\x20|\x0a|------------|------------------|------------------------|\x0a|\x20Create\x20service\x20listing\x20|\x20onchain_operations\x20(service)\x20|\x20query_toolkit\x20|\x0a|\x20Send\x20coins\x20to\x20address\x20|\x20onchain_operations\x20(payment)\x20|\x20account_operation\x20|\x0a|\x20Check\x20my\x20balance\x20|\x20query_toolkit\x20(account_balance)\x20|\x20onchain_operations\x20|\x0a|\x20Manage\x20local\x20wallet\x20|\x20account_operation\x20|\x20onchain_operations\x20|\x0a|\x20Export\x20Guard\x20for\x20edit\x20|\x20guard2file\x20|\x20query_toolkit\x20|\x0a|\x20Send/Watch\x20encrypted\x20message\x20|\x20messenger_operation\x20|\x20onchain_operations\x20|\x0a|\x20Create\x20workflow\x20template\x20|\x20onchain_operations\x20(machine)\x20|\x20wip_file\x20|\x0a|\x20Store\x20my\x20phone\x20number\x20|\x20local_info_operation\x20|\x20onchain_operations\x20|\x0a|\x20Buy\x20service\x20(create\x20order)\x20|\x20onchain_operations\x20(order)\x20|\x20onchain_operations\x20(service)\x20|\x0a|\x20Manage\x20my\x20orders\x20|\x20onchain_operations\x20(order)\x20|\x20query_toolkit\x20|\x0a|\x20Apply\x20for\x20arbitration\x20|\x20onchain_operations\x20(order)\x20|\x20onchain_operations\x20(arbitration)\x20|\x0a|\x20Create\x20reward\x20pool\x20for\x20marketing\x20|\x20onchain_operations\x20(reward)\x20|\x20onchain_operations\x20(treasury)\x20|\x0a|\x20Claim\x20rewards\x20from\x20pool\x20|\x20onchain_operations\x20(reward)\x20|\x20query_toolkit\x20|\x0a|\x20Create\x20fund\x20allocation\x20plan\x20|\x20onchain_operations\x20(allocation)\x20|\x20onchain_operations\x20(treasury)\x20|\x0a|\x20Execute\x20fund\x20distribution\x20|\x20onchain_operations\x20(allocation)\x20|\x20onchain_operations\x20(payment)\x20|\x0a|\x20Post\x20service\x20demand\x20with\x20reward\x20|\x20onchain_operations\x20(demand)\x20|\x20onchain_operations\x20(service)\x20|\x0a|\x20Submit\x20solution\x20for\x20demand\x20|\x20onchain_operations\x20(demand)\x20|\x20onchain_operations\x20(order)\x20|\x0a|\x20Create\x20team\x20treasury\x20|\x20onchain_operations\x20(treasury)\x20|\x20onchain_operations\x20(allocation)\x20|\x0a|\x20Deposit/Withdraw\x20from\x20treasury\x20|\x20onchain_operations\x20(treasury)\x20|\x20onchain_operations\x20(payment)\x20|\x0a|\x20Create\x20access\x20control\x20rules\x20|\x20onchain_operations\x20(permission)\x20|\x20onchain_operations\x20(guard)\x20|\x0a|\x20Create\x20validation\x20rules\x20(Guard)\x20|\x20onchain_operations\x20(guard)\x20|\x20onchain_operations\x20(permission)\x20|\x0a|\x20Export\x20Guard\x20for\x20editing\x20|\x20guard2file\x20|\x20query_toolkit\x20|\x0a|\x20Export\x20Machine\x20nodes\x20for\x20editing\x20|\x20machineNode2file\x20|\x20query_toolkit\x20|\x0a|\x20Query\x20token\x20list\x20and\x20precision\x20|\x20query_toolkit\x20(token_list)\x20|\x20wowok_buildin_info\x20|\x0a|\x20Watch\x20on-chain\x20events\x20|\x20onchain_events\x20|\x20query_toolkit\x20|\x0a|\x20Generate\x20WIP\x20promise\x20file\x20|\x20wip_file\x20(generate)\x20|\x20messenger_operation\x20|\x0a|\x20Sign\x20WIP\x20file\x20|\x20wip_file\x20(sign)\x20|\x20account_operation\x20(signData)\x20|\x0a|\x20Verify\x20WIP\x20file\x20integrity\x20|\x20wip_file\x20(verify)\x20|\x20query_toolkit\x20|\x0a|\x20Send\x20encrypted\x20file\x20via\x20messenger\x20|\x20messenger_operation\x20(send_file)\x20|\x20wip_file\x20|\x0a|\x20Generate\x20Witness\x20Timestamped\x20Sequence\x20(WTS)\x20|\x20messenger_operation\x20(generate_wts)\x20|\x20wip_file\x20|\x0a|\x20Query\x20protocol\x20constants\x20|\x20wowok_buildin_info\x20|\x20query_toolkit\x20|\x0a|\x20Query\x20sub-tool\x20schemas\x20|\x20schema_query\x20|\x20wowok_buildin_info\x20|\x0a|\x20Cross-chain\x20bridge\x20(WOW<->EVM)\x20|\x20bridge_operation\x20|\x20onchain_operations\x20|\x0a|\x20On-chain\x20business\x20intelligence\x20(panoramas,\x20review\x20packs)\x20|\x20query_toolkit\x20|\x20onchain_operations\x20|\x0a|\x20Runtime\x20service\x20toggles\x20|\x20config_operation\x20|\x20—\x20|\x0a|\x20Service\x20trust/risk\x20assessment\x20|\x20trust_score\x20|\x20query_toolkit\x20|\x0a|\x20Query\x20dynamic\x20table\x20data\x20/\x20table\x20items\x20|\x20onchain_table_data\x20|\x20query_toolkit\x20|\x0a|\x20Business\x20evaluation\x20(risk/match/game/evidence)\x20|\x20evaluation_operation\x20|\x20trust_score\x20|\x0a|\x20Set\x20user\x20persona\x20/\x20preferences\x20|\x20persona_operation\x20|\x20local_info_operation\x20|\x0a|\x20Match\x20business\x20intent\x20to\x20chain\x20events\x20|\x20intent_radar\x20|\x20onchain_events\x20|\x0a|\x20Manage\x20employee\x20KPI\x20/\x20liability\x20|\x20employee_operation\x20|\x20onchain_operations\x20|\x0a|\x20Scaffold\x20/\x20register\x20industry\x20pack\x20|\x20industry_pack_operation\x20|\x20persona_operation\x20|\x0a|\x20Read\x20/\x20write\x20local\x20workspace\x20files\x20|\x20workspace_operation\x20|\x20local_info_operation\x20|\x0a|\x20List\x20local-account\x20actionable\x20progress\x20/\x20advance\x20forward\x20|\x20workflow_operation\x20|\x20onchain_operations\x20|\x0a|\x20List\x20Permissions\x20related\x20to\x20local\x20accounts\x20|\x20permission_operation\x20|\x20query_toolkit\x20|\x0a|\x20Ask\x20the\x20user\x20to\x20choose\x20between\x20concrete\x20business\x20options\x20(plans/pricing/guard\x20strength/accounts)\x20|\x20ask_user\x20|\x20onchain_operations\x20/\x20prose\x20questions\x20|\x0a\x0a##\x20Sub-tool\x20Categories\x0a\x0a###\x20LOCAL\x20ONLY\x20(Never\x20touch\x20blockchain):\x0a-\x20account_operation\x0a-\x20local_mark_operation\x0a-\x20local_info_operation\x0a-\x20persona_operation\x0a-\x20employee_operation\x0a-\x20industry_pack_operation\x0a-\x20workspace_operation\x0a\x0a###\x20ON-CHAIN\x20(Blockchain\x20transactions):\x0a-\x20onchain_operations\x0a-\x20workflow_operation\x20(operate\x20advances/holds\x20progress\x20on-chain;\x20list\x20is\x20read-only)\x0a-\x20messenger_operation\x20(some\x20operations)\x0a-\x20wip_file\x20(sign\x20operation)\x0a-\x20bridge_operation\x0a\x0a###\x20QUERY\x20(Read-only):\x0a-\x20query_toolkit\x0a-\x20onchain_events\x0a-\x20onchain_table_data\x0a-\x20wowok_buildin_info\x0a-\x20schema_query\x0a-\x20guard2file\x0a-\x20machineNode2file\x0a-\x20evaluation_operation\x0a-\x20intent_radar\x0a-\x20permission_operation\x0a\x0a###\x20WORKFLOW\x20&\x20ANALYTICS:\x0a-\x20config_operation\x0a-\x20trust_score\x0a';function buildServer(){const a=new McpServer(createServerConfig(packageJson,SERVER_DESCRIPTION),createCapabilitiesConfig());return registerAllTools(a),a;}export{OnchainOperationsSchema,WipOperationsSchema,WatchQueryOperationsSchema,AccountOperationSchema,LocalMarkOperationSchema,LocalInfoOperationSchema,LocalHistoryOperationSchema,ProtocolInfoQuerySchema,CallOutputSchema,MessengerOperationInputSchema,MessengerOperationOutputSchema};async function main(){if(areSchemasAvailable()){const c=getSchemaIndex();c&&console['error']('Schema\x20system\x20ready:\x20'+(c['tools']?.['length']||0x0)+'\x20tools,\x20'+(c['operations']?.['length']||0x0)+'\x20operations');}else console['error']('Schema\x20files\x20not\x20available.\x20Run\x20\x27npm\x20run\x20generate:schemas\x27\x20to\x20generate\x20them.');const a=listServices()['filter'](d=>d['enabled'])['map'](d=>d['name']);console['error']('Phase\x202\x20active\x20services:\x20'+(a['join'](',\x20')||'none'));try{const d=scanDefaultIndustryPacks(),f=d['filter'](g=>g['ok'])['length'];console['error']('Industry\x20packs\x20ready:\x20'+f+'/'+d['length']+'\x20registered\x20at\x20startup');}catch(g){console['error']('[industry]\x20startup\x20bootstrap\x20failed:\x20'+g['message']);}if(process['env']['MONITOR_LOOP']==='1')try{const h=await monitorLoop['start']();console['error']('MonitorLoop\x20started\x20(MONITOR_LOOP=1):\x20'+h['join'](',\x20'));}catch(i){console['error']('[monitor]\x20MonitorLoop\x20start\x20failed:\x20'+(i?.['message']??i));}const b=serveStdio(()=>buildServer());process['on']('SIGINT',async()=>{await monitorLoop['stop']()['catch'](()=>undefined),await b['close'](),process['exit'](0x0);}),process['on']('SIGTERM',async()=>{console['error']('[SIGTERM]\x20'+new Date()['toISOString']()+'\x20—\x20graceful\x20shutdown');try{await monitorLoop['stop']();}catch{}try{await b['close']();}catch{}process['exit'](0x0);});}main()['catch'](console['error']);
@@ -1 +1 @@
1
- export const EVENT_SEMANTIC_REGISTRY=[{'name':'NewOrderEvent','move_type':'::order::NewOrderEvent','module':'order','category':'lifecycle','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'A\x20new\x20Order\x20was\x20placed\x20on\x20a\x20Service\x20(shared,\x20escrow-funded)','trigger':'order.move\x20`create`\x20—\x20the\x20ONLY\x20emission\x20point.\x20Fires\x20when\x20the\x20order\x20becomes\x20a\x20shared\x20object;\x20'+'validates:\x20machine\x20⇒\x20progress\x20bound;\x20amount\x20>\x200\x20⇒\x20allocation\x20bound.','side_effect':'Order\x20is\x20live:\x20buyer\x20funds\x20were\x20split\x20into\x20CoinWrappers\x20via\x20the\x20Service\x20Allocation;\x20'+'machine-governed\x20orders\x20can\x20now\x20be\x20advanced\x20by\x20operators.','params':[{'name':'object','shape':'address','meaning':'The\x20new\x20Order\x20object\x20id'},{'name':'service','shape':'address','meaning':'The\x20Service\x20the\x20order\x20was\x20placed\x20on'},{'name':'progress','shape':'Option<address>','meaning':'Bound\x20Progress\x20(machine\x20orders)\x20—\x20null\x20for\x20non-machine\x20orders'},{'name':'discount','shape':'Option<address>','meaning':'Discount\x20object\x20consumed\x20at\x20quote\x20time,\x20if\x20any'},{'name':'allocation','shape':'Option<address>','meaning':'Allocation\x20that\x20escrowed\x20the\x20payment\x20(required\x20when\x20amount\x20>\x200)'},{'name':'amount','shape':'u64','meaning':'Total\x20order\x20amount\x20in\x20the\x20Service\x27s\x20payment\x20token\x20(raw\x20on-chain\x20units)'}]},{'name':'ArbEvent','move_type':'::arb::ArbEvent','module':'arb','category':'state_change','consumers':['suggestion_bridge','problem_bridge','intent_radar'],'business_meaning':'Arbitration\x20status\x20transition\x20on\x20a\x20dispute\x20case\x20(open\x20/\x20voting\x20/\x20verdict\x20/\x20objection\x20/\x20finish\x20/\x20withdraw)','trigger':'arb.move\x20—\x20emitted\x20on\x20EVERY\x20status\x20transition:\x20create\x20(Arbitrator_confirming),\x20'+'proposition_change\x20/\x20principal\x20confirm\x20(Voting),\x20votes\x20closed\x20(Arbitrated),\x20objection\x20'+'(Objectionable),\x20finish\x20with\x20indemnity\x20(Finished\x20+\x20compensation),\x20withdraw\x20(Withdrawn).\x20'+'Helper\x20`emit_arb_event`\x20reads\x20the\x20POST-transition\x20state.','side_effect':'Parties\x20should\x20re-read\x20the\x20Arb\x20object\x20on\x20every\x20event;\x20status\x20decides\x20who\x20acts\x20next.\x20'+'When\x20indemnity_amount\x20is\x20set,\x20the\x20compensation\x20recipient\x20can\x20claim\x20after\x20compensation_time.','params':[{'name':'object','shape':'address','meaning':'The\x20Arb\x20(dispute\x20case)\x20object\x20id'},{'name':'arbitration','shape':'address','meaning':'The\x20governing\x20Arbitration\x20object\x20(voting\x20rules,\x20arbitrator\x20set)'},{'name':'order','shape':'address','meaning':'The\x20disputed\x20Order'},{'name':'status','shape':'u8','meaning':'0\x20Principal_confirming\x20·\x201\x20Arbitrator_confirming\x20·\x202\x20Voting\x20·\x203\x20Arbitrated\x20·\x204\x20Objectionable\x20·\x205\x20Finished\x20·\x206\x20Withdrawn'},{'name':'indemnity_amount','shape':'Option<u64>','meaning':'Awarded\x20compensation\x20(set\x20on\x20Arbitrated/Finished);\x20null\x20otherwise'},{'name':'compensation_time','shape':'Option<u64>','meaning':'Timestamp-ms\x20after\x20which\x20the\x20compensation\x20can\x20be\x20withdrawn\x20(locks\x20expire)'}]},{'name':'VoteEvent','move_type':'::arb::VoteEvent','module':'arb','category':'state_change','consumers':['intent_radar'],'channel_note':'Deliberately\x20radar-only:\x20per-vote\x20granularity\x20is\x20too\x20noisy\x20for\x20push;\x20the\x20ArbEvent\x20'+'Voting/Arbitrated\x20transitions\x20already\x20carry\x20the\x20push\x20signals\x20(P2-1).','business_meaning':'One\x20arbitration\x20vote\x20cast\x20(real-time\x20tally)','trigger':'arb.move\x20—\x20on\x20each\x20`vote`/`vote_with_passport`\x20call\x20(one\x20per\x20voter\x20per\x20round);\x20'+'lets\x20parties\x20track\x20the\x20tally\x20without\x20polling\x20the\x20Arb\x20object.','params':[{'name':'object','shape':'address','meaning':'The\x20Arb\x20object\x20being\x20voted\x20on'},{'name':'voter','shape':'address','meaning':'The\x20voting\x20arbitrator\x20(or\x20passport-proven\x20delegate)'},{'name':'agrees','shape':'vector<u8>','meaning':'Proposition\x20indexes\x20the\x20voter\x20agreed\x20to'},{'name':'weight','shape':'u32','meaning':'Vote\x20weight\x20applied\x20(guard-weighted\x20voting)'}]},{'name':'FeedbackEvent','move_type':'::arb::FeedbackEvent','module':'arb','category':'state_change','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'New\x20feedback\x20message\x20on\x20an\x20arbitration\x20case','trigger':'arb.move\x20—\x20on\x20`feedback`\x20(any\x20party\x20posts\x20a\x20message\x20into\x20the\x20case).','params':[{'name':'object','shape':'address','meaning':'The\x20Arb\x20object'},{'name':'feedback','shape':'String','meaning':'The\x20feedback\x20text'}]},{'name':'DemandPresentEvent','move_type':'::demand::PresentEvent','module':'demand','category':'market_opportunity','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'A\x20presenter\x20submitted/updated\x20a\x20solution\x20pitch\x20on\x20a\x20Demand','trigger':'demand.move\x20`present_imp`\x20—\x20first\x20present\x20inserts\x20a\x20presenter\x20row;\x20re-present\x20updates\x20it\x20'+'(recommend\x20text\x20+\x20optional\x20bound\x20Service).\x20Passport-gated\x20variants\x20resolve\x20the\x20Service\x20from\x20'+'the\x20passport\x20submission\x20when\x20the\x20demand\x27s\x20guard\x20sets\x20a\x20service_identifier.','side_effect':'Demand\x20owner\x20now\x20has\x20a\x20candidate;\x20track\x20update_time\x20to\x20rank\x20freshest\x20pitches.\x20'+'This\x20is\x20the\x20supply\x20side\x20of\x20the\x20demand\x20marketplace\x20(K3\x2013\x20§6.7).','params':[{'name':'object','shape':'address','meaning':'The\x20Demand\x20object'},{'name':'service','shape':'Option<address>','meaning':'The\x20presented\x20Service\x20(null\x20=\x20raw\x20recommendation\x20without\x20a\x20bound\x20service)'},{'name':'recommend','shape':'String','meaning':'The\x20presenter\x27s\x20pitch/recommendation\x20text'}]},{'name':'DemandFeedbackEvent','move_type':'::demand::DemandEvent','module':'demand','category':'reputation','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Demand\x20owner\x20scored/feedbacked\x20a\x20presenter\x20(acceptance\x20score)','trigger':'demand.move\x20`feedback_imp`\x20—\x20only\x20for\x20addresses\x20already\x20in\x20the\x20presenters\x20table;\x20'+'records\x20feedback\x20text\x20+\x20optional\x20acceptance\x20score\x20onto\x20the\x20presenter\x20row.','side_effect':'Acceptance\x20score\x20is\x20the\x20demand-side\x20quality\x20signal\x20for\x20the\x20presenter;\x20high\x20scores\x20build\x20'+'presenter\x20reputation\x20for\x20future\x20matching.','params':[{'name':'object','shape':'address','meaning':'The\x20Demand\x20object'},{'name':'service','shape':'Option<address>','meaning':'The\x20Service\x20that\x20was\x20presented\x20by\x20the\x20scored\x20presenter'},{'name':'feedback','shape':'String','meaning':'Feedback\x20text'},{'name':'acceptance_score','shape':'Option<u8>','meaning':'0-100\x20acceptance\x20score,\x20null\x20when\x20feedback\x20carries\x20no\x20score'}]},{'name':'DemandChangedEvent','move_type':'::demand::DemandChangedEvent','module':'demand','category':'market_opportunity','consumers':['intent_radar'],'channel_note':'Deliberately\x20radar-only:\x20merchant-side\x20discovery\x20is\x20pull-based\x20matching\x20semantics\x20'+'(K3\x2013\x20§6.7\x20opportunity\x20broadcast);\x20there\x20is\x20no\x20goal-bound\x20push\x20target\x20to\x20bridge\x20to.','business_meaning':'Demand\x20became/updated\x20a\x20profitable\x20opportunity\x20for\x20merchants\x20(market-opportunity\x20event)','trigger':'demand.move\x20`demand_changed_event_emit`\x20—\x20fires\x20when\x20rewards\x20are\x20bound/changed,\x20or\x20'+'description/location\x20changes\x20while\x20reward-bearing.\x20A\x20reward-less\x20demand\x20NEVER\x20emits\x20'+'(not\x20a\x20profitable\x20opportunity\x20—\x20K3\x2013\x20§6.7\x20principle).','side_effect':'PRIMARY\x20merchant-side\x20discovery\x20signal:\x20Intent\x20Radar\x20/\x20match\x20engines\x20should\x20treat\x20every\x20'+'emission\x20as\x20a\x20fresh\x20matchmaking\x20opportunity.\x20Reward\x20amounts/claim\x20rules\x20are\x20NOT\x20carried\x20—\x20'+'read\x20the\x20Reward\x20objects\x20by\x20id\x20(authoritative,\x20never\x20stale).','params':[{'name':'object','shape':'address','meaning':'The\x20Demand\x20object'},{'name':'location','shape':'String','meaning':'Demand\x20location\x20(industry/geography\x20routing\x20signal)'},{'name':'description','shape':'String','meaning':'Bounded\x20description\x20preview\x20(truncated\x20on-chain;\x20full\x20text\x20on\x20the\x20object)'},{'name':'rewards','shape':'vector<address>','meaning':'Bound\x20Reward\x20object\x20ids\x20—\x20resolve\x20amounts/conditions\x20by\x20query_objects'}]},{'name':'ProgressEvent','move_type':'::progress::ProgressEvent','module':'progress','category':'state_change','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Order/task\x20workflow\x20advanced,\x20held,\x20or\x20initialized\x20on\x20a\x20Machine\x20graph','trigger':'progress.move\x20—\x204\x20emission\x20points:\x20`new_imp`\x20(progress\x20created\x20at\x20init\x20node,\x20no\x20forward),\x20'+'`session_accomplish`\x20(threshold\x20reached\x20→\x20node\x20migrated),\x20`hold_imp`/`hold_imp_with_passport`\x20'+'(hold\x20or\x20un-hold\x20of\x20a\x20forward,\x20hold\x20field\x20carries\x20the\x20new\x20state).','side_effect':'Operators\x20should\x20check\x20the\x20new\x20node\x20name\x20against\x20their\x20Machine\x20duties;\x20hold=true\x20pauses\x20that\x20'+'forward\x27s\x20contribution,\x20hold=false\x20resumes\x20it.','params':[{'name':'object','shape':'address','meaning':'The\x20Progress\x20object'},{'name':'machine','shape':'address','meaning':'The\x20Machine\x20(workflow\x20template)\x20governing\x20this\x20progress'},{'name':'task','shape':'Option<address>','meaning':'The\x20bound\x20task\x20(usually\x20the\x20Order)\x20—\x20null\x20for\x20standalone\x20progress'},{'name':'node','shape':'String','meaning':'Node\x20reached\x20(init\x20node\x20on\x20creation;\x20next_node\x20on\x20migration/hold)'},{'name':'forward','shape':'Option<String>','meaning':'The\x20forward\x20name\x20that\x20triggered\x20the\x20transition\x20(null\x20on\x20creation)'},{'name':'hold','shape':'Option<bool>','meaning':'Present\x20only\x20on\x20hold/un-hold:\x20true\x20=\x20forward\x20held,\x20false\x20=\x20released'}]},{'name':'NewEntityEvent','move_type':'::registrar::NewEntityEvent','module':'registrar','category':'lifecycle','consumers':['intent_radar'],'channel_note':'Deliberately\x20radar-only:\x20ecosystem-entry\x20/\x20profile-update\x20signal\x20with\x20no\x20goal-bound\x20'+'push\x20target;\x20the\x20Intent\x20Radar\x20consumes\x20it\x20as\x20matching\x20context,\x20not\x20as\x20an\x20actionable\x20push.','business_meaning':'Entity\x20registered\x20or\x20re-announced\x20(new\x20counterparty\x20/\x20profile\x20update)','trigger':'registrar.move\x20—\x204\x20sites:\x20entity_register\x20/\x20entity_register_with_resource_forced\x20(new\x20Resource\x20'+'created),\x20entity_resource_use\x20(first\x20on-chain\x20use\x20of\x20a\x20resource),\x20entity_description_set,\x20'+'entity_info_add\x20(profile\x20updates\x20re-announce\x20the\x20entity).','side_effect':'A\x20new\x20potential\x20counterparty\x20entered\x20the\x20ecosystem,\x20or\x20an\x20existing\x20one\x20updated\x20its\x20public\x20'+'profile\x20—\x20refresh\x20cached\x20entity\x20profiles/records.','params':[{'name':'resource','shape':'address','meaning':'The\x20entity\x27s\x20Resource\x20object\x20(per-chain\x20identity\x20resource)'},{'name':'referrer','shape':'Option<address>','meaning':'Referring\x20entity\x20address,\x20when\x20registered\x20via\x20referral'}]},{'name':'ServiceEvent','move_type':'::service::ServiceEvent','module':'service','category':'market_opportunity','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Service\x20became/updated\x20a\x20purchasable\x20supply\x20(active-supply\x20event)','trigger':'service.move\x20`service_event_emit`\x20—\x20ONLY\x20when\x20bPublished\x20&&\x20!bPaused\x20at\x20the\x20mutation\x20point:\x20'+'publish,\x20unpause,\x20and\x20pre-publish\x20description\x20changes\x20re-notify.\x20Pausing\x20/\x20unpublishing\x20/\x20'+'draft-only\x20mutations\x20NEVER\x20emit\x20(not\x20a\x20participatable\x20opportunity\x20—\x20K3\x2013\x20§6.7).','side_effect':'PRIMARY\x20customer-side\x20discovery\x20signal:\x20every\x20emission\x20is\x20a\x20buyable\x20service\x20with\x20its\x20routing\x20'+'text.\x20The\x20authoritative\x20description/sales/stock\x20live\x20on\x20the\x20Service\x20object\x20by\x20id.','params':[{'name':'object','shape':'address','meaning':'The\x20Service\x20object'},{'name':'location','shape':'String','meaning':'Service\x20location\x20(industry/geography\x20routing\x20signal)'},{'name':'description','shape':'String','meaning':'Bounded\x20description\x20preview\x20(truncated\x20on-chain)'}]},{'name':'ArbitrationEvent','move_type':'::arbitration::ArbitrationEvent','module':'arbitration','category':'market_opportunity','consumers':['intent_radar'],'channel_note':'Deliberately\x20radar-only:\x20arbitrator\x20discovery\x20is\x20pull-based\x20matching\x20semantics\x20'+'(merchants\x20query\x20ArbitrationEvent\x20to\x20shortlist\x20third-party\x20arbiters),\x20no\x20goal-bound\x20'+'push\x20target\x20(mirrors\x20DemandChangedEvent).','business_meaning':'Arbitration\x20became\x20selectable/updated\x20a\x20third-party\x20dispute-resolution\x20offer\x20(active-arbiter\x20supply\x20event)','trigger':'arbitration.move\x20`arbitration_event_emit`\x20—\x20ONLY\x20when\x20bPaused\x20==\x20false\x20at\x20the\x20mutation\x20point:\x20'+'pause(false)\x20(unpause/listing),\x20and\x20description_set\x20/\x20location_set\x20/\x20fee_set\x20while\x20active.\x20'+'Pausing\x20or\x20pre-publish\x20mutations\x20NEVER\x20emit\x20(not\x20a\x20selectable\x20opportunity\x20—\x20K3\x2013\x20§6.7).','side_effect':'Merchant-side\x20discovery\x20signal:\x20every\x20emission\x20is\x20a\x20selectable\x20third-party\x20arbiter\x20with\x20its\x20'+'routing\x20text,\x20fee,\x20and\x20voting-guard\x20count.\x20The\x20authoritative\x20description/voting-guards\x20live\x20on\x20the\x20Arbitration\x20object\x20by\x20id.','params':[{'name':'object','shape':'address','meaning':'The\x20Arbitration\x20object\x20id'},{'name':'location','shape':'String','meaning':'Arbitration\x20location\x20(industry/geography\x20routing\x20signal)'},{'name':'description','shape':'String','meaning':'Bounded\x20description\x20preview\x20(truncated\x20on-chain)'},{'name':'fee','shape':'u64','meaning':'Dispute\x20fee\x20charged\x20by\x20the\x20Arbitration\x20(raw\x20on-chain\x20units)'},{'name':'voting_guard_count','shape':'u64','meaning':'Number\x20of\x20voting\x20guards\x20(0\x20=\x20open\x20to\x20everybody;\x20>0\x20=\x20guarded/weighted)'}]},{'name':'AllocationEvent','move_type':'::allocation::AllocationEvent','module':'allocation','category':'fund_flow','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Allocation\x20run\x20completed\x20—\x20funds\x20left\x20the\x20Allocation\x20pool\x20as\x20a\x20Payment','trigger':'allocation.move\x20alloc\x20loop\x20—\x20when\x20a\x20matching\x20Allocator\x27s\x20guard\x20passes:\x20splits\x20the\x20balance\x20per\x20'+'sharing\x20mode\x20(Amount\x20/\x20Rate\x20‰\x20/\x20Surplus),\x20creates\x20a\x20Payment\x20(from_object\x20=\x20Allocation),\x20'+'then\x20emits\x20with\x20the\x20actually-distributed\x20amount.','side_effect':'Recipients\x20receive\x20CoinWrappers\x20referencing\x20the\x20new\x20Payment\x20—\x20they\x20must\x20unwrap\x20to\x20obtain\x20coins.\x20'+'The\x20Payment\x20is\x20also\x20pushed\x20onto\x20the\x20Allocation\x27s\x20payment\x20list.','params':[{'name':'object','shape':'address','meaning':'The\x20Allocation\x20object\x20that\x20distributed\x20the\x20funds'},{'name':'payment','shape':'address','meaning':'The\x20Payment\x20object\x20created\x20by\x20this\x20run\x20(the\x20on-chain\x20receipt)'},{'name':'guard','shape':'address','meaning':'The\x20guard\x20of\x20the\x20Allocator\x20that\x20authorized\x20this\x20distribution'},{'name':'amount','shape':'u64','meaning':'Amount\x20actually\x20distributed\x20(balance\x20before\x20−\x20balance\x20after)'}]},{'name':'TreasuryEvent','move_type':'::treasury::TreasuryEvent','module':'treasury','category':'fund_flow','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Treasury\x20fund-flow\x20record\x20(withdraw\x20/\x20deposit\x20/\x20receive)\x20—\x20mirrors\x20on-chain\x20history','trigger':'treasury.move\x20—\x203\x20sites:\x20withdraw_imp\x20(balance\x20split\x20out\x20as\x20Payment,\x20from_object\x20=\x20Treasury),\x20'+'deposit_imp_\x20(coins\x20joined\x20in,\x20a\x20Payment\x20receipt\x20is\x20minted\x20for\x20the\x20depositor),\x20receive_imp\x20'+'(a\x20CoinWrapper\x20from\x20a\x20Payment\x20is\x20received\x20into\x20the\x20treasury).\x20Each\x20emission\x20appends\x20a\x20Record\x20'+'to\x20the\x20treasury\x27s\x20on-chain\x20history\x20parent\x20table.','params':[{'name':'object','shape':'address','meaning':'The\x20Treasury\x20object'},{'name':'op','shape':'u8','meaning':'0\x20Withdraw\x20·\x201\x20Deposit\x20·\x202\x20Receive'},{'name':'payment','shape':'address','meaning':'The\x20Payment\x20receipt\x20minted\x20for\x20this\x20flow'},{'name':'amount','shape':'u64','meaning':'Flow\x20amount\x20(raw\x20on-chain\x20units\x20of\x20the\x20Treasury\x27s\x20token)'},{'name':'external_guard','shape':'Option<address>','meaning':'External\x20withdraw\x20guard\x20that\x20authorized\x20a\x20withdraw,\x20if\x20any'},{'name':'store_from_id','shape':'Option<address>','meaning':'Passport-derived\x20store/branch\x20id\x20(multi-branch\x20treasury\x20bookkeeping)'}]},{'name':'RewardClaimEvent','move_type':'::reward::RewardClaimEvent','module':'reward','category':'fund_flow','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Reward\x20claimed\x20—\x20funds\x20paid\x20out\x20of\x20a\x20Reward\x20pool','trigger':'reward.move\x20claim\x20path\x20—\x20after\x20guard+passport\x20validation:\x20appends\x20a\x20Record\x20to\x20the\x20recipient\x27s\x20'+'on-chain\x20record,\x20splits\x20the\x20balance,\x20emits,\x20then\x20transfers\x20the\x20coin\x20to\x20the\x20recipient.\x20'+'The\x20ONLY\x20realtime\x20trace\x20of\x20the\x20claim\x20outflow.','params':[{'name':'object','shape':'address','meaning':'The\x20Reward\x20pool\x20object'},{'name':'guard','shape':'address','meaning':'The\x20reward\x20guard\x20that\x20authorized\x20this\x20claim'},{'name':'recipient','shape':'address','meaning':'Claim\x20recipient\x20(resolved\x20via\x20passport\x20when\x20required)'},{'name':'amount','shape':'u64','meaning':'This\x20claim\x27s\x20amount'},{'name':'total','shape':'u64','meaning':'Recipient\x27s\x20cumulative\x20claimed\x20total\x20on\x20this\x20pool'},{'name':'balance_left','shape':'u64','meaning':'Pool\x20balance\x20remaining\x20after\x20the\x20claim'},{'name':'store_from_id','shape':'Option<address>','meaning':'Passport-derived\x20store/branch\x20id,\x20when\x20the\x20guard\x20requires\x20it'}]},{'name':'RewardFundEvent','move_type':'::reward::RewardFundEvent','module':'reward','category':'fund_flow','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Reward\x20pool\x20inflow\x20—\x20funds\x20added\x20to\x20the\x20pool','trigger':'reward.move\x20—\x202\x20sites:\x20coin_add_imp\x20(direct\x20coin\x20deposit,\x20from_payment\x20=\x20null)\x20and\x20receive_imp\x20'+'(a\x20Payment\x27s\x20CoinWrapper\x20received\x20into\x20the\x20pool,\x20from_payment\x20=\x20that\x20Payment).','side_effect':'Claim\x20guards\x20whose\x20pool\x20ran\x20dry\x20become\x20satisfiable\x20again;\x20watchers\x20should\x20re-check\x20claim\x20'+'opportunities\x20against\x20the\x20new\x20balance.','params':[{'name':'object','shape':'address','meaning':'The\x20Reward\x20pool\x20object'},{'name':'amount','shape':'u64','meaning':'Inflow\x20amount'},{'name':'balance','shape':'u64','meaning':'Pool\x20balance\x20after\x20the\x20inflow'},{'name':'from_payment','shape':'Option<address>','meaning':'The\x20Payment\x20that\x20funded\x20this\x20inflow\x20(null\x20for\x20direct\x20coin\x20adds)'}]},{'name':'NewPaymentEvent','move_type':'::payment::NewPaymentEvent','module':'payment','category':'fund_flow','consumers':['keeper','intent_radar'],'channel_note':'Deliberately\x20NOT\x20suggestion-bridged\x20(P2-4):\x20the\x20keeper\x20payment_unclaimed\x20state\x20scan\x20'+'owns\x20the\x20claimable-payment\x20reminder;\x20an\x20event\x20push\x20here\x20would\x20duplicate\x20it.','business_meaning':'A\x20Payment\x20was\x20created\x20—\x20the\x20universal\x20on-chain\x20receipt\x20of\x20WoWok\x20fund\x20flows','trigger':'payment.move\x20`create`\x20—\x20the\x20ONLY\x20emission\x20point,\x20reached\x20by\x20treasury\x20withdraw/deposit,\x20'+'allocation\x20runs,\x20service\x20compensation\x20payouts,\x20and\x20direct\x20user\x20payments\x20alike.\x20'+'Emission\x20is\x20the\x20last\x20step\x20before\x20the\x20Payment\x20object\x20is\x20frozen\x20(immutable\x20receipt).','side_effect':'Every\x20recipient\x20in\x20`record`\x20received\x20a\x20frozen\x20CoinWrapper\x20that\x20references\x20this\x20Payment\x20—\x20'+'unwrap\x20converts\x20it\x20to\x20a\x20transferable\x20Coin.\x20info.for_object\x20/\x20info.for_guard\x20/\x20from_object\x20'+'are\x20registered\x20as\x20object-linker\x20affiliations,\x20so\x20the\x20payment\x20is\x20discoverable\x20via\x20global\x20'+'affiliation\x20tables\x20(onchain_affiliations_of_object).','params':[{'name':'object','shape':'address','meaning':'The\x20Payment\x20object\x20id\x20(the\x20receipt)'},{'name':'info.for_object','shape':'Option<address>','meaning':'The\x20business\x20object\x20this\x20payment\x20is\x20FOR\x20(order/demand/reward/…)\x20—\x20user-settable\x20routing\x20hint'},{'name':'info.for_guard','shape':'Option<address>','meaning':'The\x20Guard\x20governing\x20this\x20payment\x20—\x20user-settable,\x20links\x20the\x20payment\x20to\x20a\x20trust\x20rule'},{'name':'info.remark','shape':'String','meaning':'Free-form\x20on-chain\x20remark\x20(e.g.\x20invoice\x20number,\x20purpose)'},{'name':'info.index','shape':'u64','meaning':'Creator-local\x20index\x20(installment\x20sequence,\x20table\x20row,\x20…)'},{'name':'record','shape':'vector<{recipient,\x20amount}>','meaning':'Revenue\x20legs:\x20one\x20{recipient,\x20amount}\x20per\x20CoinWrapper\x20transferred'},{'name':'amount','shape':'u64','meaning':'Total\x20paid\x20across\x20all\x20legs\x20(sum\x20of\x20record\x20amounts)'},{'name':'from_object','shape':'Option<address>','meaning':'FUNDING-SOURCE\x20object\x20the\x20funds\x20LEFT\x20from\x20—\x20INTERNAL-ONLY\x20field\x20(public(package)\x20'+'from_object_set;\x20user\x20code\x20can\x20never\x20set\x20it).\x20Treasury\x20withdraw\x20⇒\x20the\x20Treasury;\x20'+'Allocation\x20run\x20⇒\x20the\x20Allocation;\x20Service\x20compensation\x20withdraw\x20⇒\x20the\x20Service.\x20'+'create()\x20registers\x20an\x20object_linker\x20affiliation\x20(from_object\x20→\x20payment)\x20so\x20the\x20'+'outflow\x20is\x20traceable\x20back\x20to\x20its\x20pool.\x20Null\x20for\x20direct\x20user-initiated\x20payments\x20'+'(no\x20on-chain\x20source\x20object).'}]}];export const EVENT_BY_NAME=new Map(EVENT_SEMANTIC_REGISTRY['map'](a=>[a['name'],a]));export const EVENT_BY_MOVE_TYPE=new Map(EVENT_SEMANTIC_REGISTRY['map'](a=>[a['move_type'],a]));export function lookupEventMeaning(a){const b=String(a?.['type']??''),c=EVENT_BY_NAME['get'](b);if(c)return c['business_meaning'];const d=String(a?.['type_raw']??'');if(d)for(const f of EVENT_SEMANTIC_REGISTRY){if(d['includes'](f['move_type']))return f['business_meaning'];}return undefined;}
1
+ export const EVENT_SEMANTIC_REGISTRY=[{'name':'NewOrderEvent','move_type':'::order::NewOrderEvent','module':'order','category':'lifecycle','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'A\x20new\x20Order\x20was\x20placed\x20on\x20a\x20Service\x20(shared,\x20escrow-funded)','trigger':'order.move\x20`create`\x20—\x20the\x20ONLY\x20emission\x20point.\x20Fires\x20when\x20the\x20order\x20becomes\x20a\x20shared\x20object;\x20'+'validates:\x20machine\x20⇒\x20progress\x20bound;\x20amount\x20>\x200\x20⇒\x20allocation\x20bound.','side_effect':'Order\x20is\x20live:\x20buyer\x20funds\x20were\x20split\x20into\x20CoinWrappers\x20via\x20the\x20Service\x20Allocation;\x20'+'machine-governed\x20orders\x20can\x20now\x20be\x20advanced\x20by\x20operators.','params':[{'name':'object','shape':'address','meaning':'The\x20new\x20Order\x20object\x20id'},{'name':'service','shape':'address','meaning':'The\x20Service\x20the\x20order\x20was\x20placed\x20on'},{'name':'progress','shape':'Option<address>','meaning':'Bound\x20Progress\x20(machine\x20orders)\x20—\x20null\x20for\x20non-machine\x20orders'},{'name':'discount','shape':'Option<address>','meaning':'Discount\x20object\x20consumed\x20at\x20quote\x20time,\x20if\x20any'},{'name':'allocation','shape':'Option<address>','meaning':'Allocation\x20that\x20escrowed\x20the\x20payment\x20(required\x20when\x20amount\x20>\x200)'},{'name':'amount','shape':'u64','meaning':'Total\x20order\x20amount\x20in\x20the\x20Service\x27s\x20payment\x20token\x20(raw\x20on-chain\x20units)'}]},{'name':'ArbEvent','move_type':'::arb::ArbEvent','module':'arb','category':'state_change','consumers':['suggestion_bridge','problem_bridge','intent_radar'],'business_meaning':'Arbitration\x20status\x20transition\x20on\x20a\x20dispute\x20case\x20(open\x20/\x20voting\x20/\x20verdict\x20/\x20objection\x20/\x20finish\x20/\x20withdraw)','trigger':'arb.move\x20—\x20emitted\x20on\x20EVERY\x20status\x20transition:\x20create\x20(Arbitrator_confirming),\x20'+'proposition_change\x20/\x20principal\x20confirm\x20(Voting),\x20votes\x20closed\x20(Arbitrated),\x20objection\x20'+'(Objectionable),\x20finish\x20with\x20indemnity\x20(Finished\x20+\x20compensation),\x20withdraw\x20(Withdrawn).\x20'+'Helper\x20`emit_arb_event`\x20reads\x20the\x20POST-transition\x20state.','side_effect':'Parties\x20should\x20re-read\x20the\x20Arb\x20object\x20on\x20every\x20event;\x20status\x20decides\x20who\x20acts\x20next.\x20'+'When\x20indemnity_amount\x20is\x20set,\x20the\x20compensation\x20recipient\x20can\x20claim\x20after\x20compensation_time.','params':[{'name':'object','shape':'address','meaning':'The\x20Arb\x20(dispute\x20case)\x20object\x20id'},{'name':'arbitration','shape':'address','meaning':'The\x20governing\x20Arbitration\x20object\x20(voting\x20rules,\x20arbitrator\x20set)'},{'name':'order','shape':'address','meaning':'The\x20disputed\x20Order'},{'name':'status','shape':'u8','meaning':'0\x20Principal_confirming\x20·\x201\x20Arbitrator_confirming\x20·\x202\x20Voting\x20·\x203\x20Arbitrated\x20·\x204\x20Objectionable\x20·\x205\x20Finished\x20·\x206\x20Withdrawn'},{'name':'indemnity_amount','shape':'Option<u64>','meaning':'Awarded\x20compensation\x20(set\x20on\x20Arbitrated/Finished);\x20null\x20otherwise'},{'name':'compensation_time','shape':'Option<u64>','meaning':'Timestamp-ms\x20after\x20which\x20the\x20compensation\x20can\x20be\x20withdrawn\x20(locks\x20expire)'}]},{'name':'VoteEvent','move_type':'::arb::VoteEvent','module':'arb','category':'state_change','consumers':['intent_radar'],'channel_note':'Deliberately\x20radar-only:\x20per-vote\x20granularity\x20is\x20too\x20noisy\x20for\x20push;\x20the\x20ArbEvent\x20'+'Voting/Arbitrated\x20transitions\x20already\x20carry\x20the\x20push\x20signals\x20(P2-1).','business_meaning':'One\x20arbitration\x20vote\x20cast\x20(real-time\x20tally)','trigger':'arb.move\x20—\x20on\x20each\x20`vote`/`vote_with_passport`\x20call\x20(one\x20per\x20voter\x20per\x20round);\x20'+'lets\x20parties\x20track\x20the\x20tally\x20without\x20polling\x20the\x20Arb\x20object.','params':[{'name':'object','shape':'address','meaning':'The\x20Arb\x20object\x20being\x20voted\x20on'},{'name':'voter','shape':'address','meaning':'The\x20voting\x20arbitrator\x20(or\x20passport-proven\x20delegate)'},{'name':'agrees','shape':'vector<u8>','meaning':'Proposition\x20indexes\x20the\x20voter\x20agreed\x20to'},{'name':'weight','shape':'u32','meaning':'Vote\x20weight\x20applied\x20(guard-weighted\x20voting)'}]},{'name':'FeedbackEvent','move_type':'::arb::FeedbackEvent','module':'arb','category':'state_change','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'New\x20feedback\x20message\x20on\x20an\x20arbitration\x20case','trigger':'arb.move\x20—\x20on\x20`feedback`\x20(any\x20party\x20posts\x20a\x20message\x20into\x20the\x20case).','params':[{'name':'object','shape':'address','meaning':'The\x20Arb\x20object'},{'name':'feedback','shape':'String','meaning':'The\x20feedback\x20text'}]},{'name':'DemandPresentEvent','move_type':'::demand::PresentEvent','module':'demand','category':'market_opportunity','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'A\x20presenter\x20submitted/updated\x20a\x20solution\x20pitch\x20on\x20a\x20Demand','trigger':'demand.move\x20`present_imp`\x20—\x20first\x20present\x20inserts\x20a\x20presenter\x20row;\x20re-present\x20updates\x20it\x20'+'(recommend\x20text\x20+\x20optional\x20bound\x20Service).\x20Passport-gated\x20variants\x20resolve\x20the\x20Service\x20from\x20'+'the\x20passport\x20submission\x20when\x20the\x20demand\x27s\x20guard\x20sets\x20a\x20service_identifier.','side_effect':'Demand\x20owner\x20now\x20has\x20a\x20candidate;\x20track\x20update_time\x20to\x20rank\x20freshest\x20pitches.\x20'+'This\x20is\x20the\x20supply\x20side\x20of\x20the\x20demand\x20marketplace\x20(K3\x2013\x20§6.7).','params':[{'name':'object','shape':'address','meaning':'The\x20Demand\x20object'},{'name':'service','shape':'Option<address>','meaning':'The\x20presented\x20Service\x20(null\x20=\x20raw\x20recommendation\x20without\x20a\x20bound\x20service)'},{'name':'recommend','shape':'String','meaning':'The\x20presenter\x27s\x20pitch/recommendation\x20text'}]},{'name':'DemandFeedbackEvent','move_type':'::demand::DemandEvent','module':'demand','category':'reputation','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Demand\x20owner\x20scored/feedbacked\x20a\x20presenter\x20(acceptance\x20score)','trigger':'demand.move\x20`feedback_imp`\x20—\x20only\x20for\x20addresses\x20already\x20in\x20the\x20presenters\x20table;\x20'+'records\x20feedback\x20text\x20+\x20optional\x20acceptance\x20score\x20onto\x20the\x20presenter\x20row.','side_effect':'Acceptance\x20score\x20is\x20the\x20demand-side\x20quality\x20signal\x20for\x20the\x20presenter;\x20high\x20scores\x20build\x20'+'presenter\x20reputation\x20for\x20future\x20matching.','params':[{'name':'object','shape':'address','meaning':'The\x20Demand\x20object'},{'name':'service','shape':'Option<address>','meaning':'The\x20Service\x20that\x20was\x20presented\x20by\x20the\x20scored\x20presenter'},{'name':'feedback','shape':'String','meaning':'Feedback\x20text'},{'name':'acceptance_score','shape':'Option<u8>','meaning':'0-100\x20acceptance\x20score,\x20null\x20when\x20feedback\x20carries\x20no\x20score'}]},{'name':'DemandChangedEvent','move_type':'::demand::DemandChangedEvent','module':'demand','category':'market_opportunity','consumers':['intent_radar'],'channel_note':'Deliberately\x20radar-only:\x20merchant-side\x20discovery\x20is\x20pull-based\x20matching\x20semantics\x20'+'(K3\x2013\x20§6.7\x20opportunity\x20broadcast);\x20there\x20is\x20no\x20goal-bound\x20push\x20target\x20to\x20bridge\x20to.','business_meaning':'Demand\x20became/updated\x20a\x20profitable\x20opportunity\x20for\x20merchants\x20(market-opportunity\x20event)','trigger':'demand.move\x20`demand_changed_event_emit`\x20—\x20fires\x20when\x20rewards\x20are\x20bound/changed,\x20or\x20'+'description/location\x20changes\x20while\x20reward-bearing.\x20A\x20reward-less\x20demand\x20NEVER\x20emits\x20'+'(not\x20a\x20profitable\x20opportunity\x20—\x20K3\x2013\x20§6.7\x20principle).','side_effect':'PRIMARY\x20merchant-side\x20discovery\x20signal:\x20Intent\x20Radar\x20/\x20match\x20engines\x20should\x20treat\x20every\x20'+'emission\x20as\x20a\x20fresh\x20matchmaking\x20opportunity.\x20Reward\x20amounts/claim\x20rules\x20are\x20NOT\x20carried\x20—\x20'+'read\x20the\x20Reward\x20objects\x20by\x20id\x20(authoritative,\x20never\x20stale).','params':[{'name':'object','shape':'address','meaning':'The\x20Demand\x20object'},{'name':'location','shape':'String','meaning':'Demand\x20location\x20(industry/geography\x20routing\x20signal)'},{'name':'description','shape':'String','meaning':'Full\x20Demand\x20description\x20as\x20carried\x20on-chain\x20(input\x20creation\x20still\x20caps\x20at\x204000\x20UTF-8\x20chars)'},{'name':'rewards','shape':'vector<address>','meaning':'Bound\x20Reward\x20object\x20ids\x20—\x20resolve\x20amounts/conditions\x20by\x20query_objects'}]},{'name':'ProgressEvent','move_type':'::progress::ProgressEvent','module':'progress','category':'state_change','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Order/task\x20workflow\x20advanced,\x20held,\x20or\x20initialized\x20on\x20a\x20Machine\x20graph','trigger':'progress.move\x20—\x204\x20emission\x20points:\x20`new_imp`\x20(progress\x20created\x20at\x20init\x20node,\x20no\x20forward),\x20'+'`session_accomplish`\x20(threshold\x20reached\x20→\x20node\x20migrated),\x20`hold_imp`/`hold_imp_with_passport`\x20'+'(hold\x20or\x20un-hold\x20of\x20a\x20forward,\x20hold\x20field\x20carries\x20the\x20new\x20state).','side_effect':'Operators\x20should\x20check\x20the\x20new\x20node\x20name\x20against\x20their\x20Machine\x20duties;\x20hold=true\x20pauses\x20that\x20'+'forward\x27s\x20contribution,\x20hold=false\x20resumes\x20it.','params':[{'name':'object','shape':'address','meaning':'The\x20Progress\x20object'},{'name':'machine','shape':'address','meaning':'The\x20Machine\x20(workflow\x20template)\x20governing\x20this\x20progress'},{'name':'task','shape':'Option<address>','meaning':'The\x20bound\x20task\x20(usually\x20the\x20Order)\x20—\x20null\x20for\x20standalone\x20progress'},{'name':'node','shape':'String','meaning':'Node\x20reached\x20(init\x20node\x20on\x20creation;\x20next_node\x20on\x20migration/hold)'},{'name':'forward','shape':'Option<String>','meaning':'The\x20forward\x20name\x20that\x20triggered\x20the\x20transition\x20(null\x20on\x20creation)'},{'name':'hold','shape':'Option<bool>','meaning':'Present\x20only\x20on\x20hold/un-hold:\x20true\x20=\x20forward\x20held,\x20false\x20=\x20released'}]},{'name':'NewEntityEvent','move_type':'::registrar::NewEntityEvent','module':'registrar','category':'lifecycle','consumers':['intent_radar'],'channel_note':'Deliberately\x20radar-only:\x20ecosystem-entry\x20/\x20profile-update\x20signal\x20with\x20no\x20goal-bound\x20'+'push\x20target;\x20the\x20Intent\x20Radar\x20consumes\x20it\x20as\x20matching\x20context,\x20not\x20as\x20an\x20actionable\x20push.','business_meaning':'Entity\x20registered\x20or\x20re-announced\x20(new\x20counterparty\x20/\x20profile\x20update)','trigger':'registrar.move\x20—\x204\x20sites:\x20entity_register\x20/\x20entity_register_with_resource_forced\x20(new\x20Resource\x20'+'created),\x20entity_resource_use\x20(first\x20on-chain\x20use\x20of\x20a\x20resource),\x20entity_description_set,\x20'+'entity_info_add\x20(profile\x20updates\x20re-announce\x20the\x20entity).','side_effect':'A\x20new\x20potential\x20counterparty\x20entered\x20the\x20ecosystem,\x20or\x20an\x20existing\x20one\x20updated\x20its\x20public\x20'+'profile\x20—\x20refresh\x20cached\x20entity\x20profiles/records.','params':[{'name':'resource','shape':'address','meaning':'The\x20entity\x27s\x20Resource\x20object\x20(per-chain\x20identity\x20resource)'},{'name':'referrer','shape':'Option<address>','meaning':'Referring\x20entity\x20address,\x20when\x20registered\x20via\x20referral'}]},{'name':'ServiceEvent','move_type':'::service::ServiceEvent','module':'service','category':'market_opportunity','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Service\x20became/updated\x20a\x20purchasable\x20supply\x20(active-supply\x20event)','trigger':'service.move\x20`service_event_emit`\x20—\x20ONLY\x20when\x20bPublished\x20&&\x20!bPaused\x20at\x20the\x20mutation\x20point:\x20'+'publish,\x20unpause,\x20and\x20pre-publish\x20description\x20changes\x20re-notify.\x20Pausing\x20/\x20unpublishing\x20/\x20'+'draft-only\x20mutations\x20NEVER\x20emit\x20(not\x20a\x20participatable\x20opportunity\x20—\x20K3\x2013\x20§6.7).','side_effect':'PRIMARY\x20customer-side\x20discovery\x20signal:\x20every\x20emission\x20is\x20a\x20buyable\x20service\x20with\x20its\x20routing\x20'+'text.\x20The\x20authoritative\x20description/sales/stock\x20live\x20on\x20the\x20Service\x20object\x20by\x20id.','params':[{'name':'object','shape':'address','meaning':'The\x20Service\x20object'},{'name':'location','shape':'String','meaning':'Service\x20location\x20(industry/geography\x20routing\x20signal)'},{'name':'description','shape':'String','meaning':'Full\x20Service\x20description\x20as\x20carried\x20on-chain\x20(input\x20creation\x20still\x20caps\x20at\x204000\x20UTF-8\x20chars)'}]},{'name':'ArbitrationEvent','move_type':'::arbitration::ArbitrationEvent','module':'arbitration','category':'market_opportunity','consumers':['intent_radar'],'channel_note':'Deliberately\x20radar-only:\x20arbitrator\x20discovery\x20is\x20pull-based\x20matching\x20semantics\x20'+'(merchants\x20query\x20ArbitrationEvent\x20to\x20shortlist\x20third-party\x20arbiters),\x20no\x20goal-bound\x20'+'push\x20target\x20(mirrors\x20DemandChangedEvent).','business_meaning':'Arbitration\x20became\x20selectable/updated\x20a\x20third-party\x20dispute-resolution\x20offer\x20(active-arbiter\x20supply\x20event)','trigger':'arbitration.move\x20`arbitration_event_emit`\x20—\x20ONLY\x20when\x20bPaused\x20==\x20false\x20at\x20the\x20mutation\x20point:\x20'+'pause(false)\x20(unpause/listing),\x20and\x20description_set\x20/\x20location_set\x20/\x20fee_set\x20while\x20active.\x20'+'Pausing\x20or\x20pre-publish\x20mutations\x20NEVER\x20emit\x20(not\x20a\x20selectable\x20opportunity\x20—\x20K3\x2013\x20§6.7).','side_effect':'Merchant-side\x20discovery\x20signal:\x20every\x20emission\x20is\x20a\x20selectable\x20third-party\x20arbiter\x20with\x20its\x20'+'routing\x20text,\x20fee,\x20and\x20voting-guard\x20count.\x20The\x20authoritative\x20description/voting-guards\x20live\x20on\x20the\x20Arbitration\x20object\x20by\x20id.','params':[{'name':'object','shape':'address','meaning':'The\x20Arbitration\x20object\x20id'},{'name':'location','shape':'String','meaning':'Arbitration\x20location\x20(industry/geography\x20routing\x20signal)'},{'name':'description','shape':'String','meaning':'Full\x20Arbitration\x20description\x20as\x20carried\x20on-chain\x20(input\x20creation\x20still\x20caps\x20at\x204000\x20UTF-8\x20chars)'},{'name':'fee','shape':'u64','meaning':'Dispute\x20fee\x20charged\x20by\x20the\x20Arbitration\x20(raw\x20on-chain\x20units)'},{'name':'voting_guard_count','shape':'u64','meaning':'Number\x20of\x20voting\x20guards\x20(0\x20=\x20open\x20to\x20everybody;\x20>0\x20=\x20guarded/weighted)'}]},{'name':'AllocationEvent','move_type':'::allocation::AllocationEvent','module':'allocation','category':'fund_flow','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Allocation\x20run\x20completed\x20—\x20funds\x20left\x20the\x20Allocation\x20pool\x20as\x20a\x20Payment','trigger':'allocation.move\x20alloc\x20loop\x20—\x20when\x20a\x20matching\x20Allocator\x27s\x20guard\x20passes:\x20splits\x20the\x20balance\x20per\x20'+'sharing\x20mode\x20(Amount\x20/\x20Rate\x20‰\x20/\x20Surplus),\x20creates\x20a\x20Payment\x20(from_object\x20=\x20Allocation),\x20'+'then\x20emits\x20with\x20the\x20actually-distributed\x20amount.','side_effect':'Recipients\x20receive\x20CoinWrappers\x20referencing\x20the\x20new\x20Payment\x20—\x20they\x20must\x20unwrap\x20to\x20obtain\x20coins.\x20'+'The\x20Payment\x20is\x20also\x20pushed\x20onto\x20the\x20Allocation\x27s\x20payment\x20list.','params':[{'name':'object','shape':'address','meaning':'The\x20Allocation\x20object\x20that\x20distributed\x20the\x20funds'},{'name':'payment','shape':'address','meaning':'The\x20Payment\x20object\x20created\x20by\x20this\x20run\x20(the\x20on-chain\x20receipt)'},{'name':'guard','shape':'address','meaning':'The\x20guard\x20of\x20the\x20Allocator\x20that\x20authorized\x20this\x20distribution'},{'name':'amount','shape':'u64','meaning':'Amount\x20actually\x20distributed\x20(balance\x20before\x20−\x20balance\x20after)'}]},{'name':'TreasuryEvent','move_type':'::treasury::TreasuryEvent','module':'treasury','category':'fund_flow','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Treasury\x20fund-flow\x20record\x20(withdraw\x20/\x20deposit\x20/\x20receive)\x20—\x20mirrors\x20on-chain\x20history','trigger':'treasury.move\x20—\x203\x20sites:\x20withdraw_imp\x20(balance\x20split\x20out\x20as\x20Payment,\x20from_object\x20=\x20Treasury),\x20'+'deposit_imp_\x20(coins\x20joined\x20in,\x20a\x20Payment\x20receipt\x20is\x20minted\x20for\x20the\x20depositor),\x20receive_imp\x20'+'(a\x20CoinWrapper\x20from\x20a\x20Payment\x20is\x20received\x20into\x20the\x20treasury).\x20Each\x20emission\x20appends\x20a\x20Record\x20'+'to\x20the\x20treasury\x27s\x20on-chain\x20history\x20parent\x20table.','params':[{'name':'object','shape':'address','meaning':'The\x20Treasury\x20object'},{'name':'op','shape':'u8','meaning':'0\x20Withdraw\x20·\x201\x20Deposit\x20·\x202\x20Receive'},{'name':'payment','shape':'address','meaning':'The\x20Payment\x20receipt\x20minted\x20for\x20this\x20flow'},{'name':'amount','shape':'u64','meaning':'Flow\x20amount\x20(raw\x20on-chain\x20units\x20of\x20the\x20Treasury\x27s\x20token)'},{'name':'external_guard','shape':'Option<address>','meaning':'External\x20withdraw\x20guard\x20that\x20authorized\x20a\x20withdraw,\x20if\x20any'},{'name':'store_from_id','shape':'Option<address>','meaning':'Passport-derived\x20store/branch\x20id\x20(multi-branch\x20treasury\x20bookkeeping)'}]},{'name':'RewardClaimEvent','move_type':'::reward::RewardClaimEvent','module':'reward','category':'fund_flow','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Reward\x20claimed\x20—\x20funds\x20paid\x20out\x20of\x20a\x20Reward\x20pool','trigger':'reward.move\x20claim\x20path\x20—\x20after\x20guard+passport\x20validation:\x20appends\x20a\x20Record\x20to\x20the\x20recipient\x27s\x20'+'on-chain\x20record,\x20splits\x20the\x20balance,\x20emits,\x20then\x20transfers\x20the\x20coin\x20to\x20the\x20recipient.\x20'+'The\x20ONLY\x20realtime\x20trace\x20of\x20the\x20claim\x20outflow.','params':[{'name':'object','shape':'address','meaning':'The\x20Reward\x20pool\x20object'},{'name':'guard','shape':'address','meaning':'The\x20reward\x20guard\x20that\x20authorized\x20this\x20claim'},{'name':'recipient','shape':'address','meaning':'Claim\x20recipient\x20(resolved\x20via\x20passport\x20when\x20required)'},{'name':'amount','shape':'u64','meaning':'This\x20claim\x27s\x20amount'},{'name':'total','shape':'u64','meaning':'Recipient\x27s\x20cumulative\x20claimed\x20total\x20on\x20this\x20pool'},{'name':'balance_left','shape':'u64','meaning':'Pool\x20balance\x20remaining\x20after\x20the\x20claim'},{'name':'store_from_id','shape':'Option<address>','meaning':'Passport-derived\x20store/branch\x20id,\x20when\x20the\x20guard\x20requires\x20it'}]},{'name':'RewardFundEvent','move_type':'::reward::RewardFundEvent','module':'reward','category':'fund_flow','consumers':['suggestion_bridge','intent_radar'],'business_meaning':'Reward\x20pool\x20inflow\x20—\x20funds\x20added\x20to\x20the\x20pool','trigger':'reward.move\x20—\x202\x20sites:\x20coin_add_imp\x20(direct\x20coin\x20deposit,\x20from_payment\x20=\x20null)\x20and\x20receive_imp\x20'+'(a\x20Payment\x27s\x20CoinWrapper\x20received\x20into\x20the\x20pool,\x20from_payment\x20=\x20that\x20Payment).','side_effect':'Claim\x20guards\x20whose\x20pool\x20ran\x20dry\x20become\x20satisfiable\x20again;\x20watchers\x20should\x20re-check\x20claim\x20'+'opportunities\x20against\x20the\x20new\x20balance.','params':[{'name':'object','shape':'address','meaning':'The\x20Reward\x20pool\x20object'},{'name':'amount','shape':'u64','meaning':'Inflow\x20amount'},{'name':'balance','shape':'u64','meaning':'Pool\x20balance\x20after\x20the\x20inflow'},{'name':'from_payment','shape':'Option<address>','meaning':'The\x20Payment\x20that\x20funded\x20this\x20inflow\x20(null\x20for\x20direct\x20coin\x20adds)'}]},{'name':'NewPaymentEvent','move_type':'::payment::NewPaymentEvent','module':'payment','category':'fund_flow','consumers':['keeper','intent_radar'],'channel_note':'Deliberately\x20NOT\x20suggestion-bridged\x20(P2-4):\x20the\x20keeper\x20payment_unclaimed\x20state\x20scan\x20'+'owns\x20the\x20claimable-payment\x20reminder;\x20an\x20event\x20push\x20here\x20would\x20duplicate\x20it.','business_meaning':'A\x20Payment\x20was\x20created\x20—\x20the\x20universal\x20on-chain\x20receipt\x20of\x20WoWok\x20fund\x20flows','trigger':'payment.move\x20`create`\x20—\x20the\x20ONLY\x20emission\x20point,\x20reached\x20by\x20treasury\x20withdraw/deposit,\x20'+'allocation\x20runs,\x20service\x20compensation\x20payouts,\x20and\x20direct\x20user\x20payments\x20alike.\x20'+'Emission\x20is\x20the\x20last\x20step\x20before\x20the\x20Payment\x20object\x20is\x20frozen\x20(immutable\x20receipt).','side_effect':'Every\x20recipient\x20in\x20`record`\x20received\x20a\x20frozen\x20CoinWrapper\x20that\x20references\x20this\x20Payment\x20—\x20'+'unwrap\x20converts\x20it\x20to\x20a\x20transferable\x20Coin.\x20info.for_object\x20/\x20info.for_guard\x20/\x20from_object\x20'+'are\x20registered\x20as\x20object-linker\x20affiliations,\x20so\x20the\x20payment\x20is\x20discoverable\x20via\x20global\x20'+'affiliation\x20tables\x20(onchain_affiliations_of_object).','params':[{'name':'object','shape':'address','meaning':'The\x20Payment\x20object\x20id\x20(the\x20receipt)'},{'name':'info.for_object','shape':'Option<address>','meaning':'The\x20business\x20object\x20this\x20payment\x20is\x20FOR\x20(order/demand/reward/…)\x20—\x20user-settable\x20routing\x20hint'},{'name':'info.for_guard','shape':'Option<address>','meaning':'The\x20Guard\x20governing\x20this\x20payment\x20—\x20user-settable,\x20links\x20the\x20payment\x20to\x20a\x20trust\x20rule'},{'name':'info.remark','shape':'String','meaning':'Free-form\x20on-chain\x20remark\x20(e.g.\x20invoice\x20number,\x20purpose)'},{'name':'info.index','shape':'u64','meaning':'Creator-local\x20index\x20(installment\x20sequence,\x20table\x20row,\x20…)'},{'name':'record','shape':'vector<{recipient,\x20amount}>','meaning':'Revenue\x20legs:\x20one\x20{recipient,\x20amount}\x20per\x20CoinWrapper\x20transferred'},{'name':'amount','shape':'u64','meaning':'Total\x20paid\x20across\x20all\x20legs\x20(sum\x20of\x20record\x20amounts)'},{'name':'from_object','shape':'Option<address>','meaning':'FUNDING-SOURCE\x20object\x20the\x20funds\x20LEFT\x20from\x20—\x20INTERNAL-ONLY\x20field\x20(public(package)\x20'+'from_object_set;\x20user\x20code\x20can\x20never\x20set\x20it).\x20Treasury\x20withdraw\x20⇒\x20the\x20Treasury;\x20'+'Allocation\x20run\x20⇒\x20the\x20Allocation;\x20Service\x20compensation\x20withdraw\x20⇒\x20the\x20Service.\x20'+'create()\x20registers\x20an\x20object_linker\x20affiliation\x20(from_object\x20→\x20payment)\x20so\x20the\x20'+'outflow\x20is\x20traceable\x20back\x20to\x20its\x20pool.\x20Null\x20for\x20direct\x20user-initiated\x20payments\x20'+'(no\x20on-chain\x20source\x20object).'}]}];export const EVENT_BY_NAME=new Map(EVENT_SEMANTIC_REGISTRY['map'](a=>[a['name'],a]));export const EVENT_BY_MOVE_TYPE=new Map(EVENT_SEMANTIC_REGISTRY['map'](a=>[a['move_type'],a]));export function lookupEventMeaning(a){const b=String(a?.['type']??''),c=EVENT_BY_NAME['get'](b);if(c)return c['business_meaning'];const d=String(a?.['type_raw']??'');if(d)for(const f of EVENT_SEMANTIC_REGISTRY){if(d['includes'](f['move_type']))return f['business_meaning'];}return undefined;}
@@ -1 +1 @@
1
- import{MAX_SUBMISSION_SIZE_PASSPORT}from'@wowok/wowok';export function checkPuzzleCompleteness(a){const b={'intent':isIntentComplete(a['intent']),'binding':isBindingComplete(a['binding']),'data_sources':isDataSourcesComplete(a['data_sources']),'query':isQueryComplete(a['queries']),'logic':isLogicComplete(a['logic']),'constraints':isConstraintsComplete(a['constraints'])},c=Object['keys'](b)['filter'](g=>!b[g]),d=[];!b['intent']&&d['push']('A.\x20Intent:\x20protected\x20action,\x20validation\x20rule,\x20or\x20failure\x20conditions\x20not\x20clarified');!b['binding']&&d['push']('B.\x20Binding:\x20Host\x20Object,\x20binding\x20field,\x20or\x20circular\x20reference\x20mode\x20not\x20determined');!b['data_sources']&&d['push']('C.\x20Data\x20sources:\x20data\x20sources\x20not\x20declared\x20by\x204\x20classifications\x20(on-chain\x20constant\x20/\x20witness-derived\x20/\x20submitted\x20object\x20/\x20system\x20context)');!b['query']&&d['push']('D.\x20Query:\x20query\x20instruction\x20not\x20determined\x20(if\x20the\x20Guard\x20needs\x20to\x20query\x20on-chain\x20data)');!b['logic']&&d['push']('E.\x20Logic:\x20computation\x20tree\x20root\x20or\x20rely\x20composition\x20not\x20designed');!b['constraints']&&d['push']('F.\x20Constraints:\x20creation-time\x2010\x20+\x20runtime\x206\x20constraint\x20checks\x20not\x20completed');const e=c['length']===0x0,f=recommendNextStep(a,c);return{'dimensions':b,'missing':c,'missing_details':d,'complete':e,'next_step':f};}function isIntentComplete(a){return!!a&&!!a['action']&&!!a['rule_sentence']&&a['failure_conditions']['length']>0x0;}function isBindingComplete(a){return!!a&&!!a['host_object']&&!!a['binding_field'];}function isDataSourcesComplete(a){if(!a)return![];const b=a['on_chain_constants']['length']>0x0,c=a['witness_derived']['length']>0x0,d=a['submitted_objects']['length']>0x0,e=a['submitted_values']['length']>0x0,f=a['system_contexts']['length']>0x0;if(!b&&!c&&!d&&!e&&!f)return![];const g=a['submitted_objects']['some'](h=>!h['binding_constraint']);if(g)return![];return!![];}function isQueryComplete(a){return!![];}function isLogicComplete(a){return!!a&&!!a['root']&&a['root']['return_type']==='Bool';}function isConstraintsComplete(a){if(!a)return![];return Object['values'](a)['every'](b=>b===!![]);}function recommendNextStep(a,b){if(b['includes']('intent'))return{'round':'R1','action':'Capture\x20validation\x20intent','questions':['What\x20action\x20do\x20you\x20want\x20to\x20protect?\x20(buy/forward/claim/vote/dispute/write/allocate)','Describe\x20the\x20validation\x20rule\x20in\x20one\x20sentence','List\x20the\x20conditions\x20under\x20which\x20the\x20Guard\x20should\x20FAIL']};if(b['includes']('binding'))return{'round':'R5','action':'Determine\x20binding\x20target','questions':['Which\x20Host\x20Object\x20will\x20the\x20Guard\x20bind\x20to?\x20(Service/Machine/Arbitration/Reward/Repository)','Which\x20field\x20will\x20it\x20bind\x20to?\x20(buy_guard/order_allocators/Forward.guard/...)','Does\x20the\x20Guard\x20need\x20to\x20reference\x20the\x20Host\x20Object?\x20(circular\x20reference\x20mode)']};if(b['includes']('data_sources'))return{'round':'R2','action':'Declare\x20data\x20sources\x20by\x204\x20classifications','questions':['Type1\x20(on-chain\x20constant):\x20Which\x20already-published\x20on-chain\x20objects\x20does\x20the\x20Guard\x20need\x20to\x20query?\x20(Service/Machine/Reward\x20addresses)','Type2\x20(witness-derived):\x20Do\x20you\x20need\x20to\x20derive\x20Progress/Machine/Service\x20from\x20Order/Arb?\x20(choose\x20witness\x20100-108)','Type3\x20(submitted\x20object):\x20Which\x20object\x20addresses\x20does\x20the\x20caller\x20need\x20to\x20submit?\x20(Order/Reward/Progress)\x20—\x20constraint\x20rules\x20must\x20be\x20designed','Type3\x20(submitted\x20value):\x20Which\x20scalar\x20values\x20does\x20the\x20caller\x20need\x20to\x20submit?\x20(amount/weight/node\x20name)','Type4\x20(system\x20context):\x20Do\x20you\x20need\x20Signer\x20(identity)\x20/\x20Clock\x20(time)\x20/\x20Guard\x20(self-reference)?','Do\x20you\x20need\x20to\x20query\x20EntityRegistrar(0xaab)\x20or\x20EntityLinker(0xaaa)?']};if(b['includes']('query'))return{'round':'R3','action':'Design\x20query\x20nodes','questions':['Which\x20on-chain\x20objects\x20does\x20the\x20Guard\x20need\x20to\x20query?','Which\x20instruction\x20ID\x20does\x20each\x20query\x20use?\x20(look\x20up\x20from\x20GUARDQUERY)','Do\x20you\x20need\x20convert_witness\x20to\x20convert\x20objects?\x20(linked\x20to\x20Type2\x20declaration)']};if(b['includes']('logic'))return{'round':'R3','action':'Design\x20computation\x20tree','questions':['What\x20is\x20the\x20root\x20node?\x20(must\x20return\x20Bool)','Which\x20data\x20source\x20nodes\x20are\x20there?\x20(by\x204\x20classifications:\x20identifier/context/query)','Which\x20intermediate\x20conversion\x20nodes\x20are\x20there?\x20(calc_*/convert_*/vec_*)','Do\x20you\x20need\x20rely\x20to\x20compose\x20with\x20other\x20Guards?']};if(b['includes']('constraints'))return{'round':'R6','action':'Pre-creation\x20review','questions':['Run\x20the\x20creation-time\x2010\x20+\x20runtime\x206\x20constraint\x20checklist']};return{'round':'R7','action':'Prepare\x20for\x20on-chain\x20creation','questions':['All\x20dimensions\x20are\x20complete;\x20ready\x20to\x20generate\x20the\x20semantic\x20confirmation\x20text']};}export function generateConfirmationText(a){if(!a['intent']||!a['binding']||!a['data_sources']||!a['logic'])return'[Puzzle\x20incomplete]\x20Cannot\x20generate\x20confirmation\x20text;\x20please\x20complete\x20all\x20dimensions\x20first';const b=[];b['push']('═══════════════════════════════════════════════════════'),b['push']('\x20\x20Guard\x20Semantic\x20Confirmation\x20Report\x20(User\x20Review\x20Edition)'),b['push']('═══════════════════════════════════════════════════════'),b['push'](''),b['push']('[Intent]'),b['push']('Protected\x20action:\x20'+a['intent']['action']),b['push']('Validation\x20rule:\x20'+a['intent']['rule_sentence']),b['push']('Failure\x20conditions:'),a['intent']['failure_conditions']['forEach']((d,e)=>{b['push']('\x20\x20'+(e+0x1)+'.\x20'+d);}),b['push'](''),b['push']('[Binding]'),b['push']('Host\x20Object:\x20'+a['binding']['host_object']);a['binding']['host_object_name']&&b['push']('Host\x20Object\x20name:\x20'+a['binding']['host_object_name']);b['push']('Binding\x20field:\x20'+a['binding']['binding_field']),b['push']('Circular\x20reference:\x20'+(a['binding']['circular_reference']?'Yes\x20(Guard\x20references\x20Host\x20Object)':'No')),b['push']('Host\x20Object\x20state:\x20'+a['binding']['host_object_state']),b['push'](''),b['push']('[Data\x20sources\x20(4\x20classifications)]'),printDataSources(b,a['data_sources']),b['push']('');a['queries']&&a['queries']['length']>0x0&&(b['push']('[Query\x20instructions]'),b['push']('┌──────┬──────────────────────────┬────────────┬──────────┬──────────┐'),b['push']('│\x20ID\x20\x20\x20│\x20Query\x20instruction\x20\x20\x20\x20\x20\x20\x20\x20│\x20Target\x20obj\x20│\x20Params\x20\x20\x20│\x20Return\x20\x20\x20│'),b['push']('├──────┼──────────────────────────┼────────────┼──────────┼──────────┤'),a['queries']['forEach'](d=>{const e=String(d['query_id'])['padEnd'](0x4),f=d['query_name']['length']>0x18?d['query_name']['slice'](0x0,0x17)+'…':d['query_name']['padEnd'](0x18),g=d['object_type']['padEnd'](0xa),h=(d['parameters']['length']===0x0?'(none)':d['parameters']['join'](','))['padEnd'](0x8),i=d['return_type']['padEnd'](0x8);b['push']('│\x20'+e+'\x20│\x20'+f+'\x20│\x20'+g+'\x20│\x20'+h+'\x20│\x20'+i+'\x20│');}),b['push']('└──────┴──────────────────────────┴────────────┴──────────┴──────────┘'),b['push'](''));b['push']('[Computation\x20tree]'),b['push']('root:\x20'+a['logic']['root']['node_type']+'\x20(returns:\x20'+a['logic']['root']['return_type']+')'),b['push']('\x20\x20'+a['logic']['root']['description']);a['logic']['root']['children']&&printLogicTree(b,a['logic']['root']['children'],0x1);b['push']('');a['logic']['rely']&&(b['push']('[rely\x20composition]'),b['push']('Dependent\x20Guards:\x20'+a['logic']['rely']['guards']['join'](',\x20')),b['push']('Logic:\x20'+(a['logic']['rely']['logic_or']?'OR\x20(any\x20passes)':'AND\x20(all\x20must\x20pass)')),b['push']('rep\x20verification:\x20'+(a['logic']['rely']['rep_verified']['every'](d=>d)?'all\x20passed':'some\x20unverified')),b['push'](''));if(a['constraints']){b['push']('[Constraint\x20checklist\x20(creation-time\x2022\x20+\x20runtime\x2011\x20=\x2033;\x20MCP\x20layer\x20static\x20check\x2016)]');const d=[['01','All\x20identifiers\x20exist\x20in\x20the\x20table',a['constraints']['pitfall_01_identifiers_in_table']],['02','Comparison\x20node\x20types\x20are\x20compatible',a['constraints']['pitfall_02_type_compatibility']],['03','Query\x20instruction\x20ID\x20and\x20parameter\x20count\x20are\x20correct',a['constraints']['pitfall_03_query_instruction_valid']],['04','convert_witness\x20type\x20is\x20correct',a['constraints']['pitfall_04_witness_correct']],['05','Time-lock\x20tests\x20use\x20small\x20values',a['constraints']['pitfall_05_time_lock_test_safe']],['06','Old\x20Guard\x20exported\x20before\x20iteration',a['constraints']['pitfall_06_exported_before_recreate']],['07','root\x20returns\x20Bool',a['constraints']['pitfall_07_root_returns_bool']],['08','rely\x20dependency\x20rep=true',a['constraints']['pitfall_08_rely_rep_true']],['09','voting_guard\x20GuardIdentifier\x20numeric',a['constraints']['pitfall_09_voting_weight_numeric']],['10','Arbitration\x20not\x20paused',a['constraints']['pitfall_10_arbitration_not_paused']]],e=[['R1','Guard\x20immutable=true\x20to\x20verify',a['constraints']['runtime_01_guard_immutable']],['R2','submission\x20type\x20bytes\x20match\x20table\x20declaration',a['constraints']['runtime_02_submission_type_match']],['R3','b_submission=true\x20entry\x20found\x20in\x20submission',a['constraints']['runtime_03_submission_complete']],['R4','submission\x20total\x20bytes\x20≤\x20'+MAX_SUBMISSION_SIZE_PASSPORT,a['constraints']['runtime_04_submission_size']],['R5','witness\x20derivation\x20source\x20object\x20has\x20related\x20field',a['constraints']['runtime_05_witness_source_valid']],['R6','query\x20target\x20object\x20exists\x20and\x20types\x20match',a['constraints']['runtime_06_query_object_valid']]];b['push']('\x20\x20Creation-time\x20constraints:'),d['forEach'](([f,g,h])=>{b['push']('\x20\x20'+(h?'✓':'✗')+'\x20['+f+']\x20'+g);}),b['push']('\x20\x20Runtime\x20constraints:'),e['forEach'](([f,g,h])=>{b['push']('\x20\x20'+(h?'✓':'✗')+'\x20['+f+']\x20'+g);}),b['push']('');}b['push']('[Risk\x20warnings]'),b['push']('\x20\x20⚠\x20Guard\x20cannot\x20be\x20modified\x20or\x20deleted\x20after\x20creation\x20(CREATE-only)'),b['push']('\x20\x20⚠\x20On-chain\x20execution\x20will\x20consume\x20gas'),b['push']('\x20\x20⚠\x20To\x20modify\x20after\x20creation:\x20export\x20→\x20edit\x20→\x20create\x20new\x20→\x20rebind'),b['push'](''),b['push']('[Test\x20plan\x20(gen_passport\x20static\x20test)]'),b['push']('\x20\x20Expected\x20pass\x20scenario:\x20submit\x20data\x20meeting\x20conditions\x20→\x20PASS\x20→\x20Passport\x20generated'),b['push']('\x20\x20Expected\x20fail\x20scenario:\x20submit\x20data\x20not\x20meeting\x20conditions\x20→\x20FAIL\x20→\x20verify\x20logic\x20direction'),b['push'](''),b['push']('[Post-creation\x20actions\x20(important)]'),b['push']('\x20\x201.\x20Use\x20guard2file\x20to\x20export\x20the\x20Guard\x20backup\x20(JSON\x20file)\x20for\x20later\x20rebuild\x20or\x20migration'),b['push']('\x20\x202.\x20Record\x20the\x20Guard\x20object\x20ID\x20for\x20subsequent\x20binding\x20and\x20invocation'),b['push']('\x20\x203.\x20If\x20the\x20Guard\x20binds\x20to\x20a\x20Host\x20Object,\x20ensure\x20the\x20Host\x20Object\x20is\x20published\x20after\x20Guard\x20creation'),b['push']('\x20\x204.\x20Verify\x20the\x20Guard\x20logic\x20direction\x20via\x20gen_passport\x20static\x20test'),b['push']('');const c=creationChecksForReadiness(a);return b['push']('[Creation\x20readiness\x20signal]'),b['push']('\x20\x20Puzzle\x20completeness:\x20'+(c?'✓\x20All\x20passed\x20—\x20ready\x20for\x20on-chain\x20CREATE':'✗\x20Some\x20items\x20not\x20passed\x20—\x20please\x20fix\x20first')),b['push'](''),b['push']('═══════════════════════════════════════════════════════'),b['push']('\x20\x20Please\x20review\x20the\x20Guard\x20semantic\x20confirmation\x20report\x20above'),b['push']('\x20\x20After\x20confirming\x20no\x20issues,\x20reply\x20\x22confirm\x20creation\x22\x20to\x20execute\x20on-chain\x20CREATE'),b['push']('\x20\x20If\x20modifications\x20are\x20needed,\x20please\x20point\x20out\x20the\x20parts\x20to\x20adjust'),b['push']('═══════════════════════════════════════════════════════'),b['join']('\x0a');}function creationChecksForReadiness(a){if(!a['intent']||!a['binding']||!a['data_sources']||!a['logic']||!a['constraints'])return![];const b=a['constraints'],d=b['pitfall_01_identifiers_in_table']&&b['pitfall_02_type_compatibility']&&b['pitfall_03_query_instruction_valid']&&b['pitfall_04_witness_correct']&&b['pitfall_05_time_lock_test_safe']&&b['pitfall_06_exported_before_recreate']&&b['pitfall_07_root_returns_bool']&&b['pitfall_08_rely_rep_true']&&b['pitfall_09_voting_weight_numeric']&&b['pitfall_10_arbitration_not_paused'],e=b['runtime_01_guard_immutable']&&b['runtime_02_submission_type_match']&&b['runtime_03_submission_complete']&&b['runtime_04_submission_size']&&b['runtime_05_witness_source_valid']&&b['runtime_06_query_object_valid'];return d&&e;}function printDataSources(a,b){b['on_chain_constants']['length']>0x0&&(a['push']('\x20\x20Type1\x20—\x20On-chain\x20constant\x20objects\x20(OnChainConstant,\x20b_submission=false):'),b['on_chain_constants']['forEach'](c=>{const d=c['is_system_address']?'\x20[system\x20address]':'';a['push']('\x20\x20\x20\x20[id='+c['identifier']+']\x20'+c['object_type']+'('+c['object_address']+')'+d+'\x20—\x20'+c['name']);})),b['witness_derived']['length']>0x0&&(a['push']('\x20\x20Type2\x20—\x20Witness-derived\x20objects\x20(WitnessDerived,\x20convert_witness\x20100-108):'),b['witness_derived']['forEach'](c=>{const d=c['source_b_submission']?'submitted':'constant';a['push']('\x20\x20\x20\x20[id='+c['identifier']+']\x20'+c['source_type']+'('+d+')\x20→\x20'+c['target_type']+'\x20via\x20'+c['witness_name']+'('+c['witness_type']+')\x20—\x20'+c['name']);})),b['submitted_objects']['length']>0x0&&(a['push']('\x20\x20Type3\x20—\x20Submitted\x20objects\x20(SubmittedObject,\x20b_submission=true):'),b['submitted_objects']['forEach'](c=>{a['push']('\x20\x20\x20\x20[id='+c['identifier']+']\x20'+c['expected_object_type']+'('+c['value_type']+')\x20—\x20'+c['name']),c['binding_constraint']&&a['push']('\x20\x20\x20\x20\x20\x20Constraint:\x20'+c['binding_constraint']);})),b['submitted_values']['length']>0x0&&(a['push']('\x20\x20Type3\x20—\x20Submitted\x20values\x20(SubmittedValue,\x20b_submission=true,\x20scalar):'),b['submitted_values']['forEach'](c=>{a['push']('\x20\x20\x20\x20[id='+c['identifier']+']\x20'+c['value_type']+'\x20—\x20'+c['name']),c['binding_constraint']&&a['push']('\x20\x20\x20\x20\x20\x20Constraint:\x20'+c['binding_constraint']);})),b['system_contexts']['length']>0x0&&(a['push']('\x20\x20Type4\x20—\x20System\x20contexts\x20(SystemContext,\x20not\x20in\x20table):'),b['system_contexts']['forEach'](c=>{a['push']('\x20\x20\x20\x20context('+c['context_type']+')\x20—\x20'+c['usage']);})),b['on_chain_constants']['length']===0x0&&b['witness_derived']['length']===0x0&&b['submitted_objects']['length']===0x0&&b['submitted_values']['length']===0x0&&b['system_contexts']['length']===0x0&&a['push']('\x20\x20(No\x20data\x20sources\x20declared)');}function printLogicTree(a,b,c){const d='\x20\x20'['repeat'](c+0x1);b['forEach']((e,f)=>{const g=f===b['length']-0x1?'└──\x20':'├──\x20';a['push'](''+d+g+e['node_type']+'\x20('+e['return_type']+')\x20—\x20'+e['description']),e['references_identifier']!==undefined&&a['push'](d+'\x20\x20\x20\x20→\x20table['+e['references_identifier']+']'),e['query']&&a['push'](d+'\x20\x20\x20\x20→\x20query('+e['query']['query_id']+':\x20'+e['query']['query_name']+')'),e['children']&&printLogicTree(a,e['children'],c+0x1);});}export function initPuzzleFromIntent(a){return{'current_round':'R1','intent':{'action':a['action']??'custom','rule_sentence':a['rule_sentence']??'','failure_conditions':a['failure_conditions']??[]}};}export function inferBindingFromAction(a){const b={'buy':{'host_object':'Service','binding_field':'buy_guard'},'forward':{'host_object':'Machine','binding_field':'Forward.guard'},'allocate':{'host_object':'Service','binding_field':'order_allocators'},'claim_reward':{'host_object':'Reward','binding_field':'guard'},'vote':{'host_object':'Arbitration','binding_field':'voting_guard'},'dispute':{'host_object':'Arbitration','binding_field':'usage_guard'},'write_repository':{'host_object':'Repository','binding_field':'write_guard'},'submit_progress':{'host_object':'Progress','binding_field':'submission'},'gen_passport':{'host_object':'Standalone','binding_field':'none'},'custom':{}};return b[a]??{};}export function emptyDataSources(){return{'on_chain_constants':[],'witness_derived':[],'submitted_objects':[],'submitted_values':[],'system_contexts':[]};}export const WITNESS_NAME_MAP={0x64:{'name':'TypeOrderProgress','source':'Order','target':'Progress'},0x65:{'name':'TypeOrderMachine','source':'Order','target':'Machine'},0x66:{'name':'TypeOrderService','source':'Order','target':'Service'},0x67:{'name':'TypeProgressMachine','source':'Progress','target':'Machine'},0x68:{'name':'TypeArbOrder','source':'Arb','target':'Order'},0x69:{'name':'TypeArbArbitration','source':'Arb','target':'Arbitration'},0x6a:{'name':'TypeArbProgress','source':'Arb','target':'Progress'},0x6b:{'name':'TypeArbMachine','source':'Arb','target':'Machine'},0x6c:{'name':'TypeArbService','source':'Arb','target':'Service'}};export function getWitnessInfo(a){return WITNESS_NAME_MAP[a];}function traverseRoot(a,b){if(!a)return;a['type']==='identifier'&&typeof a['identifier']==='number'&&b['referencedIdentifiers']['add'](a['identifier']);a['type']==='context'&&a['context']&&b['contexts']['add'](a['context']);if(a['type']==='query'&&a['object']){const c=a['object']['identifier'];b['referencedIdentifiers']['add'](c);const d=a['object']['convert_witness'];typeof d==='number'&&d>=0x64&&d<=0x6c&&b['witnessCodes']['push']({'code':d,'objectIdentifier':c});b['queries']['push']({'query':a['query']??'','objectIdentifier':c,'convertWitness':d,'parametersCount':a['parameters']?.['length']??0x0});if(a['parameters'])for(const e of a['parameters']){traverseRoot(e,b);}}if(a['nodes'])for(const f of a['nodes']){traverseRoot(f,b);}a['node']&&traverseRoot(a['node'],b),a['nodeLeft']&&traverseRoot(a['nodeLeft'],b),a['nodeRight']&&traverseRoot(a['nodeRight'],b);}function buildLogicTree(a){if(!a)return undefined;const b={'node_type':a['type'],'return_type':inferNodeType(a['type']),'description':describeNode(a)};a['type']==='identifier'&&typeof a['identifier']==='number'&&(b['references_identifier']=a['identifier']);if(a['type']==='query'&&a['object']){b['query']={'query_id':typeof a['query']==='number'?a['query']:0x0,'query_name':typeof a['query']==='string'?a['query']:String(a['query']??''),'object_type':'','parameters':[],'return_type':'','purpose':''};if(a['object']['convert_witness']){const c=getWitnessInfo(a['object']['convert_witness']);c&&(b['query']['witness']={'witness_type':a['object']['convert_witness'],'witness_name':c['name'],'source_type':c['source'],'target_type':c['target'],'scenario':''});}}if(a['nodes']){const d=a['nodes']['map'](e=>buildLogicTree(e))['filter'](e=>e!==undefined);d['length']>0x0&&(b['children']=d);}if(a['node']){const e=buildLogicTree(a['node']);e&&(b['children']=[e]);}if(a['nodeLeft']){const f=buildLogicTree(a['nodeLeft']);f&&(b['children']=[...b['children']??[],f]);}if(a['nodeRight']){const g=buildLogicTree(a['nodeRight']);g&&(b['children']=[...b['children']??[],g]);}return b;}function inferNodeType(a){const b=['logic_equal','logic_not','logic_and','logic_or','logic_as_u256_greater','logic_as_u256_lesser','logic_as_u256_equal','logic_as_u256_greater_or_equal','logic_as_u256_lesser_or_equal','logic_string_contains','logic_string_nocase_contains','logic_string_nocase_equal','calc_string_contains','calc_string_nocase_contains','calc_string_nocase_equal','vec_contains_bool','vec_contains_address','vec_contains_string','vec_contains_string_nocase','vec_contains_number','query_reward_record_exists'];if(b['includes'](a))return'Bool';const c=['calc_number_add','calc_number_subtract','calc_number_multiply','calc_number_divide','calc_number_mod','convert_address_number','convert_string_number'];if(c['includes'](a))return'U256';const d=['calc_string_length','calc_string_indexof','calc_string_nocase_indexof','vec_length','vec_indexof_bool','vec_indexof_address','vec_indexof_string','vec_indexof_string_nocase','vec_indexof_number','query_reward_record_count','query_progress_history_session_count','query_progress_history_session_forward_count','query_progress_history_session_forward_retained_submission_count'];if(d['includes'](a))return'U64';const e=['convert_number_address'];if(e['includes'](a))return'Address';const f=['convert_number_string'];if(f['includes'](a))return'String';const g=['convert_safe_u8','convert_safe_u16','convert_safe_u32','convert_safe_u64','convert_safe_u128','convert_safe_u256'];if(g['includes'](a))return a['replace']('convert_safe_','U');if(a==='value_type')return'U8';if(a==='query')return'query_defined';if(a==='identifier')return'table_defined';if(a==='context')return'context_defined';return'unknown';}function describeNode(a){switch(a['type']){case'identifier':return'Reference\x20to\x20table['+(a['identifier']??'?')+']';case'context':return'System\x20context:\x20'+(a['context']??'?');case'query':return'Query\x20instruction\x20'+(a['query']??'?')+'\x20(target:\x20table['+(a['object']?.['identifier']??'?')+'])';case'logic_equal':return'Equality\x20comparison\x20(==)';case'logic_not':return'Logical\x20NOT\x20(!)';case'logic_and':return'Logical\x20AND';case'logic_or':return'Logical\x20OR';case'logic_as_u256_greater':return'Numeric\x20greater\x20than\x20(>)';case'logic_as_u256_lesser':return'Numeric\x20less\x20than\x20(<)';case'logic_as_u256_equal':return'Numeric\x20equality\x20(==)';case'logic_as_u256_greater_or_equal':return'Numeric\x20greater\x20than\x20or\x20equal\x20(>=)';case'logic_as_u256_lesser_or_equal':return'Numeric\x20less\x20than\x20or\x20equal\x20(<=)';case'calc_number_add':return'Numeric\x20addition\x20(+)';case'calc_number_subtract':return'Numeric\x20subtraction\x20(-)';case'calc_number_multiply':return'Numeric\x20multiplication\x20(*)';case'calc_number_divide':return'Numeric\x20division\x20(/)';case'calc_number_mod':return'Numeric\x20modulo\x20(%)';case'vec_contains_address':return'Whitelist\x20check\x20(vec_contains_address)';case'vec_length':return'Vector\x20length';case'convert_safe_u64':return'Safe\x20conversion\x20to\x20U64';default:return a['type'];}}function deriveConstraints(a,b,c,d){const e=Array['from'](d['referencedIdentifiers'])['every'](v=>a['some'](w=>w['identifier']===v)),f=b!==undefined,g=!![],h=d['witnessCodes']['every'](v=>v['code']>=0x64&&v['code']<=0x6c),i=!![],j=!![],k=b!==undefined,l=c?c['guards']['length']<=0x4:!![],m=!![],n=!![],o=!![],p=!![],q=!![],r=a['filter'](v=>v['b_submission']),s=r['length']<=MAX_SUBMISSION_SIZE_PASSPORT,t=!![],u=!![];return{'pitfall_01_identifiers_in_table':e,'pitfall_02_type_compatibility':f,'pitfall_03_query_instruction_valid':g,'pitfall_04_witness_correct':h,'pitfall_05_time_lock_test_safe':i,'pitfall_06_exported_before_recreate':j,'pitfall_07_root_returns_bool':k,'pitfall_08_rely_rep_true':l,'pitfall_09_voting_weight_numeric':m,'pitfall_10_arbitration_not_paused':n,'runtime_01_guard_immutable':o,'runtime_02_submission_type_match':p,'runtime_03_submission_complete':q,'runtime_04_submission_size':s,'runtime_05_witness_source_valid':t,'runtime_06_query_object_valid':u};}export function derivePuzzleFromCallData(a){const b=a['table']??[],c=a['root'],d=a['rely'],e=a['binding_hint'],f={'referencedIdentifiers':new Set(),'queries':[],'contexts':new Set(),'witnessCodes':[]};c&&traverseRoot(c,f);let g;e&&(g={'action':e['action'],'rule_sentence':e['rule_sentence']??'','failure_conditions':e['failure_conditions']??[]});let h;e&&(h={'host_object':e['host_object'],'binding_field':e['binding_field'],'circular_reference':e['circular_reference']??![],'host_object_state':'unknown'});const i=new Map();for(const t of f['witnessCodes']){i['set'](t['objectIdentifier'],t['code']);}const j=[],k=[],l=[],m=[];for(const u of b){const v=f['referencedIdentifiers']['has'](u['identifier']),x=i['get'](u['identifier']);if(x!==undefined){const y=getWitnessInfo(x);if(y){k['push']({'identifier':u['identifier'],'source_type':y['source'],'witness_type':x,'witness_name':y['name'],'target_type':y['target'],'source_b_submission':u['b_submission'],'name':u['name']||y['source']+'→'+y['target']+'\x20via\x20'+y['name']});continue;}}if(!u['b_submission']){const z=typeof u['value']==='string'?u['value']['toLowerCase']():'',A=z==='0xaab'||z==='0xaaa';j['push']({'identifier':u['identifier'],'object_address':typeof u['value']==='string'?u['value']:String(u['value']??''),'object_type':u['object_type']??'','name':u['name']||'constant\x20#'+u['identifier'],'is_system_address':A});}else{const B=typeof u['value_type']==='string'?u['value_type']['toLowerCase']():String(u['value_type']);B==='address'?l['push']({'identifier':u['identifier'],'expected_object_type':u['object_type']??'','value_type':'Address','name':u['name']||'submitted\x20object\x20#'+u['identifier'],'binding_constraint':u['object_type']?'must\x20be\x20an\x20on-chain\x20object\x20address\x20of\x20type\x20'+u['object_type']:'must\x20be\x20a\x20valid\x20on-chain\x20object\x20address'}):m['push']({'identifier':u['identifier'],'value_type':typeof u['value_type']==='string'?u['value_type']:String(u['value_type']),'name':u['name']||'submitted\x20value\x20#'+u['identifier'],'binding_constraint':'value\x20type\x20must\x20be\x20'+u['value_type']});}}const n=[];for(const C of f['contexts']){const D={'Signer':'Current\x20transaction\x20signer\x20address\x20verification','Clock':'On-chain\x20timestamp\x20(used\x20for\x20time-lock/time-window)','Guard':'Guard\x20self\x20object\x20ID\x20self-reference'};n['push']({'context_type':C,'usage':D[C]??''});}const o={'on_chain_constants':j,'witness_derived':k,'submitted_objects':l,'submitted_values':m,'system_contexts':n},p=f['queries']['map'](E=>{const F=E['convertWitness']!==undefined?getWitnessInfo(E['convertWitness']):undefined;return{'query_id':typeof E['query']==='number'?E['query']:0x0,'query_name':typeof E['query']==='string'?E['query']:String(E['query']),'object_type':'','parameters':[],'return_type':'','witness':F?{'witness_type':E['convertWitness'],'witness_name':F['name'],'source_type':F['source'],'target_type':F['target'],'scenario':''}:undefined,'purpose':''};});let q;if(c){const E=buildLogicTree(c);if(E){E['return_type']='Bool';let F;d&&d['guards']['length']>0x0&&(F={'guards':d['guards'],'logic_or':d['logic_or']??![],'rep_verified':d['guards']['map'](()=>!![])}),q={'root':E,'rely':F};}}const r=deriveConstraints(b,c,d,f),s={'current_round':'R7','intent':g,'binding':h,'data_sources':o,'queries':p,'logic':q,'constraints':r};return s;}export function getPuzzleStatusBooleans(a){const b=checkPuzzleCompleteness(a);return{'intent':b['dimensions']['intent'],'binding':b['dimensions']['binding'],'data':b['dimensions']['data_sources'],'query':b['dimensions']['query'],'logic':b['dimensions']['logic'],'constraints':b['dimensions']['constraints']};}export function getPendingQuestions(a){const b=checkPuzzleCompleteness(a);if(b['complete'])return[];return b['next_step']['questions'];}
1
+ import{MAX_SUBMISSION_SIZE_PASSPORT,WOW_SYSTEM_SINGLETONS}from'@wowok/wowok';export function checkPuzzleCompleteness(a){const b={'intent':isIntentComplete(a['intent']),'binding':isBindingComplete(a['binding']),'data_sources':isDataSourcesComplete(a['data_sources']),'query':isQueryComplete(a['queries']),'logic':isLogicComplete(a['logic']),'constraints':isConstraintsComplete(a['constraints'])},c=Object['keys'](b)['filter'](g=>!b[g]),d=[];!b['intent']&&d['push']('A.\x20Intent:\x20protected\x20action,\x20validation\x20rule,\x20or\x20failure\x20conditions\x20not\x20clarified');!b['binding']&&d['push']('B.\x20Binding:\x20Host\x20Object,\x20binding\x20field,\x20or\x20circular\x20reference\x20mode\x20not\x20determined');!b['data_sources']&&d['push']('C.\x20Data\x20sources:\x20data\x20sources\x20not\x20declared\x20by\x204\x20classifications\x20(on-chain\x20constant\x20/\x20witness-derived\x20/\x20submitted\x20object\x20/\x20system\x20context)');!b['query']&&d['push']('D.\x20Query:\x20query\x20instruction\x20not\x20determined\x20(if\x20the\x20Guard\x20needs\x20to\x20query\x20on-chain\x20data)');!b['logic']&&d['push']('E.\x20Logic:\x20computation\x20tree\x20root\x20or\x20rely\x20composition\x20not\x20designed');!b['constraints']&&d['push']('F.\x20Constraints:\x20creation-time\x2010\x20+\x20runtime\x206\x20constraint\x20checks\x20not\x20completed');const e=c['length']===0x0,f=recommendNextStep(a,c);return{'dimensions':b,'missing':c,'missing_details':d,'complete':e,'next_step':f};}function isIntentComplete(a){return!!a&&!!a['action']&&!!a['rule_sentence']&&a['failure_conditions']['length']>0x0;}function isBindingComplete(a){return!!a&&!!a['host_object']&&!!a['binding_field'];}function isDataSourcesComplete(a){if(!a)return![];const b=a['on_chain_constants']['length']>0x0,c=a['witness_derived']['length']>0x0,d=a['submitted_objects']['length']>0x0,e=a['submitted_values']['length']>0x0,f=a['system_contexts']['length']>0x0;if(!b&&!c&&!d&&!e&&!f)return![];const g=a['submitted_objects']['some'](h=>!h['binding_constraint']);if(g)return![];return!![];}function isQueryComplete(a){return!![];}function isLogicComplete(a){return!!a&&!!a['root']&&a['root']['return_type']==='Bool';}function isConstraintsComplete(a){if(!a)return![];return Object['values'](a)['every'](b=>b===!![]);}function recommendNextStep(a,b){if(b['includes']('intent'))return{'round':'R1','action':'Capture\x20validation\x20intent','questions':['What\x20action\x20do\x20you\x20want\x20to\x20protect?\x20(buy/forward/claim/vote/dispute/write/allocate)','Describe\x20the\x20validation\x20rule\x20in\x20one\x20sentence','List\x20the\x20conditions\x20under\x20which\x20the\x20Guard\x20should\x20FAIL']};if(b['includes']('binding'))return{'round':'R5','action':'Determine\x20binding\x20target','questions':['Which\x20Host\x20Object\x20will\x20the\x20Guard\x20bind\x20to?\x20(Service/Machine/Arbitration/Reward/Repository)','Which\x20field\x20will\x20it\x20bind\x20to?\x20(buy_guard/order_allocators/Forward.guard/...)','Does\x20the\x20Guard\x20need\x20to\x20reference\x20the\x20Host\x20Object?\x20(circular\x20reference\x20mode)']};if(b['includes']('data_sources'))return{'round':'R2','action':'Declare\x20data\x20sources\x20by\x204\x20classifications','questions':['Type1\x20(on-chain\x20constant):\x20Which\x20already-published\x20on-chain\x20objects\x20does\x20the\x20Guard\x20need\x20to\x20query?\x20(Service/Machine/Reward\x20addresses)','Type2\x20(witness-derived):\x20Do\x20you\x20need\x20to\x20derive\x20Progress/Machine/Service\x20from\x20Order/Arb?\x20(choose\x20witness\x20100-108)','Type3\x20(submitted\x20object):\x20Which\x20object\x20addresses\x20does\x20the\x20caller\x20need\x20to\x20submit?\x20(Order/Reward/Progress)\x20—\x20constraint\x20rules\x20must\x20be\x20designed','Type3\x20(submitted\x20value):\x20Which\x20scalar\x20values\x20does\x20the\x20caller\x20need\x20to\x20submit?\x20(amount/weight/node\x20name)','Type4\x20(system\x20context):\x20Do\x20you\x20need\x20Signer\x20(identity)\x20/\x20Clock\x20(time)\x20/\x20Guard\x20(self-reference)?','Do\x20you\x20need\x20to\x20query\x20EntityRegistrar(0xaab)\x20or\x20EntityLinker(0xaaa)?']};if(b['includes']('query'))return{'round':'R3','action':'Design\x20query\x20nodes','questions':['Which\x20on-chain\x20objects\x20does\x20the\x20Guard\x20need\x20to\x20query?','Which\x20instruction\x20ID\x20does\x20each\x20query\x20use?\x20(look\x20up\x20from\x20GUARDQUERY)','Do\x20you\x20need\x20convert_witness\x20to\x20convert\x20objects?\x20(linked\x20to\x20Type2\x20declaration)']};if(b['includes']('logic'))return{'round':'R3','action':'Design\x20computation\x20tree','questions':['What\x20is\x20the\x20root\x20node?\x20(must\x20return\x20Bool)','Which\x20data\x20source\x20nodes\x20are\x20there?\x20(by\x204\x20classifications:\x20identifier/context/query)','Which\x20intermediate\x20conversion\x20nodes\x20are\x20there?\x20(calc_*/convert_*/vec_*)','Do\x20you\x20need\x20rely\x20to\x20compose\x20with\x20other\x20Guards?']};if(b['includes']('constraints'))return{'round':'R6','action':'Pre-creation\x20review','questions':['Run\x20the\x20creation-time\x2010\x20+\x20runtime\x206\x20constraint\x20checklist']};return{'round':'R7','action':'Prepare\x20for\x20on-chain\x20creation','questions':['All\x20dimensions\x20are\x20complete;\x20ready\x20to\x20generate\x20the\x20semantic\x20confirmation\x20text']};}export function generateConfirmationText(a){if(!a['intent']||!a['binding']||!a['data_sources']||!a['logic'])return'[Puzzle\x20incomplete]\x20Cannot\x20generate\x20confirmation\x20text;\x20please\x20complete\x20all\x20dimensions\x20first';const b=[];b['push']('═══════════════════════════════════════════════════════'),b['push']('\x20\x20Guard\x20Semantic\x20Confirmation\x20Report\x20(User\x20Review\x20Edition)'),b['push']('═══════════════════════════════════════════════════════'),b['push'](''),b['push']('[Intent]'),b['push']('Protected\x20action:\x20'+a['intent']['action']),b['push']('Validation\x20rule:\x20'+a['intent']['rule_sentence']),b['push']('Failure\x20conditions:'),a['intent']['failure_conditions']['forEach']((d,e)=>{b['push']('\x20\x20'+(e+0x1)+'.\x20'+d);}),b['push'](''),b['push']('[Binding]'),b['push']('Host\x20Object:\x20'+a['binding']['host_object']);a['binding']['host_object_name']&&b['push']('Host\x20Object\x20name:\x20'+a['binding']['host_object_name']);b['push']('Binding\x20field:\x20'+a['binding']['binding_field']),b['push']('Circular\x20reference:\x20'+(a['binding']['circular_reference']?'Yes\x20(Guard\x20references\x20Host\x20Object)':'No')),b['push']('Host\x20Object\x20state:\x20'+a['binding']['host_object_state']),b['push'](''),b['push']('[Data\x20sources\x20(4\x20classifications)]'),printDataSources(b,a['data_sources']),b['push']('');a['queries']&&a['queries']['length']>0x0&&(b['push']('[Query\x20instructions]'),b['push']('┌──────┬──────────────────────────┬────────────┬──────────┬──────────┐'),b['push']('│\x20ID\x20\x20\x20│\x20Query\x20instruction\x20\x20\x20\x20\x20\x20\x20\x20│\x20Target\x20obj\x20│\x20Params\x20\x20\x20│\x20Return\x20\x20\x20│'),b['push']('├──────┼──────────────────────────┼────────────┼──────────┼──────────┤'),a['queries']['forEach'](d=>{const e=String(d['query_id'])['padEnd'](0x4),f=d['query_name']['length']>0x18?d['query_name']['slice'](0x0,0x17)+'…':d['query_name']['padEnd'](0x18),g=d['object_type']['padEnd'](0xa),h=(d['parameters']['length']===0x0?'(none)':d['parameters']['join'](','))['padEnd'](0x8),i=d['return_type']['padEnd'](0x8);b['push']('│\x20'+e+'\x20│\x20'+f+'\x20│\x20'+g+'\x20│\x20'+h+'\x20│\x20'+i+'\x20│');}),b['push']('└──────┴──────────────────────────┴────────────┴──────────┴──────────┘'),b['push'](''));b['push']('[Computation\x20tree]'),b['push']('root:\x20'+a['logic']['root']['node_type']+'\x20(returns:\x20'+a['logic']['root']['return_type']+')'),b['push']('\x20\x20'+a['logic']['root']['description']);a['logic']['root']['children']&&printLogicTree(b,a['logic']['root']['children'],0x1);b['push']('');a['logic']['rely']&&(b['push']('[rely\x20composition]'),b['push']('Dependent\x20Guards:\x20'+a['logic']['rely']['guards']['join'](',\x20')),b['push']('Logic:\x20'+(a['logic']['rely']['logic_or']?'OR\x20(any\x20passes)':'AND\x20(all\x20must\x20pass)')),b['push']('rep\x20verification:\x20'+(a['logic']['rely']['rep_verified']['every'](d=>d)?'all\x20passed':'some\x20unverified')),b['push'](''));if(a['constraints']){b['push']('[Constraint\x20checklist\x20(creation-time\x2022\x20+\x20runtime\x2011\x20=\x2033;\x20MCP\x20layer\x20static\x20check\x2016)]');const d=[['01','All\x20identifiers\x20exist\x20in\x20the\x20table',a['constraints']['pitfall_01_identifiers_in_table']],['02','Comparison\x20node\x20types\x20are\x20compatible',a['constraints']['pitfall_02_type_compatibility']],['03','Query\x20instruction\x20ID\x20and\x20parameter\x20count\x20are\x20correct',a['constraints']['pitfall_03_query_instruction_valid']],['04','convert_witness\x20type\x20is\x20correct',a['constraints']['pitfall_04_witness_correct']],['05','Time-lock\x20tests\x20use\x20small\x20values',a['constraints']['pitfall_05_time_lock_test_safe']],['06','Old\x20Guard\x20exported\x20before\x20iteration',a['constraints']['pitfall_06_exported_before_recreate']],['07','root\x20returns\x20Bool',a['constraints']['pitfall_07_root_returns_bool']],['08','rely\x20dependency\x20rep=true',a['constraints']['pitfall_08_rely_rep_true']],['09','voting_guard\x20GuardIdentifier\x20numeric',a['constraints']['pitfall_09_voting_weight_numeric']],['10','Arbitration\x20not\x20paused',a['constraints']['pitfall_10_arbitration_not_paused']]],e=[['R1','Guard\x20immutable=true\x20to\x20verify',a['constraints']['runtime_01_guard_immutable']],['R2','submission\x20type\x20bytes\x20match\x20table\x20declaration',a['constraints']['runtime_02_submission_type_match']],['R3','b_submission=true\x20entry\x20found\x20in\x20submission',a['constraints']['runtime_03_submission_complete']],['R4','submission\x20total\x20bytes\x20≤\x20'+MAX_SUBMISSION_SIZE_PASSPORT,a['constraints']['runtime_04_submission_size']],['R5','witness\x20derivation\x20source\x20object\x20has\x20related\x20field',a['constraints']['runtime_05_witness_source_valid']],['R6','query\x20target\x20object\x20exists\x20and\x20types\x20match',a['constraints']['runtime_06_query_object_valid']]];b['push']('\x20\x20Creation-time\x20constraints:'),d['forEach'](([f,g,h])=>{b['push']('\x20\x20'+(h?'✓':'✗')+'\x20['+f+']\x20'+g);}),b['push']('\x20\x20Runtime\x20constraints:'),e['forEach'](([f,g,h])=>{b['push']('\x20\x20'+(h?'✓':'✗')+'\x20['+f+']\x20'+g);}),b['push']('');}b['push']('[Risk\x20warnings]'),b['push']('\x20\x20⚠\x20Guard\x20cannot\x20be\x20modified\x20or\x20deleted\x20after\x20creation\x20(CREATE-only)'),b['push']('\x20\x20⚠\x20On-chain\x20execution\x20will\x20consume\x20gas'),b['push']('\x20\x20⚠\x20To\x20modify\x20after\x20creation:\x20export\x20→\x20edit\x20→\x20create\x20new\x20→\x20rebind'),b['push'](''),b['push']('[Test\x20plan\x20(gen_passport\x20static\x20test)]'),b['push']('\x20\x20Expected\x20pass\x20scenario:\x20submit\x20data\x20meeting\x20conditions\x20→\x20PASS\x20→\x20Passport\x20generated'),b['push']('\x20\x20Expected\x20fail\x20scenario:\x20submit\x20data\x20not\x20meeting\x20conditions\x20→\x20FAIL\x20→\x20verify\x20logic\x20direction'),b['push'](''),b['push']('[Post-creation\x20actions\x20(important)]'),b['push']('\x20\x201.\x20Use\x20guard2file\x20to\x20export\x20the\x20Guard\x20backup\x20(JSON\x20file)\x20for\x20later\x20rebuild\x20or\x20migration'),b['push']('\x20\x202.\x20Record\x20the\x20Guard\x20object\x20ID\x20for\x20subsequent\x20binding\x20and\x20invocation'),b['push']('\x20\x203.\x20If\x20the\x20Guard\x20binds\x20to\x20a\x20Host\x20Object,\x20ensure\x20the\x20Host\x20Object\x20is\x20published\x20after\x20Guard\x20creation'),b['push']('\x20\x204.\x20Verify\x20the\x20Guard\x20logic\x20direction\x20via\x20gen_passport\x20static\x20test'),b['push']('');const c=creationChecksForReadiness(a);return b['push']('[Creation\x20readiness\x20signal]'),b['push']('\x20\x20Puzzle\x20completeness:\x20'+(c?'✓\x20All\x20passed\x20—\x20ready\x20for\x20on-chain\x20CREATE':'✗\x20Some\x20items\x20not\x20passed\x20—\x20please\x20fix\x20first')),b['push'](''),b['push']('═══════════════════════════════════════════════════════'),b['push']('\x20\x20Please\x20review\x20the\x20Guard\x20semantic\x20confirmation\x20report\x20above'),b['push']('\x20\x20After\x20confirming\x20no\x20issues,\x20reply\x20\x22confirm\x20creation\x22\x20to\x20execute\x20on-chain\x20CREATE'),b['push']('\x20\x20If\x20modifications\x20are\x20needed,\x20please\x20point\x20out\x20the\x20parts\x20to\x20adjust'),b['push']('═══════════════════════════════════════════════════════'),b['join']('\x0a');}function creationChecksForReadiness(a){if(!a['intent']||!a['binding']||!a['data_sources']||!a['logic']||!a['constraints'])return![];const b=a['constraints'],d=b['pitfall_01_identifiers_in_table']&&b['pitfall_02_type_compatibility']&&b['pitfall_03_query_instruction_valid']&&b['pitfall_04_witness_correct']&&b['pitfall_05_time_lock_test_safe']&&b['pitfall_06_exported_before_recreate']&&b['pitfall_07_root_returns_bool']&&b['pitfall_08_rely_rep_true']&&b['pitfall_09_voting_weight_numeric']&&b['pitfall_10_arbitration_not_paused'],e=b['runtime_01_guard_immutable']&&b['runtime_02_submission_type_match']&&b['runtime_03_submission_complete']&&b['runtime_04_submission_size']&&b['runtime_05_witness_source_valid']&&b['runtime_06_query_object_valid'];return d&&e;}function printDataSources(a,b){b['on_chain_constants']['length']>0x0&&(a['push']('\x20\x20Type1\x20—\x20On-chain\x20constant\x20objects\x20(OnChainConstant,\x20b_submission=false):'),b['on_chain_constants']['forEach'](c=>{const d=c['is_system_address']?'\x20[system\x20address]':'';a['push']('\x20\x20\x20\x20[id='+c['identifier']+']\x20'+c['object_type']+'('+c['object_address']+')'+d+'\x20—\x20'+c['name']);})),b['witness_derived']['length']>0x0&&(a['push']('\x20\x20Type2\x20—\x20Witness-derived\x20objects\x20(WitnessDerived,\x20convert_witness\x20100-108):'),b['witness_derived']['forEach'](c=>{const d=c['source_b_submission']?'submitted':'constant';a['push']('\x20\x20\x20\x20[id='+c['identifier']+']\x20'+c['source_type']+'('+d+')\x20→\x20'+c['target_type']+'\x20via\x20'+c['witness_name']+'('+c['witness_type']+')\x20—\x20'+c['name']);})),b['submitted_objects']['length']>0x0&&(a['push']('\x20\x20Type3\x20—\x20Submitted\x20objects\x20(SubmittedObject,\x20b_submission=true):'),b['submitted_objects']['forEach'](c=>{a['push']('\x20\x20\x20\x20[id='+c['identifier']+']\x20'+c['expected_object_type']+'('+c['value_type']+')\x20—\x20'+c['name']),c['binding_constraint']&&a['push']('\x20\x20\x20\x20\x20\x20Constraint:\x20'+c['binding_constraint']);})),b['submitted_values']['length']>0x0&&(a['push']('\x20\x20Type3\x20—\x20Submitted\x20values\x20(SubmittedValue,\x20b_submission=true,\x20scalar):'),b['submitted_values']['forEach'](c=>{a['push']('\x20\x20\x20\x20[id='+c['identifier']+']\x20'+c['value_type']+'\x20—\x20'+c['name']),c['binding_constraint']&&a['push']('\x20\x20\x20\x20\x20\x20Constraint:\x20'+c['binding_constraint']);})),b['system_contexts']['length']>0x0&&(a['push']('\x20\x20Type4\x20—\x20System\x20contexts\x20(SystemContext,\x20not\x20in\x20table):'),b['system_contexts']['forEach'](c=>{a['push']('\x20\x20\x20\x20context('+c['context_type']+')\x20—\x20'+c['usage']);})),b['on_chain_constants']['length']===0x0&&b['witness_derived']['length']===0x0&&b['submitted_objects']['length']===0x0&&b['submitted_values']['length']===0x0&&b['system_contexts']['length']===0x0&&a['push']('\x20\x20(No\x20data\x20sources\x20declared)');}function printLogicTree(a,b,c){const d='\x20\x20'['repeat'](c+0x1);b['forEach']((e,f)=>{const g=f===b['length']-0x1?'└──\x20':'├──\x20';a['push'](''+d+g+e['node_type']+'\x20('+e['return_type']+')\x20—\x20'+e['description']),e['references_identifier']!==undefined&&a['push'](d+'\x20\x20\x20\x20→\x20table['+e['references_identifier']+']'),e['query']&&a['push'](d+'\x20\x20\x20\x20→\x20query('+e['query']['query_id']+':\x20'+e['query']['query_name']+')'),e['children']&&printLogicTree(a,e['children'],c+0x1);});}export function initPuzzleFromIntent(a){return{'current_round':'R1','intent':{'action':a['action']??'custom','rule_sentence':a['rule_sentence']??'','failure_conditions':a['failure_conditions']??[]}};}export function inferBindingFromAction(a){const b={'buy':{'host_object':'Service','binding_field':'buy_guard'},'forward':{'host_object':'Machine','binding_field':'Forward.guard'},'allocate':{'host_object':'Service','binding_field':'order_allocators'},'claim_reward':{'host_object':'Reward','binding_field':'guard'},'vote':{'host_object':'Arbitration','binding_field':'voting_guard'},'dispute':{'host_object':'Arbitration','binding_field':'usage_guard'},'write_repository':{'host_object':'Repository','binding_field':'write_guard'},'submit_progress':{'host_object':'Progress','binding_field':'submission'},'gen_passport':{'host_object':'Standalone','binding_field':'none'},'custom':{}};return b[a]??{};}export function emptyDataSources(){return{'on_chain_constants':[],'witness_derived':[],'submitted_objects':[],'submitted_values':[],'system_contexts':[]};}export const WITNESS_NAME_MAP={0x64:{'name':'TypeOrderProgress','source':'Order','target':'Progress'},0x65:{'name':'TypeOrderMachine','source':'Order','target':'Machine'},0x66:{'name':'TypeOrderService','source':'Order','target':'Service'},0x67:{'name':'TypeProgressMachine','source':'Progress','target':'Machine'},0x68:{'name':'TypeArbOrder','source':'Arb','target':'Order'},0x69:{'name':'TypeArbArbitration','source':'Arb','target':'Arbitration'},0x6a:{'name':'TypeArbProgress','source':'Arb','target':'Progress'},0x6b:{'name':'TypeArbMachine','source':'Arb','target':'Machine'},0x6c:{'name':'TypeArbService','source':'Arb','target':'Service'}};export function getWitnessInfo(a){return WITNESS_NAME_MAP[a];}function traverseRoot(a,b){if(!a)return;a['type']==='identifier'&&typeof a['identifier']==='number'&&b['referencedIdentifiers']['add'](a['identifier']);a['type']==='context'&&a['context']&&b['contexts']['add'](a['context']);if(a['type']==='query'&&a['object']){const c=a['object']['identifier'];b['referencedIdentifiers']['add'](c);const d=a['object']['convert_witness'];typeof d==='number'&&d>=0x64&&d<=0x6c&&b['witnessCodes']['push']({'code':d,'objectIdentifier':c});b['queries']['push']({'query':a['query']??'','objectIdentifier':c,'convertWitness':d,'parametersCount':a['parameters']?.['length']??0x0});if(a['parameters'])for(const e of a['parameters']){traverseRoot(e,b);}}if(a['nodes'])for(const f of a['nodes']){traverseRoot(f,b);}a['node']&&traverseRoot(a['node'],b),a['nodeLeft']&&traverseRoot(a['nodeLeft'],b),a['nodeRight']&&traverseRoot(a['nodeRight'],b);}function buildLogicTree(a){if(!a)return undefined;const b={'node_type':a['type'],'return_type':inferNodeType(a['type']),'description':describeNode(a)};a['type']==='identifier'&&typeof a['identifier']==='number'&&(b['references_identifier']=a['identifier']);if(a['type']==='query'&&a['object']){b['query']={'query_id':typeof a['query']==='number'?a['query']:0x0,'query_name':typeof a['query']==='string'?a['query']:String(a['query']??''),'object_type':'','parameters':[],'return_type':'','purpose':''};if(a['object']['convert_witness']){const c=getWitnessInfo(a['object']['convert_witness']);c&&(b['query']['witness']={'witness_type':a['object']['convert_witness'],'witness_name':c['name'],'source_type':c['source'],'target_type':c['target'],'scenario':''});}}if(a['nodes']){const d=a['nodes']['map'](e=>buildLogicTree(e))['filter'](e=>e!==undefined);d['length']>0x0&&(b['children']=d);}if(a['node']){const e=buildLogicTree(a['node']);e&&(b['children']=[e]);}if(a['nodeLeft']){const f=buildLogicTree(a['nodeLeft']);f&&(b['children']=[...b['children']??[],f]);}if(a['nodeRight']){const g=buildLogicTree(a['nodeRight']);g&&(b['children']=[...b['children']??[],g]);}return b;}function inferNodeType(a){const b=['logic_equal','logic_not','logic_and','logic_or','logic_as_u256_greater','logic_as_u256_lesser','logic_as_u256_equal','logic_as_u256_greater_or_equal','logic_as_u256_lesser_or_equal','logic_string_contains','logic_string_nocase_contains','logic_string_nocase_equal','calc_string_contains','calc_string_nocase_contains','calc_string_nocase_equal','vec_contains_bool','vec_contains_address','vec_contains_string','vec_contains_string_nocase','vec_contains_number','query_reward_record_exists'];if(b['includes'](a))return'Bool';const c=['calc_number_add','calc_number_subtract','calc_number_multiply','calc_number_divide','calc_number_mod','convert_address_number','convert_string_number'];if(c['includes'](a))return'U256';const d=['calc_string_length','calc_string_indexof','calc_string_nocase_indexof','vec_length','vec_indexof_bool','vec_indexof_address','vec_indexof_string','vec_indexof_string_nocase','vec_indexof_number','query_reward_record_count','query_progress_history_session_count','query_progress_history_session_forward_count','query_progress_history_session_forward_retained_submission_count'];if(d['includes'](a))return'U64';const e=['convert_number_address'];if(e['includes'](a))return'Address';const f=['convert_number_string'];if(f['includes'](a))return'String';const g=['convert_safe_u8','convert_safe_u16','convert_safe_u32','convert_safe_u64','convert_safe_u128','convert_safe_u256'];if(g['includes'](a))return a['replace']('convert_safe_','U');if(a==='value_type')return'U8';if(a==='query')return'query_defined';if(a==='identifier')return'table_defined';if(a==='context')return'context_defined';return'unknown';}function describeNode(a){switch(a['type']){case'identifier':return'Reference\x20to\x20table['+(a['identifier']??'?')+']';case'context':return'System\x20context:\x20'+(a['context']??'?');case'query':return'Query\x20instruction\x20'+(a['query']??'?')+'\x20(target:\x20table['+(a['object']?.['identifier']??'?')+'])';case'logic_equal':return'Equality\x20comparison\x20(==)';case'logic_not':return'Logical\x20NOT\x20(!)';case'logic_and':return'Logical\x20AND';case'logic_or':return'Logical\x20OR';case'logic_as_u256_greater':return'Numeric\x20greater\x20than\x20(>)';case'logic_as_u256_lesser':return'Numeric\x20less\x20than\x20(<)';case'logic_as_u256_equal':return'Numeric\x20equality\x20(==)';case'logic_as_u256_greater_or_equal':return'Numeric\x20greater\x20than\x20or\x20equal\x20(>=)';case'logic_as_u256_lesser_or_equal':return'Numeric\x20less\x20than\x20or\x20equal\x20(<=)';case'calc_number_add':return'Numeric\x20addition\x20(+)';case'calc_number_subtract':return'Numeric\x20subtraction\x20(-)';case'calc_number_multiply':return'Numeric\x20multiplication\x20(*)';case'calc_number_divide':return'Numeric\x20division\x20(/)';case'calc_number_mod':return'Numeric\x20modulo\x20(%)';case'vec_contains_address':return'Whitelist\x20check\x20(vec_contains_address)';case'vec_length':return'Vector\x20length';case'convert_safe_u64':return'Safe\x20conversion\x20to\x20U64';default:return a['type'];}}function deriveConstraints(a,b,c,d){const e=Array['from'](d['referencedIdentifiers'])['every'](v=>a['some'](w=>w['identifier']===v)),f=b!==undefined,g=!![],h=d['witnessCodes']['every'](v=>v['code']>=0x64&&v['code']<=0x6c),i=!![],j=!![],k=b!==undefined,l=c?c['guards']['length']<=0x4:!![],m=!![],n=!![],o=!![],p=!![],q=!![],r=a['filter'](v=>v['b_submission']),s=r['length']<=MAX_SUBMISSION_SIZE_PASSPORT,t=!![],u=!![];return{'pitfall_01_identifiers_in_table':e,'pitfall_02_type_compatibility':f,'pitfall_03_query_instruction_valid':g,'pitfall_04_witness_correct':h,'pitfall_05_time_lock_test_safe':i,'pitfall_06_exported_before_recreate':j,'pitfall_07_root_returns_bool':k,'pitfall_08_rely_rep_true':l,'pitfall_09_voting_weight_numeric':m,'pitfall_10_arbitration_not_paused':n,'runtime_01_guard_immutable':o,'runtime_02_submission_type_match':p,'runtime_03_submission_complete':q,'runtime_04_submission_size':s,'runtime_05_witness_source_valid':t,'runtime_06_query_object_valid':u};}export function derivePuzzleFromCallData(a){const b=a['table']??[],c=a['root'],d=a['rely'],e=a['binding_hint'],f={'referencedIdentifiers':new Set(),'queries':[],'contexts':new Set(),'witnessCodes':[]};c&&traverseRoot(c,f);let g;e&&(g={'action':e['action'],'rule_sentence':e['rule_sentence']??'','failure_conditions':e['failure_conditions']??[]});let h;e&&(h={'host_object':e['host_object'],'binding_field':e['binding_field'],'circular_reference':e['circular_reference']??![],'host_object_state':'unknown'});const i=new Map();for(const t of f['witnessCodes']){i['set'](t['objectIdentifier'],t['code']);}const j=[],k=[],l=[],m=[];for(const u of b){const v=f['referencedIdentifiers']['has'](u['identifier']),x=i['get'](u['identifier']);if(x!==undefined){const y=getWitnessInfo(x);if(y){k['push']({'identifier':u['identifier'],'source_type':y['source'],'witness_type':x,'witness_name':y['name'],'target_type':y['target'],'source_b_submission':u['b_submission'],'name':u['name']||y['source']+'→'+y['target']+'\x20via\x20'+y['name']});continue;}}if(!u['b_submission']){const z=typeof u['value']==='string'?u['value']['toLowerCase']():'',A=z in WOW_SYSTEM_SINGLETONS||Object['values'](WOW_SYSTEM_SINGLETONS)['includes'](z);j['push']({'identifier':u['identifier'],'object_address':typeof u['value']==='string'?u['value']:String(u['value']??''),'object_type':u['object_type']??'','name':u['name']||'constant\x20#'+u['identifier'],'is_system_address':A});}else{const B=typeof u['value_type']==='string'?u['value_type']['toLowerCase']():String(u['value_type']);B==='address'?l['push']({'identifier':u['identifier'],'expected_object_type':u['object_type']??'','value_type':'Address','name':u['name']||'submitted\x20object\x20#'+u['identifier'],'binding_constraint':u['object_type']?'must\x20be\x20an\x20on-chain\x20object\x20address\x20of\x20type\x20'+u['object_type']:'must\x20be\x20a\x20valid\x20on-chain\x20object\x20address'}):m['push']({'identifier':u['identifier'],'value_type':typeof u['value_type']==='string'?u['value_type']:String(u['value_type']),'name':u['name']||'submitted\x20value\x20#'+u['identifier'],'binding_constraint':'value\x20type\x20must\x20be\x20'+u['value_type']});}}const n=[];for(const C of f['contexts']){const D={'Signer':'Current\x20transaction\x20signer\x20address\x20verification','Clock':'On-chain\x20timestamp\x20(used\x20for\x20time-lock/time-window)','Guard':'Guard\x20self\x20object\x20ID\x20self-reference'};n['push']({'context_type':C,'usage':D[C]??''});}const o={'on_chain_constants':j,'witness_derived':k,'submitted_objects':l,'submitted_values':m,'system_contexts':n},p=f['queries']['map'](E=>{const F=E['convertWitness']!==undefined?getWitnessInfo(E['convertWitness']):undefined;return{'query_id':typeof E['query']==='number'?E['query']:0x0,'query_name':typeof E['query']==='string'?E['query']:String(E['query']),'object_type':'','parameters':[],'return_type':'','witness':F?{'witness_type':E['convertWitness'],'witness_name':F['name'],'source_type':F['source'],'target_type':F['target'],'scenario':''}:undefined,'purpose':''};});let q;if(c){const E=buildLogicTree(c);if(E){E['return_type']='Bool';let F;d&&d['guards']['length']>0x0&&(F={'guards':d['guards'],'logic_or':d['logic_or']??![],'rep_verified':d['guards']['map'](()=>!![])}),q={'root':E,'rely':F};}}const r=deriveConstraints(b,c,d,f),s={'current_round':'R7','intent':g,'binding':h,'data_sources':o,'queries':p,'logic':q,'constraints':r};return s;}export function getPuzzleStatusBooleans(a){const b=checkPuzzleCompleteness(a);return{'intent':b['dimensions']['intent'],'binding':b['dimensions']['binding'],'data':b['dimensions']['data_sources'],'query':b['dimensions']['query'],'logic':b['dimensions']['logic'],'constraints':b['dimensions']['constraints']};}export function getPendingQuestions(a){const b=checkPuzzleCompleteness(a);if(b['complete'])return[];return b['next_step']['questions'];}
@@ -1 +1 @@
1
- import{formatMist,GasTokenType,MAINNET_BRIDGE_CONFIG,formatUnits,isFundApprovalExempt}from'@wowok/wowok';export const DEFAULT_VALUE_WARNINGS={'defaultAccount':'Using\x20default\x20account\x20(env.account=\x22\x22)','mainnet':'Operating\x20on\x20mainnet\x20—\x20irreversible','replaceExistName':'replaceExistName=true\x20will\x20unbind\x20the\x20existing\x20name\x20(breaking\x20refs)','defaultToken':'Using\x20default\x20token\x200x2::wow::WOW'};export const DEFAULT_AMOUNT_THRESHOLD=BigInt(0x174876e800);export function getAmountThreshold(){const a=process['env']['WOWOK_AMOUNT_THRESHOLD'];if(!a)return DEFAULT_AMOUNT_THRESHOLD;try{return BigInt(a);}catch{return DEFAULT_AMOUNT_THRESHOLD;}}export function formatAmount(a){return formatMist(a);}function bestEffortTokenType(a){return a?.['object']?.['type_parameter']??a?.['type_parameter'];}function describeAmount(a,b){if(!b||b===GasTokenType)return formatMist(a);return a+'\x20raw\x20smallest\x20units\x20of\x20'+b;}export function collectDefaultWarnings(a,b){const c=[],d=a?.['account'];(d===undefined||d==='')&&c['push'](DEFAULT_VALUE_WARNINGS['defaultAccount']);const e=a?.['network'];e&&/mainnet/i['test'](String(e))&&c['push'](DEFAULT_VALUE_WARNINGS['mainnet']);const f=b?.['namedNew']??b?.['object'];return f&&typeof f==='object'&&f['replaceExistName']===!![]&&c['push'](DEFAULT_VALUE_WARNINGS['replaceExistName']),c;}export const BRIDGE_FUND_OPERATION_TYPES=['cross_chain_wow_to_evm','cross_chain_evm_to_wow','claim_wow_to_evm','resume_transfer','withdraw'];function describeBridgeAmount(a,b,c){if(b==='WOW'||!b&&c==='wow_to_evm')return formatMist(a);const d=MAINNET_BRIDGE_CONFIG?.['tokens']?.['find'](f=>f['symbol']?.['toUpperCase']()===b?.['toUpperCase']()),e=d?c==='wow_to_evm'?d['wowDecimals']:d['evmDecimals']:undefined;if(e===undefined)return a+'\x20raw\x20smallest\x20units\x20of\x20'+(b??'the\x20bridge\x20token');try{return formatUnits(BigInt(a),e)+'\x20'+b;}catch{return a+'\x20raw\x20smallest\x20units\x20of\x20'+b;}}export const CONFIRMATION_RULES=[{'id':'bridge_fund_movement','when':(a,b,c)=>BRIDGE_FUND_OPERATION_TYPES['includes'](a),'level':'irreversible','preview':(a,b,c)=>{const d=typeof b?.['amount']==='string'?b['amount']:undefined,e=typeof b?.['token']==='string'?b['token']:undefined,f=b?.['withdrawTo']??b?.['recipientWowAddress']??b?.['to']??(a==='claim_wow_to_evm'||a==='resume_transfer'?b?.['transferId']:undefined),g=a==='cross_chain_wow_to_evm'?'wow_to_evm':'evm_side';return{'level':'irreversible','operation':a,'irreversible':!![],'network':c?.['network']??'mainnet','account':c?.['account']??'','amount':d!==undefined?{'value':d,'token':e??(g==='wow_to_evm'?GasTokenType:'ETH'),'human_readable':describeBridgeAmount(d,e,g),'recipient':f}:undefined,'warnings':[...collectDefaultWarnings(c,b),a==='withdraw'?'EVM\x20withdrawal\x20from\x20activeEvmAccount\x20—\x20funds\x20move\x20to\x20an\x20external\x20EVM\x20address;\x20irreversible.':'Cross-chain\x20bridge\x20transfer\x20—\x20funds\x20leave\x20the\x20source\x20chain;\x20recovery\x20(if\x20any)\x20requires\x20the\x20opposite-side\x20claim\x20or\x20resume_transfer,\x20never\x20a\x20rollback.']};},'bypass_on_explicit_intent':[]},{'id':'irreversible_fund_or_verdict','when':(a,b,c)=>{const d=c?.['network'],e=bestEffortTokenType(b)??GasTokenType;if(a==='payment'&&Array['isArray'](b?.['revenue'])&&b['revenue']['length']>0x0){const f=b['revenue']['map'](g=>g?.['amount']?.['balance'])['filter'](g=>typeof g==='string'||typeof g==='number');if(f['length']===b['revenue']['length']&&f['every'](g=>isFundApprovalExempt(d,e,String(g))))return![];return!![];}if(a==='treasury'&&b?.['withdraw']){const g=extractAmount(b);if(g!==null&&isFundApprovalExempt(d,e,g))return![];return!![];}if(a==='payment')return!![];if(a==='arbitration'&&b?.['arbitration']!==undefined)return!![];if(b?.['receive']!==undefined||b?.['owner_receive']!==undefined||b?.['received_coins']!==undefined||b?.['compensation_fund_receive']!==undefined)return!![];if(b?.['alloc_by_guard']!==undefined)return!![];if(a==='reward'&&b?.['claim']!==undefined)return!![];if(a==='service'&&b?.['compensation_fund_withdraw']!==undefined)return!![];if(a==='order'&&b?.['arb_claim_compensation']!==undefined)return!![];if(a==='arbitration'&&(b?.['arb_withdraw']!==undefined||b?.['fees_transfer']!==undefined))return!![];if(a==='treasury'){if(b?.['withdraw'])return!![];return![];}return![];},'level':'irreversible','preview':(a,b,c)=>{let d;if(a==='payment'&&Array['isArray'](b?.['revenue'])&&b['revenue']['length']>0x0){const f=b['revenue']['find'](g=>typeof g?.['amount']?.['balance']==='string'||typeof g?.['amount']?.['balance']==='number');if(f){const g=String(f['amount']['balance']);d={'value':g,'human_readable':describeAmount(g,bestEffortTokenType(b))};}else d={'value':'','human_readable':'entire\x20Coin\x20object(s)\x20(amount\x20resolved\x20by\x20the\x20fund\x20layer)'};}const e=[];return a==='reward'&&b?.['claim']!==undefined&&e['push']('Reward\x20claim\x20—\x20Guard-verified\x20payout\x20splits\x20the\x20pool\x20balance\x20and\x20transfers\x20coins\x20to\x20the\x20claimer;\x20the\x20exact\x20amount\x20is\x20determined\x20by\x20the\x20Reward\x27s\x20guard\x20config.'),a==='service'&&b?.['compensation_fund_withdraw']!==undefined&&e['push']('Compensation\x20fund\x20withdraw\x20—\x20withdraws\x20the\x20ENTIRE\x20compensation_fund\x20into\x20a\x20new\x20Payment\x20owned\x20by\x20\x27'+(b['compensation_fund_withdraw']?.['receipt']??'(recipient)')+'\x27.'),a==='order'&&b?.['arb_claim_compensation']!==undefined&&e['push']('Order\x20compensation\x20claim\x20—\x20splits\x20the\x20Service\x27s\x20compensation_fund\x20and\x20transfers\x20the\x20awarded\x20coins\x20to\x20the\x20caller;\x20irreversible.'),a==='arbitration'&&b?.['arb_withdraw']!==undefined&&e['push']('Arb\x20fee\x20withdraw\x20—\x20sweeps\x20the\x20Arb\x27s\x20fee\x20balance\x20into\x20the\x20Arbitration\x20object\x27s\x20balance.'),a==='arbitration'&&b?.['fees_transfer']!==undefined&&e['push']('Arbitration\x20fees\x20transfer\x20—\x20withdraws\x20the\x20ENTIRE\x20Arbitration\x20balance\x20into\x20a\x20new\x20Payment\x20for\x20the\x20target\x20Allocation/Treasury;\x20irreversible.'),{'level':'irreversible','operation':a,'irreversible':!![],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),...e],'amount':a==='payment'&&d?{...d,'token':bestEffortTokenType(b)??GasTokenType,'recipient':b?.['revenue']?.[0x0]?.['recipient']}:undefined};},'bypass_on_explicit_intent':[]},{'id':'publish_immutable','when':(a,b,c)=>{if(a==='service'&&(b?.['publish']===!![]||b?.['bPublished']===!![]))return!![];if(a==='machine'&&b?.['publish']===!![])return!![];return![];},'level':'publish','preview':(a,b,c)=>({'level':'publish','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','immutable_after':a==='service'?['machine','order_allocators']:['nodes','pairs','forwards'],'warnings':collectDefaultWarnings(c,b)}),'bypass_on_explicit_intent':['force\x20publish','publish\x20now']},{'id':'amount_sensitive','when':(a,b,c)=>{const d=extractAmount(b);if(d!==null){if(isFundApprovalExempt(c?.['network'],bestEffortTokenType(b)??GasTokenType,d))return![];return!![];}if(a==='service'&&b?.['order_new'])return!![];if(a==='treasury'&&b?.['deposit']?.['coin']?.['coin'])return!![];if(a==='reward'&&b?.['coin_add']?.['coin'])return!![];if(a==='allocation'&&b?.['coin']?.['coin'])return!![];return![];},'level':'amount','preview':(a,b,c)=>{const d=extractAmount(b),e=bestEffortTokenType(b);return{'level':'amount','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','amount':d?{'value':d,'token':e??GasTokenType,'human_readable':describeAmount(d,e)}:{'value':'','token':e??GasTokenType,'human_readable':'entire\x20Coin\x20object\x20(amount\x20resolved\x20on-chain)'},'warnings':collectDefaultWarnings(c,b)};},'bypass_on_explicit_intent':[]},{'id':'default_values','when':(a,b,c)=>{return collectDefaultWarnings(c,b)['length']>0x0;},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','warnings':collectDefaultWarnings(c,b)}),'bypass_on_explicit_intent':['use\x20default\x20account','default\x20account\x20is\x20fine','use\x20the\x20default\x20account','default\x20account\x20works\x20fine']},{'id':'guard_create_immutable','when':(a,b,c)=>{if(a==='guard')return!![];return![];},'level':'irreversible','preview':(a,b,c)=>{const d=b?.['table']??[],e=b?.['root'],f=b?.['rely'],g=typeof e==='object'&&e!==null&&'type'in e?e['type']:typeof e==='object'&&e!==null&&'type'in e&&e['type']==='file'?'file':'unknown',h=['table','root'];if(f)h['push']('rely');return{'level':'irreversible','operation':a,'object':b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','immutable_after':h,'irreversible':!![],'warnings':[...collectDefaultWarnings(c,b),'Guard\x20is\x20CREATE-only\x20and\x20immutable\x20—\x20cannot\x20be\x20edited\x20or\x20deleted\x20after\x20creation','Table\x20entries:\x20'+d['length']+'\x20(max\x20256)','Root\x20node\x20type:\x20'+g+'\x20(must\x20return\x20Bool)',...f?['Rely\x20dependencies:\x20'+(f['guards']?.['length']??0x0)+'\x20(max\x204,\x20AND/OR\x20logic)']:[],'To\x20modify\x20later:\x20export\x20via\x20guard2file\x20→\x20edit\x20→\x20CREATE\x20new\x20→\x20rebind']};},'bypass_on_explicit_intent':[]},{'id':'guard_gen_passport_test','when':(a,b,c)=>{if(a==='gen_passport')return!![];return![];},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['guard'],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),'gen_passport\x20will\x20consume\x20gas\x20for\x20static\x20testing']}),'bypass_on_explicit_intent':['test\x20guard','testing\x20guard','gen\x20passport','generate\x20passport']},{'id':'progress_advance','when':(a,b,c)=>{if(a!=='progress')return![];return b?.['operate']?.['op']==='next'||b?.['owner_receive']!==undefined;},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['object'],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),'Advancing\x20the\x20progress\x20node\x20may\x20release\x20funds\x20per\x20the\x20machine\x20allocation']}),'bypass_on_explicit_intent':[]}];export function resolveOverrideId(a,b){if(a==='publish_immutable'){if(b==='service')return'service.publish';if(b==='machine')return'machine.publish';return undefined;}if(a==='progress_advance')return'node.advance';return undefined;}export function extractAmount(a){if(!a)return null;const b=e=>{if(typeof e==='number')return String(e);if(typeof e==='string'&&e!=='')return e;return null;},d=[a?.['balance'],a?.['amount'],a?.['compensation_fund_add']?.['balance'],a?.['coin_add']?.['balance'],a?.['coin']?.['balance'],a?.['order_new']?.['buy']?.['total_pay']?.['balance'],a?.['dispute']?.['fee']?.['balance'],a?.['fee'],a?.['arbitration']?.['indemnity'],a?.['revenue']?.[0x0]?.['amount']?.['balance'],a?.['deposit']?.['coin']?.['balance'],a?.['withdraw']?.['amount']?.['fixed']];for(const e of d){const f=b(e);if(f!==null)return f;}if(Array['isArray'](a?.['guard_add']))for(const h of a['guard_add']){if(h?.['amount']?.['type']==='Fixed'){const i=b(h['amount']['value']);if(i!==null)return i;}}for(const j of[a?.['allocators'],a?.['order_allocators']]){if(!j||typeof j!=='object')continue;const k=b(j['threshold']);if(k!==null)return k;for(const l of Array['isArray'](j['allocators'])?j['allocators']:[]){if(Array['isArray'](l?.['sharing']))for(const n of l['sharing']){if(n?.['mode']==='Amount'){const o=b(n['sharing']);if(o!==null)return o;}}const m=b(l?.['max']);if(m!==null)return m;}}return null;}export const OBJECT_REUSE_RULES=[{'rule_id':'REUSE-001','object_type':'permission','recommendation':'strongly_recommended','reason':'Centralized\x20permission\x20control\x20across\x20all\x20services','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Permission\x20to\x20reuse?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-002','object_type':'machine','recommendation':'recommended','reason':'Save\x20design\x20time\x20for\x20similar\x20processes','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Machine\x20whose\x20workflow\x20fits?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-003','object_type':'guard','recommendation':'recommended','reason':'Avoid\x20redundant\x20validation\x20rules','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Guard\x20with\x20matching\x20validation\x20logic?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-004','object_type':'contact','recommendation':'recommended','reason':'Single\x20point\x20of\x20customer-service\x20management','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Contact\x20for\x20customer\x20service?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-005','object_type':'arbitration','recommendation':'always_reuse','reason':'Customers\x20choose\x20from\x20established\x20arbiters;\x20creating\x20a\x20new\x20Arbitration\x20is\x20an\x20operator-level\x20decision','ask_user':'Which\x20existing\x20Arbitration\x20service\x20should\x20disputes\x20route\x20to?\x20Provide\x20the\x20name\x20or\x20ID.'}];export const CREATE_VS_MODIFY_PATTERN={'reuse_form':'string','create_form':'object','resolution_api':'GetObjectExisted','note':'String\x20reference\x20=\x20REUSE\x20(name\x20resolution\x20failure\x20is\x20a\x20hard\x20error);\x20object\x20shape\x20=\x20CREATE\x20(always).'};export const IMMUTABILITY_RULES=[{'rule_id':'IMMUT-001','object_type':'machine','trigger':'publish','immutable_fields':['nodes','pairs','forwards'],'message':'Machine\x20topology\x20is\x20immutable\x20after\x20publish\x20—\x20verify\x20all\x20nodes/forwards\x20via\x20machineNode2file\x20BEFORE\x20publishing'},{'rule_id':'IMMUT-002','object_type':'service','trigger':'publish','immutable_fields':['machine','order_allocators','arbitrations'],'mutable_after':['sales'],'message':'Service.machine,\x20order_allocators\x20and\x20arbitrations\x20are\x20frozen\x20after\x20publish;\x20sales\x20remains\x20fully\x20modifiable\x20(L3)\x20without\x20pause'},{'rule_id':'IMMUT-003','object_type':'guard','trigger':'create','immutable_fields':['table','root','rely'],'message':'Guard\x20is\x20CREATE-only\x20and\x20immutable\x20—\x20cannot\x20be\x20edited\x20or\x20deleted\x20after\x20creation.\x20To\x20change:\x20export\x20via\x20guard2file\x20→\x20edit\x20→\x20CREATE\x20new\x20→\x20rebind'}];export const OPERATION_TYPE_CLASSIFICATION={'LOCAL_ONLY':['account_operation','local_mark_operation','local_info_operation','config_operation'],'ONCHAIN':['onchain_operations','wip_file','bridge_operation','messenger_operation'],'QUERY':['query_toolkit','onchain_table_data','onchain_events','guard2file','machineNode2file','schema_query','wowok_buildin_info','trust_score'],'ENCRYPTED':['messenger_operation']};export const OPERATION_CLASS_META={'LOCAL_ONLY':{'gas':![],'confirmation_required':![],'note':'Local\x20state\x20only\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'},'ONCHAIN':{'gas':!![],'confirmation_required':!![],'note':'On-chain\x20write\x20—\x20gas\x20consumed,\x20explicit\x20user\x20confirmation\x20REQUIRED\x20before\x20execution'},'QUERY':{'gas':![],'confirmation_required':![],'note':'Read-only\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'},'ENCRYPTED':{'gas':![],'confirmation_required':![],'note':'Local\x20encryption\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'}};export function classifyTool(a){if(OPERATION_TYPE_CLASSIFICATION['ENCRYPTED']['includes'](a))return'ENCRYPTED';for(const b of['LOCAL_ONLY','ONCHAIN','QUERY']){if(OPERATION_TYPE_CLASSIFICATION[b]['includes'](a))return b;}return undefined;}export const NAMING_CONVENTIONS={'scheme':'<projectPrefix>_<type>_<purpose>_<version>','parts':{'project_prefix':{'example':'shopFunny_','purpose':'Prevents\x20cross-project\x20collisions'},'type_prefix':{'example':'machine_\x20/\x20guard_\x20/\x20service_','purpose':'Clarifies\x20object\x20type'},'purpose_suffix':{'example':'serviceWithdraw','purpose':'Describes\x20function'},'version_suffix':{'example':'_v2','purpose':'Enables\x20iteration\x20without\x20replaceExistName'}},'entry_id':{'pattern':'^<object_type>:<name>$','example':'service:myshop_service'},'replace_exist_name':{'default':![],'false_effect':'Throws\x20error\x20if\x20name\x20is\x20in\x20use\x20—\x20safe\x20default','true_effect':'Existing\x20object/account\x20with\x20the\x20same\x20name\x20is\x20suspended/unbound\x20to\x20free\x20the\x20name','account_default_forbidden':'replaceExistName:true\x20on\x20the\x20default\x20account\x20(name=\x27\x27)\x20is\x20FORBIDDEN\x20—\x20use\x20suspend()\x20explicitly','recommendation':'DISCOURAGED\x20—\x20prefer\x20versioned\x20names\x20(_v1,\x20_v2)\x20for\x20production'},'recommendations':['Always\x20provide\x20tags\x20on\x20object\x20creation\x20for\x20filtering\x20and\x20management','Use\x20names\x20as\x20primary\x20identifiers;\x20use\x20short\x20address\x20form\x20(0x1234...def)\x20only\x20for\x20display','All\x20cross-object\x20references\x20(Guard\x20tables,\x20Service\x20bindings,\x20Machine\x20forwards)\x20use\x20NAMES\x20—\x20resolved\x20per-network\x20at\x20build\x20time']};export function checkObjectReuseRules(a){const b=[];for(const c of a){if(!c['is_new'])continue;const d=OBJECT_REUSE_RULES['find'](e=>e['object_type']===c['object_type']);if(!d)continue;(d['recommendation']==='always_reuse'||d['recommendation']==='strongly_recommended')&&b['push']({'rule_id':d['rule_id'],'severity':d['recommendation']==='always_reuse'?'warn':'info','message':'Creating\x20NEW\x20'+c['object_type']+(c['name']?'\x20\x22'+c['name']+'\x22':'')+'\x20—\x20reuse\x20is\x20'+d['recommendation']+':\x20'+d['reason']+'.\x20'+d['ask_user']});}return b;}export function checkImmutabilityRules(a){const b=[];for(const c of a){const d=IMMUTABILITY_RULES['find'](e=>e['object_type']===c['object_type']&&e['trigger']===c['trigger']);if(!d)continue;b['push']({'rule_id':d['rule_id'],'severity':'warn','message':''+c['object_type']+(c['name']?'\x20\x22'+c['name']+'\x22':'')+'\x20'+c['trigger']+':\x20'+d['message']+'.\x20Immutable:\x20['+d['immutable_fields']['join'](',\x20')+']'+(d['mutable_after']?'.\x20Still\x20mutable:\x20['+d['mutable_after']['join'](',\x20')+']':'')});}return b;}export const SAFETY_RULES_VERSION=0x2;
1
+ import{formatMist,GasTokenType,MAINNET_BRIDGE_CONFIG,formatUnits,isFundApprovalExempt}from'@wowok/wowok';export const DEFAULT_VALUE_WARNINGS={'defaultAccount':'Using\x20default\x20account\x20(env.account=\x22\x22)','mainnet':'Operating\x20on\x20mainnet\x20—\x20irreversible','replaceExistName':'replaceExistName=true\x20will\x20unbind\x20the\x20existing\x20name\x20(breaking\x20refs)','defaultToken':'Using\x20default\x20token\x200x2::wow::WOW'};export const DEFAULT_AMOUNT_THRESHOLD=BigInt(0x174876e800);export function getAmountThreshold(){const a=process['env']['WOWOK_AMOUNT_THRESHOLD'];if(!a)return DEFAULT_AMOUNT_THRESHOLD;try{return BigInt(a);}catch{return DEFAULT_AMOUNT_THRESHOLD;}}export function formatAmount(a){return formatMist(a);}function bestEffortTokenType(a){return a?.['object']?.['type_parameter']??a?.['type_parameter'];}function describeAmount(a,b){if(!b||b===GasTokenType)try{return formatMist(a);}catch{return a+'\x20raw\x20smallest\x20units\x20of\x20'+GasTokenType;}return a+'\x20raw\x20smallest\x20units\x20of\x20'+b;}export function collectDefaultWarnings(a,b){const c=[],d=a?.['account'];(d===undefined||d==='')&&c['push'](DEFAULT_VALUE_WARNINGS['defaultAccount']);const e=a?.['network'];e&&/mainnet/i['test'](String(e))&&c['push'](DEFAULT_VALUE_WARNINGS['mainnet']);const f=b?.['namedNew']??b?.['object'];return f&&typeof f==='object'&&f['replaceExistName']===!![]&&c['push'](DEFAULT_VALUE_WARNINGS['replaceExistName']),c;}export const BRIDGE_FUND_OPERATION_TYPES=['cross_chain_wow_to_evm','cross_chain_evm_to_wow','claim_wow_to_evm','resume_transfer','withdraw'];function describeBridgeAmount(a,b,c){if(b==='WOW'||!b&&c==='wow_to_evm')return formatMist(a);const d=MAINNET_BRIDGE_CONFIG?.['tokens']?.['find'](f=>f['symbol']?.['toUpperCase']()===b?.['toUpperCase']()),e=d?c==='wow_to_evm'?d['wowDecimals']:d['evmDecimals']:undefined;if(e===undefined)return a+'\x20raw\x20smallest\x20units\x20of\x20'+(b??'the\x20bridge\x20token');try{return formatUnits(BigInt(a),e)+'\x20'+b;}catch{return a+'\x20raw\x20smallest\x20units\x20of\x20'+b;}}export const CONFIRMATION_RULES=[{'id':'bridge_fund_movement','when':(a,b,c)=>BRIDGE_FUND_OPERATION_TYPES['includes'](a),'level':'irreversible','preview':(a,b,c)=>{const d=typeof b?.['amount']==='string'?b['amount']:undefined,e=typeof b?.['token']==='string'?b['token']:undefined,f=b?.['withdrawTo']??b?.['recipientWowAddress']??b?.['to']??(a==='claim_wow_to_evm'||a==='resume_transfer'?b?.['transferId']:undefined),g=a==='cross_chain_wow_to_evm'?'wow_to_evm':'evm_side';return{'level':'irreversible','operation':a,'irreversible':!![],'network':c?.['network']??'mainnet','account':c?.['account']??'','amount':d!==undefined?{'value':d,'token':e??(g==='wow_to_evm'?GasTokenType:'ETH'),'human_readable':describeBridgeAmount(d,e,g),'recipient':f}:undefined,'warnings':[...collectDefaultWarnings(c,b),a==='withdraw'?'EVM\x20withdrawal\x20from\x20activeEvmAccount\x20—\x20funds\x20move\x20to\x20an\x20external\x20EVM\x20address;\x20irreversible.':'Cross-chain\x20bridge\x20transfer\x20—\x20funds\x20leave\x20the\x20source\x20chain;\x20recovery\x20(if\x20any)\x20requires\x20the\x20opposite-side\x20claim\x20or\x20resume_transfer,\x20never\x20a\x20rollback.']};},'bypass_on_explicit_intent':[]},{'id':'irreversible_fund_or_verdict','when':(a,b,c)=>{const d=c?.['network'],e=bestEffortTokenType(b)??GasTokenType;if(a==='payment'&&Array['isArray'](b?.['revenue'])&&b['revenue']['length']>0x0){const f=b['revenue']['map'](g=>g?.['amount']?.['balance'])['filter'](g=>typeof g==='string'||typeof g==='number');if(f['length']===b['revenue']['length']&&f['every'](g=>isFundApprovalExempt(d,e,String(g))))return![];return!![];}if(a==='treasury'&&b?.['withdraw']){const g=extractAmount(b);if(g!==null&&isFundApprovalExempt(d,e,g))return![];return!![];}if(a==='payment')return!![];if(a==='arbitration'&&b?.['arbitration']!==undefined)return!![];if(b?.['receive']!==undefined||b?.['owner_receive']!==undefined||b?.['received_coins']!==undefined||b?.['compensation_fund_receive']!==undefined)return!![];if(b?.['alloc_by_guard']!==undefined)return!![];if(a==='reward'&&b?.['claim']!==undefined)return!![];if(a==='service'&&b?.['compensation_fund_withdraw']!==undefined)return!![];if(a==='order'&&b?.['arb_claim_compensation']!==undefined)return!![];if(a==='arbitration'&&(b?.['arb_withdraw']!==undefined||b?.['fees_transfer']!==undefined))return!![];if(a==='treasury'){if(b?.['withdraw'])return!![];return![];}return![];},'level':'irreversible','preview':(a,b,c)=>{let d;if(a==='payment'&&Array['isArray'](b?.['revenue'])&&b['revenue']['length']>0x0){const f=b['revenue']['find'](g=>typeof g?.['amount']?.['balance']==='string'||typeof g?.['amount']?.['balance']==='number');if(f){const g=String(f['amount']['balance']);d={'value':g,'human_readable':describeAmount(g,bestEffortTokenType(b))};}else d={'value':'','human_readable':'entire\x20Coin\x20object(s)\x20(amount\x20resolved\x20by\x20the\x20fund\x20layer)'};}const e=[];return a==='reward'&&b?.['claim']!==undefined&&e['push']('Reward\x20claim\x20—\x20Guard-verified\x20payout\x20splits\x20the\x20pool\x20balance\x20and\x20transfers\x20coins\x20to\x20the\x20claimer;\x20the\x20exact\x20amount\x20is\x20determined\x20by\x20the\x20Reward\x27s\x20guard\x20config.'),a==='service'&&b?.['compensation_fund_withdraw']!==undefined&&e['push']('Compensation\x20fund\x20withdraw\x20—\x20withdraws\x20the\x20ENTIRE\x20compensation_fund\x20into\x20a\x20new\x20Payment\x20owned\x20by\x20\x27'+(b['compensation_fund_withdraw']?.['receipt']??'(recipient)')+'\x27.'),a==='order'&&b?.['arb_claim_compensation']!==undefined&&e['push']('Order\x20compensation\x20claim\x20—\x20splits\x20the\x20Service\x27s\x20compensation_fund\x20and\x20transfers\x20the\x20awarded\x20coins\x20to\x20the\x20caller;\x20irreversible.'),a==='arbitration'&&b?.['arb_withdraw']!==undefined&&e['push']('Arb\x20fee\x20withdraw\x20—\x20sweeps\x20the\x20Arb\x27s\x20fee\x20balance\x20into\x20the\x20Arbitration\x20object\x27s\x20balance.'),a==='arbitration'&&b?.['fees_transfer']!==undefined&&e['push']('Arbitration\x20fees\x20transfer\x20—\x20withdraws\x20the\x20ENTIRE\x20Arbitration\x20balance\x20into\x20a\x20new\x20Payment\x20for\x20the\x20target\x20Allocation/Treasury;\x20irreversible.'),{'level':'irreversible','operation':a,'irreversible':!![],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),...e],'amount':a==='payment'&&d?{...d,'token':bestEffortTokenType(b)??GasTokenType,'recipient':b?.['revenue']?.[0x0]?.['recipient']}:undefined};},'bypass_on_explicit_intent':[]},{'id':'publish_immutable','when':(a,b,c)=>{if(a==='service'&&(b?.['publish']===!![]||b?.['bPublished']===!![]))return!![];if(a==='machine'&&b?.['publish']===!![])return!![];return![];},'level':'publish','preview':(a,b,c)=>({'level':'publish','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','immutable_after':a==='service'?['machine','order_allocators']:['nodes','pairs','forwards'],'warnings':collectDefaultWarnings(c,b)}),'bypass_on_explicit_intent':['force\x20publish','publish\x20now']},{'id':'amount_sensitive','when':(a,b,c)=>{const d=extractAmount(b);if(d!==null){if(isFundApprovalExempt(c?.['network'],bestEffortTokenType(b)??GasTokenType,d))return![];return!![];}if(a==='service'&&b?.['order_new'])return!![];if(a==='treasury'&&b?.['deposit']?.['coin']?.['coin'])return!![];if(a==='reward'&&b?.['coin_add']?.['coin'])return!![];if(a==='allocation'&&b?.['coin']?.['coin'])return!![];return![];},'level':'amount','preview':(a,b,c)=>{const d=extractAmount(b),e=bestEffortTokenType(b);return{'level':'amount','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','amount':d?{'value':d,'token':e??GasTokenType,'human_readable':describeAmount(d,e)}:{'value':'','token':e??GasTokenType,'human_readable':'entire\x20Coin\x20object\x20(amount\x20resolved\x20on-chain)'},'warnings':collectDefaultWarnings(c,b)};},'bypass_on_explicit_intent':[]},{'id':'default_values','when':(a,b,c)=>{return collectDefaultWarnings(c,b)['length']>0x0;},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','warnings':collectDefaultWarnings(c,b)}),'bypass_on_explicit_intent':['use\x20default\x20account','default\x20account\x20is\x20fine','use\x20the\x20default\x20account','default\x20account\x20works\x20fine']},{'id':'guard_create_immutable','when':(a,b,c)=>{if(a==='guard')return!![];return![];},'level':'irreversible','preview':(a,b,c)=>{const d=b?.['table']??[],e=b?.['root'],f=b?.['rely'],g=typeof e==='object'&&e!==null&&'type'in e?e['type']:typeof e==='object'&&e!==null&&'type'in e&&e['type']==='file'?'file':'unknown',h=['table','root'];if(f)h['push']('rely');return{'level':'irreversible','operation':a,'object':b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','immutable_after':h,'irreversible':!![],'warnings':[...collectDefaultWarnings(c,b),'Guard\x20is\x20CREATE-only\x20and\x20immutable\x20—\x20cannot\x20be\x20edited\x20or\x20deleted\x20after\x20creation','Table\x20entries:\x20'+d['length']+'\x20(max\x20256)','Root\x20node\x20type:\x20'+g+'\x20(must\x20return\x20Bool)',...f?['Rely\x20dependencies:\x20'+(f['guards']?.['length']??0x0)+'\x20(max\x204,\x20AND/OR\x20logic)']:[],'To\x20modify\x20later:\x20export\x20via\x20guard2file\x20→\x20edit\x20→\x20CREATE\x20new\x20→\x20rebind']};},'bypass_on_explicit_intent':[]},{'id':'guard_gen_passport_test','when':(a,b,c)=>{if(a==='gen_passport')return!![];return![];},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['guard'],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),'gen_passport\x20will\x20consume\x20gas\x20for\x20static\x20testing']}),'bypass_on_explicit_intent':['test\x20guard','testing\x20guard','gen\x20passport','generate\x20passport']},{'id':'progress_advance','when':(a,b,c)=>{if(a!=='progress')return![];return b?.['operate']?.['op']==='next'||b?.['owner_receive']!==undefined;},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['object'],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),'Advancing\x20the\x20progress\x20node\x20may\x20release\x20funds\x20per\x20the\x20machine\x20allocation']}),'bypass_on_explicit_intent':[]}];export function resolveOverrideId(a,b){if(a==='publish_immutable'){if(b==='service')return'service.publish';if(b==='machine')return'machine.publish';return undefined;}if(a==='progress_advance')return'node.advance';return undefined;}export function extractAmount(a){if(!a)return null;const b=e=>{if(typeof e==='number')return String(e);if(typeof e==='string'&&e!=='')return e;return null;},d=[a?.['balance'],a?.['amount'],a?.['compensation_fund_add']?.['balance'],a?.['coin_add']?.['balance'],a?.['coin']?.['balance'],a?.['order_new']?.['buy']?.['total_pay']?.['balance'],a?.['dispute']?.['fee']?.['balance'],a?.['fee'],a?.['arbitration']?.['indemnity'],a?.['revenue']?.[0x0]?.['amount']?.['balance'],a?.['deposit']?.['coin']?.['balance'],a?.['withdraw']?.['amount']?.['fixed']];for(const e of d){const f=b(e);if(f!==null)return f;}if(Array['isArray'](a?.['guard_add']))for(const h of a['guard_add']){if(h?.['amount']?.['type']==='Fixed'){const i=b(h['amount']['value']);if(i!==null)return i;}}for(const j of[a?.['allocators'],a?.['order_allocators']]){if(!j||typeof j!=='object')continue;const k=b(j['threshold']);if(k!==null)return k;for(const l of Array['isArray'](j['allocators'])?j['allocators']:[]){if(Array['isArray'](l?.['sharing']))for(const n of l['sharing']){if(n?.['mode']==='Amount'){const o=b(n['sharing']);if(o!==null)return o;}}const m=b(l?.['max']);if(m!==null)return m;}}return null;}export const OBJECT_REUSE_RULES=[{'rule_id':'REUSE-001','object_type':'permission','recommendation':'strongly_recommended','reason':'Centralized\x20permission\x20control\x20across\x20all\x20services','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Permission\x20to\x20reuse?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-002','object_type':'machine','recommendation':'recommended','reason':'Save\x20design\x20time\x20for\x20similar\x20processes','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Machine\x20whose\x20workflow\x20fits?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-003','object_type':'guard','recommendation':'recommended','reason':'Avoid\x20redundant\x20validation\x20rules','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Guard\x20with\x20matching\x20validation\x20logic?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-004','object_type':'contact','recommendation':'recommended','reason':'Single\x20point\x20of\x20customer-service\x20management','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Contact\x20for\x20customer\x20service?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-005','object_type':'arbitration','recommendation':'always_reuse','reason':'Customers\x20choose\x20from\x20established\x20arbiters;\x20creating\x20a\x20new\x20Arbitration\x20is\x20an\x20operator-level\x20decision','ask_user':'Which\x20existing\x20Arbitration\x20service\x20should\x20disputes\x20route\x20to?\x20Provide\x20the\x20name\x20or\x20ID.'}];export const CREATE_VS_MODIFY_PATTERN={'reuse_form':'string','create_form':'object','resolution_api':'GetObjectExisted','note':'String\x20reference\x20=\x20REUSE\x20(name\x20resolution\x20failure\x20is\x20a\x20hard\x20error);\x20object\x20shape\x20=\x20CREATE\x20(always).'};export const IMMUTABILITY_RULES=[{'rule_id':'IMMUT-001','object_type':'machine','trigger':'publish','immutable_fields':['nodes','pairs','forwards'],'message':'Machine\x20topology\x20is\x20immutable\x20after\x20publish\x20—\x20verify\x20all\x20nodes/forwards\x20via\x20machineNode2file\x20BEFORE\x20publishing'},{'rule_id':'IMMUT-002','object_type':'service','trigger':'publish','immutable_fields':['machine','order_allocators','arbitrations'],'mutable_after':['sales'],'message':'Service.machine,\x20order_allocators\x20and\x20arbitrations\x20are\x20frozen\x20after\x20publish;\x20sales\x20remains\x20fully\x20modifiable\x20(L3)\x20without\x20pause'},{'rule_id':'IMMUT-003','object_type':'guard','trigger':'create','immutable_fields':['table','root','rely'],'message':'Guard\x20is\x20CREATE-only\x20and\x20immutable\x20—\x20cannot\x20be\x20edited\x20or\x20deleted\x20after\x20creation.\x20To\x20change:\x20export\x20via\x20guard2file\x20→\x20edit\x20→\x20CREATE\x20new\x20→\x20rebind'}];export const OPERATION_TYPE_CLASSIFICATION={'LOCAL_ONLY':['account_operation','local_mark_operation','local_info_operation','config_operation'],'ONCHAIN':['onchain_operations','wip_file','bridge_operation','messenger_operation'],'QUERY':['query_toolkit','onchain_table_data','onchain_events','guard2file','machineNode2file','schema_query','wowok_buildin_info','trust_score'],'ENCRYPTED':['messenger_operation']};export const OPERATION_CLASS_META={'LOCAL_ONLY':{'gas':![],'confirmation_required':![],'note':'Local\x20state\x20only\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'},'ONCHAIN':{'gas':!![],'confirmation_required':!![],'note':'On-chain\x20write\x20—\x20gas\x20consumed,\x20explicit\x20user\x20confirmation\x20REQUIRED\x20before\x20execution'},'QUERY':{'gas':![],'confirmation_required':![],'note':'Read-only\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'},'ENCRYPTED':{'gas':![],'confirmation_required':![],'note':'Local\x20encryption\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'}};export function classifyTool(a){if(OPERATION_TYPE_CLASSIFICATION['ENCRYPTED']['includes'](a))return'ENCRYPTED';for(const b of['LOCAL_ONLY','ONCHAIN','QUERY']){if(OPERATION_TYPE_CLASSIFICATION[b]['includes'](a))return b;}return undefined;}export const NAMING_CONVENTIONS={'scheme':'<projectPrefix>_<type>_<purpose>_<version>','parts':{'project_prefix':{'example':'shopFunny_','purpose':'Prevents\x20cross-project\x20collisions'},'type_prefix':{'example':'machine_\x20/\x20guard_\x20/\x20service_','purpose':'Clarifies\x20object\x20type'},'purpose_suffix':{'example':'serviceWithdraw','purpose':'Describes\x20function'},'version_suffix':{'example':'_v2','purpose':'Enables\x20iteration\x20without\x20replaceExistName'}},'entry_id':{'pattern':'^<object_type>:<name>$','example':'service:myshop_service'},'replace_exist_name':{'default':![],'false_effect':'Throws\x20error\x20if\x20name\x20is\x20in\x20use\x20—\x20safe\x20default','true_effect':'Existing\x20object/account\x20with\x20the\x20same\x20name\x20is\x20suspended/unbound\x20to\x20free\x20the\x20name','account_default_forbidden':'replaceExistName:true\x20on\x20the\x20default\x20account\x20(name=\x27\x27)\x20is\x20FORBIDDEN\x20—\x20use\x20suspend()\x20explicitly','recommendation':'DISCOURAGED\x20—\x20prefer\x20versioned\x20names\x20(_v1,\x20_v2)\x20for\x20production'},'recommendations':['Always\x20provide\x20tags\x20on\x20object\x20creation\x20for\x20filtering\x20and\x20management','Use\x20names\x20as\x20primary\x20identifiers;\x20use\x20short\x20address\x20form\x20(0x1234...def)\x20only\x20for\x20display','All\x20cross-object\x20references\x20(Guard\x20tables,\x20Service\x20bindings,\x20Machine\x20forwards)\x20use\x20NAMES\x20—\x20resolved\x20per-network\x20at\x20build\x20time']};export function checkObjectReuseRules(a){const b=[];for(const c of a){if(!c['is_new'])continue;const d=OBJECT_REUSE_RULES['find'](e=>e['object_type']===c['object_type']);if(!d)continue;(d['recommendation']==='always_reuse'||d['recommendation']==='strongly_recommended')&&b['push']({'rule_id':d['rule_id'],'severity':d['recommendation']==='always_reuse'?'warn':'info','message':'Creating\x20NEW\x20'+c['object_type']+(c['name']?'\x20\x22'+c['name']+'\x22':'')+'\x20—\x20reuse\x20is\x20'+d['recommendation']+':\x20'+d['reason']+'.\x20'+d['ask_user']});}return b;}export function checkImmutabilityRules(a){const b=[];for(const c of a){const d=IMMUTABILITY_RULES['find'](e=>e['object_type']===c['object_type']&&e['trigger']===c['trigger']);if(!d)continue;b['push']({'rule_id':d['rule_id'],'severity':'warn','message':''+c['object_type']+(c['name']?'\x20\x22'+c['name']+'\x22':'')+'\x20'+c['trigger']+':\x20'+d['message']+'.\x20Immutable:\x20['+d['immutable_fields']['join'](',\x20')+']'+(d['mutable_after']?'.\x20Still\x20mutable:\x20['+d['mutable_after']['join'](',\x20')+']':'')});}return b;}export const SAFETY_RULES_VERSION=0x2;