@wowok/agent-mcp 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/communication/evidence.d.ts +6 -0
- package/dist/communication/evidence.js +1 -0
- package/dist/evaluation/acceptance.d.ts +24 -0
- package/dist/evaluation/acceptance.js +1 -0
- package/dist/evaluation/builtins/demand-match.d.ts +3 -2
- package/dist/evaluation/builtins/demand-match.js +1 -1
- package/dist/evaluation/builtins/service-risk.d.ts +2 -1
- package/dist/evaluation/builtins/service-risk.js +1 -1
- package/dist/evaluation/index.d.ts +1 -0
- package/dist/evaluation/index.js +1 -1
- package/dist/evaluation/match-operation.d.ts +14 -0
- package/dist/evaluation/match-operation.js +1 -0
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/goal/GoalClassifier.js +1 -1
- package/dist/goal/GoalEngine.d.ts +8 -0
- package/dist/goal/GoalEngine.js +1 -1
- package/dist/goal/types.d.ts +1 -1
- package/dist/harness/auto-escalation.d.ts +0 -12
- package/dist/harness/auto-escalation.js +1 -1
- package/dist/harness/index.d.ts +1 -14
- package/dist/harness/index.js +1 -1
- package/dist/harness/types.d.ts +0 -38
- package/dist/intent/types.d.ts +1 -1
- package/dist/intent/types.js +1 -1
- package/dist/keeper/KeeperScan.d.ts +39 -0
- package/dist/keeper/KeeperScan.js +1 -0
- package/dist/keeper/KeeperStore.d.ts +43 -0
- package/dist/keeper/KeeperStore.js +1 -0
- package/dist/keeper/detectors.d.ts +23 -0
- package/dist/keeper/detectors.js +1 -0
- package/dist/keeper/keeper.spec.d.ts +1 -0
- package/dist/keeper/keeper.spec.js +1 -0
- package/dist/keeper/types.d.ts +65 -0
- package/dist/keeper/types.js +1 -0
- package/dist/knowledge/demand-risk.js +1 -1
- package/dist/knowledge/event-semantics.d.ts +3 -0
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/event-semantics.spec.d.ts +1 -0
- package/dist/knowledge/event-semantics.spec.js +1 -0
- package/dist/knowledge/evidence-review.d.ts +23 -0
- package/dist/knowledge/evidence-review.js +1 -1
- package/dist/knowledge/examples-scanner-cli.js +1 -1
- package/dist/knowledge/examples-scanner.js +1 -1
- package/dist/knowledge/guard-bytecode-spec.d.ts +82 -0
- package/dist/knowledge/guard-bytecode-spec.js +1 -0
- package/dist/knowledge/guard-design-patterns.d.ts +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/index.d.ts +10 -6
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -1
- package/dist/knowledge/mcp-schema-audit.js +1 -1
- package/dist/knowledge/migration-preflight.d.ts +27 -0
- package/dist/knowledge/migration-preflight.js +1 -0
- package/dist/knowledge/scenario-modes.d.ts +1 -1
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +20 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.d.ts +1 -0
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/monitor/ScopeResolver.js +1 -1
- package/dist/monitor/SuggestionBridge.d.ts +1 -1
- package/dist/monitor/SuggestionBridge.js +1 -1
- package/dist/monitor/SuggestionBridge.spec.d.ts +1 -0
- package/dist/monitor/SuggestionBridge.spec.js +1 -0
- package/dist/monitor/normalize.js +1 -1
- package/dist/monitor/types.d.ts +0 -1
- package/dist/monitor/types.js +1 -1
- package/dist/participation/employee-kpi.d.ts +12 -0
- package/dist/participation/employee-kpi.js +1 -1
- package/dist/participation/employee-kpi.spec.d.ts +1 -0
- package/dist/participation/employee-kpi.spec.js +1 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/mode-actions.d.ts +19 -6
- package/dist/playbooks/service-build/mode-actions.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/relationship/derivation.d.ts +6 -0
- package/dist/relationship/derivation.js +1 -1
- package/dist/relationship/derivation.spec.d.ts +1 -0
- package/dist/relationship/derivation.spec.js +1 -0
- package/dist/role/index.d.ts +2 -2
- package/dist/role/index.js +1 -1
- package/dist/role/model.d.ts +2 -1
- package/dist/role/model.js +1 -1
- package/dist/role/types.d.ts +5 -0
- package/dist/rules.d.ts +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/employee/index.d.ts +61 -1
- package/dist/schema/employee/index.js +1 -1
- package/dist/schema/evaluation/index.d.ts +70 -5
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +43 -7
- package/dist/schema/industry-pack/modes.d.ts +42 -6
- package/dist/schema/industry-pack/modes.js +1 -1
- package/dist/schema/intent-radar/index.d.ts +3 -0
- package/dist/schema/intent-radar/index.js +1 -1
- package/dist/schema/keeper/index.d.ts +475 -0
- package/dist/schema/keeper/index.js +1 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +2 -0
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +34 -0
- package/dist/schema/query/bi.d.ts +188 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +48 -48
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +2 -11
- package/dist/schema/schema-query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/utils/skills-recommendation.js +1 -1
- package/dist/schema/watch/index.d.ts +4 -0
- package/dist/schema/watch/index.js +1 -1
- package/dist/schema-query-impl/index.d.ts +33 -14
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/employee_operation.output.json +100 -0
- package/dist/schemas/employee_operation.schema.json +148 -5
- package/dist/schemas/evaluation_operation.output.json +135 -9
- package/dist/schemas/evaluation_operation.schema.json +176 -7
- package/dist/schemas/index.json +7 -1
- package/dist/schemas/industry_pack_operation.output.json +158 -32
- package/dist/schemas/intent_radar.output.json +2 -0
- package/dist/schemas/intent_radar.schema.json +1 -0
- package/dist/schemas/keeper_operation.output.json +1274 -0
- package/dist/schemas/keeper_operation.schema.json +359 -0
- package/dist/schemas/messenger_operation.schema.json +8 -0
- package/dist/schemas/onchain_events.output.json +55 -11
- package/dist/schemas/onchain_events.schema.json +4 -0
- package/dist/schemas/onchain_table_data.output.json +59 -0
- package/dist/schemas/query_toolkit.output.json +428 -0
- package/dist/schemas/query_toolkit.schema.json +59 -0
- package/dist/schemas/schema_query.output.json +1 -64
- package/dist/schemas/schema_query.schema.json +18 -3
- package/dist/schemas/watch_operation.output.json +21 -1
- package/dist/task/playbook.js +1 -1
- package/dist/task/types.d.ts +1 -1
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/employee.d.ts +6 -0
- package/dist/tools/handlers/employee.js +1 -1
- package/dist/tools/handlers/employee.spec.d.ts +1 -0
- package/dist/tools/handlers/employee.spec.js +1 -0
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/evaluation.spec.d.ts +1 -0
- package/dist/tools/handlers/evaluation.spec.js +1 -0
- package/dist/tools/handlers/intent-radar.js +1 -1
- package/dist/tools/handlers/keeper.d.ts +12 -0
- package/dist/tools/handlers/keeper.js +1 -0
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/handlers/watch.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/agent.d.ts +2 -0
- package/dist/tools/registry/agent.js +1 -0
- package/dist/tools/registry/bridge.d.ts +2 -0
- package/dist/tools/registry/bridge.js +1 -0
- package/dist/tools/registry/business.d.ts +2 -0
- package/dist/tools/registry/business.js +1 -0
- package/dist/tools/registry/config.d.ts +2 -0
- package/dist/tools/registry/config.js +1 -0
- package/dist/tools/registry/files.d.ts +2 -0
- package/dist/tools/registry/files.js +1 -0
- package/dist/tools/registry/identity.d.ts +2 -0
- package/dist/tools/registry/identity.js +1 -0
- package/dist/tools/registry/local.d.ts +2 -0
- package/dist/tools/registry/local.js +1 -0
- package/dist/tools/registry/messenger.d.ts +2 -0
- package/dist/tools/registry/messenger.js +1 -0
- package/dist/tools/registry/monitor.d.ts +2 -0
- package/dist/tools/registry/monitor.js +1 -0
- package/dist/tools/registry/onchain.d.ts +2 -0
- package/dist/tools/registry/onchain.js +1 -0
- package/dist/tools/registry/query.d.ts +2 -0
- package/dist/tools/registry/query.js +1 -0
- package/dist/tools/registry/trust.d.ts +2 -0
- package/dist/tools/registry/trust.js +1 -0
- package/dist/tools/shared.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
- package/dist/examples/arbitration-dispute-create.json +0 -41
- package/dist/examples/arbitration-vote-weighted.json +0 -35
- package/dist/examples/arbitration-voting-guard-add.json +0 -38
- package/dist/examples/demand-present-service.json +0 -33
- package/dist/examples/education-contact-create.json +0 -40
- package/dist/examples/freelance-contact-create.json +0 -40
- package/dist/examples/gen-passport-verify-guard.json +0 -48
- package/dist/examples/guard-template-balance-check.json +0 -59
- package/dist/examples/guard-template-time-lock.json +0 -60
- package/dist/examples/insurance-guard-claim-timelock.json +0 -75
- package/dist/examples/insurance-guard-withdraw-allocation.json +0 -96
- package/dist/examples/insurance-machine-create.json +0 -75
- package/dist/examples/insurance-service-allocators.json +0 -55
- package/dist/examples/machine-multisig-threshold.json +0 -87
- package/dist/examples/machine-publish.json +0 -30
- package/dist/examples/machine-template-7node-rental.json +0 -119
- package/dist/examples/payment-scenario-bound.json +0 -45
- package/dist/examples/rental-ziroom-machine-create.json +0 -148
- package/dist/examples/rental-ziroom-permission-create.json +0 -41
- package/dist/examples/rental-ziroom-service-create.json +0 -36
- package/dist/examples/retail-adv-guard-customer-win-create.json +0 -80
- package/dist/examples/retail-adv-guard-messenger-proof-create.json +0 -65
- package/dist/examples/retail-adv-guard-reward-timeout-create.json +0 -92
- package/dist/examples/retail-adv-reward-guard-add.json +0 -51
- package/dist/examples/retail-myshop-allocation-activate.json +0 -55
- package/dist/examples/retail-myshop-arbitration-create.json +0 -40
- package/dist/examples/retail-myshop-contact-create.json +0 -43
- package/dist/examples/retail-myshop-order-create.json +0 -56
- package/dist/examples/retail-myshop-progress-operate.json +0 -38
- package/dist/examples/retail-myshop-reward-create.json +0 -35
- package/dist/examples/retail-myshop-service-create.json +0 -38
- package/dist/examples/retail-myshop-service-customer-required.json +0 -31
- package/dist/examples/service-discount-issue.json +0 -46
- package/dist/examples/subscription-contact-create.json +0 -40
- package/dist/examples/threebody-guard-create.json +0 -56
- package/dist/examples/threebody-machine-create.json +0 -71
- package/dist/examples/threebody-permission-create.json +0 -38
- package/dist/examples/threebody-service-allocators.json +0 -48
- package/dist/examples/travel-guard-time-lock.json +0 -69
- package/dist/examples/travel-guard-weather-oracle.json +0 -70
- package/dist/examples/travel-machine-create.json +0 -135
- package/dist/examples/travel-repository-create.json +0 -47
- package/dist/examples/travel-service-create.json +0 -34
- package/dist/examples/travel-treasury-create.json +0 -34
- package/dist/examples/treasury-deposit.json +0 -37
- package/dist/examples/treasury-withdraw.json +0 -38
- package/dist/harness/plan.d.ts +0 -33
- package/dist/harness/plan.js +0 -1
- package/dist/knowledge/demand-matching.d.ts +0 -29
- package/dist/knowledge/demand-matching.js +0 -1
- package/dist/knowledge/guard-context.d.ts +0 -56
- package/dist/knowledge/guard-context.js +0 -1
- package/dist/knowledge/guard-migration.d.ts +0 -48
- package/dist/knowledge/guard-migration.js +0 -1
- package/dist/schemas/guard-node-schema.json +0 -1000
- package/dist/task/stage-gate.d.ts +0 -22
- package/dist/task/stage-gate.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{auditService}from'../../knowledge/index.js';import{getExperienceFeedback,recordOperationOutcome}from'../../experience/index.js';import{isEnabled as a347a,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':[/insufficient\s*(balance|coin|fund)/i,/ENOTENOUGH/i,/not\s*enough\s*(coin|balance)/i,/coin\s*not\s*enough/i,/balance\s*not\s*enough/i,/stock\s*not\s*enough/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,/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],'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,/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,/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],'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],'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],'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;}const WOWOK_ADDRESSES=new Set(['0x0000000000000000000000000000000000000000000000000000000000000002','0x2','0x0000000000000000000000000000000000000000000000000000000000000001','0x1']);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+)\)/),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(WOWOK_ADDRESSES['has'](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(WOWOK_ADDRESSES['has'](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);if(b!==undefined&&isWException(b)){const f=classifyWException(b);if(f){const g=extractMoveAbortInfo(c);return g&&(f['move_abort_info']=g,g['description']&&f['recovery_hint']&&!f['recovery_hint']['includes'](g['description'])&&(f['recovery_hint']=f['recovery_hint']+'.\x20Details:\x20'+g['description'])),f;}}if(!c)return{'error_code':'unknown','retryable':![]};for(const h of ERROR_RULES){if(h['patterns']['some'](i=>i['test'](c))){const i={'error_code':h['error_code'],'retryable':h['retryable'],'recovery_hint':h['recovery_hint']},j=extractMoveAbortInfo(c);return j&&(i['move_abort_info']=j,j['description']&&(i['recovery_hint']=i['recovery_hint']+'.\x20Details:\x20'+j['description'])),i;}}const d=extractMoveAbortInfo(c),e={'error_code':'unknown','retryable':![],'recovery_hint':'Inspect\x20the\x20full\x20error\x20message;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'};return d&&(e['move_abort_info']=d,d['description']&&(e['recovery_hint']=d['description']+'.\x20'+e['recovery_hint'])),e;}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(!a347a('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=a347a('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(a347a('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(a347a('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(a347a('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 a357a,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':[/insufficient\s*(balance|coin|fund)/i,/ENOTENOUGH/i,/not\s*enough\s*(coin|balance)/i,/coin\s*not\s*enough/i,/balance\s*not\s*enough/i,/stock\s*not\s*enough/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,/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],'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,/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,/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],'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],'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],'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;}const WOWOK_ADDRESSES=new Set(['0x0000000000000000000000000000000000000000000000000000000000000002','0x2','0x0000000000000000000000000000000000000000000000000000000000000001','0x1']);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+)\)/),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(WOWOK_ADDRESSES['has'](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(WOWOK_ADDRESSES['has'](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);if(b!==undefined&&isWException(b)){const f=classifyWException(b);if(f){const g=extractMoveAbortInfo(c);return g&&(f['move_abort_info']=g,g['description']&&f['recovery_hint']&&!f['recovery_hint']['includes'](g['description'])&&(f['recovery_hint']=f['recovery_hint']+'.\x20Details:\x20'+g['description'])),f;}}if(!c)return{'error_code':'unknown','retryable':![]};for(const h of ERROR_RULES){if(h['patterns']['some'](i=>i['test'](c))){const i={'error_code':h['error_code'],'retryable':h['retryable'],'recovery_hint':h['recovery_hint']},j=extractMoveAbortInfo(c);return j&&(i['move_abort_info']=j,j['description']&&(i['recovery_hint']=i['recovery_hint']+'.\x20Details:\x20'+j['description'])),i;}}const d=extractMoveAbortInfo(c),e={'error_code':'unknown','retryable':![],'recovery_hint':'Inspect\x20the\x20full\x20error\x20message;\x20consult\x20wowok-tools\x20Skill\x20for\x20the\x20operation\x27s\x20requirements'};return d&&(e['move_abort_info']=d,d['description']&&(e['recovery_hint']=d['description']+'.\x20'+e['recovery_hint'])),e;}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(!a357a('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=a357a('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(a357a('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(a357a('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(a357a('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 +1 @@
|
|
|
1
|
-
import{z}from'zod';import{isValidAddress,ValueType as a350a,ObjectType as a350b,ENTRYPOINT,isValidWowAddress,isValidName,isValidDescription,MAX_DESCRIPTION_LENGTH,isValidLongName,MAX_LONG_NAME_LENGTH}from'@wowok/wowok';const isValidMoveIdentifier=a=>{if(a['length']===0x0)return![];const b=a[0x0];if(b==='_')return a['length']>0x1&&/^[a-zA-Z0-9_]+$/['test'](a['slice'](0x1));if(/^[a-zA-Z]$/['test'](b))return/^[a-zA-Z0-9_]*$/['test'](a['slice'](0x1));return![];};export const DescriptionSchema=z['string']()['trim']()['refine'](isValidDescription,{'message':'Description\x20string\x20(max\x20'+MAX_DESCRIPTION_LENGTH+'\x20bcs\x20characters)'})['describe']('Description\x20string\x20(max\x20'+MAX_DESCRIPTION_LENGTH+'\x20bcs\x20characters)');export const LongNameSchema=z['string']()['refine'](isValidLongName,{'message':'max\x20'+MAX_LONG_NAME_LENGTH+'\x20bcs\x20characters'});export const WowAddressSchema=z['string']()['refine'](isValidAddress,{'message':'Invalid\x20ID\x20format:\x20must\x20be\x20\x270x\x27\x20prefix\x20followed\x20by\x2064\x20hex\x20characters'})['describe']('Valid\x20ID:\x200x\x20prefix\x20+\x2064\x20hex\x20characters,\x20or\x20builtin\x20ID\x20(0x5-0x9,\x200xa,\x200xc,\x200xd,\x200x403,\x200xaaa,\x200xaab,\x200xacc)');const WOW_TOKEN_TYPE='0x2::wow::WOW';export const TokenTypeSchema=z['string']()['refine'](a=>{if(a===WOW_TOKEN_TYPE)return!![];const b=a['split']('::');if(b['length']!==0x3)return![];const [c,d,e]=b;if(!isValidWowAddress(c))return![];if(!isValidMoveIdentifier(d))return![];if(!isValidMoveIdentifier(e))return![];return!![];},{'message':'Invalid\x20token\x20type\x20format.\x20Expected:\x20{address}::{module}::{struct}\x20where\x20address\x20is\x200x+64hex,\x20module/struct\x20are\x20valid\x20Move\x20identifiers,\x20or\x20\x270x2::wow::WOW\x27'})['describe']('Token\x20type\x20in\x20format:\x20{address}::{module}::{struct}.\x20e.g.\x20\x270x2::wow::WOW\x27\x20(WOW),\x20\x270x...::usdt::USDT\x27\x20(USDT),\x20\x270x...::eth::ETH\x27\x20(ETH).\x20To\x20discover\x20all\x20available\x20tokens\x20and\x20their\x20type\x20tags,\x20query\x20\x27mainnet\x20bridge\x20tokens\x27\x20via\x20wowok_buildin_info\x20and\x20use\x20the\x20returned\x20`wowTypeTag`\x20here.');export const TokenTypeWithDefaultSchema=TokenTypeSchema['default'](WOW_TOKEN_TYPE)['describe']('Token\x20type\x20in\x20format:\x20{address}::{module}::{struct}.\x20Default:\x20\x270x2::wow::WOW\x27.\x20Other\x20examples:\x20\x270x...::usdt::USDT\x27\x20(USDT),\x20\x270x...::eth::ETH\x27\x20(ETH).\x20To\x20discover\x20all\x20available\x20tokens\x20and\x20their\x20type\x20tags,\x20query\x20\x27mainnet\x20bridge\x20tokens\x27\x20via\x20wowok_buildin_info\x20and\x20use\x20the\x20returned\x20`wowTypeTag`\x20here.');export const NameSchema=z['string']()['refine'](isValidName,'Name\x20string\x20(max\x2064\x20bcs\x20characters,\x20must\x20not\x20start\x20with\x20\x270x\x27)');export const NotEmptyNameSchema=z['string']()['nonempty']()['refine'](isValidName,'Name\x20string\x20(at\x20least\x201\x20character,\x20max\x20length\x2064\x20bcs\x20characters)');export const NameOrAddressSchema=z['string']()['refine'](a=>{if(isValidAddress(a))return!![];if(isValidName(a))return!![];return![];},{'message':'Invalid\x20ID\x20format:\x20must\x20be\x20\x270x\x27\x20prefix,\x20or\x20a\x20builtin\x20ID\x20(0x5-0x9,\x200xa,\x200xc,\x200xd,\x200x403,\x200xaaa,\x200xaab,\x200xacc)'})['describe']('Account/Object\x20name\x20or\x20ID.\x20If\x20specifying\x20an\x20account,\x20use\x20empty\x20string\x20\x27\x27\x20for\x20the\x20default\x20account.\x20'+'If\x20it\x20starts\x20with\x20\x270x\x27,\x20it\x20will\x20be\x20treated\x20as\x20an\x20ID.\x20'+'Otherwise,\x20it\x20will\x20be\x20treated\x20as\x20a\x20name\x20(max\x2064\x20bcs\x20characters).');export const AccountOrMark_AddressSchema=z['object']({'name_or_address':NameOrAddressSchema['optional'](),'local_mark_first':z['boolean']()['optional']()['describe']('Whether\x20to\x20prioritize\x20local\x20marks,\x20if\x20true,\x20prioritize\x20local\x20marks,\x20otherwise\x20prioritize\x20global\x20marks')})['strict']()['describe']('Account\x20or\x20address\x20lookup\x20object.\x20Use\x20this\x20to\x20specify\x20which\x20account\x20to\x20use\x20for\x20an\x20operation.\x20'+'EXAMPLE:\x20{\x20name_or_address:\x20\x27testor2\x27\x20}\x20-\x20looks\x20up\x20account\x20by\x20name;\x20'+'EXAMPLE:\x20{\x20name_or_address:\x20\x270x1234...\x27\x20}\x20-\x20uses\x20address\x20directly;\x20'+'If\x20name_or_address\x20is\x20empty\x20string\x20\x27\x27,\x20uses\x20the\x20default\x20local\x20account.');export const ManyAccountOrMark_AddressSchema=z['object']({'entities':z['array'](AccountOrMark_AddressSchema),'check_all_founded':z['boolean']()['optional']()['describe']('Whether\x20to\x20check\x20all\x20entities\x20are\x20found,\x20if\x20true,\x20all\x20entities\x20must\x20be\x20found\x20(abort\x20and\x20throw\x20exception\x20if\x20any\x20ID\x20not\x20found);\x20if\x20false,\x20only\x20return\x20found\x20IDs')})['strict']()['describe']('Used\x20to\x20batch\x20find\x20account\x20or\x20object\x20IDs\x20by\x20name');export const AccountOrMark_AddressAISchema=z['union']([NameOrAddressSchema['transform'](a=>({'name_or_address':a,'local_mark_first':!![]}))['describe']('Account\x20name,\x20address\x20(0x...),\x20or\x20mark\x20name.\x20'+'When\x20using\x20string\x20format,\x20local\x20marks\x20are\x20searched\x20first.\x20'+'EXAMPLE:\x20\x27alice\x27\x20-\x20searches\x20local\x20marks\x20first,\x20then\x20global;\x20'+'EXAMPLE:\x20\x270x2...\x27\x20(64\x20hex\x20chars)\x20-\x20uses\x20address\x20directly;\x20'+'EXAMPLE:\x20\x27\x27\x20-\x20uses\x20the\x20default\x20local\x20account'),AccountOrMark_AddressSchema])['describe']('Account\x20or\x20address\x20lookup.\x20Can\x20be\x20a\x20simple\x20string\x20(recommended\x20for\x20AI)\x20'+'or\x20full\x20object\x20with\x20explicit\x20local_mark_first\x20control.\x20'+'String\x20form\x20auto-converts\x20to\x20{\x20name_or_address:\x20<string>,\x20local_mark_first:\x20true\x20}.');export const ManyAccountOrMark_AddressAISchema=z['union']([z['array'](NameOrAddressSchema)['transform'](a=>({'entities':a['map'](b=>({'name_or_address':b,'local_mark_first':!![]})),'check_all_founded':!![]}))['describe']('Array\x20of\x20account\x20names,\x20addresses,\x20or\x20mark\x20names.\x20'+'Local\x20marks\x20are\x20searched\x20first\x20for\x20each\x20entry.\x20'+'EXAMPLE:\x20[\x27alice\x27,\x20\x270x2...\x27,\x20\x27bob\x27]'),ManyAccountOrMark_AddressSchema])['describe']('Batch\x20account\x20or\x20address\x20lookup.\x20Can\x20be\x20an\x20array\x20of\x20strings\x20(recommended\x20for\x20AI)\x20'+'or\x20full\x20object\x20with\x20explicit\x20control.\x20'+'Array\x20form\x20auto-converts\x20to\x20{\x20entities:\x20[...],\x20check_all_founded:\x20true\x20}.');export const ObjectOwnerSchema=z['union']([z['object']({'AddressOwner':z['string']()['describe']('Address\x20owner')})['strict'](),z['object']({'ObjectOwner':z['string']()['describe']('Object\x20owner')})['strict'](),z['object']({'Shared':z['object']({'initial_shared_version':z['union']([z['string'](),z['number']()])['describe']('Version\x20when\x20object\x20became\x20shared')})['strict']()['describe']('Shared\x20object')})['strict'](),z['literal']('Immutable'),z['object']({'ConsensusAddressOwner':z['object']({'owner':z['string']()['describe']('Consensus\x20ID\x20owner'),'start_version':z['union']([z['string'](),z['number']()])['describe']('Version\x20when\x20object\x20recently\x20became\x20consensus\x20object')})['strict']()['describe']('Consensus\x20ID\x20owner')})['strict']()])['describe']('Object\x20owner');export const ValueTypeUserSchema=z['union']([z['literal'](a350a['Bool'])['describe']('Bool\x20(0)'),z['literal'](a350a['Address'])['describe']('Address\x20(1)'),z['literal'](a350a['String'])['describe']('String\x20(2)'),z['literal'](a350a['U8'])['describe']('U8\x20(3)'),z['literal'](a350a['U16'])['describe']('U16\x20(4)'),z['literal'](a350a['U32'])['describe']('U32\x20(5)'),z['literal'](a350a['U64'])['describe']('U64\x20(6)'),z['literal'](a350a['U128'])['describe']('U128\x20(7)'),z['literal'](a350a['U256'])['describe']('U256\x20(8)'),z['literal'](a350a['VecBool'])['describe']('VecBool\x20(9)'),z['literal'](a350a['VecAddress'])['describe']('VecAddress\x20(10)'),z['literal'](a350a['VecString'])['describe']('VecString\x20(11)'),z['literal'](a350a['VecU8'])['describe']('VecU8\x20(12)'),z['literal'](a350a['VecU16'])['describe']('VecU16\x20(13)'),z['literal'](a350a['VecU32'])['describe']('VecU32\x20(14)'),z['literal'](a350a['VecU64'])['describe']('VecU64\x20(15)'),z['literal'](a350a['VecU128'])['describe']('VecU128\x20(16)'),z['literal'](a350a['VecU256'])['describe']('VecU256\x20(17)'),z['literal'](a350a['VecVecU8'])['describe']('VecVecU8\x20(18)'),z['literal']('Bool')['describe']('Bool'),z['literal']('Address')['describe']('Address'),z['literal']('String')['describe']('String'),z['literal']('U8')['describe']('U8'),z['literal']('U16')['describe']('U16'),z['literal']('U32')['describe']('U32'),z['literal']('U64')['describe']('U64'),z['literal']('U128')['describe']('U128'),z['literal']('U256')['describe']('U256'),z['literal']('VecBool')['describe']('VecBool'),z['literal']('VecAddress')['describe']('VecAddress'),z['literal']('VecString')['describe']('VecString'),z['literal']('VecU8')['describe']('VecU8'),z['literal']('VecU16')['describe']('VecU16'),z['literal']('VecU32')['describe']('VecU32'),z['literal']('VecU64')['describe']('VecU64'),z['literal']('VecU128')['describe']('VecU128'),z['literal']('VecU256')['describe']('VecU256'),z['literal']('VecVecU8')['describe']('VecVecU8'),z['literal']('bool')['describe']('bool'),z['literal']('address')['describe']('address'),z['literal']('string')['describe']('string'),z['literal']('u8')['describe']('u8'),z['literal']('u16')['describe']('u16'),z['literal']('u32')['describe']('u32'),z['literal']('u64')['describe']('u64'),z['literal']('u128')['describe']('u128'),z['literal']('u256')['describe']('u256'),z['literal']('vecbool')['describe']('vecbool'),z['literal']('vecaddress')['describe']('vecaddress'),z['literal']('vecstring')['describe']('vecstring'),z['literal']('vecu8')['describe']('vecu8'),z['literal']('vecu16')['describe']('vecu16'),z['literal']('vecu32')['describe']('vecu32'),z['literal']('vecu64')['describe']('vecu64'),z['literal']('vecu128')['describe']('vecu128'),z['literal']('vecu256')['describe']('vecu256'),z['literal']('vecvecu8')['describe']('vecvecu8')])['describe']('User\x20available\x20value\x20type\x20(number\x20or\x20string,\x20e.g.,\x206\x20or\x20\x27U64\x27\x20or\x20\x27u64\x27)');export const ValueTypeSchema=ValueTypeUserSchema['or'](z['literal'](a350a['Value'])['describe']('Value\x20(19)'))['or'](z['literal']('Value')['describe']('Value'))['describe']('Value\x20type\x20(number\x20or\x20string,\x20e.g.,\x206\x20or\x20\x27U64\x27)');export const ObjectTypeSchema=z['enum']([a350b['Permission'],a350b['Repository'],a350b['Arb'],a350b['Arbitration'],a350b['Service'],a350b['Machine'],a350b['Order'],a350b['Progress'],a350b['Payment'],a350b['Treasury'],a350b['Guard'],a350b['Demand'],a350b['Passport'],a350b['Allocation'],a350b['Resource'],a350b['Reward'],a350b['Discount'],a350b['EntityRegistrar'],a350b['EntityLinker'],a350b['Proof'],a350b['WReceivedObject'],a350b['Contact'],a350b['TableItem_ProgressHistory'],a350b['TableItem_PermissionPerm'],a350b['TableItem_DemandPresenter'],a350b['TableItem_MachineNode'],a350b['TableItem_TreasuryHistory'],a350b['TableItem_RepositoryData'],a350b['TableItem_RewardRecord'],a350b['TableItem_EntityLinker'],a350b['TableItem_AddressMark'],a350b['TableItem_EntityRegistrar']])['describe']('Wowok\x20object\x20type');export const BalanceTypeSchema=z['union']([z['number'](),z['string']()])['describe']('A\x20coin/balance\x20amount.\x20Accepts\x20three\x20formats:\x20'+'(1)\x20DISPLAY\x20FORMAT\x20with\x20token\x20symbol:\x20\x222.5WOW\x22,\x20\x2210USDC\x22,\x20\x220.05WOW\x22\x20—\x20'+'auto-converted\x20to\x20smallest\x20units\x20via\x20the\x20Fund\x20Processing\x20Layer\x20(token\x20precision\x20resolved\x20'+'from\x20official\x20registry\x20→\x20cache\x20→\x20on-chain).\x20The\x20symbol\x20MUST\x20match\x20the\x20token\x27s\x20type_parameter.\x20'+'(2)\x20SMALLEST\x20UNIT\x20(numeric\x20string):\x20\x2210000000000\x22\x20—\x20used\x20as-is,\x20no\x20conversion.\x20'+'(3)\x20SMALLEST\x20UNIT\x20(number):\x2010000000000\x20—\x20used\x20as-is\x20only\x20within\x20the\x20safe\x20integer\x20range\x20(±2^53);\x20numbers\x20outside\x20it\x20are\x20REJECTED,\x20use\x20a\x20numeric\x20string\x20instead.\x20'+'PRECISION\x20RULE:\x20for\x20values\x20exceeding\x202^53\x20(9007199254740991),\x20ALWAYS\x20use\x20format\x20(1)\x20or\x20(2)\x20—\x20JS\x20numbers\x20lose\x20integer\x20precision\x20silently\x20and\x20such\x20inputs\x20are\x20blocked.\x20'+'Raw\x20amounts\x20must\x20be\x20plain\x20non-negative\x20integers;\x20a\x20decimal\x20value\x20without\x20a\x20token\x20symbol\x20(e.g.\x20\x222.5\x22)\x20is\x20rejected\x20—\x20append\x20the\x20symbol\x20(\x222.5WOW\x22)\x20so\x20the\x20Fund\x20Processing\x20Layer\x20converts\x20it.\x20'+'Default\x20token:\x20WOW\x20(9\x20decimals,\x201\x20WOW\x20=\x2010^9\x20MIST).\x20'+'For\x20custom\x20tokens:\x20use\x20display\x20format\x20with\x20the\x20token\x27s\x20symbol,\x20or\x20pass\x20smallest\x20units\x20directly.\x20'+'MONEY\x20CONFIRMATION:\x20all\x20monetary\x20fields\x20trigger\x20user\x20confirmation\x20via\x20the\x20Fund\x20Processing\x20Layer,\x20where\x20the\x20token\x27s\x20FULL\x20type,\x20decimals\x20and\x20raw\x20amount\x20are\x20always\x20visible.\x20'+'MULTIPLE\x20ISSUERS:\x20several\x20on-chain\x20tokens\x20may\x20legally\x20share\x20the\x20same\x20symbol\x20(e.g.\x20multiple\x20\x22USDT\x22\x20coins).\x20When\x20a\x20bare\x20symbol\x20matches\x20more\x20than\x20one\x20token,\x20the\x20operation\x20is\x20BLOCKED\x20and\x20every\x20candidate\x20is\x20listed\x20with\x20full\x20details\x20(type,\x20name,\x20decimals,\x20verified\x20tag)\x20—\x20present\x20the\x20list\x20to\x20the\x20USER\x20and\x20let\x20them\x20choose\x20(they\x20may\x20answer\x20by\x20number),\x20then\x20re-issue\x20with\x20the\x20chosen\x20token\x27s\x20FULL\x20type\x20string\x20in\x20type_parameter;\x20never\x20guess\x20an\x20issuer\x20from\x20the\x20bare\x20symbol.\x20'+'MISSING\x20TOKEN\x20INFO:\x20when\x20a\x20token\x27s\x20precision\x20cannot\x20be\x20resolved,\x20the\x20operation\x20is\x20REFUSED\x20(raw\x20u64\x20included\x20—\x20amount\x20magnitude\x20could\x20not\x20be\x20verified).\x20Recovery:\x20provide\x20the\x20token\x27s\x20FULL\x20type\x20in\x20package::module::Name\x20form\x20in\x20type_parameter\x20(a\x20bare\x20symbol\x20like\x20\x22USDT\x22\x20cannot\x20be\x20resolved),\x20and\x20verify\x20the\x20WOW\x20network\x20is\x20correct.\x20'+'Examples:\x20\x222.5WOW\x22\x20(display\x20→\x202500000000),\x2010000000000\x20(number,\x20smallest\x20unit),\x20\x2250000000000\x22\x20(string,\x20smallest\x20unit).\x20'+'Used\x20for:\x20Service.sale.price,\x20Service.compensation_fund_add\x20balance,\x20Treasury.deposit,\x20Arbitration.fee,\x20Reward.amount,\x20stock\x20quantities.');export const QueryIdSchema=z['number']()['int']()['min'](0x0)['describe']('Query\x20ID');export const CacheExpireTypeSchema=z['union']([z['number'](),z['literal']('INFINITE')])['describe']('Cache\x20expiration\x20time\x20type');export const ValueContainerSchema=z['lazy'](()=>z['object']({'valueType':ValueTypeSchema['describe']('Value\x20type'),'value':SupportedValueSchema['describe']('Value')})['strict']()['describe']('Value\x20container\x20with\x20type\x20and\x20value'));export const SupportedValueUserSchema=z['union']([z['boolean'](),z['union']([AccountOrMark_AddressSchema,z['string']()]),z['string'](),z['number'](),z['array'](z['boolean']()),z['union']([ManyAccountOrMark_AddressSchema,z['array'](z['string']())]),z['array'](z['string']()),z['array'](z['number']()),z['array'](z['array'](z['number']()))])['describe']('User\x20available\x20supported\x20value\x20type');export const SupportedValueSchema=SupportedValueUserSchema['or'](ValueContainerSchema)['describe']('Supported\x20value\x20type');export const GuardIdentifierSchema=z['number']()['int']()['min'](0x0)['max'](0xff)['describe']('Identifier\x20(0-255)\x20for\x20data\x20lookup\x20in\x20Guard\x20table.');export const GuardTableItemBaseSchema=z['object']({'identifier':GuardIdentifierSchema,'b_submission':z['boolean']()['describe']('Whether\x20this\x20table\x20item\x27s\x20value\x20is\x20submitted\x20dynamically\x20at\x20Guard\x20trigger\x20time\x20(alloc_by_guard\x20call).\x20'+'\x0a\x0a'+'true\x20=\x20value\x20is\x20submitted\x20by\x20the\x20caller\x20when\x20triggering\x20the\x20Guard.\x20'+'Use\x20for\x20runtime-context-dependent\x20values\x20like\x20order\x20address,\x20user\x20address.\x20'+'The\x20\x27value\x27\x20field\x20is\x20ignored\x20when\x20b_submission=true;\x20the\x20caller\x20must\x20provide\x20it\x20via\x20submissions[].\x20'+'\x0a\x0a'+'false\x20=\x20value\x20is\x20static,\x20set\x20at\x20Guard\x20creation\x20time.\x20'+'Use\x20for\x20values\x20known\x20when\x20the\x20Guard\x20is\x20created:\x20expected\x20node\x20names,\x20expected\x20merchant\x20address,\x20expected\x20service\x20address.\x20'+'The\x20\x27value\x27\x20field\x20must\x20be\x20populated\x20and\x20will\x20be\x20stored\x20on-chain\x20permanently.\x20'+'\x0a\x0a'+'Rule\x20of\x20thumb:\x20if\x20the\x20value\x20is\x20the\x20SAME\x20for\x20all\x20future\x20Guard\x20triggers,\x20use\x20false.\x20'+'If\x20the\x20value\x20DIFFERS\x20per\x20trigger\x20(e.g.,\x20which\x20order\x20to\x20release\x20funds\x20for),\x20use\x20true.'),'value_type':ValueTypeUserSchema['describe']('Type\x20of\x20the\x20value\x20stored\x20in\x20`value`.\x20One\x20of:\x20Bool(0),\x20Address(1),\x20String(2),\x20U8(3),\x20U16(4),\x20U32(5),\x20U64(6),\x20U128(7),\x20U256(8),\x20VecBool(9),\x20VecAddress(10),\x20VecString(11),\x20VecU8(12),\x20VecU16(13),\x20VecU32(14),\x20VecU64(15),\x20VecU128(16),\x20VecU256(17),\x20VecVecU8(18).\x20'+'When\x20value_type=Address\x20(1),\x20the\x20`value`\x20field\x20accepts\x20a\x20hex\x20address\x20string,\x20a\x20LocalMark\x20name,\x20or\x20an\x20AccountOrMark_Address\x20object\x20—\x20see\x20`value`\x20field\x20description\x20for\x20details.'),'value':SupportedValueUserSchema['optional']()['describe']('The\x20actual\x20value\x20data.\x20Format\x20depends\x20on\x20`value_type`:\x0a'+'•\x20Bool:\x20true/false\x20(boolean)\x0a'+'•\x20Address\x20(CRITICAL\x20—\x20string\x20\x27Address\x27\x20is\x20NOT\x20a\x20placeholder):\x20a\x20hex\x20address\x20(e.g.\x20\x270x1234...\x27),\x20a\x20LocalMark\x20name\x20(e.g.\x20\x27my-service\x27\x20—\x20resolved\x20to\x20address\x20at\x20evaluation\x20time),\x20an\x20AccountOrMark_Address\x20object\x20(e.g.\x20{name_or_address:\x27my-service\x27}),\x20or\x20system\x20shorthand\x20(\x270xaaa\x27\x20=\x20EntityLinker,\x20\x270xaab\x27\x20=\x20EntityRegistrar).\x20The\x20literal\x20string\x20\x27Address\x27\x20itself\x20is\x20INVALID\x20—\x20it\x20would\x20be\x20treated\x20as\x20a\x20non-existent\x20LocalMark\x20name\x20and\x20fail.\x20Example:\x20value=\x270x2::wow::WOW<address>\x27\x20or\x20value=\x27my-permission\x27.\x0a'+'•\x20String:\x20any\x20string\x0a'+'•\x20U8/U16/U32/U64/U128/U256:\x20number\x20or\x20numeric\x20string\x20(e.g.\x2042\x20or\x20\x2742\x27)\x0a'+'•\x20Vec*\x20types:\x20arrays\x20of\x20the\x20corresponding\x20element\x20type\x0a'+'REQUIRED\x20when\x20b_submission=false.\x20OPTIONAL\x20when\x20b_submission=true\x20(value\x20is\x20supplied\x20at\x20evaluation\x20time\x20by\x20user\x20submission).'),'name':z['string']()['default']('')['describe']('Data\x20name\x20identifier.\x20MAX\x2064\x20BCS\x20characters\x20(Chinese\x20chars\x20count\x20as\x203-4\x20BCS\x20bytes\x20each).\x20'+'Use\x20short\x20identifiers\x20like\x20\x27order_id\x27,\x20\x27delivery_node\x27.\x20'+'Put\x20longer\x20descriptions\x20in\x20the\x20Guard\x27s\x20\x27description\x27\x20field,\x20NOT\x20here.')})['strict']()['describe']('Guard\x20table\x20item\x20(INPUT/CREATION\x20form).\x20DO\x20NOT\x20include\x20`object_type`\x20field\x20—\x20it\x20is\x20query-output\x20only\x20and\x20will\x20be\x20rejected\x20here.');export const GuardTableItemSchema=GuardTableItemBaseSchema['extend']({'object_type':ObjectTypeSchema['optional']()['describe']('OUTPUT-ONLY\x20(query\x20side):\x20Object\x20type\x20when\x20value_type\x20is\x20Address\x20and\x20represents\x20a\x20specific\x20object.\x20Auto-derived\x20by\x20the\x20system\x20—\x20DO\x20NOT\x20set\x20this\x20field\x20at\x20Guard\x20creation.')})['strict']()['describe']('Guard\x20table\x20item\x20(QUERY/OUTPUT\x20form\x20—\x20includes\x20auto-derived\x20object_type\x20field)');export const EntrypointSchema=z['enum']([ENTRYPOINT['Localnet'],ENTRYPOINT['Testnet'],ENTRYPOINT['Mainnet']])['describe']('Network\x20entrypoint:\x20Specifies\x20which\x20network\x20the\x20operation\x20occurs\x20on.\x20'+'FIX-010\x20cross-network\x20note:\x20LocalMark\x20names\x20are\x20scoped\x20per\x20network\x20(testnet\x20marks\x20are\x20invisible\x20on\x20mainnet\x20and\x20vice\x20versa).\x20'+'When\x20migrating\x20from\x20testnet\x20to\x20mainnet,\x20recreate\x20all\x20objects\x20on\x20mainnet\x20and\x20re-register\x20LocalMark\x20names\x20with\x20the\x20SAME\x20names\x20'+'to\x20keep\x20name-based\x20references\x20working\x20across\x20networks.\x20Recreate\x20all\x20objects\x20on\x20the\x20target\x20network\x20'+'via\x20onchain_operations\x20with\x20env.network=target_network,\x20then\x20re-register\x20the\x20LocalMark\x20names.');export const FaucetNetworkSchema=z['enum']([ENTRYPOINT['Localnet'],ENTRYPOINT['Testnet']])['describe']('Network\x20entrypoint\x20for\x20Faucet:\x20Specifies\x20which\x20network\x20the\x20operation\x20occurs\x20on');export const ObjectBaseSchema=z['object']({'object':z['string']()['describe']('Object\x20ID'),'type':ObjectTypeSchema['optional']()['describe']('Object\x20type'),'type_raw':z['string']()['optional']()['describe']('Raw\x20object\x20type'),'owner':z['union']([ObjectOwnerSchema,z['null']()])['optional']()['describe']('Object\x20owner'),'version':z['union']([z['string'](),z['number']()])['optional']()['describe']('Object\x20version'),'previousTransaction':z['string']()['optional']()['describe']('Previous\x20transaction\x20ID'),'cache_expire':CacheExpireTypeSchema['optional']()['describe']('Cache\x20expiration\x20time'),'query_name':z['string']()['optional']()['describe']('Original\x20query\x20name\x20or\x20address\x20used\x20to\x20retrieve\x20this\x20object'),'content_raw':z['any']()['optional']()['describe']('Raw\x20content\x20data\x20for\x20unknown\x20object\x20types'),'_guard_node_comments':z['array'](z['object']({'type':z['string'](),'description':z['string']()}))['optional']()['describe']('Additional\x20comments\x20for\x20Guard\x20node\x20instructions')})['passthrough']()['describe']('Object\x20base\x20information');export const QueryEnvSchema=z['object']({'no_cache':z['boolean']()['optional']()['describe']('Whether\x20to\x20disable\x20cache'),'network':EntrypointSchema['optional']()})['strict']()['describe']('Query\x20environment\x20parameters');export const ReceivedBalanceObjectSchema=z['object']({'id':z['string']()['describe']('Received\x20CoinWrapper\x20object\x20ID'),'balance':BalanceTypeSchema,'payment':z['string']()['describe']('Payment\x20object\x20ID'),'type':z['string']()['optional']()['describe']('Type\x20of\x20the\x20received\x20object\x20(or\x20inner\x20coin\x20type);\x20used\x20for\x20token_type\x20detection'),'version':z['string']()['optional']()['describe']('Object\x20version,\x20required\x20to\x20build\x20a\x20Receiving<T>\x20argument\x20for\x20owner_receive'),'digest':z['string']()['optional']()['describe']('Object\x20digest,\x20required\x20to\x20build\x20a\x20Receiving<T>\x20argument\x20for\x20owner_receive')})['strict']()['describe']('Received\x20CoinWrapper\x20object\x20record');export const CoinWrapperTokenTypeSchema=z['string']()['refine'](a=>{const b=a['match'](/^CoinWrapper<(.+)>$/);if(b){const g=b[0x1];if(g===WOW_TOKEN_TYPE)return!![];const h=g['split']('::');if(h['length']!==0x3)return![];const [i,j,k]=h;if(!isValidWowAddress(i))return![];if(!isValidMoveIdentifier(j))return![];if(!isValidMoveIdentifier(k))return![];return!![];}if(a===WOW_TOKEN_TYPE)return!![];const c=a['split']('::');if(c['length']!==0x3)return![];const [d,e,f]=c;if(!isValidWowAddress(d))return![];if(!isValidMoveIdentifier(e))return![];if(!isValidMoveIdentifier(f))return![];return!![];},{'message':'Invalid\x20token\x20type\x20format.\x20Expected:\x20CoinWrapper<{address}::{module}::{struct}>\x20or\x20{address}::{module}::{struct}.\x20Example:\x20CoinWrapper<0x2::wow::WOW>\x20or\x200x2::wow::WOW'})['describe']('Token\x20type\x20in\x20format:\x20CoinWrapper<{address}::{module}::{struct}>\x20or\x20{address}::{module}::{struct}.\x20Example:\x20CoinWrapper<0x2::wow::WOW>');export const ReceivedBalanceSchema=z['object']({'balance':BalanceTypeSchema,'token_type':CoinWrapperTokenTypeSchema['describe']('Asset\x20type\x20of\x20Coin\x20objects.\x20Supports\x20CoinWrapper<...>\x20format\x20for\x20order\x20receive\x20operations.'),'received':z['array'](ReceivedBalanceObjectSchema)['describe']('Received\x20records\x20of\x20Coin\x20objects')})['strict']()['describe']('Received\x20record\x20of\x20Coin\x20objects');export const ReceivedBalanceOrRecentlySchema=z['union']([ReceivedBalanceSchema,z['literal']('recently')])['describe']('Specified\x20received\x20balance\x20record\x20or\x20all\x20recently\x20received\x20balance\x20record');export const ReceivedNormalSchema=z['object']({'id':z['string']()['nonempty']()['describe']('Received\x20object\x20ID'),'type':z['string']()['nonempty']()['describe']('Object\x20type'),'content_raw':z['any']()['optional']()['describe']('Raw\x20content\x20data'),'version':z['string']()['optional']()['describe']('Object\x20version,\x20required\x20to\x20build\x20a\x20Receiving<T>\x20argument\x20for\x20owner_receive'),'digest':z['string']()['optional']()['describe']('Object\x20digest,\x20required\x20to\x20build\x20a\x20Receiving<T>\x20argument\x20for\x20owner_receive')})['strict']()['describe']('Received\x20normal\x20object\x20record');export const ReceivedObjectsOrRecentlySchema=z['union']([z['array'](ReceivedNormalSchema),ReceivedBalanceSchema,z['literal']('recently')])['describe']('Specified\x20received\x20object\x20records\x20or\x20all\x20recently\x20received\x20object\x20records');export const RECEIVE_FORMAT_BLOCK_OBJECTS='\x0a\x0aACCEPTED\x20FORMATS\x20(F-06\x20unified\x20receive\x20operation\x20block):\x0a'+'•\x20\x27recently\x27\x20(string\x20literal)\x20—\x20auto-query\x20and\x20receive\x20ALL\x20recently\x20received\x20objects.\x0a'+'\x20\x20Use\x20this\x20for\x20the\x20common\x20case:\x20\x22withdraw\x20everything\x20the\x20object\x20has\x20received.\x22\x0a'+'\x20\x20Example:\x20receive:\x20\x27recently\x27\x0a'+'•\x20ReceivedNormal[]\x20(array)\x20—\x20explicit\x20list\x20of\x20received\x20objects\x20to\x20unwrap.\x0a'+'\x20\x20Use\x20this\x20when\x20you\x20want\x20to\x20receive\x20specific\x20objects\x20only\x20(not\x20all).\x0a'+'\x20\x20Example:\x20receive:\x20[{id:\x20\x270xobj1\x27,\x20type:\x20\x270x2::coin::Coin<0x2::wow::WOW>\x27}]\x0a'+'•\x20ReceivedBalance\x20({token_type,\x20balance,\x20received:\x20[{id,\x20balance,\x20payment}]})\x20—\x0a'+'\x20\x20receive\x20a\x20balance\x20record\x20from\x20a\x20specific\x20Payment/payer.\x0a'+'\x20\x20Use\x20this\x20for\x20precise\x20balance\x20targeting\x20(advanced\x20—\x20usually\x20after\x20querying\x0a'+'\x20\x20the\x20object\x27s\x20received\x20history\x20via\x20query_received).\x0a'+'\x20\x20Example:\x20receive:\x20{token_type:\x20\x270x2::wow::WOW\x27,\x20balance:\x201000000,\x20received:\x20[{id:\x20\x270xrec1\x27,\x20balance:\x201000000,\x20payment:\x20\x270xpay1\x27}]}\x0a'+'ANTI-PATTERN:\x20do\x20NOT\x20wrap\x20in\x20{result:\x20...}\x20—\x20pass\x20the\x20value\x20directly.';export const RECEIVE_FORMAT_BLOCK_BALANCE='\x0a\x0aACCEPTED\x20FORMATS\x20(F-06\x20unified\x20receive\x20operation\x20block):\x0a'+'•\x20\x27recently\x27\x20(string\x20literal)\x20—\x20auto-query\x20and\x20receive\x20ALL\x20recently\x20received\x20balance.\x0a'+'\x20\x20Use\x20this\x20for\x20the\x20common\x20case:\x20\x22deposit\x20all\x20recently\x20received\x20coins\x20into\x20pending\x20balance.\x22\x0a'+'\x20\x20Example:\x20receive:\x20\x27recently\x27\x0a'+'•\x20ReceivedBalance\x20({token_type,\x20balance,\x20received:\x20[{id,\x20balance,\x20payment}]})\x20—\x0a'+'\x20\x20receive\x20a\x20specific\x20balance\x20record\x20from\x20a\x20Payment/payer.\x0a'+'\x20\x20Use\x20this\x20when\x20targeting\x20a\x20specific\x20received\x20balance\x20(advanced).\x0a'+'\x20\x20Example:\x20receive:\x20{token_type:\x20\x270x2::wow::WOW\x27,\x20balance:\x201000000,\x20received:\x20[{id:\x20\x270xrec1\x27,\x20balance:\x201000000,\x20payment:\x20\x270xpay1\x27}]}\x0a'+'ANTI-PATTERN:\x20do\x20NOT\x20wrap\x20in\x20{result:\x20...}\x20—\x20pass\x20the\x20value\x20directly.';export const QueryReceivedResultSchema=z['object']({'result':z['union']([ReceivedBalanceSchema,z['array'](ReceivedNormalSchema)])['describe']('Received\x20CoinWrapper\x20object\x20record\x20or\x20received\x20other\x20objects\x20array')})['strict']()['describe']('Query\x20received\x20result');
|
|
1
|
+
import{z}from'zod';import{isValidAddress,ValueType as a360a,ObjectType as a360b,ENTRYPOINT,isValidWowAddress,isValidName,isValidDescription,MAX_DESCRIPTION_LENGTH,isValidLongName,MAX_LONG_NAME_LENGTH}from'@wowok/wowok';const isValidMoveIdentifier=a=>{if(a['length']===0x0)return![];const b=a[0x0];if(b==='_')return a['length']>0x1&&/^[a-zA-Z0-9_]+$/['test'](a['slice'](0x1));if(/^[a-zA-Z]$/['test'](b))return/^[a-zA-Z0-9_]*$/['test'](a['slice'](0x1));return![];};export const DescriptionSchema=z['string']()['trim']()['refine'](isValidDescription,{'message':'Description\x20string\x20(max\x20'+MAX_DESCRIPTION_LENGTH+'\x20bcs\x20characters)'})['describe']('Description\x20string\x20(max\x20'+MAX_DESCRIPTION_LENGTH+'\x20bcs\x20characters)');export const LongNameSchema=z['string']()['refine'](isValidLongName,{'message':'max\x20'+MAX_LONG_NAME_LENGTH+'\x20bcs\x20characters'});export const WowAddressSchema=z['string']()['refine'](isValidAddress,{'message':'Invalid\x20ID\x20format:\x20must\x20be\x20\x270x\x27\x20prefix\x20followed\x20by\x2064\x20hex\x20characters'})['describe']('Valid\x20ID:\x200x\x20prefix\x20+\x2064\x20hex\x20characters,\x20or\x20builtin\x20ID\x20(0x5-0x9,\x200xa,\x200xc,\x200xd,\x200x403,\x200xaaa,\x200xaab,\x200xacc)');const WOW_TOKEN_TYPE='0x2::wow::WOW';export const TokenTypeSchema=z['string']()['refine'](a=>{if(a===WOW_TOKEN_TYPE)return!![];const b=a['split']('::');if(b['length']!==0x3)return![];const [c,d,e]=b;if(!isValidWowAddress(c))return![];if(!isValidMoveIdentifier(d))return![];if(!isValidMoveIdentifier(e))return![];return!![];},{'message':'Invalid\x20token\x20type\x20format.\x20Expected:\x20{address}::{module}::{struct}\x20where\x20address\x20is\x200x+64hex,\x20module/struct\x20are\x20valid\x20Move\x20identifiers,\x20or\x20\x270x2::wow::WOW\x27'})['describe']('Token\x20type\x20in\x20format:\x20{address}::{module}::{struct}.\x20e.g.\x20\x270x2::wow::WOW\x27\x20(WOW),\x20\x270x...::usdt::USDT\x27\x20(USDT),\x20\x270x...::eth::ETH\x27\x20(ETH).\x20To\x20discover\x20all\x20available\x20tokens\x20and\x20their\x20type\x20tags,\x20query\x20\x27mainnet\x20bridge\x20tokens\x27\x20via\x20wowok_buildin_info\x20and\x20use\x20the\x20returned\x20`wowTypeTag`\x20here.');export const TokenTypeWithDefaultSchema=TokenTypeSchema['default'](WOW_TOKEN_TYPE)['describe']('Token\x20type\x20in\x20format:\x20{address}::{module}::{struct}.\x20Default:\x20\x270x2::wow::WOW\x27.\x20Other\x20examples:\x20\x270x...::usdt::USDT\x27\x20(USDT),\x20\x270x...::eth::ETH\x27\x20(ETH).\x20To\x20discover\x20all\x20available\x20tokens\x20and\x20their\x20type\x20tags,\x20query\x20\x27mainnet\x20bridge\x20tokens\x27\x20via\x20wowok_buildin_info\x20and\x20use\x20the\x20returned\x20`wowTypeTag`\x20here.');export const NameSchema=z['string']()['refine'](isValidName,'Name\x20string\x20(max\x2064\x20bcs\x20characters,\x20must\x20not\x20start\x20with\x20\x270x\x27)');export const NotEmptyNameSchema=z['string']()['nonempty']()['refine'](isValidName,'Name\x20string\x20(at\x20least\x201\x20character,\x20max\x20length\x2064\x20bcs\x20characters)');export const NameOrAddressSchema=z['string']()['refine'](a=>{if(isValidAddress(a))return!![];if(isValidName(a))return!![];return![];},{'message':'Invalid\x20ID\x20format:\x20must\x20be\x20\x270x\x27\x20prefix,\x20or\x20a\x20builtin\x20ID\x20(0x5-0x9,\x200xa,\x200xc,\x200xd,\x200x403,\x200xaaa,\x200xaab,\x200xacc)'})['describe']('Account/Object\x20name\x20or\x20ID.\x20If\x20specifying\x20an\x20account,\x20use\x20empty\x20string\x20\x27\x27\x20for\x20the\x20default\x20account.\x20'+'If\x20it\x20starts\x20with\x20\x270x\x27,\x20it\x20will\x20be\x20treated\x20as\x20an\x20ID.\x20'+'Otherwise,\x20it\x20will\x20be\x20treated\x20as\x20a\x20name\x20(max\x2064\x20bcs\x20characters).');export const AccountOrMark_AddressSchema=z['object']({'name_or_address':NameOrAddressSchema['optional'](),'local_mark_first':z['boolean']()['optional']()['describe']('Whether\x20to\x20prioritize\x20local\x20marks,\x20if\x20true,\x20prioritize\x20local\x20marks,\x20otherwise\x20prioritize\x20global\x20marks')})['strict']()['describe']('Account\x20or\x20address\x20lookup\x20object.\x20Use\x20this\x20to\x20specify\x20which\x20account\x20to\x20use\x20for\x20an\x20operation.\x20'+'EXAMPLE:\x20{\x20name_or_address:\x20\x27testor2\x27\x20}\x20-\x20looks\x20up\x20account\x20by\x20name;\x20'+'EXAMPLE:\x20{\x20name_or_address:\x20\x270x1234...\x27\x20}\x20-\x20uses\x20address\x20directly;\x20'+'If\x20name_or_address\x20is\x20empty\x20string\x20\x27\x27,\x20uses\x20the\x20default\x20local\x20account.');export const ManyAccountOrMark_AddressSchema=z['object']({'entities':z['array'](AccountOrMark_AddressSchema),'check_all_founded':z['boolean']()['optional']()['describe']('Whether\x20to\x20check\x20all\x20entities\x20are\x20found,\x20if\x20true,\x20all\x20entities\x20must\x20be\x20found\x20(abort\x20and\x20throw\x20exception\x20if\x20any\x20ID\x20not\x20found);\x20if\x20false,\x20only\x20return\x20found\x20IDs')})['strict']()['describe']('Used\x20to\x20batch\x20find\x20account\x20or\x20object\x20IDs\x20by\x20name');export const AccountOrMark_AddressAISchema=z['union']([NameOrAddressSchema['transform'](a=>({'name_or_address':a,'local_mark_first':!![]}))['describe']('Account\x20name,\x20address\x20(0x...),\x20or\x20mark\x20name.\x20'+'When\x20using\x20string\x20format,\x20local\x20marks\x20are\x20searched\x20first.\x20'+'EXAMPLE:\x20\x27alice\x27\x20-\x20searches\x20local\x20marks\x20first,\x20then\x20global;\x20'+'EXAMPLE:\x20\x270x2...\x27\x20(64\x20hex\x20chars)\x20-\x20uses\x20address\x20directly;\x20'+'EXAMPLE:\x20\x27\x27\x20-\x20uses\x20the\x20default\x20local\x20account'),AccountOrMark_AddressSchema])['describe']('Account\x20or\x20address\x20lookup.\x20Can\x20be\x20a\x20simple\x20string\x20(recommended\x20for\x20AI)\x20'+'or\x20full\x20object\x20with\x20explicit\x20local_mark_first\x20control.\x20'+'String\x20form\x20auto-converts\x20to\x20{\x20name_or_address:\x20<string>,\x20local_mark_first:\x20true\x20}.');export const ManyAccountOrMark_AddressAISchema=z['union']([z['array'](NameOrAddressSchema)['transform'](a=>({'entities':a['map'](b=>({'name_or_address':b,'local_mark_first':!![]})),'check_all_founded':!![]}))['describe']('Array\x20of\x20account\x20names,\x20addresses,\x20or\x20mark\x20names.\x20'+'Local\x20marks\x20are\x20searched\x20first\x20for\x20each\x20entry.\x20'+'EXAMPLE:\x20[\x27alice\x27,\x20\x270x2...\x27,\x20\x27bob\x27]'),ManyAccountOrMark_AddressSchema])['describe']('Batch\x20account\x20or\x20address\x20lookup.\x20Can\x20be\x20an\x20array\x20of\x20strings\x20(recommended\x20for\x20AI)\x20'+'or\x20full\x20object\x20with\x20explicit\x20control.\x20'+'Array\x20form\x20auto-converts\x20to\x20{\x20entities:\x20[...],\x20check_all_founded:\x20true\x20}.');export const ObjectOwnerSchema=z['union']([z['object']({'AddressOwner':z['string']()['describe']('Address\x20owner')})['strict'](),z['object']({'ObjectOwner':z['string']()['describe']('Object\x20owner')})['strict'](),z['object']({'Shared':z['object']({'initial_shared_version':z['union']([z['string'](),z['number']()])['describe']('Version\x20when\x20object\x20became\x20shared')})['strict']()['describe']('Shared\x20object')})['strict'](),z['literal']('Immutable'),z['object']({'ConsensusAddressOwner':z['object']({'owner':z['string']()['describe']('Consensus\x20ID\x20owner'),'start_version':z['union']([z['string'](),z['number']()])['describe']('Version\x20when\x20object\x20recently\x20became\x20consensus\x20object')})['strict']()['describe']('Consensus\x20ID\x20owner')})['strict']()])['describe']('Object\x20owner');export const ValueTypeUserSchema=z['union']([z['literal'](a360a['Bool'])['describe']('Bool\x20(0)'),z['literal'](a360a['Address'])['describe']('Address\x20(1)'),z['literal'](a360a['String'])['describe']('String\x20(2)'),z['literal'](a360a['U8'])['describe']('U8\x20(3)'),z['literal'](a360a['U16'])['describe']('U16\x20(4)'),z['literal'](a360a['U32'])['describe']('U32\x20(5)'),z['literal'](a360a['U64'])['describe']('U64\x20(6)'),z['literal'](a360a['U128'])['describe']('U128\x20(7)'),z['literal'](a360a['U256'])['describe']('U256\x20(8)'),z['literal'](a360a['VecBool'])['describe']('VecBool\x20(9)'),z['literal'](a360a['VecAddress'])['describe']('VecAddress\x20(10)'),z['literal'](a360a['VecString'])['describe']('VecString\x20(11)'),z['literal'](a360a['VecU8'])['describe']('VecU8\x20(12)'),z['literal'](a360a['VecU16'])['describe']('VecU16\x20(13)'),z['literal'](a360a['VecU32'])['describe']('VecU32\x20(14)'),z['literal'](a360a['VecU64'])['describe']('VecU64\x20(15)'),z['literal'](a360a['VecU128'])['describe']('VecU128\x20(16)'),z['literal'](a360a['VecU256'])['describe']('VecU256\x20(17)'),z['literal'](a360a['VecVecU8'])['describe']('VecVecU8\x20(18)'),z['literal']('Bool')['describe']('Bool'),z['literal']('Address')['describe']('Address'),z['literal']('String')['describe']('String'),z['literal']('U8')['describe']('U8'),z['literal']('U16')['describe']('U16'),z['literal']('U32')['describe']('U32'),z['literal']('U64')['describe']('U64'),z['literal']('U128')['describe']('U128'),z['literal']('U256')['describe']('U256'),z['literal']('VecBool')['describe']('VecBool'),z['literal']('VecAddress')['describe']('VecAddress'),z['literal']('VecString')['describe']('VecString'),z['literal']('VecU8')['describe']('VecU8'),z['literal']('VecU16')['describe']('VecU16'),z['literal']('VecU32')['describe']('VecU32'),z['literal']('VecU64')['describe']('VecU64'),z['literal']('VecU128')['describe']('VecU128'),z['literal']('VecU256')['describe']('VecU256'),z['literal']('VecVecU8')['describe']('VecVecU8'),z['literal']('bool')['describe']('bool'),z['literal']('address')['describe']('address'),z['literal']('string')['describe']('string'),z['literal']('u8')['describe']('u8'),z['literal']('u16')['describe']('u16'),z['literal']('u32')['describe']('u32'),z['literal']('u64')['describe']('u64'),z['literal']('u128')['describe']('u128'),z['literal']('u256')['describe']('u256'),z['literal']('vecbool')['describe']('vecbool'),z['literal']('vecaddress')['describe']('vecaddress'),z['literal']('vecstring')['describe']('vecstring'),z['literal']('vecu8')['describe']('vecu8'),z['literal']('vecu16')['describe']('vecu16'),z['literal']('vecu32')['describe']('vecu32'),z['literal']('vecu64')['describe']('vecu64'),z['literal']('vecu128')['describe']('vecu128'),z['literal']('vecu256')['describe']('vecu256'),z['literal']('vecvecu8')['describe']('vecvecu8')])['describe']('User\x20available\x20value\x20type\x20(number\x20or\x20string,\x20e.g.,\x206\x20or\x20\x27U64\x27\x20or\x20\x27u64\x27)');export const ValueTypeSchema=ValueTypeUserSchema['or'](z['literal'](a360a['Value'])['describe']('Value\x20(19)'))['or'](z['literal']('Value')['describe']('Value'))['describe']('Value\x20type\x20(number\x20or\x20string,\x20e.g.,\x206\x20or\x20\x27U64\x27)');export const ObjectTypeSchema=z['enum']([a360b['Permission'],a360b['Repository'],a360b['Arb'],a360b['Arbitration'],a360b['Service'],a360b['Machine'],a360b['Order'],a360b['Progress'],a360b['Payment'],a360b['Treasury'],a360b['Guard'],a360b['Demand'],a360b['Passport'],a360b['Allocation'],a360b['Resource'],a360b['Reward'],a360b['Discount'],a360b['EntityRegistrar'],a360b['EntityLinker'],a360b['Proof'],a360b['WReceivedObject'],a360b['Contact'],a360b['TableItem_ProgressHistory'],a360b['TableItem_PermissionPerm'],a360b['TableItem_DemandPresenter'],a360b['TableItem_MachineNode'],a360b['TableItem_TreasuryHistory'],a360b['TableItem_RepositoryData'],a360b['TableItem_RewardRecord'],a360b['TableItem_EntityLinker'],a360b['TableItem_AddressMark'],a360b['TableItem_EntityRegistrar']])['describe']('Wowok\x20object\x20type');export const BalanceTypeSchema=z['union']([z['number'](),z['string']()])['describe']('A\x20coin/balance\x20amount.\x20Accepts\x20three\x20formats:\x20'+'(1)\x20DISPLAY\x20FORMAT\x20with\x20token\x20symbol:\x20\x222.5WOW\x22,\x20\x2210USDC\x22,\x20\x220.05WOW\x22\x20—\x20'+'auto-converted\x20to\x20smallest\x20units\x20via\x20the\x20Fund\x20Processing\x20Layer\x20(token\x20precision\x20resolved\x20'+'from\x20official\x20registry\x20→\x20cache\x20→\x20on-chain).\x20The\x20symbol\x20MUST\x20match\x20the\x20token\x27s\x20type_parameter.\x20'+'(2)\x20SMALLEST\x20UNIT\x20(numeric\x20string):\x20\x2210000000000\x22\x20—\x20used\x20as-is,\x20no\x20conversion.\x20'+'(3)\x20SMALLEST\x20UNIT\x20(number):\x2010000000000\x20—\x20used\x20as-is\x20only\x20within\x20the\x20safe\x20integer\x20range\x20(±2^53);\x20numbers\x20outside\x20it\x20are\x20REJECTED,\x20use\x20a\x20numeric\x20string\x20instead.\x20'+'PRECISION\x20RULE:\x20for\x20values\x20exceeding\x202^53\x20(9007199254740991),\x20ALWAYS\x20use\x20format\x20(1)\x20or\x20(2)\x20—\x20JS\x20numbers\x20lose\x20integer\x20precision\x20silently\x20and\x20such\x20inputs\x20are\x20blocked.\x20'+'Raw\x20amounts\x20must\x20be\x20plain\x20non-negative\x20integers;\x20a\x20decimal\x20value\x20without\x20a\x20token\x20symbol\x20(e.g.\x20\x222.5\x22)\x20is\x20rejected\x20—\x20append\x20the\x20symbol\x20(\x222.5WOW\x22)\x20so\x20the\x20Fund\x20Processing\x20Layer\x20converts\x20it.\x20'+'Default\x20token:\x20WOW\x20(9\x20decimals,\x201\x20WOW\x20=\x2010^9\x20MIST).\x20'+'For\x20custom\x20tokens:\x20use\x20display\x20format\x20with\x20the\x20token\x27s\x20symbol,\x20or\x20pass\x20smallest\x20units\x20directly.\x20'+'MONEY\x20CONFIRMATION:\x20all\x20monetary\x20fields\x20trigger\x20user\x20confirmation\x20via\x20the\x20Fund\x20Processing\x20Layer,\x20where\x20the\x20token\x27s\x20FULL\x20type,\x20decimals\x20and\x20raw\x20amount\x20are\x20always\x20visible.\x20'+'MULTIPLE\x20ISSUERS:\x20several\x20on-chain\x20tokens\x20may\x20legally\x20share\x20the\x20same\x20symbol\x20(e.g.\x20multiple\x20\x22USDT\x22\x20coins).\x20When\x20a\x20bare\x20symbol\x20matches\x20more\x20than\x20one\x20token,\x20the\x20operation\x20is\x20BLOCKED\x20and\x20every\x20candidate\x20is\x20listed\x20with\x20full\x20details\x20(type,\x20name,\x20decimals,\x20verified\x20tag)\x20—\x20present\x20the\x20list\x20to\x20the\x20USER\x20and\x20let\x20them\x20choose\x20(they\x20may\x20answer\x20by\x20number),\x20then\x20re-issue\x20with\x20the\x20chosen\x20token\x27s\x20FULL\x20type\x20string\x20in\x20type_parameter;\x20never\x20guess\x20an\x20issuer\x20from\x20the\x20bare\x20symbol.\x20'+'MISSING\x20TOKEN\x20INFO:\x20when\x20a\x20token\x27s\x20precision\x20cannot\x20be\x20resolved,\x20the\x20operation\x20is\x20REFUSED\x20(raw\x20u64\x20included\x20—\x20amount\x20magnitude\x20could\x20not\x20be\x20verified).\x20Recovery:\x20provide\x20the\x20token\x27s\x20FULL\x20type\x20in\x20package::module::Name\x20form\x20in\x20type_parameter\x20(a\x20bare\x20symbol\x20like\x20\x22USDT\x22\x20cannot\x20be\x20resolved),\x20and\x20verify\x20the\x20WOW\x20network\x20is\x20correct.\x20'+'Examples:\x20\x222.5WOW\x22\x20(display\x20→\x202500000000),\x2010000000000\x20(number,\x20smallest\x20unit),\x20\x2250000000000\x22\x20(string,\x20smallest\x20unit).\x20'+'Used\x20for:\x20Service.sale.price,\x20Service.compensation_fund_add\x20balance,\x20Treasury.deposit,\x20Arbitration.fee,\x20Reward.amount,\x20stock\x20quantities.');export const QueryIdSchema=z['number']()['int']()['min'](0x0)['describe']('Query\x20ID');export const CacheExpireTypeSchema=z['union']([z['number'](),z['literal']('INFINITE')])['describe']('Cache\x20expiration\x20time\x20type');export const ValueContainerSchema=z['lazy'](()=>z['object']({'valueType':ValueTypeSchema['describe']('Value\x20type'),'value':SupportedValueSchema['describe']('Value')})['strict']()['describe']('Value\x20container\x20with\x20type\x20and\x20value'));export const SupportedValueUserSchema=z['union']([z['boolean'](),z['union']([AccountOrMark_AddressSchema,z['string']()]),z['string'](),z['number'](),z['array'](z['boolean']()),z['union']([ManyAccountOrMark_AddressSchema,z['array'](z['string']())]),z['array'](z['string']()),z['array'](z['number']()),z['array'](z['array'](z['number']()))])['describe']('User\x20available\x20supported\x20value\x20type');export const SupportedValueSchema=SupportedValueUserSchema['or'](ValueContainerSchema)['describe']('Supported\x20value\x20type');export const GuardIdentifierSchema=z['number']()['int']()['min'](0x0)['max'](0xff)['describe']('Identifier\x20(0-255)\x20for\x20data\x20lookup\x20in\x20Guard\x20table.');export const GuardTableItemBaseSchema=z['object']({'identifier':GuardIdentifierSchema,'b_submission':z['boolean']()['describe']('Whether\x20this\x20table\x20item\x27s\x20value\x20is\x20submitted\x20dynamically\x20at\x20Guard\x20trigger\x20time\x20(alloc_by_guard\x20call).\x20'+'\x0a\x0a'+'true\x20=\x20value\x20is\x20submitted\x20by\x20the\x20caller\x20when\x20triggering\x20the\x20Guard.\x20'+'Use\x20for\x20runtime-context-dependent\x20values\x20like\x20order\x20address,\x20user\x20address.\x20'+'The\x20\x27value\x27\x20field\x20is\x20ignored\x20when\x20b_submission=true;\x20the\x20caller\x20must\x20provide\x20it\x20via\x20submissions[].\x20'+'\x0a\x0a'+'false\x20=\x20value\x20is\x20static,\x20set\x20at\x20Guard\x20creation\x20time.\x20'+'Use\x20for\x20values\x20known\x20when\x20the\x20Guard\x20is\x20created:\x20expected\x20node\x20names,\x20expected\x20merchant\x20address,\x20expected\x20service\x20address.\x20'+'The\x20\x27value\x27\x20field\x20must\x20be\x20populated\x20and\x20will\x20be\x20stored\x20on-chain\x20permanently.\x20'+'\x0a\x0a'+'Rule\x20of\x20thumb:\x20if\x20the\x20value\x20is\x20the\x20SAME\x20for\x20all\x20future\x20Guard\x20triggers,\x20use\x20false.\x20'+'If\x20the\x20value\x20DIFFERS\x20per\x20trigger\x20(e.g.,\x20which\x20order\x20to\x20release\x20funds\x20for),\x20use\x20true.'),'value_type':ValueTypeUserSchema['describe']('Type\x20of\x20the\x20value\x20stored\x20in\x20`value`.\x20One\x20of:\x20Bool(0),\x20Address(1),\x20String(2),\x20U8(3),\x20U16(4),\x20U32(5),\x20U64(6),\x20U128(7),\x20U256(8),\x20VecBool(9),\x20VecAddress(10),\x20VecString(11),\x20VecU8(12),\x20VecU16(13),\x20VecU32(14),\x20VecU64(15),\x20VecU128(16),\x20VecU256(17),\x20VecVecU8(18).\x20'+'When\x20value_type=Address\x20(1),\x20the\x20`value`\x20field\x20accepts\x20a\x20hex\x20address\x20string,\x20a\x20LocalMark\x20name,\x20or\x20an\x20AccountOrMark_Address\x20object\x20—\x20see\x20`value`\x20field\x20description\x20for\x20details.'),'value':SupportedValueUserSchema['optional']()['describe']('The\x20actual\x20value\x20data.\x20Format\x20depends\x20on\x20`value_type`:\x0a'+'•\x20Bool:\x20true/false\x20(boolean)\x0a'+'•\x20Address\x20(CRITICAL\x20—\x20string\x20\x27Address\x27\x20is\x20NOT\x20a\x20placeholder):\x20a\x20hex\x20address\x20(e.g.\x20\x270x1234...\x27),\x20a\x20LocalMark\x20name\x20(e.g.\x20\x27my-service\x27\x20—\x20resolved\x20to\x20address\x20at\x20evaluation\x20time),\x20an\x20AccountOrMark_Address\x20object\x20(e.g.\x20{name_or_address:\x27my-service\x27}),\x20or\x20system\x20shorthand\x20(\x270xaaa\x27\x20=\x20EntityLinker,\x20\x270xaab\x27\x20=\x20EntityRegistrar).\x20The\x20literal\x20string\x20\x27Address\x27\x20itself\x20is\x20INVALID\x20—\x20it\x20would\x20be\x20treated\x20as\x20a\x20non-existent\x20LocalMark\x20name\x20and\x20fail.\x20Example:\x20value=\x270x2::wow::WOW<address>\x27\x20or\x20value=\x27my-permission\x27.\x0a'+'•\x20String:\x20any\x20string\x0a'+'•\x20U8/U16/U32/U64/U128/U256:\x20number\x20or\x20numeric\x20string\x20(e.g.\x2042\x20or\x20\x2742\x27)\x0a'+'•\x20Vec*\x20types:\x20arrays\x20of\x20the\x20corresponding\x20element\x20type\x0a'+'REQUIRED\x20when\x20b_submission=false.\x20OPTIONAL\x20when\x20b_submission=true\x20(value\x20is\x20supplied\x20at\x20evaluation\x20time\x20by\x20user\x20submission).'),'name':z['string']()['default']('')['describe']('Data\x20name\x20identifier.\x20MAX\x2064\x20BCS\x20characters\x20(Chinese\x20chars\x20count\x20as\x203-4\x20BCS\x20bytes\x20each).\x20'+'Use\x20short\x20identifiers\x20like\x20\x27order_id\x27,\x20\x27delivery_node\x27.\x20'+'Put\x20longer\x20descriptions\x20in\x20the\x20Guard\x27s\x20\x27description\x27\x20field,\x20NOT\x20here.')})['strict']()['describe']('Guard\x20table\x20item\x20(INPUT/CREATION\x20form).\x20DO\x20NOT\x20include\x20`object_type`\x20field\x20—\x20it\x20is\x20query-output\x20only\x20and\x20will\x20be\x20rejected\x20here.');export const GuardTableItemSchema=GuardTableItemBaseSchema['extend']({'object_type':ObjectTypeSchema['optional']()['describe']('OUTPUT-ONLY\x20(query\x20side):\x20Object\x20type\x20when\x20value_type\x20is\x20Address\x20and\x20represents\x20a\x20specific\x20object.\x20Auto-derived\x20by\x20the\x20system\x20—\x20DO\x20NOT\x20set\x20this\x20field\x20at\x20Guard\x20creation.')})['strict']()['describe']('Guard\x20table\x20item\x20(QUERY/OUTPUT\x20form\x20—\x20includes\x20auto-derived\x20object_type\x20field)');export const EntrypointSchema=z['enum']([ENTRYPOINT['Localnet'],ENTRYPOINT['Testnet'],ENTRYPOINT['Mainnet']])['describe']('Network\x20entrypoint:\x20Specifies\x20which\x20network\x20the\x20operation\x20occurs\x20on.\x20'+'FIX-010\x20cross-network\x20note:\x20LocalMark\x20names\x20are\x20scoped\x20per\x20network\x20(testnet\x20marks\x20are\x20invisible\x20on\x20mainnet\x20and\x20vice\x20versa).\x20'+'When\x20migrating\x20from\x20testnet\x20to\x20mainnet,\x20recreate\x20all\x20objects\x20on\x20mainnet\x20and\x20re-register\x20LocalMark\x20names\x20with\x20the\x20SAME\x20names\x20'+'to\x20keep\x20name-based\x20references\x20working\x20across\x20networks.\x20Recreate\x20all\x20objects\x20on\x20the\x20target\x20network\x20'+'via\x20onchain_operations\x20with\x20env.network=target_network,\x20then\x20re-register\x20the\x20LocalMark\x20names.');export const FaucetNetworkSchema=z['enum']([ENTRYPOINT['Localnet'],ENTRYPOINT['Testnet']])['describe']('Network\x20entrypoint\x20for\x20Faucet:\x20Specifies\x20which\x20network\x20the\x20operation\x20occurs\x20on');export const ObjectBaseSchema=z['object']({'object':z['string']()['describe']('Object\x20ID'),'type':ObjectTypeSchema['optional']()['describe']('Object\x20type'),'type_raw':z['string']()['optional']()['describe']('Raw\x20object\x20type'),'owner':z['union']([ObjectOwnerSchema,z['null']()])['optional']()['describe']('Object\x20owner'),'version':z['union']([z['string'](),z['number']()])['optional']()['describe']('Object\x20version'),'previousTransaction':z['string']()['optional']()['describe']('Previous\x20transaction\x20ID'),'cache_expire':CacheExpireTypeSchema['optional']()['describe']('Cache\x20expiration\x20time'),'query_name':z['string']()['optional']()['describe']('Original\x20query\x20name\x20or\x20address\x20used\x20to\x20retrieve\x20this\x20object'),'content_raw':z['any']()['optional']()['describe']('Raw\x20content\x20data\x20for\x20unknown\x20object\x20types'),'_guard_node_comments':z['array'](z['object']({'type':z['string'](),'description':z['string']()}))['optional']()['describe']('Additional\x20comments\x20for\x20Guard\x20node\x20instructions')})['passthrough']()['describe']('Object\x20base\x20information');export const QueryEnvSchema=z['object']({'no_cache':z['boolean']()['optional']()['describe']('Whether\x20to\x20disable\x20cache'),'network':EntrypointSchema['optional']()})['strict']()['describe']('Query\x20environment\x20parameters');export const ReceivedBalanceObjectSchema=z['object']({'id':z['string']()['describe']('Received\x20CoinWrapper\x20object\x20ID'),'balance':BalanceTypeSchema,'payment':z['string']()['describe']('Payment\x20object\x20ID'),'type':z['string']()['optional']()['describe']('Type\x20of\x20the\x20received\x20object\x20(or\x20inner\x20coin\x20type);\x20used\x20for\x20token_type\x20detection'),'version':z['string']()['optional']()['describe']('Object\x20version,\x20required\x20to\x20build\x20a\x20Receiving<T>\x20argument\x20for\x20owner_receive'),'digest':z['string']()['optional']()['describe']('Object\x20digest,\x20required\x20to\x20build\x20a\x20Receiving<T>\x20argument\x20for\x20owner_receive')})['strict']()['describe']('Received\x20CoinWrapper\x20object\x20record');export const CoinWrapperTokenTypeSchema=z['string']()['refine'](a=>{const b=a['match'](/^CoinWrapper<(.+)>$/);if(b){const g=b[0x1];if(g===WOW_TOKEN_TYPE)return!![];const h=g['split']('::');if(h['length']!==0x3)return![];const [i,j,k]=h;if(!isValidWowAddress(i))return![];if(!isValidMoveIdentifier(j))return![];if(!isValidMoveIdentifier(k))return![];return!![];}if(a===WOW_TOKEN_TYPE)return!![];const c=a['split']('::');if(c['length']!==0x3)return![];const [d,e,f]=c;if(!isValidWowAddress(d))return![];if(!isValidMoveIdentifier(e))return![];if(!isValidMoveIdentifier(f))return![];return!![];},{'message':'Invalid\x20token\x20type\x20format.\x20Expected:\x20CoinWrapper<{address}::{module}::{struct}>\x20or\x20{address}::{module}::{struct}.\x20Example:\x20CoinWrapper<0x2::wow::WOW>\x20or\x200x2::wow::WOW'})['describe']('Token\x20type\x20in\x20format:\x20CoinWrapper<{address}::{module}::{struct}>\x20or\x20{address}::{module}::{struct}.\x20Example:\x20CoinWrapper<0x2::wow::WOW>');export const ReceivedBalanceSchema=z['object']({'balance':BalanceTypeSchema,'token_type':CoinWrapperTokenTypeSchema['describe']('Asset\x20type\x20of\x20Coin\x20objects.\x20Supports\x20CoinWrapper<...>\x20format\x20for\x20order\x20receive\x20operations.'),'received':z['array'](ReceivedBalanceObjectSchema)['describe']('Received\x20records\x20of\x20Coin\x20objects')})['strict']()['describe']('Received\x20record\x20of\x20Coin\x20objects');export const ReceivedBalanceOrRecentlySchema=z['union']([ReceivedBalanceSchema,z['literal']('recently')])['describe']('Specified\x20received\x20balance\x20record\x20or\x20all\x20recently\x20received\x20balance\x20record');export const ReceivedNormalSchema=z['object']({'id':z['string']()['nonempty']()['describe']('Received\x20object\x20ID'),'type':z['string']()['nonempty']()['describe']('Object\x20type'),'content_raw':z['any']()['optional']()['describe']('Raw\x20content\x20data'),'version':z['string']()['optional']()['describe']('Object\x20version,\x20required\x20to\x20build\x20a\x20Receiving<T>\x20argument\x20for\x20owner_receive'),'digest':z['string']()['optional']()['describe']('Object\x20digest,\x20required\x20to\x20build\x20a\x20Receiving<T>\x20argument\x20for\x20owner_receive')})['strict']()['describe']('Received\x20normal\x20object\x20record');export const ReceivedObjectsOrRecentlySchema=z['union']([z['array'](ReceivedNormalSchema),ReceivedBalanceSchema,z['literal']('recently')])['describe']('Specified\x20received\x20object\x20records\x20or\x20all\x20recently\x20received\x20object\x20records');export const RECEIVE_FORMAT_BLOCK_OBJECTS='\x0a\x0aACCEPTED\x20FORMATS\x20(F-06\x20unified\x20receive\x20operation\x20block):\x0a'+'•\x20\x27recently\x27\x20(string\x20literal)\x20—\x20auto-query\x20and\x20receive\x20ALL\x20recently\x20received\x20objects.\x0a'+'\x20\x20Use\x20this\x20for\x20the\x20common\x20case:\x20\x22withdraw\x20everything\x20the\x20object\x20has\x20received.\x22\x0a'+'\x20\x20Example:\x20receive:\x20\x27recently\x27\x0a'+'•\x20ReceivedNormal[]\x20(array)\x20—\x20explicit\x20list\x20of\x20received\x20objects\x20to\x20unwrap.\x0a'+'\x20\x20Use\x20this\x20when\x20you\x20want\x20to\x20receive\x20specific\x20objects\x20only\x20(not\x20all).\x0a'+'\x20\x20Example:\x20receive:\x20[{id:\x20\x270xobj1\x27,\x20type:\x20\x270x2::coin::Coin<0x2::wow::WOW>\x27}]\x0a'+'•\x20ReceivedBalance\x20({token_type,\x20balance,\x20received:\x20[{id,\x20balance,\x20payment}]})\x20—\x0a'+'\x20\x20receive\x20a\x20balance\x20record\x20from\x20a\x20specific\x20Payment/payer.\x0a'+'\x20\x20Use\x20this\x20for\x20precise\x20balance\x20targeting\x20(advanced\x20—\x20usually\x20after\x20querying\x0a'+'\x20\x20the\x20object\x27s\x20received\x20history\x20via\x20query_received).\x0a'+'\x20\x20Example:\x20receive:\x20{token_type:\x20\x270x2::wow::WOW\x27,\x20balance:\x201000000,\x20received:\x20[{id:\x20\x270xrec1\x27,\x20balance:\x201000000,\x20payment:\x20\x270xpay1\x27}]}\x0a'+'ANTI-PATTERN:\x20do\x20NOT\x20wrap\x20in\x20{result:\x20...}\x20—\x20pass\x20the\x20value\x20directly.';export const RECEIVE_FORMAT_BLOCK_BALANCE='\x0a\x0aACCEPTED\x20FORMATS\x20(F-06\x20unified\x20receive\x20operation\x20block):\x0a'+'•\x20\x27recently\x27\x20(string\x20literal)\x20—\x20auto-query\x20and\x20receive\x20ALL\x20recently\x20received\x20balance.\x0a'+'\x20\x20Use\x20this\x20for\x20the\x20common\x20case:\x20\x22deposit\x20all\x20recently\x20received\x20coins\x20into\x20pending\x20balance.\x22\x0a'+'\x20\x20Example:\x20receive:\x20\x27recently\x27\x0a'+'•\x20ReceivedBalance\x20({token_type,\x20balance,\x20received:\x20[{id,\x20balance,\x20payment}]})\x20—\x0a'+'\x20\x20receive\x20a\x20specific\x20balance\x20record\x20from\x20a\x20Payment/payer.\x0a'+'\x20\x20Use\x20this\x20when\x20targeting\x20a\x20specific\x20received\x20balance\x20(advanced).\x0a'+'\x20\x20Example:\x20receive:\x20{token_type:\x20\x270x2::wow::WOW\x27,\x20balance:\x201000000,\x20received:\x20[{id:\x20\x270xrec1\x27,\x20balance:\x201000000,\x20payment:\x20\x270xpay1\x27}]}\x0a'+'ANTI-PATTERN:\x20do\x20NOT\x20wrap\x20in\x20{result:\x20...}\x20—\x20pass\x20the\x20value\x20directly.';export const QueryReceivedResultSchema=z['object']({'result':z['union']([ReceivedBalanceSchema,z['array'](ReceivedNormalSchema)])['describe']('Received\x20CoinWrapper\x20object\x20record\x20or\x20received\x20other\x20objects\x20array')})['strict']()['describe']('Query\x20received\x20result');
|
|
@@ -25,8 +25,10 @@ export declare const EmployeeOperationInputSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
25
25
|
}, z.core.$strict>, z.ZodObject<{
|
|
26
26
|
action: z.ZodLiteral<"assess_kpi">;
|
|
27
27
|
node: z.ZodString;
|
|
28
|
-
assigned_at: z.ZodNumber
|
|
28
|
+
assigned_at: z.ZodOptional<z.ZodNumber>;
|
|
29
29
|
advanced_at: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
progress: z.ZodOptional<z.ZodString>;
|
|
31
|
+
network: z.ZodOptional<z.ZodString>;
|
|
30
32
|
budget_ms: z.ZodOptional<z.ZodNumber>;
|
|
31
33
|
account: z.ZodOptional<z.ZodString>;
|
|
32
34
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -39,6 +41,37 @@ export declare const EmployeeOperationInputSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
39
41
|
merchant_bears: "merchant_bears";
|
|
40
42
|
self_bears: "self_bears";
|
|
41
43
|
}>>;
|
|
44
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
45
|
+
action: z.ZodLiteral<"suggest_incentive">;
|
|
46
|
+
account: z.ZodString;
|
|
47
|
+
kpis: z.ZodArray<z.ZodObject<{
|
|
48
|
+
node: z.ZodString;
|
|
49
|
+
reaction_ms: z.ZodNumber;
|
|
50
|
+
within_budget: z.ZodBoolean;
|
|
51
|
+
status: z.ZodEnum<{
|
|
52
|
+
pass: "pass";
|
|
53
|
+
fail: "fail";
|
|
54
|
+
warn: "warn";
|
|
55
|
+
}>;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
|
+
acceptance: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
58
|
+
node: z.ZodString;
|
|
59
|
+
wip_hashes: z.ZodArray<z.ZodString>;
|
|
60
|
+
submitted_at: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
}, z.core.$strict>>>;
|
|
62
|
+
liability: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
bears: z.ZodEnum<{
|
|
64
|
+
merchant: "merchant";
|
|
65
|
+
employee: "employee";
|
|
66
|
+
}>;
|
|
67
|
+
must_compensate_before_resume: z.ZodBoolean;
|
|
68
|
+
note: z.ZodString;
|
|
69
|
+
}, z.core.$strict>>;
|
|
70
|
+
available_rewards: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
71
|
+
address: z.ZodString;
|
|
72
|
+
description: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.core.$strict>>>;
|
|
74
|
+
prior_compensation: z.ZodOptional<z.ZodString>;
|
|
42
75
|
}, z.core.$strict>], "action">;
|
|
43
76
|
export declare const EmployeeOperationOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
44
77
|
action: z.ZodLiteral<"set">;
|
|
@@ -88,6 +121,16 @@ export declare const EmployeeOperationOutputSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
88
121
|
fail: "fail";
|
|
89
122
|
warn: "warn";
|
|
90
123
|
}>;
|
|
124
|
+
timing: z.ZodOptional<z.ZodObject<{
|
|
125
|
+
node: z.ZodString;
|
|
126
|
+
assigned_at: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
advanced_at: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
source: z.ZodEnum<{
|
|
129
|
+
none: "none";
|
|
130
|
+
monitor_events: "monitor_events";
|
|
131
|
+
}>;
|
|
132
|
+
gap: z.ZodOptional<z.ZodString>;
|
|
133
|
+
}, z.core.$strict>>;
|
|
91
134
|
}, z.core.$strict>, z.ZodObject<{
|
|
92
135
|
action: z.ZodLiteral<"resolve_liability">;
|
|
93
136
|
bears: z.ZodEnum<{
|
|
@@ -96,4 +139,21 @@ export declare const EmployeeOperationOutputSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
96
139
|
}>;
|
|
97
140
|
must_compensate_before_resume: z.ZodBoolean;
|
|
98
141
|
note: z.ZodString;
|
|
142
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
143
|
+
action: z.ZodLiteral<"suggest_incentive">;
|
|
144
|
+
employee: z.ZodString;
|
|
145
|
+
kind: z.ZodEnum<{
|
|
146
|
+
none: "none";
|
|
147
|
+
reward_grant: "reward_grant";
|
|
148
|
+
compensation_offset: "compensation_offset";
|
|
149
|
+
correction_notice: "correction_notice";
|
|
150
|
+
}>;
|
|
151
|
+
rationale: z.ZodString;
|
|
152
|
+
requires_confirmation: z.ZodLiteral<true>;
|
|
153
|
+
reward_candidates: z.ZodArray<z.ZodObject<{
|
|
154
|
+
address: z.ZodString;
|
|
155
|
+
description: z.ZodOptional<z.ZodString>;
|
|
156
|
+
}, z.core.$strict>>;
|
|
157
|
+
execution_hint: z.ZodString;
|
|
158
|
+
kpi_rollup: z.ZodString;
|
|
99
159
|
}, z.core.$strict>], "action">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from'zod';const EmployeeDepartmentEnum=z['enum'](['customer_service','logistics','finance','operations']),EmployeeLiabilityEnum=z['enum'](['merchant_bears','self_bears','hybrid']),EmployeeProfileSchema=z['object']({'department':EmployeeDepartmentEnum['describe']('Organizational\x20department\x20of\x20the\x20merchant\x27s\x20employee.'),'liability':EmployeeLiabilityEnum['describe']('Who\x20internally\x20bears\x20an\x20employee-error\x20loss\x20(hybrid\x20=\x20threshold\x20split).'),'response_time_budget_ms':z['number']()['int']()['positive']()['optional']()['describe']('Response-time\x20budget\x20(ms);\x20a\x20node\x20taking\x20longer\x20fails\x20the\x20reaction\x20KPI.')})['strict']();export const EmployeeOperationInputSchema=z['discriminatedUnion']('action',[z['object']({'action':z['literal']('set'),'account':z['string']()['describe']('Employee\x20account\x20address.'),'profile':EmployeeProfileSchema})['strict'](),z['object']({'action':z['literal']('get'),'account':z['string']()['describe']('Employee\x20account\x20address.')})['strict'](),z['object']({'action':z['literal']('remove'),'account':z['string']()['describe']('Employee\x20account\x20address.')})['strict'](),z['object']({'action':z['literal']('assess_kpi'),'node':z['string']()['describe']('Progress\x20node\x20name\x20the\x20employee\x20was\x20assigned\x20to.'),'assigned_at':z['number']()['int']()['describe']('Assignment\x20timestamp\x20(ms).'),'advanced_at':z['number']()['int']()['optional']()['describe']('Advance\x20timestamp\x20(ms);\
|
|
1
|
+
import{z}from'zod';const EmployeeDepartmentEnum=z['enum'](['customer_service','logistics','finance','operations']),EmployeeLiabilityEnum=z['enum'](['merchant_bears','self_bears','hybrid']),EmployeeProfileSchema=z['object']({'department':EmployeeDepartmentEnum['describe']('Organizational\x20department\x20of\x20the\x20merchant\x27s\x20employee.'),'liability':EmployeeLiabilityEnum['describe']('Who\x20internally\x20bears\x20an\x20employee-error\x20loss\x20(hybrid\x20=\x20threshold\x20split).'),'response_time_budget_ms':z['number']()['int']()['positive']()['optional']()['describe']('Response-time\x20budget\x20(ms);\x20a\x20node\x20taking\x20longer\x20fails\x20the\x20reaction\x20KPI.')})['strict'](),ReactionKpiSchema=z['object']({'node':z['string']()['describe']('Progress\x20node\x20name.'),'reaction_ms':z['number']()['int']()['describe']('Measured\x20reaction\x20time\x20(ms);\x20-1\x20when\x20still\x20pending.'),'within_budget':z['boolean'](),'status':z['enum'](['pass','warn','fail'])})['strict'](),AcceptanceEvidenceSchema=z['object']({'node':z['string']()['describe']('Machine\x20node\x20the\x20acceptance\x20refers\x20to.'),'wip_hashes':z['array'](z['string']())['describe']('WIP\x20evidence\x20hashes\x20submitted\x20for\x20the\x20node.'),'submitted_at':z['number']()['int']()['optional']()['describe']('Evidence\x20submission\x20timestamp\x20(ms).')})['strict'](),LiabilityResolutionSchema=z['object']({'bears':z['enum'](['merchant','employee']),'must_compensate_before_resume':z['boolean'](),'note':z['string']()})['strict'](),RewardCandidateSchema=z['object']({'address':z['string']()['describe']('Reward\x20object\x20address.'),'description':z['string']()['optional']()})['strict'](),NodeTimingSchema=z['object']({'node':z['string'](),'assigned_at':z['number']()['int']()['optional']()['describe']('Derived\x20entry-into-node\x20timestamp\x20(ms).'),'advanced_at':z['number']()['int']()['optional']()['describe']('Derived\x20exit-from-node\x20timestamp\x20(ms);\x20absent\x20=\x20node\x20still\x20current.'),'source':z['enum'](['monitor_events','none']),'gap':z['string']()['optional']()})['strict']();export const EmployeeOperationInputSchema=z['discriminatedUnion']('action',[z['object']({'action':z['literal']('set'),'account':z['string']()['describe']('Employee\x20account\x20address.'),'profile':EmployeeProfileSchema})['strict'](),z['object']({'action':z['literal']('get'),'account':z['string']()['describe']('Employee\x20account\x20address.')})['strict'](),z['object']({'action':z['literal']('remove'),'account':z['string']()['describe']('Employee\x20account\x20address.')})['strict'](),z['object']({'action':z['literal']('assess_kpi'),'node':z['string']()['describe']('Progress\x20node\x20name\x20the\x20employee\x20was\x20assigned\x20to.'),'assigned_at':z['number']()['int']()['optional']()['describe']('Assignment\x20timestamp\x20(ms)\x20—\x20when\x20the\x20progress\x20ENTERED\x20this\x20node.\x20Omit\x20to\x20derive\x20it\x20from\x20monitored\x20ProgressEvents\x20(requires\x20`progress`).'),'advanced_at':z['number']()['int']()['optional']()['describe']('Advance\x20timestamp\x20(ms)\x20—\x20when\x20the\x20progress\x20LEFT\x20this\x20node.\x20Omit\x20to\x20derive\x20it;\x20still-current\x20node\x20=\x20still\x20waiting\x20(status\x20warn).'),'progress':z['string']()['optional']()['describe']('Progress\x20object\x20address\x20—\x20enables\x20automatic\x20assigned_at/advanced_at\x20derivation\x20from\x20its\x20monitored\x20ProgressEvents\x20(P1-3).\x20Explicit\x20timestamps\x20override\x20derived\x20values.'),'network':z['string']()['optional']()['describe']('Network\x20alias\x20for\x20the\x20monitor\x20event\x20lookup;\x20defaults\x20to\x20the\x20current\x20network.'),'budget_ms':z['number']()['int']()['positive']()['optional']()['describe']('Response-time\x20budget\x20(ms);\x20defaults\x20to\x20the\x20stored\x20profile\x27s\x20budget,\x20else\x2048h.'),'account':z['string']()['optional']()['describe']('Employee\x20account\x20address\x20—\x20when\x20given\x20and\x20budget_ms\x20omitted,\x20the\x20stored\x20profile\x27s\x20response_time_budget_ms\x20is\x20used.')})['strict'](),z['object']({'action':z['literal']('resolve_liability'),'loss_amount':z['number']()['min'](0x0)['describe']('Loss\x20amount\x20caused\x20by\x20the\x20employee\x20error.'),'hybrid_threshold':z['number']()['min'](0x0)['optional']()['describe']('Hybrid\x20split\x20threshold\x20—\x20loss\x20<=\x20threshold\x20→\x20merchant\x20bears;\x20loss\x20>\x20threshold\x20→\x20employee\x20bears.\x20Defaults\x20to\x200.'),'account':z['string']()['optional']()['describe']('Employee\x20account\x20address\x20whose\x20stored\x20profile\x20supplies\x20`liability`.\x20Required\x20unless\x20`liability`\x20is\x20given.'),'liability':EmployeeLiabilityEnum['optional']()['describe']('Explicit\x20liability\x20rule\x20—\x20used\x20when\x20no\x20stored\x20profile\x20(or\x20account\x20omitted).')})['strict'](),z['object']({'action':z['literal']('suggest_incentive'),'account':z['string']()['describe']('Employee\x20account\x20address.'),'kpis':z['array'](ReactionKpiSchema)['describe']('Node\x20reaction\x20KPIs\x20from\x20prior\x20assess_kpi\x20calls.'),'acceptance':z['array'](AcceptanceEvidenceSchema)['optional']()['describe']('WIP\x20evidence\x20per\x20node;\x20a\x20node\x20missing\x20here\x20counts\x20as\x20an\x20acceptance\x20gap.'),'liability':LiabilityResolutionSchema['optional']()['describe']('Resolution\x20from\x20a\x20prior\x20resolve_liability\x20call\x20—\x20include\x20when\x20an\x20error-loss\x20occurred.'),'available_rewards':z['array'](RewardCandidateSchema)['optional']()['describe']('Reward\x20objects\x20the\x20merchant\x20can\x20grant;\x20without\x20them\x20a\x20passing\x20employee\x20gets\x20a\x20\x27configure\x20a\x20Reward\x27\x20recommendation.'),'prior_compensation':z['string']()['optional']()['describe']('Compensation\x20already\x20paid\x20by\x20this\x20employee\x20for\x20prior\x20losses\x20(raw\x20units).')})['strict']()]);export const EmployeeOperationOutputSchema=z['discriminatedUnion']('action',[z['object']({'action':z['literal']('set'),'account':z['string'](),'profile':EmployeeProfileSchema})['strict'](),z['object']({'action':z['literal']('get'),'account':z['string'](),'profile':EmployeeProfileSchema['nullable']()})['strict'](),z['object']({'action':z['literal']('remove'),'account':z['string'](),'removed':z['boolean']()})['strict'](),z['object']({'action':z['literal']('assess_kpi'),'node':z['string'](),'reaction_ms':z['number']()['int'](),'within_budget':z['boolean'](),'status':z['enum'](['pass','warn','fail']),'timing':NodeTimingSchema['optional']()['describe']('Present\x20when\x20any\x20timestamp\x20was\x20derived\x20from\x20monitored\x20ProgressEvents\x20(P1-3).')})['strict'](),z['object']({'action':z['literal']('resolve_liability'),'bears':z['enum'](['merchant','employee']),'must_compensate_before_resume':z['boolean'](),'note':z['string']()})['strict'](),z['object']({'action':z['literal']('suggest_incentive'),'employee':z['string'](),'kind':z['enum'](['reward_grant','compensation_offset','correction_notice','none']),'rationale':z['string'](),'requires_confirmation':z['literal'](!![]),'reward_candidates':z['array'](RewardCandidateSchema),'execution_hint':z['string'](),'kpi_rollup':z['string']()})['strict']()]);
|