@wowok/agent-mcp 3.3.2 → 3.3.3
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.
- package/dist/chain-semantics/field-capability.js +1 -1
- package/dist/chain-semantics/freeze-map.js +1 -1
- package/dist/chain-semantics/fund-flow.js +1 -1
- package/dist/chain-semantics/object-graph.js +1 -1
- package/dist/composition/audit.js +1 -1
- package/dist/composition/compile.d.ts +2 -2
- package/dist/composition/compile.js +1 -1
- package/dist/composition/inflight.d.ts +27 -3
- package/dist/composition/inflight.js +1 -1
- package/dist/config/judgment.d.ts +111 -1
- package/dist/config/judgment.js +1 -1
- package/dist/evaluation/arbitration-game.d.ts +4 -0
- package/dist/evaluation/arbitration-game.js +1 -1
- package/dist/evaluation/builtins/graph-service.js +1 -1
- package/dist/evaluation/builtins/graph-service.spec.js +1 -1
- package/dist/evaluation/game-strategy.d.ts +6 -0
- package/dist/evaluation/game-strategy.js +1 -1
- package/dist/evaluation/node-game.d.ts +4 -0
- package/dist/evaluation/node-game.js +1 -1
- package/dist/evaluation/value-risk.d.ts +8 -0
- package/dist/evaluation/value-risk.js +1 -0
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/business-modules.js +1 -1
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/graph/onchain/analyze.js +1 -1
- package/dist/graph/onchain/analyze.spec.js +1 -1
- package/dist/graph/onchain/expand.js +1 -1
- package/dist/graph/onchain/exposure.js +1 -1
- package/dist/graph/onchain/facet-projection.js +1 -1
- package/dist/graph/onchain/facet-projection.spec.js +1 -1
- package/dist/graph/onchain/facts.d.ts +20 -0
- package/dist/graph/onchain/facts.js +1 -1
- package/dist/graph/onchain/facts.spec.js +1 -1
- package/dist/graph/onchain/object-held-receipts.d.ts +20 -0
- package/dist/graph/onchain/object-held-receipts.js +1 -0
- package/dist/graph/onchain/object-held-receipts.spec.d.ts +1 -0
- package/dist/graph/onchain/object-held-receipts.spec.js +1 -0
- package/dist/graph/onchain/sdk-batch.d.ts +1 -0
- package/dist/graph/onchain/sdk-batch.js +1 -1
- package/dist/harness/index.d.ts +1 -0
- package/dist/harness/recover.d.ts +2 -1
- package/dist/harness/recover.js +1 -1
- package/dist/knowledge/allocation-ledger.d.ts +0 -1
- package/dist/knowledge/allocation-ledger.js +1 -1
- package/dist/knowledge/allocation-puzzle.js +1 -1
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/arb-fund-facts.d.ts +7 -0
- package/dist/knowledge/arb-fund-facts.js +1 -1
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/judgment-baselines.json +502 -81
- package/dist/knowledge/baselines/rules/allocation.json +0 -14
- package/dist/knowledge/baselines/rules/graph.json +4 -4
- package/dist/knowledge/baselines/rules/plan.json +33 -3
- package/dist/knowledge/builtin-templates.d.ts +1 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/discount-threshold.js +1 -1
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/game-scenarios.d.ts +21 -0
- package/dist/knowledge/game-scenarios.js +1 -0
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-bindings.js +1 -1
- package/dist/knowledge/guard-design-patterns.d.ts +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-field-cognition.js +1 -1
- package/dist/knowledge/guard-leg-map.d.ts +5 -0
- package/dist/knowledge/guard-leg-map.js +1 -0
- package/dist/knowledge/guard-puzzle.js +1 -1
- package/dist/knowledge/guard-render.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-submission-prompt.js +1 -1
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/guard-translation.js +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/industry-strategy.js +1 -1
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/onchain-constants.d.ts +4 -2
- package/dist/knowledge/onchain-constants.js +1 -1
- package/dist/knowledge/order-ledger.d.ts +1 -1
- package/dist/knowledge/order-ledger.js +1 -1
- package/dist/knowledge/order-puzzle.d.ts +3 -0
- package/dist/knowledge/order-risk.d.ts +1 -1
- package/dist/knowledge/passport-ledger.d.ts +12 -0
- package/dist/knowledge/passport-ledger.js +1 -1
- package/dist/knowledge/payment-tracker.js +1 -1
- package/dist/knowledge/protocol-facts.d.ts +1 -0
- package/dist/knowledge/protocol-facts.js +1 -1
- package/dist/knowledge/repository-write-semantics.d.ts +1 -1
- package/dist/knowledge/repository-write-semantics.js +1 -1
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/service-ledger.d.ts +14 -0
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/strategy-manuals.js +1 -1
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +4 -0
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +2 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/allocation-advice.d.ts +8 -1
- package/dist/participation/allocation-advice.js +1 -1
- package/dist/participation/game-context.d.ts +25 -0
- package/dist/participation/game-context.js +1 -0
- package/dist/participation/node-action-advisor.d.ts +64 -0
- package/dist/participation/node-action-advisor.js +1 -0
- package/dist/participation/radar-core.js +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +1 -0
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/migration-planner.d.ts +2 -2
- package/dist/playbooks/service-build/migration-planner.js +1 -1
- package/dist/playbooks/service-build/object-panorama.d.ts +13 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +8 -0
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/service-quote.js +1 -1
- package/dist/playbooks/service-build/service-quote.spec.js +1 -1
- package/dist/review/index.js +1 -1
- package/dist/review/repository.js +1 -1
- package/dist/role/intent.d.ts +23 -0
- package/dist/role/intent.js +1 -0
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +4 -0
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/allocation.d.ts +3 -0
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +52 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +3 -0
- package/dist/schema/call/error-codes.d.ts +1 -1
- package/dist/schema/call/error-codes.js +1 -1
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +10 -0
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/order.d.ts +2 -0
- package/dist/schema/call/order.js +1 -1
- package/dist/schema/call/progress.js +1 -1
- package/dist/schema/call/repository.d.ts +4 -0
- package/dist/schema/call/semantic.d.ts +6 -0
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +34 -0
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/keeper/index.d.ts +2 -0
- package/dist/schema/local/index.d.ts +33 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +2 -0
- package/dist/schema/operations.d.ts +26 -0
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +484 -0
- package/dist/schema/query/bi.d.ts +2 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +60 -48
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +13 -7
- package/dist/schemas/account_operation.schema.json +1 -1
- package/dist/schemas/benchmark_migration_operation.output.json +8 -5
- package/dist/schemas/benchmark_migration_operation.schema.json +5 -4
- package/dist/schemas/bridge_operation.output.json +13 -7
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/keeper_operation.output.json +12 -7
- package/dist/schemas/local_cache_operation.output.json +34 -7
- package/dist/schemas/local_cache_operation.schema.json +16 -1
- package/dist/schemas/local_history_operation.output.json +13 -7
- package/dist/schemas/local_info_operation.output.json +13 -7
- package/dist/schemas/local_info_operation.schema.json +5 -1
- package/dist/schemas/local_mark_operation.output.json +13 -7
- package/dist/schemas/messenger_operation.output.json +12 -7
- package/dist/schemas/monitor_events.output.json +12 -7
- package/dist/schemas/monitor_subscription.output.json +12 -7
- package/dist/schemas/onchain_events.output.json +67 -18
- package/dist/schemas/onchain_events.schema.json +4 -0
- package/dist/schemas/onchain_operations.output.json +81 -24
- package/dist/schemas/onchain_operations.schema.json +226 -111
- package/dist/schemas/onchain_operations_allocation.schema.json +9 -5
- package/dist/schemas/onchain_operations_arbitration.schema.json +3 -3
- package/dist/schemas/onchain_operations_contact.schema.json +1 -1
- package/dist/schemas/onchain_operations_demand.schema.json +3 -3
- package/dist/schemas/onchain_operations_gen_passport.schema.json +1 -1
- package/dist/schemas/onchain_operations_guard.schema.json +99 -63
- package/dist/schemas/onchain_operations_machine.schema.json +10 -1
- package/dist/schemas/onchain_operations_order.schema.json +7 -3
- package/dist/schemas/onchain_operations_progress.schema.json +2 -2
- package/dist/schemas/onchain_operations_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_repository.schema.json +5 -1
- package/dist/schemas/onchain_operations_reward.schema.json +4 -4
- package/dist/schemas/onchain_operations_service.schema.json +74 -16
- package/dist/schemas/onchain_operations_treasury.schema.json +7 -7
- package/dist/schemas/onchain_table_data.output.json +16 -7
- package/dist/schemas/persona_operation.output.json +1387 -0
- package/dist/schemas/persona_operation.schema.json +219 -0
- package/dist/schemas/query_toolkit.output.json +96 -59
- package/dist/schemas/query_toolkit.schema.json +8 -0
- package/dist/schemas/workflow_operation.schema.json +1 -1
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/dispatch-expectations.js +1 -1
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain-name-registration.d.ts +11 -0
- package/dist/tools/handlers/onchain-name-registration.js +1 -1
- package/dist/tools/handlers/onchain.d.ts +4 -0
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/review-chain.js +1 -1
- package/dist/tools/move-fn-index.gen.js +1 -1
- package/dist/tools/registry/local.js +1 -1
- package/dist/tools/registry/onchain.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{handleOnchainOperations}from'../handlers/onchain.js';import{applyOnchainRules}from'../rules-hook.js';import{createToolMeta,OnchainOperationsSchema,CallOutputSchema}from'../../schema/index.js';export const ONCHAIN_TOOLS=[{'name':'onchain_operations','handler':handleOnchainOperations,'config':{'title':'⛓️\x20On-chain\x20Operations','summary':'On-chain\x20ops:\x20service,\x20machine,\x20progress,\x20repository,\x20arbitration,\x20etc.','description':'On-chain\x20operations\x20for\x20WoWok\x20object:\x20service\x20(marketplace\x20listings),\x20machine\x20(workflow\x20templates),\x20progress\x20(order\x20tracking),\x20repository\x20(on-chain\x20database),\x20arbitration\x20(dispute\x20resolution),\x20contact\x20(IM\x20management),\x20treasury\x20(team\x20funds),\x20reward\x20(incentive\x20pools),\x20allocation\x20(auto-distribution),\x20permission\x20(access\x20control),\x20guard\x20(programmable\x20trust\x20rules),\x20personal\x20(public\x20profile),\x20payment\x20(direct\x20coin\x20transfers),\x20demand\x20(service\x20requests),\x20order\x20(order\x20management),\x20gen_passport\x20(verified\x20credentials),\x20proof\x20(on-chain\x20proof\x20objects),\x20gen_proof\x20(generate\x20proof\x20shortcut).\x0a\x0a🎯\x20NETWORK\x20(CRITICAL):\x20never\x20guess\x20or\x20hardcode\x20a\x20network.\x20OMIT\x20env.network\x20—\x20the\x20runtime\x20stamps\x20the\x20user\x27s\x20CURRENT\x20network\x20(the\x20client\x27s\x20UI\x20selection)\x20onto\x20every\x20call;\x20the\x20confirmation\x20card\x20and\x20response\x20echo\x20the\x20actual\x20network.\x20Set\x20env.network\x20ONLY\x20when\x20the\x20user\x20explicitly\x20names\x20a\x20different\x20network\x20(a\x20mismatch\x20pauses\x20for\x20user\x20confirmation).\x0a\x0a💰\x20FUND\x20SAFETY\x20(service/arbitration/treasury/reward/allocation/payment):\x20amounts\x20are\x20parsed\x20against\x20the\x20target\x20object\x27s\x20IMMUTABLE\x20generic\x20token\x20type\x20(e.g.\x20Treasury<USDT>\x20accepts\x20ONLY\x20USDT\x20—\x20mismatched\x20coins/token_types\x20are\x20BLOCKED\x20before\x20execution).\x20Monetary\x20input\x20with\x20unresolvable\x20token\x20precision\x20is\x20BLOCKED\x20(never\x20guesses\x20decimals)\x20with\x20known-token\x20suggestions;\x20retry\x20once\x20the\x20token\x20info\x20resolves.\x20Display-format\x20amounts\x20like\x20\x222WOW\x22\x20are\x20converted\x20to\x20raw\x20u64\x20using\x20the\x20token\x27s\x20own\x20decimals.\x0a\x0a🔒\x20GUARD\x20PRESET\x20BINDINGS:\x20objects\x20declare\x20preset\x20slots\x20where\x20guard\x20submissions\x20gain\x20business\x20meaning\x20—\x20Reward\x20reads\x20claim\x20recipient\x20(address)\x20/\x20amount\x20(u64)\x20/\x20expiration_time\x20(claim\x20deadline;\x20contract\x20asserts\x20clock\x20≤\x20expiration_time);\x20Allocation\x20reads\x20split\x20payee\x20(address)\x20and\x20Rate\x20(basis\x20points,\x20must\x20complete\x2010000\x20unless\x20a\x20Surplus\x20entry\x20exists);\x20Demand\x20reads\x20the\x20presented\x20service\x20(address);\x20Treasury\x20reads\x20deposit/withdraw\x20amounts\x20(number)\x20—\x20external_withdraw\x20is\x20a\x20PAYMENT\x20AUTHORIZATION;\x20Repository\x20reads\x20row\x20key\x20(address)\x20and\x20row\x20data\x20(any\x20type);\x20Arbitration\x20reads\x20vote\x20weight\x20(number)\x20and\x20usage_guard\x20(dispute-opening\x20gate);\x20Machine\x20Forward\x20requires\x20retained_submissions\x20as\x20mandatory\x20evidence.\x20When\x20configuring\x20rewards\x20for\x20staff:\x20consider\x20an\x20owner\x20fund-recovery\x20escape\x20guard\x20(Signer\x20recipient\x20+\x20GuardU64Identifier\x20amount\x20+\x20Clock-based\x20lock)\x20—\x20claim\x20is\x20the\x20ONLY\x20exit\x20from\x20a\x20Reward\x27s\x20balance\x20(owner_receive\x20extracts\x20RECEIVED\x20objects,\x20never\x20the\x20balance).\x20relationship_profile\x20surfaces\x20these\x20creator/user\x20semantics\x20on\x20touched\x20objects.\x0a\x0a🌐\x20SCENARIO\x20TOPOLOGY:\x20object\x20fields\x20that\x20reference\x20other\x20objects\x20are\x20SCENARIO\x20BRIDGES,\x20not\x20data\x20pointers\x20—\x20Demand.present(Service)\x20welds\x20need-expression\x20and\x20product-listing\x20into\x20a\x20matchmaking\x20capability\x20that\x20belongs\x20to\x20neither\x20object\x20alone;\x20Order\x20copies\x20the\x20Service\x27s\x20machine\x20at\x20creation\x20(order\x20keeps\x20its\x20own\x20fulfillment\x20path);\x20Service\x20pre-binds\x20arbitrations\x20+\x20compensation_fund\x20(fairness:\x20E_ARBITRATION_PERMISSION_CONFLICT\x20rejects\x20arbitrations\x20sharing\x20the\x20service\x27s\x20own\x20permission);\x20um\x20binds\x20a\x20Contact\x20per\x20object;\x20permission\x20fields\x20route\x20ALL\x20admin\x20operations\x20through\x20one\x20governance\x20backbone.\x20Whole\x20applications\x20are\x20BRIDGE\x20CHAINS\x20(standard\x20e-commerce:\x20qualification→purchase→communication→fulfillment→escrow_split→incentive;\x20procurement\x20tender:\x20supply_match→…→dispute).\x20relationship_profile\x20auto-surfaces\x20the\x20bridges\x20implied\x20by\x20a\x20topology\x27s\x20touched\x20objects\x20(K3\x2003\x20§3.5).\x0a\x0a⚡\x20MACHINE\x20FORWARD\x20LOCK\x20(threshold\x20design):\x20each\x20forward\x20is\x20SINGLE-OPERATOR-LOCKED\x20—\x20it\x20contributes\x20its\x20weight\x20AT\x20MOST\x20ONCE\x20(a\x20second\x20operator\x20re-executing\x20the\x20same\x20accomplished\x20forward\x20aborts\x20E_NOT_THE_HOLDER).\x20A\x20Pair\x27s\x20maximum\x20achievable\x20weight\x20=\x20sum\x20of\x20its\x20DISTINCT\x20forward\x20weights;\x20if\x20that\x20sum\x20<\x20threshold\x20the\x20transition\x20can\x20never\x20migrate\x20(workflow\x20stuck).\x20Multi-operator\x20cooperation\x20(threshold\x20>\x201)\x20MUST\x20use\x20one\x20DISTINCT\x20forward\x20per\x20contributing\x20operator\x20(e.g.\x20threshold\x202\x20→\x20begin_a\x20+\x20begin_b,\x20each\x20weight\x201)\x20—\x20never\x20one\x20forward\x20reused\x20by\x20several\x20people.\x20machine-risk\x20R-M1-12/13\x20and\x20machine-confirm\x20C-12\x20flag\x20such\x20designs\x20before\x20publish.\x0a\x0a💡\x20Schema\x20hint:\x20call\x20the\x20OTHER\x20tool\x20`schema_query`\x20with\x20action=\x27get\x27\x20and\x20name=\x27onchain_operations\x27\x20to\x20retrieve\x20the\x20complete\x20parameter\x20schema.\x20For\x20individual\x20operation\x20schemas\x20(e.g.,\x20\x27onchain_operations_permission\x27),\x20use\x20schema_query\x20with\x20action=\x27list_operations\x27\x20to\x20see\x20all\x20available\x20operation\x20schemas.','inputSchema':OnchainOperationsSchema,'outputSchema':CallOutputSchema,'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':!![]},'_meta':createToolMeta('operation',['service','machine','progress','repository','arbitration','contact','treasury','reward','allocation','permission','guard','personal','payment','demand','order','gen_passport','proof','gen_proof','on-chain','blockchain'])},'applyRules':applyOnchainRules,'timeoutMs':0x1d4c0}];
|
|
1
|
+
import{handleOnchainOperations}from'../handlers/onchain.js';import{applyOnchainRules}from'../rules-hook.js';import{createToolMeta,OnchainOperationsSchema,CallOutputSchema}from'../../schema/index.js';export const ONCHAIN_TOOLS=[{'name':'onchain_operations','handler':handleOnchainOperations,'config':{'title':'⛓️\x20On-chain\x20Operations','summary':'On-chain\x20ops:\x20service,\x20machine,\x20progress,\x20repository,\x20arbitration,\x20etc.','description':'On-chain\x20operations\x20for\x20WoWok\x20object:\x20service\x20(marketplace\x20listings),\x20machine\x20(workflow\x20templates),\x20progress\x20(order\x20tracking),\x20repository\x20(on-chain\x20database),\x20arbitration\x20(dispute\x20resolution),\x20contact\x20(IM\x20management),\x20treasury\x20(team\x20funds),\x20reward\x20(incentive\x20pools),\x20allocation\x20(auto-distribution),\x20permission\x20(access\x20control),\x20guard\x20(programmable\x20trust\x20rules),\x20personal\x20(public\x20profile),\x20payment\x20(direct\x20coin\x20transfers),\x20demand\x20(service\x20requests),\x20order\x20(order\x20management),\x20gen_passport\x20(verified\x20credentials),\x20proof\x20(on-chain\x20proof\x20objects),\x20gen_proof\x20(generate\x20proof\x20shortcut).\x0a\x0a🎯\x20NETWORK\x20(CRITICAL):\x20never\x20guess\x20or\x20hardcode\x20a\x20network.\x20OMIT\x20env.network\x20—\x20the\x20runtime\x20stamps\x20the\x20user\x27s\x20CURRENT\x20network\x20(the\x20client\x27s\x20UI\x20selection)\x20onto\x20every\x20call;\x20the\x20confirmation\x20card\x20and\x20response\x20echo\x20the\x20actual\x20network.\x20Set\x20env.network\x20ONLY\x20when\x20the\x20user\x20explicitly\x20names\x20a\x20different\x20network\x20(a\x20mismatch\x20pauses\x20for\x20user\x20confirmation).\x0a\x0a💰\x20FUND\x20SAFETY\x20(service/arbitration/treasury/reward/allocation/payment):\x20amounts\x20are\x20parsed\x20against\x20the\x20target\x20object\x27s\x20IMMUTABLE\x20generic\x20token\x20type\x20(e.g.\x20Treasury<USDT>\x20accepts\x20ONLY\x20USDT\x20—\x20mismatched\x20coins/token_types\x20are\x20BLOCKED\x20before\x20execution).\x20Monetary\x20input\x20with\x20unresolvable\x20token\x20precision\x20is\x20BLOCKED\x20(never\x20guesses\x20decimals)\x20with\x20known-token\x20suggestions;\x20retry\x20once\x20the\x20token\x20info\x20resolves.\x20Display-format\x20amounts\x20like\x20\x222WOW\x22\x20are\x20converted\x20to\x20raw\x20u64\x20using\x20the\x20token\x27s\x20own\x20decimals.\x0a\x0a🔒\x20GUARD\x20PRESET\x20BINDINGS:\x20objects\x20declare\x20preset\x20slots\x20where\x20guard\x20submissions\x20gain\x20business\x20meaning\x20—\x20Reward\x20reads\x20claim\x20recipient\x20(address)\x20/\x20amount\x20(u64)\x20/\x20expiration_time\x20(claim\x20deadline;\x20contract\x20asserts\x20clock\x20≤\x20expiration_time);\x20Allocation\x20reads\x20split\x20payee\x20(address)\x20and\x20Rate\x20(basis\x20points,\x20must\x20complete\x2010000\x20unless\x20a\x20Surplus\x20entry\x20exists);\x20Demand\x20reads\x20the\x20presented\x20service\x20(address);\x20Treasury\x20reads\x20deposit/withdraw\x20amounts\x20(number)\x20—\x20external_withdraw\x20is\x20a\x20PAYMENT\x20AUTHORIZATION;\x20Repository\x20reads\x20row\x20key\x20(address)\x20and\x20row\x20data\x20(any\x20type);\x20Arbitration\x20reads\x20vote\x20weight\x20(number)\x20and\x20usage_guard\x20(dispute-opening\x20gate);\x20Machine\x20Forward\x20requires\x20retained_submissions\x20as\x20mandatory\x20evidence.\x20When\x20configuring\x20rewards\x20for\x20staff:\x20consider\x20an\x20owner\x20fund-recovery\x20escape\x20guard\x20(Signer\x20recipient\x20+\x20GuardU64Identifier\x20amount\x20+\x20Clock-based\x20lock)\x20—\x20claim\x20is\x20the\x20ONLY\x20exit\x20from\x20a\x20Reward\x27s\x20balance\x20(owner_receive\x20extracts\x20RECEIVED\x20objects,\x20never\x20the\x20balance).\x20relationship_profile\x20surfaces\x20these\x20creator/user\x20semantics\x20on\x20touched\x20objects.\x0a\x0a🌐\x20SCENARIO\x20TOPOLOGY:\x20object\x20fields\x20that\x20reference\x20other\x20objects\x20are\x20SCENARIO\x20BRIDGES,\x20not\x20data\x20pointers\x20—\x20Demand.present(Service)\x20welds\x20need-expression\x20and\x20product-listing\x20into\x20a\x20matchmaking\x20capability\x20that\x20belongs\x20to\x20neither\x20object\x20alone;\x20Order\x20copies\x20the\x20Service\x27s\x20machine\x20at\x20creation\x20(order\x20keeps\x20its\x20own\x20fulfillment\x20path);\x20Service\x20pre-binds\x20arbitrations\x20+\x20compensation_fund\x20(fairness:\x20E_ARBITRATION_PERMISSION_CONFLICT\x20rejects\x20arbitrations\x20sharing\x20the\x20service\x27s\x20own\x20permission);\x20um\x20binds\x20a\x20Contact\x20per\x20object;\x20permission\x20fields\x20route\x20ALL\x20admin\x20operations\x20through\x20one\x20governance\x20backbone.\x20Whole\x20applications\x20are\x20BRIDGE\x20CHAINS\x20(standard\x20e-commerce:\x20qualification→purchase→communication→fulfillment→escrow_split→incentive;\x20procurement\x20tender:\x20supply_match→…→dispute).\x20relationship_profile\x20auto-surfaces\x20the\x20bridges\x20implied\x20by\x20a\x20topology\x27s\x20touched\x20objects\x20(K3\x2003\x20§3.5).\x0a\x0a⚡\x20MACHINE\x20FORWARD\x20LOCK\x20(threshold\x20design):\x20each\x20forward\x20is\x20SINGLE-OPERATOR-LOCKED\x20—\x20it\x20contributes\x20its\x20weight\x20AT\x20MOST\x20ONCE\x20(a\x20second\x20operator\x20re-executing\x20the\x20same\x20accomplished\x20forward\x20aborts\x20E_NOT_THE_HOLDER).\x20A\x20Pair\x27s\x20maximum\x20achievable\x20weight\x20=\x20sum\x20of\x20its\x20DISTINCT\x20forward\x20weights;\x20if\x20that\x20sum\x20<\x20threshold\x20the\x20transition\x20can\x20never\x20migrate\x20(workflow\x20stuck).\x20Multi-operator\x20cooperation\x20(threshold\x20>\x201)\x20MUST\x20use\x20one\x20DISTINCT\x20forward\x20per\x20contributing\x20operator\x20(e.g.\x20threshold\x202\x20→\x20begin_a\x20+\x20begin_b,\x20each\x20weight\x201)\x20—\x20never\x20one\x20forward\x20reused\x20by\x20several\x20people.\x20machine-risk\x20R-M1-12/13\x20and\x20machine-confirm\x20C-12\x20flag\x20such\x20designs\x20before\x20publish.\x0a\x0a💡\x20Schema\x20hint:\x20call\x20the\x20OTHER\x20tool\x20`schema_query`\x20with\x20action=\x27get\x27\x20and\x20name=\x27onchain_operations\x27\x20to\x20retrieve\x20the\x20complete\x20parameter\x20schema.\x20For\x20individual\x20operation\x20schemas\x20(e.g.,\x20\x27onchain_operations_permission\x27),\x20use\x20schema_query\x20with\x20action=\x27list_operations\x27\x20to\x20see\x20all\x20available\x20operation\x20schemas.\x0a\x0a🏷️\x20AUTO\x20NAMING:\x20a\x20successful\x20creation\x20auto-registers\x20the\x20primary\x20created\x20object\x20in\x20the\x20local\x20name\x20index\x20as\x20<type>_<last-6-hex>\x20(e.g.\x20guard_a1b2c3)\x20unless\x20you\x20supplied\x20a\x20name\x20—\x20you\x20NEVER\x20need\x20local_mark_operation\x20add\x20after\x20a\x20create;\x20keep\x20the\x20returned\x20address\x20(or\x20the\x20derived\x20name)\x20and\x20reference\x20either\x20everywhere.','inputSchema':OnchainOperationsSchema,'outputSchema':CallOutputSchema,'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':!![]},'_meta':createToolMeta('operation',['service','machine','progress','repository','arbitration','contact','treasury','reward','allocation','permission','guard','personal','payment','demand','order','gen_passport','proof','gen_proof','on-chain','blockchain'])},'applyRules':applyOnchainRules,'timeoutMs':0x1d4c0}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{handleWatchQueryOperations,handleOnchainTableData,handleOnchainEvents,handleWowokInfo}from'../handlers/query.js';import{handleSchemaQuery}from'../handlers/schema-query.js';import{createToolMeta,WatchQueryOperationsSchema,WatchQueryOperationsResultSchema,OnchainTableDataSchema,OnchainTableDataResultSchema,OnchainEventsInputSchema,OnchainEventsResultSchema,ProtocolInfoQuerySchema,ProtocolInfoResultSchema,SchemaQueryInputSchema,SchemaQueryOutputSchema}from'../../schema/index.js';export const QUERY_TOOLS=[{'name':'query_toolkit','handler':handleWatchQueryOperations,'timeoutMs':0x493e0,'config':{'title':'🔍\x20Data\x20Query\x20Toolkit','summary':'Query\x20on-chain\x20objects,\x20balances,\x20profiles,\x20history,\x20tokens,\x20topology\x20(21\x20types).','description':'WOWOK\x20data\x20query\x20toolkit\x20—\x2021\x20query\x20types\x20covering\x20local\x20device\x20data\x20and\x20on-chain\x20blockchain\x20data:\x0a\x0a'+'LOCAL\x20(device-only,\x20never\x20on-chain):\x0a'+'1.\x20local_mark_list\x20—\x20Query\x20your\x20LOCAL\x20address\x20book:\x20maps\x20human-readable\x20names\x20to\x20blockchain\x20addresses\x20with\x20optional\x20tags.\x20Use\x20to\x20resolve\x20names→addresses\x20or\x20find\x20addresses\x20by\x20tag.\x0a'+'2.\x20account_list\x20—\x20Query\x20your\x20LOCAL\x20accounts\x20(addresses,\x20messenger\x20status,\x20suspension\x20state).\x20Use\x20filter.includePubkey=true\x20to\x20also\x20include\x20public\x20keys.\x20Use\x20to\x20discover\x20available\x20accounts\x20before\x20operations.\x20NOTE:\x20local\x20accounts\x20are\x20just\x20ONE\x20form\x20of\x20distributed\x20account\x20—\x20WoWok\x20serves\x20ANY\x20account\x20on\x20ANY\x20device;\x20every\x20on-chain/BI\x20query\x20below\x20also\x20accepts\x20any\x200x\x20address\x20(LocalMark\x20names\x20are\x20a\x20convenience,\x20not\x20a\x20requirement).\x0a'+'3.\x20local_info_list\x20—\x20Query\x20your\x20LOCAL\x20private\x20info:\x20sensitive\x20data\x20like\x20delivery\x20addresses,\x20phone\x20numbers,\x20contacts\x20stored\x20ONLY\x20on\x20this\x20device.\x0a'+'4.\x20token_list\x20—\x20Query\x20cached\x20token\x20metadata:\x20symbol,\x20decimals,\x20icon\x20URL,\x20description\x20for\x20tokens\x20previously\x20fetched\x20from\x20chain.\x20Use\x20to\x20look\x20up\x20token\x20precision/decimals\x20before\x20performing\x20token\x20operations.\x20Returns:\x20TokenTypeInfo[]\x20(type,\x20alias,\x20name,\x20symbol,\x20decimals,\x20iconUrl).\x0a'+'5.\x20account_balance\x20—\x20Query\x20an\x20account\x27s\x20coin\x20balance\x20OR\x20Paginated\x20coin\x20objects.\x20Use\x20balance=true\x20for\x20total\x20amount,\x20or\x20coin={cursor,limit}\x20to\x20list\x20individual\x20coin\x20objects.\x20Supports\x20multi-token\x20via\x20token_type\x20parameter.\x20Results\x20include\x20`_money_display`\x20with\x20unit-converted\x20values\x20+\x20decimals\x20reminder.\x20LIVE\x20QUERY\x20(no\x20cache\x20—\x20no_cache\x20not\x20needed).\x20If\x20the\x20input\x20is\x20an\x20on-chain\x20OBJECT\x20(e.g.\x20a\x20Treasury\x20mark\x20name),\x20the\x20result\x20auto-routes\x20to\x20that\x20object\x27s\x20\x27balance\x27\x20field\x20with\x20a\x20hint\x20—\x20wallet\x20gas\x20balances\x20vs\x20object\x20funds\x20are\x20different\x20concepts.\x0a'+'6.\x20local_names\x20—\x20Query\x20local\x20names\x20by\x20a\x20list\x20of\x20addresses.\x20For\x20each\x20address,\x20returns\x20the\x20resolved\x20account\x20name\x20(if\x20exists)\x20and\x20local\x20mark\x20name\x20(if\x20exists).\x20Returns:\x20{\x20account?,\x20local_mark?,\x20address\x20}[].\x0a\x0a'+'ONCHAIN\x20(blockchain):\x0a'+'7.\x20onchain_personal_profile\x20—\x20Query\x20any\x20user\x27s\x20PUBLIC\x20on-chain\x20profile:\x20social\x20links,\x20reputation\x20(likes/dislikes),\x20personal\x20info\x20records,\x20voting\x20history,\x20referrer.\x0a'+'8.\x20onchain_objects\x20—\x20Batch\x20query\x20on-chain\x20WOWOK\x20objects\x20by\x20ID\x20or\x20name:\x20supports\x20Service,\x20Machine,\x20Order,\x20Treasury,\x20Reward,\x20Arb,\x20Personal,\x20Contact,\x20and\x20more.\x20Monetary\x20fields\x20include\x20`_money_display`\x20annotations\x20(token\x20type\x20from\x20the\x20object\x27s\x20immutable\x20generic).\x0a'+'9.\x20onchain_received\x20—\x20Query\x20objects\x20(Payments,\x20Tokens,\x20NFTs)\x20received\x20by\x20a\x20specific\x20object.\x20Supports\x20pagination\x20and\x20type\x20filter.\x20CoinWrapper\x20mode\x20returns\x20token-aware\x20`_money_display`.\x0a'+'10.\x20onchain_transaction\x20—\x20Verify\x20what\x20a\x20specific\x20transaction\x20did\x20on-chain\x20(status,\x20object\x20changes,\x20balance\x20changes,\x20gas,\x20events).\x20Balance\x20changes\x20include\x20`_money_display`\x20(unit-converted\x20via\x20each\x20change\x27s\x20own\x20coin_type;\x20signed\x20amounts\x20supported).\x0a'+'11.\x20onchain_block\x20—\x20Query\x20ONE\x20checkpoint\x20(block)\x20by\x20sequence\x20number\x20or\x20digest;\x20returns\x20the\x20RAW\x20fullnode\x20checkpoint\x20summary\x20verbatim\x20(sequence,\x20digest,\x20timestamp,\x20tx\x20count,\x20epoch).\x20Block-level\x20facts\x20—\x20distinct\x20from\x20onchain_transaction\x20(per-tx\x20proof).\x0a'+'12.\x20onchain_object_history\x20—\x20FORENSICS:\x20all\x20transactions\x20that\x20touched\x20an\x20object\x20(auditing\x20only\x20—\x20prefer\x20assemble_context\x20for\x20AI\x20context\x20building).\x0a'+'13.\x20onchain_address_activity\x20—\x20FORENSICS:\x20an\x20address\x27s\x20transaction\x20history\x20(auditing\x20only).\x20direction=\x27sent\x27\x20(default)\x20lists\x20transactions\x20SENT\x20BY\x20the\x20address;\x20direction=\x27received\x27\x20lists\x20transactions\x20that\x20delivered\x20objects/coins\x20TO\x20it\x20(inbound\x20—\x20the\x20route\x20for\x20\x27when\x20did\x20this\x20arrive\x27\x20without\x20knowing\x20the\x20sender).\x0a'+'14.\x20token_value_convert\x20—\x20Convert\x20between\x20raw\x20on-chain\x20smallest\x20units\x20(u64)\x20and\x20human\x20unit\x20values\x20in\x20EITHER\x20direction\x20(e.g.\x20\x222200000000\x22\x20↔\x20\x222.2\x22\x20WOW).\x20Unit→raw\x20is\x20REFUSED\x20when\x20token\x20precision\x20cannot\x20be\x20resolved\x20(never\x20guesses\x20decimals).\x0a'+'15.\x20address_profile\x20—\x20Unified\x20address\x20profile:\x20classifies\x20an\x20address\x20(user\x20/\x20business\x20object\x20/\x20system\x20singleton),\x20then\x20batches\x20identity\x20+\x20reputation\x20(like/dislike/favor)\x20+\x20order/contact\x20membership\x20+\x20core/tx\x20reverse\x20bindings\x20+\x20the\x20object\x20itself.\x20For\x20Service\x20addresses\x20the\x20result\x20merges\x20a\x20service_analysis\x20block\x20(description\x20/\x20payment\x20token\x20/\x20shelf\x20split\x20/\x20location\x20/\x20on-chain\x20last\x20update).\x20The\x20one-stop\x20\x27who/what\x20is\x20this\x20address\x27\x20entry.\x0a'+'16.\x20address_profiles\x20—\x20BATCH\x20form\x20of\x20address_profile\x20(up\x20to\x2050\x20addresses\x20in\x20ONE\x20call):\x20same\x20per-address\x20shape\x20—\x20classification,\x20identity,\x20reputation\x20votes,\x20memberships,\x20reverse\x20bindings,\x20object,\x20activity,\x20role\x20evidence,\x20plus\x20the\x20service_analysis\x20merge\x20for\x20Service\x20addresses.\x20List\x20views\x20needing\x20profiles\x20for\x20many\x20rows\x20should\x20ALWAYS\x20prefer\x20this\x20over\x20N\x20single\x20calls.\x20Returns:\x20(AddressProfile\x20|\x20null)[]\x20(result\x20order\x20matches\x20the\x20request).\x0a'+'17.\x20service_supply_chain\x20—\x20Resolve\x20a\x20Service\x27s\x20transparent\x20sub-order\x20purchasing\x20graph\x20(K3\x2023\x20§3.6):\x20reads\x20the\x20bound\x20Machine\x27s\x20frozen\x20forwards,\x20finds\x20purchasing-commitment\x20Guards,\x20and\x20returns\x20each\x20forward\x27s\x20purchased\x20sub-services\x20+\x20required\x20sub-order\x20proof\x20fields.\x20Use\x20for\x20buyer\x20due-diligence,\x20compose_service,\x20anti_cheat\x20(shell-merchant\x20detection),\x20merchant\x20self-check,\x20or\x20Watch\x20relation\x20expansion.\x0a'+'18.\x20workspace_lists\x20—\x20ONE-CALL\x20Quick\x20Access\x20workspace\x20object\x20lists\x20for\x20an\x20account\x20(treasuries/repositories/contacts/machines/rewards/others)\x20via\x20the\x20permission\x20reverse\x20chain,\x20TTL-cached.\x0a'+'19.\x20marks_of_account\x20—\x20Like/Favor\x20list:\x20every\x20address\x20(object\x20or\x20user)\x20the\x20account\x20ever\x20liked/disliked/favored,\x20deduplicated,\x20with\x20the\x20CURRENT\x20active\x20vote\x20kinds\x20per\x20target\x20(voter\x20Resource\x20mark\x20table\x20+\x20EntityLinker\x20clock),\x20TTL-cached.\x0a'+'20.\x20migration_preflight\x20—\x20Cross-network\x20build\x20detection:\x20report\x20an\x20account\x27s\x20Services/Machines/Treasuries/etc.\x20on\x20a\x20source\x20network\x20(default\x20testnet)\x20vs\x20target\x20network\x20(default\x20mainnet),\x20plus\x20a\x20business-facing\x20checklist\x20of\x20settings\x20to\x20confirm/change\x20when\x20migrating\x20(payment\x20token\x20/\x20location\x20/\x20arbitration\x20/\x20WIP\x20/\x20gas).\x0a'+'21.\x20onchain_topology\x20—\x20Read-only\x20on-chain\x20TOPOLOGY\x20network\x20around\x20ONE\x20seed\x20address\x20(any\x20EOA/object\x20or\x20LocalMark\x20name):\x20batched\x20multi-hop\x20BFS\x20over\x20the\x20machine-readable\x20EdgeSchema\x20—\x20nodes\x20+\x20typed\x20edges\x20(F=field\x20/\x20R=reverse-index\x20/\x20W=workflow\x20/\x20M=money-flow\x20/\x20S=social)\x20with\x20retention\x20semantics\x20(complete/bounded/window/membership/derived),\x20the\x20structural\x20workflow\x20subgraph\x20+\x20terminal\x20set\x20of\x20each\x20reached\x20Machine,\x20structural\x20completion\x20of\x20every\x20Order\x20reached,\x20and\x20R/A/O/G\x20analyzer\x20findings.\x20Use\x20for\x20multi-hop\x20relationship/permission/fund-flow\x20questions,\x20risk/arbitrage/opportunity\x20scans,\x20and\x20\x27what\x20is\x20connected\x20to\x20what\x20and\x20how\x20strongly\x27\x20due\x20diligence.\x20Truncation/gap/budget\x20markers\x20are\x20always\x20reported\x20honestly.\x0a\x0a'+'For\x20dynamic\x20table\x20data\x20queries\x20(pagination,\x20table\x20items),\x20use\x20the\x20\x27onchain_table_data\x27\x20tool.\x20For\x20state-transition\x20events,\x20use\x20the\x20\x27onchain_events\x27\x20tool.\x0a\x0a'+'🌐\x20Network\x20parameter:\x20on-chain\x20query\x20types\x20accept\x20`network`\x20and\x20`context_network`\x20INTERCHANGEABLY\x20—\x20either\x20spelling\x20is\x20normalized\x20to\x20the\x20right\x20field\x20before\x20validation,\x20and\x20the\x20response\x20echoes\x20the\x20resolved\x20network\x20(`network`\x20+\x20`network_source`)\x20so\x20results\x20can\x20never\x20be\x20silently\x20misattributed.\x20The\x20different\x20key\x20names\x20per\x20query\x20type\x20are\x20a\x20display\x20convention,\x20NOT\x20a\x20trap:\x20passing\x20the\x20opposite\x20spelling\x20still\x20works.\x20local_*\x20/\x20account_list\x20/\x20token_list\x20queries\x20are\x20device-local\x20and\x20network-free\x20BY\x20DESIGN\x20—\x20they\x20ignore\x20a\x20network\x20key\x20rather\x20than\x20erroring.\x0a\x0a'+'🕒\x20Runtime\x20freshness:\x20when\x20an\x20observed\x20behavior\x20contradicts\x20documented\x20schema/knowledge\x20text,\x20FIRST\x20check\x20the\x20running\x20process\x20is\x20not\x20stale\x20via\x20wowok_buildin_info\x20info=\x27upgrade_check\x27\x20—\x20its\x20build_stamp\x20reports\x20mcp_dist_stale\x20/\x20sdk_dist_stale\x20(source-newer-than-dist\x20detection)\x20and\x20runtime_health\x20before\x20you\x20classify\x20the\x20mismatch\x20as\x20a\x20design\x20defect.\x0a\x0a'+'💡\x20Schema\x20hint:\x20call\x20the\x20OTHER\x20tool\x20`schema_query`\x20with\x20action=\x27get\x27\x20and\x20name=\x27query_toolkit\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20with\x20all\x20query\x20types\x20and\x20field\x20definitions.','inputSchema':WatchQueryOperationsSchema,'outputSchema':WatchQueryOperationsResultSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('query',['watch','query','on-chain','local','events','objects','tokens','balance','profile','block'])}},{'name':'onchain_table_data','handler':handleOnchainTableData,'config':{'title':'📊\x20Query\x20WoWok\x20On-chain\x20Table\x20Data','summary':'Query\x20on-chain\x20dynamic\x20field\x20tables\x20with\x20pagination\x20(table\x20+\x20table-item\x20queries).','description':'Query\x20the\x20dynamic\x20table\x20data\x20of\x20on-chain\x20objects\x20(ONE-TIME\x20query\x20—\x20NOT\x20a\x20realtime\x20subscription).\x20Supports\x20paginated\x20table\x20queries\x20and\x20specific\x20table\x20item\x20lookups.\x20Each\x20table\x20item\x20belongs\x20to\x20a\x20parent\x20object\x20type\x20and\x20has\x20a\x20specific\x20meaning:\x0a\x0a'+'1.\x20onchain_table\x20—\x20Paginated\x20query\x20of\x20ANY\x20object\x27s\x20dynamic\x20fields\x20table\x20(Parent:\x20any\x20object).\x20Returns\x20all\x20entries\x20with\x20keys,\x20types,\x20and\x20object\x20IDs.\x20Use\x20to\x20explore\x20all\x20sub-items\x20of\x20an\x20object.\x0a'+'2.\x20onchain_table_item_repository_data\x20—\x20Query\x20a\x20record\x20from\x20a\x20Repository\x27s\x20on-chain\x20key-value\x20database\x20(Parent:\x20Repository).\x20Key:\x20name\x20+\x20entity\x20(address\x20or\x20number).\x20Returns\x20the\x20stored\x20data\x20record\x20with\x20typed\x20value.\x0a'+'3.\x20onchain_table_item_permission_perm\x20—\x20Query\x20a\x20permission\x20entry\x20from\x20a\x20Permission\x20object\x27s\x20access\x20control\x20table\x20(Parent:\x20Permission).\x20Key:\x20user\x20address\x20or\x20Guard\x20ID.\x20Returns\x20the\x20permission\x20list\x20(perm[])\x20granted\x20to\x20that\x20user/guard.\x0a'+'4.\x20onchain_table_item_entity_registrar\x20—\x20Query\x20an\x20entity\x27s\x20registration\x20record\x20from\x20the\x20GLOBAL\x20EntityRegistrar\x20(Parent:\x20system\x20EntityRegistrar).\x20Key:\x20user\x20address.\x20Returns\x20registration\x20info:\x20description,\x20referrer,\x20records,\x20mark_object.\x0a'+'5.\x20onchain_table_item_entity_linker\x20—\x20Query\x20community\x20votes/endorsements\x20for\x20an\x20entity\x20from\x20the\x20GLOBAL\x20EntityLinker\x20(Parent:\x20system\x20EntityLinker).\x20Key:\x20entity\x20address.\x20Returns\x20vote\x20records\x20(likes/dislikes/favor)\x20showing\x20community\x20trust.\x0a'+'6.\x20onchain_table_item_entity_contact\x20—\x20Query\x20which\x20customer-service\x20Contacts\x20an\x20entity\x20is\x20a\x20member\x20of,\x20from\x20the\x20GLOBAL\x20EntityContact\x20reverse\x20index\x20(Parent:\x200xaa9).\x20Key:\x20entity\x20address.\x20Returns\x20contact\x20memberships\x20(contact\x20+\x20time).\x0a'+'7.\x20onchain_table_item_object_linker_core\x20—\x20Query\x20which\x20bounded\x20core\x20objects\x20(Service/Machine/Treasury/Reward/Demand/Arbitration/Arb/Contact)\x20bind\x20to\x20a\x20target,\x20from\x20the\x20GLOBAL\x20ObjectLinkerCore\x20reverse\x20index\x20(Parent:\x200xaae).\x20Lossless\x20fixed;\x20use\x20for\x20DEFAULT\x20reverse\x20lookups\x20(e.g.\x20which\x20services\x20use\x20a\x20permission).\x0a'+'8.\x20onchain_table_item_object_linker_tx\x20—\x20Query\x20which\x20operational\x20objects\x20(Order/Progress/Payment/Allocation/Guard/Permission)\x20bind\x20to\x20a\x20target,\x20from\x20the\x20GLOBAL\x20ObjectLinkerTx\x20reverse\x20index\x20(Parent:\x200xaaf).\x20Lossy\x20FIFO\x20(recent\x20only);\x20use\x20for\x20ORDER/PROGRESS/operational\x20reverse\x20lookups\x20(e.g.\x20which\x20orders\x20a\x20service\x20has).\x0a'+'9.\x20onchain_table_item_reward_record\x20—\x20Query\x20a\x20reward\x20claim\x20record\x20from\x20a\x20Reward\x20object\x27s\x20distribution\x20table\x20(Parent:\x20Reward).\x20Key:\x20recipient\x20address.\x20Returns\x20claim\x20history:\x20guard\x20used,\x20total\x20claimed,\x20per-claim\x20details.\x0a'+'10.\x20onchain_table_item_demand_presenter\x20—\x20Query\x20a\x20demand\x20submission\x20from\x20a\x20Demand\x20object\x27s\x20presenter\x20table\x20(Parent:\x20Demand).\x20Key:\x20presenter\x20address.\x20Returns\x20submission\x20details:\x20recommendation,\x20service,\x20feedback,\x20acceptance\x20score.\x0a'+'11.\x20onchain_table_item_treasury_history\x20—\x20Query\x20a\x20payment\x20record\x20from\x20a\x20Treasury\x27s\x20history\x20table\x20(Parent:\x20Treasury).\x20Key:\x20payment\x20ID\x20(address).\x20Returns\x20payment\x20details:\x20operation\x20type,\x20signer,\x20amount,\x20external\x20guard.\x0a'+'12.\x20onchain_table_item_machine_node\x20—\x20Query\x20a\x20workflow\x20node\x20definition\x20from\x20a\x20Machine\x20object\x27s\x20node\x20table\x20(Parent:\x20Machine).\x20Key:\x20node\x20name\x20(string).\x20Returns\x20node\x20configuration:\x20pairs,\x20forwards,\x20guards,\x20thresholds.\x0a'+'13.\x20onchain_table_item_progress_history\x20—\x20Query\x20a\x20progress\x20step\x20record\x20from\x20a\x20Progress\x20object\x27s\x20history\x20table\x20(Parent:\x20Progress).\x20Key:\x20sequence\x20number\x20(u64).\x20Returns\x20step\x20details:\x20node,\x20next_node,\x20session\x20state,\x20time.\x0a'+'14.\x20onchain_table_item_address_mark\x20—\x20Query\x20a\x20PUBLIC\x20on-chain\x20name/tag\x20mark\x20from\x20an\x20AddressMark\x20object\x27s\x20table\x20(Parent:\x20AddressMark).\x20Key:\x20address.\x20Returns\x20public\x20labels:\x20entity,\x20name,\x20tags[].\x20Unlike\x20local\x20marks,\x20these\x20are\x20published\x20on-chain.\x0a'+'15.\x20onchain_table_item_entity_order\x20—\x20Query\x20the\x20orders\x20a\x20user\x20participates\x20in,\x20from\x20the\x20GLOBAL\x20EntityOrder\x20reverse\x20index\x20(Parent:\x200xaa8).\x20Key:\x20user\x20address.\x20Returns\x20order\x20addresses\x20with\x20role\x20bitmask\x20(1=owner,\x202=agent)\x20and\x20last\x20role-update\x20time\x20(raw\x20index,\x20without\x20full\x20order\x20objects).\x0a'+'16.\x20onchain_orders_of_user\x20—\x20Query\x20EVERY\x20order\x20a\x20user\x20participates\x20in\x20(as\x20owner\x20and/or\x20agent)\x20via\x20the\x20GLOBAL\x20EntityOrder\x20reverse\x20index\x20(Parent:\x200xaa8),\x20resolving\x20each\x20to\x20its\x20full\x20on-chain\x20Order\x20object.\x20Each\x20result\x20includes\x20role\x20info:\x20role\x20bitmask,\x20is_owner,\x20is_agent,\x20role\x20update\x20time,\x20and\x20the\x20full\x20order.\x20Use\x20to\x20get\x20a\x20user\x27s\x20complete\x20order\x20list\x20with\x20role\x20attributes.\x0a'+'17.\x20onchain_orders_of_users\x20—\x20Cross-account\x20variant:\x20query\x20EVERY\x20order\x20that\x20ANY\x20of\x20the\x20given\x20accounts\x20participates\x20in,\x20merged\x20into\x20ONE\x20deduped\x20list\x20(per-account\x20roles\x20merged)\x20with\x20SERVER-SIDE\x20enrichment\x20identical\x20to\x20the\x20Service\x20panorama\x20Orders\x20tab\x20—\x20amount/item\x20prices\x20as\x20human\x20token\x20display,\x20progress\x20node\x20+\x20entry\x20time,\x20allocation\x20fund\x20state,\x20updated\x20time.\x20Non-blocking\x20per-account\x20errors\x20(account_errors).\x20Use\x20for\x20a\x20local\x20wallet\x27s\x20complete\x20order\x20list\x20in\x20ONE\x20call.\x0a'+'18.\x20onchain_table_item_generic\x20—\x20Query\x20a\x20generic\x20table\x20item\x20from\x20ANY\x20object\x27s\x20dynamic\x20fields\x20(Parent:\x20any\x20object).\x20Supports\x20arbitrary\x20key\x20types\x20(address,\x20u64,\x20string,\x20object\x20ID,\x20etc.).\x20Use\x20for\x20custom\x20objects\x20and\x20general-purpose\x20table\x20lookups.\x20Returns:\x20ObjectBase\x20|\x20undefined.\x0a'+'19.\x20address_profile\x20—\x20unified\x20address\x20profile\x20(classification\x20+\x20identity\x20+\x20reputation\x20+\x20memberships\x20+\x20reverse\x20bindings\x20+\x20the\x20object,\x20with\x20a\x20merged\x20service_analysis\x20block\x20for\x20Service\x20addresses).\x20Also\x20available\x20via\x20query_toolkit\x20(query_type=\x22address_profile\x22).\x0a'+'20.\x20service_supply_chain\x20—\x20resolve\x20a\x20Service\x27s\x20transparent\x20sub-order\x20purchasing\x20graph.\x20Also\x20available\x20via\x20query_toolkit\x20(query_type=\x22service_supply_chain\x22).\x0a\x0a'+'🧭\x20Tool\x20selection\x20(avoid\x20confusion):\x20use\x20query_toolkit\x20to\x20query\x20a\x20WHOLE\x20object/balance/profile;\x20use\x20onchain_events\x20to\x20query\x20state-transition\x20events;\x20use\x20onchain_table_data\x20(this\x20tool)\x20to\x20paginate\x20over\x20ONE\x20object\x27s\x20dynamic\x20table\x20fields\x20or\x20read\x20a\x20single\x20table\x20item.\x0a\x0a'+'💡\x20Schema\x20hint:\x20call\x20the\x20OTHER\x20tool\x20`schema_query`\x20with\x20action=\x27get\x27\x20and\x20name=\x27onchain_table_data\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20with\x20all\x20table\x20item\x20types\x20and\x20field\x20definitions.','inputSchema':OnchainTableDataSchema,'outputSchema':OnchainTableDataResultSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('table\x20query',['on-chain','table','dynamic\x20fields','pagination','repository','permission','reward','demand','treasury','machine','progress'])}},{'name':'onchain_events','handler':handleOnchainEvents,'config':{'title':'📅\x20Query\x20WoWok\x20On-chain\x20Events','summary':'Watch\x20on-chain\x20state-transition\x20and\x20fund-flow\x20events\x20(all\x2022\x20framework\x20types).','description':'Query\x20on-chain\x20WoWok\x20events\x20by\x20type\x20(a\x20ONE-TIME\x20paginated\x20query\x20—\x20NOT\x20a\x20realtime\x20subscription).\x20All\x2022\x20framework\x20event\x20types\x20are\x20supported,\x20grouped\x20by\x20business\x20family:\x20market\x20opportunity\x20(ServiceEvent,\x20ArbitrationEvent,\x20DemandChangedEvent,\x20DemandPresentEvent),\x20order/workflow\x20(NewOrderEvent,\x20ProgressEvent),\x20dispute\x20(ArbEvent,\x20VoteEvent,\x20FeedbackEvent,\x20ArbStatementEvent),\x20reputation\x20(DemandFeedbackEvent,\x20NewEntityEvent,\x20VoteEvictedEvent),\x20fund\x20flow\x20(AllocationEvent,\x20TreasuryEvent,\x20RewardClaimEvent,\x20RewardFundEvent,\x20RewardWithdrawEvent,\x20NewPaymentEvent),\x20service\x20administration\x20(OrderAllocatorsAppendedEvent),\x20audit/watch\x20(PermissionChangedEvent,\x20RepositoryDataOverwriteEvent).\x20Use\x20pagination\x20cursor\x20for\x20fetching\x20large\x20result\x20sets.\x0a\x0a💰\x20NewPaymentEvent\x20is\x20the\x20universal\x20fund-flow\x20receipt:\x20every\x20treasury\x20withdraw/deposit,\x20allocation\x20split\x20and\x20compensation\x20payout\x20mints\x20one.\x20Its\x20`from_object`\x20is\x20the\x20internal-only\x20funding-source\x20object\x20(Treasury/Allocation/Service\x20—\x20set\x20by\x20the\x20framework,\x20never\x20user\x20code),\x20and\x20`info.for_object`/`info.for_guard`\x20are\x20user-settable\x20business\x20routing\x20hints;\x20both\x20are\x20registered\x20as\x20on-chain\x20affiliations.\x20RewardWithdrawEvent\x20is\x20the\x20only\x20non-claim\x20outflow\x20from\x20a\x20reward\x20pool\x20(permission-gated)\x20and\x20mirrors\x20the\x20claim\x20event\x27s\x20balance_left.\x20NewOrderEvent.amount\x20includes\x20`_money_display`\x20annotation\x20(unit-converted\x20via\x20the\x20order\x27s\x20Service\x20generic\x20token\x20type;\x20raw-only\x20with\x20retry\x20hint\x20when\x20precision\x20is\x20unavailable).\x0a\x0a🧭\x20Tool\x20selection\x20(avoid\x20confusion):\x20use\x20query_toolkit\x20to\x20query\x20whole\x20objects/balances/profiles;\x20use\x20onchain_table_data\x20to\x20query\x20ONE\x20object\x27s\x20dynamic\x20table\x20fields;\x20use\x20onchain_events\x20(this\x20tool)\x20to\x20query\x20EVENTS\x20by\x20type.\x0a\x0a💡\x20Schema\x20hint:\x20call\x20the\x20OTHER\x20tool\x20`schema_query`\x20with\x20action=\x27get\x27\x20and\x20name=\x27onchain_events\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20with\x20all\x20event\x20types\x20and\x20field\x20definitions.','inputSchema':OnchainEventsInputSchema,'outputSchema':OnchainEventsResultSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('watch\x20wowook\x20events',['events','on-chain','arbitration','order','progress','demand','entity'])}},{'name':'wowok_buildin_info','handler':handleWowokInfo,'config':{'title':'ℹ️\x20WoWok\x20Build-in\x20Information','summary':'Getting-started\x20orientation,\x20protocol\x20constants,\x20permissions,\x20bridge\x20tokens,\x20funding\x20guidance,\x20upgrade\x20check.','description':'Query\x20WoWok\x20protocol\x20information:\x20\x27getting\x20started\x27,\x20\x27constants\x27,\x20\x27built-in\x20permissions\x27,\x20\x27common\x20mistakes\x27,\x20\x27guard\x20instructions\x27,\x20\x27current\x20network\x27,\x20\x27value\x20types\x27,\x20\x27mainnet\x20bridge\x20tokens\x27,\x20\x27funding\x20guidance\x27,\x20\x27upgrade_check\x27,\x20or\x20\x27universal_template\x27.\x20Call\x20\x27getting\x20started\x27\x20at\x20conversation\x20start\x20when\x20no\x20WoWok\x20Skill\x20guidance\x20is\x20loaded\x20—\x20it\x20explains\x20what\x20the\x20companion\x20@wowok/skills\x20package\x20is,\x20gives\x20install/doctor/repair\x20commands,\x20best-effort\x20local\x20detection\x20of\x20installed\x20skills,\x20the\x20~20s\x20cold-start\x20window,\x20and\x20maps\x20common\x20goals\x20to\x20sub-tools.\x20Use\x20\x27common\x20mistakes\x27\x20to\x20proactively\x20learn\x20known\x20field-name/unit/workflow\x20pitfalls\x20before\x20submitting\x20an\x20operation\x20(e.g.\x20filter\x20operation:\x22compensation_fund_add\x22).\x20For\x20\x27mainnet\x20bridge\x20tokens\x27:\x20returns\x20cross-chain\x20bridge\x20tokens\x20(ETH,\x20WETH,\x20WBTC,\x20USDC,\x20USDT)\x20with\x20each\x20token\x27s\x20symbol,\x20WOW-side\x20type\x20tag\x20(wowTypeTag),\x20EVM\x20address,\x20decimals,\x20and\x20description.\x20The\x20wowTypeTag\x20(format\x20{address}::{module}::{struct})\x20can\x20be\x20used\x20directly\x20as\x20the\x20`type_parameter`\x20of\x20Service\x20/\x20Treasury\x20/\x20Reward\x20/\x20Allocation\x20objects\x20to\x20set\x20their\x20payment\x20token\x20—\x20e.g.\x20use\x20USDT\x27s\x20wowTypeTag\x20to\x20create\x20a\x20Service\x20that\x20accepts\x20USDT\x20payments.\x20For\x20\x27funding\x20guidance\x27:\x20returns\x20how\x20to\x20obtain\x20WOW\x20gas\x20and\x20payment\x20tokens\x20—\x20testnet\x20faucet,\x20mainnet\x20ETH\x20cross-chain\x20bridge\x20flow,\x20and\x20the\x20WOW\x20mainnet\x20airdrop\x20link.\x20Use\x20this\x20when\x20a\x20user\x20asks\x20how\x20to\x20obtain\x20tokens/gas/funds,\x20or\x20as\x20a\x20proactive\x20first-use\x20reminder.','inputSchema':ProtocolInfoQuerySchema,'outputSchema':ProtocolInfoResultSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('WoWok\x20info',['build-in','getting-started','skills','constants','permissions','guard','network','value-types','bridge-tokens','funding-guidance','faucet','airdrop'])}},{'name':'schema_query','handler':handleSchemaQuery,'config':{'title':'📋\x20Schema\x20Query','summary':'Query\x20JSON\x20schemas\x20for\x20any\x20sub-tool\x20(action:\x20list/get/get_output/search).','description':'Look\x20up\x20JSON\x20Schemas\x20for\x20WoWok\x20MCP\x20tools\x20and\x20on-chain\x20operations.\x20'+'This\x20is\x20the\x20authoritative\x20reference\x20for\x20exact\x20parameter\x20structures,\x20types,\x20and\x20required\x20fields.\x20'+'Always\x20check\x20the\x20schema\x20before\x20calling\x20an\x20unfamiliar\x20tool.\x0a\x0a'+'Actions:\x0a'+'\x20\x20\x27list\x27\x20-\x20Show\x20all\x20available\x20schemas\x20(tools\x20+\x20on-chain\x20operations).\x20Start\x20here\x20to\x20discover\x20what\x20exists.\x0a'+'\x20\x20\x27get\x27\x20-\x20Fetch\x20the\x20full\x20input\x20JSON\x20Schema\x20by\x20name\x20(e.g.\x20\x27onchain_operations\x27).\x20Use\x20with\x20the\x20\x27name\x27\x20param.\x0a'+'\x20\x20\x27get_output\x27\x20-\x20Fetch\x20the\x20output\x20JSON\x20Schema\x20of\x20a\x20tool\x20by\x20name\x20(e.g.\x20\x27onchain_operations\x27).\x20Use\x20with\x20the\x20\x27name\x27\x20param.\x20Use\x20this\x20to\x20understand\x20a\x20tool\x27s\x20return\x20value\x20structure.\x0a'+'\x20\x20\x27get_field\x27\x20-\x20Query\x20a\x20single\x20field\x20by\x20dot-path\x20(e.g.\x20field_path=\x27data.node.nodes.0.pairs\x27).\x20Cheaper\x20than\x20\x27get\x27\x20when\x20you\x20only\x20need\x20one\x20subtree.\x0a'+'\x20\x20\x27search\x27\x20-\x20Find\x20schemas\x20by\x20keyword,\x20matching\x20name/title/description.\x20Use\x20with\x20the\x20\x27query\x27\x20param.\x0a'+'\x20\x20\x27list_operations\x27\x20-\x20Show\x20only\x20on-chain\x20operation\x20schemas\x20(prefixed\x20\x27onchain_operations_\x27).\x20Narrower\x20than\x20\x27list\x27.\x0a'+'\x20\x20\x27get_guard_templates\x27\x20-\x20Guard\x20creation\x20templates\x20+\x20best\x20practices\x20(e.g.\x20signer_verification,\x20progress_node_check).\x20Omit\x20\x27template\x27\x20to\x20list\x20all.\x0a'+'\x20\x20\x27get_tool_reference\x27\x20-\x20MCP\x20tool\x20usage\x20reference\x20(summaries,\x20actions,\x20prerequisites,\x20notes).\x20Pass\x20name=\x27<tool>\x27\x20for\x20one\x20tool,\x20query=\x27<keyword>\x27\x20to\x20search,\x20or\x20omit\x20for\x20the\x20full\x20catalog.\x0a'+'\x20\x20\x27get_guard_design_patterns\x27\x20-\x20Curated\x20Guard\x20design\x20patterns\x20(business\x20requirement\x20→\x20logic\x20tree\x20template).\x20Pass\x20name=\x27<pattern_id>\x27,\x20query=\x27<host>\x27\x20(e.g.\x20\x27service_buy_guard\x27,\x20\x27machine_forward\x27),\x20or\x20omit\x20for\x20the\x20full\x20catalog.\x0a'+'\x20\x20\x27get_safety_rules\x27\x20-\x20Safety\x20rule\x20tables\x20sunk\x20from\x20the\x20wowok-safety\x20skill:\x20object\x20reuse,\x20immutability-after-publish,\x20LOCAL/ONCHAIN/QUERY\x20classification,\x20naming\x20conventions.\x0a'+'\x20\x20\x27analyze_guard_semantics\x27\x20-\x20Parse\x20+\x20evaluate\x20ANY\x20Guard\x20JSON\x20(pass\x20guard=<json>):\x20rendered\x20logic\x20tree,\x20lint\x20+\x20risk\x20diagnostics,\x20and\x20a\x20party-perspective\x20fact\x20sheet\x20(who\x20can\x20trigger,\x20time\x20constraints,\x20evidence\x20required,\x20data\x20sources\x20read\x20—\x20including\x20which\x20are\x20mutable\x20on-chain).\x20BOTH\x20transacting\x20parties\x20should\x20run\x20this\x20before\x20relying\x20on\x20a\x20Guard\x20(e.g.\x20a\x20refund\x20or\x20fund-release\x20Guard\x20is\x20a\x20free-form\x20game\x20condition\x20tree,\x20not\x20necessarily\x20tied\x20to\x20any\x20Machine\x20node).','inputSchema':SchemaQueryInputSchema,'outputSchema':SchemaQueryOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]},'_meta':createToolMeta('schema',['schema','json-schema','types','structure','validation','reference'])}}];
|
|
1
|
+
import{handleWatchQueryOperations,handleOnchainTableData,handleOnchainEvents,handleWowokInfo}from'../handlers/query.js';import{handleSchemaQuery}from'../handlers/schema-query.js';import{createToolMeta,WatchQueryOperationsSchema,WatchQueryOperationsResultSchema,OnchainTableDataSchema,OnchainTableDataResultSchema,OnchainEventsInputSchema,OnchainEventsResultSchema,ProtocolInfoQuerySchema,ProtocolInfoResultSchema,SchemaQueryInputSchema,SchemaQueryOutputSchema}from'../../schema/index.js';export const QUERY_TOOLS=[{'name':'query_toolkit','handler':handleWatchQueryOperations,'timeoutMs':0x493e0,'config':{'title':'🔍\x20Data\x20Query\x20Toolkit','summary':'Query\x20on-chain\x20objects,\x20balances,\x20profiles,\x20history,\x20tokens,\x20topology\x20(21\x20types).','description':'WOWOK\x20data\x20query\x20toolkit\x20—\x2021\x20query\x20types\x20covering\x20local\x20device\x20data\x20and\x20on-chain\x20blockchain\x20data:\x0a\x0a'+'LOCAL\x20(device-only,\x20never\x20on-chain):\x0a'+'1.\x20local_mark_list\x20—\x20Query\x20your\x20LOCAL\x20address\x20book:\x20maps\x20human-readable\x20names\x20to\x20blockchain\x20addresses\x20with\x20optional\x20tags.\x20Use\x20to\x20resolve\x20names→addresses\x20or\x20find\x20addresses\x20by\x20tag.\x0a'+'2.\x20account_list\x20—\x20Query\x20your\x20LOCAL\x20accounts\x20(addresses,\x20messenger\x20status,\x20suspension\x20state).\x20Use\x20filter.includePubkey=true\x20to\x20also\x20include\x20public\x20keys.\x20Use\x20to\x20discover\x20available\x20accounts\x20before\x20operations.\x20NOTE:\x20local\x20accounts\x20are\x20just\x20ONE\x20form\x20of\x20distributed\x20account\x20—\x20WoWok\x20serves\x20ANY\x20account\x20on\x20ANY\x20device;\x20every\x20on-chain/BI\x20query\x20below\x20also\x20accepts\x20any\x200x\x20address\x20(LocalMark\x20names\x20are\x20a\x20convenience,\x20not\x20a\x20requirement).\x0a'+'3.\x20local_info_list\x20—\x20Query\x20your\x20LOCAL\x20private\x20info:\x20sensitive\x20data\x20like\x20delivery\x20addresses,\x20phone\x20numbers,\x20contacts\x20stored\x20ONLY\x20on\x20this\x20device.\x0a'+'4.\x20token_list\x20—\x20Query\x20cached\x20token\x20metadata:\x20symbol,\x20decimals,\x20icon\x20URL,\x20description\x20for\x20tokens\x20previously\x20fetched\x20from\x20chain.\x20Use\x20to\x20look\x20up\x20token\x20precision/decimals\x20before\x20performing\x20token\x20operations.\x20Returns:\x20TokenTypeInfo[]\x20(type,\x20alias,\x20name,\x20symbol,\x20decimals,\x20iconUrl).\x0a'+'5.\x20account_balance\x20—\x20Query\x20an\x20account\x27s\x20coin\x20balance\x20OR\x20Paginated\x20coin\x20objects.\x20Use\x20balance=true\x20for\x20total\x20amount,\x20or\x20coin={cursor,limit}\x20to\x20list\x20individual\x20coin\x20objects.\x20Supports\x20multi-token\x20via\x20token_type\x20parameter.\x20Results\x20include\x20`_money_display`\x20with\x20unit-converted\x20values\x20+\x20decimals\x20reminder.\x20LIVE\x20QUERY\x20(no\x20cache\x20—\x20no_cache\x20not\x20needed).\x20If\x20the\x20input\x20is\x20an\x20on-chain\x20OBJECT\x20(e.g.\x20a\x20Treasury\x20mark\x20name),\x20the\x20result\x20auto-routes\x20to\x20that\x20object\x27s\x20\x27balance\x27\x20field\x20with\x20a\x20hint\x20—\x20wallet\x20gas\x20balances\x20vs\x20object\x20funds\x20are\x20different\x20concepts.\x0a'+'6.\x20local_names\x20—\x20Query\x20local\x20names\x20by\x20a\x20list\x20of\x20addresses.\x20For\x20each\x20address,\x20returns\x20the\x20resolved\x20account\x20name\x20(if\x20exists)\x20and\x20local\x20mark\x20name\x20(if\x20exists).\x20Returns:\x20{\x20account?,\x20local_mark?,\x20address\x20}[].\x0a\x0a'+'ONCHAIN\x20(blockchain):\x0a'+'7.\x20onchain_personal_profile\x20—\x20Query\x20any\x20user\x27s\x20PUBLIC\x20on-chain\x20profile:\x20social\x20links,\x20reputation\x20(likes/dislikes),\x20personal\x20info\x20records,\x20voting\x20history,\x20referrer.\x0a'+'8.\x20onchain_objects\x20—\x20Batch\x20query\x20on-chain\x20WOWOK\x20objects\x20by\x20ID\x20or\x20name:\x20supports\x20Service,\x20Machine,\x20Order,\x20Treasury,\x20Reward,\x20Arb,\x20Personal,\x20Contact,\x20and\x20more.\x20Monetary\x20fields\x20include\x20`_money_display`\x20annotations\x20(token\x20type\x20from\x20the\x20object\x27s\x20immutable\x20generic).\x0a'+'9.\x20onchain_received\x20—\x20Query\x20objects\x20(Payments,\x20Tokens,\x20NFTs)\x20received\x20by\x20a\x20specific\x20object.\x20Supports\x20pagination\x20and\x20type\x20filter.\x20CoinWrapper\x20mode\x20returns\x20token-aware\x20`_money_display`;\x20for\x20an\x20OBJECT\x20holder\x20(e.g.\x20an\x20Order\x20escrow)\x20whose\x20wrappers\x20the\x20owned-object\x20index\x20cannot\x20see,\x20the\x20records\x20are\x20recovered\x20from\x20the\x20allocation\x20transaction\x20effects\x20and\x20the\x20envelope\x20sets\x20`read_path=\x27allocation-transaction-effects\x27`.\x0a'+'10.\x20onchain_transaction\x20—\x20Verify\x20what\x20a\x20specific\x20transaction\x20did\x20on-chain\x20(status,\x20object\x20changes,\x20balance\x20changes,\x20gas,\x20events).\x20Balance\x20changes\x20include\x20`_money_display`\x20(unit-converted\x20via\x20each\x20change\x27s\x20own\x20coin_type;\x20signed\x20amounts\x20supported).\x0a'+'11.\x20onchain_block\x20—\x20Query\x20ONE\x20checkpoint\x20(block)\x20by\x20sequence\x20number\x20or\x20digest;\x20returns\x20the\x20RAW\x20fullnode\x20checkpoint\x20summary\x20verbatim\x20(sequence,\x20digest,\x20timestamp,\x20tx\x20count,\x20epoch).\x20Block-level\x20facts\x20—\x20distinct\x20from\x20onchain_transaction\x20(per-tx\x20proof).\x0a'+'12.\x20onchain_object_history\x20—\x20FORENSICS:\x20all\x20transactions\x20that\x20touched\x20an\x20object\x20(auditing\x20only\x20—\x20prefer\x20assemble_context\x20for\x20AI\x20context\x20building).\x0a'+'13.\x20onchain_address_activity\x20—\x20FORENSICS:\x20an\x20address\x27s\x20transaction\x20history\x20(auditing\x20only).\x20direction=\x27sent\x27\x20(default)\x20lists\x20transactions\x20SENT\x20BY\x20the\x20address;\x20direction=\x27received\x27\x20lists\x20transactions\x20that\x20delivered\x20objects/coins\x20TO\x20it\x20(inbound\x20—\x20the\x20route\x20for\x20\x27when\x20did\x20this\x20arrive\x27\x20without\x20knowing\x20the\x20sender).\x0a'+'14.\x20token_value_convert\x20—\x20Convert\x20between\x20raw\x20on-chain\x20smallest\x20units\x20(u64)\x20and\x20human\x20unit\x20values\x20in\x20EITHER\x20direction\x20(e.g.\x20\x222200000000\x22\x20↔\x20\x222.2\x22\x20WOW).\x20Unit→raw\x20is\x20REFUSED\x20when\x20token\x20precision\x20cannot\x20be\x20resolved\x20(never\x20guesses\x20decimals).\x0a'+'15.\x20address_profile\x20—\x20Unified\x20address\x20profile:\x20classifies\x20an\x20address\x20(user\x20/\x20business\x20object\x20/\x20system\x20singleton),\x20then\x20batches\x20identity\x20+\x20reputation\x20(like/dislike/favor)\x20+\x20order/contact\x20membership\x20+\x20core/tx\x20reverse\x20bindings\x20+\x20the\x20object\x20itself.\x20For\x20Service\x20addresses\x20the\x20result\x20merges\x20a\x20service_analysis\x20block\x20(description\x20/\x20payment\x20token\x20/\x20shelf\x20split\x20/\x20location\x20/\x20on-chain\x20last\x20update).\x20The\x20one-stop\x20\x27who/what\x20is\x20this\x20address\x27\x20entry.\x0a'+'16.\x20address_profiles\x20—\x20BATCH\x20form\x20of\x20address_profile\x20(up\x20to\x2050\x20addresses\x20in\x20ONE\x20call):\x20same\x20per-address\x20shape\x20—\x20classification,\x20identity,\x20reputation\x20votes,\x20memberships,\x20reverse\x20bindings,\x20object,\x20activity,\x20role\x20evidence,\x20plus\x20the\x20service_analysis\x20merge\x20for\x20Service\x20addresses.\x20List\x20views\x20needing\x20profiles\x20for\x20many\x20rows\x20should\x20ALWAYS\x20prefer\x20this\x20over\x20N\x20single\x20calls.\x20Returns:\x20(AddressProfile\x20|\x20null)[]\x20(result\x20order\x20matches\x20the\x20request).\x0a'+'17.\x20service_supply_chain\x20—\x20Resolve\x20a\x20Service\x27s\x20transparent\x20sub-order\x20purchasing\x20graph\x20(K3\x2023\x20§3.6):\x20reads\x20the\x20bound\x20Machine\x27s\x20frozen\x20forwards,\x20finds\x20purchasing-commitment\x20Guards,\x20and\x20returns\x20each\x20forward\x27s\x20purchased\x20sub-services\x20+\x20required\x20sub-order\x20proof\x20fields.\x20Use\x20for\x20buyer\x20due-diligence,\x20compose_service,\x20anti_cheat\x20(shell-merchant\x20detection),\x20merchant\x20self-check,\x20or\x20Watch\x20relation\x20expansion.\x0a'+'18.\x20workspace_lists\x20—\x20ONE-CALL\x20Quick\x20Access\x20workspace\x20object\x20lists\x20for\x20an\x20account\x20(treasuries/repositories/contacts/machines/rewards/others)\x20via\x20the\x20permission\x20reverse\x20chain,\x20TTL-cached.\x0a'+'19.\x20marks_of_account\x20—\x20Like/Favor\x20list:\x20every\x20address\x20(object\x20or\x20user)\x20the\x20account\x20ever\x20liked/disliked/favored,\x20deduplicated,\x20with\x20the\x20CURRENT\x20active\x20vote\x20kinds\x20per\x20target\x20(voter\x20Resource\x20mark\x20table\x20+\x20EntityLinker\x20clock),\x20TTL-cached.\x0a'+'20.\x20migration_preflight\x20—\x20Cross-network\x20build\x20detection:\x20report\x20an\x20account\x27s\x20Services/Machines/Treasuries/etc.\x20on\x20a\x20source\x20network\x20(default\x20testnet)\x20vs\x20target\x20network\x20(default\x20mainnet),\x20plus\x20a\x20business-facing\x20checklist\x20of\x20settings\x20to\x20confirm/change\x20when\x20migrating\x20(payment\x20token\x20/\x20location\x20/\x20arbitration\x20/\x20WIP\x20/\x20gas).\x0a'+'21.\x20onchain_topology\x20—\x20Read-only\x20on-chain\x20TOPOLOGY\x20network\x20around\x20ONE\x20seed\x20address\x20(any\x20EOA/object\x20or\x20LocalMark\x20name):\x20batched\x20multi-hop\x20BFS\x20over\x20the\x20machine-readable\x20EdgeSchema\x20—\x20nodes\x20+\x20typed\x20edges\x20(F=field\x20/\x20R=reverse-index\x20/\x20W=workflow\x20/\x20M=money-flow\x20/\x20S=social)\x20with\x20retention\x20semantics\x20(complete/bounded/window/membership/derived),\x20the\x20structural\x20workflow\x20subgraph\x20+\x20terminal\x20set\x20of\x20each\x20reached\x20Machine,\x20structural\x20completion\x20of\x20every\x20Order\x20reached,\x20and\x20R/A/O/G\x20analyzer\x20findings.\x20Use\x20for\x20multi-hop\x20relationship/permission/fund-flow\x20questions,\x20risk/arbitrage/opportunity\x20scans,\x20and\x20\x27what\x20is\x20connected\x20to\x20what\x20and\x20how\x20strongly\x27\x20due\x20diligence.\x20Truncation/gap/budget\x20markers\x20are\x20always\x20reported\x20honestly.\x0a\x0a'+'For\x20dynamic\x20table\x20data\x20queries\x20(pagination,\x20table\x20items),\x20use\x20the\x20\x27onchain_table_data\x27\x20tool.\x20For\x20state-transition\x20events,\x20use\x20the\x20\x27onchain_events\x27\x20tool.\x0a\x0a'+'🌐\x20Network\x20parameter:\x20on-chain\x20query\x20types\x20accept\x20`network`\x20and\x20`context_network`\x20INTERCHANGEABLY\x20—\x20either\x20spelling\x20is\x20normalized\x20to\x20the\x20right\x20field\x20before\x20validation,\x20and\x20the\x20response\x20echoes\x20the\x20resolved\x20network\x20(`network`\x20+\x20`network_source`)\x20so\x20results\x20can\x20never\x20be\x20silently\x20misattributed.\x20The\x20different\x20key\x20names\x20per\x20query\x20type\x20are\x20a\x20display\x20convention,\x20NOT\x20a\x20trap:\x20passing\x20the\x20opposite\x20spelling\x20still\x20works.\x20local_*\x20/\x20account_list\x20/\x20token_list\x20queries\x20are\x20device-local\x20and\x20network-free\x20BY\x20DESIGN\x20—\x20they\x20ignore\x20a\x20network\x20key\x20rather\x20than\x20erroring.\x20onchain_transaction\x20without\x20an\x20explicit\x20network\x20tries\x20the\x20session\x20default\x20first;\x20on\x20a\x20miss\x20it\x20PROBES\x20the\x20remaining\x20networks\x20and\x20answers\x20from\x20wherever\x20the\x20digest\x20is\x20live\x20(`network_source=\x27probed\x27`\x20+\x20result._network_probe\x20name\x20the\x20answering\x20network\x20—\x20never\x20cite\x20a\x20probed\x20result\x20as\x20default-network\x20data;\x20an\x20all-network\x20miss\x20is\x20an\x20authoritative\x20\x22did\x20not\x20commit\x22).\x0a\x0a'+'🕒\x20Runtime\x20freshness:\x20when\x20an\x20observed\x20behavior\x20contradicts\x20documented\x20schema/knowledge\x20text,\x20FIRST\x20check\x20the\x20running\x20process\x20is\x20not\x20stale\x20via\x20wowok_buildin_info\x20info=\x27upgrade_check\x27\x20—\x20its\x20build_stamp\x20reports\x20mcp_dist_stale\x20/\x20sdk_dist_stale\x20(source-newer-than-dist\x20detection)\x20and\x20runtime_health\x20before\x20you\x20classify\x20the\x20mismatch\x20as\x20a\x20design\x20defect.\x0a\x0a'+'💡\x20Schema\x20hint:\x20call\x20the\x20OTHER\x20tool\x20`schema_query`\x20with\x20action=\x27get\x27\x20and\x20name=\x27query_toolkit\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20with\x20all\x20query\x20types\x20and\x20field\x20definitions.','inputSchema':WatchQueryOperationsSchema,'outputSchema':WatchQueryOperationsResultSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('query',['watch','query','on-chain','local','events','objects','tokens','balance','profile','block'])}},{'name':'onchain_table_data','handler':handleOnchainTableData,'config':{'title':'📊\x20Query\x20WoWok\x20On-chain\x20Table\x20Data','summary':'Query\x20on-chain\x20dynamic\x20field\x20tables\x20with\x20pagination\x20(table\x20+\x20table-item\x20queries).','description':'Query\x20the\x20dynamic\x20table\x20data\x20of\x20on-chain\x20objects\x20(ONE-TIME\x20query\x20—\x20NOT\x20a\x20realtime\x20subscription).\x20Supports\x20paginated\x20table\x20queries\x20and\x20specific\x20table\x20item\x20lookups.\x20Each\x20table\x20item\x20belongs\x20to\x20a\x20parent\x20object\x20type\x20and\x20has\x20a\x20specific\x20meaning:\x0a\x0a'+'1.\x20onchain_table\x20—\x20Paginated\x20query\x20of\x20ANY\x20object\x27s\x20dynamic\x20fields\x20table\x20(Parent:\x20any\x20object).\x20Returns\x20all\x20entries\x20with\x20keys,\x20types,\x20and\x20object\x20IDs.\x20Use\x20to\x20explore\x20all\x20sub-items\x20of\x20an\x20object.\x0a'+'2.\x20onchain_table_item_repository_data\x20—\x20Query\x20a\x20record\x20from\x20a\x20Repository\x27s\x20on-chain\x20key-value\x20database\x20(Parent:\x20Repository).\x20Key:\x20name\x20+\x20entity\x20(address\x20or\x20number).\x20Returns\x20the\x20stored\x20data\x20record\x20with\x20typed\x20value.\x0a'+'3.\x20onchain_table_item_permission_perm\x20—\x20Query\x20a\x20permission\x20entry\x20from\x20a\x20Permission\x20object\x27s\x20access\x20control\x20table\x20(Parent:\x20Permission).\x20Key:\x20user\x20address\x20or\x20Guard\x20ID.\x20Returns\x20the\x20permission\x20list\x20(perm[])\x20granted\x20to\x20that\x20user/guard.\x0a'+'4.\x20onchain_table_item_entity_registrar\x20—\x20Query\x20an\x20entity\x27s\x20registration\x20record\x20from\x20the\x20GLOBAL\x20EntityRegistrar\x20(Parent:\x20system\x20EntityRegistrar).\x20Key:\x20user\x20address.\x20Returns\x20registration\x20info:\x20description,\x20referrer,\x20records,\x20mark_object.\x0a'+'5.\x20onchain_table_item_entity_linker\x20—\x20Query\x20community\x20votes/endorsements\x20for\x20an\x20entity\x20from\x20the\x20GLOBAL\x20EntityLinker\x20(Parent:\x20system\x20EntityLinker).\x20Key:\x20entity\x20address.\x20Returns\x20vote\x20records\x20(likes/dislikes/favor)\x20showing\x20community\x20trust.\x0a'+'6.\x20onchain_table_item_entity_contact\x20—\x20Query\x20which\x20customer-service\x20Contacts\x20an\x20entity\x20is\x20a\x20member\x20of,\x20from\x20the\x20GLOBAL\x20EntityContact\x20reverse\x20index\x20(Parent:\x200xaa9).\x20Key:\x20entity\x20address.\x20Returns\x20contact\x20memberships\x20(contact\x20+\x20time).\x0a'+'7.\x20onchain_table_item_object_linker_core\x20—\x20Query\x20which\x20bounded\x20core\x20objects\x20(Service/Machine/Treasury/Reward/Demand/Arbitration/Arb/Contact)\x20bind\x20to\x20a\x20target,\x20from\x20the\x20GLOBAL\x20ObjectLinkerCore\x20reverse\x20index\x20(Parent:\x200xaae).\x20Lossless\x20fixed;\x20use\x20for\x20DEFAULT\x20reverse\x20lookups\x20(e.g.\x20which\x20services\x20use\x20a\x20permission).\x0a'+'8.\x20onchain_table_item_object_linker_tx\x20—\x20Query\x20which\x20operational\x20objects\x20(Order/Progress/Payment/Allocation/Guard/Permission)\x20bind\x20to\x20a\x20target,\x20from\x20the\x20GLOBAL\x20ObjectLinkerTx\x20reverse\x20index\x20(Parent:\x200xaaf).\x20Lossy\x20FIFO\x20(recent\x20only);\x20use\x20for\x20ORDER/PROGRESS/operational\x20reverse\x20lookups\x20(e.g.\x20which\x20orders\x20a\x20service\x20has).\x0a'+'9.\x20onchain_table_item_reward_record\x20—\x20Query\x20a\x20reward\x20claim\x20record\x20from\x20a\x20Reward\x20object\x27s\x20distribution\x20table\x20(Parent:\x20Reward).\x20Key:\x20recipient\x20address.\x20Returns\x20claim\x20history:\x20guard\x20used,\x20total\x20claimed,\x20per-claim\x20details.\x0a'+'10.\x20onchain_table_item_demand_presenter\x20—\x20Query\x20a\x20demand\x20submission\x20from\x20a\x20Demand\x20object\x27s\x20presenter\x20table\x20(Parent:\x20Demand).\x20Key:\x20presenter\x20address.\x20Returns\x20submission\x20details:\x20recommendation,\x20service,\x20feedback,\x20acceptance\x20score.\x0a'+'11.\x20onchain_table_item_treasury_history\x20—\x20Query\x20a\x20payment\x20record\x20from\x20a\x20Treasury\x27s\x20history\x20table\x20(Parent:\x20Treasury).\x20Key:\x20payment\x20ID\x20(address).\x20Returns\x20payment\x20details:\x20operation\x20type,\x20signer,\x20amount,\x20external\x20guard.\x0a'+'12.\x20onchain_table_item_machine_node\x20—\x20Query\x20a\x20workflow\x20node\x20definition\x20from\x20a\x20Machine\x20object\x27s\x20node\x20table\x20(Parent:\x20Machine).\x20Key:\x20node\x20name\x20(string).\x20Returns\x20node\x20configuration:\x20pairs,\x20forwards,\x20guards,\x20thresholds.\x0a'+'13.\x20onchain_table_item_progress_history\x20—\x20Query\x20a\x20progress\x20step\x20record\x20from\x20a\x20Progress\x20object\x27s\x20history\x20table\x20(Parent:\x20Progress).\x20Key:\x20sequence\x20number\x20(u64).\x20Returns\x20step\x20details:\x20node,\x20next_node,\x20session\x20state,\x20time.\x0a'+'14.\x20onchain_table_item_address_mark\x20—\x20Query\x20a\x20PUBLIC\x20on-chain\x20name/tag\x20mark\x20from\x20an\x20AddressMark\x20object\x27s\x20table\x20(Parent:\x20AddressMark).\x20Key:\x20address.\x20Returns\x20public\x20labels:\x20entity,\x20name,\x20tags[].\x20Unlike\x20local\x20marks,\x20these\x20are\x20published\x20on-chain.\x0a'+'15.\x20onchain_table_item_entity_order\x20—\x20Query\x20the\x20orders\x20a\x20user\x20participates\x20in,\x20from\x20the\x20GLOBAL\x20EntityOrder\x20reverse\x20index\x20(Parent:\x200xaa8).\x20Key:\x20user\x20address.\x20Returns\x20order\x20addresses\x20with\x20role\x20bitmask\x20(1=owner,\x202=agent)\x20and\x20last\x20role-update\x20time\x20(raw\x20index,\x20without\x20full\x20order\x20objects).\x0a'+'16.\x20onchain_orders_of_user\x20—\x20Query\x20EVERY\x20order\x20a\x20user\x20participates\x20in\x20(as\x20owner\x20and/or\x20agent)\x20via\x20the\x20GLOBAL\x20EntityOrder\x20reverse\x20index\x20(Parent:\x200xaa8),\x20resolving\x20each\x20to\x20its\x20full\x20on-chain\x20Order\x20object.\x20Each\x20result\x20includes\x20role\x20info:\x20role\x20bitmask,\x20is_owner,\x20is_agent,\x20role\x20update\x20time,\x20and\x20the\x20full\x20order.\x20Use\x20to\x20get\x20a\x20user\x27s\x20complete\x20order\x20list\x20with\x20role\x20attributes.\x0a'+'17.\x20onchain_orders_of_users\x20—\x20Cross-account\x20variant:\x20query\x20EVERY\x20order\x20that\x20ANY\x20of\x20the\x20given\x20accounts\x20participates\x20in,\x20merged\x20into\x20ONE\x20deduped\x20list\x20(per-account\x20roles\x20merged)\x20with\x20SERVER-SIDE\x20enrichment\x20identical\x20to\x20the\x20Service\x20panorama\x20Orders\x20tab\x20—\x20amount/item\x20prices\x20as\x20human\x20token\x20display,\x20progress\x20node\x20+\x20entry\x20time,\x20allocation\x20fund\x20state,\x20updated\x20time.\x20Non-blocking\x20per-account\x20errors\x20(account_errors).\x20Use\x20for\x20a\x20local\x20wallet\x27s\x20complete\x20order\x20list\x20in\x20ONE\x20call.\x0a'+'18.\x20onchain_table_item_generic\x20—\x20Query\x20a\x20generic\x20table\x20item\x20from\x20ANY\x20object\x27s\x20dynamic\x20fields\x20(Parent:\x20any\x20object).\x20Supports\x20arbitrary\x20key\x20types\x20(address,\x20u64,\x20string,\x20object\x20ID,\x20etc.).\x20Use\x20for\x20custom\x20objects\x20and\x20general-purpose\x20table\x20lookups.\x20Returns:\x20ObjectBase\x20|\x20undefined.\x0a'+'19.\x20address_profile\x20—\x20unified\x20address\x20profile\x20(classification\x20+\x20identity\x20+\x20reputation\x20+\x20memberships\x20+\x20reverse\x20bindings\x20+\x20the\x20object,\x20with\x20a\x20merged\x20service_analysis\x20block\x20for\x20Service\x20addresses).\x20Also\x20available\x20via\x20query_toolkit\x20(query_type=\x22address_profile\x22).\x0a'+'20.\x20service_supply_chain\x20—\x20resolve\x20a\x20Service\x27s\x20transparent\x20sub-order\x20purchasing\x20graph.\x20Also\x20available\x20via\x20query_toolkit\x20(query_type=\x22service_supply_chain\x22).\x0a\x0a'+'🧭\x20Tool\x20selection\x20(avoid\x20confusion):\x20use\x20query_toolkit\x20to\x20query\x20a\x20WHOLE\x20object/balance/profile;\x20use\x20onchain_events\x20to\x20query\x20state-transition\x20events;\x20use\x20onchain_table_data\x20(this\x20tool)\x20to\x20paginate\x20over\x20ONE\x20object\x27s\x20dynamic\x20table\x20fields\x20or\x20read\x20a\x20single\x20table\x20item.\x0a\x0a'+'💡\x20Schema\x20hint:\x20call\x20the\x20OTHER\x20tool\x20`schema_query`\x20with\x20action=\x27get\x27\x20and\x20name=\x27onchain_table_data\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20with\x20all\x20table\x20item\x20types\x20and\x20field\x20definitions.','inputSchema':OnchainTableDataSchema,'outputSchema':OnchainTableDataResultSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('table\x20query',['on-chain','table','dynamic\x20fields','pagination','repository','permission','reward','demand','treasury','machine','progress'])}},{'name':'onchain_events','handler':handleOnchainEvents,'config':{'title':'📅\x20Query\x20WoWok\x20On-chain\x20Events','summary':'Watch\x20on-chain\x20state-transition\x20and\x20fund-flow\x20events\x20(all\x2022\x20framework\x20types).','description':'Query\x20on-chain\x20WoWok\x20events\x20by\x20type\x20(a\x20ONE-TIME\x20paginated\x20query\x20—\x20NOT\x20a\x20realtime\x20subscription).\x20All\x2022\x20framework\x20event\x20types\x20are\x20supported,\x20grouped\x20by\x20business\x20family:\x20market\x20opportunity\x20(ServiceEvent,\x20ArbitrationEvent,\x20DemandChangedEvent,\x20DemandPresentEvent),\x20order/workflow\x20(NewOrderEvent,\x20ProgressEvent),\x20dispute\x20(ArbEvent,\x20VoteEvent,\x20FeedbackEvent,\x20ArbStatementEvent),\x20reputation\x20(DemandFeedbackEvent,\x20NewEntityEvent,\x20VoteEvictedEvent),\x20fund\x20flow\x20(AllocationEvent,\x20TreasuryEvent,\x20RewardClaimEvent,\x20RewardFundEvent,\x20RewardWithdrawEvent,\x20NewPaymentEvent),\x20service\x20administration\x20(OrderAllocatorsAppendedEvent),\x20audit/watch\x20(PermissionChangedEvent,\x20RepositoryDataOverwriteEvent).\x20Use\x20pagination\x20cursor\x20for\x20fetching\x20large\x20result\x20sets.\x0a\x0a💰\x20NewPaymentEvent\x20is\x20the\x20universal\x20fund-flow\x20receipt:\x20every\x20treasury\x20withdraw/deposit,\x20allocation\x20split\x20and\x20compensation\x20payout\x20mints\x20one.\x20Its\x20`from_object`\x20is\x20the\x20internal-only\x20funding-source\x20object\x20(Treasury/Allocation/Service\x20—\x20set\x20by\x20the\x20framework,\x20never\x20user\x20code),\x20and\x20`info.for_object`/`info.for_guard`\x20are\x20user-settable\x20business\x20routing\x20hints;\x20both\x20are\x20registered\x20as\x20on-chain\x20affiliations.\x20RewardWithdrawEvent\x20is\x20the\x20only\x20non-claim\x20outflow\x20from\x20a\x20reward\x20pool\x20(permission-gated)\x20and\x20mirrors\x20the\x20claim\x20event\x27s\x20balance_left.\x20NewOrderEvent.amount\x20includes\x20`_money_display`\x20annotation\x20(unit-converted\x20via\x20the\x20order\x27s\x20Service\x20generic\x20token\x20type;\x20raw-only\x20with\x20retry\x20hint\x20when\x20precision\x20is\x20unavailable).\x0a\x0a🧭\x20Tool\x20selection\x20(avoid\x20confusion):\x20use\x20query_toolkit\x20to\x20query\x20whole\x20objects/balances/profiles;\x20use\x20onchain_table_data\x20to\x20query\x20ONE\x20object\x27s\x20dynamic\x20table\x20fields;\x20use\x20onchain_events\x20(this\x20tool)\x20to\x20query\x20EVENTS\x20by\x20type.\x0a\x0a💡\x20Schema\x20hint:\x20call\x20the\x20OTHER\x20tool\x20`schema_query`\x20with\x20action=\x27get\x27\x20and\x20name=\x27onchain_events\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20with\x20all\x20event\x20types\x20and\x20field\x20definitions.','inputSchema':OnchainEventsInputSchema,'outputSchema':OnchainEventsResultSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('watch\x20wowook\x20events',['events','on-chain','arbitration','order','progress','demand','entity'])}},{'name':'wowok_buildin_info','handler':handleWowokInfo,'config':{'title':'ℹ️\x20WoWok\x20Build-in\x20Information','summary':'Getting-started\x20orientation,\x20protocol\x20constants,\x20permissions,\x20bridge\x20tokens,\x20funding\x20guidance,\x20upgrade\x20check.','description':'Query\x20WoWok\x20protocol\x20information:\x20\x27getting\x20started\x27,\x20\x27constants\x27,\x20\x27built-in\x20permissions\x27,\x20\x27common\x20mistakes\x27,\x20\x27guard\x20instructions\x27,\x20\x27current\x20network\x27,\x20\x27value\x20types\x27,\x20\x27mainnet\x20bridge\x20tokens\x27,\x20\x27funding\x20guidance\x27,\x20\x27upgrade_check\x27,\x20or\x20\x27universal_template\x27.\x20Call\x20\x27getting\x20started\x27\x20at\x20conversation\x20start\x20when\x20no\x20WoWok\x20Skill\x20guidance\x20is\x20loaded\x20—\x20it\x20explains\x20what\x20the\x20companion\x20@wowok/skills\x20package\x20is,\x20gives\x20install/doctor/repair\x20commands,\x20best-effort\x20local\x20detection\x20of\x20installed\x20skills,\x20the\x20~20s\x20cold-start\x20window,\x20and\x20maps\x20common\x20goals\x20to\x20sub-tools.\x20Use\x20\x27common\x20mistakes\x27\x20to\x20proactively\x20learn\x20known\x20field-name/unit/workflow\x20pitfalls\x20before\x20submitting\x20an\x20operation\x20(e.g.\x20filter\x20operation:\x22compensation_fund_add\x22).\x20For\x20\x27mainnet\x20bridge\x20tokens\x27:\x20returns\x20cross-chain\x20bridge\x20tokens\x20(ETH,\x20WETH,\x20WBTC,\x20USDC,\x20USDT)\x20with\x20each\x20token\x27s\x20symbol,\x20WOW-side\x20type\x20tag\x20(wowTypeTag),\x20EVM\x20address,\x20decimals,\x20and\x20description.\x20The\x20wowTypeTag\x20(format\x20{address}::{module}::{struct})\x20can\x20be\x20used\x20directly\x20as\x20the\x20`type_parameter`\x20of\x20Service\x20/\x20Treasury\x20/\x20Reward\x20/\x20Allocation\x20objects\x20to\x20set\x20their\x20payment\x20token\x20—\x20e.g.\x20use\x20USDT\x27s\x20wowTypeTag\x20to\x20create\x20a\x20Service\x20that\x20accepts\x20USDT\x20payments.\x20For\x20\x27funding\x20guidance\x27:\x20returns\x20how\x20to\x20obtain\x20WOW\x20gas\x20and\x20payment\x20tokens\x20—\x20testnet\x20faucet,\x20mainnet\x20ETH\x20cross-chain\x20bridge\x20flow,\x20and\x20the\x20WOW\x20mainnet\x20airdrop\x20link.\x20Use\x20this\x20when\x20a\x20user\x20asks\x20how\x20to\x20obtain\x20tokens/gas/funds,\x20or\x20as\x20a\x20proactive\x20first-use\x20reminder.','inputSchema':ProtocolInfoQuerySchema,'outputSchema':ProtocolInfoResultSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('WoWok\x20info',['build-in','getting-started','skills','constants','permissions','guard','network','value-types','bridge-tokens','funding-guidance','faucet','airdrop'])}},{'name':'schema_query','handler':handleSchemaQuery,'config':{'title':'📋\x20Schema\x20Query','summary':'Query\x20JSON\x20schemas\x20for\x20any\x20sub-tool\x20(action:\x20list/get/get_output/search).','description':'Look\x20up\x20JSON\x20Schemas\x20for\x20WoWok\x20MCP\x20tools\x20and\x20on-chain\x20operations.\x20'+'This\x20is\x20the\x20authoritative\x20reference\x20for\x20exact\x20parameter\x20structures,\x20types,\x20and\x20required\x20fields.\x20'+'Always\x20check\x20the\x20schema\x20before\x20calling\x20an\x20unfamiliar\x20tool.\x0a\x0a'+'Actions:\x0a'+'\x20\x20\x27list\x27\x20-\x20Show\x20all\x20available\x20schemas\x20(tools\x20+\x20on-chain\x20operations).\x20Start\x20here\x20to\x20discover\x20what\x20exists.\x0a'+'\x20\x20\x27get\x27\x20-\x20Fetch\x20the\x20full\x20input\x20JSON\x20Schema\x20by\x20name\x20(e.g.\x20\x27onchain_operations\x27).\x20Use\x20with\x20the\x20\x27name\x27\x20param.\x0a'+'\x20\x20\x27get_output\x27\x20-\x20Fetch\x20the\x20output\x20JSON\x20Schema\x20of\x20a\x20tool\x20by\x20name\x20(e.g.\x20\x27onchain_operations\x27).\x20Use\x20with\x20the\x20\x27name\x27\x20param.\x20Use\x20this\x20to\x20understand\x20a\x20tool\x27s\x20return\x20value\x20structure.\x0a'+'\x20\x20\x27get_field\x27\x20-\x20Query\x20a\x20single\x20field\x20by\x20dot-path\x20(e.g.\x20field_path=\x27data.node.nodes.0.pairs\x27).\x20Cheaper\x20than\x20\x27get\x27\x20when\x20you\x20only\x20need\x20one\x20subtree.\x0a'+'\x20\x20\x27search\x27\x20-\x20Find\x20schemas\x20by\x20keyword,\x20matching\x20name/title/description.\x20Use\x20with\x20the\x20\x27query\x27\x20param.\x0a'+'\x20\x20\x27list_operations\x27\x20-\x20Show\x20only\x20on-chain\x20operation\x20schemas\x20(prefixed\x20\x27onchain_operations_\x27).\x20Narrower\x20than\x20\x27list\x27.\x0a'+'\x20\x20\x27get_guard_templates\x27\x20-\x20Guard\x20creation\x20templates\x20+\x20best\x20practices\x20(e.g.\x20signer_verification,\x20progress_node_check).\x20Omit\x20\x27template\x27\x20to\x20list\x20all.\x0a'+'\x20\x20\x27get_tool_reference\x27\x20-\x20MCP\x20tool\x20usage\x20reference\x20(summaries,\x20actions,\x20prerequisites,\x20notes).\x20Pass\x20name=\x27<tool>\x27\x20for\x20one\x20tool,\x20query=\x27<keyword>\x27\x20to\x20search,\x20or\x20omit\x20for\x20the\x20full\x20catalog.\x0a'+'\x20\x20\x27get_guard_design_patterns\x27\x20-\x20Curated\x20Guard\x20design\x20patterns\x20(business\x20requirement\x20→\x20logic\x20tree\x20template).\x20Pass\x20name=\x27<pattern_id>\x27,\x20query=\x27<host>\x27\x20(e.g.\x20\x27service_buy_guard\x27,\x20\x27machine_forward\x27),\x20or\x20omit\x20for\x20the\x20full\x20catalog.\x0a'+'\x20\x20\x27get_safety_rules\x27\x20-\x20Safety\x20rule\x20tables\x20sunk\x20from\x20the\x20wowok-safety\x20skill:\x20object\x20reuse,\x20immutability-after-publish,\x20LOCAL/ONCHAIN/QUERY\x20classification,\x20naming\x20conventions.\x0a'+'\x20\x20\x27analyze_guard_semantics\x27\x20-\x20Parse\x20+\x20evaluate\x20ANY\x20Guard\x20JSON\x20(pass\x20guard=<json>):\x20rendered\x20logic\x20tree,\x20lint\x20+\x20risk\x20diagnostics,\x20and\x20a\x20party-perspective\x20fact\x20sheet\x20(who\x20can\x20trigger,\x20time\x20constraints,\x20evidence\x20required,\x20data\x20sources\x20read\x20—\x20including\x20which\x20are\x20mutable\x20on-chain).\x20BOTH\x20transacting\x20parties\x20should\x20run\x20this\x20before\x20relying\x20on\x20a\x20Guard\x20(e.g.\x20a\x20refund\x20or\x20fund-release\x20Guard\x20is\x20a\x20free-form\x20game\x20condition\x20tree,\x20not\x20necessarily\x20tied\x20to\x20any\x20Machine\x20node).','inputSchema':SchemaQueryInputSchema,'outputSchema':SchemaQueryOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]},'_meta':createToolMeta('schema',['schema','json-schema','types','structure','validation','reference'])}}];
|
package/dist/tools/wrap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{classifyError,buildDataSemantic}from'../schema/call/semantic.js';import{buildClassifiedErrorResult}from'./shared.js';import{shouldRunLightHooks,shouldRunHeavyHooks,recordOperationFailure,recordCriticalRisk,recordCriticalOperation,recordSubstepFailure}from'../harness/auto-escalation.js';import{getHarnessTier,setHarnessTier,isEnabled}from'../config/runtime.js';import{getHarness}from'../harness/index.js';import{recover}from'../harness/recover.js';import{stableOperationId}from'../harness/operation-id.js';import{recordOperationOutcome}from'../experience/index.js';import{recordIndustrySignal}from'../knowledge/flywheel-loop.js';import{getStageCache}from'../playbooks/service-build/index.js';import{SERVICE_BUILD_STAGES}from'../playbooks/service-build/process.js';import{extractAmount,getAmountThreshold,formatAmount}from'../knowledge/safety-rules.js';import{LocalMark,query_serviceContext}from'@wowok/wowok';import{arbitrationVotingLockDetail,auditMachineNodes,computeTerminalReachability,guardTimeProfileDetail,lintReviewLockedTerminals,rewardRefsOf,serviceRewardsUnfundedDetail}from'../knowledge/audit-rules.js';import{lintGuard}from'../knowledge/guard-lint.js';import{parseGuardNodeGates}from'../knowledge/guard-node-gates.js';import{batchQueryObjectsByIds,fetchMachineNodes}from'../graph/onchain/sdk-batch.js';function stageIndexOf(a){const b=SERVICE_BUILD_STAGES['indexOf'](a);return b>=0x0?b:0x0;}export function withTimeout(a,b=0x7530,c='operation'){let d;return Promise['race']([a['finally'](()=>{if(d)clearTimeout(d);}),new Promise((e,f)=>{d=setTimeout(()=>{let g='';if(c['includes']('messenger'))g='\x20This\x20is\x20a\x20messenger\x20network\x20operation.\x20Possible\x20causes:\x20'+'(1)\x20messenger\x20server\x20(https://messenger.wowok.net)\x20unreachable,\x20'+'(2)\x20no\x20messenger-enabled\x20account\x20configured\x20(use\x20account_operation\x20to\x20set\x20messenger\x20name),\x20'+'(3)\x20network\x20connectivity\x20issue.\x20'+'Ensure\x20you\x20have\x20a\x20messenger-enabled\x20account\x20and\x20the\x20server\x20is\x20reachable.';else(c['includes']('onchain')||c['includes']('account_operation')||c['includes']('bridge')||c['includes']('workflow')||c['includes']('keeper')||c['includes']('wowok'))&&(g='\x20This\x20tool\x20may\x20submit\x20an\x20ON-CHAIN\x20transaction.\x20The\x20transaction\x20was\x20NOT\x20cancelled\x20'+'by\x20this\x20timeout\x20—\x20it\x20may\x20already\x20be\x20submitted\x20and\x20still\x20finalize\x20on-chain.\x20'+'DO\x20NOT\x20blindly\x20retry\x20(risk\x20of\x20duplicate\x20operations).\x20First\x20verify:\x20'+'(1)\x20if\x20the\x20error\x20above\x20carries\x20a\x20tx\x20digest,\x20check\x20it\x20via\x20query_toolkit\x20'+'(query_type=\x27onchain_transaction\x27);\x20(2)\x20otherwise\x20verify\x20via\x20query_toolkit\x20'+'onchain_events\x20(or\x20the\x20account\x27s\x20recent\x20transactions).\x20Do\x20NOT\x20rely\x20on\x20an\x20'+'onchain_objects\x20read\x20alone:\x20it\x20may\x20serve\x20a\x20pre-transaction\x20cached\x20snapshot,\x20'+'so\x20an\x20unchanged\x20object\x20must\x20never\x20on\x20its\x20own\x20justify\x20a\x20retry.');f(new Error('Operation\x20\x27'+c+'\x27\x20timed\x20out\x20after\x20'+b+'ms.'+g));},b);})]);}export function wrapHandlerWithErrorShape(a,b,c,d){return async(e,f)=>{try{return await withTimeout(a(e,f),b,c);}catch(g){if(d){const h=g instanceof Error?g['message']:String(g),i=classifyError(h,g),j={'operation_type':c,'data':e},k=d(h,i,j);return{'content':[{'type':'text','text':'Error:\x20'+h}],'structuredContent':k};}throw g;}};}export const statusErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'status':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const operationErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'operation':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const strictStatusErrorShape=(a,b,c)=>({'result':{'status':'error','error':a}});function checkProjectStage(a,b,c){const d={'analyze_intent':'puzzle','aggregate_risks':'risk','trace_substeps':'substeps'},e=d[a];if(!e)return null;const f=getStageCache(b,c);if(!f){if(a==='analyze_intent')return null;return'project_stage:\x20calling\x20\x27'+a+'\x27\x20before\x20\x27analyze_intent\x27\x20—\x20recommend\x20calling\x20analyze_intent\x20first\x20for\x20project\x20\x27'+b+':'+c+'\x27';}if(stageIndexOf(f['stage'])<stageIndexOf(e)-0x1)return'project_stage:\x20calling\x20\x27'+a+'\x27\x20(stage\x20\x27'+e+'\x27)\x20but\x20project\x20is\x20at\x20stage\x20\x27'+f['stage']+'\x27\x20—\x20recommend\x20completing\x20prior\x20stages\x20first\x20for\x20\x27'+b+':'+c+'\x27';return null;}export function dispatchWithHarness(a,b){return async(d,f)=>{const g=[],h=getHarness(),i=shouldRunLightHooks(),j=shouldRunHeavyHooks(),k=isPublishOperation(b,d),l=isSignOperation(b,d),m=isBuyOperation(b,d),n=getHarnessTier();if(b==='goal_operation'&&i)try{const p=d,q=p?.['action'],r=p?.['project'],s=p?.['version'];if(q&&r&&s){const t=checkProjectStage(q,r,s);t&&g['push'](t);}}catch{}k&&n==='lightweight'&&(setHarnessTier('full'),g['push']('pre_publish:\x20tier\x20forced\x20to\x20full\x20for\x20publish-class\x20operation\x20(GLM5-21\x20§3.3)'));if(k&&n!=='off')try{const u=await runPrePublishChecks(b,d);g['push'](...u['warnings']);if(u['critical']['length']>0x0){for(const v of u['critical']){const x=recordCriticalRisk(v);if(x)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+x['reason']);}return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20Harness\x20pre-publish\x20gate\x20(GLM5-21\x20V6):\x20'+(u['critical']['length']+'\x20CRITICAL\x20risk(s)\x20must\x20be\x20resolved\x20before\x20publish.'),u['critical'],u['warnings'],'immutable_violation','Fix\x20the\x20CRITICAL\x20risks\x20listed\x20in\x20the\x20message\x20(e.g.\x20rename\x20dispute\x20nodes\x20per\x20R-M1-11\x20—\x20disputes\x20live\x20off-Machine;\x20bare\x20fund-terminal\x20names\x20only\x20warn\x20but\x20must\x20carry\x20an\x20anchored\x20refund\x20rail),\x20add\x20the\x20entry\x20pair\x20prev_node=\x22\x22,\x20then\x20retry\x20publish.\x20Nodes/pairs/forwards\x20are\x20immutable\x20after\x20publish\x20—\x20verify\x20via\x20machineNode2file\x20first.');}}catch(y){g['push']('pre_publish\x20hook\x20failed:\x20'+(y instanceof Error?y['message']:String(y)));}if(l&&j)try{const z=extractData(d),A=z?extractAmount(z,{'excludeConfigAmounts':!![]}):null;if(A!==null){const B=getAmountThreshold();let C=null;try{C=BigInt(A);}catch{C=null;}if(C!==null&&C>B){const D=await skuMatchedOrderTotalExemption(z,d?.['env']?.['network']);if(D)g['push']('pre_sign:\x20order\x20total\x20'+A+'\x20exceeds\x20the\x20full-tier\x20threshold\x20'+B['toString']()+'\x20(smallest\x20unit)\x20—\x20'+'EXEMPTED\x20(M-K11-a):\x20exact\x20catalog\x20match\x20Σ\x20price×quantity\x20against\x20the\x20Service\x27s\x20published\x20sales'+(D['coinType']?',\x20payment\x20coin\x20'+D['coinType']:'')+'.');else return buildHarnessBlockResult('pre_sign','Sign\x20BLOCKED\x20by\x20Harness\x20pre-sign\x20gate\x20(GLM5-21\x20V7):\x20amount\x20'+formatAmount(C)+'\x20WOW\x20exceeds\x20the\x20full-tier\x20threshold\x20'+formatAmount(B)+'\x20WOW.',['amount\x20'+A+'\x20(smallest\x20unit)\x20>\x20threshold\x20'+B['toString']()+'\x20(smallest\x20unit)'],[],'invalid_parameter','Raise\x20WOWOK_AMOUNT_THRESHOLD\x20to\x20match\x20the\x20intended\x20amount,\x20split\x20the\x20transaction,\x20or\x20reset\x20the\x20harness\x20tier\x20to\x20lightweight\x20(config_operation)\x20after\x20explicit\x20user\x20confirmation.\x20'+'M-K11-a:\x20catalog-priced\x20order_new\x20buys\x20(total_pay\x20EXACTLY\x20equal\x20to\x20Σ\x20price×quantity\x20of\x20PUBLISHED\x20sales)\x20are\x20exempted\x20automatically\x20—\x20'+'if\x20this\x20IS\x20a\x20catalog-priced\x20buy,\x20verify\x20every\x20item\x20name/quantity\x20against\x20the\x20service\x27s\x20current\x20sales\x20and\x20retry.');}}}catch(E){g['push']('pre_sign\x20hook\x20failed:\x20'+(E instanceof Error?E['message']:String(E)));}if(m&&n!=='off')try{const F=await runPreBuyChecks(b,d);g['push'](...F['warnings']);if(F['critical']['length']>0x0){for(const G of F['critical']){const H=recordCriticalRisk(G);if(H)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+H['reason']);}return buildHarnessBlockResult('pre_buy','Purchase\x20BLOCKED\x20by\x20Harness\x20pre-buy\x20gate:\x20'+F['critical']['length']+'\x20CRITICAL\x20allocator\x20risk(s)\x20—\x20'+'paying\x20into\x20this\x20service\x20as\x20currently\x20configured\x20would\x20fail\x20on-chain\x20or\x20lock\x20funds\x20with\x20no\x20distribution\x20path.',F['critical'],F['warnings'],'state_conflict','Do\x20NOT\x20retry\x20this\x20purchase\x20against\x20the\x20current\x20service\x20state.\x20Read\x20the\x20service\x27s\x20effective\x20allocator\x20plan\x20'+'(query_toolkit\x20query_type=\x27service_panorama\x27,\x20field\x20order_allocators)\x20and\x20confirm\x20every\x20finding\x20above\x20is\x20resolved\x20'+'(merchant\x20fixes\x20the\x20plan\x20—\x20post-publish\x20append\x20is\x20allowed\x20—\x20or\x20the\x20guard\x20definitions\x20are\x20repaired).\x20'+'Only\x20retry\x20the\x20buy\x20after\x20the\x20on-chain\x20state\x20changes;\x20otherwise\x20choose\x20a\x20different\x20service.');}}catch(I){g['push']('pre_buy\x20hook\x20failed:\x20'+(I instanceof Error?I['message']:String(I)));}let o;try{o=await a(d,f);}catch(J){const K=J instanceof Error?J['message']:String(J),L=recordOperationFailure(b,K);L&&g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+L['reason']);if(b==='onchain_operations')try{const M=classifyError(K,J);if(!M['retryable']&&M['error_code']!=='unknown'){const N=recordCriticalOperation(b,M['error_code']);if(N)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+N['reason']);}}catch{}throw J;}if(b==='onchain_operations')try{if(classifyOutcome(o)==='failed'){const O=extractErrorCode(o)??'',P=classifyError(O);if(!P['retryable']&&P['error_code']!=='unknown'){const Q=recordCriticalOperation(b,P['error_code']);if(Q)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Q['reason']);}}}catch{}if(i&&!isOutcomeDiscriminated(o)){const R=stableOperationId(extractIntent(b,d)??b,extractData(d));try{const S=classifyOutcome(o);if(S==='failed'){const T=extractErrorCode(o)??'',U=classifyError(T),V=h['recover'](U['error_code'],R,{'operation_type':b,'data':extractData(d)});g['push']('Harness\x20recover:\x20strategy='+V['strategy']+('\x20(attempt\x20'+V['current_attempt']+'/'+V['max_attempts']+')')+(V['should_retry']?'\x20—\x20retryable':'\x20—\x20do\x20NOT\x20retry\x20blindly')+(V['user_prompt']?'\x20—\x20'+V['user_prompt']:'\x20—\x20'+V['detail']));}else S==='success'&&h['resetRecovery'](R);}catch(W){g['push']('recover\x20hook\x20failed:\x20'+(W instanceof Error?W['message']:String(W)));}}if(b==='goal_operation')try{const X=d?.['action'];if(X==='trace_substeps'){const Y=extractCriticalFindingCount(o);if(Y>0x0){const Z=recordSubstepFailure(String(X)+':\x20'+Y+'\x20critical\x20finding(s)');if(Z)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Z['reason']);}}}catch{}if(isWriteClassTool(b)&&!SEMANTIC_RECORDED_TOOLS['has'](b))try{const a0=extractOperationType(b,d)??b,a1=extractIntent(b,d)??b,a2=extractData(d)??d,a3=classifyOutcome(o),a4=extractErrorCode(o),a5=isEnabled('experience_layer');if(a5)recordOperationOutcome(a0,a2,a1,a3,a4);else{const a6=extractIndustry(d);a6&&isEnabled('industry_evolution')&&recordIndustrySignal(a6,{'type':a0},{'success':a3==='success','error_code':a4});}}catch(a7){g['push']('signal\x20collection\x20failed:\x20'+(a7 instanceof Error?a7['message']:String(a7)));}if(g['length']>0x0){if(o?.['structuredContent']){const a8=o['structuredContent'],a9=a8['semantic'];if(a9){const aa=Array['isArray'](a9['warnings'])?a9['warnings']:[];a9['warnings']=[...aa,...g];}else for(const ab of g){console['warn']('[harness]\x20'+ab);}}else for(const ac of g){console['warn']('[harness]\x20'+ac);}}return o;};}function isPublishOperation(a,b){if(a!=='onchain_operations')return![];const c=extractOperationType(a,b);if(c!=='service'&&c!=='machine')return![];const d=extractData(b);return d?.['publish']===!![]||d?.['bPublished']===!![];}function isSignOperation(a,b){if(a==='wip_file'){const c=b?.['operation_type'];return c==='sign';}return a==='onchain_operations';}function isBuyOperation(a,b){if(a!=='onchain_operations')return![];if(extractOperationType(a,b)!=='service')return![];const c=extractData(b),d=c?.['order_new'],e=c?.['buy']!=null||d!=null&&typeof d==='object'&&d['buy']!=null;return e&&c!=null&&typeof c['object']==='string'&&c['object']!=='';}function extractOperationType(a,b){if(!b||typeof b!=='object')return undefined;const c=b;if(a==='onchain_operations')return typeof c['operation_type']==='string'?c['operation_type']:undefined;if(a==='goal_operation'||a==='industry_pack_operation'||a==='strategy_review_operation')return typeof c['action']==='string'?c['action']:undefined;return typeof c['operation_type']==='string'?c['operation_type']:undefined;}function extractIntent(a,b){if(!b||typeof b!=='object')return undefined;const c=b;if((a==='goal_operation'||a==='industry_pack_operation'||a==='strategy_review_operation')&&typeof c['action']==='string')return a+':'+c['action'];const d=c['operation_type'];if(typeof d==='string')return a+':'+d;return a;}function extractData(a){if(!a||typeof a!=='object')return undefined;const b=a,c=b['data'];return c&&typeof c==='object'?c:undefined;}export async function skuMatchedOrderTotalExemption(a,b){try{if(!a)return undefined;const c=a['order_new']?.['buy'];if(!c||c['discount']!=null)return undefined;const d=c?.['total_pay']?.['balance']??c?.['total_pay'];if(d===null||d===undefined||typeof d==='object')return undefined;const e=Array['isArray'](c['items'])?c['items']:[];if(e['length']===0x0)return undefined;const f=a['object'];if(typeof f!=='string'||f['length']===0x0)return undefined;const g=f['startsWith']('0x')?f:await LocalMark['Instance']()['get_address'](f)??undefined;if(!g)return undefined;const h=await query_serviceContext({'service':g,'network':b}),i=h?.['service'];if(!i)return undefined;if(i['bPublished']!==!![])return undefined;const j=String(i?.['type_raw']??i?.['type']??'')['match'](/<(.+)>$/)?.[0x1],k=Array['isArray'](i['sales'])?i['sales']:[];let l=0x0n;for(const n of e){const o=k['find'](r=>r?.['name']===n?.['name']);if(!o||o?.['suspension']===!![])return undefined;const p=BigInt(String(o?.['price']?.['balance']??o?.['price']??'0')),q=BigInt(String(n?.['quantity']??'1'));if(q<=0x0n)return undefined;l+=p*q;}let m;try{m=BigInt(String(d));}catch{return undefined;}if(m!==l)return undefined;return{'coinType':j};}catch{return undefined;}}const WRITE_CLASS_TOOLS=new Set(['onchain_operations','goal_operation','industry_pack_operation','strategy_review_operation','wip_file','messenger_operation','bridge_operation']),SEMANTIC_RECORDED_TOOLS=new Set(['onchain_operations','bridge_operation']);function isWriteClassTool(a){return WRITE_CLASS_TOOLS['has'](a);}function classifyOutcome(a){if(!a?.['structuredContent'])return'failed';const b=a['structuredContent'];if(b['outcome']==='failed')return'failed';if(b['outcome']==='executed')return'success';if(b['outcome']==='pending_input')return'partial';const c=b['verdict'];if(c&&typeof c==='object'&&c['buildable']===![])return'failed';const d=typeof b['status']==='string'?b['status']:typeof b['result_type']==='string'?b['result_type']:b['result']&&typeof b['result']==='object'&&typeof b['result']['status']==='string'?b['result']['status']:'';if(d==='error'||d==='failed'||d==='schema_mismatch')return'failed';if(d==='partial')return'partial';return'success';}function isOutcomeDiscriminated(a){const b=a?.['structuredContent'];return!!b&&typeof b==='object'&&'outcome'in b;}function extractErrorCode(a){if(!a?.['structuredContent'])return undefined;const b=a['structuredContent'];if(typeof b['error_code']==='string')return b['error_code'];const c=b['error'];if(typeof c==='string')return c;if(c&&typeof c==='object'){const d=c['code'];if(typeof d==='string')return d;}return undefined;}function extractIndustry(a){if(!a||typeof a!=='object')return undefined;const b=a;if(typeof b['industry']==='string')return b['industry'];const c=b['data'];if(c&&typeof c==='object'){const e=c;if(typeof e['industry']==='string')return e['industry'];}return undefined;}function numericBalance(a){if(typeof a==='number'&&Number['isFinite'](a))return a;if(typeof a==='string'&&a['trim']()!==''&&Number['isFinite'](Number(a)))return Number(a);if(typeof a==='bigint')return Number(a);return undefined;}function collectAllocatorGuards(b){const c=new Map();for(const d of b){const e=d?.['allocators'];if(!Array['isArray'](e))continue;for(const f of e){const g=f?.['guard'];if(typeof g!=='string'||g['trim']()==='')continue;const h=g['toLowerCase']();let i=c['get'](h);!i&&(i={'ref':g,'recipients':new Set(),'slots':new Set()},c['set'](h,i));const j=f?.['sharing'];if(!Array['isArray'](j))continue;for(const k of j){const l=k?.['who'];if(!l||typeof l!=='object')continue;if('Signer'in l)i['recipients']['add']('Signer');else{if('Entity'in l)i['recipients']['add']('Entity');else{if('GuardIdentifier'in l){i['recipients']['add']('GuardIdentifier');const m=l['GuardIdentifier'],o=Number(m);if(Number['isFinite'](o))i['slots']['add'](o);}}}}}}return c;}async function lintAllocatorGuardSet(a,b,c,f){const h=[],i=[],j=collectAllocatorGuards(a);if(j['size']===0x0)return{'critical':h,'warnings':i};let l;try{l=await batchQueryObjectsByIds([...j['values']()]['map'](n=>n['ref']),b,!![]);}catch(n){return i['push'](c+':\x20allocator\x20guard\x20lint\x20skipped\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+(n instanceof Error?n['message']:String(n))+');\x20')+(c==='pre_buy'?'the\x20guard\x20layer\x20of\x20this\x20service\x27s\x20allocator\x20plan\x20is\x20UNVERIFIED\x20—\x20verify\x20the\x20guards\x20yourself\x20before\x20trusting\x20this\x20buy':'run\x20guard\x20lint\x20manually\x20BEFORE\x20publish\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)')),{'critical':h,'warnings':i};}const m=new Map();for(const o of l??[]){const p=o;if(p?.['type']!=='Guard')continue;for(const q of[p['query_name'],p['object']]){if(typeof q==='string'&&q!=='')m['set'](q['toLowerCase'](),p);}}for(const [r,s]of j){const t=m['get'](r);if(!t){const z=c+':\x20allocator\x20guard\x20\x22'+s['ref']+'\x22\x20not\x20found\x20on-chain\x20—\x20'+(f==='critical'?'the\x20pool\x20accepts\x20funds\x20but\x20no\x20distribution\x20run\x20can\x20ever\x20pass\x20a\x20missing\x20guard\x20(fund-lock\x20risk)':'lint\x20skipped\x20for\x20this\x20guard;\x20verify\x20the\x20guard\x20exists\x20and\x20is\x20final\x20BEFORE\x20publish\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)');if(f==='critical')h['push'](z);else i['push'](z);continue;}const u=t['data']??t,v=Array['isArray'](u?.['table'])?u['table']:[],w=Array['isArray'](u?.['relies'])?u['relies']:[];for(const A of s['slots']){const B=v['find'](D=>Number(D?.['identifier'])===A),C=B!=null&&B['b_submission']===!![]&&String(B['value_type'])==='Address';!C&&h['push'](c+':\x20allocator\x20guard\x20\x22'+s['ref']+'\x22\x20pays\x20a\x20{GuardIdentifier:\x20'+A+'}\x20leg\x20but\x20its\x20table\x20has\x20'+(B==null?'NO\x20slot\x20'+A+'\x20row':'slot\x20'+A+'\x20as\x20a\x20STATIC\x20row\x20(b_submission:\x20'+(B['b_submission']===!![])+',\x20value_type:\x20'+String(B['value_type'])+')')+'\x20—\x20the\x20passport\x20only\x20emits\x20DECLARED\x20submission\x20slots\x20and\x20allocation\x20asserts\x20the\x20slot\x20equals\x20the\x20paying\x20'+'order,\x20so\x20this\x20rail\x20aborts\x20at\x20alloc\x20(code\x2015,\x20ERECIPIENT_NOT_FOR_OBJECT)\x20with\x20the\x20leg\x27s\x20funds\x20stranded.\x20'+'Anchor\x20the\x20leg\x20on\x20protocol\x20slot\x20254\x20(auto-written\x20with\x20the\x20paying\x20order\x20id\x20at\x20order\x20creation)\x20or\x20declare\x20'+('{identifier:\x20'+A+',\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22}\x20in\x20the\x20guard\x20table\x20BEFORE\x20publish'));}const x={'description':typeof u?.['description']==='string'?u['description']:undefined,'table':v['map'](D=>({'identifier':Number(D?.['identifier']??0x0),'b_submission':!!D?.['b_submission'],'value_type':D?.['value_type']!==undefined?String(D['value_type']):undefined,'value':D?.['value'],'name':D?.['name']!==undefined?String(D['name']):undefined,'object_type':D?.['object_type']!==undefined?String(D['object_type']):undefined})),'root':u?.['root'],'rely':w['length']>0x0?{'guards':w['map'](D=>String(D)),'logic_or':!u?.['relies_logic_and']}:undefined,'binding_hint':{'host_object':'Service','binding_field':'order_allocators','sharing_recipients':s['recipients']['size']>0x0?[...s['recipients']]:undefined}},y=guardTimeProfileDetail({'ref':s['ref'],'description':typeof u?.['description']==='string'?u['description']:undefined,'table':v,'root':u?.['root']});if(y){const D='pre_publish:\x20R-TIME-PROFILE\x20—\x20allocator\x20guard\x20\x22'+s['ref']+'\x22:\x20'+y['detail'];if(y['level']==='critical')h['push'](D);else i['push'](D);}try{const E=await lintGuard(x,{'auto_fix':![]});for(const F of E['diagnostics']){const G=c+':\x20allocator\x20guard\x20\x22'+s['ref']+'\x22\x20'+F['code']+'\x20('+F['source']+'):\x20'+F['message']+'\x20at\x20'+F['location']['path'];if(F['severity']==='error')h['push'](G);else{if(F['severity']==='warning')i['push'](G);}}}catch(H){i['push'](c+':\x20allocator\x20guard\x20\x22'+s['ref']+'\x22\x20lint\x20failed\x20'+('('+(H instanceof Error?H['message']:String(H))+')\x20—\x20non-blocking'));}}return{'critical':h,'warnings':i};}function collectForwardGuardRefs(a){const b=new Map();for(const c of a){const d=c,e=Array['isArray'](d?.['pairs'])?d['pairs']:Array['isArray'](d?.['value'])?d['value']:[];for(const h of e){const i=h,j=Array['isArray'](i?.['forwards'])?i['forwards']:[];for(const k of j){const l=k,m=l?.['guard'],n=typeof m==='string'&&m['trim']()!==''?m:m&&typeof m==='object'?m['guard']??m['$ref']:undefined;typeof n==='string'&&n['trim']()!==''&&b['set'](n['toLowerCase'](),n);}}}return b;}async function fetchForwardGuardIndex(a,b){const c=collectForwardGuardRefs(a),d=new Map();if(c['size']===0x0)return{'refs':c,'defs':d};try{const f=await batchQueryObjectsByIds([...c['values']()],b,!![]);for(const h of f??[]){const i=h;if(i?.['type']!=='Guard')continue;for(const j of[i['query_name'],i['object']]){if(typeof j==='string'&&j!=='')d['set'](j['toLowerCase'](),i);}}return{'refs':c,'defs':d};}catch(l){return{'refs':c,'defs':d,'error':l instanceof Error?l['message']:String(l)};}}function lintForwardGuardsTaskBinding(a){const b=[],c=[];if(a['refs']['size']===0x0)return{'critical':b,'warnings':c};if(a['error']!==undefined)return c['push']('pre_publish:\x20forward-guard\x20lints\x20(task-binding\x20+\x20review-lock)\x20skipped\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+a['error']+');\x20verify\x20every\x20forward\x20guard\x20carries\x20the\x20protocol\x20slot\x20254\x20Address\x20submission\x20row\x20and\x20')+'that\x20no\x20settlement\x20rail\x20is\x20review-locked\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001)'),{'critical':b,'warnings':c};for(const [d,e]of a['refs']){const f=a['defs']['get'](d);if(!f){c['push']('pre_publish:\x20forward-bound\x20guard\x20\x22'+e+'\x22\x20not\x20found\x20on-chain\x20—\x20task-binding\x20lint\x20skipped\x20for\x20it;\x20'+'ensure\x20it\x20exists\x20and\x20carries\x20the\x20protocol\x20slot\x20254\x20Address\x20submission\x20row\x20BEFORE\x20publish\x20'+'(immutable\x20after\x20publish,\x20IMMUT-001)');continue;}const g=f['data']??f,h=Array['isArray'](g?.['table'])?g['table']:[],i=h['some'](j=>Number(j?.['identifier'])===0xfe&&j?.['b_submission']===!![]&&String(j?.['value_type'])==='Address');!i&&b['push']('pre_publish:\x20forward-bound\x20guard\x20\x22'+e+'\x22\x20has\x20NO\x20protocol\x20slot\x20254\x20Address\x20submission\x20row\x20—\x20'+'the\x20passport\x20only\x20emits\x20DECLARED\x20slots,\x20so\x20once\x20a\x20Service\x20binds\x20this\x20Machine\x20EVERY\x20forward\x20this\x20'+'guard\x20gates\x20aborts\x20(code\x2011)\x20and\x20escrowed\x20funds\x20can\x20never\x20advance.\x20Machine\x20topology\x20is\x20immutable\x20'+'after\x20publish\x20(IMMUT-001):\x20add\x20{identifier:254,\x20b_submission:true,\x20value_type:\x22Address\x22}\x20to\x20the\x20'+'guard\x27s\x20table\x20(recreate\x20the\x20guard\x20unfrozen\x20if\x20it\x20is\x20frozen)\x20BEFORE\x20publishing\x20this\x20Machine');}return{'critical':b,'warnings':c};}function lintForwardReviewLocks(a,b){if(b['error']!==undefined||b['refs']['size']===0x0)return{'critical':[],'warnings':[]};const c=new Map();for(const [d,e]of b['defs']){const f=new Set();collectGuardNodeGates(e,f);if(f['size']>0x0)c['set'](d,[...f]);}return lintReviewLockedTerminals(a,c);}function lintForwardGuardsTimeProfile(a){const b=[],c=[];if(a['error']!==undefined||a['refs']['size']===0x0)return{'critical':b,'warnings':c};for(const [d,e]of a['refs']){const f=a['defs']['get'](d);if(!f)continue;const g=f['data']??f,h=guardTimeProfileDetail({'ref':e,'description':g?.['description'],'table':Array['isArray'](g?.['table'])?g['table']:undefined,'root':g?.['root']});if(h){const i='pre_publish:\x20R-TIME-PROFILE\x20—\x20forward-bound\x20guard\x20\x22'+e+'\x22:\x20'+h['detail'];if(h['level']==='critical')b['push'](i);else c['push'](i);}}return{'critical':b,'warnings':c};}async function lintAllocatorGuards(a,b){return lintAllocatorGuardSet([a['order_allocators'],a['order_allocators_append']],b,'pre_publish','warning');}async function lintServiceEscrowExitCoverage(b,c,d){const f=[],h=[];let i=[];try{i=await fetchMachineNodes(b,d,!![]);}catch(p){return f['push']('pre_publish:\x20escrow-exit\x20gate\x20could\x20not\x20fetch\x20machine\x20\x22'+b+'\x22\x20nodes\x20'+('('+(p instanceof Error?p['message']:String(p))+')\x20—\x20terminal\x20coverage\x20UNVERIFIABLE;\x20publish\x20blocked.\x20')+'Retry\x20when\x20the\x20network\x20is\x20reachable'),{'critical':f,'warnings':h};}if(i['length']===0x0)return h['push']('pre_publish:\x20escrow-exit\x20gate\x20skipped\x20—\x20machine\x20has\x20no\x20nodes\x20to\x20cover'),{'critical':f,'warnings':h};const j=computeTerminalReachability(i);if(j['terminals']['length']===0x0)return{'critical':f,'warnings':h};const k=new Map();let l=0x0;for(const q of c){if(!Array['isArray'](q))continue;for(const r of q){l++;const s=r?.['guard'];if(typeof s==='string'&&s['trim']()!=='')k['set'](s['toLowerCase'](),s);}}if(k['size']===0x0)return f['push']('pre_publish:\x20machine\x20terminal\x20node(s)\x20'+j['terminals']['map'](t=>'\x22'+t+'\x22')['join'](',\x20')+'\x20have\x20NO\x20allocator\x20rail\x20—\x20'+(l===0x0?'order_allocators\x20is\x20empty\x20in\x20this\x20call,\x20so\x20':'no\x20allocator\x20row\x20carries\x20a\x20guard\x20ref,\x20so\x20')+'an\x20order\x20stopping\x20at\x20any\x20terminal\x20strands\x20its\x20escrow\x20by\x20construction\x20(immutable\x20after\x20publish,\x20IMMUT-002).\x20'+'Every\x20terminal\x20needs\x20a\x20settlement/refund\x20allocator\x20whose\x20guard\x20gates\x20progress.current\x20==\x20<terminal>\x20'+'(canonical\x20designs:\x20tpl_allocator_node_gate_settle\x20/\x20tpl_allocator_node_gate_refund,\x20M-T12)'),{'critical':f,'warnings':h};let m;try{m=await batchQueryObjectsByIds([...k['values']()],d,!![]);}catch(t){return h['push']('pre_publish:\x20escrow-exit\x20coverage\x20UNVERIFIED\x20—\x20could\x20not\x20query\x20allocator\x20guards\x20'+('('+(t instanceof Error?t['message']:String(t))+');\x20run\x20guard\x20lint\x20manually\x20BEFORE\x20publish\x20')+'(terminal(s)\x20in\x20question:\x20'+j['terminals']['join'](',\x20')+')'),{'critical':f,'warnings':h};}const n=new Set();for(const u of m??[]){const v=u;if(v?.['type']!=='Guard')continue;collectGuardNodeGates(v,n);}const o=j['terminals']['filter'](w=>!n['has'](w));return o['length']>0x0&&f['push']('pre_publish:\x20terminal\x20node(s)\x20'+o['map'](w=>'\x22'+w+'\x22')['join'](',\x20')+'\x20have\x20NO\x20allocator\x20rail\x20—\x20'+'an\x20order\x20that\x20reaches\x20a\x20terminal\x20moves\x20no\x20money\x20by\x20itself,\x20so\x20its\x20escrow\x20strands\x20permanently\x20'+'(mainnet:\x200.299\x20stranded\x20at\x20an\x20un-railied\x20terminal;\x20ofshop:\x200.25\x20stranded\x20at\x20\x27expired\x27).\x20Every\x20terminal\x20'+'needs\x20a\x20settlement/refund\x20allocator\x20whose\x20guard\x20gates\x20progress.current\x20==\x20<terminal>\x20(canonical\x20designs:\x20'+'tpl_allocator_node_gate_settle\x20/\x20tpl_allocator_node_gate_refund,\x20M-T12).\x20If\x20the\x20pool\x20legitimately\x20drains\x20'+'at\x20an\x20earlier\x20node,\x20add\x20a\x20zero-value\x20anchor\x20row\x20on\x20the\x20terminal\x20rail\x20so\x20the\x20guard\x20resolves\x20without\x20paying'),{'critical':f,'warnings':h};}function collectGuardNodeGates(a,b){const c=a['data']??a;for(const d of parseGuardNodeGates(c?.['root'],c?.['table']))b['add'](d);}async function checkArbitrationNeutrality(b,c){const d=[],f=[],g=[],h=p=>{const q=typeof p==='string'?p:p?.['object']??p?.['name'];if(typeof q==='string'&&q!==''&&!g['includes'](q))g['push'](q);};for(const p of Array['isArray'](b['arbitrations'])?b['arbitrations']:[])h(p);let i=typeof b['permission']==='string'?b['permission']:undefined;const j=typeof b['object']==='string'?b['object']:undefined;if(j){let q;try{const r=await batchQueryObjectsByIds([j],c,!![]);q=(r??[])['find'](s=>s?.['type']==='Service');}catch(s){f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+j+'\x22\x20'+('('+(s instanceof Error?s['message']:String(s))+').\x20Verify\x20manually\x20that\x20every\x20bound\x20arbitration\x27s\x20')+'Permission\x20owner/admin\x20set\x20is\x20DISJOINT\x20from\x20the\x20service\x27s\x20controller\x20keys\x20before\x20publishing');}if(q){const t=q['data']??q;if(!i&&typeof t['permission']==='string')i=t['permission'];for(const u of Array['isArray'](t['arbitrations'])?t['arbitrations']:[])h(u);}}if(g['length']===0x0)return{'critical':d,'warnings':f};if(!i)return f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20the\x20service\x20Permission\x20address\x20is\x20not\x20resolvable\x20'+'from\x20this\x20call\x20(no\x20payload\x20\x27permission\x27,\x20service\x20object\x20not\x20found).\x20The\x20bound\x20arbitrations\x27\x20controller\x20'+'keys\x20are\x20UNVERIFIED:\x20confirm\x20each\x20arbitration\x20Permission\x27s\x20owner/admin\x20set\x20is\x20disjoint\x20from\x20the\x20service\x27s\x20'+'controller\x20keys\x20(same-controller\x20arbitration\x20=\x20the\x20merchant\x20can\x20rule\x20their\x20own\x20disputes)'),{'critical':d,'warnings':f};let k;try{k=await batchQueryObjectsByIds([i,...g],c,!![]);}catch(v){return f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20object\x20query\x20failed\x20'+('('+(v instanceof Error?v['message']:String(v))+').\x20Verify\x20the\x20arbitration\x20Permissions\x27\x20owner/admin\x20sets\x20')+'are\x20disjoint\x20from\x20the\x20service\x27s\x20controller\x20keys\x20before\x20publishing'),{'critical':d,'warnings':f};}const l=w=>(k??[])['find'](x=>{const y=x;return typeof y?.['object']==='string'&&y['object']['toLowerCase']()===w['toLowerCase']()||typeof y?.['query_name']==='string'&&y['query_name']['toLowerCase']()===w['toLowerCase']();}),m=w=>{if(!w)return new Set();const x=w['data']??w,y=new Set();for(const z of[x['builder']])if(typeof z==='string'&&z)y['add'](z['toLowerCase']());for(const A of Array['isArray'](x['admin'])?x['admin']:[])if(typeof A==='string'&&A)y['add'](A['toLowerCase']());return y;},n=l(i),o=m(n);if(o['size']===0x0)return f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20service\x20Permission\x20\x22'+i+'\x22\x20not\x20found\x20or\x20'+'carries\x20no\x20builder/admin\x20list.\x20The\x20bound\x20arbitrations\x27\x20controller\x20keys\x20are\x20UNVERIFIED\x20—\x20confirm\x20disjointness\x20manually'),{'critical':d,'warnings':f};for(const w of g){const x=l(w);if(!x){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20not\x20found\x20on-chain\x20(or\x20not\x20yet\x20indexed)\x20—\x20its\x20Permission\x20controller\x20'+'keys\x20are\x20UNVERIFIED.\x20Confirm\x20the\x20arbitration\x20Permission\x27s\x20builder/admin\x20set\x20is\x20disjoint\x20from\x20the\x20service\x27s\x20'+'controller\x20keys\x20(same-controller\x20arbitration\x20=\x20the\x20merchant\x20can\x20rule\x20their\x20own\x20disputes)');continue;}const y=x['data']??x,z=typeof y['permission']==='string'?y['permission']:undefined;if(!z){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20exposes\x20no\x20permission\x20address\x20—\x20controller-key\x20disjointness\x20UNVERIFIED');continue;}if(z['toLowerCase']()===i['toLowerCase']()){d['push']('pre_publish:\x20R-ARB-SAME-CONTROLLER\x20—\x20arbitration\x20\x22'+w+'\x22\x20shares\x20the\x20service\x27s\x20Permission\x20object\x20'+('('+i+').\x20The\x20chain\x20aborts\x20this\x20binding\x20(E_ARBITRATION_PERMISSION_CONFLICT);\x20bind\x20an\x20')+'arbitration\x20with\x20its\x20own\x20independent\x20Permission');continue;}if(!l(z))try{const D=await batchQueryObjectsByIds([z],c,!![]);k=[...k??[],...D??[]];}catch(E){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20Permission\x20\x22'+z+'\x22\x20could\x20not\x20be\x20queried\x20'+('('+(E instanceof Error?E['message']:String(E))+')\x20—\x20controller-key\x20disjointness\x20UNVERIFIED'));continue;}const A=m(l(z));if(A['size']===0x0){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20Permission\x20\x22'+z+'\x22\x20not\x20found\x20or\x20carries\x20no\x20builder/admin\x20list\x20—\x20'+'controller-key\x20disjointness\x20UNVERIFIED');continue;}const B=[...o]['filter'](F=>A['has'](F));B['length']>0x0&&d['push']('pre_publish:\x20R-ARB-SAME-CONTROLLER\x20—\x20the\x20arbitration\x20\x22'+w+'\x22\x20is\x20NOT\x20controller-independent:\x20'+('EOA(s)\x20'+B['join'](',\x20')+'\x20appear\x20in\x20BOTH\x20the\x20service\x20Permission\x20('+i+')\x20and\x20the\x20')+('arbitration\x20Permission\x20('+z+')\x20builder/admin\x20sets.\x20Object\x20isolation\x20is\x20enforced\x20on-chain\x20')+'(different\x20Permission\x20objects),\x20but\x20controller\x20isolation\x20is\x20NOT:\x20a\x20shared\x20EOA\x20can\x20confirm,\x20vote\x20in,\x20'+'and\x20rule\x20the\x20service\x27s\x20disputes\x20—\x20arbitration\x20neutrality\x20collapses\x20(live\x20mainnet:\x20the\x20reused\x20arb\x27s\x20'+'Permission\x20builder\x20AND\x20sole\x20admin\x20was\x20the\x20merchant).\x20Bind\x20an\x20arbitration\x20whose\x20Permission\x20is\x20controlled\x20'+'by\x20physically\x20independent\x20keys');const C=arbitrationVotingLockDetail(y['voting_guard']);C!==null&&d['push']('pre_publish:\x20R-ARB-VOTE-LOCK\x20—\x20arbitration\x20\x22'+w+'\x22:\x20'+C);}return{'critical':d,'warnings':f};}async function runPreBuyChecks(a,b){const c=[],d=[],f=extractData(b)??{},g=b?.['env']?.['network'],h=f['object'];let i;try{i=await batchQueryObjectsByIds([h],g,!![]);}catch(m){return d['push']('pre_buy:\x20allocator\x20screening\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+h+'\x22\x20'+('('+(m instanceof Error?m['message']:String(m))+');\x20the\x20purchase\x20was\x20NOT\x20screened.\x20')+'Verify\x20the\x20service\x27s\x20order_allocators\x20yourself\x20(query_toolkit\x20query_type=\x27service_panorama\x27)\x20before\x20trusting\x20this\x20buy'),{'critical':c,'warnings':d};}const j=(i??[])['find'](n=>n?.['type']==='Service');if(!j)return d['push']('pre_buy:\x20allocator\x20screening\x20DEGRADED\x20—\x20service\x20\x22'+h+'\x22\x20not\x20found\x20on-chain\x20(or\x20not\x20yet\x20indexed);\x20'+'the\x20purchase\x20was\x20NOT\x20screened.\x20Verify\x20the\x20address/network\x20and\x20the\x20service\x27s\x20order_allocators\x20before\x20trusting\x20this\x20buy'),{'critical':c,'warnings':d};const k=j['data']??j;k['bPublished']!==!![]&&c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20is\x20NOT\x20published\x20—\x20the\x20buy\x20aborts\x20on-chain\x20(E_NOT_PUBLISHED)');k['bPaused']===!![]&&c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20is\x20paused\x20—\x20the\x20buy\x20aborts\x20on-chain\x20(E_PAUSED)');const l=k['order_allocators'];if(l==null)c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20has\x20NO\x20order_allocators\x20—\x20the\x20payment\x20step\x20aborts\x20(no\x20distribution\x20plan).\x20'+'Funds\x20committed\x20to\x20this\x20service\x20would\x20have\x20NO\x20distribution\x20path\x20(the\x20fund-lock\x20incident\x20class).\x20'+'Do\x20not\x20buy\x20until\x20the\x20merchant\x20configures\x20an\x20allocator\x20plan');else{if(!Array['isArray'](l['allocators'])||l['allocators']['length']===0x0)c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20order_allocators\x20is\x20EMPTY\x20—\x20the\x20payment\x20step\x20aborts\x20(EALLOCATORS_EMPTY).\x20'+'Do\x20not\x20buy\x20until\x20the\x20merchant\x20configures\x20at\x20least\x20one\x20allocator');else{const n=f['buy'],o=Array['isArray'](n?.['items'])?n['items']:[],p=Array['isArray'](k['sales'])?k['sales']:[];let q=0x0,r=o['length']>0x0;const s=[];for(const v of o){const w=v,x=numericBalance(w?.['quantity']),y=p['find'](A=>A?.['name']===w?.['name']),z=numericBalance(y?.['price']);if(x===undefined||z===undefined){r=![],s['push'](typeof w?.['name']==='string'?w['name']:JSON['stringify'](w?.['name']));continue;}q+=z*x;}const t=numericBalance(l['threshold']);if(!r)d['push']('pre_buy:\x20could\x20not\x20price\x20'+s['length']+'\x20cart\x20item(s)\x20['+s['join'](',\x20')+']\x20against\x20the\x20service\x27s\x20on-chain\x20sales\x20—\x20'+'allocator-threshold\x20coverage\x20UNVERIFIED\x20for\x20this\x20cart\x20(unknown\x20items\x20also\x20abort\x20the\x20quote\x20step).\x20'+'Confirm\x20every\x20item\x20name\x20matches\x20a\x20current\x20sale\x20entry');else t!==undefined&&t>q&&c['push']('pre_buy:\x20allocator\x20threshold\x20'+t+'\x20exceeds\x20this\x20cart\x27s\x20total\x20'+q+'\x20(Σ\x20price×quantity\x20over\x20the\x20on-chain\x20sales)\x20—\x20'+'the\x20payment\x20step\x20aborts\x20(EINSUFFICIENT_BALANCE):\x20pool\x20creation\x20requires\x20amount\x20>=\x20threshold.\x20'+'The\x20merchant\x20must\x20lower\x20the\x20threshold\x20(new\x20service\x20—\x20threshold\x20is\x20frozen\x20at\x20publish)\x20or\x20the\x20cart\x20must\x20grow');n?.['discount']!=null&&r&&t!==undefined&&t<=q&&d['push']('pre_buy:\x20a\x20discount\x20is\x20applied\x20—\x20the\x20discounted\x20total\x20may\x20fall\x20below\x20the\x20list\x20total\x20'+q+'\x20used\x20here;\x20'+('if\x20it\x20lands\x20under\x20the\x20allocator\x20threshold\x20'+t+',\x20the\x20payment\x20step\x20aborts\x20(EINSUFFICIENT_BALANCE)'));const u=await lintAllocatorGuardSet([l],g,'pre_buy','critical');c['push'](...u['critical']),d['push'](...u['warnings']);}}return{'critical':c,'warnings':d};}export async function runPrePublishChecks(a,b){const c=[],d=[],f=extractOperationType(a,b),g=extractData(b)??{},h=b?.['env']?.['network'];if(f==='machine'){const i=g['node'];let j=Array['isArray'](i)?i:Array['isArray'](i?.['nodes'])?i['nodes']:[];if(j['length']===0x0&&typeof g['object']==='string'){const l=g['object'];try{const m=await fetchMachineNodes(l,h,!![]);m['length']>0x0&&(j=m,d['push']('pre_publish:\x20machine\x20\x22'+l+'\x22\x20published\x20by\x20reference\x20—\x20audited\x20against\x20its\x20'+(m['length']+'\x20on-chain\x20node(s)\x20(effective-state\x20gate)')));}catch(n){c['push']('pre_publish:\x20could\x20not\x20fetch\x20on-chain\x20nodes\x20for\x20machine\x20\x22'+l+'\x22\x20'+('('+(n instanceof Error?n['message']:String(n))+')\x20—\x20topology\x20UNVERIFIABLE;\x20publish\x20blocked.\x20')+'Retry\x20when\x20the\x20network\x20is\x20reachable;\x20every\x20guarded\x20forward\x20must\x20carry\x20the\x20protocol\x20slot\x20254\x20'+'submission\x20row\x20and\x20topology\x20is\x20immutable\x20after\x20publish\x20(IMMUT-001)');}}if(j['length']>0x0){const o=g['reentry_kind'],p=o==='none'||o==='review-loop'||o==='paid-cycle'?o:undefined;o!==undefined&&p===undefined&&d['push']('pre_publish:\x20ignored\x20invalid\x20reentry_kind\x20\x22'+String(o)+'\x22\x20—\x20'+'valid\x20values:\x20none\x20(default,\x20word-stem\x20classification)\x20/\x20review-loop\x20(same-order\x20no-charge\x20revisits)\x20/\x20paid-cycle\x20(per-revisit\x20fee,\x20fund\x20gate\x20required)');const q=auditMachineNodes(j,p);c['push'](...q['critical']),d['push'](...q['warnings']);const s=await fetchForwardGuardIndex(j,h),t=lintForwardGuardsTaskBinding(s);c['push'](...t['critical']),d['push'](...t['warnings']);const u=lintForwardReviewLocks(j,s);c['push'](...u['critical']),d['push'](...u['warnings']);const v=lintForwardGuardsTimeProfile(s);c['push'](...v['critical']),d['push'](...v['warnings']);}else typeof g['object']!=='string'&&d['push']('pre_publish:\x20publishing\x20machine\x20without\x20inline\x20node\x20data\x20—\x20topology\x20not\x20verifiable\x20in\x20this\x20call;\x20'+'verify\x20nodes/pairs/forwards\x20via\x20machineNode2file\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001)');d['push']('pre_publish:\x20machine\x20nodes/pairs/forwards\x20become\x20immutable\x20after\x20publish\x20(IMMUT-001)');}if(f==='service'){d['push']('pre_publish:\x20service\x20machine/order_allocators/arbitrations\x20become\x20immutable\x20after\x20publish\x20(IMMUT-002);\x20sales\x20remains\x20modifiable');g['machine']===undefined&&d['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call\x20(the\x20store\x20may\x20already\x20be\x20bound\x20—\x20verify\x20before\x20assuming\x20otherwise):\x20'+'query_toolkit\x20query_type=\x27service_panorama\x27\x20and\x20read\x20service.machine;\x20an\x20unset\x20machine\x20cannot\x20process\x20orders\x20and\x20CANNOT\x20be\x20fixed\x20after\x20publish\x20(IMMUT-002)');g['order_allocators']===undefined&&d['push']('pre_publish:\x20\x27order_allocators\x27\x20absent\x20from\x20THIS\x20call\x20(the\x20store\x20may\x20already\x20be\x20configured\x20—\x20verify\x20before\x20assuming\x20otherwise):\x20'+'query_toolkit\x20query_type=\x27service_panorama\x27\x20and\x20read\x20order_allocators;\x20immutable\x20after\x20publish,\x20so\x20orders\x20get\x20no\x20fund\x20distribution\x20if\x20never\x20configured\x20(IMMUT-002)');const w=g,x=numericBalance(w['compensation_fund_add']?.['balance']);if(x!==undefined&&x>0x0){const B=w['sales'],C=(Array['isArray'](B?.['sales'])?B['sales']:[])['map'](D=>numericBalance(D?.['price']?.['balance']))['filter'](D=>D!==undefined);if(C['length']>0x0){const D=C['reduce']((F,G)=>F+G,0x0),E=D*0x3;if(E>0x0){const F=x/E,G='fund='+x+',\x20highest-SKU\x20single\x20order=Σ(price×1)='+D+'\x20(quantity\x20set\x20at\x20buy\x20time),\x20'+('award\x20cap=3×order='+E+'\x20(MAX_INDEMNITY_MULTIPLE),\x20coverage='+F['toFixed'](0x2));F<0x1&&d['push']('pre_publish:\x20compensation-fund\x20coverage\x20below\x20the\x20award\x20ceiling\x20—\x20'+G+'\x20<\x201.\x20'+'Disclosure\x20only\x20(b6-11):\x20this\x20does\x20NOT\x20block\x20publish.\x20Per-order\x20coverage\x20is\x20enforced\x20at\x20'+'BUY\x20time\x20—\x20orders\x20are\x20rejected\x20while\x20the\x20fund\x20cannot\x20cover\x203x\x20that\x20order,\x20so\x20top\x20up\x20via\x20'+'compensation_fund_add\x20as\x20your\x20catalog\x27s\x20order\x20sizes\x20require\x20(no\x20cross-SKU\x20subsidy).\x20'+'Awards\x20beyond\x20the\x20fund\x20abort\x20the\x20claim\x20(code\x2027)\x20—\x20settlement\x20is\x20all-or-nothing,\x20nothing\x20partial\x20is\x20paid;\x20top\x20up\x20and\x20the\x20winner\x20retries.');}}else d['push']('pre_publish:\x20compensation_fund_add\x20present\x20but\x20\x27sales\x27\x20absent\x20from\x20THIS\x20call\x20(sales\x20may\x20already\x20be\x20configured\x20—\x20verify,\x20do\x20not\x20assume):\x20'+'the\x20fund\x20should\x20cover\x203×\x20each\x20order\x20you\x20want\x20to\x20sell\x20(MAX_INDEMNITY_MULTIPLE=3;\x20enforced\x20per-order\x20at\x20buy\x20time).\x20'+'query_toolkit\x20query_type=\x27service_panorama\x27\x20to\x20read\x20the\x20current\x20sales\x20prices,\x20then\x20re-check\x20coverage.');}const y=await lintAllocatorGuards(w,h);c['push'](...y['critical']),d['push'](...y['warnings']);if(w['order_allocators']!==undefined||w['order_allocators_append']!==undefined){const H=w['machine'];if(typeof H==='string'&&H['trim']()!==''){const I=await lintServiceEscrowExitCoverage(H,[w['order_allocators'],w['order_allocators_append']],h);c['push'](...I['critical']),d['push'](...I['warnings']);}else d['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call\x20—\x20escrow-exit\x20terminal\x20coverage\x20not\x20auditable\x20here;\x20'+'if\x20the\x20machine\x20is\x20already\x20bound,\x20every\x20machine\x20terminal\x20needs\x20an\x20allocator\x20rail\x20(immutable\x20after\x20publish,\x20IMMUT-002)');}const z=await checkArbitrationNeutrality(w,h);c['push'](...z['critical']),d['push'](...z['warnings']);const A=new Set(rewardRefsOf(w)['map'](J=>J['toLowerCase']()));if(A['size']===0x0&&w['publish']===!![]&&typeof w['object']==='string')try{const J=await batchQueryObjectsByIds([w['object']],h,!![]),K=(J??[])[0x0],L=K?.['data']??K,M=Array['isArray'](L?.['rewards'])?L['rewards']:[];for(const N of M){if(typeof N==='string'&&N['trim']()!=='')A['add'](N['toLowerCase']());}}catch(O){d['push']('pre_publish:\x20reward-funding\x20gate\x20skipped\x20—\x20could\x20not\x20read\x20the\x20service\x27s\x20on-chain\x20rewards\x20'+('('+(O instanceof Error?O['message']:String(O))+');\x20verify\x20every\x20attached\x20Reward\x20pool\x20is\x20funded\x20')+'up\x20to\x20expected_orders\x20x\x20per-claim\x20amount\x20BEFORE\x20publish');}if(A['size']>0x0)try{const P=await batchQueryObjectsByIds([...A['values']()],h,!![]),Q=new Map();for(const R of P??[]){const S=R;if(S?.['type']!=='Reward')continue;for(const T of[S['query_name'],S['object']]){if(typeof T==='string'&&T!=='')Q['set'](T['toLowerCase'](),S);}}for(const U of A){const V=Q['get'](U);if(!V){d['push']('pre_publish:\x20attached\x20reward\x20\x22'+U+'\x22\x20not\x20found\x20on-chain\x20—\x20funding\x20check\x20skipped\x20for\x20it;\x20'+'an\x20unfunded\x20pool\x20publishes\x20silently\x20and\x20claims\x20abort\x20when\x20it\x20drains');continue;}const W=serviceRewardsUnfundedDetail(V);W&&c['push']('pre_publish:\x20OFN-C\x20reward-pool\x20funding\x20—\x20reward\x20\x22'+U+'\x22:\x20'+W);}}catch(X){d['push']('pre_publish:\x20reward-funding\x20gate\x20skipped\x20—\x20could\x20not\x20query\x20reward\x20objects\x20'+('('+(X instanceof Error?X['message']:String(X))+');\x20verify\x20every\x20attached\x20Reward\x20pool\x20is\x20funded\x20')+'up\x20to\x20expected_orders\x20x\x20per-claim\x20amount\x20BEFORE\x20publish');}}return{'critical':c,'warnings':d};}function buildHarnessBlockResult(a,b,c,d,e,f){const g=[...c['map'](i=>'CRITICAL:\x20'+i),...d['map'](i=>'WARN:\x20'+i)]['join']('\x0a'),h='Error:\x20'+b+(g?'\x0a'+g:'')+'\x0aRecovery:\x20'+f;return{'content':[{'type':'text','text':h}],'structuredContent':{'outcome':'failed','result':{'type':'error','error':b+'\x20[gate='+a+']','error_code':e,'retryable':![],'recovery_hint':f},'message':h,'recovery':recover(e,'harness:'+a)}};}function extractCriticalFindingCount(a){const b=a?.['structuredContent'];if(!b)return 0x0;const c=b['semantic'],d=c?.['summary'];if(typeof d?.['critical_count']==='number'&&d['critical_count']>0x0)return d['critical_count'];const e=b['findings']??c?.['findings'];if(Array['isArray'](e))return e['filter'](h=>h?.['severity']==='error')['length'];const f=a?.['content']?.['map'](h=>'text'in h?h['text']:'')['join']('\x0a')??'',g=f['match'](/\[AUDIT ERROR\]/g);return g?g['length']:0x0;}
|
|
1
|
+
import{classifyError,buildDataSemantic}from'../schema/call/semantic.js';import{buildClassifiedErrorResult}from'./shared.js';import{shouldRunLightHooks,shouldRunHeavyHooks,recordOperationFailure,recordCriticalRisk,recordCriticalOperation,recordSubstepFailure}from'../harness/auto-escalation.js';import{getHarnessTier,setHarnessTier,isEnabled}from'../config/runtime.js';import{getHarness}from'../harness/index.js';import{TASK_BINDING_SLOT}from'../knowledge/onchain-constants.js';import{recover}from'../harness/recover.js';import{stableOperationId}from'../harness/operation-id.js';import{recordOperationOutcome}from'../experience/index.js';import{recordIndustrySignal}from'../knowledge/flywheel-loop.js';import{getStageCache}from'../playbooks/service-build/index.js';import{SERVICE_BUILD_STAGES}from'../playbooks/service-build/process.js';import{extractAmount,getAmountThreshold,formatAmount}from'../knowledge/safety-rules.js';import{LocalMark,query_serviceContext}from'@wowok/wowok';import{arbitrationVotingLockDetail,auditMachineNodes,computeTerminalReachability,guardTimeProfileDetail,lintReviewLockedTerminals,rewardRefsOf,serviceRewardsUnfundedDetail}from'../knowledge/audit-rules.js';import{lintGuard}from'../knowledge/guard-lint.js';import{parseGuardNodeGates}from'../knowledge/guard-node-gates.js';import{batchQueryObjectsByIds,batchQueryObjectsByRef,fetchMachineNodes}from'../graph/onchain/sdk-batch.js';function stageIndexOf(a){const b=SERVICE_BUILD_STAGES['indexOf'](a);return b>=0x0?b:0x0;}export function withTimeout(a,b=0x7530,c='operation'){let d;return Promise['race']([a['finally'](()=>{if(d)clearTimeout(d);}),new Promise((e,f)=>{d=setTimeout(()=>{let g='';if(c['includes']('messenger'))g='\x20This\x20is\x20a\x20messenger\x20network\x20operation.\x20Possible\x20causes:\x20'+'(1)\x20messenger\x20server\x20(https://messenger.wowok.net)\x20unreachable,\x20'+'(2)\x20no\x20messenger-enabled\x20account\x20configured\x20(use\x20account_operation\x20to\x20set\x20messenger\x20name),\x20'+'(3)\x20network\x20connectivity\x20issue.\x20'+'Ensure\x20you\x20have\x20a\x20messenger-enabled\x20account\x20and\x20the\x20server\x20is\x20reachable.';else(c['includes']('onchain')||c['includes']('account_operation')||c['includes']('bridge')||c['includes']('workflow')||c['includes']('keeper')||c['includes']('wowok'))&&(g='\x20This\x20tool\x20may\x20submit\x20an\x20ON-CHAIN\x20transaction.\x20The\x20transaction\x20was\x20NOT\x20cancelled\x20'+'by\x20this\x20timeout\x20—\x20it\x20may\x20already\x20be\x20submitted\x20and\x20still\x20finalize\x20on-chain.\x20'+'DO\x20NOT\x20blindly\x20retry\x20(risk\x20of\x20duplicate\x20operations).\x20First\x20verify:\x20'+'(1)\x20if\x20the\x20error\x20above\x20carries\x20a\x20tx\x20digest,\x20check\x20it\x20via\x20query_toolkit\x20'+'(query_type=\x27onchain_transaction\x27);\x20(2)\x20otherwise\x20verify\x20via\x20query_toolkit\x20'+'onchain_events\x20(or\x20the\x20account\x27s\x20recent\x20transactions).\x20Do\x20NOT\x20rely\x20on\x20an\x20'+'onchain_objects\x20read\x20alone:\x20it\x20may\x20serve\x20a\x20pre-transaction\x20cached\x20snapshot,\x20'+'so\x20an\x20unchanged\x20object\x20must\x20never\x20on\x20its\x20own\x20justify\x20a\x20retry.');f(new Error('Operation\x20\x27'+c+'\x27\x20timed\x20out\x20after\x20'+b+'ms.'+g));},b);})]);}export function wrapHandlerWithErrorShape(a,b,c,d){return async(e,f)=>{try{return await withTimeout(a(e,f),b,c);}catch(g){if(d){const h=g instanceof Error?g['message']:String(g),i=classifyError(h,g),j={'operation_type':c,'data':e},k=d(h,i,j);return{'content':[{'type':'text','text':'Error:\x20'+h}],'structuredContent':k};}throw g;}};}export const statusErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'status':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const operationErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'operation':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const strictStatusErrorShape=(a,b,c)=>({'result':{'status':'error','error':a}});function checkProjectStage(a,b,c){const d={'analyze_intent':'puzzle','aggregate_risks':'risk','trace_substeps':'substeps'},e=d[a];if(!e)return null;const f=getStageCache(b,c);if(!f){if(a==='analyze_intent')return null;return'project_stage:\x20calling\x20\x27'+a+'\x27\x20before\x20\x27analyze_intent\x27\x20—\x20recommend\x20calling\x20analyze_intent\x20first\x20for\x20project\x20\x27'+b+':'+c+'\x27';}if(stageIndexOf(f['stage'])<stageIndexOf(e)-0x1)return'project_stage:\x20calling\x20\x27'+a+'\x27\x20(stage\x20\x27'+e+'\x27)\x20but\x20project\x20is\x20at\x20stage\x20\x27'+f['stage']+'\x27\x20—\x20recommend\x20completing\x20prior\x20stages\x20first\x20for\x20\x27'+b+':'+c+'\x27';return null;}export function dispatchWithHarness(a,b){return async(d,f)=>{const g=[],h=getHarness(),i=shouldRunLightHooks(),j=shouldRunHeavyHooks(),k=isPublishOperation(b,d),l=isSignOperation(b,d),m=isBuyOperation(b,d),n=getHarnessTier();if(b==='goal_operation'&&i)try{const p=d,q=p?.['action'],r=p?.['project'],s=p?.['version'];if(q&&r&&s){const t=checkProjectStage(q,r,s);t&&g['push'](t);}}catch{}k&&n==='lightweight'&&(setHarnessTier('full'),g['push']('pre_publish:\x20tier\x20forced\x20to\x20full\x20for\x20publish-class\x20operation\x20(GLM5-21\x20§3.3)'));if(k&&n!=='off')try{const u=await runPrePublishChecks(b,d);g['push'](...u['warnings']);if(u['critical']['length']>0x0){for(const v of u['critical']){const x=recordCriticalRisk(v);if(x)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+x['reason']);}return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20Harness\x20pre-publish\x20gate\x20(GLM5-21\x20V6):\x20'+(u['critical']['length']+'\x20CRITICAL\x20risk(s)\x20must\x20be\x20resolved\x20before\x20publish.'),u['critical'],u['warnings'],'immutable_violation','Fix\x20the\x20CRITICAL\x20risks\x20listed\x20in\x20the\x20message\x20(e.g.\x20rename\x20dispute\x20nodes\x20per\x20R-M1-11\x20—\x20disputes\x20live\x20off-Machine;\x20bare\x20fund-terminal\x20names\x20only\x20warn\x20but\x20must\x20carry\x20an\x20anchored\x20refund\x20rail),\x20add\x20the\x20entry\x20pair\x20prev_node=\x22\x22,\x20then\x20retry\x20publish.\x20Nodes/pairs/forwards\x20are\x20immutable\x20after\x20publish\x20—\x20verify\x20via\x20machineNode2file\x20first.');}}catch(y){g['push']('pre_publish\x20hook\x20failed:\x20'+(y instanceof Error?y['message']:String(y)));}if(l&&j)try{const z=extractData(d),A=z?extractAmount(z,{'excludeConfigAmounts':!![]}):null;if(A!==null){const B=getAmountThreshold();let C=null;try{C=BigInt(A);}catch{C=null;}if(C!==null&&C>B){const D=await skuMatchedOrderTotalExemption(z,d?.['env']?.['network']);if(D)g['push']('pre_sign:\x20order\x20total\x20'+A+'\x20exceeds\x20the\x20full-tier\x20threshold\x20'+B['toString']()+'\x20(smallest\x20unit)\x20—\x20'+'EXEMPTED\x20(M-K11-a):\x20exact\x20catalog\x20match\x20Σ\x20price×quantity\x20against\x20the\x20Service\x27s\x20published\x20sales'+(D['coinType']?',\x20payment\x20coin\x20'+D['coinType']:'')+'.');else return buildHarnessBlockResult('pre_sign','Sign\x20BLOCKED\x20by\x20Harness\x20pre-sign\x20gate\x20(GLM5-21\x20V7):\x20amount\x20'+formatAmount(C)+'\x20WOW\x20exceeds\x20the\x20full-tier\x20threshold\x20'+formatAmount(B)+'\x20WOW.',['amount\x20'+A+'\x20(smallest\x20unit)\x20>\x20threshold\x20'+B['toString']()+'\x20(smallest\x20unit)'],[],'invalid_parameter','Raise\x20WOWOK_AMOUNT_THRESHOLD\x20to\x20match\x20the\x20intended\x20amount,\x20split\x20the\x20transaction,\x20or\x20reset\x20the\x20harness\x20tier\x20to\x20lightweight\x20(config_operation)\x20after\x20explicit\x20user\x20confirmation.\x20'+'M-K11-a:\x20catalog-priced\x20order_new\x20buys\x20(total_pay\x20EXACTLY\x20equal\x20to\x20Σ\x20price×quantity\x20of\x20PUBLISHED\x20sales)\x20are\x20exempted\x20automatically\x20—\x20'+'if\x20this\x20IS\x20a\x20catalog-priced\x20buy,\x20verify\x20every\x20item\x20name/quantity\x20against\x20the\x20service\x27s\x20current\x20sales\x20and\x20retry.');}}}catch(E){g['push']('pre_sign\x20hook\x20failed:\x20'+(E instanceof Error?E['message']:String(E)));}if(m&&n!=='off')try{const F=await runPreBuyChecks(b,d);g['push'](...F['warnings']);if(F['critical']['length']>0x0){for(const G of F['critical']){const H=recordCriticalRisk(G);if(H)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+H['reason']);}return buildHarnessBlockResult('pre_buy','Purchase\x20BLOCKED\x20by\x20Harness\x20pre-buy\x20gate:\x20'+F['critical']['length']+'\x20CRITICAL\x20allocator\x20risk(s)\x20—\x20'+'paying\x20into\x20this\x20service\x20as\x20currently\x20configured\x20would\x20fail\x20on-chain\x20or\x20lock\x20funds\x20with\x20no\x20distribution\x20path.',F['critical'],F['warnings'],'state_conflict','Do\x20NOT\x20retry\x20this\x20purchase\x20against\x20the\x20current\x20service\x20state.\x20Read\x20the\x20service\x27s\x20effective\x20allocator\x20plan\x20'+'(query_toolkit\x20query_type=\x27service_panorama\x27,\x20field\x20order_allocators)\x20and\x20confirm\x20every\x20finding\x20above\x20is\x20resolved\x20'+'(merchant\x20fixes\x20the\x20plan\x20—\x20post-publish\x20append\x20is\x20allowed\x20—\x20or\x20the\x20guard\x20definitions\x20are\x20repaired).\x20'+'Only\x20retry\x20the\x20buy\x20after\x20the\x20on-chain\x20state\x20changes;\x20otherwise\x20choose\x20a\x20different\x20service.');}}catch(I){g['push']('pre_buy\x20hook\x20failed:\x20'+(I instanceof Error?I['message']:String(I)));}let o;try{o=await a(d,f);}catch(J){const K=J instanceof Error?J['message']:String(J),L=recordOperationFailure(b,K);L&&g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+L['reason']);if(b==='onchain_operations')try{const M=classifyError(K,J);if(!M['retryable']&&M['error_code']!=='unknown'){const N=recordCriticalOperation(b,M['error_code']);if(N)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+N['reason']);}}catch{}throw J;}if(b==='onchain_operations')try{if(classifyOutcome(o)==='failed'){const O=extractErrorCode(o)??'',P=classifyError(O);if(!P['retryable']&&P['error_code']!=='unknown'){const Q=recordCriticalOperation(b,P['error_code']);if(Q)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Q['reason']);}}}catch{}if(i&&!isOutcomeDiscriminated(o)){const R=stableOperationId(extractIntent(b,d)??b,extractData(d));try{const S=classifyOutcome(o);if(S==='failed'){const T=extractErrorCode(o)??'',U=classifyError(T),V=h['recover'](U['error_code'],R,{'operation_type':b,'data':extractData(d),'retryable':U['retryable']});g['push']('Harness\x20recover:\x20strategy='+V['strategy']+('\x20(attempt\x20'+V['current_attempt']+'/'+V['max_attempts']+')')+(V['should_retry']?'\x20—\x20retryable':'\x20—\x20do\x20NOT\x20retry\x20blindly')+(V['user_prompt']?'\x20—\x20'+V['user_prompt']:'\x20—\x20'+V['detail']));}else S==='success'&&h['resetRecovery'](R);}catch(W){g['push']('recover\x20hook\x20failed:\x20'+(W instanceof Error?W['message']:String(W)));}}if(b==='goal_operation')try{const X=d?.['action'];if(X==='trace_substeps'){const Y=extractCriticalFindingCount(o);if(Y>0x0){const Z=recordSubstepFailure(String(X)+':\x20'+Y+'\x20critical\x20finding(s)');if(Z)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Z['reason']);}}}catch{}if(isWriteClassTool(b)&&!SEMANTIC_RECORDED_TOOLS['has'](b))try{const a0=extractOperationType(b,d)??b,a1=extractIntent(b,d)??b,a2=extractData(d)??d,a3=classifyOutcome(o),a4=extractErrorCode(o),a5=isEnabled('experience_layer');if(a5)recordOperationOutcome(a0,a2,a1,a3,a4);else{const a6=extractIndustry(d);a6&&isEnabled('industry_evolution')&&recordIndustrySignal(a6,{'type':a0},{'success':a3==='success','error_code':a4});}}catch(a7){g['push']('signal\x20collection\x20failed:\x20'+(a7 instanceof Error?a7['message']:String(a7)));}if(g['length']>0x0){if(o?.['structuredContent']){const a8=o['structuredContent'],a9=a8['semantic'];if(a9){const aa=Array['isArray'](a9['warnings'])?a9['warnings']:[];a9['warnings']=[...aa,...g];}else for(const ab of g){console['warn']('[harness]\x20'+ab);}}else for(const ac of g){console['warn']('[harness]\x20'+ac);}}return o;};}function isPublishOperation(a,b){if(a!=='onchain_operations')return![];const c=extractOperationType(a,b);if(c!=='service'&&c!=='machine')return![];const d=extractData(b);return d?.['publish']===!![]||d?.['bPublished']===!![];}function isSignOperation(a,b){if(a==='wip_file'){const c=b?.['operation_type'];return c==='sign';}return a==='onchain_operations';}function isBuyOperation(a,b){if(a!=='onchain_operations')return![];if(extractOperationType(a,b)!=='service')return![];const c=extractData(b),d=c?.['order_new'],e=c?.['buy']!=null||d!=null&&typeof d==='object'&&d['buy']!=null;return e&&c!=null&&typeof c['object']==='string'&&c['object']!=='';}function extractOperationType(a,b){if(!b||typeof b!=='object')return undefined;const c=b;if(a==='onchain_operations')return typeof c['operation_type']==='string'?c['operation_type']:undefined;if(a==='goal_operation'||a==='industry_pack_operation'||a==='strategy_review_operation')return typeof c['action']==='string'?c['action']:undefined;return typeof c['operation_type']==='string'?c['operation_type']:undefined;}function extractIntent(a,b){if(!b||typeof b!=='object')return undefined;const c=b;if((a==='goal_operation'||a==='industry_pack_operation'||a==='strategy_review_operation')&&typeof c['action']==='string')return a+':'+c['action'];const d=c['operation_type'];if(typeof d==='string')return a+':'+d;return a;}function extractData(a){if(!a||typeof a!=='object')return undefined;const b=a,c=b['data'];return c&&typeof c==='object'?c:undefined;}export async function skuMatchedOrderTotalExemption(a,b){try{if(!a)return undefined;const c=a['order_new']?.['buy'];if(!c||c['discount']!=null)return undefined;const d=c?.['total_pay']?.['balance']??c?.['total_pay'];if(d===null||d===undefined||typeof d==='object')return undefined;const e=Array['isArray'](c['items'])?c['items']:[];if(e['length']===0x0)return undefined;const f=a['object'];if(typeof f!=='string'||f['length']===0x0)return undefined;const g=f['startsWith']('0x')?f:await LocalMark['Instance']()['get_address'](f)??undefined;if(!g)return undefined;const h=await query_serviceContext({'service':g,'network':b}),i=h?.['service'];if(!i)return undefined;if(i['bPublished']!==!![])return undefined;const j=String(i?.['type_raw']??i?.['type']??'')['match'](/<(.+)>$/)?.[0x1],k=Array['isArray'](i['sales'])?i['sales']:[];let l=0x0n;for(const n of e){const o=k['find'](r=>r?.['name']===n?.['name']);if(!o||o?.['suspension']===!![])return undefined;const p=BigInt(String(o?.['price']?.['balance']??o?.['price']??'0')),q=BigInt(String(n?.['quantity']??'1'));if(q<=0x0n)return undefined;l+=p*q;}let m;try{m=BigInt(String(d));}catch{return undefined;}if(m!==l)return undefined;return{'coinType':j};}catch{return undefined;}}const WRITE_CLASS_TOOLS=new Set(['onchain_operations','goal_operation','industry_pack_operation','strategy_review_operation','wip_file','messenger_operation','bridge_operation']),SEMANTIC_RECORDED_TOOLS=new Set(['onchain_operations','bridge_operation']);function isWriteClassTool(a){return WRITE_CLASS_TOOLS['has'](a);}function classifyOutcome(a){if(!a?.['structuredContent'])return'failed';const b=a['structuredContent'];if(b['outcome']==='failed')return'failed';if(b['outcome']==='executed')return'success';if(b['outcome']==='pending_input')return'partial';const c=b['verdict'];if(c&&typeof c==='object'&&c['buildable']===![])return'failed';const d=typeof b['status']==='string'?b['status']:typeof b['result_type']==='string'?b['result_type']:b['result']&&typeof b['result']==='object'&&typeof b['result']['status']==='string'?b['result']['status']:'';if(d==='error'||d==='failed'||d==='schema_mismatch')return'failed';if(d==='partial')return'partial';return'success';}function isOutcomeDiscriminated(a){const b=a?.['structuredContent'];return!!b&&typeof b==='object'&&'outcome'in b;}function extractErrorCode(a){if(!a?.['structuredContent'])return undefined;const b=a['structuredContent'];if(typeof b['error_code']==='string')return b['error_code'];const c=b['error'];if(typeof c==='string')return c;if(c&&typeof c==='object'){const d=c['code'];if(typeof d==='string')return d;}return undefined;}function extractIndustry(a){if(!a||typeof a!=='object')return undefined;const b=a;if(typeof b['industry']==='string')return b['industry'];const c=b['data'];if(c&&typeof c==='object'){const e=c;if(typeof e['industry']==='string')return e['industry'];}return undefined;}function numericBalance(a){if(typeof a==='number'&&Number['isFinite'](a))return a;if(typeof a==='string'&&a['trim']()!==''&&Number['isFinite'](Number(a)))return Number(a);if(typeof a==='bigint')return Number(a);return undefined;}function collectAllocatorGuards(b){const c=new Map();for(const d of b){const e=d?.['allocators'];if(!Array['isArray'](e))continue;for(const f of e){const g=f?.['guard'];if(typeof g!=='string'||g['trim']()==='')continue;const h=g['toLowerCase']();let i=c['get'](h);!i&&(i={'ref':g,'recipients':new Set(),'slots':new Set()},c['set'](h,i));const j=f?.['sharing'];if(!Array['isArray'](j))continue;for(const k of j){const l=k?.['who'];if(!l||typeof l!=='object')continue;if('Signer'in l)i['recipients']['add']('Signer');else{if('Entity'in l)i['recipients']['add']('Entity');else{if('GuardIdentifier'in l){i['recipients']['add']('GuardIdentifier');const m=l['GuardIdentifier'],o=Number(m);if(Number['isFinite'](o))i['slots']['add'](o);}}}}}}return c;}async function lintAllocatorGuardSet(a,b,c,f){const h=[],i=[],j=collectAllocatorGuards(a);if(j['size']===0x0)return{'critical':h,'warnings':i};let l;try{l=await batchQueryObjectsByRef([...j['values']()]['map'](n=>n['ref']),b,!![]);}catch(n){return i['push'](c+':\x20allocator\x20guard\x20lint\x20skipped\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+(n instanceof Error?n['message']:String(n))+');\x20')+(c==='pre_buy'?'the\x20guard\x20layer\x20of\x20this\x20service\x27s\x20allocator\x20plan\x20is\x20UNVERIFIED\x20—\x20verify\x20the\x20guards\x20yourself\x20before\x20trusting\x20this\x20buy':'run\x20guard\x20lint\x20manually\x20BEFORE\x20publish\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)')),{'critical':h,'warnings':i};}const m=new Map();for(const [o,p]of l){const q=p;if(q?.['type']!=='Guard')continue;m['set'](o['toLowerCase'](),q);for(const r of[q['query_name'],q['object']]){if(typeof r==='string'&&r!=='')m['set'](r['toLowerCase'](),q);}}for(const [s,t]of j){const u=m['get'](s);if(!u){const A=c+':\x20allocator\x20guard\x20\x22'+t['ref']+'\x22\x20not\x20found\x20on-chain\x20—\x20'+(f==='critical'?'the\x20pool\x20accepts\x20funds\x20but\x20no\x20distribution\x20run\x20can\x20ever\x20pass\x20a\x20missing\x20guard\x20(fund-lock\x20risk)':'lint\x20skipped\x20for\x20this\x20guard;\x20verify\x20the\x20guard\x20exists\x20and\x20is\x20final\x20BEFORE\x20publish\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)');if(f==='critical')h['push'](A);else i['push'](A);continue;}const v=u['data']??u,w=Array['isArray'](v?.['table'])?v['table']:[],x=Array['isArray'](v?.['relies'])?v['relies']:[];for(const B of t['slots']){const C=w['find'](E=>Number(E?.['identifier'])===B),D=C!=null&&C['b_submission']===!![]&&String(C['value_type'])==='Address';!D&&h['push'](c+':\x20allocator\x20guard\x20\x22'+t['ref']+'\x22\x20pays\x20a\x20{GuardIdentifier:\x20'+B+'}\x20leg\x20but\x20its\x20table\x20has\x20'+(C==null?'NO\x20slot\x20'+B+'\x20row':'slot\x20'+B+'\x20as\x20a\x20STATIC\x20row\x20(b_submission:\x20'+(C['b_submission']===!![])+',\x20value_type:\x20'+String(C['value_type'])+')')+'\x20—\x20the\x20passport\x20only\x20emits\x20DECLARED\x20submission\x20slots\x20and\x20allocation\x20asserts\x20the\x20slot\x20equals\x20the\x20paying\x20'+'order,\x20so\x20this\x20rail\x20aborts\x20at\x20alloc\x20(code\x2015,\x20ERECIPIENT_NOT_FOR_OBJECT)\x20with\x20the\x20leg\x27s\x20funds\x20stranded.\x20'+('Declare\x20{identifier:\x20'+B+',\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22}\x20in\x20the\x20guard\x20table\x20BEFORE\x20publish\x20')+'(templates\x20anchor\x20refund\x20rails\x20on\x20user\x20slot\x200\x20and\x20submit\x20the\x20Order\x20address\x20there).\x20Do\x20NOT\x20reach\x20for\x20'+'protocol\x20slot\x20254\x20as\x20the\x20payee:\x20it\x20is\x20the\x20task-binding/once\x20slot,\x20so\x20naming\x20it\x20arms\x20once-per-order\x20and\x20a\x20'+'second\x20fire\x20on\x20the\x20same\x20order\x20aborts\x20E_ONCE_TRIGGERED\x20(16)');}const y={'description':typeof v?.['description']==='string'?v['description']:undefined,'table':w['map'](E=>({'identifier':Number(E?.['identifier']??0x0),'b_submission':!!E?.['b_submission'],'value_type':E?.['value_type']!==undefined?String(E['value_type']):undefined,'value':E?.['value'],'name':E?.['name']!==undefined?String(E['name']):undefined,'object_type':E?.['object_type']!==undefined?String(E['object_type']):undefined})),'root':v?.['root'],'rely':x['length']>0x0?{'guards':x['map'](E=>String(E)),'logic_or':!v?.['relies_logic_and']}:undefined,'binding_hint':{'host_object':'Service','binding_field':'order_allocators','sharing_recipients':t['recipients']['size']>0x0?[...t['recipients']]:undefined}},z=guardTimeProfileDetail({'ref':t['ref'],'description':typeof v?.['description']==='string'?v['description']:undefined,'table':w,'root':v?.['root']});if(z){const E='pre_publish:\x20R-TIME-PROFILE\x20—\x20allocator\x20guard\x20\x22'+t['ref']+'\x22:\x20'+z['detail'];if(z['level']==='critical')h['push'](E);else i['push'](E);}try{const F=await lintGuard(y,{'auto_fix':![]});for(const G of F['diagnostics']){const H=c+':\x20allocator\x20guard\x20\x22'+t['ref']+'\x22\x20'+G['code']+'\x20('+G['source']+'):\x20'+G['message']+'\x20at\x20'+G['location']['path'];if(G['severity']==='error')h['push'](H);else{if(G['severity']==='warning')i['push'](H);}}}catch(I){i['push'](c+':\x20allocator\x20guard\x20\x22'+t['ref']+'\x22\x20lint\x20failed\x20'+('('+(I instanceof Error?I['message']:String(I))+')\x20—\x20non-blocking'));}}return{'critical':h,'warnings':i};}function collectForwardGuardRefs(a){const b=new Map();for(const c of a){const d=c,e=Array['isArray'](d?.['pairs'])?d['pairs']:Array['isArray'](d?.['value'])?d['value']:[];for(const h of e){const i=h,j=Array['isArray'](i?.['forwards'])?i['forwards']:[];for(const k of j){const l=k,m=l?.['guard'],n=typeof m==='string'&&m['trim']()!==''?m:m&&typeof m==='object'?m['guard']??m['$ref']:undefined;typeof n==='string'&&n['trim']()!==''&&b['set'](n['toLowerCase'](),n);}}}return b;}async function fetchForwardGuardIndex(a,b){const c=collectForwardGuardRefs(a),d=new Map();if(c['size']===0x0)return{'refs':c,'defs':d};try{const f=await batchQueryObjectsByIds([...c['values']()],b,!![]);for(const h of f??[]){const i=h;if(i?.['type']!=='Guard')continue;for(const j of[i['query_name'],i['object']]){if(typeof j==='string'&&j!=='')d['set'](j['toLowerCase'](),i);}}return{'refs':c,'defs':d};}catch(l){return{'refs':c,'defs':d,'error':l instanceof Error?l['message']:String(l)};}}function lintForwardGuardsTaskBinding(a){const b=[],c=[];if(a['refs']['size']===0x0)return{'critical':b,'warnings':c};if(a['error']!==undefined)return c['push']('pre_publish:\x20forward-guard\x20lints\x20(task-binding\x20+\x20review-lock)\x20skipped\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+a['error']+');\x20verify\x20every\x20forward\x20guard\x20carries\x20the\x20protocol\x20slot\x20254\x20Address\x20submission\x20row\x20and\x20')+'that\x20no\x20settlement\x20rail\x20is\x20review-locked\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001)'),{'critical':b,'warnings':c};for(const [d,e]of a['refs']){const f=a['defs']['get'](d);if(!f){c['push']('pre_publish:\x20forward-bound\x20guard\x20\x22'+e+'\x22\x20not\x20found\x20on-chain\x20—\x20task-binding\x20lint\x20skipped\x20for\x20it;\x20'+'ensure\x20it\x20exists\x20and\x20carries\x20the\x20protocol\x20slot\x20254\x20Address\x20submission\x20row\x20BEFORE\x20publish\x20'+'(immutable\x20after\x20publish,\x20IMMUT-001)');continue;}const g=f['data']??f,h=Array['isArray'](g?.['table'])?g['table']:[],i=h['some'](j=>Number(j?.['identifier'])===TASK_BINDING_SLOT&&j?.['b_submission']===!![]&&String(j?.['value_type'])==='Address');!i&&b['push']('pre_publish:\x20forward-bound\x20guard\x20\x22'+e+'\x22\x20has\x20NO\x20protocol\x20slot\x20'+TASK_BINDING_SLOT+'\x20Address\x20submission\x20row\x20—\x20'+'the\x20passport\x20only\x20emits\x20DECLARED\x20slots,\x20so\x20once\x20a\x20Service\x20binds\x20this\x20Machine\x20EVERY\x20forward\x20this\x20'+'guard\x20gates\x20aborts\x20(code\x2011)\x20and\x20escrowed\x20funds\x20can\x20never\x20advance.\x20Machine\x20topology\x20is\x20immutable\x20'+('after\x20publish\x20(IMMUT-001):\x20add\x20{identifier:'+TASK_BINDING_SLOT+',\x20b_submission:true,\x20value_type:\x22Address\x22}\x20to\x20the\x20')+'guard\x27s\x20table\x20(recreate\x20the\x20guard\x20unfrozen\x20if\x20it\x20is\x20frozen)\x20BEFORE\x20publishing\x20this\x20Machine');}return{'critical':b,'warnings':c};}function lintForwardReviewLocks(a,b){if(b['error']!==undefined||b['refs']['size']===0x0)return{'critical':[],'warnings':[]};const c=new Map();for(const [d,e]of b['defs']){const f=new Set();collectGuardNodeGates(e,f);if(f['size']>0x0)c['set'](d,[...f]);}return lintReviewLockedTerminals(a,c);}function lintForwardGuardsTimeProfile(a){const b=[],c=[];if(a['error']!==undefined||a['refs']['size']===0x0)return{'critical':b,'warnings':c};for(const [d,e]of a['refs']){const f=a['defs']['get'](d);if(!f)continue;const g=f['data']??f,h=guardTimeProfileDetail({'ref':e,'description':g?.['description'],'table':Array['isArray'](g?.['table'])?g['table']:undefined,'root':g?.['root']});if(h){const i='pre_publish:\x20R-TIME-PROFILE\x20—\x20forward-bound\x20guard\x20\x22'+e+'\x22:\x20'+h['detail'];if(h['level']==='critical')b['push'](i);else c['push'](i);}}return{'critical':b,'warnings':c};}async function lintAllocatorGuards(a,b){return lintAllocatorGuardSet([a['order_allocators'],a['order_allocators_append']],b,'pre_publish','warning');}async function lintServiceEscrowExitCoverage(b,c,d){const f=[],h=[];let i=[];try{i=await fetchMachineNodes(b,d,!![]);}catch(p){return f['push']('pre_publish:\x20escrow-exit\x20gate\x20could\x20not\x20fetch\x20machine\x20\x22'+b+'\x22\x20nodes\x20'+('('+(p instanceof Error?p['message']:String(p))+')\x20—\x20terminal\x20coverage\x20UNVERIFIABLE;\x20publish\x20blocked.\x20')+'Retry\x20when\x20the\x20network\x20is\x20reachable'),{'critical':f,'warnings':h};}if(i['length']===0x0)return h['push']('pre_publish:\x20escrow-exit\x20gate\x20skipped\x20—\x20machine\x20has\x20no\x20nodes\x20to\x20cover'),{'critical':f,'warnings':h};const j=computeTerminalReachability(i);if(j['terminals']['length']===0x0)return{'critical':f,'warnings':h};const k=new Map();let l=0x0;for(const q of c){if(q===null||q===undefined)continue;const r=Array['isArray'](q)?q:Array['isArray'](q['allocators'])?q['allocators']:[];for(const s of r){l++;const t=s?.['guard'];if(typeof t==='string'&&t['trim']()!=='')k['set'](t['toLowerCase'](),t);}}if(k['size']===0x0)return f['push']('pre_publish:\x20machine\x20terminal\x20node(s)\x20'+j['terminals']['map'](u=>'\x22'+u+'\x22')['join'](',\x20')+'\x20have\x20NO\x20allocator\x20rail\x20—\x20'+(l===0x0?'order_allocators\x20is\x20empty\x20in\x20this\x20call,\x20so\x20':'no\x20allocator\x20row\x20carries\x20a\x20guard\x20ref,\x20so\x20')+'an\x20order\x20stopping\x20at\x20any\x20terminal\x20strands\x20its\x20escrow\x20by\x20construction\x20(immutable\x20after\x20publish,\x20IMMUT-002).\x20'+'Every\x20terminal\x20needs\x20a\x20settlement/refund\x20allocator\x20whose\x20guard\x20gates\x20progress.current\x20==\x20<terminal>\x20'+'(canonical\x20designs:\x20tpl_allocator_node_gate_settle\x20/\x20tpl_allocator_node_gate_refund,\x20M-T12)'),{'critical':f,'warnings':h};let m;try{m=await batchQueryObjectsByRef([...k['values']()],d,!![]);}catch(u){return h['push']('pre_publish:\x20escrow-exit\x20coverage\x20UNVERIFIED\x20—\x20could\x20not\x20query\x20allocator\x20guards\x20'+('('+(u instanceof Error?u['message']:String(u))+');\x20run\x20guard\x20lint\x20manually\x20BEFORE\x20publish\x20')+'(terminal(s)\x20in\x20question:\x20'+j['terminals']['join'](',\x20')+')'),{'critical':f,'warnings':h};}const n=new Set();for(const v of m['values']()){const w=v;if(w?.['type']!=='Guard')continue;collectGuardNodeGates(w,n);}const o=j['terminals']['filter'](x=>!n['has'](x));return o['length']>0x0&&f['push']('pre_publish:\x20terminal\x20node(s)\x20'+o['map'](x=>'\x22'+x+'\x22')['join'](',\x20')+'\x20have\x20NO\x20allocator\x20rail\x20—\x20'+'an\x20order\x20that\x20reaches\x20a\x20terminal\x20moves\x20no\x20money\x20by\x20itself,\x20so\x20its\x20escrow\x20strands\x20permanently\x20'+'(mainnet:\x200.299\x20stranded\x20at\x20an\x20un-railied\x20terminal;\x20ofshop:\x200.25\x20stranded\x20at\x20\x27expired\x27).\x20Every\x20terminal\x20'+'needs\x20a\x20settlement/refund\x20allocator\x20whose\x20guard\x20gates\x20progress.current\x20==\x20<terminal>\x20(canonical\x20designs:\x20'+'tpl_allocator_node_gate_settle\x20/\x20tpl_allocator_node_gate_refund,\x20M-T12).\x20If\x20the\x20pool\x20legitimately\x20drains\x20'+'at\x20an\x20earlier\x20node,\x20add\x20a\x20zero-value\x20anchor\x20row\x20on\x20the\x20terminal\x20rail\x20so\x20the\x20guard\x20resolves\x20without\x20paying'),{'critical':f,'warnings':h};}function collectGuardNodeGates(a,b){const c=a['data']??a;for(const d of parseGuardNodeGates(c?.['root'],c?.['table']))b['add'](d);}async function checkArbitrationNeutrality(b,c){const d=[],f=[],g=[],h=p=>{const q=typeof p==='string'?p:p?.['object']??p?.['name'];if(typeof q==='string'&&q!==''&&!g['includes'](q))g['push'](q);};for(const p of Array['isArray'](b['arbitrations'])?b['arbitrations']:[])h(p);let i=typeof b['permission']==='string'?b['permission']:undefined;const j=typeof b['object']==='string'?b['object']:undefined;if(j){let q;try{const r=await batchQueryObjectsByIds([j],c,!![]);q=(r??[])['find'](s=>s?.['type']==='Service');}catch(s){f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+j+'\x22\x20'+('('+(s instanceof Error?s['message']:String(s))+').\x20Verify\x20manually\x20that\x20every\x20bound\x20arbitration\x27s\x20')+'Permission\x20owner/admin\x20set\x20is\x20DISJOINT\x20from\x20the\x20service\x27s\x20controller\x20keys\x20before\x20publishing');}if(q){const t=q['data']??q;if(!i&&typeof t['permission']==='string')i=t['permission'];for(const u of Array['isArray'](t['arbitrations'])?t['arbitrations']:[])h(u);}}if(g['length']===0x0)return{'critical':d,'warnings':f};if(!i)return f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20the\x20service\x20Permission\x20address\x20is\x20not\x20resolvable\x20'+'from\x20this\x20call\x20(no\x20payload\x20\x27permission\x27,\x20service\x20object\x20not\x20found).\x20The\x20bound\x20arbitrations\x27\x20controller\x20'+'keys\x20are\x20UNVERIFIED:\x20confirm\x20each\x20arbitration\x20Permission\x27s\x20owner/admin\x20set\x20is\x20disjoint\x20from\x20the\x20service\x27s\x20'+'controller\x20keys\x20(same-controller\x20arbitration\x20=\x20the\x20merchant\x20can\x20rule\x20their\x20own\x20disputes)'),{'critical':d,'warnings':f};let k;try{k=await batchQueryObjectsByIds([i,...g],c,!![]);}catch(v){return f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20object\x20query\x20failed\x20'+('('+(v instanceof Error?v['message']:String(v))+').\x20Verify\x20the\x20arbitration\x20Permissions\x27\x20owner/admin\x20sets\x20')+'are\x20disjoint\x20from\x20the\x20service\x27s\x20controller\x20keys\x20before\x20publishing'),{'critical':d,'warnings':f};}const l=w=>(k??[])['find'](x=>{const y=x;return typeof y?.['object']==='string'&&y['object']['toLowerCase']()===w['toLowerCase']()||typeof y?.['query_name']==='string'&&y['query_name']['toLowerCase']()===w['toLowerCase']();}),m=w=>{if(!w)return new Set();const x=w['data']??w,y=new Set();for(const z of[x['builder']])if(typeof z==='string'&&z)y['add'](z['toLowerCase']());for(const A of Array['isArray'](x['admin'])?x['admin']:[])if(typeof A==='string'&&A)y['add'](A['toLowerCase']());return y;},n=l(i),o=m(n);if(o['size']===0x0)return f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20service\x20Permission\x20\x22'+i+'\x22\x20not\x20found\x20or\x20'+'carries\x20no\x20builder/admin\x20list.\x20The\x20bound\x20arbitrations\x27\x20controller\x20keys\x20are\x20UNVERIFIED\x20—\x20confirm\x20disjointness\x20manually'),{'critical':d,'warnings':f};for(const w of g){const x=l(w);if(!x){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20not\x20found\x20on-chain\x20(or\x20not\x20yet\x20indexed)\x20—\x20its\x20Permission\x20controller\x20'+'keys\x20are\x20UNVERIFIED.\x20Confirm\x20the\x20arbitration\x20Permission\x27s\x20builder/admin\x20set\x20is\x20disjoint\x20from\x20the\x20service\x27s\x20'+'controller\x20keys\x20(same-controller\x20arbitration\x20=\x20the\x20merchant\x20can\x20rule\x20their\x20own\x20disputes)');continue;}const y=x['data']??x,z=typeof y['permission']==='string'?y['permission']:undefined;if(!z){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20exposes\x20no\x20permission\x20address\x20—\x20controller-key\x20disjointness\x20UNVERIFIED');continue;}if(z['toLowerCase']()===i['toLowerCase']()){d['push']('pre_publish:\x20R-ARB-SAME-CONTROLLER\x20—\x20arbitration\x20\x22'+w+'\x22\x20shares\x20the\x20service\x27s\x20Permission\x20object\x20'+('('+i+').\x20The\x20chain\x20aborts\x20this\x20binding\x20(E_ARBITRATION_PERMISSION_CONFLICT);\x20bind\x20an\x20')+'arbitration\x20with\x20its\x20own\x20independent\x20Permission');continue;}if(!l(z))try{const D=await batchQueryObjectsByIds([z],c,!![]);k=[...k??[],...D??[]];}catch(E){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20Permission\x20\x22'+z+'\x22\x20could\x20not\x20be\x20queried\x20'+('('+(E instanceof Error?E['message']:String(E))+')\x20—\x20controller-key\x20disjointness\x20UNVERIFIED'));continue;}const A=m(l(z));if(A['size']===0x0){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20Permission\x20\x22'+z+'\x22\x20not\x20found\x20or\x20carries\x20no\x20builder/admin\x20list\x20—\x20'+'controller-key\x20disjointness\x20UNVERIFIED');continue;}const B=[...o]['filter'](F=>A['has'](F));B['length']>0x0&&d['push']('pre_publish:\x20R-ARB-SAME-CONTROLLER\x20—\x20the\x20arbitration\x20\x22'+w+'\x22\x20is\x20NOT\x20controller-independent:\x20'+('EOA(s)\x20'+B['join'](',\x20')+'\x20appear\x20in\x20BOTH\x20the\x20service\x20Permission\x20('+i+')\x20and\x20the\x20')+('arbitration\x20Permission\x20('+z+')\x20builder/admin\x20sets.\x20Object\x20isolation\x20is\x20enforced\x20on-chain\x20')+'(different\x20Permission\x20objects),\x20but\x20controller\x20isolation\x20is\x20NOT:\x20a\x20shared\x20EOA\x20can\x20confirm,\x20vote\x20in,\x20'+'and\x20rule\x20the\x20service\x27s\x20disputes\x20—\x20arbitration\x20neutrality\x20collapses\x20(live\x20mainnet:\x20the\x20reused\x20arb\x27s\x20'+'Permission\x20builder\x20AND\x20sole\x20admin\x20was\x20the\x20merchant).\x20Bind\x20an\x20arbitration\x20whose\x20Permission\x20is\x20controlled\x20'+'by\x20physically\x20independent\x20keys');const C=arbitrationVotingLockDetail(y['voting_guard']);C!==null&&d['push']('pre_publish:\x20R-ARB-VOTE-LOCK\x20—\x20arbitration\x20\x22'+w+'\x22:\x20'+C);}return{'critical':d,'warnings':f};}async function runPreBuyChecks(a,b){const c=[],d=[],f=extractData(b)??{},g=b?.['env']?.['network'],h=f['object'];let i;try{i=await batchQueryObjectsByIds([h],g,!![]);}catch(m){return d['push']('pre_buy:\x20allocator\x20screening\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+h+'\x22\x20'+('('+(m instanceof Error?m['message']:String(m))+');\x20the\x20purchase\x20was\x20NOT\x20screened.\x20')+'Verify\x20the\x20service\x27s\x20order_allocators\x20yourself\x20(query_toolkit\x20query_type=\x27service_panorama\x27)\x20before\x20trusting\x20this\x20buy'),{'critical':c,'warnings':d};}const j=(i??[])['find'](n=>n?.['type']==='Service');if(!j)return d['push']('pre_buy:\x20allocator\x20screening\x20DEGRADED\x20—\x20service\x20\x22'+h+'\x22\x20not\x20found\x20on-chain\x20(or\x20not\x20yet\x20indexed);\x20'+'the\x20purchase\x20was\x20NOT\x20screened.\x20Verify\x20the\x20address/network\x20and\x20the\x20service\x27s\x20order_allocators\x20before\x20trusting\x20this\x20buy'),{'critical':c,'warnings':d};const k=j['data']??j;k['bPublished']!==!![]&&c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20is\x20NOT\x20published\x20—\x20the\x20buy\x20aborts\x20on-chain\x20(E_NOT_PUBLISHED)');k['bPaused']===!![]&&c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20is\x20paused\x20—\x20the\x20buy\x20aborts\x20on-chain\x20(E_PAUSED)');const l=k['order_allocators'];if(l==null)c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20has\x20NO\x20order_allocators\x20—\x20the\x20payment\x20step\x20aborts\x20(no\x20distribution\x20plan).\x20'+'Funds\x20committed\x20to\x20this\x20service\x20would\x20have\x20NO\x20distribution\x20path\x20(the\x20fund-lock\x20incident\x20class).\x20'+'Do\x20not\x20buy\x20until\x20the\x20merchant\x20configures\x20an\x20allocator\x20plan');else{if(!Array['isArray'](l['allocators'])||l['allocators']['length']===0x0)c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20order_allocators\x20is\x20EMPTY\x20—\x20the\x20payment\x20step\x20aborts\x20(EALLOCATORS_EMPTY).\x20'+'Do\x20not\x20buy\x20until\x20the\x20merchant\x20configures\x20at\x20least\x20one\x20allocator');else{const n=f['buy'],o=Array['isArray'](n?.['items'])?n['items']:[],p=Array['isArray'](k['sales'])?k['sales']:[];let q=0x0,r=o['length']>0x0;const s=[];for(const v of o){const w=v,x=numericBalance(w?.['quantity']),y=p['find'](A=>A?.['name']===w?.['name']),z=numericBalance(y?.['price']);if(x===undefined||z===undefined){r=![],s['push'](typeof w?.['name']==='string'?w['name']:JSON['stringify'](w?.['name']));continue;}q+=z*x;}const t=numericBalance(l['threshold']);if(!r)d['push']('pre_buy:\x20could\x20not\x20price\x20'+s['length']+'\x20cart\x20item(s)\x20['+s['join'](',\x20')+']\x20against\x20the\x20service\x27s\x20on-chain\x20sales\x20—\x20'+'allocator-threshold\x20coverage\x20UNVERIFIED\x20for\x20this\x20cart\x20(unknown\x20items\x20also\x20abort\x20the\x20quote\x20step).\x20'+'Confirm\x20every\x20item\x20name\x20matches\x20a\x20current\x20sale\x20entry');else t!==undefined&&t>q&&c['push']('pre_buy:\x20allocator\x20threshold\x20'+t+'\x20exceeds\x20this\x20cart\x27s\x20total\x20'+q+'\x20(Σ\x20price×quantity\x20over\x20the\x20on-chain\x20sales)\x20—\x20'+'the\x20payment\x20step\x20aborts\x20(EINSUFFICIENT_BALANCE):\x20pool\x20creation\x20requires\x20amount\x20>=\x20threshold.\x20'+'The\x20merchant\x20must\x20lower\x20the\x20threshold\x20(new\x20service\x20—\x20threshold\x20is\x20frozen\x20at\x20publish)\x20or\x20the\x20cart\x20must\x20grow');n?.['discount']!=null&&r&&t!==undefined&&t<=q&&d['push']('pre_buy:\x20a\x20discount\x20is\x20applied\x20—\x20the\x20discounted\x20total\x20may\x20fall\x20below\x20the\x20list\x20total\x20'+q+'\x20used\x20here;\x20'+('if\x20it\x20lands\x20under\x20the\x20allocator\x20threshold\x20'+t+',\x20the\x20payment\x20step\x20aborts\x20(EINSUFFICIENT_BALANCE)'));const u=await lintAllocatorGuardSet([l],g,'pre_buy','critical');c['push'](...u['critical']),d['push'](...u['warnings']);}}return{'critical':c,'warnings':d};}export async function runPrePublishChecks(a,b){const c=[],d=[],f=extractOperationType(a,b),g=extractData(b)??{},h=b?.['env']?.['network'];if(f==='machine'){const i=g['node'];let j=Array['isArray'](i)?i:Array['isArray'](i?.['nodes'])?i['nodes']:[];if(j['length']===0x0&&typeof g['object']==='string'){const l=g['object'];try{const m=await fetchMachineNodes(l,h,!![]);m['length']>0x0&&(j=m,d['push']('pre_publish:\x20machine\x20\x22'+l+'\x22\x20published\x20by\x20reference\x20—\x20audited\x20against\x20its\x20'+(m['length']+'\x20on-chain\x20node(s)\x20(effective-state\x20gate)')));}catch(n){c['push']('pre_publish:\x20could\x20not\x20fetch\x20on-chain\x20nodes\x20for\x20machine\x20\x22'+l+'\x22\x20'+('('+(n instanceof Error?n['message']:String(n))+')\x20—\x20topology\x20UNVERIFIABLE;\x20publish\x20blocked.\x20')+'Retry\x20when\x20the\x20network\x20is\x20reachable;\x20every\x20guarded\x20forward\x20must\x20carry\x20the\x20protocol\x20slot\x20254\x20'+'submission\x20row\x20and\x20topology\x20is\x20immutable\x20after\x20publish\x20(IMMUT-001)');}}if(j['length']>0x0){const o=g['reentry_kind'],p=o==='none'||o==='review-loop'||o==='paid-cycle'?o:undefined;o!==undefined&&p===undefined&&d['push']('pre_publish:\x20ignored\x20invalid\x20reentry_kind\x20\x22'+String(o)+'\x22\x20—\x20'+'valid\x20values:\x20none\x20(default,\x20word-stem\x20classification)\x20/\x20review-loop\x20(same-order\x20no-charge\x20revisits)\x20/\x20paid-cycle\x20(per-revisit\x20fee,\x20fund\x20gate\x20required)');const q=auditMachineNodes(j,p);c['push'](...q['critical']),d['push'](...q['warnings']);const s=await fetchForwardGuardIndex(j,h),t=lintForwardGuardsTaskBinding(s);c['push'](...t['critical']),d['push'](...t['warnings']);const u=lintForwardReviewLocks(j,s);c['push'](...u['critical']),d['push'](...u['warnings']);const v=lintForwardGuardsTimeProfile(s);c['push'](...v['critical']),d['push'](...v['warnings']);}else typeof g['object']!=='string'&&d['push']('pre_publish:\x20publishing\x20machine\x20without\x20inline\x20node\x20data\x20—\x20topology\x20not\x20verifiable\x20in\x20this\x20call;\x20'+'verify\x20nodes/pairs/forwards\x20via\x20machineNode2file\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001)');d['push']('pre_publish:\x20machine\x20nodes/pairs/forwards\x20become\x20immutable\x20after\x20publish\x20(IMMUT-001)');}if(f==='service'){d['push']('pre_publish:\x20service\x20machine/order_allocators/arbitrations\x20become\x20immutable\x20after\x20publish\x20(IMMUT-002);\x20sales\x20remains\x20modifiable');g['machine']===undefined&&d['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call\x20(the\x20store\x20may\x20already\x20be\x20bound\x20—\x20verify\x20before\x20assuming\x20otherwise):\x20'+'query_toolkit\x20query_type=\x27service_panorama\x27\x20and\x20read\x20service.machine;\x20an\x20unset\x20machine\x20cannot\x20process\x20orders\x20and\x20CANNOT\x20be\x20fixed\x20after\x20publish\x20(IMMUT-002)');g['order_allocators']===undefined&&d['push']('pre_publish:\x20\x27order_allocators\x27\x20absent\x20from\x20THIS\x20call\x20(the\x20store\x20may\x20already\x20be\x20configured\x20—\x20verify\x20before\x20assuming\x20otherwise):\x20'+'query_toolkit\x20query_type=\x27service_panorama\x27\x20and\x20read\x20order_allocators;\x20immutable\x20after\x20publish,\x20so\x20orders\x20get\x20no\x20fund\x20distribution\x20if\x20never\x20configured\x20(IMMUT-002)');const w=g,x=numericBalance(w['compensation_fund_add']?.['balance']);if(x!==undefined&&x>0x0){const B=w['sales'],C=(Array['isArray'](B?.['sales'])?B['sales']:[])['map'](D=>numericBalance(D?.['price']?.['balance']))['filter'](D=>D!==undefined);if(C['length']>0x0){const D=C['reduce']((F,G)=>F+G,0x0),E=D*0x3;if(E>0x0){const F=x/E,G='fund='+x+',\x20highest-SKU\x20single\x20order=Σ(price×1)='+D+'\x20(quantity\x20set\x20at\x20buy\x20time),\x20'+('award\x20cap=3×order='+E+'\x20(MAX_INDEMNITY_MULTIPLE),\x20coverage='+F['toFixed'](0x2));F<0x1&&d['push']('pre_publish:\x20compensation-fund\x20coverage\x20below\x20the\x20award\x20ceiling\x20—\x20'+G+'\x20<\x201.\x20'+'Disclosure\x20only\x20(b6-11):\x20this\x20does\x20NOT\x20block\x20publish.\x20Per-order\x20coverage\x20is\x20enforced\x20at\x20'+'BUY\x20time\x20—\x20orders\x20are\x20rejected\x20while\x20the\x20fund\x20cannot\x20cover\x203x\x20that\x20order,\x20so\x20top\x20up\x20via\x20'+'compensation_fund_add\x20as\x20your\x20catalog\x27s\x20order\x20sizes\x20require\x20(no\x20cross-SKU\x20subsidy).\x20'+'Awards\x20beyond\x20the\x20fund\x20abort\x20the\x20claim\x20(code\x2027)\x20—\x20settlement\x20is\x20all-or-nothing,\x20nothing\x20partial\x20is\x20paid;\x20top\x20up\x20and\x20the\x20winner\x20retries.');}}else d['push']('pre_publish:\x20compensation_fund_add\x20present\x20but\x20\x27sales\x27\x20absent\x20from\x20THIS\x20call\x20(sales\x20may\x20already\x20be\x20configured\x20—\x20verify,\x20do\x20not\x20assume):\x20'+'the\x20fund\x20should\x20cover\x203×\x20each\x20order\x20you\x20want\x20to\x20sell\x20(MAX_INDEMNITY_MULTIPLE=3;\x20enforced\x20per-order\x20at\x20buy\x20time).\x20'+'query_toolkit\x20query_type=\x27service_panorama\x27\x20to\x20read\x20the\x20current\x20sales\x20prices,\x20then\x20re-check\x20coverage.');}const y=await lintAllocatorGuards(w,h);c['push'](...y['critical']),d['push'](...y['warnings']);if(w['order_allocators']!==undefined||w['order_allocators_append']!==undefined){const H=w['machine'];if(typeof H==='string'&&H['trim']()!==''){const I=await lintServiceEscrowExitCoverage(H,[w['order_allocators'],w['order_allocators_append']],h);c['push'](...I['critical']),d['push'](...I['warnings']);}else d['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call\x20—\x20escrow-exit\x20terminal\x20coverage\x20not\x20auditable\x20here;\x20'+'if\x20the\x20machine\x20is\x20already\x20bound,\x20every\x20machine\x20terminal\x20needs\x20an\x20allocator\x20rail\x20(immutable\x20after\x20publish,\x20IMMUT-002)');}const z=await checkArbitrationNeutrality(w,h);c['push'](...z['critical']),d['push'](...z['warnings']);const A=new Set(rewardRefsOf(w)['map'](J=>J['toLowerCase']()));if(A['size']===0x0&&w['publish']===!![]&&typeof w['object']==='string')try{const J=await batchQueryObjectsByIds([w['object']],h,!![]),K=(J??[])[0x0],L=K?.['data']??K,M=Array['isArray'](L?.['rewards'])?L['rewards']:[];for(const N of M){if(typeof N==='string'&&N['trim']()!=='')A['add'](N['toLowerCase']());}}catch(O){d['push']('pre_publish:\x20reward-funding\x20gate\x20skipped\x20—\x20could\x20not\x20read\x20the\x20service\x27s\x20on-chain\x20rewards\x20'+('('+(O instanceof Error?O['message']:String(O))+');\x20verify\x20every\x20attached\x20Reward\x20pool\x20is\x20funded\x20')+'up\x20to\x20expected_orders\x20x\x20per-claim\x20amount\x20BEFORE\x20publish');}if(A['size']>0x0)try{const P=await batchQueryObjectsByIds([...A['values']()],h,!![]),Q=new Map();for(const R of P??[]){const S=R;if(S?.['type']!=='Reward')continue;for(const T of[S['query_name'],S['object']]){if(typeof T==='string'&&T!=='')Q['set'](T['toLowerCase'](),S);}}for(const U of A){const V=Q['get'](U);if(!V){d['push']('pre_publish:\x20attached\x20reward\x20\x22'+U+'\x22\x20not\x20found\x20on-chain\x20—\x20funding\x20check\x20skipped\x20for\x20it;\x20'+'an\x20unfunded\x20pool\x20publishes\x20silently\x20and\x20claims\x20abort\x20when\x20it\x20drains');continue;}const W=serviceRewardsUnfundedDetail(V);W&&c['push']('pre_publish:\x20OFN-C\x20reward-pool\x20funding\x20—\x20reward\x20\x22'+U+'\x22:\x20'+W);}}catch(X){d['push']('pre_publish:\x20reward-funding\x20gate\x20skipped\x20—\x20could\x20not\x20query\x20reward\x20objects\x20'+('('+(X instanceof Error?X['message']:String(X))+');\x20verify\x20every\x20attached\x20Reward\x20pool\x20is\x20funded\x20')+'up\x20to\x20expected_orders\x20x\x20per-claim\x20amount\x20BEFORE\x20publish');}}return{'critical':c,'warnings':d};}function buildHarnessBlockResult(a,b,c,d,e,f){const g=[...c['map'](i=>'CRITICAL:\x20'+i),...d['map'](i=>'WARN:\x20'+i)]['join']('\x0a'),h='Error:\x20'+b+(g?'\x0a'+g:'')+'\x0aRecovery:\x20'+f;return{'content':[{'type':'text','text':h}],'structuredContent':{'outcome':'failed','result':{'type':'error','error':b+'\x20[gate='+a+']','error_code':e,'retryable':![],'recovery_hint':f},'message':h,'recovery':recover(e,'harness:'+a)}};}function extractCriticalFindingCount(a){const b=a?.['structuredContent'];if(!b)return 0x0;const c=b['semantic'],d=c?.['summary'];if(typeof d?.['critical_count']==='number'&&d['critical_count']>0x0)return d['critical_count'];const e=b['findings']??c?.['findings'];if(Array['isArray'](e))return e['filter'](h=>h?.['severity']==='error')['length'];const f=a?.['content']?.['map'](h=>'text'in h?h['text']:'')['join']('\x0a')??'',g=f['match'](/\[AUDIT ERROR\]/g);return g?g['length']:0x0;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wowok/agent-mcp",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"description": "Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"license": "Apache-2.0",
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
57
|
-
"@wowok/wowok": "3.3.
|
|
57
|
+
"@wowok/wowok": "3.3.5",
|
|
58
58
|
"lodash": "^4.18.1",
|
|
59
59
|
"zod": "^4.2.0"
|
|
60
60
|
},
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"vitest": "^2.1.0"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
|
-
"clean": "node -e \"fs.rmSync('dist',{recursive:true,force:true})\"",
|
|
69
|
+
"clean": "node -e \"fs.rmSync('dist',{recursive:true,force:true,maxRetries:20,retryDelay:150})\"",
|
|
70
70
|
"build": "pnpm clean && pnpm check:hygiene && pnpm check:baselines && pnpm check:citations && tsc && pnpm copy:standards && pnpm generate:schemas && pnpm obfuscate",
|
|
71
71
|
"check:hygiene": "node --import tsx/esm scripts/check-hygiene.ts",
|
|
72
72
|
"check:baselines": "node --import tsx/esm scripts/check-baselines.ts",
|