@wowok/agent-mcp 3.0.5 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -20
- package/dist/customer/account-events.js +1 -1
- package/dist/graph/onchain/dataplane.d.ts +2 -2
- package/dist/graph/onchain/edge-schema.js +1 -1
- package/dist/graph/onchain/expand.js +1 -1
- package/dist/graph/onchain/onchain.spec.js +1 -1
- package/dist/graph/onchain/sdk-batch.d.ts +7 -1
- package/dist/graph/onchain/sdk-batch.js +1 -1
- package/dist/graph/onchain/sdk-dataplane.d.ts +6 -3
- package/dist/graph/onchain/sdk-dataplane.js +1 -1
- package/dist/graph/onchain/types.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/knowledge/account-marks.js +1 -1
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/allocation-templates.js +1 -1
- package/dist/knowledge/goal-completion.d.ts +12 -0
- package/dist/knowledge/goal-completion.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/index.d.ts +4 -0
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/migration-preflight.js +1 -1
- package/dist/knowledge/payment-tracker.d.ts +63 -0
- package/dist/knowledge/payment-tracker.js +1 -0
- package/dist/knowledge/recipient-constraint.d.ts +160 -0
- package/dist/knowledge/recipient-constraint.js +1 -0
- package/dist/knowledge/safety-rules.d.ts +1 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/knowledge/workspace-lists.d.ts +4 -0
- package/dist/knowledge/workspace-lists.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/arbitrator-interest.d.ts +2 -0
- package/dist/participation/arbitrator-interest.js +1 -1
- package/dist/participation/collaborator-interest.d.ts +2 -0
- package/dist/participation/collaborator-interest.js +1 -1
- package/dist/participation/customer-interest.d.ts +2 -0
- package/dist/participation/customer-interest.js +1 -1
- package/dist/participation/merchant-interest.d.ts +2 -0
- package/dist/participation/merchant-interest.js +1 -1
- package/dist/participation/supplier-interest.d.ts +2 -0
- package/dist/participation/supplier-interest.js +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/context-assembly.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +7 -0
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/pipeline-actions.d.ts +2 -2
- package/dist/playbooks/service-build/pipeline-actions.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/risk-aggregator.js +1 -1
- package/dist/playbooks/service-build/topology-query.js +1 -1
- package/dist/relationship/derivation.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +6 -6
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/evaluation/index.d.ts +4 -4
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +21 -21
- package/dist/schema/goal/planning.d.ts +6 -6
- package/dist/schema/industry-pack/index.d.ts +6 -6
- package/dist/schema/industry-pack/modes.d.ts +6 -6
- package/dist/schema/intent-radar/index.d.ts +16 -16
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +110 -8
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +37 -29
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +155 -155
- package/dist/schema/query/bi.d.ts +26 -26
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +15 -12
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/strategy-review/index.d.ts +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/bridge_operation.schema.json +14 -14
- package/dist/schemas/evaluation_operation.schema.json +7 -7
- package/dist/schemas/guard2file.schema.json +3 -3
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/local_history_operation.schema.json +1 -1
- package/dist/schemas/machineNode2file.schema.json +3 -3
- package/dist/schemas/messenger_operation.output.json +266 -38
- package/dist/schemas/messenger_operation.schema.json +27 -3
- package/dist/schemas/onchain_events.schema.json +1 -1
- package/dist/schemas/onchain_operations.schema.json +75 -77
- package/dist/schemas/onchain_operations_allocation.schema.json +6 -6
- package/dist/schemas/onchain_operations_arbitration.schema.json +3 -3
- package/dist/schemas/onchain_operations_contact.schema.json +3 -3
- package/dist/schemas/onchain_operations_demand.schema.json +3 -3
- package/dist/schemas/onchain_operations_gen_passport.schema.json +3 -3
- package/dist/schemas/onchain_operations_gen_proof.schema.json +3 -3
- package/dist/schemas/onchain_operations_guard.schema.json +4 -4
- package/dist/schemas/onchain_operations_machine.schema.json +11 -11
- package/dist/schemas/onchain_operations_order.schema.json +3 -3
- package/dist/schemas/onchain_operations_payment.schema.json +4 -4
- package/dist/schemas/onchain_operations_permission.schema.json +3 -3
- package/dist/schemas/onchain_operations_personal.schema.json +3 -3
- package/dist/schemas/onchain_operations_progress.schema.json +3 -3
- package/dist/schemas/onchain_operations_proof.schema.json +3 -3
- package/dist/schemas/onchain_operations_repository.schema.json +3 -3
- package/dist/schemas/onchain_operations_reward.schema.json +3 -3
- package/dist/schemas/onchain_operations_service.schema.json +9 -11
- package/dist/schemas/onchain_operations_treasury.schema.json +5 -5
- package/dist/schemas/onchain_table_data.output.json +14 -14
- package/dist/schemas/query_toolkit.output.json +38 -13
- package/dist/schemas/query_toolkit.schema.json +39 -11
- package/dist/strategy/collectors.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/permission.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/strategy-review.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/onchain.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/rules-hook.d.ts +2 -0
- package/dist/tools/rules-hook.js +1 -1
- package/dist/tools/shared.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{auditService}from'../../knowledge/index.js';import{getExperienceFeedback,recordOperationOutcome}from'../../experience/index.js';import{isEnabled as a306a,listServices}from'../../config/index.js';import{generateReminders}from'../../customer/index.js';import{getProfile}from'../../experience/user-profile.js';import{injectEvolutionContext,recordIndustrySignal}from'../../knowledge/flywheel-loop.js';import{WException,getMoveErrorDescription,WErrors}from'@wowok/wowok';import{GUARDQUERY}from'@wowok/wowok';import{assessGuardRisksForOperation,getRiskSummary}from'../../knowledge/guard-risk.js';import{derivePuzzleFromCallData,getPuzzleStatusBooleans,getPendingQuestions,generateConfirmationText}from'../../knowledge/guard-puzzle.js';import{inferSceneFromAction}from'../../knowledge/guard-ledger.js';import{extractGenericTokenType,registryDisplayHint}from'../../knowledge/fund-layer.js';import{matchSemanticPattern}from'../../knowledge/guard-translation.js';import{formatShortAddress}from'../../persona/address-format.js';import{EVENT_SEMANTIC_REGISTRY}from'../../knowledge/event-semantics.js';function booleanFromSignals(a,b){if(a)return!![];if(b)return![];return undefined;}function deriveAdviceRole(a,b){switch(a){case'order':case'personal':case'demand':return'customer';case'service':case'machine':case'permission':case'reward':case'repository':case'allocator':case'treasury':return'merchant';case'arbitration':if(b?.['vote']!==undefined)return'arbitrator';if(b?.['dispute']!==undefined)return'customer';return undefined;default:return undefined;}}const ERROR_RULES=[{'patterns':[/too\s*many\s*requests/i,/rate\s*limit/i,/429/i,/throttl/i,/faucet.*rate/i,/request.*limit.*exceeded/i],'error_code':'rate_limit','retryable':!![],'recovery_hint':'Rate\x20limit\x20hit\x20(HTTP\x20429).\x20Wait\x20with\x20exponential\x20backoff\x20and\x20retry.\x20To\x20check\x20existing\x20balance,\x20use\x20account_balance\x20query.'},{'patterns':[/gas.*budget.*exceeded/i,/out\s*of\s*gas/i,/gas\s*exceeded/i,/insufficient\s*gas/i,/not\s*enough\s*gas/i,/could not automatically determine a budget/i,/dry run failed.*budget/i,/Maximum gas/i],'error_code':'gas_exceeded','retryable':!![],'recovery_hint':'Gas\x20budget\x20exceeded.\x20Increase\x20the\x20gas_budget\x20parameter\x20or\x20claim\x20more\x20gas\x20tokens,\x20then\x20retry'},{'patterns':[/stock\s*not\s*enough/i,/E_STOCK_NOT_ENOUGH/i],'error_code':'stock_exhausted','retryable':![],'recovery_hint':'Merchant-side\x20stock\x20exhausted\x20(NOT\x20a\x20balance\x20issue).\x20Reduce\x20the\x20quantity,\x20pick\x20another\x20sale\x20item,\x20or\x20ask\x20the\x20merchant\x20to\x20restock'},{'patterns':[/sale\s*(item\s*)?(is\s*)?suspended/i,/E_SALE_SUSPENDED/i],'error_code':'sale_suspended','retryable':![],'recovery_hint':'The\x20sale\x20item\x20is\x20suspended\x20by\x20the\x20merchant.\x20Pick\x20another\x20item\x20or\x20contact\x20the\x20merchant'},{'patterns':[/discount.*time.*(?:window|invalid)/i,/E_DISCOUNT_TIME_INVALID/i],'error_code':'discount_invalid','retryable':![],'recovery_hint':'Discount\x20is\x20outside\x20its\x20[time_start,\x20time_end]\x20validity\x20window.\x20Buy\x20without\x20the\x20discount\x20or\x20ask\x20the\x20merchant\x20for\x20a\x20fresh\x20one'},{'patterns':[/insufficient\s*(balance|coin|fund)/i,/insufficient\s*amount/i,/ENOTENOUGH/i,/not\s*enough\s*(coin|balance)/i,/coin\s*not\s*enough/i,/balance\s*not\s*enough/i,/balance\s+insufficient/i,/balance\s+too\s+low/i,/\bnot\s+enough\b/i,/no\s+coins/i,/fee\s*not\s*enough/i,/Insufficient balance/i],'error_code':'insufficient_balance','retryable':!![],'recovery_hint':'Claim\x20faucet\x20tokens\x20via\x20account_operation\x20(faucet)\x20then\x20retry\x20the\x20call'},{'patterns':[/bcs.*(error|fail|invalid)/i,/BCS serialization/i,/serialization\s*(failure|error)/i,/deserialization\s*(failure|error)/i,/invalid bcs type/i,/Out of range.*bcs/i,/\bout\s+of\s+range\b/i,/not\s+bool/i,/Length out of range/i,/parse object content failed/i],'error_code':'bcs_error','retryable':![],'recovery_hint':'BCS\x20serialization/deserialization\x20error.\x20Verify\x20data\x20types\x20and\x20structure\x20match\x20the\x20expected\x20schema'},{'patterns':[/signature.*(invalid|fail|error|verif)/i,/invalid\s*signature/i,/signature\s*verification\s*failed/i,/bad\s*signature/i,/signing\s*fail/i,/crypto.*signature/i,/ed25519.*(fail|error|invalid)/i,/secp256k1.*(fail|error|invalid)/i,/failed\s+to\s+recover\s+public\s+key/i],'error_code':'signature_error','retryable':![],'recovery_hint':'Signature\x20verification\x20failed.\x20Check\x20that\x20the\x20correct\x20private\x20key\x20and\x20network\x20configuration\x20are\x20correct'},{'patterns':[/config.*(not set|not found|invalid|missing)/i,/RPC\s*not\s*configured/i,/network.*not\s*specified/i,/protocol network not specified/i,/account persistent storage not set/i,/config persistent storage not set/i,/account persistent storage not found/i,/no\s*rpc\s*url/i],'error_code':'config_error','retryable':![],'recovery_hint':'Configuration\x20error.\x20Verify\x20that\x20network,\x20RPC\x20endpoints,\x20and\x20required\x20environment\x20variables\x20are\x20properly\x20configured'},{'patterns':[/network/i,/timeout/i,/ECONNRESET/i,/ETIMEDOUT/i,/ECONNREFUSED/i,/EAI_AGAIN/i,/RPC\s*(error|failed|unreachable)/i,/socket\s*hang\s*up/i,/fetch\s*failed/i,/connection\s*(refused|reset|lost)/i,/dns\s*(error|fail)/i],'error_code':'network_error','retryable':!![],'recovery_hint':'Retry\x20the\x20call;\x20if\x20it\x20persists,\x20switch\x20RPC\x20endpoint\x20or\x20check\x20connectivity'},{'patterns':[/guard.*(reject|fail|denied|verif)/i,/verification\s*failed/i,/submission.*(invalid|fail|required)/i,/passport.*(invalid|fail|verif)/i,/passport\s+required/i,/move[._-]?abort.*guard/i,/Guard count exceeded limit/i,/Submission size exceeded limit/i,/Submission not found/i,/Guard not found/i,/Impact guard not found/i],'error_code':'guard_rejected','retryable':![],'recovery_hint':'Fill\x20the\x20Guard\x20submission\x20data\x20(see\x20the\x20\x27submission\x27\x20field)\x20and\x20resubmit\x20via\x20call_with_submission'},{'patterns':[/WIP file verification failed/i,/Failed to load WIP file/i,/WIP.*hash\s*mismatch/i,/wip.*hash.*not\s*match/i,/Invalid WIP file structure/i,/wip.*not\s*found/i,/wip.*unreachable/i,/wip_file.*error/i],'error_code':'wip_verification_failed','retryable':![],'recovery_hint':['WIP\x20file\x20must\x20be\x20publicly\x20accessible\x20via\x20HTTP(S)\x20URL\x20—\x20local\x20file\x20paths\x20cannot\x20be\x20stored\x20on-chain.','Deployment\x20options\x20(pick\x20one):','\x20\x201.\x20GitHub\x20Pages\x20(free,\x20stable):\x20upload\x20.wip\x20file\x20to\x20a\x20repo,\x20enable\x20Pages,\x20use\x20raw\x20URL.','\x20\x20\x20\x20\x20Example:\x20https://<user>.github.io/<repo>/<file>.wip','\x20\x20\x20\x20\x20Or\x20raw\x20URL:\x20https://raw.githubusercontent.com/<user>/<repo>/<branch>/<file>.wip','\x20\x202.\x20IPFS\x20(free,\x20decentralized):\x20upload\x20via\x20Pinata\x20(https://pinata.cloud)\x20or\x20nft.storage.','\x20\x20\x20\x20\x20Use\x20the\x20ipfs://<CID>\x20or\x20https://<gateway>/ipfs/<CID>\x20URL\x20form.','\x20\x20\x20\x20\x20Common\x20gateways:\x20https://ipfs.io/ipfs/,\x20https://cloudflare-ipfs.com/ipfs/,\x20https://dweb.link/ipfs/','\x20\x203.\x20User\x27s\x20own\x20website:\x20serve\x20the\x20.wip\x20file\x20from\x20your\x20static\x20site.','\x20\x204.\x20Generate\x20a\x20fresh\x20WIP\x20file\x20locally\x20first\x20via\x20wip_file\x20(type=\x27generate\x27),\x20upload\x20it,\x20then\x20re-submit\x20the\x20URL.','After\x20updating\x20the\x20sale\x27s\x20wip\x20URL,\x20re-run\x20the\x20operation.']['join']('\x0a')},{'patterns':[/setting lock duration not exceeded/i,/E_LOCKED_TIME_NOT_ENOUGH/i,/locked time not enough/i,/lock duration not (?:elapsed|exceeded|met)/i],'error_code':'time_lock_not_elapsed','retryable':!![],'recovery_hint':'Service\x20setting_lock_duration\x20has\x20not\x20elapsed\x20since\x20pause.\x20Pause\x20the\x20Service,\x20wait\x20until\x20paused_time\x20+\x20setting_lock_duration\x20<=\x20current\x20time,\x20then\x20retry.'},{'patterns':[/already\s*publish/i,/immutable/i,/cannot\s*(modify|change|mutate)/i,/is\s*published/i,/Service already published/i,/Machine already published/i],'error_code':'immutable_violation','retryable':![],'recovery_hint':'Object\x20is\x20in\x20an\x20immutable\x20state\x20(e.g.\x20Service\x20already\x20published).\x20Recreate\x20the\x20object\x20if\x20a\x20different\x20config\x20is\x20needed'},{'patterns':[/permission/i,/unauthorized/i,/forbidden/i,/not\s*(the\s*)?owner/i,/access\s*denied/i,/no permission/i,/Permission denied/i,/Not the builder/i,/Not admin/i,/No operation permission/i,/Not the holder/i,/not\s+(?:authorized|approved)\b/i,/not\s+allowed/i,/unable\s+to\s+receive\s+object/i],'error_code':'permission_denied','retryable':![],'recovery_hint':'Use\x20an\x20account\x20with\x20the\x20required\x20permission,\x20or\x20pass\x20permission_guard\x20IDs\x20via\x20env.permission_guard'},{'patterns':[/not\s*found/i,/does\s*not\s*exist/i,/ENOTFOUND/i,/no\s*such\s*object/i,/unknown\s*object/i,/account not found/i,/address not found/i,/token not found/i,/Node not found/i,/Policy not found/i,/Reward not found/i],'error_code':'object_not_found','retryable':![],'recovery_hint':'Verify\x20the\x20object\x20ID/name\x20with\x20query_toolkit;\x20local_mark\x20names\x20are\x20case-sensitive'},{'patterns':[/state\s*(conflict|mismatch)/i,/already\s*exist/i,/conflict/i,/duplicate/i,/version\s*mismatch/i,/name exist/i,/Duplicate forward name/i,/Duplicate node previous/i,/already claimed/i,/already specified/i,/already accomplished/i,/already used/i,/Status does not match/i,/does not match/i,/\bnot\s+published\b/i,/\bis\s+paused\b/i,/global\s+pause/i,/\bis\s+listed\b/i,/not\s+listed\b/i,/\blocked\b/i,/\bmismatch\b/i,/already\s+(?:set|minted|listed|verified|authorized)\b/i,/\bnot\s+empty\b/i,/non-zero\s+balance/i,/\bnot\s+match\b/i,/not\s+set\s+for\s+epoch/i,/no\s+allocator\b/i,/not\s+satisfied/i,/invariant\s+violation/i],'error_code':'state_conflict','retryable':![],'recovery_hint':'Object\x20state\x20conflicts\x20with\x20the\x20operation.\x20Query\x20the\x20current\x20state\x20with\x20query_toolkit\x20and\x20adjust\x20parameters'},{'patterns':[/invalid/i,/missing\s*(field|param|required)/i,/required/i,/expected/i,/malformed/i,/parse\s*error/i,/type\s*mismatch/i,/invalid argument/i,/Invalid value/i,/Invalid data value/i,/Invalid string value/i,/Invalid argument/i,/IsValid/i,/type does not match/i,/value type/i,/exceeds\s*limit/i,/indemnity\s*(exceeds|too\s*large)/i,/max(?:imum)?\b[^\n]*\bexceeded/i,/\bexceeded\s+(?:the\s+)?(?:limit|count)\b/i,/length\s+exceeded/i,/count\s+exceeded/i,/\bsize\s+exceeded\b/i,/\btoo\s+(?:many|long)\b/i,/not\s+(?:address|u64|number)\s+type/i,/not\s+system\s+address/i,/\bempty\b/i,/\bnot\s+equal\b/i,/unequal\s+lengths/i,/index\s+out\s+of\s+bounds?\b/i,/(?:arithmetic\s+)?(?:overflow|underflow)/i,/division\s+by\s+zero/i,/modulo\s+by\s+zero/i,/rate\s+(?:not\s+10000|exceeds)/i,/amount\s+(?:below\s+threshold|exceeds)/i,/store\s+from\s+id\s+not\s+compatible/i,/not\s+supported/i,/bad\s+(?:witness|transaction\s+hash\s+length)/i,/wrong\s+(?:borrow|value|inner\s+version|kiosk)/i,/incorrect\s+amount/i,/input\s+too\s+long/i,/vector\s+not\s+enough/i,/unknown\s+(?:action|requirement)/i,/illegal\s+rule/i,/not\s+zero/i,/no\s+config/i,/not\s+installed/i,/not\s+wow/i],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Check\x20parameter\x20format\x20against\x20the\x20tool\x20schema;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'}],WERROR_MAPPINGS=[{'codes':[WErrors['AccountNotFound'],WErrors['AddressNotFound'],WErrors['TokenNotFoundLocally']],'error_code':'object_not_found','retryable':![],'recovery_hint':'Verify\x20the\x20object\x20ID/name\x20with\x20query_toolkit;\x20local_mark\x20names\x20are\x20case-sensitive'},{'codes':[WErrors['NoPermission']],'error_code':'permission_denied','retryable':![],'recovery_hint':'Use\x20an\x20account\x20with\x20the\x20required\x20permission,\x20or\x20pass\x20permission_guard\x20IDs\x20via\x20env.permission_guard'},{'codes':[WErrors['IsValidDescription'],WErrors['IsValidName'],WErrors['IsValidName_AllowEmpty'],WErrors['IsValidEndpoint'],WErrors['IsValidAddress'],WErrors['IsValidArgType'],WErrors['IsValidTokenType'],WErrors['IsValidUint'],WErrors['IsValidInt'],WErrors['IsValidU8'],WErrors['IsValidU16'],WErrors['IsValidU32'],WErrors['IsValidU64'],WErrors['IsValidU128'],WErrors['IsValidU256'],WErrors['IsValidRate'],WErrors['IsValidArray'],WErrors['IsValidObjects'],WErrors['AllInvalid'],WErrors['InvalidParam'],WErrors['IsValidPermissionIndex'],WErrors['IsValidKey'],WErrors['IsValidIdentifier'],WErrors['IsValidHttpUrl'],WErrors['IsValidBizPermissionIndex'],WErrors['IsValidServiceItemName'],WErrors['IsValidCoinType'],WErrors['IsValidGuardIdentifier'],WErrors['IsValidValue'],WErrors['IsValidValueType'],WErrors['IsValidLocation'],WErrors['WitnessTypeInvalid']],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Check\x20parameter\x20format\x20against\x20the\x20tool\x20schema;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'},{'codes':[WErrors['BcsTypeInvalid'],WErrors['ParseObjectContentFailed']],'error_code':'bcs_error','retryable':![],'recovery_hint':'BCS\x20serialization/deserialization\x20error.\x20Verify\x20data\x20types\x20and\x20structure\x20match\x20the\x20expected\x20schema'},{'codes':[WErrors['NetworkInvalid']],'error_code':'config_error','retryable':![],'recovery_hint':'Configuration\x20error.\x20Verify\x20that\x20network,\x20RPC\x20endpoints,\x20and\x20required\x20environment\x20variables\x20are\x20properly\x20configured'},{'codes':[WErrors['AccountPersistentStorageNotSet'],WErrors['ConfigPersistentStorageNotSet'],WErrors['AccountPersistentStorageNotFound']],'error_code':'config_error','retryable':![],'recovery_hint':'Persistent\x20storage\x20not\x20configured.\x20Initialize\x20account\x20storage\x20before\x20performing\x20this\x20operation'},{'codes':[WErrors['AccountNameExist'],WErrors['LocalMarkNameExist']],'error_code':'state_conflict','retryable':![],'recovery_hint':'Object\x20state\x20conflicts\x20with\x20the\x20operation.\x20Query\x20the\x20current\x20state\x20with\x20query_toolkit\x20and\x20adjust\x20parameters'},{'codes':[WErrors['MaxObjectsPerQuery'],WErrors['ResourceTagCountExceeded'],WErrors['AddressCountExceeded'],WErrors['NumberCountExceeded']],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Count\x20limit\x20exceeded.\x20Reduce\x20the\x20number\x20of\x20items\x20per\x20request\x20and\x20retry'}];function isWException(a){return a instanceof WException;}function classifyWException(a){const b=a['getErrorCode'](),c=WERROR_MAPPINGS['find'](e=>e['codes']['includes'](b));if(!c)return undefined;const d={'error_code':c['error_code'],'retryable':c['retryable'],'recovery_hint':c['recovery_hint']};return d;}export const MOVE_ABORT_ERROR_MAP={'service:10':{'error_code':'invalid_parameter','recovery_hint':'Discounts\x20are\x20bound\x20to\x20their\x20receiver\x20and\x20cannot\x20be\x20transferred.\x20Use\x20discount_issue\x20to\x20grant\x20a\x20new\x20discount\x20to\x20the\x20target\x20address'},'service:16':{'error_code':'stock_exhausted'},'service:18':{'error_code':'guard_rejected','recovery_hint':'This\x20Service\x20requires\x20buyers\x20to\x20present\x20a\x20Guard\x20passport\x20(buyer_guard\x20configured).\x20Attach\x20a\x20passport\x20verifying\x20the\x20required\x20guard\x20and\x20resubmit'},'service:25':{'error_code':'state_conflict','recovery_hint':'This\x20operation\x20requires\x20the\x20Service\x20to\x20have\x20an\x20Arbitration\x20bound\x20together\x20with\x20a\x20compensation\x20fund.\x20Configure\x20arbitration\x20and\x20compensation\x20first'},'service:31':{'error_code':'invalid_parameter','recovery_hint':'The\x20submitted\x20wip_hash\x20does\x20not\x20match\x20the\x20Service\x27s\x20current\x20WIP\x20hash\x20—\x20the\x20merchant\x20may\x20have\x20updated\x20the\x20WIP.\x20Re-query\x20the\x20Service\x27s\x20sale\x20info\x20and\x20resubmit\x20with\x20the\x20current\x20wip_hash'},'service:33':{'error_code':'state_conflict','recovery_hint':'The\x20Service\x20cannot\x20bind\x20an\x20Arbitration\x20whose\x20permission\x20is\x20the\x20same\x20as\x20its\x20own\x20—\x20the\x20Service\x20owner\x20would\x20then\x20control\x20dispute\x20resolution,\x20breaking\x20fairness.\x20Use\x20a\x20different\x20Arbitration\x20or\x20change\x20the\x20Service\x27s\x20permission\x20first'},'service:34':{'error_code':'sale_suspended'},'service:35':{'error_code':'discount_invalid'},'machine:12':{'error_code':'guard_rejected','recovery_hint':'The\x20retained\x20submission\x20identifiers\x20do\x20not\x20exist\x20in\x20the\x20Guard.\x20Query\x20the\x20Guard\x27s\x20submission\x20table\x20and\x20correct\x20the\x20retained_submission\x20list'},'machine:14':{'error_code':'invalid_parameter','recovery_hint':'A\x20Machine\x20forward\x20must\x20define\x20one\x20of\x20namedOperator,\x20permissionIndex,\x20or\x20guard.\x20Set\x20one\x20of\x20them\x20for\x20the\x20forward'},'progress:8':{'error_code':'invalid_parameter','recovery_hint':'This\x20forward\x20requires\x20a\x20permission_index\x20for\x20non-named-operator\x20holders.\x20Supply\x20the\x20permission_index\x20of\x20a\x20Permission\x20the\x20Machine\x20recognizes'},'order:3':{'error_code':'invalid_parameter','recovery_hint':'This\x20order\x20requires\x20progress\x20specification\x20(the\x20Service\x20is\x20machine-backed).\x20Supply\x20the\x20progress\x20parameters,\x20or\x20query\x20the\x20machine\x20node\x20info\x20for\x20the\x20expected\x20values'},'order:8':{'error_code':'invalid_parameter','recovery_hint':'This\x20order\x20requires\x20allocation\x20specification.\x20Supply\x20the\x20allocation\x20parameters\x20matching\x20the\x20Service\x27s\x20allocator\x20configuration'},'arb:4':{'error_code':'time_lock_not_elapsed','recovery_hint':'The\x20voting\x20deadline\x20has\x20not\x20passed\x20yet.\x20Wait\x20until\x20the\x20deadline\x20elapses,\x20then\x20tally\x20the\x20votes'},'arb:7':{'error_code':'state_conflict','recovery_hint':'The\x20voting\x20deadline\x20has\x20passed\x20—\x20voting\x20is\x20closed.\x20Query\x20the\x20proposition\x20state\x20to\x20see\x20the\x20outcome'},'arb:8':{'error_code':'time_lock_not_elapsed','recovery_hint':'The\x20withdraw\x20duration\x20has\x20not\x20elapsed\x20yet.\x20Wait\x20until\x20the\x20lock\x20duration\x20passes,\x20then\x20withdraw'},'passport:2':{'error_code':'guard_rejected','recovery_hint':'Guards\x20relied\x20upon\x20by\x20this\x20Guard\x20must\x20be\x20added\x20to\x20the\x20Passport\x20first\x20(dependents-before-dependent\x20order).\x20Add\x20the\x20relied-upon\x20guards\x20to\x20the\x20passport,\x20then\x20add\x20this\x20one'},'passport:5':{'error_code':'guard_rejected','recovery_hint':'The\x20passport\x20lacks\x20the\x20required\x20verification\x20for\x20this\x20operation.\x20Complete\x20the\x20verification\x20scene\x20first'},'passport:6':{'error_code':'guard_rejected','recovery_hint':'The\x20guard\x20is\x20not\x20an\x20impact\x20guard\x20of\x20this\x20Passport\x20—\x20its\x20result\x20does\x20not\x20participate\x20in\x20the\x20passport\x20outcome.\x20Query\x20the\x20passport\x27s\x20guard\x20list\x20and\x20use\x20a\x20guard\x20registered\x20with\x20impack=true'},'passport:11':{'error_code':'guard_rejected','recovery_hint':'Digest\x20mismatch\x20in\x20proof\x20verification.\x20The\x20proof\x20does\x20not\x20cover\x20the\x20expected\x20content\x20—\x20regenerate\x20the\x20proof\x20against\x20the\x20current\x20target'},'reward:1':{'error_code':'time_lock_not_elapsed','recovery_hint':'The\x20guard-add\x20lock\x20(guard_not_added_expiration_time)\x20is\x20still\x20active\x20and\x20cannot\x20be\x20replaced\x20yet.\x20Wait\x20until\x20it\x20elapses,\x20then\x20set\x20the\x20new\x20lock\x20time'},'reward:2':{'error_code':'invalid_parameter','retryable':![],'recovery_hint':'The\x20guard\x27s\x20expiration_time\x20has\x20already\x20passed\x20and\x20it\x20can\x20no\x20longer\x20be\x20used.\x20Ask\x20the\x20reward\x20issuer\x20to\x20re-add\x20the\x20guard\x20with\x20a\x20later\x20expiration\x20(or\x20use\x20a\x20different\x20guard),\x20then\x20retry'},'reward:10':{'error_code':'time_lock_not_elapsed','recovery_hint':'Guards\x20are\x20locked\x20until\x20guard_not_added_expiration_time\x20elapses.\x20Wait\x20until\x20then\x20before\x20adding\x20guards'},'reward:11':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard-add\x20lock\x20time\x20must\x20be\x20strictly\x20later\x20than\x20the\x20current\x20clock\x20time.\x20Set\x20a\x20future\x20timestamp'},'repository:8':{'error_code':'invalid_parameter','recovery_hint':'The\x20referenced\x20policy\x20does\x20not\x20exist\x20in\x20the\x20repository\x20(option\x20is\x20none).\x20Query\x20the\x20repository\x20policies\x20and\x20use\x20a\x20valid\x20policy\x20ID'},'repository:11':{'error_code':'invalid_parameter','recovery_hint':'The\x20policy\x27s\x20guard\x20entry\x20expects\x20id/data\x20from\x20the\x20passport\x20submission\x20(id_from_submission/data_from_submission\x20is\x20set),\x20but\x20this\x20call\x20passes\x20explicit\x20values.\x20Use\x20the\x20submission-based\x20call\x20route,\x20or\x20fix\x20the\x20policy\x20entry'},'repository:12':{'error_code':'guard_rejected','recovery_hint':'The\x20write_guard\x20is\x20not\x20an\x20impact\x20guard\x20in\x20the\x20passport\x20—\x20the\x20passport\x20must\x20verify\x20this\x20guard\x20with\x20impack=true.\x20Rebuild\x20the\x20passport\x20including\x20the\x20write_guard\x20as\x20an\x20impact\x20guard'},'repository:13':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20in\x20the\x20repository\x20policy\x27s\x20guard\x20list.\x20Query\x20the\x20policy\x27s\x20guards\x20and\x20use\x20a\x20registered\x20one'},'repository:14':{'error_code':'invalid_parameter','recovery_hint':'The\x20ID\x20vector\x20is\x20shorter\x20than\x20required\x20—\x20a\x20vector\x20length\x20problem,\x20not\x20a\x20balance\x20problem.\x20Align\x20the\x20vector\x20lengths\x20with\x20the\x20operation\x27s\x20requirement'},'repository:15':{'error_code':'invalid_parameter','recovery_hint':'The\x20data\x20vector\x20is\x20shorter\x20than\x20required\x20—\x20a\x20vector\x20length\x20problem,\x20not\x20a\x20balance\x20problem.\x20Align\x20the\x20vector\x20lengths\x20with\x20the\x20operation\x27s\x20requirement'},'repository:20':{'error_code':'invalid_parameter','recovery_hint':'The\x20policy\x20entry\x20requires\x20the\x20id\x20to\x20come\x20from\x20the\x20passport\x20submission\x20(id_from_submission\x20is\x20set).\x20Use\x20the\x20submission-based\x20call\x20route\x20that\x20supplies\x20the\x20passport'},'repository:21':{'error_code':'invalid_parameter','recovery_hint':'The\x20quote\x20guard\x20must\x20be\x20a\x20depended\x20guard\x20(no\x20relies\x20of\x20its\x20own,\x20immutable,\x20with\x20reputation).\x20Configure\x20the\x20guard\x20accordingly\x20before\x20setting\x20it\x20as\x20the\x20policy\x27s\x20quote\x20guard'},'repository:22':{'error_code':'invalid_parameter','recovery_hint':'The\x20policy\x20requires\x20a\x20write_guard\x20when\x20id_from\x20is\x20None.\x20Set\x20the\x20policy\x27s\x20write_guard\x20or\x20use\x20a\x20non-None\x20id_from'},'repository:23':{'error_code':'invalid_parameter','recovery_hint':'id_from_submission\x20is\x20forbidden\x20when\x20id_from\x20is\x20Clock\x20or\x20Signer\x20(the\x20id\x20is\x20auto-generated).\x20Remove\x20id_from_submission\x20from\x20the\x20policy\x20entry\x20or\x20change\x20id_from'},'guard:6':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20being\x20relied\x20upon\x20must\x20be\x20a\x20depended\x20guard\x20(no\x20relies\x20of\x20its\x20own,\x20immutable,\x20with\x20reputation).\x20Rely\x20on\x20a\x20terminal\x20guard,\x20not\x20one\x20with\x20its\x20own\x20dependencies'},'guard:7':{'error_code':'invalid_parameter','recovery_hint':'A\x20Guard\x20cannot\x20depend\x20on\x20itself.\x20Remove\x20the\x20self-reference\x20from\x20the\x20relies\x20list'},'guard:9':{'error_code':'invalid_parameter','recovery_hint':'The\x20submission\x20identifier\x27s\x20object\x20type\x20does\x20not\x20match\x20the\x20Guard\x20table\x20entry.\x20Check\x20each\x20identifier\x27s\x20type\x20against\x20the\x20Guard\x27s\x20table'},'guard:10':{'error_code':'invalid_parameter','recovery_hint':'The\x20identifiers\x20and\x20values\x20vectors\x20must\x20have\x20equal\x20lengths.\x20Align\x20the\x20counts'},'guard:11':{'error_code':'guard_rejected','recovery_hint':'The\x20submission\x20identifier\x20is\x20not\x20in\x20the\x20Guard\x27s\x20table.\x20Query\x20the\x20Guard\x27s\x20table\x20identifiers\x20and\x20submit\x20a\x20valid\x20one'},'allocation:5':{'error_code':'invalid_parameter','recovery_hint':'Multiple\x20surplus\x20entries\x20are\x20not\x20supported.\x20Provide\x20at\x20most\x20one\x20surplus\x20entry\x20in\x20the\x20allocation'},'allocation:8':{'error_code':'state_conflict','recovery_hint':'No\x20allocators\x20are\x20configured\x20for\x20this\x20order.\x20The\x20merchant\x20must\x20configure\x20the\x20Service\x27s\x20allocation\x20first'},'allocation:9':{'error_code':'invalid_parameter','recovery_hint':'Payment\x20info\x20is\x20missing\x20for\x20the\x20allocation.\x20Supply\x20the\x20payment\x20parameters\x20required\x20by\x20the\x20order'},'allocation:12':{'error_code':'invalid_parameter','recovery_hint':'The\x20split\x20amount\x20is\x20below\x20the\x20allocator\x27s\x20minimum\x20threshold.\x20Raise\x20the\x20amount\x20or\x20remove\x20the\x20split'},'transfer:0':{'error_code':'invalid_parameter','recovery_hint':'A\x20shared\x20non-new\x20object\x20was\x20passed\x20where\x20only\x20newly-created\x20objects\x20are\x20allowed'},'coin:3':{'error_code':'state_conflict','recovery_hint':'The\x20operation\x20is\x20disallowed\x20while\x20the\x20coin\x20is\x20globally\x20paused.\x20Wait\x20for\x20the\x20pause\x20to\x20be\x20lifted'},'kiosk:4':{'error_code':'state_conflict','recovery_hint':'The\x20item\x20is\x20listed\x20exclusively\x20on\x20another\x20marketplace.\x20Delist\x20it\x20there\x20before\x20this\x20operation'},'token:5':{'error_code':'insufficient_balance','recovery_hint':'The\x20token\x20balance\x20cannot\x20be\x20consumed\x20(a\x20locked\x20portion\x20exists).\x20Unlock\x20or\x20acquire\x20more\x20balance\x20first'},'package:0':{'error_code':'invalid_parameter','recovery_hint':'Not\x20a\x20one-time\x20witness\x20—\x20the\x20module\x20initializer\x20pattern\x20is\x20invalid'},'package:1':{'error_code':'invalid_parameter','recovery_hint':'The\x20witness\x20is\x20too\x20permissive\x20for\x20this\x20operation'},'package:4':{'error_code':'invalid_parameter','recovery_hint':'Wrong\x20upgrade\x20cap\x20for\x20this\x20package\x20upgrade'},'u64:1':{'error_code':'invalid_parameter','recovery_hint':'Arithmetic\x20overflow\x20—\x20the\x20computed\x20value\x20exceeds\x20u64.\x20Reduce\x20the\x20amounts'},'u64:2':{'error_code':'invalid_parameter','recovery_hint':'Arithmetic\x20underflow\x20—\x20the\x20computed\x20value\x20goes\x20below\x20zero.\x20Check\x20the\x20subtraction\x20inputs'},'u64:3':{'error_code':'invalid_parameter','recovery_hint':'Division\x20by\x20zero\x20—\x20the\x20divisor\x20is\x20zero.\x20Guard\x20the\x20divisor\x20before\x20dividing'},'u64:4':{'error_code':'invalid_parameter','recovery_hint':'Modulo\x20by\x20zero\x20—\x20the\x20divisor\x20is\x20zero.\x20Guard\x20the\x20divisor\x20before\x20the\x20modulo'},'bcs:0':{'error_code':'bcs_error','recovery_hint':'BCS\x20value\x20out\x20of\x20range'},'bcs:1':{'error_code':'bcs_error','recovery_hint':'BCS\x20value\x20is\x20not\x20a\x20bool'},'bcs:2':{'error_code':'bcs_error','recovery_hint':'BCS\x20length\x20out\x20of\x20range'},'address:0':{'error_code':'invalid_parameter','recovery_hint':'Address\x20parse\x20error\x20—\x20the\x20byte\x20length\x20is\x20not\x2032'},'hex:0':{'error_code':'invalid_parameter','recovery_hint':'Invalid\x20hex\x20length'},'hex:1':{'error_code':'invalid_parameter','recovery_hint':'Not\x20a\x20valid\x20hex\x20character'}};function canonicalDefaultFor(a){const b=ERROR_RULES['find'](c=>c['error_code']===a);if(b)return{'retryable':b['retryable'],'recovery_hint':b['recovery_hint']};return{'retryable':![],'recovery_hint':'Inspect\x20the\x20full\x20error\x20message;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'};}function classifyMoveAbort(a){const b=MOVE_ABORT_ERROR_MAP[a['module']+':'+a['code']];if(!b)return undefined;const c=canonicalDefaultFor(b['error_code']),d=b['recovery_hint']??c['recovery_hint'],e={'error_code':b['error_code'],'retryable':b['retryable']??c['retryable'],'recovery_hint':a['description']&&!d['includes'](a['description'])?d+'.\x20Details:\x20'+a['description']:d,'move_abort_info':a};return e;}function isWowokSystemAddress(a){const b=a['toLowerCase']()['replace'](/^0x/,'')['replace'](/^0+(?=.)/,'');return b==='1'||b==='2';}export function normalizeErrorMessage(a){if(typeof a==='string')return a;if(a&&typeof a==='object'){const b=a;if(typeof b['message']==='string'&&b['message'])return b['message'];if(typeof b['error']==='string'&&b['error'])return b['error'];try{return JSON['stringify'](a);}catch{return String(a);}}if(a===undefined||a===null)return'';return String(a);}function extractMoveAbortInfo(a){const b=normalizeErrorMessage(a);if(!b)return undefined;const c=b['match'](/MoveAbort\(.*,\s*(\d+)\s*\)/),d=b['match'](/name:\s*Identifier\("([^"]+)"\)/),e=b['match'](/address:\s*([0-9a-fA-Fx]+)/);if(c&&d&&e){const i=parseInt(c[0x1],0xa),j=d[0x1]['toLowerCase'](),k=e[0x1]['toLowerCase']();if(isWowokSystemAddress(k)){const l=getMoveErrorDescription(j,i)??undefined;return{'module':j,'code':i,'description':l};}}const f=b['match'](/abort code:\s*(\d+)/),g=b['match'](/'0x[0-9a-fA-F]+::([^:]+)::[^']+'/),h=b['match'](/'(0x[0-9a-fA-F]+)::/);if(f&&g&&h){const m=parseInt(f[0x1],0xa),n=g[0x1]['toLowerCase'](),o=h[0x1]['toLowerCase']();if(isWowokSystemAddress(o)){const p=getMoveErrorDescription(n,m)??undefined;return{'module':n,'code':m,'description':p};}}return undefined;}export function classifyError(a,b){const c=normalizeErrorMessage(a),d=extractMoveAbortInfo(c);if(d){const g=classifyMoveAbort(d);if(g)return g;}if(b!==undefined&&isWException(b)){const h=classifyWException(b);if(h)return d&&(h['move_abort_info']=d,d['description']&&h['recovery_hint']&&!h['recovery_hint']['includes'](d['description'])&&(h['recovery_hint']=h['recovery_hint']+'.\x20Details:\x20'+d['description'])),h;}if(!c)return{'error_code':'unknown','retryable':![]};const e=d?.['description']?c+'\x0a'+d['description']:c;for(const i of ERROR_RULES){if(i['patterns']['some'](j=>j['test'](e))){const j={'error_code':i['error_code'],'retryable':i['retryable'],'recovery_hint':i['recovery_hint']};return d&&(j['move_abort_info']=d,d['description']&&(j['recovery_hint']=j['recovery_hint']+'.\x20Details:\x20'+d['description'])),j;}}const f={'error_code':'unknown','retryable':![],'recovery_hint':'Inspect\x20the\x20full\x20error\x20message;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'};return d&&(f['move_abort_info']=d,d['description']&&(f['recovery_hint']=d['description']+'.\x20'+f['recovery_hint'])),f;}const INTENT_RULES=[{'operation_type':'service','signals':a=>a?.['publish']===!![],'intent':'publish_service','confidence':0.95},{'operation_type':'service','signals':a=>a?.['name']&&a?.['publish']===undefined,'intent':'create_service','confidence':0.9},{'operation_type':'service','intent':'modify_service','confidence':0.7},{'operation_type':'machine','intent':'configure_machine','confidence':0.9},{'operation_type':'progress','intent':'update_progress','confidence':0.9},{'operation_type':'order','signals':a=>!!a?.['arb'],'intent':'apply_arbitration','confidence':0.9},{'operation_type':'order','intent':'manage_order','confidence':0.85},{'operation_type':'payment','signals':a=>a?.['receive']===!![],'intent':'claim_escrow_payment','confidence':0.95},{'operation_type':'payment','intent':'send_payment','confidence':0.9},{'operation_type':'reward','intent':'manage_reward','confidence':0.9},{'operation_type':'demand','intent':'post_demand','confidence':0.9},{'operation_type':'treasury','intent':'manage_treasury','confidence':0.9},{'operation_type':'allocation','intent':'allocate_funds','confidence':0.9},{'operation_type':'permission','intent':'manage_permission','confidence':0.9},{'operation_type':'guard','intent':'configure_guard','confidence':0.9},{'operation_type':'arbitration','intent':'manage_arbitration','confidence':0.9},{'operation_type':'contact','intent':'manage_contact','confidence':0.9},{'operation_type':'repository','intent':'manage_repository','confidence':0.9},{'operation_type':'personal','intent':'manage_personal','confidence':0.9},{'operation_type':'gen_passport','intent':'generate_passport','confidence':0.95},{'operation_type':'proof','intent':'create_proof','confidence':0.9},{'operation_type':'gen_proof','intent':'generate_proof','confidence':0.95},{'operation_type':'bridge_cross_chain_wow_to_evm','intent':'cross_chain_wow_to_evm_deposit','confidence':0.95},{'operation_type':'bridge_cross_chain_evm_to_wow','intent':'cross_chain_evm_to_wow_deposit','confidence':0.95},{'operation_type':'bridge_claim_wow_to_evm','intent':'claim_wow_to_evm','confidence':0.95},{'operation_type':'bridge_withdraw','intent':'withdraw_from_evm_account','confidence':0.9},{'operation_type':'bridge_query_active_evm_account','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_supported_evm_chains','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_supported_tokens','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_transfer_list','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_transfer_status','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_manage_evm_rpc','intent':'manage_evm_rpc','confidence':0.9},{'operation_type':'account_new','intent':'create_account','confidence':0.95},{'operation_type':'account_faucet','intent':'claim_faucet','confidence':0.95},{'operation_type':'account_balance','intent':'query_balance','confidence':0.9},{'operation_type':'mark_add','intent':'create_local_mark','confidence':0.9},{'operation_type':'mark_remove','intent':'remove_local_mark','confidence':0.9},{'operation_type':'mark_query','intent':'query_local_marks','confidence':0.9},{'operation_type':'local_info','intent':'query_local_info','confidence':0.9},{'operation_type':'query_toolkit','intent':'query_objects','confidence':0.85},{'operation_type':'onchain_events','intent':'query_events','confidence':0.85},{'operation_type':'onchain_table_data','intent':'query_table_data','confidence':0.85}];export function inferIntent(a,b){const c=INTENT_RULES['filter'](f=>f['operation_type']===a),d=c['find'](f=>f['signals']&&f['signals'](b));if(d)return d['intent'];const e=c['find'](f=>!f['signals']);return e?.['intent']??a;}function inferStatus(a){if(a&&typeof a==='object'&&'error'in a)return'failed';if(a&&typeof a==='object'&&'digest'in a)return a?.['effects']?.['status']?.['status']==='success'?'success':'failed';return'success';}const OBJECT_TYPE_TO_ROLE={'service':'Service','machine':'Machine','progress':'Progress','permission':'Permission','guard':'Guard','order':'Order','arb':'ArbCase','arbitration':'Arbitration','messenger':'Messenger','contact':'Contact','demand':'Demand','reward':'Reward','personal':'Personal','repository':'Repository','treasury':'Treasury','discount':'Discount','allocation':'Allocation','payment':'Payment','passport':'Passport','proof':'Proof'};export function objectTypeToRole(a){if(!a)return'Other';const b=a['replace'](/<.*>/,'')['trim'](),c=b['split']('::'),d=(c[c['length']-0x1]||'')['toLowerCase']();return OBJECT_TYPE_TO_ROLE[d]??'Other';}export function tagObjectRoles(a){if(!Array['isArray'](a))return[];return a['filter'](b=>b&&(b['objectId']||b['object']?.['objectId']))['map'](b=>{const d=b['objectId']||b['object']?.['objectId'],e=b['objectType']||b['object']?.['objectType']||'',f=b['type']||'';return{'id':d,'role':objectTypeToRole(e),'immutable':e['includes']('Service')&&f==='published'};});}const GAS_COIN_PATTERNS=[/::wow::WOW$/i],SMALL_AMOUNT_THRESHOLD=BigInt(0xf4240);function isNegative(a){return String(a??'0')['startsWith']('-');}function hasEventMatch(a,b){if(!Array['isArray'](a))return![];return a['some'](c=>b['test'](String(c?.['type']??c?.['event_type']??'')));}function isGasCoin(a){if(!a)return![];return GAS_COIN_PATTERNS['some'](b=>b['test'](a));}function absAmount(a){try{return BigInt(String(a)['replace']('-','')||'0');}catch{return BigInt(0x0);}}const FUND_ROLE_RULES=[{'when':a=>hasEventMatch(a['events'],/order::OrderPaidEvent/i),'role':'payment','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/order::OrderRefundedEvent|order::RefundEvent/i),'role':'refund','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/reward::RewardClaimedEvent|reward::ClaimedEvent/i),'role':'reward','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/arbitration::CompensationEvent|arbitration::RefundEvent/i),'role':'compensation','confidence':0.9},{'when':a=>hasEventMatch(a['events'],/treasury::DepositEvent/i),'role':'deposit','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/treasury::WithdrawEvent|treasury::ReleaseEvent/i),'role':'release','confidence':0.9},{'when':a=>a['operation_type']==='payment'&&a['data']?.['receive']===!![],'role':'release','confidence':0.95},{'when':a=>a['operation_type']==='payment'&&isNegative(a['amount']),'role':'payment','confidence':0.95},{'when':a=>a['operation_type']==='payment'&&!isNegative(a['amount']),'role':'refund','confidence':0.9},{'when':a=>a['operation_type']==='reward'&&isNegative(a['amount']),'role':'reward','confidence':0.95},{'when':a=>a['operation_type']==='reward'&&!isNegative(a['amount']),'role':'release','confidence':0.9},{'when':a=>a['operation_type']==='treasury'&&isNegative(a['amount']),'role':'deposit','confidence':0.95},{'when':a=>a['operation_type']==='treasury'&&!isNegative(a['amount']),'role':'release','confidence':0.9},{'when':a=>a['operation_type']==='allocation'&&isNegative(a['amount']),'role':'payment','confidence':0.85},{'when':a=>a['operation_type']==='allocation'&&!isNegative(a['amount']),'role':'release','confidence':0.85},{'when':a=>a['operation_type']==='arbitration'&&(a['data']?.['compensation']!==undefined||a['data']?.['arb']===!![]),'role':'compensation','confidence':0.9},{'when':a=>a['operation_type']==='order'&&isNegative(a['amount'])&&a['data']?.['buy']!==undefined,'role':'payment','confidence':0.9},{'when':a=>a['operation_type']==='order'&&!isNegative(a['amount'])&&(a['data']?.['refund']!==undefined||a['data']?.['arb']!==undefined),'role':'refund','confidence':0.85},{'when':a=>{if(isNegative(a['amount']))return![];const b=absAmount(a['amount']);return isGasCoin(a['coinType'])&&b>BigInt(0x0)&&b<SMALL_AMOUNT_THRESHOLD;},'role':'gas','confidence':0.7},{'when':a=>{if(isNegative(a['amount']))return![];return a['sender']!==undefined&&a['recipient']!==undefined&&a['sender']===a['recipient']&&a['sender']!=='';},'role':'change','confidence':0.7},{'when':a=>isNegative(a['amount']),'role':'payment','confidence':0.7},{'when':a=>!isNegative(a['amount'])&&absAmount(a['amount'])===BigInt(0x0),'role':'other','confidence':0.5},{'when':a=>!isNegative(a['amount']),'role':'release','confidence':0.7},{'when':()=>!![],'role':'other','confidence':0.3}];export function tagFundRoles(a,b,c,d){if(!Array['isArray'](a))return[];return a['filter'](e=>e&&(e['amount']!==undefined||e['coinType']))['map'](e=>{const f={'operation_type':b,'amount':String(e['amount']??'0'),'coinType':e['coinType'],'data':c??{},'events':d,'sender':e['sender'],'recipient':e['recipient']},g=FUND_ROLE_RULES['find'](i=>i['when'](f)),h=g?.['role']??'other';return{'amount':f['amount'],'coinType':e['coinType']||'','role':h,'from':e['sender']??null,'to':e['recipient']??null};});}const EVENT_SEMANTIC_RULES=EVENT_SEMANTIC_REGISTRY['map'](a=>({'pattern':new RegExp(a['move_type']['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'i'),'business_meaning':a['business_meaning'],'category':a['category'],'side_effect':a['side_effect']}));function extractRelatedObject(a){if(!a||typeof a!=='object')return undefined;const b=a['fields']??a['payload']??a;if(typeof b!=='object')return undefined;for(const c of['object','object_id','objectId','parent','demand','service','order','machine','payment','progress','arb','allocation','resource','id']){const d=b[c];if(typeof d==='string'&&d['startsWith']('0x')&&d['length']>=0x6)return d;}return undefined;}const BUILTIN_EVENT_TYPE_MAP=Object['fromEntries'](EVENT_SEMANTIC_REGISTRY['map'](a=>[a['name'],a['move_type']]));export function eventToSemantic(a){const b=String(a?.['type']??a?.['event_type']??''),c=String(a?.['type_raw']??''),d=[c,b,BUILTIN_EVENT_TYPE_MAP[b]??'']['filter'](Boolean),e=EVENT_SEMANTIC_RULES['find'](h=>d['some'](i=>h['pattern']['test'](i)));if(!e)return{'event_type':b,'business_meaning':'Unknown\x20event','category':'other'};const f=e['extractRelatedObject']?e['extractRelatedObject'](a):extractRelatedObject(a),g={'event_type':b,'business_meaning':e['business_meaning'],'category':e['category']};if(f)g['related_object']=f;if(e['side_effect'])g['side_effect']=e['side_effect'];return g;}export function annotateEvents(a){if(!Array['isArray'](a))return[];return a['map'](eventToSemantic);}const NEXT_ACTION_RULES=[{'when':a=>a==='service','action':'publish\x20the\x20Service\x20when\x20configuration\x20is\x20complete','reason':'Service\x20must\x20be\x20published\x20before\x20customers\x20can\x20order','tool':'onchain_operations\x20(service\x20with\x20publish:true)','priority':'recommended'},{'when':a=>a==='service','action':'add\x20Machine\x20nodes\x20to\x20define\x20the\x20service\x20workflow','reason':'Machine\x20drives\x20order\x20state\x20transitions','tool':'onchain_operations\x20(machine)','priority':'recommended'},{'when':a=>a==='machine','action':'bind\x20Progress\x20to\x20track\x20order\x20execution','reason':'Progress\x20provides\x20customer-visible\x20status\x20updates','tool':'onchain_operations\x20(progress)','priority':'recommended'},{'when':a=>a==='order','action':'wait\x20for\x20customer\x20payment\x20or\x20proceed\x20to\x20allocation','reason':'Order\x20lifecycle:\x20payment\x20→\x20allocation\x20→\x20completion','priority':'optional'},{'when':(a,b)=>a==='order'&&b?.['transfer_to']!==undefined,'action':'inform\x20the\x20end\x20customer\x20about\x20the\x20supplier/sub-contractor\x20who\x20will\x20fulfill\x20this\x20order','reason':'O-5\x20procurement\x20sub-order\x20transparency:\x20customers\x20have\x20the\x20right\x20to\x20know\x20who\x20fulfills\x20their\x20order','tool':'messenger_operation\x20(notify\x20customer)','priority':'recommended'},{'when':a=>a==='demand','action':'wait\x20for\x20presenter\x20submissions\x20or\x20evaluate\x20existing\x20ones','reason':'Demand\x20lifecycle:\x20presenters\x20submit\x20solutions\x20for\x20reward','priority':'optional'},{'when':a=>a==='reward','action':'deposit\x20funds\x20into\x20the\x20reward\x20pool','reason':'Reward\x20pool\x20must\x20be\x20funded\x20before\x20claimants\x20can\x20withdraw','tool':'onchain_operations\x20(treasury)','priority':'recommended'},{'when':a=>a==='bridge_cross_chain_wow_to_evm','action':'poll\x20query_transfer_status\x20until\x20bridge\x20signs\x20(~1-5\x20min),\x20then\x20call\x20claim_wow_to_evm\x20to\x20complete','reason':'Cross-chain\x20WOW→EVM\x20is\x20a\x202-step\x20process:\x20deposit\x20first,\x20then\x20claim\x20after\x20bridge\x20confirmation','tool':'bridge_operation\x20(query_transfer_status,\x20then\x20claim_wow_to_evm)','priority':'required'},{'when':a=>a==='bridge_cross_chain_evm_to_wow','action':'poll\x20query_transfer_status\x20to\x20monitor\x20auto-claim\x20progress\x20(~10-20\x20min)','reason':'EVM→WOW\x20cross-chain\x20auto-claims;\x20monitor\x20progress\x20but\x20no\x20manual\x20action\x20needed','tool':'bridge_operation\x20(query_transfer_status)','priority':'recommended'},{'when':a=>a==='bridge_claim_wow_to_evm','action':'verify\x20recipient\x20EVM\x20balance\x20updated','reason':'Claim\x20completes\x20the\x20cross-chain\x20transfer;\x20verify\x20funds\x20arrived\x20on\x20EVM\x20side','tool':'bridge_operation\x20(query_active_evm_account)','priority':'recommended'},{'when':a=>a==='bridge_withdraw','action':'verify\x20WOW\x20balance\x20updated','reason':'Withdrawal\x20moves\x20funds\x20from\x20active\x20EVM\x20account\x20to\x20WOW;\x20verify\x20balance','tool':'account_operation\x20(balance)','priority':'recommended'},{'when':a=>a==='account_new','action':'claim\x20faucet\x20tokens\x20for\x20gas\x20if\x20on\x20testnet,\x20then\x20proceed\x20to\x20create\x20Service','reason':'New\x20account\x20needs\x20gas\x20tokens\x20before\x20on-chain\x20operations','tool':'account_operation\x20(faucet)','priority':'recommended'},{'when':a=>a==='account_faucet','action':'proceed\x20to\x20create\x20Permission\x20and\x20Service\x20objects','reason':'Account\x20is\x20now\x20funded;\x20start\x20building\x20your\x20service','tool':'onchain_operations\x20(permission,\x20service)','priority':'recommended'},{'when':a=>a==='query_toolkit','action':'use\x20the\x20queried\x20object\x20data\x20to\x20plan\x20next\x20operations','reason':'Query\x20results\x20reveal\x20current\x20object\x20states\x20for\x20decision-making','priority':'optional'}];function inferNextActions(a,b,c){return NEXT_ACTION_RULES['filter'](d=>d['when'](a,b,c))['map'](d=>({'action':d['action'],'reason':d['reason'],'tool':d['tool'],'priority':d['priority']}));}function inferWarnings(a,b,c){const d=[];return a==='service'&&b?.['order_allocators']===undefined&&d['push']('order_allocators\x20not\x20configured;\x20order\x20funds\x20cannot\x20be\x20distributed\x20automatically'),a==='reward'&&(b?.['balance']==='0'||b?.['balance']===0x0)&&d['push']('Reward\x20pool\x20balance\x20is\x20zero;\x20claimants\x20cannot\x20withdraw'),a==='order'&&b?.['transfer_to']!==undefined&&d['push']('[TRANSPARENCY]\x20Order\x20ownership\x20is\x20being\x20transferred\x20(likely\x20to\x20a\x20supplier/sub-contractor).\x20'+'Ensure\x20the\x20end\x20customer\x20is\x20informed\x20about\x20who\x20fulfills\x20their\x20order\x20—\x20this\x20builds\x20trust\x20and\x20is\x20required\x20for\x20procurement\x20sub-orders.'),d;}function composeSummary(a,b,c,d,e){const f=a['replace'](/_/g,'\x20');if(b==='failed')return'Failed\x20to\x20'+f;if(b==='pending_input')return f+'\x20requires\x20Guard\x20submission\x20to\x20proceed';const g=[];if(c['length'])g['push']('created\x20'+c['length']+'\x20object(s)');if(d['length'])g['push']('modified\x20'+d['length']+'\x20object(s)');if(e['length']){if(a==='allocate_funds'){const h=e['map'](i=>{const j=i['amount'],k=shortCoinType(i['coinType']),l=i['to']?shortAddr(i['to']):null,m=i['from']?shortAddr(i['from']):null;if(l)return j+'\x20'+k+'\x20→\x20'+l;if(m)return j+'\x20'+k+'\x20from\x20'+m;return j+'\x20'+k;})['join'](';\x20');g['push']('distributed:\x20'+h);}else g['push'](e['length']+'\x20fund\x20movement(s)');}return'Successfully\x20'+f+(g['length']?'\x20('+g['join'](',\x20')+')':'');}function shortAddr(a){return formatShortAddress(a);}function shortCoinType(a){if(!a)return'coin';const b=a['split']('::');return b[b['length']-0x1]||a;}function buildCustomerAdvice(a,b,c){if(!a306a('customer_intelligence'))return undefined;let d;if(a==='order')d='preorder';else{if(a==='query_toolkit'||a==='onchain_table_data'||a==='onchain_events')d='browse';else{if(a==='service')d='evaluate';else return undefined;}}const e=b?.['service_name']??b?.['service_id']??b?.['service']??b?.['name'],f=b?.['order_name']??b?.['order_id']??b?.['order'];let g;if(b?.['price']!==undefined)try{g=BigInt(String(b['price']));}catch{}if(g===undefined&&c?.['price']!==undefined)try{g=BigInt(String(c['price']));}catch{}const h=booleanFromSignals(b?.['arb_name']!==undefined||b?.['arbitration']!==undefined,b?.['arb']===![]),i=booleanFromSignals(b?.['compensation_fund']!==undefined||b?.['compensation']!==undefined,![]),j=booleanFromSignals(b?.['refund']!==undefined,![]),k=booleanFromSignals(b?.['um']!==undefined||b?.['um_name']!==undefined||b?.['messenger']!==undefined||c?.['um']!==undefined,b?.['um']===null||b?.['um_name']===null),l=Array['isArray'](b?.['customer_required'])?b['customer_required']['filter'](A=>typeof A==='string'):Array['isArray'](c?.['customer_required'])?c['customer_required']['filter'](A=>typeof A==='string'):[],m=h===![],n=i===![],o=typeof b?.['risk_score']==='number'?b['risk_score']:typeof c?.['risk_score']==='number'?c['risk_score']:undefined,p=b?.['risk_level']??c?.['risk_level'],q=getProfile(),s=q['risk_appetite']==='conservative'?0x46:q['risk_appetite']==='aggressive'?0x1e:0x32;let t;const u=c?.['_money_display']??(Array['isArray'](c?.['objects'])?c['objects'][0x0]?.['_money_display']:undefined),v=u?Object['values'](u)[0x0]:undefined;if(v?.['precision_known']===!![])t={'decimals':v['decimals'],'symbol':v['symbol']};else{const A=c?.['type_raw']??(Array['isArray'](c?.['objects'])?c['objects'][0x0]?.['type_raw']:undefined);t=registryDisplayHint(extractGenericTokenType(A))??registryDisplayHint(typeof b?.['type_parameter']==='string'?b['type_parameter']:undefined);}const w={'stage':d,'service_id':e,'order_id':f,'service_price':g,'token':t,'has_arbitration':h,'has_compensation':i,'has_refund_path':j,'has_messenger':k,'customer_required':l,'risk_score':o,'risk_level':p,'user_min_trust_score':s,'user_require_arbitration':q['risk_appetite']==='conservative','user_require_compensation':q['risk_appetite']==='conservative'},x=generateReminders(w),y=[];for(const B of x){if(B['action'])y['push'](B['action']);}m&&!y['some'](C=>C['includes']('arbitration'))&&y['push']('Require\x20the\x20merchant\x20to\x20configure\x20an\x20Arbitration\x20service\x20before\x20placing\x20the\x20order');n&&!y['some'](C=>C['includes']('compensation'))&&y['push']('Require\x20the\x20merchant\x20to\x20set\x20a\x20compensation_fund\x20to\x20guarantee\x20automatic\x20payout\x20when\x20the\x20order\x20fails');const z={'recommendations':y,'reminders':x['map'](C=>({'id':C['id'],'stage':C['stage'],'priority':C['priority'],'message':C['message'],'action':C['action']}))};if(o!==undefined)z['risk_score']=o;if(p!==undefined)z['risk_level']=p;return z;}function buildGuardAdvice(a,b,c){try{if(a==='guard')return buildGuardCreateAdvice(b);if(a==='gen_passport'){const e=c?.['error']?'fail':'pass';return{'current_round':'R8','test_result':{'status':e,'passport_id':e==='pass'?c?.['passport']:undefined,'failure_node':e==='fail'?typeof c?.['error']==='string'?c['error']['slice'](0x0,0x78):undefined:undefined}};}const d=typeof c?.['error']==='string'?c['error']:'';if(d['includes']('GUARD')||d['includes']('Guard')||d['includes']('guard'))return{'risk_warnings':['Guard\x20verification\x20failed:\x20'+d['slice'](0x0,0xc8),'Suggestion:\x20check\x20whether\x20the\x20submission\x20data\x20matches\x20the\x20Guard\x20table\x20declaration,\x20or\x20query\x20the\x20Guard\x20definition\x20to\x20learn\x20the\x20required\x20submission']};return undefined;}catch{return undefined;}}function buildGuardCreateAdvice(a){if(!a)return undefined;const b=convertCallDataToPuzzleInput(a),c=derivePuzzleFromCallData(b),d=getPuzzleStatusBooleans(c);let e,f,g;a['binding_hint']?.['action']&&(e=inferSceneFromAction(a['binding_hint']['action']),e&&(f=e['name'],g=e['special_constraints']));let h;const i=a['binding_hint']?.['rule_sentence']||a['binding_hint']?.['action']||'';if(i){const r=matchSemanticPattern(i);r['length']>0x0&&(h=r['map'](s=>s['id']+':\x20'+s['pattern_name']));}let j;try{const s=generateConfirmationText(c);!s['startsWith']('[Puzzle\x20incomplete]')&&(j=s);}catch{}let k;const l=getPendingQuestions(c);l['length']>0x0&&(k=l);let m;if(e){const t=mapSceneToObjectType(e);if(t){const u=GUARDQUERY['filter'](v=>v['objectType']===t)['slice'](0x0,0xa)['map'](v=>({'id':v['id'],'name':v['name'],'objectType':String(v['objectType']),'returnType':String(v['return']),'description':v['description']}));u['length']>0x0&&(m=u);}}const n=assessGuardRisksForOperation('guard',a);let o,p;if(n){const v=getRiskSummary(n);o={'overall_risk':v['risk_count']>0x0?n['overall_risk']:'info','risk_count':v['risk_count'],'critical_count':v['critical_count'],'high_count':v['high_count'],'needs_human_review':v['needs_human_review'],'top_risks':v['top_risks'],'stakeholder_advice':n['stakeholder_advice']};const w=n['risks']['map'](x=>'['+x['level']['toUpperCase']()+']\x20'+x['title']+':\x20'+x['description']);w['length']>0x0&&(p=w);}const q={'current_round':'R7','puzzle_status':d};if(e)q['matched_scene']=e['id'];if(f)q['scene_description']=f;if(g)q['scene_constraints']=g;if(h)q['suggested_patterns']=h;if(m)q['available_queries']=m;if(p)q['risk_warnings']=p;if(k)q['pending_questions']=k;if(j)q['confirmation_text']=j;if(o)q['risk_assessment']=o;return q;}function convertCallDataToPuzzleInput(a){const b={};Array['isArray'](a['table'])&&(b['table']=a['table']['map'](c=>({'identifier':c['identifier'],'b_submission':c['b_submission'],'value_type':typeof c['value_type']==='string'?c['value_type']:String(c['value_type']),'value':convertValueSnapshot(c['value']),'name':c['name']??'','object_type':c['object_type']})));if(a['root']&&typeof a['root']==='object'){const c=a['root'];if(c['type']!=='file'&&c['type']!=='node')b['root']=convertNodeToSnapshot(a['root']);else c['type']==='node'&&a['root']['node']&&(b['root']=convertNodeToSnapshot(a['root']['node']));}a['rely']&&Array['isArray'](a['rely']['guards'])&&(b['rely']={'guards':a['rely']['guards']['map'](d=>typeof d==='string'?d:String(d)),'logic_or':a['rely']['logic_or']});if(a['binding_hint']){const d=a['binding_hint'],e={'action':d['action'],'host_object':d['host_object'],'binding_field':d['binding_field']};if(d['rule_sentence']!==undefined)e['rule_sentence']=d['rule_sentence'];if(d['failure_conditions']!==undefined)e['failure_conditions']=d['failure_conditions'];if(d['circular_reference']!==undefined)e['circular_reference']=d['circular_reference'];b['binding_hint']=e;}return b;}function convertNodeToSnapshot(a){if(!a||typeof a!=='object')return{'type':'unknown'};const b={'type':String(a['type']??'unknown')};typeof a['identifier']==='number'&&(b['identifier']=a['identifier']);a['query']!==undefined&&(b['query']=typeof a['query']==='number'?a['query']:String(a['query']));if(a['object']&&typeof a['object']==='object'){const c={'identifier':Number(a['object']['identifier'])};typeof a['object']['convert_witness']==='number'&&(c['convert_witness']=a['object']['convert_witness']),b['object']=c;}Array['isArray'](a['parameters'])&&(b['parameters']=a['parameters']['map'](d=>convertNodeToSnapshot(d)));if(typeof a['context']==='string'){const d=a['context'];(d==='Clock'||d==='Guard'||d==='Signer')&&(b['context']=d);}return Array['isArray'](a['nodes'])&&(b['nodes']=a['nodes']['map'](e=>convertNodeToSnapshot(e))),a['node']&&(b['node']=convertNodeToSnapshot(a['node'])),a['nodeLeft']&&(b['nodeLeft']=convertNodeToSnapshot(a['nodeLeft'])),a['nodeRight']&&(b['nodeRight']=convertNodeToSnapshot(a['nodeRight'])),b;}function convertValueSnapshot(a){if(a===undefined||a===null)return undefined;if(typeof a==='string'||typeof a==='number'||typeof a==='boolean')return a;if(Array['isArray'](a)){const b=a['every'](e=>typeof e==='string');if(b)return a;const c=a['every'](e=>typeof e==='number');if(c)return a;const d=a['every'](e=>typeof e==='boolean');if(d)return a;return JSON['stringify'](a);}return JSON['stringify'](a);}function mapSceneToObjectType(a){const b=a['host_object'];if(b==='Standalone')return undefined;return b;}export function buildSemantic(a,b){if(!b)return undefined;const c=inferIntent(b['operation_type'],b['data']),d=inferStatus(a),e=a?.['objectChanges']||[],g=a?.['balanceChanges']||[],h=a?.['events']||[],i=tagObjectRoles(e['filter'](u=>u?.['type']==='created')),j=tagObjectRoles(e['filter'](u=>u?.['type']==='mutated'||u?.['type']==='published')),k=tagFundRoles(g,b['operation_type'],b['data'],h),l=annotateEvents(h),m=inferNextActions(b['operation_type'],b['data'],d),n=inferWarnings(b['operation_type'],b['data'],a);b['pre_warnings']&&b['pre_warnings']['length']>0x0&&n['push'](...b['pre_warnings']);if(b['operation_type']==='service'&&b['data']?.['publish']===!![]){const u=auditService(b['data']);for(const v of u){const w=v['severity']==='error'?'[AUDIT\x20ERROR]\x20':v['severity']==='warning'?'[AUDIT]\x20':'[INFO]\x20';n['push'](w+v['message']);}}let o;const p=a306a('experience_layer');if(p)try{const x=getExperienceFeedback(b['operation_type'],b['data'],c);x&&(o=x);const y=d==='success'?'success':d==='failed'?'failed':'partial',z=[...i,...j]['map'](B=>B['id'])['filter'](Boolean),A=inferErrorCodeForSignal(a);recordOperationOutcome(b['operation_type'],b['data'],c,y,A,z);}catch{}let q;if(a306a('industry_evolution'))try{const B=typeof b['data']?.['industry']==='string'&&b['data']['industry']['trim']()?b['data']['industry']['trim']():undefined;if(B&&!p){const C=d==='success'?{'success':!![]}:{'success':![],'error_code':inferErrorCodeForSignal(a)};recordIndustrySignal(B,{'type':b['operation_type'],'data':b['data']},C);}if(B){const D=injectEvolutionContext(undefined,B,deriveAdviceRole(b['operation_type'],b['data']));D&&(D['industry_signal']||D['evolution_advice']||D['confidence']>0x0)&&(q=D);}}catch{}let r;if(a306a('semantic_rich'))try{const E=listServices(),F=E['filter'](H=>H['enabled'])['map'](H=>H['name']),G=E['filter'](H=>!H['enabled'])['map'](H=>H['name']);r={'active':F,'inactive':G['length']?G:undefined};}catch{}let s;try{s=buildCustomerAdvice(b['operation_type'],b['data'],a);}catch{}let t;try{t=buildGuardAdvice(b['operation_type'],b['data'],a);}catch{}return{'intent':c,'status':d,'summary':composeSummary(c,d,i,j,k),'created':i['length']?i:undefined,'modified':j['length']?j:undefined,'released':k['length']?k:undefined,'events':l['length']?l:undefined,'next_actions':m['length']?m:undefined,'warnings':n['length']?n:undefined,'experience':o,'service_status':r,'customer_advice':s,'evolution_context':q,'guard_advice':t};}function inferErrorCodeForSignal(a){if(!a)return undefined;if(typeof a['error']==='string')return a['error']['slice'](0x0,0x40);return undefined;}export function buildDataSemantic(a,b,c,d){if(!b)return undefined;const e=inferIntent(b['operation_type'],b['data']),f=[];b['pre_warnings']&&b['pre_warnings']['length']>0x0&&f['push'](...b['pre_warnings']);let g;if(c)g='failed';else{g='success';if(Array['isArray'](a)&&a['length']===0x0)g='partial',f['push']('no\x20results\x20found');else{if(a===null||a===undefined)g='partial',f['push']('no\x20results\x20found');else{if(typeof a==='object'&&!Array['isArray'](a)){const n=Object['values'](a);n['length']>0x0&&n['every'](o=>Array['isArray'](o)?o['length']===0x0:o===null||o===undefined)&&(g='partial',f['push']('no\x20results\x20found'));}}}}const h=inferNextActions(b['operation_type'],b['data'],g);let i;if(!c&&b['operation_type']==='onchain_events'){const o=Array['isArray'](a)?a:a?.['data']&&Array['isArray'](a['data'])?a['data']:null;if(o){i=annotateEvents(o);if(i['length']===0x0)i=undefined;}}const j=e['replace'](/_/g,'\x20');let k;if(g==='failed')k=d?'Failed\x20to\x20'+j+':\x20'+d:'Failed\x20to\x20'+j;else g==='partial'?k=j+'\x20completed\x20with\x20no\x20results':k='Successfully\x20'+j;let l;if(a306a('semantic_rich'))try{const p=listServices(),q=p['filter'](t=>t['enabled'])['map'](t=>t['name']),r=p['filter'](t=>!t['enabled'])['map'](t=>t['name']);l={'active':q,'inactive':r['length']?r:undefined};}catch{}let m;if(!c)try{m=buildCustomerAdvice(b['operation_type'],b['data'],a);}catch{}return{'intent':e,'status':g,'summary':k,'events':i,'next_actions':h['length']?h:undefined,'warnings':f['length']?f:undefined,'service_status':l,'customer_advice':m};}
|
|
1
|
+
import{auditService}from'../../knowledge/index.js';import{getExperienceFeedback,recordOperationOutcome}from'../../experience/index.js';import{isEnabled as a308a,listServices}from'../../config/index.js';import{generateReminders}from'../../customer/index.js';import{getProfile}from'../../experience/user-profile.js';import{injectEvolutionContext,recordIndustrySignal}from'../../knowledge/flywheel-loop.js';import{WException,getMoveErrorDescription,WErrors}from'@wowok/wowok';import{GUARDQUERY}from'@wowok/wowok';import{assessGuardRisksForOperation,getRiskSummary}from'../../knowledge/guard-risk.js';import{derivePuzzleFromCallData,getPuzzleStatusBooleans,getPendingQuestions,generateConfirmationText}from'../../knowledge/guard-puzzle.js';import{inferSceneFromAction}from'../../knowledge/guard-ledger.js';import{extractGenericTokenType,registryDisplayHint}from'../../knowledge/fund-layer.js';import{matchSemanticPattern}from'../../knowledge/guard-translation.js';import{formatShortAddress}from'../../persona/address-format.js';import{EVENT_SEMANTIC_REGISTRY}from'../../knowledge/event-semantics.js';function booleanFromSignals(a,b){if(a)return!![];if(b)return![];return undefined;}function deriveAdviceRole(a,b){switch(a){case'order':case'personal':case'demand':return'customer';case'service':case'machine':case'permission':case'reward':case'repository':case'allocator':case'treasury':return'merchant';case'arbitration':if(b?.['vote']!==undefined)return'arbitrator';if(b?.['dispute']!==undefined)return'customer';return undefined;default:return undefined;}}const ERROR_RULES=[{'patterns':[/too\s*many\s*requests/i,/rate\s*limit/i,/429/i,/throttl/i,/faucet.*rate/i,/request.*limit.*exceeded/i],'error_code':'rate_limit','retryable':!![],'recovery_hint':'Rate\x20limit\x20hit\x20(HTTP\x20429).\x20Wait\x20with\x20exponential\x20backoff\x20and\x20retry.\x20To\x20check\x20existing\x20balance,\x20use\x20account_balance\x20query.'},{'patterns':[/gas.*budget.*exceeded/i,/out\s*of\s*gas/i,/gas\s*exceeded/i,/insufficient\s*gas/i,/not\s*enough\s*gas/i,/could not automatically determine a budget/i,/dry run failed.*budget/i,/Maximum gas/i],'error_code':'gas_exceeded','retryable':!![],'recovery_hint':'Gas\x20budget\x20exceeded.\x20Increase\x20the\x20gas_budget\x20parameter\x20or\x20claim\x20more\x20gas\x20tokens,\x20then\x20retry'},{'patterns':[/stock\s*not\s*enough/i,/E_STOCK_NOT_ENOUGH/i],'error_code':'stock_exhausted','retryable':![],'recovery_hint':'Merchant-side\x20stock\x20exhausted\x20(NOT\x20a\x20balance\x20issue).\x20Reduce\x20the\x20quantity,\x20pick\x20another\x20sale\x20item,\x20or\x20ask\x20the\x20merchant\x20to\x20restock'},{'patterns':[/sale\s*(item\s*)?(is\s*)?suspended/i,/E_SALE_SUSPENDED/i],'error_code':'sale_suspended','retryable':![],'recovery_hint':'The\x20sale\x20item\x20is\x20suspended\x20by\x20the\x20merchant.\x20Pick\x20another\x20item\x20or\x20contact\x20the\x20merchant'},{'patterns':[/discount.*time.*(?:window|invalid)/i,/E_DISCOUNT_TIME_INVALID/i],'error_code':'discount_invalid','retryable':![],'recovery_hint':'Discount\x20is\x20outside\x20its\x20[time_start,\x20time_end]\x20validity\x20window.\x20Buy\x20without\x20the\x20discount\x20or\x20ask\x20the\x20merchant\x20for\x20a\x20fresh\x20one'},{'patterns':[/insufficient\s*(balance|coin|fund)/i,/insufficient\s*amount/i,/ENOTENOUGH/i,/not\s*enough\s*(coin|balance)/i,/coin\s*not\s*enough/i,/balance\s*not\s*enough/i,/balance\s+insufficient/i,/balance\s+too\s+low/i,/\bnot\s+enough\b/i,/no\s+coins/i,/fee\s*not\s*enough/i,/Insufficient balance/i],'error_code':'insufficient_balance','retryable':!![],'recovery_hint':'Claim\x20faucet\x20tokens\x20via\x20account_operation\x20(faucet)\x20then\x20retry\x20the\x20call'},{'patterns':[/bcs.*(error|fail|invalid)/i,/BCS serialization/i,/serialization\s*(failure|error)/i,/deserialization\s*(failure|error)/i,/invalid bcs type/i,/Out of range.*bcs/i,/\bout\s+of\s+range\b/i,/not\s+bool/i,/Length out of range/i,/parse object content failed/i],'error_code':'bcs_error','retryable':![],'recovery_hint':'BCS\x20serialization/deserialization\x20error.\x20Verify\x20data\x20types\x20and\x20structure\x20match\x20the\x20expected\x20schema'},{'patterns':[/signature.*(invalid|fail|error|verif)/i,/invalid\s*signature/i,/signature\s*verification\s*failed/i,/bad\s*signature/i,/signing\s*fail/i,/crypto.*signature/i,/ed25519.*(fail|error|invalid)/i,/secp256k1.*(fail|error|invalid)/i,/failed\s+to\s+recover\s+public\s+key/i],'error_code':'signature_error','retryable':![],'recovery_hint':'Signature\x20verification\x20failed.\x20Check\x20that\x20the\x20correct\x20private\x20key\x20and\x20network\x20configuration\x20are\x20correct'},{'patterns':[/config.*(not set|not found|invalid|missing)/i,/RPC\s*not\s*configured/i,/network.*not\s*specified/i,/protocol network not specified/i,/account persistent storage not set/i,/config persistent storage not set/i,/account persistent storage not found/i,/no\s*rpc\s*url/i],'error_code':'config_error','retryable':![],'recovery_hint':'Configuration\x20error.\x20Verify\x20that\x20network,\x20RPC\x20endpoints,\x20and\x20required\x20environment\x20variables\x20are\x20properly\x20configured'},{'patterns':[/network/i,/timeout/i,/ECONNRESET/i,/ETIMEDOUT/i,/ECONNREFUSED/i,/EAI_AGAIN/i,/RPC\s*(error|failed|unreachable)/i,/socket\s*hang\s*up/i,/fetch\s*failed/i,/connection\s*(refused|reset|lost)/i,/dns\s*(error|fail)/i],'error_code':'network_error','retryable':!![],'recovery_hint':'Retry\x20the\x20call;\x20if\x20it\x20persists,\x20switch\x20RPC\x20endpoint\x20or\x20check\x20connectivity'},{'patterns':[/guard.*(reject|fail|denied|verif)/i,/verification\s*failed/i,/submission.*(invalid|fail|required)/i,/passport.*(invalid|fail|verif)/i,/passport\s+required/i,/move[._-]?abort.*guard/i,/Guard count exceeded limit/i,/Submission size exceeded limit/i,/Submission not found/i,/Guard not found/i,/Impact guard not found/i],'error_code':'guard_rejected','retryable':![],'recovery_hint':'Fill\x20the\x20Guard\x20submission\x20data\x20(see\x20the\x20\x27submission\x27\x20field)\x20and\x20resubmit\x20via\x20call_with_submission'},{'patterns':[/WIP file verification failed/i,/Failed to load WIP file/i,/WIP.*hash\s*mismatch/i,/wip.*hash.*not\s*match/i,/Invalid WIP file structure/i,/wip.*not\s*found/i,/wip.*unreachable/i,/wip_file.*error/i],'error_code':'wip_verification_failed','retryable':![],'recovery_hint':['WIP\x20file\x20must\x20be\x20publicly\x20accessible\x20via\x20HTTP(S)\x20URL\x20—\x20local\x20file\x20paths\x20cannot\x20be\x20stored\x20on-chain.','Deployment\x20options\x20(pick\x20one):','\x20\x201.\x20GitHub\x20Pages\x20(free,\x20stable):\x20upload\x20.wip\x20file\x20to\x20a\x20repo,\x20enable\x20Pages,\x20use\x20raw\x20URL.','\x20\x20\x20\x20\x20Example:\x20https://<user>.github.io/<repo>/<file>.wip','\x20\x20\x20\x20\x20Or\x20raw\x20URL:\x20https://raw.githubusercontent.com/<user>/<repo>/<branch>/<file>.wip','\x20\x202.\x20IPFS\x20(free,\x20decentralized):\x20upload\x20via\x20Pinata\x20(https://pinata.cloud)\x20or\x20nft.storage.','\x20\x20\x20\x20\x20Use\x20the\x20ipfs://<CID>\x20or\x20https://<gateway>/ipfs/<CID>\x20URL\x20form.','\x20\x20\x20\x20\x20Common\x20gateways:\x20https://ipfs.io/ipfs/,\x20https://cloudflare-ipfs.com/ipfs/,\x20https://dweb.link/ipfs/','\x20\x203.\x20User\x27s\x20own\x20website:\x20serve\x20the\x20.wip\x20file\x20from\x20your\x20static\x20site.','\x20\x204.\x20Generate\x20a\x20fresh\x20WIP\x20file\x20locally\x20first\x20via\x20wip_file\x20(type=\x27generate\x27),\x20upload\x20it,\x20then\x20re-submit\x20the\x20URL.','After\x20updating\x20the\x20sale\x27s\x20wip\x20URL,\x20re-run\x20the\x20operation.']['join']('\x0a')},{'patterns':[/setting lock duration not exceeded/i,/E_LOCKED_TIME_NOT_ENOUGH/i,/locked time not enough/i,/lock duration not (?:elapsed|exceeded|met)/i],'error_code':'time_lock_not_elapsed','retryable':!![],'recovery_hint':'Service\x20setting_lock_duration\x20has\x20not\x20elapsed\x20since\x20pause.\x20Pause\x20the\x20Service,\x20wait\x20until\x20paused_time\x20+\x20setting_lock_duration\x20<=\x20current\x20time,\x20then\x20retry.'},{'patterns':[/already\s*publish/i,/immutable/i,/cannot\s*(modify|change|mutate)/i,/is\s*published/i,/Service already published/i,/Machine already published/i],'error_code':'immutable_violation','retryable':![],'recovery_hint':'Object\x20is\x20in\x20an\x20immutable\x20state\x20(e.g.\x20Service\x20already\x20published).\x20Recreate\x20the\x20object\x20if\x20a\x20different\x20config\x20is\x20needed'},{'patterns':[/permission/i,/unauthorized/i,/forbidden/i,/not\s*(the\s*)?owner/i,/access\s*denied/i,/no permission/i,/Permission denied/i,/Not the builder/i,/Not admin/i,/No operation permission/i,/Not the holder/i,/not\s+(?:authorized|approved)\b/i,/not\s+allowed/i,/unable\s+to\s+receive\s+object/i],'error_code':'permission_denied','retryable':![],'recovery_hint':'Use\x20an\x20account\x20with\x20the\x20required\x20permission,\x20or\x20pass\x20permission_guard\x20IDs\x20via\x20env.permission_guard'},{'patterns':[/^invalid\s+parameter\b/i],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Check\x20parameter\x20format\x20against\x20the\x20tool\x20schema;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'},{'patterns':[/not\s*found/i,/does\s*not\s*exist/i,/ENOTFOUND/i,/no\s*such\s*object/i,/unknown\s*object/i,/account not found/i,/address not found/i,/token not found/i,/Node not found/i,/Policy not found/i,/Reward not found/i],'error_code':'object_not_found','retryable':![],'recovery_hint':'Verify\x20the\x20object\x20ID/name\x20with\x20query_toolkit;\x20local_mark\x20names\x20are\x20case-sensitive'},{'patterns':[/state\s*(conflict|mismatch)/i,/already\s*exist/i,/conflict/i,/duplicate/i,/version\s*mismatch/i,/name exist/i,/Duplicate forward name/i,/Duplicate node previous/i,/already claimed/i,/already specified/i,/already accomplished/i,/already used/i,/Status does not match/i,/does not match/i,/\bnot\s+published\b/i,/\bis\s+paused\b/i,/global\s+pause/i,/\bis\s+listed\b/i,/not\s+listed\b/i,/\blocked\b/i,/\bmismatch\b/i,/already\s+(?:set|minted|listed|verified|authorized)\b/i,/\bnot\s+empty\b/i,/non-zero\s+balance/i,/\bnot\s+match\b/i,/not\s+set\s+for\s+epoch/i,/no\s+allocator\b/i,/not\s+satisfied/i,/invariant\s+violation/i],'error_code':'state_conflict','retryable':![],'recovery_hint':'Object\x20state\x20conflicts\x20with\x20the\x20operation.\x20Query\x20the\x20current\x20state\x20with\x20query_toolkit\x20and\x20adjust\x20parameters'},{'patterns':[/invalid/i,/missing\s*(field|param|required)/i,/required/i,/expected/i,/malformed/i,/parse\s*error/i,/type\s*mismatch/i,/invalid argument/i,/Invalid value/i,/Invalid data value/i,/Invalid string value/i,/Invalid argument/i,/IsValid/i,/type does not match/i,/value type/i,/exceeds\s*limit/i,/indemnity\s*(exceeds|too\s*large)/i,/max(?:imum)?\b[^\n]*\bexceeded/i,/\bexceeded\s+(?:the\s+)?(?:limit|count)\b/i,/length\s+exceeded/i,/count\s+exceeded/i,/\bsize\s+exceeded\b/i,/\btoo\s+(?:many|long)\b/i,/not\s+(?:address|u64|number)\s+type/i,/not\s+system\s+address/i,/\bempty\b/i,/\bnot\s+equal\b/i,/unequal\s+lengths/i,/index\s+out\s+of\s+bounds?\b/i,/(?:arithmetic\s+)?(?:overflow|underflow)/i,/division\s+by\s+zero/i,/modulo\s+by\s+zero/i,/rate\s+(?:not\s+10000|exceeds)/i,/amount\s+(?:below\s+threshold|exceeds)/i,/store\s+from\s+id\s+not\s+compatible/i,/not\s+supported/i,/bad\s+(?:witness|transaction\s+hash\s+length)/i,/wrong\s+(?:borrow|value|inner\s+version|kiosk)/i,/incorrect\s+amount/i,/input\s+too\s+long/i,/vector\s+not\s+enough/i,/unknown\s+(?:action|requirement)/i,/illegal\s+rule/i,/not\s+zero/i,/no\s+config/i,/not\s+installed/i,/not\s+wow/i],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Check\x20parameter\x20format\x20against\x20the\x20tool\x20schema;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'}],WERROR_MAPPINGS=[{'codes':[WErrors['AccountNotFound'],WErrors['AddressNotFound'],WErrors['TokenNotFoundLocally']],'error_code':'object_not_found','retryable':![],'recovery_hint':'Verify\x20the\x20object\x20ID/name\x20with\x20query_toolkit;\x20local_mark\x20names\x20are\x20case-sensitive'},{'codes':[WErrors['NoPermission']],'error_code':'permission_denied','retryable':![],'recovery_hint':'Use\x20an\x20account\x20with\x20the\x20required\x20permission,\x20or\x20pass\x20permission_guard\x20IDs\x20via\x20env.permission_guard'},{'codes':[WErrors['IsValidDescription'],WErrors['IsValidName'],WErrors['IsValidName_AllowEmpty'],WErrors['IsValidEndpoint'],WErrors['IsValidAddress'],WErrors['IsValidArgType'],WErrors['IsValidTokenType'],WErrors['IsValidUint'],WErrors['IsValidInt'],WErrors['IsValidU8'],WErrors['IsValidU16'],WErrors['IsValidU32'],WErrors['IsValidU64'],WErrors['IsValidU128'],WErrors['IsValidU256'],WErrors['IsValidRate'],WErrors['IsValidArray'],WErrors['IsValidObjects'],WErrors['AllInvalid'],WErrors['InvalidParam'],WErrors['IsValidPermissionIndex'],WErrors['IsValidKey'],WErrors['IsValidIdentifier'],WErrors['IsValidHttpUrl'],WErrors['IsValidBizPermissionIndex'],WErrors['IsValidServiceItemName'],WErrors['IsValidCoinType'],WErrors['IsValidGuardIdentifier'],WErrors['IsValidValue'],WErrors['IsValidValueType'],WErrors['IsValidLocation'],WErrors['WitnessTypeInvalid']],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Check\x20parameter\x20format\x20against\x20the\x20tool\x20schema;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'},{'codes':[WErrors['BcsTypeInvalid'],WErrors['ParseObjectContentFailed']],'error_code':'bcs_error','retryable':![],'recovery_hint':'BCS\x20serialization/deserialization\x20error.\x20Verify\x20data\x20types\x20and\x20structure\x20match\x20the\x20expected\x20schema'},{'codes':[WErrors['NetworkInvalid']],'error_code':'config_error','retryable':![],'recovery_hint':'Configuration\x20error.\x20Verify\x20that\x20network,\x20RPC\x20endpoints,\x20and\x20required\x20environment\x20variables\x20are\x20properly\x20configured'},{'codes':[WErrors['AccountPersistentStorageNotSet'],WErrors['ConfigPersistentStorageNotSet'],WErrors['AccountPersistentStorageNotFound']],'error_code':'config_error','retryable':![],'recovery_hint':'Persistent\x20storage\x20not\x20configured.\x20Initialize\x20account\x20storage\x20before\x20performing\x20this\x20operation'},{'codes':[WErrors['AccountNameExist'],WErrors['LocalMarkNameExist']],'error_code':'state_conflict','retryable':![],'recovery_hint':'Object\x20state\x20conflicts\x20with\x20the\x20operation.\x20Query\x20the\x20current\x20state\x20with\x20query_toolkit\x20and\x20adjust\x20parameters'},{'codes':[WErrors['MaxObjectsPerQuery'],WErrors['ResourceTagCountExceeded'],WErrors['AddressCountExceeded'],WErrors['NumberCountExceeded']],'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Count\x20limit\x20exceeded.\x20Reduce\x20the\x20number\x20of\x20items\x20per\x20request\x20and\x20retry'}];function isWException(a){return a instanceof WException;}function classifyWException(a){const b=a['getErrorCode'](),c=WERROR_MAPPINGS['find'](e=>e['codes']['includes'](b));if(!c)return undefined;const d={'error_code':c['error_code'],'retryable':c['retryable'],'recovery_hint':c['recovery_hint']};return d;}export const MOVE_ABORT_ERROR_MAP={'service:10':{'error_code':'invalid_parameter','recovery_hint':'Discounts\x20are\x20bound\x20to\x20their\x20receiver\x20and\x20cannot\x20be\x20transferred.\x20Use\x20discount_issue\x20to\x20grant\x20a\x20new\x20discount\x20to\x20the\x20target\x20address'},'service:16':{'error_code':'stock_exhausted'},'service:18':{'error_code':'guard_rejected','recovery_hint':'This\x20Service\x20requires\x20buyers\x20to\x20present\x20a\x20Guard\x20passport\x20(buyer_guard\x20configured).\x20Attach\x20a\x20passport\x20verifying\x20the\x20required\x20guard\x20and\x20resubmit'},'service:25':{'error_code':'state_conflict','recovery_hint':'This\x20operation\x20requires\x20the\x20Service\x20to\x20have\x20an\x20Arbitration\x20bound\x20together\x20with\x20a\x20compensation\x20fund.\x20Configure\x20arbitration\x20and\x20compensation\x20first'},'service:31':{'error_code':'invalid_parameter','recovery_hint':'The\x20submitted\x20wip_hash\x20does\x20not\x20match\x20the\x20Service\x27s\x20current\x20WIP\x20hash\x20—\x20the\x20merchant\x20may\x20have\x20updated\x20the\x20WIP.\x20Re-query\x20the\x20Service\x27s\x20sale\x20info\x20and\x20resubmit\x20with\x20the\x20current\x20wip_hash'},'service:33':{'error_code':'state_conflict','recovery_hint':'The\x20Service\x20cannot\x20bind\x20an\x20Arbitration\x20whose\x20permission\x20is\x20the\x20same\x20as\x20its\x20own\x20—\x20the\x20Service\x20owner\x20would\x20then\x20control\x20dispute\x20resolution,\x20breaking\x20fairness.\x20Use\x20a\x20different\x20Arbitration\x20or\x20change\x20the\x20Service\x27s\x20permission\x20first'},'service:34':{'error_code':'sale_suspended'},'service:35':{'error_code':'discount_invalid'},'service:32':{'error_code':'invalid_parameter','recovery_hint':'The\x20sale\x20item\x20index\x20does\x20not\x20exist\x20on\x20this\x20Service.\x20Query\x20the\x20Service\x27s\x20sale\x20list\x20and\x20use\x20an\x20existing\x20item\x20index'},'machine:12':{'error_code':'guard_rejected','recovery_hint':'The\x20retained\x20submission\x20identifiers\x20do\x20not\x20exist\x20in\x20the\x20Guard.\x20Query\x20the\x20Guard\x27s\x20submission\x20table\x20and\x20correct\x20the\x20retained_submission\x20list'},'machine:14':{'error_code':'invalid_parameter','recovery_hint':'A\x20Machine\x20forward\x20must\x20define\x20one\x20of\x20namedOperator,\x20permissionIndex,\x20or\x20guard.\x20Set\x20one\x20of\x20them\x20for\x20the\x20forward'},'machine:8':{'error_code':'invalid_parameter','recovery_hint':'No\x20node\x20with\x20that\x20name\x20exists\x20in\x20this\x20Machine.\x20Export\x20the\x20node\x20set\x20via\x20machineNode2file\x20(or\x20query\x20the\x20node\x20table)\x20and\x20use\x20an\x20exact\x20existing\x20node\x20name'},'machine:10':{'error_code':'invalid_parameter','recovery_hint':'The\x20referenced\x20node\x20name\x20does\x20not\x20exist\x20in\x20this\x20Machine.\x20Export\x20the\x20node\x20set\x20via\x20machineNode2file\x20(or\x20query\x20the\x20node\x20table)\x20and\x20use\x20exact\x20existing\x20node\x20names'},'machine:13':{'error_code':'invalid_parameter','recovery_hint':'No\x20forward\x20info\x20matches\x20that\x20node/next_node/forward\x20triple.\x20Query\x20the\x20Machine\x27s\x20node\x20table\x20(onchain_table_data\x20onchain_table_item_machine_node)\x20and\x20use\x20an\x20existing\x20combination'},'progress:8':{'error_code':'invalid_parameter','recovery_hint':'This\x20forward\x20requires\x20a\x20permission_index\x20for\x20non-named-operator\x20holders.\x20Supply\x20the\x20permission_index\x20of\x20a\x20Permission\x20the\x20Machine\x20recognizes'},'order:3':{'error_code':'invalid_parameter','recovery_hint':'This\x20order\x20requires\x20progress\x20specification\x20(the\x20Service\x20is\x20machine-backed).\x20Supply\x20the\x20progress\x20parameters,\x20or\x20query\x20the\x20machine\x20node\x20info\x20for\x20the\x20expected\x20values'},'order:8':{'error_code':'invalid_parameter','recovery_hint':'This\x20order\x20requires\x20allocation\x20specification.\x20Supply\x20the\x20allocation\x20parameters\x20matching\x20the\x20Service\x27s\x20allocator\x20configuration'},'arb:5':{'error_code':'invalid_parameter','recovery_hint':'votes\x20are\x200-based\x20indices\x20of\x20the\x20propositions\x20the\x20voter\x20agrees\x20with\x20—\x20each\x20value\x20must\x20be\x20<\x20the\x20Arb\x27s\x20proposition\x20count.\x20Query\x20the\x20Arb\x27s\x20propositions\x20and\x20resubmit\x20with\x20valid\x20indices\x20(0\x20…\x20N-1)'},'arb:4':{'error_code':'time_lock_not_elapsed','recovery_hint':'The\x20voting\x20deadline\x20has\x20not\x20passed\x20yet.\x20Wait\x20until\x20the\x20deadline\x20elapses,\x20then\x20tally\x20the\x20votes'},'arb:7':{'error_code':'state_conflict','recovery_hint':'The\x20voting\x20deadline\x20has\x20passed\x20—\x20voting\x20is\x20closed.\x20Query\x20the\x20proposition\x20state\x20to\x20see\x20the\x20outcome'},'arb:8':{'error_code':'time_lock_not_elapsed','recovery_hint':'The\x20withdraw\x20duration\x20has\x20not\x20elapsed\x20yet.\x20Wait\x20until\x20the\x20lock\x20duration\x20passes,\x20then\x20withdraw'},'passport:2':{'error_code':'guard_rejected','recovery_hint':'Guards\x20relied\x20upon\x20by\x20this\x20Guard\x20must\x20be\x20added\x20to\x20the\x20Passport\x20first\x20(dependents-before-dependent\x20order).\x20Add\x20the\x20relied-upon\x20guards\x20to\x20the\x20passport,\x20then\x20add\x20this\x20one'},'passport:5':{'error_code':'guard_rejected','recovery_hint':'The\x20passport\x20lacks\x20the\x20required\x20verification\x20for\x20this\x20operation.\x20Complete\x20the\x20verification\x20scene\x20first'},'passport:6':{'error_code':'guard_rejected','recovery_hint':'The\x20guard\x20is\x20not\x20an\x20impact\x20guard\x20of\x20this\x20Passport\x20—\x20its\x20result\x20does\x20not\x20participate\x20in\x20the\x20passport\x20outcome.\x20Query\x20the\x20passport\x27s\x20guard\x20list\x20and\x20use\x20a\x20guard\x20registered\x20with\x20impack=true'},'passport:9':{'error_code':'guard_rejected','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20in\x20this\x20passport.\x20Add\x20the\x20guard\x20to\x20the\x20passport\x20(with\x20impack=true\x20if\x20its\x20result\x20must\x20participate\x20in\x20the\x20outcome),\x20then\x20retry'},'passport:10':{'error_code':'invalid_parameter','recovery_hint':'The\x20submission\x20identifier\x20does\x20not\x20exist\x20in\x20this\x20passport.\x20Query\x20the\x20passport\x27s\x20submission\x20table\x20and\x20use\x20a\x20registered\x20identifier'},'passport:11':{'error_code':'guard_rejected','recovery_hint':'Digest\x20mismatch\x20in\x20proof\x20verification.\x20The\x20proof\x20does\x20not\x20cover\x20the\x20expected\x20content\x20—\x20regenerate\x20the\x20proof\x20against\x20the\x20current\x20target'},'reward:1':{'error_code':'time_lock_not_elapsed','recovery_hint':'The\x20guard-add\x20lock\x20(guard_not_added_expiration_time)\x20is\x20still\x20active\x20and\x20cannot\x20be\x20replaced\x20yet.\x20Wait\x20until\x20it\x20elapses,\x20then\x20set\x20the\x20new\x20lock\x20time'},'reward:2':{'error_code':'invalid_parameter','retryable':![],'recovery_hint':'The\x20guard\x27s\x20expiration_time\x20has\x20already\x20passed\x20and\x20it\x20can\x20no\x20longer\x20be\x20used.\x20Ask\x20the\x20reward\x20issuer\x20to\x20re-add\x20the\x20guard\x20with\x20a\x20later\x20expiration\x20(or\x20use\x20a\x20different\x20guard),\x20then\x20retry'},'reward:10':{'error_code':'time_lock_not_elapsed','recovery_hint':'Guards\x20are\x20locked\x20until\x20guard_not_added_expiration_time\x20elapses.\x20Wait\x20until\x20then\x20before\x20adding\x20guards'},'reward:11':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard-add\x20lock\x20time\x20must\x20be\x20strictly\x20later\x20than\x20the\x20current\x20clock\x20time.\x20Set\x20a\x20future\x20timestamp'},'reward:7':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20in\x20this\x20Reward.\x20Use\x20a\x20guard\x20registered\x20in\x20the\x20Reward\x27s\x20guard\x20table,\x20or\x20have\x20the\x20issuer\x20add\x20it\x20first'},'repository:7':{'error_code':'invalid_parameter','recovery_hint':'The\x20referenced\x20policy\x20does\x20not\x20exist\x20in\x20the\x20repository.\x20Query\x20the\x20repository\x20policies\x20and\x20use\x20a\x20valid\x20policy\x20ID'},'repository:8':{'error_code':'invalid_parameter','recovery_hint':'The\x20referenced\x20policy\x20does\x20not\x20exist\x20in\x20the\x20repository\x20(option\x20is\x20none).\x20Query\x20the\x20repository\x20policies\x20and\x20use\x20a\x20valid\x20policy\x20ID'},'repository:11':{'error_code':'invalid_parameter','recovery_hint':'The\x20policy\x27s\x20guard\x20entry\x20expects\x20id/data\x20from\x20the\x20passport\x20submission\x20(id_from_submission/data_from_submission\x20is\x20set),\x20but\x20this\x20call\x20passes\x20explicit\x20values.\x20Use\x20the\x20submission-based\x20call\x20route,\x20or\x20fix\x20the\x20policy\x20entry'},'repository:12':{'error_code':'guard_rejected','recovery_hint':'The\x20write_guard\x20is\x20not\x20an\x20impact\x20guard\x20in\x20the\x20passport\x20—\x20the\x20passport\x20must\x20verify\x20this\x20guard\x20with\x20impack=true.\x20Rebuild\x20the\x20passport\x20including\x20the\x20write_guard\x20as\x20an\x20impact\x20guard'},'repository:13':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20in\x20the\x20repository\x20policy\x27s\x20guard\x20list.\x20Query\x20the\x20policy\x27s\x20guards\x20and\x20use\x20a\x20registered\x20one'},'repository:14':{'error_code':'invalid_parameter','recovery_hint':'The\x20ID\x20vector\x20is\x20shorter\x20than\x20required\x20—\x20a\x20vector\x20length\x20problem,\x20not\x20a\x20balance\x20problem.\x20Align\x20the\x20vector\x20lengths\x20with\x20the\x20operation\x27s\x20requirement'},'repository:15':{'error_code':'invalid_parameter','recovery_hint':'The\x20data\x20vector\x20is\x20shorter\x20than\x20required\x20—\x20a\x20vector\x20length\x20problem,\x20not\x20a\x20balance\x20problem.\x20Align\x20the\x20vector\x20lengths\x20with\x20the\x20operation\x27s\x20requirement'},'repository:20':{'error_code':'invalid_parameter','recovery_hint':'The\x20policy\x20entry\x20requires\x20the\x20id\x20to\x20come\x20from\x20the\x20passport\x20submission\x20(id_from_submission\x20is\x20set).\x20Use\x20the\x20submission-based\x20call\x20route\x20that\x20supplies\x20the\x20passport'},'repository:21':{'error_code':'invalid_parameter','recovery_hint':'The\x20quote\x20guard\x20must\x20be\x20a\x20depended\x20guard\x20(no\x20relies\x20of\x20its\x20own,\x20immutable,\x20with\x20reputation).\x20Configure\x20the\x20guard\x20accordingly\x20before\x20setting\x20it\x20as\x20the\x20policy\x27s\x20quote\x20guard'},'repository:22':{'error_code':'invalid_parameter','recovery_hint':'The\x20policy\x20requires\x20a\x20write_guard\x20when\x20id_from\x20is\x20None.\x20Set\x20the\x20policy\x27s\x20write_guard\x20or\x20use\x20a\x20non-None\x20id_from'},'repository:23':{'error_code':'invalid_parameter','recovery_hint':'id_from_submission\x20is\x20forbidden\x20when\x20id_from\x20is\x20Clock\x20or\x20Signer\x20(the\x20id\x20is\x20auto-generated).\x20Remove\x20id_from_submission\x20from\x20the\x20policy\x20entry\x20or\x20change\x20id_from'},'permission:7':{'error_code':'invalid_parameter','recovery_hint':'The\x20permission\x20index\x20is\x20not\x20defined\x20in\x20this\x20Permission.\x20Grant\x20it\x20first\x20(permission\x20add\x20perm\x20by\x20index)\x20or\x20use\x20an\x20already-granted\x20index\x20—\x20audit\x20with\x20onchain_table_data\x20query_type=onchain_table_item_permission_perm'},'arbitration:8':{'error_code':'invalid_parameter','recovery_hint':'This\x20guard\x20is\x20not\x20registered\x20as\x20a\x20voting\x20guard\x20on\x20the\x20Arbitration.\x20Add\x20it\x20to\x20the\x20Arbitration\x27s\x20voting_guard\x20config\x20(with\x20its\x20vote_weight)\x20first,\x20or\x20use\x20an\x20already-registered\x20voting\x20guard'},'demand:4':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20on\x20this\x20Demand.\x20Use\x20a\x20guard\x20registered\x20on\x20the\x20Demand,\x20or\x20configure\x20it\x20first'},'treasury:3':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20as\x20an\x20external\x20deposit\x20guard\x20on\x20this\x20Treasury.\x20Register\x20it\x20in\x20the\x20Treasury\x27s\x20external\x20deposit\x20guard\x20list\x20first'},'treasury:4':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20is\x20not\x20registered\x20as\x20an\x20external\x20withdraw\x20guard\x20on\x20this\x20Treasury.\x20Register\x20it\x20in\x20the\x20Treasury\x27s\x20external\x20withdraw\x20guard\x20list\x20first'},'guard:6':{'error_code':'invalid_parameter','recovery_hint':'The\x20guard\x20being\x20relied\x20upon\x20must\x20be\x20a\x20depended\x20guard\x20(no\x20relies\x20of\x20its\x20own,\x20immutable,\x20with\x20reputation).\x20Rely\x20on\x20a\x20terminal\x20guard,\x20not\x20one\x20with\x20its\x20own\x20dependencies'},'guard:7':{'error_code':'invalid_parameter','recovery_hint':'A\x20Guard\x20cannot\x20depend\x20on\x20itself.\x20Remove\x20the\x20self-reference\x20from\x20the\x20relies\x20list'},'guard:9':{'error_code':'invalid_parameter','recovery_hint':'The\x20submission\x20identifier\x27s\x20object\x20type\x20does\x20not\x20match\x20the\x20Guard\x20table\x20entry.\x20Check\x20each\x20identifier\x27s\x20type\x20against\x20the\x20Guard\x27s\x20table'},'guard:10':{'error_code':'invalid_parameter','recovery_hint':'The\x20identifiers\x20and\x20values\x20vectors\x20must\x20have\x20equal\x20lengths.\x20Align\x20the\x20counts'},'guard:11':{'error_code':'guard_rejected','recovery_hint':'The\x20submission\x20identifier\x20is\x20not\x20in\x20the\x20Guard\x27s\x20table.\x20Query\x20the\x20Guard\x27s\x20table\x20identifiers\x20and\x20submit\x20a\x20valid\x20one'},'allocation:5':{'error_code':'invalid_parameter','recovery_hint':'Multiple\x20surplus\x20entries\x20are\x20not\x20supported.\x20Provide\x20at\x20most\x20one\x20surplus\x20entry\x20in\x20the\x20allocation'},'allocation:8':{'error_code':'state_conflict','recovery_hint':'No\x20allocators\x20are\x20configured\x20for\x20this\x20order.\x20The\x20merchant\x20must\x20configure\x20the\x20Service\x27s\x20allocation\x20first'},'allocation:9':{'error_code':'invalid_parameter','recovery_hint':'Payment\x20info\x20is\x20missing\x20for\x20the\x20allocation.\x20Supply\x20the\x20payment\x20parameters\x20required\x20by\x20the\x20order'},'allocation:12':{'error_code':'invalid_parameter','recovery_hint':'The\x20split\x20amount\x20is\x20below\x20the\x20allocator\x27s\x20minimum\x20threshold.\x20Raise\x20the\x20amount\x20or\x20remove\x20the\x20split'},'transfer:0':{'error_code':'invalid_parameter','recovery_hint':'A\x20shared\x20non-new\x20object\x20was\x20passed\x20where\x20only\x20newly-created\x20objects\x20are\x20allowed'},'coin:3':{'error_code':'state_conflict','recovery_hint':'The\x20operation\x20is\x20disallowed\x20while\x20the\x20coin\x20is\x20globally\x20paused.\x20Wait\x20for\x20the\x20pause\x20to\x20be\x20lifted'},'kiosk:4':{'error_code':'state_conflict','recovery_hint':'The\x20item\x20is\x20listed\x20exclusively\x20on\x20another\x20marketplace.\x20Delist\x20it\x20there\x20before\x20this\x20operation'},'token:5':{'error_code':'insufficient_balance','recovery_hint':'The\x20token\x20balance\x20cannot\x20be\x20consumed\x20(a\x20locked\x20portion\x20exists).\x20Unlock\x20or\x20acquire\x20more\x20balance\x20first'},'package:0':{'error_code':'invalid_parameter','recovery_hint':'Not\x20a\x20one-time\x20witness\x20—\x20the\x20module\x20initializer\x20pattern\x20is\x20invalid'},'package:1':{'error_code':'invalid_parameter','recovery_hint':'The\x20witness\x20is\x20too\x20permissive\x20for\x20this\x20operation'},'package:4':{'error_code':'invalid_parameter','recovery_hint':'Wrong\x20upgrade\x20cap\x20for\x20this\x20package\x20upgrade'},'u64:1':{'error_code':'invalid_parameter','recovery_hint':'Arithmetic\x20overflow\x20—\x20the\x20computed\x20value\x20exceeds\x20u64.\x20Reduce\x20the\x20amounts'},'u64:2':{'error_code':'invalid_parameter','recovery_hint':'Arithmetic\x20underflow\x20—\x20the\x20computed\x20value\x20goes\x20below\x20zero.\x20Check\x20the\x20subtraction\x20inputs'},'u64:3':{'error_code':'invalid_parameter','recovery_hint':'Division\x20by\x20zero\x20—\x20the\x20divisor\x20is\x20zero.\x20Guard\x20the\x20divisor\x20before\x20dividing'},'u64:4':{'error_code':'invalid_parameter','recovery_hint':'Modulo\x20by\x20zero\x20—\x20the\x20divisor\x20is\x20zero.\x20Guard\x20the\x20divisor\x20before\x20the\x20modulo'},'bcs:0':{'error_code':'bcs_error','recovery_hint':'BCS\x20value\x20out\x20of\x20range'},'bcs:1':{'error_code':'bcs_error','recovery_hint':'BCS\x20value\x20is\x20not\x20a\x20bool'},'bcs:2':{'error_code':'bcs_error','recovery_hint':'BCS\x20length\x20out\x20of\x20range'},'address:0':{'error_code':'invalid_parameter','recovery_hint':'Address\x20parse\x20error\x20—\x20the\x20byte\x20length\x20is\x20not\x2032'},'hex:0':{'error_code':'invalid_parameter','recovery_hint':'Invalid\x20hex\x20length'},'hex:1':{'error_code':'invalid_parameter','recovery_hint':'Not\x20a\x20valid\x20hex\x20character'}};function canonicalDefaultFor(a){const b=ERROR_RULES['find'](c=>c['error_code']===a);if(b)return{'retryable':b['retryable'],'recovery_hint':b['recovery_hint']};return{'retryable':![],'recovery_hint':'Inspect\x20the\x20full\x20error\x20message;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'};}function classifyMoveAbort(a){const b=MOVE_ABORT_ERROR_MAP[a['module']+':'+a['code']];if(!b)return undefined;const c=canonicalDefaultFor(b['error_code']),d=b['recovery_hint']??c['recovery_hint'],e={'error_code':b['error_code'],'retryable':b['retryable']??c['retryable'],'recovery_hint':a['description']&&!d['includes'](a['description'])?d+'.\x20Details:\x20'+a['description']:d,'move_abort_info':a};return e;}function isWowokSystemAddress(a){const b=a['toLowerCase']()['replace'](/^0x/,'')['replace'](/^0+(?=.)/,'');return b==='1'||b==='2';}export function normalizeErrorMessage(a){if(typeof a==='string')return a;if(a&&typeof a==='object'){const b=a;if(typeof b['message']==='string'&&b['message'])return b['message'];if(typeof b['error']==='string'&&b['error'])return b['error'];try{return JSON['stringify'](a);}catch{return String(a);}}if(a===undefined||a===null)return'';return String(a);}function extractMoveAbortInfo(a){const b=normalizeErrorMessage(a);if(!b)return undefined;const c=b['match'](/MoveAbort\(.*,\s*(\d+)\s*\)/),d=b['match'](/name:\s*Identifier\("([^"]+)"\)/),e=b['match'](/address:\s*([0-9a-fA-Fx]+)/);if(c&&d&&e){const i=parseInt(c[0x1],0xa),j=d[0x1]['toLowerCase'](),k=e[0x1]['toLowerCase']();if(isWowokSystemAddress(k)){const l=getMoveErrorDescription(j,i)??undefined;return{'module':j,'code':i,'description':l};}}const f=b['match'](/abort code:\s*(\d+)/),g=b['match'](/'0x[0-9a-fA-F]+::([^:]+)::[^']+'/),h=b['match'](/'(0x[0-9a-fA-F]+)::/);if(f&&g&&h){const m=parseInt(f[0x1],0xa),n=g[0x1]['toLowerCase'](),o=h[0x1]['toLowerCase']();if(isWowokSystemAddress(o)){const p=getMoveErrorDescription(n,m)??undefined;return{'module':n,'code':m,'description':p};}}return undefined;}export function classifyError(a,b){const c=normalizeErrorMessage(a),d=extractMoveAbortInfo(c);if(d){const g=classifyMoveAbort(d);if(g)return g;}if(b!==undefined&&isWException(b)){const h=classifyWException(b);if(h)return d&&(h['move_abort_info']=d,d['description']&&h['recovery_hint']&&!h['recovery_hint']['includes'](d['description'])&&(h['recovery_hint']=h['recovery_hint']+'.\x20Details:\x20'+d['description'])),h;}if(!c)return{'error_code':'unknown','retryable':![]};const e=d?.['description']?c+'\x0a'+d['description']:c;for(const i of ERROR_RULES){if(i['patterns']['some'](j=>j['test'](e))){const j={'error_code':i['error_code'],'retryable':i['retryable'],'recovery_hint':i['recovery_hint']};return d&&(j['move_abort_info']=d,d['description']&&(j['recovery_hint']=j['recovery_hint']+'.\x20Details:\x20'+d['description'])),j;}}const f={'error_code':'unknown','retryable':![],'recovery_hint':'Inspect\x20the\x20full\x20error\x20message;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'};return d&&(f['move_abort_info']=d,d['description']&&(f['recovery_hint']=d['description']+'.\x20'+f['recovery_hint'])),f;}const INTENT_RULES=[{'operation_type':'service','signals':a=>a?.['publish']===!![],'intent':'publish_service','confidence':0.95},{'operation_type':'service','signals':a=>a?.['name']&&a?.['publish']===undefined,'intent':'create_service','confidence':0.9},{'operation_type':'service','intent':'modify_service','confidence':0.7},{'operation_type':'machine','intent':'configure_machine','confidence':0.9},{'operation_type':'progress','intent':'update_progress','confidence':0.9},{'operation_type':'order','signals':a=>!!a?.['arb'],'intent':'apply_arbitration','confidence':0.9},{'operation_type':'order','intent':'manage_order','confidence':0.85},{'operation_type':'payment','signals':a=>a?.['receive']===!![],'intent':'claim_escrow_payment','confidence':0.95},{'operation_type':'payment','intent':'send_payment','confidence':0.9},{'operation_type':'reward','intent':'manage_reward','confidence':0.9},{'operation_type':'demand','intent':'post_demand','confidence':0.9},{'operation_type':'treasury','intent':'manage_treasury','confidence':0.9},{'operation_type':'allocation','intent':'allocate_funds','confidence':0.9},{'operation_type':'permission','intent':'manage_permission','confidence':0.9},{'operation_type':'guard','intent':'configure_guard','confidence':0.9},{'operation_type':'arbitration','intent':'manage_arbitration','confidence':0.9},{'operation_type':'contact','intent':'manage_contact','confidence':0.9},{'operation_type':'repository','intent':'manage_repository','confidence':0.9},{'operation_type':'personal','intent':'manage_personal','confidence':0.9},{'operation_type':'gen_passport','intent':'generate_passport','confidence':0.95},{'operation_type':'proof','intent':'create_proof','confidence':0.9},{'operation_type':'gen_proof','intent':'generate_proof','confidence':0.95},{'operation_type':'bridge_cross_chain_wow_to_evm','intent':'cross_chain_wow_to_evm_deposit','confidence':0.95},{'operation_type':'bridge_cross_chain_evm_to_wow','intent':'cross_chain_evm_to_wow_deposit','confidence':0.95},{'operation_type':'bridge_claim_wow_to_evm','intent':'claim_wow_to_evm','confidence':0.95},{'operation_type':'bridge_withdraw','intent':'withdraw_from_evm_account','confidence':0.9},{'operation_type':'bridge_query_active_evm_account','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_supported_evm_chains','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_supported_tokens','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_transfer_list','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_query_transfer_status','intent':'query_bridge_status','confidence':0.85},{'operation_type':'bridge_manage_evm_rpc','intent':'manage_evm_rpc','confidence':0.9},{'operation_type':'account_new','intent':'create_account','confidence':0.95},{'operation_type':'account_faucet','intent':'claim_faucet','confidence':0.95},{'operation_type':'account_balance','intent':'query_balance','confidence':0.9},{'operation_type':'mark_add','intent':'create_local_mark','confidence':0.9},{'operation_type':'mark_remove','intent':'remove_local_mark','confidence':0.9},{'operation_type':'mark_query','intent':'query_local_marks','confidence':0.9},{'operation_type':'local_info','intent':'query_local_info','confidence':0.9},{'operation_type':'query_toolkit','intent':'query_objects','confidence':0.85},{'operation_type':'onchain_events','intent':'query_events','confidence':0.85},{'operation_type':'onchain_table_data','intent':'query_table_data','confidence':0.85}];export function inferIntent(a,b){const c=INTENT_RULES['filter'](f=>f['operation_type']===a),d=c['find'](f=>f['signals']&&f['signals'](b));if(d)return d['intent'];const e=c['find'](f=>!f['signals']);return e?.['intent']??a;}function inferStatus(a){if(a&&typeof a==='object'&&'error'in a)return'failed';if(a&&typeof a==='object'&&'digest'in a)return a?.['effects']?.['status']?.['status']==='success'?'success':'failed';return'success';}const OBJECT_TYPE_TO_ROLE={'service':'Service','machine':'Machine','progress':'Progress','permission':'Permission','guard':'Guard','order':'Order','arb':'ArbCase','arbitration':'Arbitration','messenger':'Messenger','contact':'Contact','demand':'Demand','reward':'Reward','personal':'Personal','repository':'Repository','treasury':'Treasury','discount':'Discount','allocation':'Allocation','payment':'Payment','passport':'Passport','proof':'Proof'};export function objectTypeToRole(a){if(!a)return'Other';const b=a['replace'](/<.*>/,'')['trim'](),c=b['split']('::'),d=(c[c['length']-0x1]||'')['toLowerCase']();return OBJECT_TYPE_TO_ROLE[d]??'Other';}export function tagObjectRoles(a){if(!Array['isArray'](a))return[];return a['filter'](b=>b&&(b['objectId']||b['object']?.['objectId']))['map'](b=>{const d=b['objectId']||b['object']?.['objectId'],e=b['objectType']||b['object']?.['objectType']||'',f=b['type']||'';return{'id':d,'role':objectTypeToRole(e),'immutable':e['includes']('Service')&&f==='published'};});}const GAS_COIN_PATTERNS=[/::wow::WOW$/i],SMALL_AMOUNT_THRESHOLD=BigInt(0xf4240);function isNegative(a){return String(a??'0')['startsWith']('-');}function hasEventMatch(a,b){if(!Array['isArray'](a))return![];return a['some'](c=>b['test'](String(c?.['type']??c?.['event_type']??'')));}function isGasCoin(a){if(!a)return![];return GAS_COIN_PATTERNS['some'](b=>b['test'](a));}function absAmount(a){try{return BigInt(String(a)['replace']('-','')||'0');}catch{return BigInt(0x0);}}const FUND_ROLE_RULES=[{'when':a=>hasEventMatch(a['events'],/order::OrderPaidEvent/i),'role':'payment','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/order::OrderRefundedEvent|order::RefundEvent/i),'role':'refund','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/reward::RewardClaimedEvent|reward::ClaimedEvent/i),'role':'reward','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/arbitration::CompensationEvent|arbitration::RefundEvent/i),'role':'compensation','confidence':0.9},{'when':a=>hasEventMatch(a['events'],/treasury::DepositEvent/i),'role':'deposit','confidence':0.95},{'when':a=>hasEventMatch(a['events'],/treasury::WithdrawEvent|treasury::ReleaseEvent/i),'role':'release','confidence':0.9},{'when':a=>a['operation_type']==='payment'&&a['data']?.['receive']===!![],'role':'release','confidence':0.95},{'when':a=>a['operation_type']==='payment'&&isNegative(a['amount']),'role':'payment','confidence':0.95},{'when':a=>a['operation_type']==='payment'&&!isNegative(a['amount']),'role':'refund','confidence':0.9},{'when':a=>a['operation_type']==='reward'&&isNegative(a['amount']),'role':'reward','confidence':0.95},{'when':a=>a['operation_type']==='reward'&&!isNegative(a['amount']),'role':'release','confidence':0.9},{'when':a=>a['operation_type']==='treasury'&&isNegative(a['amount']),'role':'deposit','confidence':0.95},{'when':a=>a['operation_type']==='treasury'&&!isNegative(a['amount']),'role':'release','confidence':0.9},{'when':a=>a['operation_type']==='allocation'&&isNegative(a['amount']),'role':'payment','confidence':0.85},{'when':a=>a['operation_type']==='allocation'&&!isNegative(a['amount']),'role':'release','confidence':0.85},{'when':a=>a['operation_type']==='arbitration'&&(a['data']?.['compensation']!==undefined||a['data']?.['arb']===!![]),'role':'compensation','confidence':0.9},{'when':a=>a['operation_type']==='order'&&isNegative(a['amount'])&&a['data']?.['buy']!==undefined,'role':'payment','confidence':0.9},{'when':a=>a['operation_type']==='order'&&!isNegative(a['amount'])&&(a['data']?.['refund']!==undefined||a['data']?.['arb']!==undefined),'role':'refund','confidence':0.85},{'when':a=>{if(isNegative(a['amount']))return![];const b=absAmount(a['amount']);return isGasCoin(a['coinType'])&&b>BigInt(0x0)&&b<SMALL_AMOUNT_THRESHOLD;},'role':'gas','confidence':0.7},{'when':a=>{if(isNegative(a['amount']))return![];return a['sender']!==undefined&&a['recipient']!==undefined&&a['sender']===a['recipient']&&a['sender']!=='';},'role':'change','confidence':0.7},{'when':a=>isNegative(a['amount']),'role':'payment','confidence':0.7},{'when':a=>!isNegative(a['amount'])&&absAmount(a['amount'])===BigInt(0x0),'role':'other','confidence':0.5},{'when':a=>!isNegative(a['amount']),'role':'release','confidence':0.7},{'when':()=>!![],'role':'other','confidence':0.3}];export function tagFundRoles(a,b,c,d){if(!Array['isArray'](a))return[];return a['filter'](e=>e&&(e['amount']!==undefined||e['coinType']))['map'](e=>{const f={'operation_type':b,'amount':String(e['amount']??'0'),'coinType':e['coinType'],'data':c??{},'events':d,'sender':e['sender'],'recipient':e['recipient']},g=FUND_ROLE_RULES['find'](i=>i['when'](f)),h=g?.['role']??'other';return{'amount':f['amount'],'coinType':e['coinType']||'','role':h,'from':e['sender']??null,'to':e['recipient']??null};});}const EVENT_SEMANTIC_RULES=EVENT_SEMANTIC_REGISTRY['map'](a=>({'pattern':new RegExp(a['move_type']['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'i'),'business_meaning':a['business_meaning'],'category':a['category'],'side_effect':a['side_effect']}));function extractRelatedObject(a){if(!a||typeof a!=='object')return undefined;const b=a['fields']??a['payload']??a;if(typeof b!=='object')return undefined;for(const c of['object','object_id','objectId','parent','demand','service','order','machine','payment','progress','arb','allocation','resource','id']){const d=b[c];if(typeof d==='string'&&d['startsWith']('0x')&&d['length']>=0x6)return d;}return undefined;}const BUILTIN_EVENT_TYPE_MAP=Object['fromEntries'](EVENT_SEMANTIC_REGISTRY['map'](a=>[a['name'],a['move_type']]));export function eventToSemantic(a){const b=String(a?.['type']??a?.['event_type']??''),c=String(a?.['type_raw']??''),d=[c,b,BUILTIN_EVENT_TYPE_MAP[b]??'']['filter'](Boolean),e=EVENT_SEMANTIC_RULES['find'](h=>d['some'](i=>h['pattern']['test'](i)));if(!e)return{'event_type':b,'business_meaning':'Unknown\x20event','category':'other'};const f=e['extractRelatedObject']?e['extractRelatedObject'](a):extractRelatedObject(a),g={'event_type':b,'business_meaning':e['business_meaning'],'category':e['category']};if(f)g['related_object']=f;if(e['side_effect'])g['side_effect']=e['side_effect'];return g;}export function annotateEvents(a){if(!Array['isArray'](a))return[];return a['map'](eventToSemantic);}const NEXT_ACTION_RULES=[{'when':a=>a==='service','action':'publish\x20the\x20Service\x20when\x20configuration\x20is\x20complete','reason':'Service\x20must\x20be\x20published\x20before\x20customers\x20can\x20order','tool':'onchain_operations\x20(service\x20with\x20publish:true)','priority':'recommended'},{'when':a=>a==='service','action':'add\x20Machine\x20nodes\x20to\x20define\x20the\x20service\x20workflow','reason':'Machine\x20drives\x20order\x20state\x20transitions','tool':'onchain_operations\x20(machine)','priority':'recommended'},{'when':a=>a==='machine','action':'bind\x20Progress\x20to\x20track\x20order\x20execution','reason':'Progress\x20provides\x20customer-visible\x20status\x20updates','tool':'onchain_operations\x20(progress)','priority':'recommended'},{'when':a=>a==='order','action':'wait\x20for\x20customer\x20payment\x20or\x20proceed\x20to\x20allocation','reason':'Order\x20lifecycle:\x20payment\x20→\x20allocation\x20→\x20completion','priority':'optional'},{'when':(a,b)=>a==='order'&&b?.['transfer_to']!==undefined,'action':'inform\x20the\x20end\x20customer\x20about\x20the\x20supplier/sub-contractor\x20who\x20will\x20fulfill\x20this\x20order','reason':'O-5\x20procurement\x20sub-order\x20transparency:\x20customers\x20have\x20the\x20right\x20to\x20know\x20who\x20fulfills\x20their\x20order','tool':'messenger_operation\x20(notify\x20customer)','priority':'recommended'},{'when':a=>a==='demand','action':'wait\x20for\x20presenter\x20submissions\x20or\x20evaluate\x20existing\x20ones','reason':'Demand\x20lifecycle:\x20presenters\x20submit\x20solutions\x20for\x20reward','priority':'optional'},{'when':a=>a==='reward','action':'deposit\x20funds\x20into\x20the\x20reward\x20pool','reason':'Reward\x20pool\x20must\x20be\x20funded\x20before\x20claimants\x20can\x20withdraw','tool':'onchain_operations\x20(treasury)','priority':'recommended'},{'when':a=>a==='bridge_cross_chain_wow_to_evm','action':'poll\x20query_transfer_status\x20until\x20bridge\x20signs\x20(~1-5\x20min),\x20then\x20call\x20claim_wow_to_evm\x20to\x20complete','reason':'Cross-chain\x20WOW→EVM\x20is\x20a\x202-step\x20process:\x20deposit\x20first,\x20then\x20claim\x20after\x20bridge\x20confirmation','tool':'bridge_operation\x20(query_transfer_status,\x20then\x20claim_wow_to_evm)','priority':'required'},{'when':a=>a==='bridge_cross_chain_evm_to_wow','action':'poll\x20query_transfer_status\x20to\x20monitor\x20auto-claim\x20progress\x20(~10-20\x20min)','reason':'EVM→WOW\x20cross-chain\x20auto-claims;\x20monitor\x20progress\x20but\x20no\x20manual\x20action\x20needed','tool':'bridge_operation\x20(query_transfer_status)','priority':'recommended'},{'when':a=>a==='bridge_claim_wow_to_evm','action':'verify\x20recipient\x20EVM\x20balance\x20updated','reason':'Claim\x20completes\x20the\x20cross-chain\x20transfer;\x20verify\x20funds\x20arrived\x20on\x20EVM\x20side','tool':'bridge_operation\x20(query_active_evm_account)','priority':'recommended'},{'when':a=>a==='bridge_withdraw','action':'verify\x20WOW\x20balance\x20updated','reason':'Withdrawal\x20moves\x20funds\x20from\x20active\x20EVM\x20account\x20to\x20WOW;\x20verify\x20balance','tool':'account_operation\x20(balance)','priority':'recommended'},{'when':a=>a==='account_new','action':'claim\x20faucet\x20tokens\x20for\x20gas\x20if\x20on\x20testnet,\x20then\x20proceed\x20to\x20create\x20Service','reason':'New\x20account\x20needs\x20gas\x20tokens\x20before\x20on-chain\x20operations','tool':'account_operation\x20(faucet)','priority':'recommended'},{'when':a=>a==='account_faucet','action':'proceed\x20to\x20create\x20Permission\x20and\x20Service\x20objects','reason':'Account\x20is\x20now\x20funded;\x20start\x20building\x20your\x20service','tool':'onchain_operations\x20(permission,\x20service)','priority':'recommended'},{'when':a=>a==='query_toolkit','action':'use\x20the\x20queried\x20object\x20data\x20to\x20plan\x20next\x20operations','reason':'Query\x20results\x20reveal\x20current\x20object\x20states\x20for\x20decision-making','priority':'optional'}];function inferNextActions(a,b,c){return NEXT_ACTION_RULES['filter'](d=>d['when'](a,b,c))['map'](d=>({'action':d['action'],'reason':d['reason'],'tool':d['tool'],'priority':d['priority']}));}function inferWarnings(a,b,c){const d=[];return a==='service'&&b?.['order_allocators']===undefined&&d['push']('order_allocators\x20not\x20configured;\x20order\x20funds\x20cannot\x20be\x20distributed\x20automatically'),a==='reward'&&(b?.['balance']==='0'||b?.['balance']===0x0)&&d['push']('Reward\x20pool\x20balance\x20is\x20zero;\x20claimants\x20cannot\x20withdraw'),a==='order'&&b?.['transfer_to']!==undefined&&d['push']('[TRANSPARENCY]\x20Order\x20ownership\x20is\x20being\x20transferred\x20(likely\x20to\x20a\x20supplier/sub-contractor).\x20'+'Ensure\x20the\x20end\x20customer\x20is\x20informed\x20about\x20who\x20fulfills\x20their\x20order\x20—\x20this\x20builds\x20trust\x20and\x20is\x20required\x20for\x20procurement\x20sub-orders.'),d;}function composeSummary(a,b,c,d,e){const f=a['replace'](/_/g,'\x20');if(b==='failed')return'Failed\x20to\x20'+f;if(b==='pending_input')return f+'\x20requires\x20Guard\x20submission\x20to\x20proceed';const g=[];if(c['length'])g['push']('created\x20'+c['length']+'\x20object(s)');if(d['length'])g['push']('modified\x20'+d['length']+'\x20object(s)');if(e['length']){if(a==='allocate_funds'){const h=e['map'](i=>{const j=i['amount'],k=shortCoinType(i['coinType']),l=i['to']?shortAddr(i['to']):null,m=i['from']?shortAddr(i['from']):null;if(l)return j+'\x20'+k+'\x20→\x20'+l;if(m)return j+'\x20'+k+'\x20from\x20'+m;return j+'\x20'+k;})['join'](';\x20');g['push']('distributed:\x20'+h);}else g['push'](e['length']+'\x20fund\x20movement(s)');}return'Successfully\x20'+f+(g['length']?'\x20('+g['join'](',\x20')+')':'');}function shortAddr(a){return formatShortAddress(a);}function shortCoinType(a){if(!a)return'coin';const b=a['split']('::');return b[b['length']-0x1]||a;}function buildCustomerAdvice(a,b,c){if(!a308a('customer_intelligence'))return undefined;let d;if(a==='order')d='preorder';else{if(a==='query_toolkit'||a==='onchain_table_data'||a==='onchain_events')d='browse';else{if(a==='service')d='evaluate';else return undefined;}}const e=b?.['service_name']??b?.['service_id']??b?.['service']??b?.['name'],f=b?.['order_name']??b?.['order_id']??b?.['order'];let g;if(b?.['price']!==undefined)try{g=BigInt(String(b['price']));}catch{}if(g===undefined&&c?.['price']!==undefined)try{g=BigInt(String(c['price']));}catch{}const h=booleanFromSignals(b?.['arb_name']!==undefined||b?.['arbitration']!==undefined,b?.['arb']===![]),i=booleanFromSignals(b?.['compensation_fund']!==undefined||b?.['compensation']!==undefined,![]),j=booleanFromSignals(b?.['refund']!==undefined,![]),k=booleanFromSignals(b?.['um']!==undefined||b?.['um_name']!==undefined||b?.['messenger']!==undefined||c?.['um']!==undefined,b?.['um']===null||b?.['um_name']===null),l=Array['isArray'](b?.['customer_required'])?b['customer_required']['filter'](A=>typeof A==='string'):Array['isArray'](c?.['customer_required'])?c['customer_required']['filter'](A=>typeof A==='string'):[],m=h===![],n=i===![],o=typeof b?.['risk_score']==='number'?b['risk_score']:typeof c?.['risk_score']==='number'?c['risk_score']:undefined,p=b?.['risk_level']??c?.['risk_level'],q=getProfile(),s=q['risk_appetite']==='conservative'?0x46:q['risk_appetite']==='aggressive'?0x1e:0x32;let t;const u=c?.['_money_display']??(Array['isArray'](c?.['objects'])?c['objects'][0x0]?.['_money_display']:undefined),v=u?Object['values'](u)[0x0]:undefined;if(v?.['precision_known']===!![])t={'decimals':v['decimals'],'symbol':v['symbol']};else{const A=c?.['type_raw']??(Array['isArray'](c?.['objects'])?c['objects'][0x0]?.['type_raw']:undefined);t=registryDisplayHint(extractGenericTokenType(A))??registryDisplayHint(typeof b?.['type_parameter']==='string'?b['type_parameter']:undefined);}const w={'stage':d,'service_id':e,'order_id':f,'service_price':g,'token':t,'has_arbitration':h,'has_compensation':i,'has_refund_path':j,'has_messenger':k,'customer_required':l,'risk_score':o,'risk_level':p,'user_min_trust_score':s,'user_require_arbitration':q['risk_appetite']==='conservative','user_require_compensation':q['risk_appetite']==='conservative'},x=generateReminders(w),y=[];for(const B of x){if(B['action'])y['push'](B['action']);}m&&!y['some'](C=>C['includes']('arbitration'))&&y['push']('Require\x20the\x20merchant\x20to\x20configure\x20an\x20Arbitration\x20service\x20before\x20placing\x20the\x20order');n&&!y['some'](C=>C['includes']('compensation'))&&y['push']('Require\x20the\x20merchant\x20to\x20set\x20a\x20compensation_fund\x20to\x20guarantee\x20automatic\x20payout\x20when\x20the\x20order\x20fails');const z={'recommendations':y,'reminders':x['map'](C=>({'id':C['id'],'stage':C['stage'],'priority':C['priority'],'message':C['message'],'action':C['action']}))};if(o!==undefined)z['risk_score']=o;if(p!==undefined)z['risk_level']=p;return z;}function buildGuardAdvice(a,b,c){try{if(a==='guard')return buildGuardCreateAdvice(b);if(a==='gen_passport'){const e=c?.['error']?'fail':'pass';return{'current_round':'R8','test_result':{'status':e,'passport_id':e==='pass'?c?.['passport']:undefined,'failure_node':e==='fail'?typeof c?.['error']==='string'?c['error']['slice'](0x0,0x78):undefined:undefined}};}const d=typeof c?.['error']==='string'?c['error']:'';if(d['includes']('GUARD')||d['includes']('Guard')||d['includes']('guard'))return{'risk_warnings':['Guard\x20verification\x20failed:\x20'+d['slice'](0x0,0xc8),'Suggestion:\x20check\x20whether\x20the\x20submission\x20data\x20matches\x20the\x20Guard\x20table\x20declaration,\x20or\x20query\x20the\x20Guard\x20definition\x20to\x20learn\x20the\x20required\x20submission']};return undefined;}catch{return undefined;}}function buildGuardCreateAdvice(a){if(!a)return undefined;const b=convertCallDataToPuzzleInput(a),c=derivePuzzleFromCallData(b),d=getPuzzleStatusBooleans(c);let e,f,g;a['binding_hint']?.['action']&&(e=inferSceneFromAction(a['binding_hint']['action']),e&&(f=e['name'],g=e['special_constraints']));let h;const i=a['binding_hint']?.['rule_sentence']||a['binding_hint']?.['action']||'';if(i){const r=matchSemanticPattern(i);r['length']>0x0&&(h=r['map'](s=>s['id']+':\x20'+s['pattern_name']));}let j;try{const s=generateConfirmationText(c);!s['startsWith']('[Puzzle\x20incomplete]')&&(j=s);}catch{}let k;const l=getPendingQuestions(c);l['length']>0x0&&(k=l);let m;if(e){const t=mapSceneToObjectType(e);if(t){const u=GUARDQUERY['filter'](v=>v['objectType']===t)['slice'](0x0,0xa)['map'](v=>({'id':v['id'],'name':v['name'],'objectType':String(v['objectType']),'returnType':String(v['return']),'description':v['description']}));u['length']>0x0&&(m=u);}}const n=assessGuardRisksForOperation('guard',a);let o,p;if(n){const v=getRiskSummary(n);o={'overall_risk':v['risk_count']>0x0?n['overall_risk']:'info','risk_count':v['risk_count'],'critical_count':v['critical_count'],'high_count':v['high_count'],'needs_human_review':v['needs_human_review'],'top_risks':v['top_risks'],'stakeholder_advice':n['stakeholder_advice']};const w=n['risks']['map'](x=>'['+x['level']['toUpperCase']()+']\x20'+x['title']+':\x20'+x['description']);w['length']>0x0&&(p=w);}const q={'current_round':'R7','puzzle_status':d};if(e)q['matched_scene']=e['id'];if(f)q['scene_description']=f;if(g)q['scene_constraints']=g;if(h)q['suggested_patterns']=h;if(m)q['available_queries']=m;if(p)q['risk_warnings']=p;if(k)q['pending_questions']=k;if(j)q['confirmation_text']=j;if(o)q['risk_assessment']=o;return q;}function convertCallDataToPuzzleInput(a){const b={};Array['isArray'](a['table'])&&(b['table']=a['table']['map'](c=>({'identifier':c['identifier'],'b_submission':c['b_submission'],'value_type':typeof c['value_type']==='string'?c['value_type']:String(c['value_type']),'value':convertValueSnapshot(c['value']),'name':c['name']??'','object_type':c['object_type']})));if(a['root']&&typeof a['root']==='object'){const c=a['root'];if(c['type']!=='file'&&c['type']!=='node')b['root']=convertNodeToSnapshot(a['root']);else c['type']==='node'&&a['root']['node']&&(b['root']=convertNodeToSnapshot(a['root']['node']));}a['rely']&&Array['isArray'](a['rely']['guards'])&&(b['rely']={'guards':a['rely']['guards']['map'](d=>typeof d==='string'?d:String(d)),'logic_or':a['rely']['logic_or']});if(a['binding_hint']){const d=a['binding_hint'],e={'action':d['action'],'host_object':d['host_object'],'binding_field':d['binding_field']};if(d['rule_sentence']!==undefined)e['rule_sentence']=d['rule_sentence'];if(d['failure_conditions']!==undefined)e['failure_conditions']=d['failure_conditions'];if(d['circular_reference']!==undefined)e['circular_reference']=d['circular_reference'];b['binding_hint']=e;}return b;}function convertNodeToSnapshot(a){if(!a||typeof a!=='object')return{'type':'unknown'};const b={'type':String(a['type']??'unknown')};typeof a['identifier']==='number'&&(b['identifier']=a['identifier']);a['query']!==undefined&&(b['query']=typeof a['query']==='number'?a['query']:String(a['query']));if(a['object']&&typeof a['object']==='object'){const c={'identifier':Number(a['object']['identifier'])};typeof a['object']['convert_witness']==='number'&&(c['convert_witness']=a['object']['convert_witness']),b['object']=c;}Array['isArray'](a['parameters'])&&(b['parameters']=a['parameters']['map'](d=>convertNodeToSnapshot(d)));if(typeof a['context']==='string'){const d=a['context'];(d==='Clock'||d==='Guard'||d==='Signer')&&(b['context']=d);}return Array['isArray'](a['nodes'])&&(b['nodes']=a['nodes']['map'](e=>convertNodeToSnapshot(e))),a['node']&&(b['node']=convertNodeToSnapshot(a['node'])),a['nodeLeft']&&(b['nodeLeft']=convertNodeToSnapshot(a['nodeLeft'])),a['nodeRight']&&(b['nodeRight']=convertNodeToSnapshot(a['nodeRight'])),b;}function convertValueSnapshot(a){if(a===undefined||a===null)return undefined;if(typeof a==='string'||typeof a==='number'||typeof a==='boolean')return a;if(Array['isArray'](a)){const b=a['every'](e=>typeof e==='string');if(b)return a;const c=a['every'](e=>typeof e==='number');if(c)return a;const d=a['every'](e=>typeof e==='boolean');if(d)return a;return JSON['stringify'](a);}return JSON['stringify'](a);}function mapSceneToObjectType(a){const b=a['host_object'];if(b==='Standalone')return undefined;return b;}export function buildSemantic(a,b){if(!b)return undefined;const c=inferIntent(b['operation_type'],b['data']),d=inferStatus(a),e=a?.['objectChanges']||[],g=a?.['balanceChanges']||[],h=a?.['events']||[],i=tagObjectRoles(e['filter'](u=>u?.['type']==='created')),j=tagObjectRoles(e['filter'](u=>u?.['type']==='mutated'||u?.['type']==='published')),k=tagFundRoles(g,b['operation_type'],b['data'],h),l=annotateEvents(h),m=inferNextActions(b['operation_type'],b['data'],d),n=inferWarnings(b['operation_type'],b['data'],a);b['pre_warnings']&&b['pre_warnings']['length']>0x0&&n['push'](...b['pre_warnings']);if(b['operation_type']==='service'&&b['data']?.['publish']===!![]){const u=auditService(b['data']);for(const v of u){const w=v['severity']==='error'?'[AUDIT\x20ERROR]\x20':v['severity']==='warning'?'[AUDIT]\x20':'[INFO]\x20';n['push'](w+v['message']);}}let o;const p=a308a('experience_layer');if(p)try{const x=getExperienceFeedback(b['operation_type'],b['data'],c);x&&(o=x);const y=d==='success'?'success':d==='failed'?'failed':'partial',z=[...i,...j]['map'](B=>B['id'])['filter'](Boolean),A=inferErrorCodeForSignal(a);recordOperationOutcome(b['operation_type'],b['data'],c,y,A,z);}catch{}let q;if(a308a('industry_evolution'))try{const B=typeof b['data']?.['industry']==='string'&&b['data']['industry']['trim']()?b['data']['industry']['trim']():undefined;if(B&&!p){const C=d==='success'?{'success':!![]}:{'success':![],'error_code':inferErrorCodeForSignal(a)};recordIndustrySignal(B,{'type':b['operation_type'],'data':b['data']},C);}if(B){const D=injectEvolutionContext(undefined,B,deriveAdviceRole(b['operation_type'],b['data']));D&&(D['industry_signal']||D['evolution_advice']||D['confidence']>0x0)&&(q=D);}}catch{}let r;if(a308a('semantic_rich'))try{const E=listServices(),F=E['filter'](H=>H['enabled'])['map'](H=>H['name']),G=E['filter'](H=>!H['enabled'])['map'](H=>H['name']);r={'active':F,'inactive':G['length']?G:undefined};}catch{}let s;try{s=buildCustomerAdvice(b['operation_type'],b['data'],a);}catch{}let t;try{t=buildGuardAdvice(b['operation_type'],b['data'],a);}catch{}return{'intent':c,'status':d,'summary':composeSummary(c,d,i,j,k),'created':i['length']?i:undefined,'modified':j['length']?j:undefined,'released':k['length']?k:undefined,'events':l['length']?l:undefined,'next_actions':m['length']?m:undefined,'warnings':n['length']?n:undefined,'experience':o,'service_status':r,'customer_advice':s,'evolution_context':q,'guard_advice':t};}function inferErrorCodeForSignal(a){if(!a)return undefined;if(typeof a['error']==='string')return a['error']['slice'](0x0,0x40);return undefined;}export function buildDataSemantic(a,b,c,d){if(!b)return undefined;const e=inferIntent(b['operation_type'],b['data']),f=[];b['pre_warnings']&&b['pre_warnings']['length']>0x0&&f['push'](...b['pre_warnings']);let g;if(c)g='failed';else{g='success';if(Array['isArray'](a)&&a['length']===0x0)g='partial',f['push']('no\x20results\x20found');else{if(a===null||a===undefined)g='partial',f['push']('no\x20results\x20found');else{if(typeof a==='object'&&!Array['isArray'](a)){const n=Object['values'](a);n['length']>0x0&&n['every'](o=>Array['isArray'](o)?o['length']===0x0:o===null||o===undefined)&&(g='partial',f['push']('no\x20results\x20found'));}}}}const h=inferNextActions(b['operation_type'],b['data'],g);let i;if(!c&&b['operation_type']==='onchain_events'){const o=Array['isArray'](a)?a:a?.['data']&&Array['isArray'](a['data'])?a['data']:null;if(o){i=annotateEvents(o);if(i['length']===0x0)i=undefined;}}const j=e['replace'](/_/g,'\x20');let k;if(g==='failed')k=d?'Failed\x20to\x20'+j+':\x20'+d:'Failed\x20to\x20'+j;else g==='partial'?k=j+'\x20completed\x20with\x20no\x20results':k='Successfully\x20'+j;let l;if(a308a('semantic_rich'))try{const p=listServices(),q=p['filter'](t=>t['enabled'])['map'](t=>t['name']),r=p['filter'](t=>!t['enabled'])['map'](t=>t['name']);l={'active':q,'inactive':r['length']?r:undefined};}catch{}let m;if(!c)try{m=buildCustomerAdvice(b['operation_type'],b['data'],a);}catch{}return{'intent':e,'status':g,'summary':k,'events':i,'next_actions':h['length']?h:undefined,'warnings':f['length']?f:undefined,'service_status':l,'customer_advice':m};}
|
|
@@ -21,10 +21,10 @@ export declare const BuySchema: z.ZodObject<{
|
|
|
21
21
|
}, z.core.$strict>;
|
|
22
22
|
export declare const DiscountSchema: z.ZodObject<{
|
|
23
23
|
name: z.ZodString;
|
|
24
|
-
discount_type: z.ZodUnion<readonly [z.ZodEnum<{
|
|
24
|
+
discount_type: z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodEnum<{
|
|
25
25
|
FIXED: "FIXED";
|
|
26
26
|
RATES: "RATES";
|
|
27
|
-
}>, z.
|
|
27
|
+
}>, z.ZodTransform<0 | 1, "FIXED" | "RATES">>]>;
|
|
28
28
|
discount_value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
29
29
|
benchmark: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
30
30
|
time_ms_start: z.ZodOptional<z.ZodNumber>;
|
|
@@ -232,10 +232,10 @@ export declare const CallService_DataSchema: z.ZodObject<{
|
|
|
232
232
|
machine: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
233
233
|
discount: z.ZodOptional<z.ZodObject<{
|
|
234
234
|
name: z.ZodString;
|
|
235
|
-
discount_type: z.ZodUnion<readonly [z.ZodEnum<{
|
|
235
|
+
discount_type: z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodEnum<{
|
|
236
236
|
FIXED: "FIXED";
|
|
237
237
|
RATES: "RATES";
|
|
238
|
-
}>, z.
|
|
238
|
+
}>, z.ZodTransform<0 | 1, "FIXED" | "RATES">>]>;
|
|
239
239
|
discount_value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
240
240
|
benchmark: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
241
241
|
time_ms_start: z.ZodOptional<z.ZodNumber>;
|
|
@@ -453,10 +453,10 @@ export declare const CallService_InputSchema: z.ZodObject<{
|
|
|
453
453
|
machine: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
454
454
|
discount: z.ZodOptional<z.ZodObject<{
|
|
455
455
|
name: z.ZodString;
|
|
456
|
-
discount_type: z.ZodUnion<readonly [z.ZodEnum<{
|
|
456
|
+
discount_type: z.ZodUnion<readonly [z.ZodNumber, z.ZodPipe<z.ZodEnum<{
|
|
457
457
|
FIXED: "FIXED";
|
|
458
458
|
RATES: "RATES";
|
|
459
|
-
}>, z.
|
|
459
|
+
}>, z.ZodTransform<0 | 1, "FIXED" | "RATES">>]>;
|
|
460
460
|
discount_value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
461
461
|
benchmark: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
462
462
|
time_ms_start: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from'zod';import{TypedPermissionObjectSchema,CoinParamSchema,NamedObjectSchema,ObjectsSchema,CallEnvSchema,SubmissionCallSchema}from'./base.js';import{AllocatorsSchema,DiscountTypeSchema,ServiceSaleSchema,PaymentInfoSchema}from'../query/index.js';import{AccountOrMark_AddressSchema,DescriptionSchema,LongNameSchema,ManyAccountOrMark_AddressSchema,NameOrAddressSchema,NotEmptyNameSchema,ReceivedBalanceOrRecentlySchema,ReceivedObjectsOrRecentlySchema,RECEIVE_FORMAT_BLOCK_OBJECTS,RECEIVE_FORMAT_BLOCK_BALANCE}from'../common/index.js';import{BalanceTypeSchema}from'../common/index.js';export const ServiceBuyItemSchema=z['object']({'name':LongNameSchema['describe']('Name\x20of\x20the\x20product\x20or\x20service\x20to\x20purchase'),'stock':BalanceTypeSchema['describe']('Quantity\x20of\x20the\x20product\x20or\x20service\x20to\x20purchase'),'wip_hash':z['string']()['describe']('WIP\x20file\x20hash\x20of\x20the\x20item.\x20EMPTY\x20string\x20\x22\x22\x20means\x20only\x20verify\x20the\x20WIP\x20file\x20integrity\x20without\x20comparing\x20to\x20a\x20specific\x20hash\x20(the\x20hash\x20within\x20the\x20wip\x20file\x20will\x20be\x20used).\x20For\x20purchases,\x20it\x20is\x20STRONGLY\x20RECOMMENDED\x20to\x20fill\x20in\x20the\x20hash\x20you\x20saw\x20when\x20viewing\x20the\x20product\x20info\x20(from\x20the\x20Service\x20sale\x27s\x20wip_hash\x20field)\x20to\x20prevent\x20the\x20merchant\x20from\x20replacing\x20the\x20WIP\x20file\x20before\x20your\x20order\x20is\x20placed\x20(a\x20legitimate\x20update\x20operation),\x20which\x20would\x20cause\x20inconsistency\x20between\x20what\x20you\x20saw\x20and\x20what\x20you\x20received.')})['strict']();export const BuySchema=z['object']({'items':z['array'](ServiceBuyItemSchema)['describe']('List\x20of\x20products\x20or\x20services\x20to\x20purchase'),'total_pay':CoinParamSchema['describe']('Actual\x20payment\x20amount.\x20FORMAT:\x20{balance:\x20<amount_in_smallest_unit>}\x20or\x20{coin:\x20<coin_object_id>}.\x20'+'The\x20token\x20type\x20and\x20precision\x20are\x20determined\x20by\x20the\x20Service\x20object\x27s\x20type_parameter\x20(the\x20generic\x20type\x20set\x20when\x20the\x20Service\x20was\x20created).\x20'+'For\x20WOW\x20(9\x20decimals):\x20{balance:\x201000000000}\x20=\x201\x20WOW.\x20'),'discount':z['string']()['optional']()['describe']('Discount\x20object\x20ID\x20or\x20name'),'payment_remark':z['string']()['optional']()['describe']('Payment\x20remark'),'payment_index':z['number']()['optional']()['describe']('Payment\x20index')})['strict']();export const DiscountSchema=z['object']({'name':z['string']()['describe']('Discount\x20name'),'discount_type':DiscountTypeSchema['describe']('Discount\x20type'),'discount_value':BalanceTypeSchema['describe']('Discount\x20value'),'benchmark':z['union']([z['number'](),z['string']()])['optional']()['describe']('Discount\x20benchmark\x20value.\x20Discount\x20is\x20only\x20applied\x20if\x20the\x20amount\x20exceeds\x20this\x20value'),'time_ms_start':z['number']()['optional']()['describe']('Discount\x20start\x20time\x20(milliseconds)'),'time_ms_end':z['number']()['describe']('Discount\x20end\x20time\x20(milliseconds)'),'count':z['number']()['describe']('Discount\x20usage\x20count'),'recipient':ManyAccountOrMark_AddressSchema['describe']('Discount\x20recipient'),'transferable':z['boolean']()['describe']('Whether\x20the\x20discount\x20object\x20recipient\x20can\x20transfer\x20the\x20discount\x20object')})['strict']();export const OrderNewSchema=z['object']({'buy':BuySchema,'agents':ManyAccountOrMark_AddressSchema['optional']()['describe']('Order\x20agents.\x20Agents\x20can\x20operate\x20the\x20order,\x20such\x20as\x20canceling\x20the\x20order,\x20modifying\x20the\x20order\x20status,\x20etc.;\x20but\x20cannot\x20receive\x20the\x20funds\x20received\x20by\x20the\x20order.'),'order_required_info':z['string']()['optional']()['describe']('Contact\x20object\x20ID\x20or\x20WTS\x20Proof\x20object,\x20recorded\x20on\x20the\x20Order\x20as\x20proof\x20that\x20the\x20order\x20holder\x20'+'delivered\x20the\x20required\x20private\x20information\x20(service.customer_required)\x20to\x20the\x20merchant.\x20'+'FLOW:\x20when\x20a\x20Service\x20declares\x20customer_required\x20(e.g.\x20phone/email/shipping_address),\x20the\x20order\x20holder\x20'+'MUST\x20send\x20that\x20private\x20information\x20to\x20the\x20Service\x27s\x20Contact\x20(um)\x20via\x20end-to-end\x20encrypted\x20Messenger,\x20'+'then\x20pass\x20the\x20Contact\x20object\x20ID\x20or\x20the\x20generated\x20WTS\x20Proof\x20here\x20so\x20the\x20delivery\x20is\x20verifiable\x20on-chain.'),'transfer':AccountOrMark_AddressSchema['optional']()['describe']('Set\x20the\x20new\x20owner\x20of\x20the\x20order.\x20Requires\x20order\x20owner\x20permission\x20to\x20set.'),'namedNewOrder':NamedObjectSchema['optional']()['describe']('RECOMMENDED:\x20Set\x20a\x20local\x20name\x20for\x20the\x20newly\x20created\x20Order\x20object.\x20'+'Without\x20this,\x20the\x20Order\x20is\x20only\x20referenceable\x20by\x20its\x20on-chain\x20address.\x20'+'Example:\x20{name:\x20\x27my_order_v1\x27}\x20allows\x20subsequent\x20operations\x20to\x20use\x20\x27my_order_v1\x27\x20instead\x20of\x20the\x20address.'),'namedNewAllocation':NamedObjectSchema['optional']()['describe']('RECOMMENDED:\x20Set\x20a\x20local\x20name\x20for\x20the\x20order\x27s\x20Allocation\x20object.\x20'+'Without\x20this,\x20the\x20Allocation\x20is\x20only\x20referenceable\x20by\x20its\x20address.\x20'+'Example:\x20{name:\x20\x27my_allocation_v1\x27}\x20allows\x20alloc_by_guard\x20to\x20reference\x20\x27my_allocation_v1\x27.'),'namedNewProgress':NamedObjectSchema['optional']()['describe']('RECOMMENDED:\x20Set\x20a\x20local\x20name\x20for\x20the\x20order\x27s\x20Progress\x20object.\x20'+'Without\x20this,\x20the\x20Progress\x20is\x20only\x20referenceable\x20by\x20its\x20address.\x20'+'Example:\x20{name:\x20\x27my_progress_v1\x27}\x20allows\x20progress\x20operations\x20to\x20use\x20\x27my_progress_v1\x27.')})['strict']();export const SalesSchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('add'),'sales':z['array'](ServiceSaleSchema)})['strict']()['describe']('Add\x20new\x20sales\x20products\x20or\x20services.'),z['object']({'op':z['literal']('set'),'sales':z['array'](ServiceSaleSchema)})['strict']()['describe']('Set\x20sales\x20products\x20or\x20services.'),z['object']({'op':z['literal']('remove'),'sales_name':z['array'](LongNameSchema['describe']('Sales\x20name'))})['strict']()['describe']('Remove\x20existing\x20sales\x20products\x20or\x20services.'),z['object']({'op':z['literal']('clear')})['strict']()['describe']('Clear\x20all\x20sales\x20products\x20or\x20services.')]);export const CallService_DataSchema=z['object']({'object':TypedPermissionObjectSchema,'order_new':OrderNewSchema['optional']()['describe']('Create\x20new\x20order.'),'description':DescriptionSchema['optional'](),'location':LongNameSchema['optional']()['describe']('The\x20service\x20area\x20and\x20scope\x20as\x20stated\x20by\x20the\x20merchant.\x20'+'IMPORTANT:\x20If\x20the\x20service\x20has\x20a\x20geographic\x20scope,\x20ALWAYS\x20specify\x20this\x20field.\x20'+'Use\x20a\x20complete\x20hierarchical\x20address\x20'+'(e.g.\x20\x27US\x20→\x20California\x20→\x20Los\x20Angeles\x20→\x20Koreatown\x27).\x20'+'If\x20only\x20a\x20partial\x20location\x20is\x20known,\x20EXPAND\x20it\x20to\x20the\x20full\x20standardized\x20form\x20'+'(country\x20→\x20province/state\x20→\x20city\x20→\x20district,\x20worldwide)\x20—\x20when\x20ambiguous,\x20offer\x202-4\x20candidate\x20completions\x20and\x20let\x20the\x20user\x20pick.'),'sales':SalesSchema['optional']()['describe']('Service\x20sales\x20products\x20or\x20services\x20list.\x20'+'⚠️\x20WIP\x20NETWORK-DEPLOYMENT\x20RULE:\x20a\x20non-empty\x20sale.wip\x20MUST\x20be\x20a\x20publicly\x20reachable\x20URL\x20'+'(GitHub\x20Pages\x20/\x20IPFS\x20/\x20your\x20own\x20website).\x20The\x20URL\x20is\x20stored\x20ON-CHAIN\x20and\x20every\x20customer\x20'+'fetches\x20it\x20at\x20order\x20time\x20—\x20a\x20local\x20file\x20path,\x20localhost/loopback\x20URL,\x20or\x20LAN\x20private-IP\x20URL\x20'+'is\x20unreachable\x20by\x20customers\x20on\x20other\x20machines\x20and\x20aborts\x20order_new\x20100%.\x20Local-network\x20URLs\x20'+'are\x20INTERNAL\x20TEST\x20USE\x20ONLY\x20(env.network\x20=\x20localnet).\x20Leave\x20sale.wip\x20empty\x20(\x22\x22)\x20to\x20skip\x20'+'WIP\x20verification\x20(TESTING\x20ONLY).'),'repositories':ObjectsSchema['optional']()['describe']('Service\x20Repository\x20object\x20list.'),'rewards':ObjectsSchema['optional']()['describe']('Service\x20Reward\x20object\x20list.\x20'+'May\x20share\x20the\x20Service\x27s\x20Permission\x20(no\x20conflict\x20check\x20—\x20intentional:\x20rewards\x20are\x20the\x20provider\x27s\x20own\x20'+'incentive\x20tool;\x20only\x20Arbitration\x20requires\x20a\x20different\x20Permission\x20for\x20neutrality).'),'arbitrations':ObjectsSchema['optional']()['describe']('Service\x20Arbitration\x20object\x20list.\x20'+'FORMAT:\x20same\x20as\x20repositories\x20—\x20use\x20the\x20`objects`\x20field\x20name\x20inside\x20the\x20operation\x20data.\x20'+'Example:\x20{arbitrations:\x20[{name:\x20\x27my_arb_1\x27},\x20{name:\x20\x27my_arb_2\x27}]}.\x20'+'Each\x20item\x20is\x20a\x20NameOrAddress\x20(object\x20ID\x20or\x20local\x20mark\x20name).\x20'+'⚠️\x20PERMISSION\x20RULE\x20(contract-enforced,\x20service.move\x20arbitration_add_imp):\x20every\x20Arbitration\x20bound\x20here\x20'+'MUST\x20use\x20a\x20Permission\x20object\x20DIFFERENT\x20from\x20THIS\x20Service\x27s\x20permission\x20—\x20binding\x20an\x20Arbitration\x20that\x20shares\x20'+'the\x20Service\x27s\x20Permission\x20aborts\x20with\x20E_ARBITRATION_PERMISSION_CONFLICT\x20(error\x2033).\x20'+'Create\x20a\x20dedicated\x20Permission\x20for\x20each\x20Arbitration\x20BEFORE\x20binding.\x20'+'DESIGN\x20RATIONALE\x20(confirmed\x20intentional):\x20dispute\x20resolution\x20requires\x20NEUTRALITY\x20—\x20an\x20Arbitration\x20controlled\x20'+'by\x20the\x20same\x20Permission\x20admins\x20as\x20the\x20Service\x20it\x20judges\x20would\x20be\x20a\x20conflict\x20of\x20interest.\x20ONLY\x20Arbitration\x20has\x20'+'this\x20check:\x20Reward\x20and\x20Treasury\x20objects\x20MAY\x20share\x20the\x20Service\x27s\x20Permission\x20(they\x20are\x20the\x20provider\x27s\x20own\x20tools).'),'machine':z['union']([NameOrAddressSchema,z['null']()])['optional']()['describe']('Service\x20Machine\x20object\x20ID\x20or\x20name.\x20The\x20Machine\x20object\x20must\x20be\x20in\x20published\x20state.'),'discount':DiscountSchema['optional']()['describe']('Issue\x20discount.'),'discount_destroy':z['array'](NameOrAddressSchema)['optional']()['describe']('Destroy\x20existing\x20discount\x20object\x20ID\x20list.'),'customer_required':z['array'](NotEmptyNameSchema)['optional']()['describe']('Customer\x20required\x20information\x20labels.\x20Such\x20as\x20phone,\x20email,\x20shipping_address,\x20etc.\x20'+'⚠️\x20HARD\x20LINKAGE\x20(SDK-enforced):\x20if\x20customer_required\x20is\x20set\x20(non-empty),\x20the\x20Service\x20MUST\x20also\x20bind\x20a\x20'+'Contact\x20via\x20`um`\x20—\x20otherwise\x20the\x20customer\x27s\x20private\x20information\x20cannot\x20be\x20delivered\x20through\x20end-to-end\x20'+'encrypted\x20Messenger\x20(which\x20routes\x20to\x20the\x20Contact\x20bound\x20as\x20um).\x20Set\x20`um`\x20together\x20with\x20customer_required.'),'order_allocators':z['union']([AllocatorsSchema,z['null']()])['optional']()['describe']('Order\x20fund\x20allocator.\x20Max\x20100\x20allocators\x20(MAX_ALLOCATOR_COUNT).\x20'+'Each\x20allocator\x20has\x20a\x20guard\x20(first\x20matching\x20guard\x20wins)\x20and\x20a\x20sharing\x20list.\x20'+'Set\x20to\x20null\x20to\x20clear.\x20'+'⚠️\x20PERMANENTLY\x20IMMUTABLE\x20after\x20publish:\x20order_allocators\x20can\x20ONLY\x20be\x20set\x20BEFORE\x20publish=true\x20'+'(Move\x20service.move:503:\x20assert!(!self.bPublished,\x20E_ALREADY_PUBLISHED)).\x20'+'After\x20publish,\x20the\x20ONLY\x20way\x20to\x20change\x20allocation\x20rules\x20is\x20to\x20create\x20a\x20NEW\x20Service\x20object.\x20'+'There\x20is\x20NO\x20pause+lock\x20exception\x20for\x20order_allocators\x20(unlike\x20arbitrations/rewards\x20which\x20have\x20time-lock\x20removal).\x20'+'PRE-PUBLISH\x20CHECKLIST:\x20verify\x20all\x20guard\x20names\x20resolve,\x20all\x20sharing\x20amounts\x20are\x20correct,\x20'+'threshold\x20is\x20set,\x20and\x20recipient\x20types\x20(Entity/Signer/GuardIdentifier)\x20are\x20intended\x20before\x20calling\x20publish=true.\x20'+'GuardIdentifier\x20sharing\x20mode:\x20{who:\x20{GuardIdentifier:\x20<u8>},\x20sharing:\x20<rate>,\x20mode:\x20\x27Rate\x27}\x20—\x20'+'resolves\x20recipient\x20from\x20Guard\x20table\x20submission\x20at\x20allocation\x20time\x20(e.g.,\x20refund\x20to\x20customer).\x20'+'MULTI-CALL\x20ALLOCATION:\x20Allocation.alloc()\x20can\x20be\x20called\x20MULTIPLE\x20times\x20(no\x20consumed\x20flag\x20in\x20contract).\x20'+'Use\x20Amount\x20mode\x20(not\x20Surplus)\x20for\x20recurring\x20allocations\x20—\x20Surplus\x20calls\x20balance::withdraw_all\x20which\x20drains\x20the\x20balance.\x20'+'For\x20monthly\x20payment\x20scenarios,\x20create\x20multiple\x20Allocators\x20with\x20time-based\x20Guards\x20+\x20Amount\x20mode\x20sharing\x20items.'),'buy_guard':z['union']([NameOrAddressSchema,z['null']()])['optional']()['describe']('Buy\x20guard\x20object\x20ID\x20or\x20name.'),'compensation_fund_add':CoinParamSchema['optional']()['describe']('Deposit\x20funds\x20into\x20the\x20Service\x20compensation_fund.\x20Used\x20to\x20pay\x20indemnity\x20when\x20arbitration\x20resolves\x20in\x20customer\x27s\x20favor.\x20'+'FORMAT:\x20{balance:\x20<amount_in_smallest_unit>}\x20—\x20the\x20field\x20name\x20is\x20\x27balance\x27\x20(NOT\x20\x27amount\x27).\x20'+'The\x20token\x20type\x20and\x20precision\x20are\x20determined\x20by\x20the\x20Service\x20object\x27s\x20type_parameter\x20(the\x20generic\x20type\x20set\x20when\x20the\x20Service\x20was\x20created).\x20'+'For\x20WOW\x20(9\x20decimals):\x20{balance:\x201000000000}\x20=\x201\x20WOW.\x20'+'For\x20tokens\x20with\x20different\x20decimals,\x20adjust\x20accordingly\x20(e.g.\x20USDC\x20has\x206\x20decimals,\x20so\x20{balance:\x201000000}\x20=\x201\x20USDC).\x20'+'REQUIRES:\x20Permission\x20index\x20315\x20(SERVICE_COMPENSATION_FUND_DEPOSIT)\x20must\x20be\x20granted\x20to\x20the\x20calling\x20account\x20first.\x20'+'COMMON\x20MISTAKE:\x20using\x20{amount:\x20...}\x20or\x20{amount:\x20...,\x20type:\x20\x27WOW\x27}\x20—\x20these\x20will\x20fail.\x20The\x20correct\x20field\x20is\x20\x27balance\x27.'),'compensation_fund_withdraw':z['object']({'receipt':AccountOrMark_AddressSchema['describe']('Receipt\x20address\x20that\x20will\x20receive\x20the\x20withdrawn\x20funds\x20(as\x20a\x20new\x20Payment\x20object)'),'payment_info':PaymentInfoSchema['describe']('Payment\x20info\x20for\x20the\x20new\x20Payment\x20object\x20created\x20to\x20hold\x20the\x20withdrawn\x20funds')})['strict']()['optional']()['describe']('Withdraw\x20ALL\x20funds\x20from\x20the\x20compensation_fund\x20to\x20a\x20new\x20Payment\x20object\x20owned\x20by\x20`receipt`.\x20'+'Move\x20layer:\x20service::compensation_fund_withdraw\x20(service.move\x20L383-390).\x20'+'REQUIRES:\x20Service\x20must\x20be\x20paused\x20AND\x20setting_lock_duration\x20must\x20have\x20elapsed\x20since\x20pause\x20(assert_not_published\x20at\x20L384-385).\x20'+'Withdraws\x20the\x20ENTIRE\x20compensation_fund\x20balance\x20via\x20balance::withdraw_all.\x20'+'DIFFERENT\x20from\x20compensation_claim\x20(order-side,\x20for\x20arbitration-winning\x20users,\x20no\x20pause+lock\x20required).'),'setting_lock_duration_add':z['number']()['optional']()['describe']('Additional\x20lock\x20duration\x20to\x20ADD\x20to\x20\x27setting_lock_duration\x27\x20(Move\x20field\x20name).\x20'+'UNIT:\x20milliseconds\x20(ms).\x20Example:\x202592000000\x20=\x2030\x20days,\x207776000000\x20=\x2090\x20days,\x2086400000\x20=\x201\x20day.\x20'+'DEFAULT:\x202592000000\x20(30\x20days,\x20DEFAULT_LOCK_DURATION).\x20This\x20is\x20the\x20initial\x20value\x20when\x20a\x20Service\x20is\x20created.\x20'+'Behavior:\x20additive\x20(safe_add)\x20—\x20only\x20increases,\x20never\x20decreases.\x20'+'Move\x20entry:\x20service::setting_lock_duration_add\x20/\x20setting_lock_duration_add_with_passport.\x20'+'Can\x20be\x20called\x20BEFORE\x20or\x20AFTER\x20publish\x20(no\x20publish\x20check).\x20'+'Affects\x20the\x20waiting\x20time\x20required\x20by:\x20compensation_fund_withdraw,\x20arbitrations\x20remove/clear,\x20rewards\x20remove/clear\x20'+'(all\x20require\x20pause\x20+\x20setting_lock_duration\x20elapsed\x20since\x20pause).'),'compensation_fund_receive':ReceivedBalanceOrRecentlySchema['optional']()['describe']('Receive\x20order\x20compensation\x20funds\x20from\x20this\x20Service\x20object.'+RECEIVE_FORMAT_BLOCK_BALANCE),'owner_receive':ReceivedObjectsOrRecentlySchema['optional']()['describe']('Unwrap\x20CoinWrapper\x20objects\x20and\x20other\x20objects\x20received\x20by\x20this\x20Service\x20object\x20and\x20send\x20them\x20to\x20the\x20owner\x20of\x20its\x20Permission\x20object.'+RECEIVE_FORMAT_BLOCK_OBJECTS),'um':z['union']([NameOrAddressSchema,z['null']()])['optional']()['describe']('Contact\x20object\x20ID\x20or\x20name\x20—\x20the\x20Service\x27s\x20customer-service\x20channel.\x20'+'This\x20is\x20the\x20object\x20that\x20Messenger\x20routes\x20encrypted\x20messages\x20to\x20for\x20pre-order\x20negotiation,\x20'+'private-info\x20delivery\x20(see\x20customer_required),\x20and\x20post-sale\x20support.\x20'+'⚠️\x20REQUIRED\x20whenever\x20customer_required\x20is\x20set:\x20without\x20um,\x20the\x20customer\x27s\x20private\x20information\x20'+'has\x20no\x20channel\x20to\x20reach\x20the\x20merchant.'),'pause':z['boolean']()['optional']()['describe']('Whether\x20to\x20pause\x20accepting\x20new\x20orders.'),'publish':z['boolean']()['optional']()['describe']('Whether\x20to\x20publish\x20the\x20Service.\x20After\x20publishing,\x20customers\x20can\x20place\x20orders.\x20'+'VERIFIED\x20against\x20Move\x20source\x20service.move\x20+\x20SDK\x20service.ts\x20(4-level\x20immutability\x20matrix):\x0a'+'\x20\x20L1\x20—\x20PERMANENTLY\x20LOCKED\x20after\x20publish\x20(assert!(!bPublished),\x20no\x20pause+lock\x20exception):\x0a'+'\x20\x20\x20\x20•\x20machine\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(service.move\x20L633/L653\x20—\x20workflow\x20template)\x0a'+'\x20\x20\x20\x20•\x20order_allocators\x20(service.move\x20L503\x20—\x20fund\x20distribution\x20rules)\x0a'+'\x20\x20L2\x20—\x20TIME-LOCKED\x20after\x20publish\x20(assert_not_published\x20—\x20requires\x20pause\x20+\x20setting_lock_duration\x20elapsed):\x0a'+'\x20\x20\x20\x20•\x20arbitrations\x20remove/clear\x20(service.move\x20L433/L445\x20—\x20dispute\x20resolution\x20objects)\x0a'+'\x20\x20\x20\x20•\x20rewards\x20remove/clear\x20\x20\x20\x20\x20\x20\x20(service.move\x20L402/L414\x20—\x20reward\x20objects)\x0a'+'\x20\x20\x20\x20•\x20compensation_fund_withdraw\x20(service.move\x20L384-385\x20—\x20withdraw\x20ALL\x20funds)\x0a'+'\x20\x20L3\x20—\x20REMAIN\x20MUTABLE\x20after\x20publish\x20(no\x20SDK\x20check,\x20no\x20Move\x20check):\x0a'+'\x20\x20\x20\x20•\x20arbitrations\x20add,\x20rewards\x20add\x20(no\x20assert\x20—\x20can\x20add\x20after\x20publish)\x0a'+'\x20\x20\x20\x20•\x20buy_guard,\x20sales,\x20discount,\x20description,\x20location,\x20pause,\x20repositories,\x0a'+'\x20\x20\x20\x20•\x20compensation_fund_add,\x20setting_lock_duration_add,\x20customer_required,\x20um\x20(Contact)\x0a'+'These\x202\x20L1-LOCKED\x20fields\x20(machine/order_allocators)\x20MUST\x20be\x20set\x20BEFORE\x20publish=true.\x0a'+'arbitrations/rewards\x20can\x20be\x20ADDED\x20after\x20publish\x20but\x20remove/clear\x20requires\x20pause+lock.\x0a'+'\x0a'+'⚠️\x20COMPENSATION_FUND\x20+\x20ARBITRATION\x20LINKAGE\x20(service.move:494-499):\x0a'+'\x20\x20At\x20publish\x20time,\x20if\x20compensation_fund\x20>\x200,\x20Arbitration\x20MUST\x20be\x20bound:\x0a'+'\x20\x20\x20\x20if\x20(balance::value(&self.compensation_fund)\x20>\x200)\x20{\x0a'+'\x20\x20\x20\x20\x20\x20\x20\x20assert!(arbitration_count\x20>\x200,\x20E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND);\x0a'+'\x20\x20\x20\x20}\x0a'+'\x20\x20The\x20MCP\x20handler\x20enforces\x20this\x20as\x20a\x20HARD\x20PRE-CHECK:\x20if\x20publish=true\x20AND\x20compensation_fund_add\x20'+'\x20\x20is\x20set\x20in\x20the\x20same\x20call\x20AND\x20arbitrations\x20is\x20empty,\x20the\x20call\x20is\x20REJECTED\x20before\x20submission.\x20'+'\x20\x20If\x20compensation_fund\x20was\x20deposited\x20in\x20a\x20prior\x20call,\x20a\x20SOFT\x20WARNING\x20is\x20issued.\x0a'+'\x0a'+'SCHEMA-03\x20/\x20P0-01\x20fix\x20—\x20DEPLOYMENT\x20WORKFLOW\x20(two-phase,\x20avoids\x20circular\x20dependency):\x0a'+'\x20\x20Phase\x201\x20—\x20CREATE\x20(no\x20publish):\x20object={name:\x27my-service\x27,\x20type_parameter,\x20permission}\x20+\x20machine\x20+\x20order_allocators\x20+\x20arbitrations.\x0a'+'\x20\x20\x20\x20NOTE:\x20buy_guard\x20can\x20use\x20a\x20LocalMark\x20NAME\x20(not\x20address)\x20to\x20break\x20the\x20Guard→Service\x20circular\x20dependency.\x0a'+'\x20\x20\x20\x20The\x20name\x20is\x20resolved\x20to\x20an\x20address\x20at\x20transaction\x20build\x20time.\x0a'+'\x20\x20Phase\x202\x20—\x20PUBLISH:\x20object=\x27my-service\x27\x20(string\x20ref)\x20+\x20publish=true.\x0a'+'\x20\x20\x20\x20All\x20L1-LOCKED\x20fields\x20must\x20be\x20set\x20in\x20Phase\x201;\x20Phase\x202\x20only\x20flips\x20the\x20publish\x20flag.\x0a'+'\x20\x20Post-publish\x20updates:\x20buy_guard,\x20sales,\x20description,\x20repositories\x20(add),\x20rewards\x20(add),\x20arbitrations\x20(add),\x20etc.')})['strict']()['describe']('On-chain\x20Service\x20operations.\x20USAGE:\x20(1)\x20CREATE\x20NEW:\x20Set\x20\x27object\x27\x20field\x20with\x20OBJECT\x20format\x20{name,\x20type_parameter,\x20permission,\x20...}\x20to\x20create\x20a\x20Service.\x20NOTE:\x20\x27name\x27\x20goes\x20INSIDE\x20\x27object\x27,\x20NOT\x20at\x20the\x20data\x20root\x20level.\x20\x27permission\x27\x20can\x20be\x20a\x20new\x20Permission\x20object\x20or\x20reference\x20an\x20existing\x20one\x20-\x20check\x20\x27object\x27\x20field\x20description\x20for\x20details.\x20(2)\x20OPERATE\x20EXISTING:\x20Set\x20\x27object\x27\x20field\x20with\x20STRING\x20format\x20(object\x20ID\x20or\x20name).\x20The\x20\x27object\x27\x20field\x20is\x20CRITICAL\x20and\x20REQUIRED\x20in\x20both\x20cases.\x20STRING\x20for\x20existing,\x20OBJECT\x20for\x20new\x20creation.');export const CallService_InputSchema=z['object']({'data':CallService_DataSchema,'env':CallEnvSchema['optional'](),'submission':SubmissionCallSchema['optional']()})['strict']();
|
|
1
|
+
import{z}from'zod';import{TypedPermissionObjectSchema,CoinParamSchema,NamedObjectSchema,ObjectsSchema,CallEnvSchema,SubmissionCallSchema}from'./base.js';import{AllocatorsSchema,DiscountTypeSchema,ServiceSaleSchema,PaymentInfoSchema}from'../query/index.js';import{AccountOrMark_AddressSchema,DescriptionSchema,LongNameSchema,ManyAccountOrMark_AddressSchema,NameOrAddressSchema,NotEmptyNameSchema,ReceivedBalanceOrRecentlySchema,ReceivedObjectsOrRecentlySchema,RECEIVE_FORMAT_BLOCK_OBJECTS,RECEIVE_FORMAT_BLOCK_BALANCE}from'../common/index.js';import{BalanceTypeSchema}from'../common/index.js';export const ServiceBuyItemSchema=z['object']({'name':LongNameSchema['describe']('Name\x20of\x20the\x20product\x20or\x20service\x20to\x20purchase'),'stock':BalanceTypeSchema['describe']('Quantity\x20of\x20the\x20product\x20or\x20service\x20to\x20purchase'),'wip_hash':z['string']()['describe']('WIP\x20file\x20hash\x20of\x20the\x20item.\x20EMPTY\x20string\x20\x22\x22\x20means\x20only\x20verify\x20the\x20WIP\x20file\x20integrity\x20without\x20comparing\x20to\x20a\x20specific\x20hash\x20(the\x20hash\x20within\x20the\x20wip\x20file\x20will\x20be\x20used).\x20For\x20purchases,\x20it\x20is\x20STRONGLY\x20RECOMMENDED\x20to\x20fill\x20in\x20the\x20hash\x20you\x20saw\x20when\x20viewing\x20the\x20product\x20info\x20(from\x20the\x20Service\x20sale\x27s\x20wip_hash\x20field)\x20to\x20prevent\x20the\x20merchant\x20from\x20replacing\x20the\x20WIP\x20file\x20before\x20your\x20order\x20is\x20placed\x20(a\x20legitimate\x20update\x20operation),\x20which\x20would\x20cause\x20inconsistency\x20between\x20what\x20you\x20saw\x20and\x20what\x20you\x20received.')})['strict']();export const BuySchema=z['object']({'items':z['array'](ServiceBuyItemSchema)['describe']('List\x20of\x20products\x20or\x20services\x20to\x20purchase'),'total_pay':CoinParamSchema['describe']('Actual\x20payment\x20amount.\x20FORMAT:\x20{balance:\x20<amount_in_smallest_unit>}\x20or\x20{coin:\x20<coin_object_id>}.\x20'+'The\x20token\x20type\x20and\x20precision\x20are\x20determined\x20by\x20the\x20Service\x20object\x27s\x20type_parameter\x20(the\x20generic\x20type\x20set\x20when\x20the\x20Service\x20was\x20created).\x20'+'For\x20WOW\x20(9\x20decimals):\x20{balance:\x201000000000}\x20=\x201\x20WOW.\x20'),'discount':z['string']()['optional']()['describe']('Discount\x20object\x20ID\x20or\x20name'),'payment_remark':z['string']()['optional']()['describe']('Payment\x20remark'),'payment_index':z['number']()['optional']()['describe']('Payment\x20index')})['strict']();export const DiscountSchema=z['object']({'name':z['string']()['describe']('Discount\x20name'),'discount_type':DiscountTypeSchema['describe']('Discount\x20type'),'discount_value':BalanceTypeSchema['describe']('Discount\x20value'),'benchmark':z['union']([z['number'](),z['string']()])['optional']()['describe']('Discount\x20benchmark\x20value.\x20Discount\x20is\x20only\x20applied\x20if\x20the\x20amount\x20exceeds\x20this\x20value'),'time_ms_start':z['number']()['optional']()['describe']('Discount\x20start\x20time\x20(milliseconds)'),'time_ms_end':z['number']()['describe']('Discount\x20end\x20time\x20(milliseconds)'),'count':z['number']()['describe']('Discount\x20usage\x20count'),'recipient':ManyAccountOrMark_AddressSchema['describe']('Discount\x20recipient'),'transferable':z['boolean']()['describe']('Whether\x20the\x20discount\x20object\x20recipient\x20can\x20transfer\x20the\x20discount\x20object')})['strict']();export const OrderNewSchema=z['object']({'buy':BuySchema,'agents':ManyAccountOrMark_AddressSchema['optional']()['describe']('Order\x20agents.\x20Agents\x20can\x20operate\x20the\x20order,\x20such\x20as\x20canceling\x20the\x20order,\x20modifying\x20the\x20order\x20status,\x20etc.;\x20but\x20cannot\x20receive\x20the\x20funds\x20received\x20by\x20the\x20order.'),'order_required_info':z['string']()['optional']()['describe']('Contact\x20object\x20ID\x20or\x20WTS\x20Proof\x20object,\x20recorded\x20on\x20the\x20Order\x20as\x20proof\x20that\x20the\x20order\x20holder\x20'+'delivered\x20the\x20required\x20private\x20information\x20(service.customer_required)\x20to\x20the\x20merchant.\x20'+'FLOW:\x20when\x20a\x20Service\x20declares\x20customer_required\x20(e.g.\x20phone/email/shipping_address),\x20the\x20order\x20holder\x20'+'MUST\x20send\x20that\x20private\x20information\x20to\x20the\x20Service\x27s\x20Contact\x20(um)\x20via\x20end-to-end\x20encrypted\x20Messenger,\x20'+'then\x20pass\x20the\x20Contact\x20object\x20ID\x20or\x20the\x20generated\x20WTS\x20Proof\x20here\x20so\x20the\x20delivery\x20is\x20verifiable\x20on-chain.'),'transfer':AccountOrMark_AddressSchema['optional']()['describe']('Set\x20the\x20new\x20owner\x20of\x20the\x20order.\x20Requires\x20order\x20owner\x20permission\x20to\x20set.'),'namedNewOrder':NamedObjectSchema['optional']()['describe']('RECOMMENDED:\x20Set\x20a\x20local\x20name\x20for\x20the\x20newly\x20created\x20Order\x20object.\x20'+'Without\x20this,\x20the\x20Order\x20is\x20only\x20referenceable\x20by\x20its\x20on-chain\x20address.\x20'+'Example:\x20{name:\x20\x27my_order_v1\x27}\x20allows\x20subsequent\x20operations\x20to\x20use\x20\x27my_order_v1\x27\x20instead\x20of\x20the\x20address.'),'namedNewAllocation':NamedObjectSchema['optional']()['describe']('RECOMMENDED:\x20Set\x20a\x20local\x20name\x20for\x20the\x20order\x27s\x20Allocation\x20object.\x20'+'Without\x20this,\x20the\x20Allocation\x20is\x20only\x20referenceable\x20by\x20its\x20address.\x20'+'Example:\x20{name:\x20\x27my_allocation_v1\x27}\x20allows\x20alloc_by_guard\x20to\x20reference\x20\x27my_allocation_v1\x27.'),'namedNewProgress':NamedObjectSchema['optional']()['describe']('RECOMMENDED:\x20Set\x20a\x20local\x20name\x20for\x20the\x20order\x27s\x20Progress\x20object.\x20'+'Without\x20this,\x20the\x20Progress\x20is\x20only\x20referenceable\x20by\x20its\x20address.\x20'+'Example:\x20{name:\x20\x27my_progress_v1\x27}\x20allows\x20progress\x20operations\x20to\x20use\x20\x27my_progress_v1\x27.')})['strict']();export const SalesSchema=z['discriminatedUnion']('op',[z['object']({'op':z['literal']('add'),'sales':z['array'](ServiceSaleSchema)})['strict']()['describe']('Add\x20new\x20sales\x20products\x20or\x20services.'),z['object']({'op':z['literal']('set'),'sales':z['array'](ServiceSaleSchema)})['strict']()['describe']('Set\x20sales\x20products\x20or\x20services.'),z['object']({'op':z['literal']('remove'),'sales_name':z['array'](LongNameSchema['describe']('Sales\x20name'))})['strict']()['describe']('Remove\x20existing\x20sales\x20products\x20or\x20services.'),z['object']({'op':z['literal']('clear')})['strict']()['describe']('Clear\x20all\x20sales\x20products\x20or\x20services.')]);export const CallService_DataSchema=z['object']({'object':TypedPermissionObjectSchema,'order_new':OrderNewSchema['optional']()['describe']('Create\x20new\x20order.'),'description':DescriptionSchema['optional'](),'location':LongNameSchema['optional']()['describe']('The\x20service\x20area\x20and\x20scope\x20as\x20stated\x20by\x20the\x20merchant.\x20'+'IMPORTANT:\x20If\x20the\x20service\x20has\x20a\x20geographic\x20scope,\x20ALWAYS\x20specify\x20this\x20field.\x20'+'Use\x20a\x20complete\x20hierarchical\x20address\x20'+'(e.g.\x20\x27US\x20→\x20California\x20→\x20Los\x20Angeles\x20→\x20Koreatown\x27).\x20'+'If\x20only\x20a\x20partial\x20location\x20is\x20known,\x20EXPAND\x20it\x20to\x20the\x20full\x20standardized\x20form\x20'+'(country\x20→\x20province/state\x20→\x20city\x20→\x20district,\x20worldwide)\x20—\x20when\x20ambiguous,\x20offer\x202-4\x20candidate\x20completions\x20and\x20let\x20the\x20user\x20pick.'),'sales':SalesSchema['optional']()['describe']('Service\x20sales\x20products\x20or\x20services\x20list.\x20'+'⚠️\x20WIP\x20NETWORK-DEPLOYMENT\x20RULE:\x20a\x20non-empty\x20sale.wip\x20MUST\x20be\x20a\x20publicly\x20reachable\x20URL\x20'+'(GitHub\x20Pages\x20/\x20IPFS\x20/\x20your\x20own\x20website).\x20The\x20URL\x20is\x20stored\x20ON-CHAIN\x20and\x20every\x20customer\x20'+'fetches\x20it\x20at\x20order\x20time\x20—\x20a\x20local\x20file\x20path,\x20localhost/loopback\x20URL,\x20or\x20LAN\x20private-IP\x20URL\x20'+'is\x20unreachable\x20by\x20customers\x20on\x20other\x20machines\x20and\x20aborts\x20order_new\x20100%.\x20Local-network\x20URLs\x20'+'are\x20INTERNAL\x20TEST\x20USE\x20ONLY\x20(env.network\x20=\x20localnet).\x20Leave\x20sale.wip\x20empty\x20(\x22\x22)\x20to\x20skip\x20'+'WIP\x20verification\x20(TESTING\x20ONLY).'),'repositories':ObjectsSchema['optional']()['describe']('Service\x20Repository\x20object\x20list.'),'rewards':ObjectsSchema['optional']()['describe']('Service\x20Reward\x20object\x20list.\x20'+'May\x20share\x20the\x20Service\x27s\x20Permission\x20(no\x20conflict\x20check\x20—\x20intentional:\x20rewards\x20are\x20the\x20provider\x27s\x20own\x20'+'incentive\x20tool;\x20only\x20Arbitration\x20requires\x20a\x20different\x20Permission\x20for\x20neutrality).'),'arbitrations':ObjectsSchema['optional']()['describe']('Service\x20Arbitration\x20object\x20list.\x20'+'FORMAT:\x20same\x20as\x20repositories\x20—\x20use\x20the\x20`objects`\x20field\x20name\x20inside\x20the\x20operation\x20data.\x20'+'Example:\x20{arbitrations:\x20[{name:\x20\x27my_arb_1\x27},\x20{name:\x20\x27my_arb_2\x27}]}.\x20'+'Each\x20item\x20is\x20a\x20NameOrAddress\x20(object\x20ID\x20or\x20local\x20mark\x20name).\x20'+'⚠️\x20PERMISSION\x20RULE\x20(contract-enforced,\x20service.move\x20arbitration_add_imp):\x20every\x20Arbitration\x20bound\x20here\x20'+'MUST\x20use\x20a\x20Permission\x20object\x20DIFFERENT\x20from\x20THIS\x20Service\x27s\x20permission\x20—\x20binding\x20an\x20Arbitration\x20that\x20shares\x20'+'the\x20Service\x27s\x20Permission\x20aborts\x20with\x20E_ARBITRATION_PERMISSION_CONFLICT\x20(error\x2033).\x20'+'Create\x20a\x20dedicated\x20Permission\x20for\x20each\x20Arbitration\x20BEFORE\x20binding.\x20'+'DESIGN\x20RATIONALE\x20(confirmed\x20intentional):\x20dispute\x20resolution\x20requires\x20NEUTRALITY\x20—\x20an\x20Arbitration\x20controlled\x20'+'by\x20the\x20same\x20Permission\x20admins\x20as\x20the\x20Service\x20it\x20judges\x20would\x20be\x20a\x20conflict\x20of\x20interest.\x20ONLY\x20Arbitration\x20has\x20'+'this\x20check:\x20Reward\x20and\x20Treasury\x20objects\x20MAY\x20share\x20the\x20Service\x27s\x20Permission\x20(they\x20are\x20the\x20provider\x27s\x20own\x20tools).'),'machine':z['union']([NameOrAddressSchema,z['null']()])['optional']()['describe']('Service\x20Machine\x20object\x20ID\x20or\x20name.\x20The\x20Machine\x20object\x20must\x20be\x20in\x20published\x20state.'),'discount':DiscountSchema['optional']()['describe']('Issue\x20discount.'),'discount_destroy':z['array'](NameOrAddressSchema)['optional']()['describe']('Destroy\x20existing\x20discount\x20object\x20ID\x20list.'),'customer_required':z['array'](NotEmptyNameSchema)['optional']()['describe']('Customer\x20required\x20information\x20labels.\x20Such\x20as\x20phone,\x20email,\x20shipping_address,\x20etc.\x20'+'⚠️\x20HARD\x20LINKAGE\x20(SDK-enforced):\x20if\x20customer_required\x20is\x20set\x20(non-empty),\x20the\x20Service\x20MUST\x20also\x20bind\x20a\x20'+'Contact\x20via\x20`um`\x20—\x20otherwise\x20the\x20customer\x27s\x20private\x20information\x20cannot\x20be\x20delivered\x20through\x20end-to-end\x20'+'encrypted\x20Messenger\x20(which\x20routes\x20to\x20the\x20Contact\x20bound\x20as\x20um).\x20Set\x20`um`\x20together\x20with\x20customer_required.'),'order_allocators':z['union']([AllocatorsSchema,z['null']()])['optional']()['describe']('Order\x20fund\x20allocator.\x20Max\x20100\x20allocators\x20(MAX_ALLOCATOR_COUNT).\x20'+'Each\x20allocator\x20has\x20a\x20guard\x20(first\x20matching\x20guard\x20wins)\x20and\x20a\x20sharing\x20list.\x20'+'Set\x20to\x20null\x20to\x20clear.\x20'+'⚠️\x20PERMANENTLY\x20IMMUTABLE\x20after\x20publish:\x20order_allocators\x20can\x20ONLY\x20be\x20set\x20BEFORE\x20publish=true\x20'+'(Move\x20service.move:503:\x20assert!(!self.bPublished,\x20E_ALREADY_PUBLISHED)).\x20'+'After\x20publish,\x20the\x20ONLY\x20way\x20to\x20change\x20allocation\x20rules\x20is\x20to\x20create\x20a\x20NEW\x20Service\x20object.\x20'+'There\x20is\x20NO\x20pause+lock\x20exception\x20for\x20order_allocators\x20(unlike\x20arbitrations/rewards\x20which\x20have\x20time-lock\x20removal).\x20'+'PRE-PUBLISH\x20CHECKLIST:\x20verify\x20all\x20guard\x20names\x20resolve,\x20all\x20sharing\x20amounts\x20are\x20correct,\x20'+'threshold\x20is\x20set,\x20and\x20recipient\x20types\x20(Entity/Signer/GuardIdentifier)\x20are\x20intended\x20before\x20calling\x20publish=true.\x20'+'GuardIdentifier\x20sharing\x20mode:\x20{who:\x20{GuardIdentifier:\x20<u8>},\x20sharing:\x20<rate>,\x20mode:\x20\x27Rate\x27}\x20—\x20'+'resolves\x20recipient\x20from\x20the\x20Guard\x20table\x20submission\x20at\x20allocation\x20time.\x20Canonical\x20order\x20pattern:\x20the\x20recipient\x20slot\x20is\x20the\x20single\x20'+'submitted\x20Order\x20(constrained\x20by\x20the\x20Guard\x20—\x20service\x20binding,\x20qualifying\x20node,\x20signer==order.owner);\x20funds\x20land\x20at\x20that\x20order\x20object\x20and\x20'+'are\x20receivable\x20only\x20by\x20its\x20owner\x20(object\x20receipt\x20=\x20owner\x20receipt).\x20Safety\x20is\x20determined\x20by\x20constraint\x20sufficiency\x20—\x20run\x20the\x20recipient\x20'+'constraint\x20audit\x20before\x20publish.\x20Fixed\x20recipients\x20should\x20use\x20{who:{Entity:...}};\x20unbound\x20Signer\x20recipients\x20are\x20a\x20CRITICAL\x20theft\x20risk.\x20'+'MULTI-CALL\x20ALLOCATION:\x20Allocation.alloc()\x20can\x20be\x20called\x20MULTIPLE\x20times\x20(no\x20consumed\x20flag\x20in\x20contract).\x20'+'Use\x20Amount\x20mode\x20(not\x20Surplus)\x20for\x20recurring\x20allocations\x20—\x20Surplus\x20calls\x20balance::withdraw_all\x20which\x20drains\x20the\x20balance.\x20'+'For\x20monthly\x20payment\x20scenarios,\x20create\x20multiple\x20Allocators\x20with\x20time-based\x20Guards\x20+\x20Amount\x20mode\x20sharing\x20items.'),'buy_guard':z['union']([NameOrAddressSchema,z['null']()])['optional']()['describe']('Buy\x20guard\x20object\x20ID\x20or\x20name.'),'compensation_fund_add':CoinParamSchema['optional']()['describe']('Deposit\x20funds\x20into\x20the\x20Service\x20compensation_fund.\x20Used\x20to\x20pay\x20indemnity\x20when\x20arbitration\x20resolves\x20in\x20customer\x27s\x20favor.\x20'+'FORMAT:\x20{balance:\x20<amount_in_smallest_unit>}\x20—\x20the\x20field\x20name\x20is\x20\x27balance\x27\x20(NOT\x20\x27amount\x27).\x20'+'The\x20token\x20type\x20and\x20precision\x20are\x20determined\x20by\x20the\x20Service\x20object\x27s\x20type_parameter\x20(the\x20generic\x20type\x20set\x20when\x20the\x20Service\x20was\x20created).\x20'+'For\x20WOW\x20(9\x20decimals):\x20{balance:\x201000000000}\x20=\x201\x20WOW.\x20'+'For\x20tokens\x20with\x20different\x20decimals,\x20adjust\x20accordingly\x20(e.g.\x20USDC\x20has\x206\x20decimals,\x20so\x20{balance:\x201000000}\x20=\x201\x20USDC).\x20'+'REQUIRES:\x20Permission\x20index\x20315\x20(SERVICE_COMPENSATION_FUND_DEPOSIT)\x20must\x20be\x20granted\x20to\x20the\x20calling\x20account\x20first.\x20'+'COMMON\x20MISTAKE:\x20using\x20{amount:\x20...}\x20or\x20{amount:\x20...,\x20type:\x20\x27WOW\x27}\x20—\x20these\x20will\x20fail.\x20The\x20correct\x20field\x20is\x20\x27balance\x27.'),'compensation_fund_withdraw':z['object']({'receipt':AccountOrMark_AddressSchema['describe']('Receipt\x20address\x20that\x20will\x20receive\x20the\x20withdrawn\x20funds\x20(as\x20a\x20new\x20Payment\x20object)'),'payment_info':PaymentInfoSchema['describe']('Payment\x20info\x20for\x20the\x20new\x20Payment\x20object\x20created\x20to\x20hold\x20the\x20withdrawn\x20funds')})['strict']()['optional']()['describe']('Withdraw\x20ALL\x20funds\x20from\x20the\x20compensation_fund\x20to\x20a\x20new\x20Payment\x20object\x20owned\x20by\x20`receipt`.\x20'+'Move\x20layer:\x20service::compensation_fund_withdraw\x20(service.move\x20L383-390).\x20'+'REQUIRES:\x20Service\x20must\x20be\x20paused\x20AND\x20setting_lock_duration\x20must\x20have\x20elapsed\x20since\x20pause\x20(assert_not_published\x20at\x20L384-385).\x20'+'Withdraws\x20the\x20ENTIRE\x20compensation_fund\x20balance\x20via\x20balance::withdraw_all.\x20'+'DIFFERENT\x20from\x20compensation_claim\x20(order-side,\x20for\x20arbitration-winning\x20users,\x20no\x20pause+lock\x20required).'),'setting_lock_duration_add':z['number']()['optional']()['describe']('Additional\x20lock\x20duration\x20to\x20ADD\x20to\x20\x27setting_lock_duration\x27\x20(Move\x20field\x20name).\x20'+'UNIT:\x20milliseconds\x20(ms).\x20Example:\x202592000000\x20=\x2030\x20days,\x207776000000\x20=\x2090\x20days,\x2086400000\x20=\x201\x20day.\x20'+'DEFAULT:\x202592000000\x20(30\x20days,\x20DEFAULT_LOCK_DURATION).\x20This\x20is\x20the\x20initial\x20value\x20when\x20a\x20Service\x20is\x20created.\x20'+'Behavior:\x20additive\x20(safe_add)\x20—\x20only\x20increases,\x20never\x20decreases.\x20'+'Move\x20entry:\x20service::setting_lock_duration_add\x20/\x20setting_lock_duration_add_with_passport.\x20'+'Can\x20be\x20called\x20BEFORE\x20or\x20AFTER\x20publish\x20(no\x20publish\x20check).\x20'+'Affects\x20the\x20waiting\x20time\x20required\x20by:\x20compensation_fund_withdraw,\x20arbitrations\x20remove/clear,\x20rewards\x20remove/clear\x20'+'(all\x20require\x20pause\x20+\x20setting_lock_duration\x20elapsed\x20since\x20pause).'),'compensation_fund_receive':ReceivedBalanceOrRecentlySchema['optional']()['describe']('Receive\x20order\x20compensation\x20funds\x20from\x20this\x20Service\x20object.'+RECEIVE_FORMAT_BLOCK_BALANCE),'owner_receive':ReceivedObjectsOrRecentlySchema['optional']()['describe']('Unwrap\x20CoinWrapper\x20objects\x20and\x20other\x20objects\x20received\x20by\x20this\x20Service\x20object\x20and\x20send\x20them\x20to\x20the\x20owner\x20of\x20its\x20Permission\x20object.'+RECEIVE_FORMAT_BLOCK_OBJECTS),'um':z['union']([NameOrAddressSchema,z['null']()])['optional']()['describe']('Contact\x20object\x20ID\x20or\x20name\x20—\x20the\x20Service\x27s\x20customer-service\x20channel.\x20'+'This\x20is\x20the\x20object\x20that\x20Messenger\x20routes\x20encrypted\x20messages\x20to\x20for\x20pre-order\x20negotiation,\x20'+'private-info\x20delivery\x20(see\x20customer_required),\x20and\x20post-sale\x20support.\x20'+'⚠️\x20REQUIRED\x20whenever\x20customer_required\x20is\x20set:\x20without\x20um,\x20the\x20customer\x27s\x20private\x20information\x20'+'has\x20no\x20channel\x20to\x20reach\x20the\x20merchant.'),'pause':z['boolean']()['optional']()['describe']('Whether\x20to\x20pause\x20accepting\x20new\x20orders.'),'publish':z['boolean']()['optional']()['describe']('Whether\x20to\x20publish\x20the\x20Service.\x20After\x20publishing,\x20customers\x20can\x20place\x20orders.\x20'+'VERIFIED\x20against\x20Move\x20source\x20service.move\x20+\x20SDK\x20service.ts\x20(4-level\x20immutability\x20matrix):\x0a'+'\x20\x20L1\x20—\x20PERMANENTLY\x20LOCKED\x20after\x20publish\x20(assert!(!bPublished),\x20no\x20pause+lock\x20exception):\x0a'+'\x20\x20\x20\x20•\x20machine\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(service.move\x20L633/L653\x20—\x20workflow\x20template)\x0a'+'\x20\x20\x20\x20•\x20order_allocators\x20(service.move\x20L503\x20—\x20fund\x20distribution\x20rules)\x0a'+'\x20\x20L2\x20—\x20TIME-LOCKED\x20after\x20publish\x20(assert_not_published\x20—\x20requires\x20pause\x20+\x20setting_lock_duration\x20elapsed):\x0a'+'\x20\x20\x20\x20•\x20arbitrations\x20remove/clear\x20(service.move\x20L433/L445\x20—\x20dispute\x20resolution\x20objects)\x0a'+'\x20\x20\x20\x20•\x20rewards\x20remove/clear\x20\x20\x20\x20\x20\x20\x20(service.move\x20L402/L414\x20—\x20reward\x20objects)\x0a'+'\x20\x20\x20\x20•\x20compensation_fund_withdraw\x20(service.move\x20L384-385\x20—\x20withdraw\x20ALL\x20funds)\x0a'+'\x20\x20L3\x20—\x20REMAIN\x20MUTABLE\x20after\x20publish\x20(no\x20SDK\x20check,\x20no\x20Move\x20check):\x0a'+'\x20\x20\x20\x20•\x20arbitrations\x20add,\x20rewards\x20add\x20(no\x20assert\x20—\x20can\x20add\x20after\x20publish)\x0a'+'\x20\x20\x20\x20•\x20buy_guard,\x20sales,\x20discount,\x20description,\x20location,\x20pause,\x20repositories,\x0a'+'\x20\x20\x20\x20•\x20compensation_fund_add,\x20setting_lock_duration_add,\x20customer_required,\x20um\x20(Contact)\x0a'+'These\x202\x20L1-LOCKED\x20fields\x20(machine/order_allocators)\x20MUST\x20be\x20set\x20BEFORE\x20publish=true.\x0a'+'arbitrations/rewards\x20can\x20be\x20ADDED\x20after\x20publish\x20but\x20remove/clear\x20requires\x20pause+lock.\x0a'+'\x0a'+'⚠️\x20COMPENSATION_FUND\x20+\x20ARBITRATION\x20LINKAGE\x20(service.move:494-499):\x0a'+'\x20\x20At\x20publish\x20time,\x20if\x20compensation_fund\x20>\x200,\x20Arbitration\x20MUST\x20be\x20bound:\x0a'+'\x20\x20\x20\x20if\x20(balance::value(&self.compensation_fund)\x20>\x200)\x20{\x0a'+'\x20\x20\x20\x20\x20\x20\x20\x20assert!(arbitration_count\x20>\x200,\x20E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND);\x0a'+'\x20\x20\x20\x20}\x0a'+'\x20\x20The\x20MCP\x20handler\x20enforces\x20this\x20as\x20a\x20HARD\x20PRE-CHECK:\x20if\x20publish=true\x20AND\x20compensation_fund_add\x20'+'\x20\x20is\x20set\x20in\x20the\x20same\x20call\x20AND\x20arbitrations\x20is\x20empty,\x20the\x20call\x20is\x20REJECTED\x20before\x20submission.\x20'+'\x20\x20If\x20compensation_fund\x20was\x20deposited\x20in\x20a\x20prior\x20call,\x20a\x20SOFT\x20WARNING\x20is\x20issued.\x0a'+'\x0a'+'SCHEMA-03\x20/\x20P0-01\x20fix\x20—\x20DEPLOYMENT\x20WORKFLOW\x20(two-phase,\x20avoids\x20circular\x20dependency):\x0a'+'\x20\x20Phase\x201\x20—\x20CREATE\x20(no\x20publish):\x20object={name:\x27my-service\x27,\x20type_parameter,\x20permission}\x20+\x20machine\x20+\x20order_allocators\x20+\x20arbitrations.\x0a'+'\x20\x20\x20\x20NOTE:\x20buy_guard\x20can\x20use\x20a\x20LocalMark\x20NAME\x20(not\x20address)\x20to\x20break\x20the\x20Guard→Service\x20circular\x20dependency.\x0a'+'\x20\x20\x20\x20The\x20name\x20is\x20resolved\x20to\x20an\x20address\x20at\x20transaction\x20build\x20time.\x0a'+'\x20\x20Phase\x202\x20—\x20PUBLISH:\x20object=\x27my-service\x27\x20(string\x20ref)\x20+\x20publish=true.\x0a'+'\x20\x20\x20\x20All\x20L1-LOCKED\x20fields\x20must\x20be\x20set\x20in\x20Phase\x201;\x20Phase\x202\x20only\x20flips\x20the\x20publish\x20flag.\x0a'+'\x20\x20Post-publish\x20updates:\x20buy_guard,\x20sales,\x20description,\x20repositories\x20(add),\x20rewards\x20(add),\x20arbitrations\x20(add),\x20etc.')})['strict']()['describe']('On-chain\x20Service\x20operations.\x20USAGE:\x20(1)\x20CREATE\x20NEW:\x20Set\x20\x27object\x27\x20field\x20with\x20OBJECT\x20format\x20{name,\x20type_parameter,\x20permission,\x20...}\x20to\x20create\x20a\x20Service.\x20NOTE:\x20\x27name\x27\x20goes\x20INSIDE\x20\x27object\x27,\x20NOT\x20at\x20the\x20data\x20root\x20level.\x20\x27permission\x27\x20can\x20be\x20a\x20new\x20Permission\x20object\x20or\x20reference\x20an\x20existing\x20one\x20-\x20check\x20\x27object\x27\x20field\x20description\x20for\x20details.\x20(2)\x20OPERATE\x20EXISTING:\x20Set\x20\x27object\x27\x20field\x20with\x20STRING\x20format\x20(object\x20ID\x20or\x20name).\x20The\x20\x27object\x27\x20field\x20is\x20CRITICAL\x20and\x20REQUIRED\x20in\x20both\x20cases.\x20STRING\x20for\x20existing,\x20OBJECT\x20for\x20new\x20creation.');export const CallService_InputSchema=z['object']({'data':CallService_DataSchema,'env':CallEnvSchema['optional'](),'submission':SubmissionCallSchema['optional']()})['strict']();
|