@wowok/agent-mcp 3.3.8 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chain-semantics/field-capability.js +1 -1
- package/dist/chain-semantics/freeze-map.js +1 -1
- package/dist/chain-semantics/fund-flow.js +1 -1
- package/dist/chain-semantics/guard-verbs.js +1 -1
- package/dist/chain-semantics/object-graph.js +1 -1
- package/dist/composition/audit.js +1 -1
- package/dist/composition/compile.d.ts +3 -2
- package/dist/composition/compile.js +1 -1
- package/dist/composition/inflight.d.ts +6 -0
- package/dist/composition/inflight.js +1 -1
- package/dist/composition/materialize.d.ts +4 -0
- package/dist/composition/materialize.js +1 -1
- package/dist/composition/param-disclosure.d.ts +61 -0
- package/dist/composition/param-disclosure.js +1 -0
- package/dist/composition/plan.d.ts +11 -1
- package/dist/composition/plan.js +1 -1
- package/dist/customer/account-events.js +1 -1
- package/dist/data/api/api.spec.js +1 -1
- package/dist/data/api/cli.js +1 -1
- package/dist/data/api/server.d.ts +1 -0
- package/dist/data/api/server.js +1 -1
- package/dist/data/projection/store.d.ts +2 -1
- package/dist/data/projection/store.js +1 -1
- package/dist/data/projection/types.d.ts +10 -0
- package/dist/data/sync/cdc.js +1 -1
- package/dist/data/sync/cdc.spec.js +1 -1
- package/dist/data/sync/store.d.ts +5 -0
- package/dist/data/sync/store.js +1 -1
- package/dist/data/sync/types.d.ts +2 -0
- package/dist/evaluation/builtins/graph-service.spec.js +1 -1
- package/dist/evaluation/engine.js +1 -1
- package/dist/evaluation/guard-scan.js +1 -1
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/business-modules.js +1 -1
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/graph/onchain/expand.js +1 -1
- package/dist/graph/onchain/exposure.js +1 -1
- package/dist/harness/recover.js +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/allocation-templates.js +1 -1
- package/dist/knowledge/allocator-rail-verifier.js +1 -1
- package/dist/knowledge/arb-fund-facts.d.ts +1 -0
- package/dist/knowledge/arb-fund-facts.js +1 -1
- package/dist/knowledge/arbitration-ledger.js +1 -1
- package/dist/knowledge/arbitration-risk.d.ts +1 -0
- package/dist/knowledge/arbitration-risk.js +1 -1
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/rules/allocation.json +6 -6
- package/dist/knowledge/baselines/rules/arb.json +2 -2
- package/dist/knowledge/baselines/rules/guard.json +11 -11
- package/dist/knowledge/baselines/rules/order.json +1 -1
- package/dist/knowledge/baselines/rules/plan.json +1 -1
- package/dist/knowledge/baselines/semantic-facts.js +1 -1
- package/dist/knowledge/builtin-templates.d.ts +14 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/catalog-facts.d.ts +4 -0
- package/dist/knowledge/catalog-facts.js +1 -0
- package/dist/knowledge/commission-landing.js +1 -1
- package/dist/knowledge/component-schema.d.ts +64 -0
- package/dist/knowledge/component-schema.js +1 -0
- package/dist/knowledge/entity-recipient-guard.js +1 -1
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/fee-param-bindings.d.ts +26 -0
- package/dist/knowledge/fee-param-bindings.js +1 -0
- package/dist/knowledge/fund-layer.js +1 -1
- package/dist/knowledge/getting-started.d.ts +2 -2
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-anchor-reach.js +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-ledger.js +1 -1
- package/dist/knowledge/guard-lint.d.ts +1 -0
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-puzzle.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +1 -1
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/guard-translation.js +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/industry-strategy.js +1 -1
- package/dist/knowledge/jsonrpc-enum.d.ts +14 -3
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/knob-docs.d.ts +5 -0
- package/dist/knowledge/knob-docs.js +1 -0
- package/dist/knowledge/machine-templates.js +1 -1
- package/dist/knowledge/machine-topology.js +1 -1
- package/dist/knowledge/machine-translation.js +1 -1
- package/dist/knowledge/onchain-constants.d.ts +2 -0
- package/dist/knowledge/onchain-constants.js +1 -1
- package/dist/knowledge/order-ledger.js +1 -1
- package/dist/knowledge/param-schema.d.ts +70 -0
- package/dist/knowledge/param-schema.js +1 -0
- package/dist/knowledge/param-tiers.d.ts +25 -0
- package/dist/knowledge/param-tiers.js +1 -0
- package/dist/knowledge/passport-ledger.d.ts +1 -1
- package/dist/knowledge/passport-ledger.js +1 -1
- package/dist/knowledge/pattern-resolutions.d.ts +106 -0
- package/dist/knowledge/pattern-resolutions.js +1 -0
- package/dist/knowledge/projection.spec.js +1 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/scenario-modes.d.ts +1 -0
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/scenario-topology.js +1 -1
- package/dist/knowledge/service-allocation-semantics.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-templates.js +1 -1
- package/dist/knowledge/strategy-manuals.d.ts +1 -1
- package/dist/knowledge/strategy-manuals.js +1 -1
- package/dist/knowledge/template-loader.d.ts +101 -1
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-nav.d.ts +7 -0
- package/dist/knowledge/template-nav.js +1 -0
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +33 -0
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/template-test-profiles.d.ts +17 -0
- package/dist/knowledge/template-test-profiles.js +1 -0
- package/dist/knowledge/template-validation.d.ts +1 -0
- package/dist/knowledge/template-validation.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/treasury-templates.js +1 -1
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/time-window.d.ts +37 -0
- package/dist/participation/time-window.js +1 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.d.ts +1 -0
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +4 -1
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/migration-planner.js +1 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.d.ts +1 -0
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +1 -0
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/service-quote.js +1 -1
- package/dist/playbooks/service-build/service-quote.spec.js +1 -1
- package/dist/playbooks/service-build/workflow-design-assessment.js +1 -1
- package/dist/relationship/registry.js +1 -1
- package/dist/review/index.js +1 -1
- package/dist/runtime/instance-registry.d.ts +7 -1
- package/dist/runtime/instance-registry.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +2 -0
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +8 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +2 -0
- package/dist/schema/call/error-codes.d.ts +1 -1
- package/dist/schema/call/error-codes.js +1 -1
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +3 -3
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/evaluation/index.d.ts +8 -0
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/planning.d.ts +1 -0
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +29 -0
- package/dist/schema/industry-pack/index.js +1 -1
- package/dist/schema/local/index.d.ts +20 -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 +1 -1
- package/dist/schema/operations.js +1 -1
- package/dist/schema/query/bi.d.ts +106 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +5 -5
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/watch/index.js +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +4 -2
- package/dist/schemas/benchmark_migration_operation.output.json +3 -3
- package/dist/schemas/benchmark_migration_operation.schema.json +16 -2
- package/dist/schemas/bridge_operation.output.json +4 -2
- package/dist/schemas/bridge_operation.schema.json +5 -5
- package/dist/schemas/evaluation_operation.output.json +16 -0
- package/dist/schemas/guard2file.schema.json +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/industry_pack_operation.output.json +150 -1
- package/dist/schemas/industry_pack_operation.schema.json +9 -3
- package/dist/schemas/keeper_operation.output.json +2 -2
- package/dist/schemas/local_cache_operation.output.json +4 -2
- package/dist/schemas/local_history_operation.output.json +4 -2
- package/dist/schemas/local_info_operation.output.json +4 -2
- package/dist/schemas/local_mark_operation.output.json +4 -2
- package/dist/schemas/machineNode2file.schema.json +1 -1
- package/dist/schemas/messenger_operation.output.json +13 -2
- package/dist/schemas/messenger_operation.schema.json +41 -34
- package/dist/schemas/monitor_events.output.json +2 -2
- package/dist/schemas/monitor_subscription.output.json +2 -2
- package/dist/schemas/onchain_events.output.json +14 -14
- package/dist/schemas/onchain_operations.output.json +13 -10
- package/dist/schemas/onchain_operations.schema.json +124 -99
- package/dist/schemas/onchain_operations_allocation.schema.json +7 -6
- package/dist/schemas/onchain_operations_arbitration.schema.json +7 -6
- package/dist/schemas/onchain_operations_contact.schema.json +4 -3
- package/dist/schemas/onchain_operations_demand.schema.json +4 -3
- package/dist/schemas/onchain_operations_gen_passport.schema.json +4 -3
- package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_guard.schema.json +7 -6
- package/dist/schemas/onchain_operations_machine.schema.json +9 -7
- package/dist/schemas/onchain_operations_order.schema.json +6 -4
- package/dist/schemas/onchain_operations_payment.schema.json +2 -2
- package/dist/schemas/onchain_operations_permission.schema.json +19 -15
- package/dist/schemas/onchain_operations_personal.schema.json +17 -14
- package/dist/schemas/onchain_operations_progress.schema.json +6 -4
- package/dist/schemas/onchain_operations_proof.schema.json +4 -3
- package/dist/schemas/onchain_operations_repository.schema.json +9 -7
- package/dist/schemas/onchain_operations_reward.schema.json +5 -4
- package/dist/schemas/onchain_operations_service.schema.json +15 -12
- package/dist/schemas/onchain_operations_treasury.schema.json +4 -3
- package/dist/schemas/onchain_table_data.output.json +18 -13
- package/dist/schemas/onchain_table_data.schema.json +13 -13
- package/dist/schemas/query_toolkit.output.json +301 -33
- package/dist/schemas/query_toolkit.schema.json +6 -6
- package/dist/schemas/watch_operation.output.json +3 -3
- package/dist/schemas/workflow_operation.schema.json +3 -2
- package/dist/schemas/wowok_buildin_info.schema.json +1 -1
- package/dist/task/playbook.js +1 -1
- package/dist/tools/handlers/benchmark-migration.d.ts +1 -0
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/evaluation.spec.js +1 -1
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain.d.ts +4 -0
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/onchain.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/sanitize-output.js +1 -1
- package/dist/tools/sanitize-output.spec.js +1 -1
- package/dist/tools/types.d.ts +1 -0
- package/dist/tools/upgrade-check.d.ts +22 -0
- package/dist/tools/upgrade-check.js +1 -1
- package/dist/tools/wrap.d.ts +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +7 -6
package/dist/tools/wrap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{classifyError,buildDataSemantic}from'../schema/call/semantic.js';import{buildClassifiedErrorResult}from'./shared.js';import{getWipVerifyRecord}from'./wip-verify-ledger.js';import{shouldRunLightHooks,shouldRunHeavyHooks,recordOperationFailure,recordCriticalRisk,recordCriticalOperation,recordSubstepFailure}from'../harness/auto-escalation.js';import{getHarnessTier,setHarnessTier,isEnabled}from'../config/runtime.js';import{getHarness}from'../harness/index.js';import{TASK_BINDING_SLOT}from'../knowledge/onchain-constants.js';import{recover}from'../harness/recover.js';import{stableOperationId}from'../harness/operation-id.js';import{recordOperationOutcome}from'../experience/index.js';import{recordIndustrySignal}from'../knowledge/flywheel-loop.js';import{getStageCache}from'../playbooks/service-build/index.js';import{SERVICE_BUILD_STAGES}from'../playbooks/service-build/process.js';import{extractAmount,getAmountThreshold,formatAmount}from'../knowledge/safety-rules.js';import{LocalMark,query_objects,query_serviceContext}from'@wowok/wowok';import{arbitrationVotingLockDetail,auditMachineNodes,computeTerminalReachability,formatTaskBindingAdvisory,guardTimeProfileDetail,lintMachineTaskBindingPreflight,lintReviewLockedTerminals,lintTaskBindingAdvisories,rewardRefsOf,serviceRewardsUnfundedDetail}from'../knowledge/audit-rules.js';import{lintGuard}from'../knowledge/guard-lint.js';import{parseGuardNodeGates}from'../knowledge/guard-node-gates.js';import{batchQueryObjectsByIds,batchQueryObjectsByRef,fetchMachineNodes}from'../graph/onchain/sdk-batch.js';import{collectPermissionIndexes,checkPermissionAuthorization}from'../schema/utils/permission-machine-check.js';import{fetchEntityPermissions}from'../playbooks/service-build/participation-radar.js';import{verifyAllocatorRails}from'../knowledge/allocator-rail-verifier.js';function stageIndexOf(a){const b=SERVICE_BUILD_STAGES['indexOf'](a);return b>=0x0?b:0x0;}export function withTimeout(a,b=0x7530,c='operation'){let d;return Promise['race']([a['finally'](()=>{if(d)clearTimeout(d);}),new Promise((e,f)=>{d=setTimeout(()=>{let g='';if(c['includes']('messenger'))g='\x20This\x20is\x20a\x20messenger\x20network\x20operation.\x20Possible\x20causes:\x20'+'(1)\x20messenger\x20server\x20(https://messenger.wowok.net)\x20unreachable,\x20'+'(2)\x20no\x20messenger-enabled\x20account\x20configured\x20(use\x20account_operation\x20to\x20set\x20messenger\x20name),\x20'+'(3)\x20network\x20connectivity\x20issue.\x20'+'Ensure\x20you\x20have\x20a\x20messenger-enabled\x20account\x20and\x20the\x20server\x20is\x20reachable.';else(c['includes']('onchain')||c['includes']('account_operation')||c['includes']('bridge')||c['includes']('workflow')||c['includes']('keeper')||c['includes']('wowok'))&&(g='\x20This\x20tool\x20may\x20submit\x20an\x20ON-CHAIN\x20transaction.\x20The\x20transaction\x20was\x20NOT\x20cancelled\x20'+'by\x20this\x20timeout\x20—\x20it\x20may\x20already\x20be\x20submitted\x20and\x20still\x20finalize\x20on-chain.\x20'+'DO\x20NOT\x20blindly\x20retry\x20(risk\x20of\x20duplicate\x20operations).\x20First\x20verify:\x20'+'(1)\x20if\x20the\x20error\x20above\x20carries\x20a\x20tx\x20digest,\x20check\x20it\x20via\x20query_toolkit\x20'+'(query_type=\x27onchain_transaction\x27);\x20(2)\x20otherwise\x20verify\x20via\x20query_toolkit\x20'+'onchain_events\x20(or\x20the\x20account\x27s\x20recent\x20transactions).\x20Do\x20NOT\x20rely\x20on\x20an\x20'+'onchain_objects\x20read\x20alone:\x20it\x20may\x20serve\x20a\x20pre-transaction\x20cached\x20snapshot,\x20'+'so\x20an\x20unchanged\x20object\x20must\x20never\x20on\x20its\x20own\x20justify\x20a\x20retry.');f(new Error('Operation\x20\x27'+c+'\x27\x20timed\x20out\x20after\x20'+b+'ms.'+g));},b);})]);}export function wrapHandlerWithErrorShape(a,b,c,d){return async(e,f)=>{try{return await withTimeout(a(e,f),b,c);}catch(g){if(d){const h=g instanceof Error?g['message']:String(g),i=classifyError(h,g),j={'operation_type':c,'data':e},k=d(h,i,j);return{'content':[{'type':'text','text':'Error:\x20'+h}],'structuredContent':k};}throw g;}};}export const statusErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'status':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const operationErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'operation':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const strictStatusErrorShape=(a,b,c)=>({'result':{'status':'error','error':a}});function checkProjectStage(a,b,c){const d={'analyze_intent':'puzzle','aggregate_risks':'risk','trace_substeps':'substeps'},e=d[a];if(!e)return null;const f=getStageCache(b,c);if(!f){if(a==='analyze_intent')return null;return'project_stage:\x20calling\x20\x27'+a+'\x27\x20before\x20\x27analyze_intent\x27\x20—\x20recommend\x20calling\x20analyze_intent\x20first\x20for\x20project\x20\x27'+b+':'+c+'\x27';}if(stageIndexOf(f['stage'])<stageIndexOf(e)-0x1)return'project_stage:\x20calling\x20\x27'+a+'\x27\x20(stage\x20\x27'+e+'\x27)\x20but\x20project\x20is\x20at\x20stage\x20\x27'+f['stage']+'\x27\x20—\x20recommend\x20completing\x20prior\x20stages\x20first\x20for\x20\x27'+b+':'+c+'\x27';return null;}export function dispatchWithHarness(a,b){return async(d,f)=>{const g=[],h=getHarness(),i=shouldRunLightHooks(),j=shouldRunHeavyHooks(),k=isPublishOperation(b,d),l=isSignOperation(b,d),m=isBuyOperation(b,d),n=getHarnessTier();if(b==='goal_operation'&&i)try{const p=d,q=p?.['action'],r=p?.['project'],s=p?.['version'];if(q&&r&&s){const t=checkProjectStage(q,r,s);t&&g['push'](t);}}catch{}k&&n==='lightweight'&&(setHarnessTier('full'),g['push']('pre_publish:\x20tier\x20forced\x20to\x20full\x20for\x20publish-class\x20operation\x20(GLM5-21\x20§3.3)'));if(k&&n!=='off')try{const u=await runPrePublishChecks(b,d);g['push'](...u['warnings']);if(u['critical']['length']>0x0){for(const v of u['critical']){const x=recordCriticalRisk(v);if(x)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+x['reason']);}return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20Harness\x20pre-publish\x20gate\x20(GLM5-21\x20V6):\x20'+(u['critical']['length']+'\x20CRITICAL\x20risk(s)\x20must\x20be\x20resolved\x20before\x20publish.'),u['critical'],u['warnings'],'immutable_violation','Fix\x20the\x20CRITICAL\x20risks\x20listed\x20in\x20the\x20message\x20(e.g.\x20rename\x20dispute\x20nodes\x20per\x20R-M1-11\x20—\x20disputes\x20live\x20off-Machine;\x20bare\x20fund-terminal\x20names\x20only\x20warn\x20but\x20must\x20carry\x20an\x20anchored\x20refund\x20rail),\x20add\x20the\x20entry\x20pair\x20prev_node=\x22\x22,\x20then\x20retry\x20publish.\x20Nodes/pairs/forwards\x20are\x20immutable\x20after\x20publish\x20—\x20verify\x20via\x20machineNode2file\x20first.');}}catch(y){g['push']('pre_publish\x20hook\x20failed:\x20'+(y instanceof Error?y['message']:String(y)));}if(l&&j)try{const z=extractData(d),A=z?extractAmount(z,{'excludeConfigAmounts':!![]}):null;if(A!==null){const B=getAmountThreshold();let C=null;try{C=BigInt(A);}catch{C=null;}if(C!==null&&C>B){const D=await skuMatchedOrderTotalExemption(z,d?.['env']?.['network']);if(D)g['push']('pre_sign:\x20order\x20total\x20'+A+'\x20exceeds\x20the\x20full-tier\x20threshold\x20'+B['toString']()+'\x20(smallest\x20unit)\x20—\x20'+'EXEMPTED\x20(M-K11-a):\x20exact\x20catalog\x20match\x20Σ\x20price×quantity\x20against\x20the\x20Service\x27s\x20published\x20sales'+(D['coinType']?',\x20payment\x20coin\x20'+D['coinType']:'')+'.');else return buildHarnessBlockResult('pre_sign','Sign\x20BLOCKED\x20by\x20Harness\x20pre-sign\x20gate\x20(GLM5-21\x20V7):\x20amount\x20'+formatAmount(C)+'\x20WOW\x20exceeds\x20the\x20full-tier\x20threshold\x20'+formatAmount(B)+'\x20WOW.',['amount\x20'+A+'\x20(smallest\x20unit)\x20>\x20threshold\x20'+B['toString']()+'\x20(smallest\x20unit)'],[],'invalid_parameter','Raise\x20WOWOK_AMOUNT_THRESHOLD\x20to\x20match\x20the\x20intended\x20amount,\x20split\x20the\x20transaction,\x20or\x20reset\x20the\x20harness\x20tier\x20to\x20lightweight\x20(config_operation)\x20after\x20explicit\x20user\x20confirmation.\x20'+'M-K11-a:\x20catalog-priced\x20order_new\x20buys\x20(total_pay\x20EXACTLY\x20equal\x20to\x20Σ\x20price×quantity\x20of\x20PUBLISHED\x20sales)\x20are\x20exempted\x20automatically\x20—\x20'+'if\x20this\x20IS\x20a\x20catalog-priced\x20buy,\x20verify\x20every\x20item\x20name/quantity\x20against\x20the\x20service\x27s\x20current\x20sales\x20and\x20retry.');}}}catch(E){g['push']('pre_sign\x20hook\x20failed:\x20'+(E instanceof Error?E['message']:String(E)));}if(m&&n!=='off')try{const F=await runPreBuyChecks(b,d);g['push'](...F['warnings']);if(F['critical']['length']>0x0){for(const G of F['critical']){const H=recordCriticalRisk(G);if(H)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+H['reason']);}return buildHarnessBlockResult('pre_buy','Purchase\x20BLOCKED\x20by\x20Harness\x20pre-buy\x20gate:\x20'+F['critical']['length']+'\x20CRITICAL\x20allocator\x20risk(s)\x20—\x20'+'paying\x20into\x20this\x20service\x20as\x20currently\x20configured\x20would\x20fail\x20on-chain\x20or\x20lock\x20funds\x20with\x20no\x20distribution\x20path.',F['critical'],F['warnings'],'state_conflict','Do\x20NOT\x20retry\x20this\x20purchase\x20against\x20the\x20current\x20service\x20state.\x20Read\x20the\x20service\x27s\x20effective\x20allocator\x20plan\x20'+'(query_toolkit\x20query_type=\x27service_panorama\x27,\x20field\x20order_allocators)\x20and\x20confirm\x20every\x20finding\x20above\x20is\x20resolved\x20'+'(merchant\x20fixes\x20the\x20plan\x20—\x20post-publish\x20append\x20is\x20allowed\x20—\x20or\x20the\x20guard\x20definitions\x20are\x20repaired).\x20'+'Only\x20retry\x20the\x20buy\x20after\x20the\x20on-chain\x20state\x20changes;\x20otherwise\x20choose\x20a\x20different\x20service.');}}catch(I){g['push']('pre_buy\x20hook\x20failed:\x20'+(I instanceof Error?I['message']:String(I)));}let o;try{o=await a(d,f);}catch(J){const K=J instanceof Error?J['message']:String(J),L=recordOperationFailure(b,K);L&&g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+L['reason']);if(b==='onchain_operations')try{const M=classifyError(K,J);if(!M['retryable']&&M['error_code']!=='unknown'){const N=recordCriticalOperation(b,M['error_code']);if(N)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+N['reason']);}}catch{}throw J;}if(b==='onchain_operations')try{if(classifyOutcome(o)==='failed'){const O=extractErrorCode(o)??'',P=classifyError(O);if(!P['retryable']&&P['error_code']!=='unknown'){const Q=recordCriticalOperation(b,P['error_code']);if(Q)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Q['reason']);}}}catch{}if(i&&!isOutcomeDiscriminated(o)){const R=stableOperationId(extractIntent(b,d)??b,extractData(d));try{const S=classifyOutcome(o);if(S==='failed'){const T=extractErrorCode(o)??'',U=classifyError(T),V=h['recover'](U['error_code'],R,{'operation_type':b,'data':extractData(d),'retryable':U['retryable']});g['push']('Harness\x20recover:\x20strategy='+V['strategy']+('\x20(attempt\x20'+V['current_attempt']+'/'+V['max_attempts']+')')+(V['should_retry']?'\x20—\x20retryable':'\x20—\x20do\x20NOT\x20retry\x20blindly')+(V['user_prompt']?'\x20—\x20'+V['user_prompt']:'\x20—\x20'+V['detail']));}else S==='success'&&h['resetRecovery'](R);}catch(W){g['push']('recover\x20hook\x20failed:\x20'+(W instanceof Error?W['message']:String(W)));}}if(b==='goal_operation')try{const X=d?.['action'];if(X==='trace_substeps'){const Y=extractCriticalFindingCount(o);if(Y>0x0){const Z=recordSubstepFailure(String(X)+':\x20'+Y+'\x20critical\x20finding(s)');if(Z)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Z['reason']);}}}catch{}if(isWriteClassTool(b)&&!SEMANTIC_RECORDED_TOOLS['has'](b))try{const a0=extractOperationType(b,d)??b,a1=extractIntent(b,d)??b,a2=extractData(d)??d,a3=classifyOutcome(o),a4=extractErrorCode(o),a5=isEnabled('experience_layer');if(a5)recordOperationOutcome(a0,a2,a1,a3,a4);else{const a6=extractIndustry(d);a6&&isEnabled('industry_evolution')&&recordIndustrySignal(a6,{'type':a0},{'success':a3==='success','error_code':a4});}}catch(a7){g['push']('signal\x20collection\x20failed:\x20'+(a7 instanceof Error?a7['message']:String(a7)));}if(g['length']>0x0){if(o?.['structuredContent']){const a8=o['structuredContent'],a9=a8['semantic'];if(a9){const aa=Array['isArray'](a9['warnings'])?a9['warnings']:[];a9['warnings']=[...aa,...g];}else for(const ab of g){console['warn']('[harness]\x20'+ab);}}else for(const ac of g){console['warn']('[harness]\x20'+ac);}}return o;};}function isPublishOperation(a,b){if(a!=='onchain_operations')return![];const c=extractOperationType(a,b);if(c!=='service'&&c!=='machine')return![];const d=extractData(b);return d?.['publish']===!![]||d?.['bPublished']===!![];}function isSignOperation(a,b){if(a==='wip_file'){const c=b?.['operation_type'];return c==='sign';}return a==='onchain_operations';}function isBuyOperation(a,b){if(a!=='onchain_operations')return![];if(extractOperationType(a,b)!=='service')return![];const c=extractData(b),d=c?.['order_new'],e=c?.['buy']!=null||d!=null&&typeof d==='object'&&d['buy']!=null;return e&&c!=null&&typeof c['object']==='string'&&c['object']!=='';}function extractOperationType(a,b){if(!b||typeof b!=='object')return undefined;const c=b;if(a==='onchain_operations')return typeof c['operation_type']==='string'?c['operation_type']:undefined;if(a==='goal_operation'||a==='industry_pack_operation'||a==='strategy_review_operation')return typeof c['action']==='string'?c['action']:undefined;return typeof c['operation_type']==='string'?c['operation_type']:undefined;}function extractIntent(a,b){if(!b||typeof b!=='object')return undefined;const c=b;if((a==='goal_operation'||a==='industry_pack_operation'||a==='strategy_review_operation')&&typeof c['action']==='string')return a+':'+c['action'];const d=c['operation_type'];if(typeof d==='string')return a+':'+d;return a;}function extractData(a){if(!a||typeof a!=='object')return undefined;const b=a,c=b['data'];return c&&typeof c==='object'?c:undefined;}export async function skuMatchedOrderTotalExemption(a,b){try{if(!a)return undefined;const c=a['order_new']?.['buy'];if(!c||c['discount']!=null)return undefined;const d=c?.['total_pay']?.['balance']??c?.['total_pay'];if(d===null||d===undefined||typeof d==='object')return undefined;const e=Array['isArray'](c['items'])?c['items']:[];if(e['length']===0x0)return undefined;const f=a['object'];if(typeof f!=='string'||f['length']===0x0)return undefined;const g=f['startsWith']('0x')?f:await LocalMark['Instance']()['get_address'](f)??undefined;if(!g)return undefined;const h=await query_serviceContext({'service':g,'network':b}),i=h?.['service'];if(!i)return undefined;if(i['bPublished']!==!![])return undefined;const j=String(i?.['type_raw']??i?.['type']??'')['match'](/<(.+)>$/)?.[0x1],k=Array['isArray'](i['sales'])?i['sales']:[];let l=0x0n;for(const n of e){const o=k['find'](r=>r?.['name']===n?.['name']);if(!o||o?.['suspension']===!![])return undefined;const p=BigInt(String(o?.['price']?.['balance']??o?.['price']??'0')),q=BigInt(String(n?.['quantity']??'1'));if(q<=0x0n)return undefined;l+=p*q;}let m;try{m=BigInt(String(d));}catch{return undefined;}if(m!==l)return undefined;return{'coinType':j};}catch{return undefined;}}const WRITE_CLASS_TOOLS=new Set(['onchain_operations','goal_operation','industry_pack_operation','strategy_review_operation','wip_file','messenger_operation','bridge_operation']),SEMANTIC_RECORDED_TOOLS=new Set(['onchain_operations','bridge_operation']);function isWriteClassTool(a){return WRITE_CLASS_TOOLS['has'](a);}function classifyOutcome(a){if(!a?.['structuredContent'])return'failed';const b=a['structuredContent'];if(b['outcome']==='failed')return'failed';if(b['outcome']==='executed')return'success';if(b['outcome']==='pending_input')return'partial';const c=b['verdict'];if(c&&typeof c==='object'&&c['buildable']===![])return'failed';const d=typeof b['status']==='string'?b['status']:typeof b['result_type']==='string'?b['result_type']:b['result']&&typeof b['result']==='object'&&typeof b['result']['status']==='string'?b['result']['status']:'';if(d==='error'||d==='failed'||d==='schema_mismatch')return'failed';if(d==='partial')return'partial';return'success';}function isOutcomeDiscriminated(a){const b=a?.['structuredContent'];return!!b&&typeof b==='object'&&'outcome'in b;}function extractErrorCode(a){if(!a?.['structuredContent'])return undefined;const b=a['structuredContent'];if(typeof b['error_code']==='string')return b['error_code'];const c=b['error'];if(typeof c==='string')return c;if(c&&typeof c==='object'){const d=c['code'];if(typeof d==='string')return d;}return undefined;}function extractIndustry(a){if(!a||typeof a!=='object')return undefined;const b=a;if(typeof b['industry']==='string')return b['industry'];const c=b['data'];if(c&&typeof c==='object'){const e=c;if(typeof e['industry']==='string')return e['industry'];}return undefined;}function numericBalance(a){if(typeof a==='number'&&Number['isFinite'](a))return a;if(typeof a==='string'&&a['trim']()!==''&&Number['isFinite'](Number(a)))return Number(a);if(typeof a==='bigint')return Number(a);return undefined;}function collectAllocatorGuards(b){const c=new Map();for(const d of b){const e=d?.['allocators'];if(!Array['isArray'](e))continue;for(const f of e){const g=f?.['guard'];if(typeof g!=='string'||g['trim']()==='')continue;const h=g['toLowerCase']();let i=c['get'](h);!i&&(i={'ref':g,'recipients':new Set(),'slots':new Set()},c['set'](h,i));const j=f?.['sharing'];if(!Array['isArray'](j))continue;for(const k of j){const l=k?.['who'];if(!l||typeof l!=='object')continue;if('Signer'in l)i['recipients']['add']('Signer');else{if('Entity'in l)i['recipients']['add']('Entity');else{if('GuardIdentifier'in l){i['recipients']['add']('GuardIdentifier');const m=l['GuardIdentifier'],o=Number(m);if(Number['isFinite'](o))i['slots']['add'](o);}}}}}}return c;}async function lintAllocatorGuardSet(a,b,c,h){const i=[],j=[],l=collectAllocatorGuards(a);if(l['size']===0x0)return{'critical':i,'warnings':j};let m;try{m=await batchQueryObjectsByRef([...l['values']()]['map'](q=>q['ref']),b,!![]);}catch(q){return j['push'](c+':\x20allocator\x20guard\x20lint\x20skipped\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+(q instanceof Error?q['message']:String(q))+');\x20')+(c==='pre_buy'?'the\x20guard\x20layer\x20of\x20this\x20service\x27s\x20allocator\x20plan\x20is\x20UNVERIFIED\x20—\x20verify\x20the\x20guards\x20yourself\x20before\x20trusting\x20this\x20buy':'run\x20guard\x20lint\x20manually\x20BEFORE\x20publish\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)')),{'critical':i,'warnings':j};}const n=new Map(),o=new Set(),p=new Map();for(const [r,s]of m){const t=s;if(t?.['type']!=='Guard'){t!=null&&typeof t['object']==='string'&&t['object']!==''&&(o['add'](r['toLowerCase']()),o['add'](String(t['object'])['toLowerCase']()),typeof t['type']==='string'&&t['type']!==''&&p['set'](r['toLowerCase'](),String(t['type'])));continue;}n['set'](r['toLowerCase'](),t);for(const u of[t['query_name'],t['object']]){if(typeof u==='string'&&u!=='')n['set'](u['toLowerCase'](),t);}}for(const [v,w]of l){const x=n['get'](v)??n['get'](w['ref']['toLowerCase']());if(!x){const D=w['ref']['toLowerCase']();if(o['has'](v)||o['has'](D)){const F=p['get'](v)??p['get'](D);if(F!==undefined){const G=c+':\x20allocator\x20guard\x20\x22'+w['ref']+'\x22\x20resolves\x20to\x20a\x20'+F+'\x20object,\x20not\x20a\x20Guard\x20—\x20'+'no\x20distribution\x20run\x20can\x20pass\x20a\x20guard\x20slot\x20that\x20names\x20a\x20different\x20object\x20type';if(h==='critical')i['push'](G);else j['push'](G);}else j['push'](c+':\x20allocator\x20guard\x20\x22'+w['ref']+'\x22\x20EXISTS\x20on\x20chain\x20but\x20its\x20object\x20could\x20not\x20be\x20parsed\x20'+'as\x20a\x20Guard\x20(unreadable\x20envelope\x20—\x20usually\x20an\x20SDK/on-chain\x20schema\x20skew)\x20—\x20lint\x20skipped\x20for\x20'+'this\x20guard;\x20verify\x20its\x20definition\x20manually\x20BEFORE\x20'+(c==='pre_buy'?'trusting\x20this\x20buy':'publish\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)'));continue;}const E=c+':\x20allocator\x20guard\x20\x22'+w['ref']+'\x22\x20not\x20found\x20on-chain\x20—\x20'+(h==='critical'?'the\x20pool\x20accepts\x20funds\x20but\x20no\x20distribution\x20run\x20can\x20ever\x20pass\x20a\x20missing\x20guard\x20(fund-lock\x20risk)':'lint\x20skipped\x20for\x20this\x20guard;\x20verify\x20the\x20guard\x20exists\x20and\x20is\x20final\x20BEFORE\x20publish\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)');if(h==='critical')i['push'](E);else j['push'](E);continue;}const y=x['data']??x,z=Array['isArray'](y?.['table'])?y['table']:[],A=Array['isArray'](y?.['relies'])?y['relies']:[];for(const H of w['slots']){const I=z['find'](K=>Number(K?.['identifier'])===H),J=I!=null&&I['b_submission']===!![]&&String(I['value_type'])==='Address';!J&&i['push'](c+':\x20allocator\x20guard\x20\x22'+w['ref']+'\x22\x20pays\x20a\x20{GuardIdentifier:\x20'+H+'}\x20leg\x20but\x20its\x20table\x20has\x20'+(I==null?'NO\x20slot\x20'+H+'\x20row':'slot\x20'+H+'\x20as\x20a\x20STATIC\x20row\x20(b_submission:\x20'+(I['b_submission']===!![])+',\x20value_type:\x20'+String(I['value_type'])+')')+'\x20—\x20the\x20passport\x20only\x20emits\x20DECLARED\x20submission\x20slots\x20and\x20allocation\x20asserts\x20the\x20slot\x20equals\x20the\x20paying\x20'+'order,\x20so\x20this\x20rail\x20aborts\x20at\x20alloc\x20(code\x2015,\x20ERECIPIENT_NOT_FOR_OBJECT)\x20with\x20the\x20leg\x27s\x20funds\x20stranded.\x20'+('Declare\x20{identifier:\x20'+H+',\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22}\x20in\x20the\x20guard\x20table\x20BEFORE\x20publish\x20')+'(templates\x20anchor\x20refund\x20rails\x20on\x20user\x20slot\x200\x20and\x20submit\x20the\x20Order\x20address\x20there).\x20Do\x20NOT\x20reach\x20for\x20'+'protocol\x20slot\x20254\x20as\x20the\x20payee:\x20it\x20is\x20the\x20task-binding/once\x20slot,\x20so\x20naming\x20it\x20arms\x20once-per-order\x20and\x20a\x20'+'second\x20fire\x20on\x20the\x20same\x20order\x20aborts\x20E_ONCE_TRIGGERED\x20(16)');}try{const K=z['some'](N=>Number(N?.['identifier'])===0x0&&N?.['b_submission']===!![]),L=w['slots']['has'](0x0),M=lintTaskBindingAdvisories({'guardRef':w['ref'],'table':z,'allocatorBound':!L&&K,'refundReentry':L});for(const N of M)j['push'](formatTaskBindingAdvisory(N,c));}catch{}const B={'description':typeof y?.['description']==='string'?y['description']:undefined,'table':z['map'](O=>({'identifier':Number(O?.['identifier']??0x0),'b_submission':!!O?.['b_submission'],'value_type':O?.['value_type']!==undefined?String(O['value_type']):undefined,'value':O?.['value'],'name':O?.['name']!==undefined?String(O['name']):undefined,'object_type':O?.['object_type']!==undefined?String(O['object_type']):undefined})),'root':y?.['root'],'rely':A['length']>0x0?{'guards':A['map'](O=>String(O)),'logic_or':!y?.['relies_logic_and']}:undefined,'binding_hint':{'host_object':'Service','binding_field':'order_allocators','sharing_recipients':w['recipients']['size']>0x0?[...w['recipients']]:undefined}},C=guardTimeProfileDetail({'ref':w['ref'],'description':typeof y?.['description']==='string'?y['description']:undefined,'table':z,'root':y?.['root']});if(C){const O='pre_publish:\x20R-TIME-PROFILE\x20—\x20allocator\x20guard\x20\x22'+w['ref']+'\x22:\x20'+C['detail'];if(C['level']==='critical')i['push'](O);else j['push'](O);}try{const P=await lintGuard(B,{'auto_fix':![]});for(const Q of P['diagnostics']){const R=c+':\x20allocator\x20guard\x20\x22'+w['ref']+'\x22\x20'+Q['code']+'\x20('+Q['source']+'):\x20'+Q['message']+'\x20at\x20'+Q['location']['path'];if(Q['severity']==='error')i['push'](R);else{if(Q['severity']==='warning')j['push'](R);}}}catch(S){j['push'](c+':\x20allocator\x20guard\x20\x22'+w['ref']+'\x22\x20lint\x20failed\x20'+('('+(S instanceof Error?S['message']:String(S))+')\x20—\x20non-blocking'));}}return{'critical':i,'warnings':j};}function collectForwardGuardRefs(a){const b=new Map();for(const c of a){const d=c,e=Array['isArray'](d?.['pairs'])?d['pairs']:Array['isArray'](d?.['value'])?d['value']:[];for(const h of e){const i=h,j=Array['isArray'](i?.['forwards'])?i['forwards']:[];for(const k of j){const l=k,m=l?.['guard'],n=typeof m==='string'&&m['trim']()!==''?m:m&&typeof m==='object'?m['guard']??m['$ref']:undefined;typeof n==='string'&&n['trim']()!==''&&b['set'](n['toLowerCase'](),n);}}}return b;}async function fetchForwardGuardIndex(a,b){const c=collectForwardGuardRefs(a),d=new Map();if(c['size']===0x0)return{'refs':c,'defs':d};try{const f=await batchQueryObjectsByIds([...c['values']()],b,!![]);for(const h of f??[]){const i=h;if(i?.['type']!=='Guard')continue;for(const j of[i['query_name'],i['object']]){if(typeof j==='string'&&j!=='')d['set'](j['toLowerCase'](),i);}}return{'refs':c,'defs':d};}catch(l){return{'refs':c,'defs':d,'error':l instanceof Error?l['message']:String(l)};}}function lintForwardGuardsTaskBinding(a){const b=[],c=[];if(a['refs']['size']===0x0)return{'critical':b,'warnings':c};if(a['error']!==undefined)return c['push']('pre_publish:\x20forward-guard\x20lints\x20(task-binding\x20+\x20review-lock)\x20DEGRADED\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+a['error']+');\x20verify\x20every\x20forward\x20guard\x20carries\x20the\x20protocol\x20slot\x20254\x20Address\x20submission\x20row\x20and\x20')+'that\x20no\x20settlement\x20rail\x20is\x20review-locked\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001).\x20'+'If\x20this\x20repeats,\x20fix\x20the\x20read\x20path\x20(RPC/network)\x20—\x20do\x20not\x20publish\x20blind'),{'critical':b,'warnings':c};for(const [d,e]of a['refs']){const f=a['defs']['get'](d);if(!f){const j='pre_publish:\x20forward-bound\x20guard\x20\x22'+e+'\x22\x20not\x20found\x20on-chain\x20—\x20'+(/^0x[0-9a-fA-F]{4,64}$/['test'](e)?'dangling\x20forward\x20binding;\x20publish\x20BLOCKED\x20(fail-closed,\x20IMMUT-001).\x20Bind\x20an\x20existing\x20guard\x20'+'(or\x20create\x20it\x20first)\x20BEFORE\x20publishing\x20—\x20a\x20frozen\x20machine\x20cannot\x20be\x20repaired':'task-binding\x20lint\x20skipped\x20for\x20it;\x20ensure\x20it\x20exists\x20and\x20carries\x20the\x20protocol\x20slot\x20254\x20Address\x20'+'submission\x20row\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001)');(/^0x[0-9a-fA-F]{4,64}$/['test'](e)?b:c)['push'](j);continue;}const g=f['data']??f,h=Array['isArray'](g?.['table'])?g['table']:[],i=h['some'](k=>Number(k?.['identifier'])===TASK_BINDING_SLOT&&k?.['b_submission']===!![]&&String(k?.['value_type'])==='Address');!i&&b['push']('pre_publish:\x20forward-bound\x20guard\x20\x22'+e+'\x22\x20has\x20NO\x20protocol\x20slot\x20'+TASK_BINDING_SLOT+'\x20Address\x20submission\x20row\x20—\x20'+'the\x20passport\x20only\x20emits\x20DECLARED\x20slots,\x20so\x20once\x20a\x20Service\x20binds\x20this\x20Machine\x20EVERY\x20forward\x20this\x20'+'guard\x20gates\x20aborts\x20(code\x2011)\x20and\x20escrowed\x20funds\x20can\x20never\x20advance.\x20Machine\x20topology\x20is\x20immutable\x20'+('after\x20publish\x20(IMMUT-001):\x20add\x20{identifier:'+TASK_BINDING_SLOT+',\x20b_submission:true,\x20value_type:\x22Address\x22}\x20to\x20the\x20')+'guard\x27s\x20table\x20(recreate\x20the\x20guard\x20unfrozen\x20if\x20it\x20is\x20frozen)\x20BEFORE\x20publishing\x20this\x20Machine');}return{'critical':b,'warnings':c};}function lintForwardReviewLocks(a,b){if(b['error']!==undefined||b['refs']['size']===0x0)return{'critical':[],'warnings':[]};const c=new Map();for(const [d,e]of b['defs']){const f=new Set();collectGuardNodeGates(e,f);if(f['size']>0x0)c['set'](d,[...f]);}return lintReviewLockedTerminals(a,c);}function lintForwardGuardsTimeProfile(a){const b=[],c=[];if(a['error']!==undefined||a['refs']['size']===0x0)return{'critical':b,'warnings':c};for(const [d,e]of a['refs']){const f=a['defs']['get'](d);if(!f)continue;const g=f['data']??f,h=guardTimeProfileDetail({'ref':e,'description':g?.['description'],'table':Array['isArray'](g?.['table'])?g['table']:undefined,'root':g?.['root']});if(h){const i='pre_publish:\x20R-TIME-PROFILE\x20—\x20forward-bound\x20guard\x20\x22'+e+'\x22:\x20'+h['detail'];if(h['level']==='critical')b['push'](i);else c['push'](i);}}return{'critical':b,'warnings':c};}async function lintAllocatorGuards(a,b){return lintAllocatorGuardSet([a['order_allocators'],a['order_allocators_append']],b,'pre_publish','warning');}async function lintAllocatorRailPairing(a,b){const c=[],d=[],h=[a['order_allocators'],a['order_allocators_append']],i=collectAllocatorGuards(h);if(i['size']===0x0)return{'critical':c,'warnings':d};let j;try{j=await batchQueryObjectsByRef([...i['values']()]['map'](q=>q['ref']),b,!![]);}catch(q){return d['push']('pre_publish:\x20claimed_by\x20rail-pairing\x20check\x20skipped\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+(q instanceof Error?q['message']:String(q))+');\x20run\x20template_scan\x20or\x20guard\x20lint\x20manually\x20')+'BEFORE\x20publish:\x20a\x20refund\x20rail\x20gated\x20on\x20order.claimed_by\x20none\x20MUST\x20be\x20paired\x20with\x20a\x20'+'merchant-recovery\x20rail\x20gated\x20on\x20claimed_by\x20some,\x20or\x20a\x20claimed\x20order\x20strands\x20its\x20escrow\x20'+'(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)'),{'critical':c,'warnings':d};}const l=new Map();for(const [r,s]of j){const t=s;if(t?.['type']!=='Guard')continue;l['set'](r['toLowerCase'](),t);for(const u of[t['query_name'],t['object']]){if(typeof u==='string'&&u!=='')l['set'](u['toLowerCase'](),t);}}const m=[];for(const [v,w]of i){const x=l['get'](v);if(!x)continue;const y=x?.['data']??x,z=Array['isArray'](y['table'])?y['table']:[];m['push']({'key':w['ref'],'track':w['slots']['has'](0x0)?'refund':'settlement','table':z,'root':y['root']});}if(m['length']===0x0)return d['push']('pre_publish:\x20claimed_by\x20rail-pairing\x20check\x20skipped\x20—\x20no\x20referenced\x20allocator\x20guard\x20was\x20'+'resolvable\x20on-chain;\x20verify\x20the\x20rails\x20BEFORE\x20publish\x20(IMMUT-002)'),{'critical':c,'warnings':d};const n=typeof a['machine']==='string'?a['machine']:undefined;let o=[];if(n&&n['trim']()!=='')try{const A=await fetchMachineNodes(n,b,!![]);o=A['map'](B=>({'name':B['name']}));}catch{d['push']('pre_publish:\x20claimed_by\x20rail-pairing\x20check\x20ran\x20WITHOUT\x20the\x20machine\x20node\x20matrix\x20'+'(machine\x20fetch\x20failed)\x20—\x20award-exit\x20coverage\x20is\x20evaluated\x20on\x20the\x20payload\x20rails\x20only');}else d['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call\x20—\x20claimed_by\x20rail-pairing\x20evaluated\x20without\x20'+'the\x20node\x20matrix;\x20if\x20the\x20store\x20binds\x20a\x20machine\x20later,\x20re-verify\x20after\x20binding');o['length']===0x0&&(o=[{'name':'*'}]);const p=verifyAllocatorRails(m,o,{'arbitrationBound':!![]});for(const B of p){const C='pre_publish:\x20claimed_by\x20rail\x20pairing\x20—\x20['+B['code']+']\x20'+B['detail'];B['level']==='info'?d['push']('pre_publish:\x20claimed_by\x20rail\x20DISCLOSURE\x20(not\x20a\x20violation)\x20—\x20['+B['code']+']\x20'+B['detail']):c['push'](C);}return{'critical':c,'warnings':d};}async function lintServiceEscrowExitCoverage(b,c,d,f){const h=[],i=[],j=new Map();let k=0x0;for(const r of c){if(r===null||r===undefined)continue;const s=Array['isArray'](r)?r:Array['isArray'](r['allocators'])?r['allocators']:[];for(const t of s){k++;const u=t?.['guard'];if(typeof u==='string'&&u['trim']()!=='')j['set'](u['toLowerCase'](),u);}}const l=c['some'](v=>v!==null&&v!==undefined);if(f){let v,w;try{const x=await batchQueryObjectsByIds([f],d,!![]);v=(x??[])['find'](y=>y?.['type']==='Service');}catch(y){w=y;}if(!v&&!b)return h['push']('pre_publish:\x20(R-ESCROW-LEAF)\x20escrow-exit\x20gate\x20could\x20not\x20resolve\x20service\x20\x22'+f+'\x22\x20'+('('+(w instanceof Error?w['message']:String(w))+')\x20—\x20terminal\x20coverage\x20UNVERIFIABLE;\x20publish\x20blocked.\x20')+'Retry\x20when\x20the\x20network\x20is\x20reachable'),{'critical':h,'warnings':i};!v&&w!==undefined&&i['push']('pre_publish:\x20escrow-exit\x20gate\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+f+'\x22\x20'+('('+(w instanceof Error?w['message']:String(w))+');\x20auditing\x20THIS\x20call\x27s\x20allocator\x20payload\x20only'));if(v){const z=v['data']??v;if(!b&&typeof z['machine']==='string'&&z['machine']['trim']()!=='')b=z['machine'];const A=z['order_allocators'],B=Array['isArray'](A)?A:Array['isArray'](A?.['allocators'])?A['allocators']:[];for(const C of B){const D=C?.['guard'];typeof D==='string'&&D['trim']()!==''&&!j['has'](D['toLowerCase']())&&j['set'](D['toLowerCase'](),D);}}}if(!b)return i['push']('pre_publish:\x20escrow-exit\x20gate\x20skipped\x20—\x20no\x20machine\x20in\x20this\x20call\x20and\x20the\x20published\x20service\x20carries\x20none;\x20'+'there\x20is\x20no\x20topology\x20to\x20cover'),{'critical':h,'warnings':i};let m=[];try{m=await fetchMachineNodes(b,d,!![]);}catch(E){return h['push']('pre_publish:\x20escrow-exit\x20gate\x20could\x20not\x20fetch\x20machine\x20\x22'+b+'\x22\x20nodes\x20'+('('+(E instanceof Error?E['message']:String(E))+')\x20—\x20terminal\x20coverage\x20UNVERIFIABLE;\x20publish\x20blocked.\x20')+'Retry\x20when\x20the\x20network\x20is\x20reachable'),{'critical':h,'warnings':i};}if(m['length']===0x0)return i['push']('pre_publish:\x20escrow-exit\x20gate\x20skipped\x20—\x20machine\x20has\x20no\x20nodes\x20to\x20cover'),{'critical':h,'warnings':i};const n=computeTerminalReachability(m);if(n['terminals']['length']===0x0)return{'critical':h,'warnings':i};if(j['size']===0x0)return l?h['push']('pre_publish:\x20(R-ESCROW-LEAF)\x20machine\x20terminal\x20node(s)\x20'+n['terminals']['map'](F=>'\x22'+F+'\x22')['join'](',\x20')+'\x20have\x20NO\x20allocator\x20rail\x20—\x20'+(k===0x0?'order_allocators\x20is\x20empty\x20in\x20this\x20call,\x20so\x20':'no\x20allocator\x20row\x20carries\x20a\x20guard\x20ref,\x20so\x20')+'an\x20order\x20stopping\x20at\x20any\x20terminal\x20strands\x20its\x20escrow\x20by\x20construction\x20(immutable\x20after\x20publish,\x20IMMUT-002).\x20'+'Every\x20terminal\x20needs\x20a\x20settlement/refund\x20allocator\x20whose\x20guard\x20gates\x20progress.current\x20==\x20<terminal>\x20'+'(canonical\x20designs:\x20tpl_allocator_node_gate_settle\x20/\x20tpl_allocator_node_gate_refund,\x20M-T12)'):i['push']('pre_publish:\x20(R-ESCROW-LEAF)\x20the\x20published\x20service\x20carries\x20NO\x20allocator\x20rails\x20on-chain\x20—\x20'+('if\x20it\x20ever\x20takes\x20payment,\x20every\x20terminal\x20('+n['terminals']['map'](F=>'\x22'+F+'\x22')['join'](',\x20')+')\x20strands\x20escrow\x20')+'with\x20no\x20exit.\x20Zero-payment\x20services\x20may\x20proceed;\x20otherwise\x20bind\x20settlement/refund\x20rails\x20BEFORE\x20publish\x20'+'(canonical\x20designs:\x20tpl_allocator_node_gate_settle\x20/\x20tpl_allocator_node_gate_refund,\x20M-T12;\x20immutable\x20after\x20publish,\x20IMMUT-002)'),{'critical':h,'warnings':i};let o;try{o=await batchQueryObjectsByRef([...j['values']()],d,!![]);}catch(F){return i['push']('pre_publish:\x20escrow-exit\x20coverage\x20UNVERIFIED\x20—\x20could\x20not\x20query\x20allocator\x20guards\x20'+('('+(F instanceof Error?F['message']:String(F))+');\x20run\x20guard\x20lint\x20manually\x20BEFORE\x20publish\x20')+'(terminal(s)\x20in\x20question:\x20'+n['terminals']['join'](',\x20')+')'),{'critical':h,'warnings':i};}const p=new Set();for(const G of o['values']()){const H=G;if(H?.['type']!=='Guard')continue;collectGuardNodeGates(H,p);}const q=n['terminals']['filter'](I=>!p['has'](I));return q['length']>0x0&&h['push']('pre_publish:\x20(R-ESCROW-LEAF)\x20terminal\x20node(s)\x20'+q['map'](I=>'\x22'+I+'\x22')['join'](',\x20')+'\x20have\x20NO\x20allocator\x20rail\x20—\x20'+'an\x20order\x20that\x20reaches\x20a\x20terminal\x20moves\x20no\x20money\x20by\x20itself,\x20so\x20its\x20escrow\x20strands\x20permanently\x20'+'(mainnet:\x200.299\x20stranded\x20at\x20an\x20un-railied\x20terminal;\x20ofshop:\x200.25\x20stranded\x20at\x20\x27expired\x27).\x20Every\x20terminal\x20'+'needs\x20a\x20settlement/refund\x20allocator\x20whose\x20guard\x20gates\x20progress.current\x20==\x20<terminal>\x20(canonical\x20designs:\x20'+'tpl_allocator_node_gate_settle\x20/\x20tpl_allocator_node_gate_refund,\x20M-T12).\x20If\x20the\x20pool\x20legitimately\x20drains\x20'+'at\x20an\x20earlier\x20node,\x20add\x20a\x20zero-value\x20anchor\x20row\x20on\x20the\x20terminal\x20rail\x20so\x20the\x20guard\x20resolves\x20without\x20paying'),{'critical':h,'warnings':i};}function collectGuardNodeGates(a,b){const c=a['data']??a;for(const d of parseGuardNodeGates(c?.['root'],c?.['table']))b['add'](d);}async function checkArbitrationNeutrality(b,c){const d=[],f=[],g=[],h=p=>{const q=typeof p==='string'?p:p?.['object']??p?.['name'];if(typeof q==='string'&&q!==''&&!g['includes'](q))g['push'](q);};for(const p of Array['isArray'](b['arbitrations'])?b['arbitrations']:[])h(p);let i=typeof b['permission']==='string'?b['permission']:undefined;const j=typeof b['object']==='string'?b['object']:undefined;if(j){let q;try{const r=await batchQueryObjectsByIds([j],c,!![]);q=(r??[])['find'](s=>s?.['type']==='Service');}catch(s){f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+j+'\x22\x20'+('('+(s instanceof Error?s['message']:String(s))+').\x20Verify\x20manually\x20that\x20every\x20bound\x20arbitration\x27s\x20')+'Permission\x20owner/admin\x20set\x20is\x20DISJOINT\x20from\x20the\x20service\x27s\x20controller\x20keys\x20before\x20publishing');}if(q){const t=q['data']??q;if(!i&&typeof t['permission']==='string')i=t['permission'];for(const u of Array['isArray'](t['arbitrations'])?t['arbitrations']:[])h(u);}}if(g['length']===0x0)return{'critical':d,'warnings':f};if(!i)return f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20the\x20service\x20Permission\x20address\x20is\x20not\x20resolvable\x20'+'from\x20this\x20call\x20(no\x20payload\x20\x27permission\x27,\x20service\x20object\x20not\x20found).\x20The\x20bound\x20arbitrations\x27\x20controller\x20'+'keys\x20are\x20UNVERIFIED:\x20confirm\x20each\x20arbitration\x20Permission\x27s\x20owner/admin\x20set\x20is\x20disjoint\x20from\x20the\x20service\x27s\x20'+'controller\x20keys\x20(same-controller\x20arbitration\x20=\x20the\x20merchant\x20can\x20rule\x20their\x20own\x20disputes)'),{'critical':d,'warnings':f};let k;try{k=await batchQueryObjectsByIds([i,...g],c,!![]);}catch(v){return f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20object\x20query\x20failed\x20'+('('+(v instanceof Error?v['message']:String(v))+').\x20Verify\x20the\x20arbitration\x20Permissions\x27\x20owner/admin\x20sets\x20')+'are\x20disjoint\x20from\x20the\x20service\x27s\x20controller\x20keys\x20before\x20publishing'),{'critical':d,'warnings':f};}const l=w=>(k??[])['find'](x=>{const y=x;return typeof y?.['object']==='string'&&y['object']['toLowerCase']()===w['toLowerCase']()||typeof y?.['query_name']==='string'&&y['query_name']['toLowerCase']()===w['toLowerCase']();}),m=w=>{if(!w)return new Set();const x=w['data']??w,y=new Set();for(const z of[x['builder']])if(typeof z==='string'&&z)y['add'](z['toLowerCase']());for(const A of Array['isArray'](x['admin'])?x['admin']:[])if(typeof A==='string'&&A)y['add'](A['toLowerCase']());return y;},n=l(i),o=m(n);if(o['size']===0x0)return f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20service\x20Permission\x20\x22'+i+'\x22\x20not\x20found\x20or\x20'+'carries\x20no\x20builder/admin\x20list.\x20The\x20bound\x20arbitrations\x27\x20controller\x20keys\x20are\x20UNVERIFIED\x20—\x20confirm\x20disjointness\x20manually'),{'critical':d,'warnings':f};for(const w of g){const x=l(w);if(!x){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20not\x20found\x20on-chain\x20(or\x20not\x20yet\x20indexed)\x20—\x20its\x20Permission\x20controller\x20'+'keys\x20are\x20UNVERIFIED.\x20Confirm\x20the\x20arbitration\x20Permission\x27s\x20builder/admin\x20set\x20is\x20disjoint\x20from\x20the\x20service\x27s\x20'+'controller\x20keys\x20(same-controller\x20arbitration\x20=\x20the\x20merchant\x20can\x20rule\x20their\x20own\x20disputes)');continue;}const y=x['data']??x;y['bPaused']===!![]&&d['push']('pre_publish:\x20R-ARB-PAUSED\x20—\x20arbitration\x20\x22'+w+'\x22\x20is\x20PAUSED.\x20Every\x20dispute\x20against\x20this\x20service\x20'+'will\x20abort\x20(arbitration::E_PAUSED)\x20while\x20the\x20arbitration\x20stays\x20paused\x20—\x20case_open,\x20voting\x20and\x20'+'conclusion\x20are\x20all\x20dead-locked.\x20New\x20Arbitrations\x20are\x20created\x20paused\x20by\x20default;\x20the\x20arbitration\x20'+('owner\x20must\x20un-pause\x20it\x20BEFORE\x20this\x20publish:\x20{operation_type:\x22arbitration\x22,\x20data:{object:\x22'+w+'\x22,\x20pause:false}}'));const z=typeof y['permission']==='string'?y['permission']:undefined;if(!z){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20exposes\x20no\x20permission\x20address\x20—\x20controller-key\x20disjointness\x20UNVERIFIED');continue;}if(z['toLowerCase']()===i['toLowerCase']()){d['push']('pre_publish:\x20R-ARB-SAME-CONTROLLER\x20—\x20arbitration\x20\x22'+w+'\x22\x20shares\x20the\x20service\x27s\x20Permission\x20object\x20'+('('+i+').\x20The\x20chain\x20aborts\x20this\x20binding\x20(E_ARBITRATION_PERMISSION_CONFLICT);\x20bind\x20an\x20')+'arbitration\x20with\x20its\x20own\x20independent\x20Permission');continue;}if(!l(z))try{const D=await batchQueryObjectsByIds([z],c,!![]);k=[...k??[],...D??[]];}catch(E){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20Permission\x20\x22'+z+'\x22\x20could\x20not\x20be\x20queried\x20'+('('+(E instanceof Error?E['message']:String(E))+')\x20—\x20controller-key\x20disjointness\x20UNVERIFIED'));continue;}const A=m(l(z));if(A['size']===0x0){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20Permission\x20\x22'+z+'\x22\x20not\x20found\x20or\x20carries\x20no\x20builder/admin\x20list\x20—\x20'+'controller-key\x20disjointness\x20UNVERIFIED');continue;}const B=[...o]['filter'](F=>A['has'](F));B['length']>0x0&&d['push']('pre_publish:\x20R-ARB-SAME-CONTROLLER\x20—\x20the\x20arbitration\x20\x22'+w+'\x22\x20is\x20NOT\x20controller-independent:\x20'+('EOA(s)\x20'+B['join'](',\x20')+'\x20appear\x20in\x20BOTH\x20the\x20service\x20Permission\x20('+i+')\x20and\x20the\x20')+('arbitration\x20Permission\x20('+z+')\x20builder/admin\x20sets.\x20Object\x20isolation\x20is\x20enforced\x20on-chain\x20')+'(different\x20Permission\x20objects),\x20but\x20controller\x20isolation\x20is\x20NOT:\x20a\x20shared\x20EOA\x20can\x20confirm,\x20vote\x20in,\x20'+'and\x20rule\x20the\x20service\x27s\x20disputes\x20—\x20arbitration\x20neutrality\x20collapses\x20(live\x20mainnet:\x20the\x20reused\x20arb\x27s\x20'+'Permission\x20builder\x20AND\x20sole\x20admin\x20was\x20the\x20merchant).\x20Bind\x20an\x20arbitration\x20whose\x20Permission\x20is\x20controlled\x20'+'by\x20physically\x20independent\x20keys');const C=arbitrationVotingLockDetail(y['voting_guard']);C!==null&&d['push']('pre_publish:\x20R-ARB-VOTE-LOCK\x20—\x20arbitration\x20\x22'+w+'\x22:\x20'+C);}return{'critical':d,'warnings':f};}async function runPreBuyChecks(a,b){const c=[],d=[],f=extractData(b)??{},g=b?.['env']?.['network'],h=f['object'];let i;try{i=await batchQueryObjectsByIds([h],g,!![]);}catch(m){return d['push']('pre_buy:\x20allocator\x20screening\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+h+'\x22\x20'+('('+(m instanceof Error?m['message']:String(m))+');\x20the\x20purchase\x20was\x20NOT\x20screened.\x20')+'Verify\x20the\x20service\x27s\x20order_allocators\x20yourself\x20(query_toolkit\x20query_type=\x27service_panorama\x27)\x20before\x20trusting\x20this\x20buy'),{'critical':c,'warnings':d};}const j=(i??[])['find'](n=>n?.['type']==='Service');if(!j)return d['push']('pre_buy:\x20allocator\x20screening\x20DEGRADED\x20—\x20service\x20\x22'+h+'\x22\x20not\x20found\x20on-chain\x20(or\x20not\x20yet\x20indexed);\x20'+'the\x20purchase\x20was\x20NOT\x20screened.\x20Verify\x20the\x20address/network\x20and\x20the\x20service\x27s\x20order_allocators\x20before\x20trusting\x20this\x20buy'),{'critical':c,'warnings':d};const k=j['data']??j;k['bPublished']!==!![]&&c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20is\x20NOT\x20published\x20—\x20the\x20buy\x20aborts\x20on-chain\x20(E_NOT_PUBLISHED)');k['bPaused']===!![]&&c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20is\x20paused\x20—\x20the\x20buy\x20aborts\x20on-chain\x20(E_PAUSED)');const l=k['order_allocators'];if(l==null)c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20has\x20NO\x20order_allocators\x20—\x20the\x20payment\x20step\x20aborts\x20(no\x20distribution\x20plan).\x20'+'Funds\x20committed\x20to\x20this\x20service\x20would\x20have\x20NO\x20distribution\x20path\x20(the\x20fund-lock\x20incident\x20class).\x20'+'Do\x20not\x20buy\x20until\x20the\x20merchant\x20configures\x20an\x20allocator\x20plan');else{if(!Array['isArray'](l['allocators'])||l['allocators']['length']===0x0)c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20order_allocators\x20is\x20EMPTY\x20—\x20the\x20payment\x20step\x20aborts\x20(EALLOCATORS_EMPTY).\x20'+'Do\x20not\x20buy\x20until\x20the\x20merchant\x20configures\x20at\x20least\x20one\x20allocator');else{const n=f['buy'],o=Array['isArray'](n?.['items'])?n['items']:[],p=Array['isArray'](k['sales'])?k['sales']:[];let q=0x0,r=o['length']>0x0;const s=[];for(const v of o){const w=v,x=numericBalance(w?.['quantity']),y=p['find'](A=>A?.['name']===w?.['name']),z=numericBalance(y?.['price']);if(x===undefined||z===undefined){r=![],s['push'](typeof w?.['name']==='string'?w['name']:JSON['stringify'](w?.['name']));continue;}q+=z*x;}const t=numericBalance(l['threshold']);if(!r)d['push']('pre_buy:\x20could\x20not\x20price\x20'+s['length']+'\x20cart\x20item(s)\x20['+s['join'](',\x20')+']\x20against\x20the\x20service\x27s\x20on-chain\x20sales\x20—\x20'+'allocator-threshold\x20coverage\x20UNVERIFIED\x20for\x20this\x20cart\x20(unknown\x20items\x20also\x20abort\x20the\x20quote\x20step).\x20'+'Confirm\x20every\x20item\x20name\x20matches\x20a\x20current\x20sale\x20entry');else t!==undefined&&t>q&&c['push']('pre_buy:\x20allocator\x20threshold\x20'+t+'\x20exceeds\x20this\x20cart\x27s\x20total\x20'+q+'\x20(Σ\x20price×quantity\x20over\x20the\x20on-chain\x20sales)\x20—\x20'+'the\x20payment\x20step\x20aborts\x20(EINSUFFICIENT_BALANCE):\x20pool\x20creation\x20requires\x20amount\x20>=\x20threshold.\x20'+'The\x20merchant\x20must\x20lower\x20the\x20threshold\x20(new\x20service\x20—\x20threshold\x20is\x20frozen\x20at\x20publish)\x20or\x20the\x20cart\x20must\x20grow');n?.['discount']!=null&&r&&t!==undefined&&t<=q&&d['push']('pre_buy:\x20a\x20discount\x20is\x20applied\x20—\x20the\x20discounted\x20total\x20may\x20fall\x20below\x20the\x20list\x20total\x20'+q+'\x20used\x20here;\x20'+('if\x20it\x20lands\x20under\x20the\x20allocator\x20threshold\x20'+t+',\x20the\x20payment\x20step\x20aborts\x20(EINSUFFICIENT_BALANCE)'));const u=await lintAllocatorGuardSet([l],g,'pre_buy','critical');c['push'](...u['critical']),d['push'](...u['warnings']);}}return{'critical':c,'warnings':d};}export function lintSalesWipBindings(a,b){const c=[],d=[],e=Array['isArray'](a)?a:[];for(const f of e){const g=typeof f?.['wip']==='string'?f['wip']['trim']():'';if(g==='')continue;const h=typeof f?.['wip_hash']==='string'&&f['wip_hash']['trim']()!==''?f['wip_hash']['trim']():undefined,i=getWipVerifyRecord(g);if(i===undefined){c['push']('pre_publish:\x20a\x20sale\x20binds\x20WIP\x20\x22'+g+'\x22\x20that\x20THIS\x20session\x20never\x20verified\x20—\x20BLOCKED\x20(R2-08②,\x20alg26\x20'+'F-A26-03:\x20upload\x20responses\x20are\x20an\x20infra\x20passthrough\x20that\x20echoed\x20another\x20account\x27s\x20file\x20URL,\x20and\x20the\x20'+'chain\x20only\x20checks\x20hash-vs-URL\x20self-consistency\x20at\x20quote).\x20Before\x20publishing,\x20run\x20'+('wip_file\x20type=\x22verify\x22\x20wipFilePath=\x22'+g+'\x22')+(h!==undefined?'\x20hash_equal=\x22'+h+'\x22':'')+'\x20and\x20retry\x20only\x20on\x20a\x20valid\x20result.\x20(An\x20MCP\x20restart\x20clears\x20the\x20session\x20ledger\x20—\x20re-run\x20the\x20verify.)');continue;}if(h!==undefined){if(i['hash_equal']!==undefined&&i['hash_equal']!==h)c['push']('pre_publish:\x20a\x20sale\x20binds\x20wip_hash\x20\x22'+h+'\x22\x20but\x20the\x20WIP\x20\x22'+g+'\x22\x20was\x20equality-verified\x20'+('against\x20\x22'+i['hash_equal']+'\x22\x20—\x20hash\x20MISMATCH,\x20BLOCKED\x20(R2-08②).\x20Re-verify\x20with\x20')+('hash_equal=\x22'+h+'\x22\x20or\x20correct\x20the\x20sale\x27s\x20wip_hash.'));else i['hash_equal']===undefined&&d['push']('pre_publish:\x20sale\x20binds\x20wip_hash\x20on\x20WIP\x20\x22'+g+'\x22\x20that\x20was\x20only\x20integrity-verified\x20(no\x20'+'hash_equal)\x20—\x20run\x20wip_file\x20verify\x20with\x20hash_equal=\x22'+h+'\x22\x20to\x20close\x20the\x20gap\x20'+'(the\x20chain\x20re-checks\x20at\x20quote,\x20E_WIP_HASH_NOT_MATCH;\x20a\x20mismatched\x20bind\x20surfaces\x20as\x20a\x20buyer-side\x20abort)');}const j=i['upload_account'];j!==undefined&&b!==undefined&&j!==b&&!i['signature_verified']&&c['push']('pre_publish:\x20WIP\x20\x22'+g+'\x22\x20was\x20uploaded\x20by\x20account\x20\x22'+j+'\x22\x20but\x20is\x20bound/published\x20by\x20'+('\x22'+b+'\x22\x20without\x20an\x20owner\x20signature\x20—\x20BLOCKED\x20(R2-08③).\x20Either\x20upload\x20with\x20\x22'+b+'\x22,\x20')+'or\x20re-verify\x20with\x20requireSignature=true\x20(the\x20file\x27s\x20owner\x20signature\x20IS\x20the\x20explicit\x20delegate\x20proof)\x20and\x20retry.');}return{'critical':c,'warnings':d};}export async function runPrePublishChecks(a,b){const c=[],d=[],g=extractOperationType(a,b),h=extractData(b)??{},i=b?.['env']?.['network'];if(g==='machine'){const j=h['node'];let l=Array['isArray'](j)?j:Array['isArray'](j?.['nodes'])?j['nodes']:[];if(l['length']===0x0&&typeof h['object']==='string'){const m=h['object'];try{const n=await fetchMachineNodes(m,i,!![]);n['length']>0x0&&(l=n,d['push']('pre_publish:\x20machine\x20\x22'+m+'\x22\x20published\x20by\x20reference\x20—\x20audited\x20against\x20its\x20'+(n['length']+'\x20on-chain\x20node(s)\x20(effective-state\x20gate)')));}catch(o){c['push']('pre_publish:\x20could\x20not\x20fetch\x20on-chain\x20nodes\x20for\x20machine\x20\x22'+m+'\x22\x20'+('('+(o instanceof Error?o['message']:String(o))+')\x20—\x20topology\x20UNVERIFIABLE;\x20publish\x20blocked.\x20')+'Retry\x20when\x20the\x20network\x20is\x20reachable;\x20every\x20guarded\x20forward\x20must\x20carry\x20the\x20protocol\x20slot\x20254\x20'+'submission\x20row\x20and\x20topology\x20is\x20immutable\x20after\x20publish\x20(IMMUT-001)');}}if(l['length']>0x0){const p=h['reentry_kind'],q=p==='none'||p==='review-loop'||p==='paid-cycle'?p:undefined;p!==undefined&&q===undefined&&d['push']('pre_publish:\x20ignored\x20invalid\x20reentry_kind\x20\x22'+String(p)+'\x22\x20—\x20'+'valid\x20values:\x20none\x20(default,\x20word-stem\x20classification)\x20/\x20review-loop\x20(same-order\x20no-charge\x20revisits)\x20/\x20paid-cycle\x20(per-revisit\x20fee,\x20fund\x20gate\x20required)');const s=auditMachineNodes(l,q);c['push'](...s['critical']),d['push'](...s['warnings']);const t=await fetchForwardGuardIndex(l,i),u=lintForwardGuardsTaskBinding(t);c['push'](...u['critical']),d['push'](...u['warnings']);const v=lintForwardReviewLocks(l,t);c['push'](...v['critical']),d['push'](...v['warnings']);const w=lintForwardGuardsTimeProfile(t);c['push'](...w['critical']),d['push'](...w['warnings']);try{const x=lintMachineTaskBindingPreflight({'refs':[...t['refs']['values']()],'resolved':[...t['refs']]['flatMap'](([y,z])=>{const A=t['defs']['get'](y);if(A===undefined)return[];const B=A['data'],C=B!==null&&typeof B==='object'?B:A;return[{'ref':z,'table':C['table']}];}),'readError':t['error']});for(const y of x)d['push'](formatTaskBindingAdvisory(y));}catch{}}else typeof h['object']!=='string'&&d['push']('pre_publish:\x20publishing\x20machine\x20without\x20inline\x20node\x20data\x20—\x20topology\x20not\x20verifiable\x20in\x20this\x20call;\x20'+'verify\x20nodes/pairs/forwards\x20via\x20machineNode2file\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001)');d['push']('pre_publish:\x20machine\x20nodes/pairs/forwards\x20become\x20immutable\x20after\x20publish\x20(IMMUT-001)');}if(g==='service'){d['push']('pre_publish:\x20service\x20machine/order_allocators/arbitrations\x20become\x20immutable\x20after\x20publish\x20(IMMUT-002);\x20sales\x20remains\x20modifiable');h['machine']===undefined&&d['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call\x20(the\x20store\x20may\x20already\x20be\x20bound\x20—\x20verify\x20before\x20assuming\x20otherwise):\x20'+'query_toolkit\x20query_type=\x27service_panorama\x27\x20and\x20read\x20service.machine;\x20an\x20unset\x20machine\x20cannot\x20process\x20orders\x20and\x20CANNOT\x20be\x20fixed\x20after\x20publish\x20(IMMUT-002)');const z=h['order_allocators'];if(z!=null&&(!Array['isArray'](z['allocators'])||z['allocators']['length']===0x0))c['push']('pre_publish:\x20order_allocators\x20is\x20EMPTY\x20in\x20THIS\x20publish\x20call\x20—\x20the\x20publish\x20aborts\x20on-chain\x20'+'(\x22No\x20allocator\x20configured\x22).\x20Declare\x20at\x20least\x20one\x20allocator\x20row\x20in\x20the\x20payload\x20'+'(order_allocators\x20is\x20immutable\x20after\x20publish,\x20IMMUT-002)');else{if(z===undefined){const I=h['object'],J=typeof I==='string'?I['trim']():'';let K=![];if(J!=='')try{const L=await batchQueryObjectsByRef([J],i,!![]),M=L['get'](J['toLowerCase']()),N=M?.['data']??M;if(M!=null&&N!=null){K=!![];const O=N['order_allocators'],P=Array['isArray'](O?.['allocators'])?O['allocators']['length']:0x0;P===0x0?c['push']('pre_publish:\x20service\x20\x22'+J+'\x22\x20has\x20NO\x20order_allocators\x20on\x20chain\x20and\x20none\x20in\x20THIS\x20call\x20—\x20'+'the\x20publish\x20aborts\x20on-chain\x20(\x22No\x20allocator\x20configured\x22).\x20Declare\x20at\x20least\x20one\x20allocator\x20row\x20in\x20the\x20publish\x20payload\x20'+'(order_allocators\x20is\x20immutable\x20after\x20publish,\x20IMMUT-002)'):d['push']('pre_publish:\x20\x27order_allocators\x27\x20absent\x20from\x20THIS\x20call\x20—\x20chain\x20state\x20verified:\x20'+P+'\x20allocator\x20row(s)\x20already\x20configured');}}catch{}!K&&d['push']('pre_publish:\x20\x27order_allocators\x27\x20absent\x20from\x20THIS\x20call\x20(the\x20store\x20may\x20already\x20be\x20configured\x20—\x20verify\x20before\x20assuming\x20otherwise):\x20'+'query_toolkit\x20query_type=\x27service_panorama\x27\x20and\x20read\x20order_allocators;\x20immutable\x20after\x20publish,\x20and\x20a\x20NEVER-configured\x20service\x20aborts\x20the\x20publish\x20on-chain\x20'+'(\x22No\x20allocator\x20configured\x22)\x20(IMMUT-002)');}}if(h['publish']===!![])try{const Q=h,R=Q['object'],S=R??{};let T=typeof Q['machine']==='string'?Q['machine']:typeof Q['machine']?.['object']==='string'?Q['machine']['object']:typeof S['machine']==='string'?S['machine']:'',U=typeof S['permission']==='string'?S['permission']:'';const V=typeof R==='string'?R['trim']():'';if((!T||!U)&&V!==''){const W=await batchQueryObjectsByRef([V],i,!![]),X=W['get'](V['toLowerCase']()),Y=X?.['data']??X;if(Y!=null){if(!T&&typeof Y['machine']==='string')T=Y['machine'];if(!U&&typeof Y['permission']==='string')U=Y['permission'];}}if(T!==''&&U!==''){const Z=await fetchMachineNodes(T,i,!![]),a0=collectPermissionIndexes(Z),a1=a0['requiredIndexes']['filter'](a2=>a2>=0x3e8);if(a1['length']>0x0){let a2=U;if(!a2['startsWith']('0x')){const a3=await LocalMark['Instance']()['get'](a2)['catch'](()=>undefined);if(a3?.['address'])a2=a3['address'];}if(a2['startsWith']('0x')){const a4=await query_objects({'objects':[a2],'network':i}),a5=a4?.['objects']?.[0x0];if(a5){const a6={'address':a2,'entity_count':a5['entity_count'],'perm_remark':a5['perm_remark'],'owner':a5['owner']??a5['builder'],'admin':a5['admin']};try{a6['entityPermissions']=await fetchEntityPermissions(a2,i);}catch{}const a7=checkPermissionAuthorization(a1,a6);if(!a7['allAuthorized'])d['push']('pre_publish:\x20bound\x20Machine\x20\x22'+T+'\x22\x20forwards\x20use\x20permission\x20index(es)\x20['+a7['missingIndexes']['join'](',\x20')+']\x20'+('with\x20NO\x20entity\x20grant\x20in\x20the\x20bound\x20Permission\x20\x22'+a2+'\x22\x20—\x20every\x20rail\x20on\x20those\x20indexes\x20aborts\x20(code\x205)\x20until\x20granted\x20')+'(gfm31\x20P05:\x20a\x20store\x20shipped\x20with\x201000/1002\x20ungranted;\x20both\x20edges\x20aborted\x20for\x203.5\x20minutes\x20after\x20publish).\x20'+('Grant\x20NOW\x20via\x20{\x20operation_type:\x27permission\x27,\x20data:{\x20object:\x27'+a2+'\x27,\x20permission:{\x20op:\x27add\x20perm\x20by\x20index\x27,\x20index:<N>,\x20entity:[\x27<address>\x27]\x20}\x20}\x20}\x20—\x20')+'grantable\x20any\x20time\x20(Permission\x20is\x20NOT\x20frozen\x20by\x20publish,\x20L3),\x20but\x20grant\x20BEFORE\x20first\x20orders\x20to\x20keep\x20the\x20build\x20one-pass.');else!a7['allVerified']&&d['push']('pre_publish:\x20could\x20NOT\x20verify\x20grants\x20for\x20permission\x20index(es)\x20['+a1['join'](',\x20')+']\x20on\x20Permission\x20\x22'+a2+'\x22\x20'+'(PermissionPerm\x20entity\x20table\x20unreadable)\x20—\x20they\x20are\x20NOT\x20confirmed\x20authorized.\x20Verify\x20via\x20onchain_table\x20listing\x20the\x20Permission\x27s\x20'+'perm\x20entries\x20before\x20first\x20orders\x20(gfm31\x20P05\x20dead-rail\x20window).');}}}}}catch{}const A=h,B=numericBalance(A['compensation_fund_add']?.['balance']);if(B!==undefined&&B>0x0){const a8=A['sales'],a9=(Array['isArray'](a8?.['sales'])?a8['sales']:[])['map'](aa=>numericBalance(aa?.['price']?.['balance']))['filter'](aa=>aa!==undefined);if(a9['length']>0x0){const aa=a9['reduce']((ac,ad)=>ac+ad,0x0),ab=aa*0x3;if(ab>0x0){const ac=B/ab,ad='fund='+B+',\x20highest-SKU\x20single\x20order=Σ(price×1)='+aa+'\x20(quantity\x20set\x20at\x20buy\x20time),\x20'+('award\x20cap=3×order='+ab+'\x20(MAX_INDEMNITY_MULTIPLE),\x20coverage='+ac['toFixed'](0x2));ac<0x1&&d['push']('pre_publish:\x20compensation-fund\x20coverage\x20below\x20the\x20award\x20ceiling\x20—\x20'+ad+'\x20<\x201.\x20'+'Disclosure\x20only\x20(b6-11):\x20this\x20does\x20NOT\x20block\x20publish.\x20Per-order\x20coverage\x20is\x20enforced\x20at\x20'+'BUY\x20time\x20—\x20orders\x20are\x20rejected\x20while\x20the\x20fund\x20cannot\x20cover\x203x\x20that\x20order,\x20so\x20top\x20up\x20via\x20'+'compensation_fund_add\x20as\x20your\x20catalog\x27s\x20order\x20sizes\x20require\x20(no\x20cross-SKU\x20subsidy).\x20'+'Awards\x20beyond\x20the\x20fund\x20abort\x20the\x20claim\x20(code\x2027)\x20—\x20settlement\x20is\x20all-or-nothing,\x20nothing\x20partial\x20is\x20paid;\x20top\x20up\x20and\x20the\x20winner\x20retries.');}}else d['push']('pre_publish:\x20compensation_fund_add\x20present\x20but\x20\x27sales\x27\x20absent\x20from\x20THIS\x20call\x20(sales\x20may\x20already\x20be\x20configured\x20—\x20verify,\x20do\x20not\x20assume):\x20'+'the\x20fund\x20should\x20cover\x203×\x20each\x20order\x20you\x20want\x20to\x20sell\x20(MAX_INDEMNITY_MULTIPLE=3;\x20enforced\x20per-order\x20at\x20buy\x20time).\x20'+'query_toolkit\x20query_type=\x27service_panorama\x27\x20to\x20read\x20the\x20current\x20sales\x20prices,\x20then\x20re-check\x20coverage.');}const C=A['sales']?.['sales'];if(C!==undefined){const ae=typeof A['account']==='string'&&A['account']['trim']()!==''?A['account']['trim']():undefined,af=lintSalesWipBindings(C,ae);c['push'](...af['critical']),d['push'](...af['warnings']);}const D=await lintAllocatorGuards(A,i);c['push'](...D['critical']),d['push'](...D['warnings']);const E=A['order_allocators']!==undefined||A['order_allocators_append']!==undefined,F=A['publish']===!![]&&typeof A['object']==='string'&&A['object']['trim']()!=='';if(E||F){const ag=A['machine'],ah=typeof ag==='string'&&ag['trim']()!=='';if(ah||F){const ai=await lintServiceEscrowExitCoverage(ah?ag:undefined,[A['order_allocators'],A['order_allocators_append']],i,F?A['object']:undefined);c['push'](...ai['critical']),d['push'](...ai['warnings']);}else d['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call\x20—\x20escrow-exit\x20terminal\x20coverage\x20not\x20auditable\x20here;\x20'+'if\x20the\x20machine\x20is\x20already\x20bound,\x20every\x20machine\x20terminal\x20needs\x20an\x20allocator\x20rail\x20(immutable\x20after\x20publish,\x20IMMUT-002)');}const G=await checkArbitrationNeutrality(A,i);c['push'](...G['critical']),d['push'](...G['warnings']);if(A['arbitrations']!==undefined||A['arbitrations_append']!==undefined){const aj=await lintAllocatorRailPairing(A,i);c['push'](...aj['critical']),d['push'](...aj['warnings']);}const H=new Set(rewardRefsOf(A)['map'](ak=>ak['toLowerCase']()));if(H['size']===0x0&&A['publish']===!![]&&typeof A['object']==='string')try{const ak=await batchQueryObjectsByIds([A['object']],i,!![]),al=(ak??[])[0x0],am=al?.['data']??al,an=Array['isArray'](am?.['rewards'])?am['rewards']:[];for(const ao of an){if(typeof ao==='string'&&ao['trim']()!=='')H['add'](ao['toLowerCase']());}}catch(ap){d['push']('pre_publish:\x20reward-funding\x20gate\x20skipped\x20—\x20could\x20not\x20read\x20the\x20service\x27s\x20on-chain\x20rewards\x20'+('('+(ap instanceof Error?ap['message']:String(ap))+');\x20verify\x20every\x20attached\x20Reward\x20pool\x20is\x20funded\x20')+'up\x20to\x20expected_orders\x20x\x20per-claim\x20amount\x20BEFORE\x20publish');}if(H['size']>0x0)try{const aq=await batchQueryObjectsByIds([...H['values']()],i,!![]),ar=new Map();for(const as of aq??[]){const at=as;if(at?.['type']!=='Reward')continue;for(const au of[at['query_name'],at['object']]){if(typeof au==='string'&&au!=='')ar['set'](au['toLowerCase'](),at);}}for(const av of H){const aw=ar['get'](av);if(!aw){d['push']('pre_publish:\x20attached\x20reward\x20\x22'+av+'\x22\x20not\x20found\x20on-chain\x20—\x20funding\x20check\x20skipped\x20for\x20it;\x20'+'an\x20unfunded\x20pool\x20publishes\x20silently\x20and\x20claims\x20abort\x20when\x20it\x20drains');continue;}const ax=serviceRewardsUnfundedDetail(aw);ax&&c['push']('pre_publish:\x20OFN-C\x20reward-pool\x20funding\x20—\x20reward\x20\x22'+av+'\x22:\x20'+ax);}}catch(ay){d['push']('pre_publish:\x20reward-funding\x20gate\x20skipped\x20—\x20could\x20not\x20query\x20reward\x20objects\x20'+('('+(ay instanceof Error?ay['message']:String(ay))+');\x20verify\x20every\x20attached\x20Reward\x20pool\x20is\x20funded\x20')+'up\x20to\x20expected_orders\x20x\x20per-claim\x20amount\x20BEFORE\x20publish');}}return{'critical':c,'warnings':d};}function buildHarnessBlockResult(a,b,c,d,e,f){const g=[...c['map'](i=>'CRITICAL:\x20'+i),...d['map'](i=>'WARN:\x20'+i)]['join']('\x0a'),h='Error:\x20'+b+(g?'\x0a'+g:'')+'\x0aRecovery:\x20'+f;return{'content':[{'type':'text','text':h}],'structuredContent':{'outcome':'failed','result':{'type':'error','error':b+'\x20[gate='+a+']','error_code':e,'retryable':![],'recovery_hint':f},'message':h,'recovery':recover(e,'harness:'+a)}};}function extractCriticalFindingCount(a){const b=a?.['structuredContent'];if(!b)return 0x0;const c=b['semantic'],d=c?.['summary'];if(typeof d?.['critical_count']==='number'&&d['critical_count']>0x0)return d['critical_count'];const e=b['findings']??c?.['findings'];if(Array['isArray'](e))return e['filter'](h=>h?.['severity']==='error')['length'];const f=a?.['content']?.['map'](h=>'text'in h?h['text']:'')['join']('\x0a')??'',g=f['match'](/\[AUDIT ERROR\]/g);return g?g['length']:0x0;}
|
|
1
|
+
import{classifyError,buildDataSemantic}from'../schema/call/semantic.js';import{buildClassifiedErrorResult}from'./shared.js';import{getWipVerifyRecord}from'./wip-verify-ledger.js';import{shouldRunLightHooks,shouldRunHeavyHooks,recordOperationFailure,recordCriticalRisk,recordCriticalOperation,recordSubstepFailure}from'../harness/auto-escalation.js';import{getHarnessTier,setHarnessTier,isEnabled}from'../config/runtime.js';import{getHarness}from'../harness/index.js';import{TASK_BINDING_SLOT}from'../knowledge/onchain-constants.js';import{recover}from'../harness/recover.js';import{stableOperationId}from'../harness/operation-id.js';import{recordOperationOutcome}from'../experience/index.js';import{recordIndustrySignal}from'../knowledge/flywheel-loop.js';import{getStageCache}from'../playbooks/service-build/index.js';import{SERVICE_BUILD_STAGES}from'../playbooks/service-build/process.js';import{extractAmount,getAmountThreshold,formatAmount}from'../knowledge/safety-rules.js';import{LocalMark,query_objects,query_serviceContext}from'@wowok/wowok';import{arbitrationVotingLockDetail,auditMachineNodes,computeTerminalReachability,formatTaskBindingAdvisory,guardTimeProfileDetail,lintMachineTaskBindingPreflight,lintReviewLockedTerminals,lintTaskBindingAdvisories,rewardRefsOf,serviceRewardsUnfundedDetail}from'../knowledge/audit-rules.js';import{lintGuard}from'../knowledge/guard-lint.js';import{parseGuardNodeGates}from'../knowledge/guard-node-gates.js';import{batchQueryObjectsByIds,batchQueryObjectsByRef,fetchMachineNodes}from'../graph/onchain/sdk-batch.js';import{collectPermissionIndexes,checkPermissionAuthorization}from'../schema/utils/permission-machine-check.js';import{fetchEntityPermissions}from'../playbooks/service-build/participation-radar.js';import{verifyAllocatorRails}from'../knowledge/allocator-rail-verifier.js';function stageIndexOf(a){const b=SERVICE_BUILD_STAGES['indexOf'](a);return b>=0x0?b:0x0;}export function withTimeout(a,b=0x7530,c='operation'){let d;return Promise['race']([a['finally'](()=>{if(d)clearTimeout(d);}),new Promise((e,f)=>{d=setTimeout(()=>{let g='';if(c['includes']('messenger'))g='\x20This\x20is\x20a\x20messenger\x20network\x20operation.\x20Possible\x20causes:\x20'+'(1)\x20messenger\x20server\x20(https://messenger.wowok.net)\x20unreachable,\x20'+'(2)\x20no\x20messenger-enabled\x20account\x20configured\x20(use\x20account_operation\x20to\x20set\x20messenger\x20name),\x20'+'(3)\x20network\x20connectivity\x20issue.\x20'+'Ensure\x20you\x20have\x20a\x20messenger-enabled\x20account\x20and\x20the\x20server\x20is\x20reachable.';else(c['includes']('onchain')||c['includes']('account_operation')||c['includes']('bridge')||c['includes']('workflow')||c['includes']('keeper')||c['includes']('wowok'))&&(g='\x20This\x20tool\x20may\x20submit\x20an\x20ON-CHAIN\x20transaction.\x20The\x20transaction\x20was\x20NOT\x20cancelled\x20'+'by\x20this\x20timeout\x20—\x20it\x20may\x20already\x20be\x20submitted\x20and\x20still\x20finalize\x20on-chain.\x20'+'DO\x20NOT\x20blindly\x20retry\x20(risk\x20of\x20duplicate\x20operations).\x20First\x20verify:\x20'+'(1)\x20if\x20the\x20error\x20above\x20carries\x20a\x20tx\x20digest,\x20check\x20it\x20via\x20query_toolkit\x20'+'(query_type=\x27onchain_transaction\x27);\x20(2)\x20otherwise\x20verify\x20via\x20query_toolkit\x20'+'onchain_events\x20(or\x20the\x20account\x27s\x20recent\x20transactions).\x20Do\x20NOT\x20rely\x20on\x20an\x20'+'onchain_objects\x20read\x20alone:\x20it\x20may\x20serve\x20a\x20pre-transaction\x20cached\x20snapshot,\x20'+'so\x20an\x20unchanged\x20object\x20must\x20never\x20on\x20its\x20own\x20justify\x20a\x20retry.');f(new Error('Operation\x20\x27'+c+'\x27\x20timed\x20out\x20after\x20'+b+'ms.'+g));},b);})]);}export function wrapHandlerWithErrorShape(a,b,c,d,e){return async(f,g)=>{try{return await withTimeout(a(f,g),b,c);}catch(h){let i=h instanceof Error?h['message']:String(h);if(e&&i['includes']('timed\x20out\x20after\x20'+b+'ms'))try{const j=await e(f);if(j){i=i+'\x0a'+j;if(h instanceof Error)h['message']=i;}}catch{}if(d){const k=classifyError(i,h),l={'operation_type':c,'data':f},m=d(i,k,l);return{'content':[{'type':'text','text':'Error:\x20'+i}],'structuredContent':m};}throw h;}};}export const statusErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'status':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const operationErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'operation':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const strictStatusErrorShape=(a,b,c)=>({'result':{'status':'error','error':a}});function checkProjectStage(a,b,c){const d={'analyze_intent':'puzzle','aggregate_risks':'risk','trace_substeps':'substeps'},e=d[a];if(!e)return null;const f=getStageCache(b,c);if(!f){if(a==='analyze_intent')return null;return'project_stage:\x20calling\x20\x27'+a+'\x27\x20before\x20\x27analyze_intent\x27\x20—\x20recommend\x20calling\x20analyze_intent\x20first\x20for\x20project\x20\x27'+b+':'+c+'\x27';}if(stageIndexOf(f['stage'])<stageIndexOf(e)-0x1)return'project_stage:\x20calling\x20\x27'+a+'\x27\x20(stage\x20\x27'+e+'\x27)\x20but\x20project\x20is\x20at\x20stage\x20\x27'+f['stage']+'\x27\x20—\x20recommend\x20completing\x20prior\x20stages\x20first\x20for\x20\x27'+b+':'+c+'\x27';return null;}export function dispatchWithHarness(a,b){return async(d,f)=>{const g=[],h=getHarness(),i=shouldRunLightHooks(),j=shouldRunHeavyHooks(),k=isPublishOperation(b,d),l=isSignOperation(b,d),m=isBuyOperation(b,d),n=getHarnessTier();if(b==='goal_operation'&&i)try{const p=d,q=p?.['action'],r=p?.['project'],s=p?.['version'];if(q&&r&&s){const t=checkProjectStage(q,r,s);t&&g['push'](t);}}catch{}k&&n==='lightweight'&&(setHarnessTier('full'),g['push']('pre_publish:\x20tier\x20forced\x20to\x20full\x20for\x20publish-class\x20operation\x20(GLM5-21\x20§3.3)'));if(k&&n!=='off')try{const u=await runPrePublishChecks(b,d);g['push'](...u['warnings']);if(u['critical']['length']>0x0){for(const v of u['critical']){const x=recordCriticalRisk(v);if(x)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+x['reason']);}return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20Harness\x20pre-publish\x20gate\x20(GLM5-21\x20V6):\x20'+(u['critical']['length']+'\x20CRITICAL\x20risk(s)\x20must\x20be\x20resolved\x20before\x20publish.'),u['critical'],u['warnings'],'immutable_violation','Fix\x20the\x20CRITICAL\x20risks\x20listed\x20in\x20the\x20message\x20(e.g.\x20rename\x20dispute\x20nodes\x20per\x20R-M1-11\x20—\x20disputes\x20live\x20off-Machine;\x20bare\x20fund-terminal\x20names\x20only\x20warn\x20but\x20must\x20carry\x20an\x20anchored\x20refund\x20rail),\x20add\x20the\x20entry\x20pair\x20prev_node=\x22\x22,\x20then\x20retry\x20publish.\x20Nodes/pairs/forwards\x20are\x20immutable\x20after\x20publish\x20—\x20verify\x20via\x20machineNode2file\x20first.');}}catch(y){g['push']('pre_publish\x20hook\x20failed:\x20'+(y instanceof Error?y['message']:String(y)));}if(l&&j)try{const z=extractData(d),A=z?extractAmount(z,{'excludeConfigAmounts':!![]}):null;if(A!==null){const B=getAmountThreshold();let C=null;try{C=BigInt(A);}catch{C=null;}if(C!==null&&C>B){const D=await skuMatchedOrderTotalExemption(z,d?.['env']?.['network']);if(D)g['push']('pre_sign:\x20order\x20total\x20'+A+'\x20exceeds\x20the\x20full-tier\x20threshold\x20'+B['toString']()+'\x20(smallest\x20unit)\x20—\x20'+'EXEMPTED\x20(M-K11-a):\x20exact\x20catalog\x20match\x20Σ\x20price×quantity\x20against\x20the\x20Service\x27s\x20published\x20sales'+(D['coinType']?',\x20payment\x20coin\x20'+D['coinType']:'')+'.');else return buildHarnessBlockResult('pre_sign','Sign\x20BLOCKED\x20by\x20Harness\x20pre-sign\x20gate\x20(GLM5-21\x20V7):\x20amount\x20'+formatAmount(C)+'\x20WOW\x20exceeds\x20the\x20full-tier\x20threshold\x20'+formatAmount(B)+'\x20WOW.',['amount\x20'+A+'\x20(smallest\x20unit)\x20>\x20threshold\x20'+B['toString']()+'\x20(smallest\x20unit)'],[],'invalid_parameter','Raise\x20WOWOK_AMOUNT_THRESHOLD\x20to\x20match\x20the\x20intended\x20amount,\x20split\x20the\x20transaction,\x20or\x20reset\x20the\x20harness\x20tier\x20to\x20lightweight\x20(config_operation)\x20after\x20explicit\x20user\x20confirmation.\x20'+'M-K11-a:\x20catalog-priced\x20order_new\x20buys\x20(total_pay\x20EXACTLY\x20equal\x20to\x20Σ\x20price×quantity\x20of\x20PUBLISHED\x20sales)\x20are\x20exempted\x20automatically\x20—\x20'+'if\x20this\x20IS\x20a\x20catalog-priced\x20buy,\x20verify\x20every\x20item\x20name/quantity\x20against\x20the\x20service\x27s\x20current\x20sales\x20and\x20retry.');}}}catch(E){g['push']('pre_sign\x20hook\x20failed:\x20'+(E instanceof Error?E['message']:String(E)));}if(m&&n!=='off')try{const F=await runPreBuyChecks(b,d);g['push'](...F['warnings']);if(F['critical']['length']>0x0){for(const G of F['critical']){const H=recordCriticalRisk(G);if(H)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+H['reason']);}return buildHarnessBlockResult('pre_buy','Purchase\x20BLOCKED\x20by\x20Harness\x20pre-buy\x20gate:\x20'+F['critical']['length']+'\x20CRITICAL\x20allocator\x20risk(s)\x20—\x20'+'paying\x20into\x20this\x20service\x20as\x20currently\x20configured\x20would\x20fail\x20on-chain\x20or\x20lock\x20funds\x20with\x20no\x20distribution\x20path.',F['critical'],F['warnings'],'state_conflict','Do\x20NOT\x20retry\x20this\x20purchase\x20against\x20the\x20current\x20service\x20state.\x20Read\x20the\x20service\x27s\x20effective\x20allocator\x20plan\x20'+'(query_toolkit\x20query_type=\x27service_panorama\x27,\x20field\x20order_allocators)\x20and\x20confirm\x20every\x20finding\x20above\x20is\x20resolved\x20'+'(merchant\x20fixes\x20the\x20plan\x20—\x20post-publish\x20append\x20is\x20allowed\x20—\x20or\x20the\x20guard\x20definitions\x20are\x20repaired).\x20'+'Only\x20retry\x20the\x20buy\x20after\x20the\x20on-chain\x20state\x20changes;\x20otherwise\x20choose\x20a\x20different\x20service.');}}catch(I){g['push']('pre_buy\x20hook\x20failed:\x20'+(I instanceof Error?I['message']:String(I)));}let o;try{o=await a(d,f);}catch(J){const K=J instanceof Error?J['message']:String(J),L=recordOperationFailure(b,K);L&&g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+L['reason']);if(b==='onchain_operations')try{const M=classifyError(K,J);if(!M['retryable']&&M['error_code']!=='unknown'){const N=recordCriticalOperation(b,M['error_code']);if(N)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+N['reason']);}}catch{}throw J;}if(b==='onchain_operations')try{if(classifyOutcome(o)==='failed'){const O=extractErrorCode(o)??'',P=classifyError(O);if(!P['retryable']&&P['error_code']!=='unknown'){const Q=recordCriticalOperation(b,P['error_code']);if(Q)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Q['reason']);}}}catch{}if(i&&!isOutcomeDiscriminated(o)){const R=stableOperationId(extractIntent(b,d)??b,extractData(d));try{const S=classifyOutcome(o);if(S==='failed'){const T=extractErrorCode(o)??'',U=classifyError(T),V=h['recover'](U['error_code'],R,{'operation_type':b,'data':extractData(d),'retryable':U['retryable']});g['push']('Harness\x20recover:\x20strategy='+V['strategy']+('\x20(attempt\x20'+V['current_attempt']+'/'+V['max_attempts']+')')+(V['should_retry']?'\x20—\x20retryable':'\x20—\x20do\x20NOT\x20retry\x20blindly')+(V['user_prompt']?'\x20—\x20'+V['user_prompt']:'\x20—\x20'+V['detail']));}else S==='success'&&h['resetRecovery'](R);}catch(W){g['push']('recover\x20hook\x20failed:\x20'+(W instanceof Error?W['message']:String(W)));}}if(b==='goal_operation')try{const X=d?.['action'];if(X==='trace_substeps'){const Y=extractCriticalFindingCount(o);if(Y>0x0){const Z=recordSubstepFailure(String(X)+':\x20'+Y+'\x20critical\x20finding(s)');if(Z)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Z['reason']);}}}catch{}if(isWriteClassTool(b)&&!SEMANTIC_RECORDED_TOOLS['has'](b))try{const a0=extractOperationType(b,d)??b,a1=extractIntent(b,d)??b,a2=extractData(d)??d,a3=classifyOutcome(o),a4=extractErrorCode(o),a5=isEnabled('experience_layer');if(a5)recordOperationOutcome(a0,a2,a1,a3,a4);else{const a6=extractIndustry(d);a6&&isEnabled('industry_evolution')&&recordIndustrySignal(a6,{'type':a0},{'success':a3==='success','error_code':a4});}}catch(a7){g['push']('signal\x20collection\x20failed:\x20'+(a7 instanceof Error?a7['message']:String(a7)));}if(g['length']>0x0){if(o?.['structuredContent']){const a8=o['structuredContent'],a9=a8['semantic'];if(a9){const aa=Array['isArray'](a9['warnings'])?a9['warnings']:[];a9['warnings']=[...aa,...g];}else for(const ab of g){console['warn']('[harness]\x20'+ab);}}else for(const ac of g){console['warn']('[harness]\x20'+ac);}}return o;};}function isPublishOperation(a,b){if(a!=='onchain_operations')return![];const c=extractOperationType(a,b);if(c!=='service'&&c!=='machine')return![];const d=extractData(b);return d?.['publish']===!![]||d?.['bPublished']===!![];}function isSignOperation(a,b){if(a==='wip_file'){const c=b?.['operation_type'];return c==='sign';}return a==='onchain_operations';}function isBuyOperation(a,b){if(a!=='onchain_operations')return![];if(extractOperationType(a,b)!=='service')return![];const c=extractData(b),d=c?.['order_new'],e=c?.['buy']!=null||d!=null&&typeof d==='object'&&d['buy']!=null;return e&&c!=null&&typeof c['object']==='string'&&c['object']!=='';}function extractOperationType(a,b){if(!b||typeof b!=='object')return undefined;const c=b;if(a==='onchain_operations')return typeof c['operation_type']==='string'?c['operation_type']:undefined;if(a==='goal_operation'||a==='industry_pack_operation'||a==='strategy_review_operation')return typeof c['action']==='string'?c['action']:undefined;return typeof c['operation_type']==='string'?c['operation_type']:undefined;}function extractIntent(a,b){if(!b||typeof b!=='object')return undefined;const c=b;if((a==='goal_operation'||a==='industry_pack_operation'||a==='strategy_review_operation')&&typeof c['action']==='string')return a+':'+c['action'];const d=c['operation_type'];if(typeof d==='string')return a+':'+d;return a;}function extractData(a){if(!a||typeof a!=='object')return undefined;const b=a,c=b['data'];return c&&typeof c==='object'?c:undefined;}export async function skuMatchedOrderTotalExemption(a,b){try{if(!a)return undefined;const c=a['order_new']?.['buy'];if(!c||c['discount']!=null)return undefined;const d=c?.['total_pay']?.['balance']??c?.['total_pay'];if(d===null||d===undefined||typeof d==='object')return undefined;const e=Array['isArray'](c['items'])?c['items']:[];if(e['length']===0x0)return undefined;const f=a['object'];if(typeof f!=='string'||f['length']===0x0)return undefined;const g=f['startsWith']('0x')?f:await LocalMark['Instance']()['get_address'](f)??undefined;if(!g)return undefined;const h=await query_serviceContext({'service':g,'network':b}),i=h?.['service'];if(!i)return undefined;if(i['bPublished']!==!![])return undefined;const j=String(i?.['type_raw']??i?.['type']??'')['match'](/<(.+)>$/)?.[0x1],k=Array['isArray'](i['sales'])?i['sales']:[];let l=0x0n;for(const n of e){const o=k['find'](r=>r?.['name']===n?.['name']);if(!o||o?.['suspension']===!![])return undefined;const p=BigInt(String(o?.['price']?.['balance']??o?.['price']??'0')),q=BigInt(String(n?.['quantity']??'1'));if(q<=0x0n)return undefined;l+=p*q;}let m;try{m=BigInt(String(d));}catch{return undefined;}if(m!==l)return undefined;return{'coinType':j};}catch{return undefined;}}const WRITE_CLASS_TOOLS=new Set(['onchain_operations','goal_operation','industry_pack_operation','strategy_review_operation','wip_file','messenger_operation','bridge_operation']),SEMANTIC_RECORDED_TOOLS=new Set(['onchain_operations','bridge_operation']);function isWriteClassTool(a){return WRITE_CLASS_TOOLS['has'](a);}function classifyOutcome(a){if(!a?.['structuredContent'])return'failed';const b=a['structuredContent'];if(b['outcome']==='failed')return'failed';if(b['outcome']==='executed')return'success';if(b['outcome']==='pending_input')return'partial';const c=b['verdict'];if(c&&typeof c==='object'&&c['buildable']===![])return'failed';const d=typeof b['status']==='string'?b['status']:typeof b['result_type']==='string'?b['result_type']:b['result']&&typeof b['result']==='object'&&typeof b['result']['status']==='string'?b['result']['status']:'';if(d==='error'||d==='failed'||d==='schema_mismatch')return'failed';if(d==='partial')return'partial';return'success';}function isOutcomeDiscriminated(a){const b=a?.['structuredContent'];return!!b&&typeof b==='object'&&'outcome'in b;}function extractErrorCode(a){if(!a?.['structuredContent'])return undefined;const b=a['structuredContent'];if(typeof b['error_code']==='string')return b['error_code'];const c=b['error'];if(typeof c==='string')return c;if(c&&typeof c==='object'){const d=c['code'];if(typeof d==='string')return d;}return undefined;}function extractIndustry(a){if(!a||typeof a!=='object')return undefined;const b=a;if(typeof b['industry']==='string')return b['industry'];const c=b['data'];if(c&&typeof c==='object'){const e=c;if(typeof e['industry']==='string')return e['industry'];}return undefined;}function numericBalance(a){if(typeof a==='number'&&Number['isFinite'](a))return a;if(typeof a==='string'&&a['trim']()!==''&&Number['isFinite'](Number(a)))return Number(a);if(typeof a==='bigint')return Number(a);return undefined;}function collectAllocatorGuards(b){const c=new Map();for(const d of b){const e=d?.['allocators'];if(!Array['isArray'](e))continue;for(const f of e){const g=f?.['guard'];if(typeof g!=='string'||g['trim']()==='')continue;const h=g['toLowerCase']();let i=c['get'](h);!i&&(i={'ref':g,'recipients':new Set(),'slots':new Set()},c['set'](h,i));const j=f?.['sharing'];if(!Array['isArray'](j))continue;for(const k of j){const l=k?.['who'];if(!l||typeof l!=='object')continue;if('Signer'in l)i['recipients']['add']('Signer');else{if('Entity'in l)i['recipients']['add']('Entity');else{if('GuardIdentifier'in l){i['recipients']['add']('GuardIdentifier');const m=l['GuardIdentifier'],o=Number(m);if(Number['isFinite'](o))i['slots']['add'](o);}}}}}}return c;}async function lintAllocatorGuardSet(a,b,c,h){const i=[],j=[],l=collectAllocatorGuards(a);if(l['size']===0x0)return{'critical':i,'warnings':j};let m;try{m=await batchQueryObjectsByRef([...l['values']()]['map'](q=>q['ref']),b,!![]);}catch(q){return j['push'](c+':\x20allocator\x20guard\x20lint\x20skipped\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+(q instanceof Error?q['message']:String(q))+');\x20')+(c==='pre_buy'?'the\x20guard\x20layer\x20of\x20this\x20service\x27s\x20allocator\x20plan\x20is\x20UNVERIFIED\x20—\x20verify\x20the\x20guards\x20yourself\x20before\x20trusting\x20this\x20buy':'run\x20guard\x20lint\x20manually\x20BEFORE\x20publish\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)')),{'critical':i,'warnings':j};}const n=new Map(),o=new Set(),p=new Map();for(const [r,s]of m){const t=s;if(t?.['type']!=='Guard'){t!=null&&typeof t['object']==='string'&&t['object']!==''&&(o['add'](r['toLowerCase']()),o['add'](String(t['object'])['toLowerCase']()),typeof t['type']==='string'&&t['type']!==''&&p['set'](r['toLowerCase'](),String(t['type'])));continue;}n['set'](r['toLowerCase'](),t);for(const u of[t['query_name'],t['object']]){if(typeof u==='string'&&u!=='')n['set'](u['toLowerCase'](),t);}}for(const [v,w]of l){const x=n['get'](v)??n['get'](w['ref']['toLowerCase']());if(!x){const D=w['ref']['toLowerCase']();if(o['has'](v)||o['has'](D)){const F=p['get'](v)??p['get'](D);if(F!==undefined){const G=c+':\x20allocator\x20guard\x20\x22'+w['ref']+'\x22\x20resolves\x20to\x20a\x20'+F+'\x20object,\x20not\x20a\x20Guard\x20—\x20'+'no\x20distribution\x20run\x20can\x20pass\x20a\x20guard\x20slot\x20that\x20names\x20a\x20different\x20object\x20type';if(h==='critical')i['push'](G);else j['push'](G);}else j['push'](c+':\x20allocator\x20guard\x20\x22'+w['ref']+'\x22\x20EXISTS\x20on\x20chain\x20but\x20its\x20object\x20could\x20not\x20be\x20parsed\x20'+'as\x20a\x20Guard\x20(unreadable\x20envelope\x20—\x20usually\x20an\x20SDK/on-chain\x20schema\x20skew)\x20—\x20lint\x20skipped\x20for\x20'+'this\x20guard;\x20verify\x20its\x20definition\x20manually\x20BEFORE\x20'+(c==='pre_buy'?'trusting\x20this\x20buy':'publish\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)'));continue;}const E=c+':\x20allocator\x20guard\x20\x22'+w['ref']+'\x22\x20not\x20found\x20on-chain\x20—\x20'+(h==='critical'?'the\x20pool\x20accepts\x20funds\x20but\x20no\x20distribution\x20run\x20can\x20ever\x20pass\x20a\x20missing\x20guard\x20(fund-lock\x20risk)':'lint\x20skipped\x20for\x20this\x20guard;\x20verify\x20the\x20guard\x20exists\x20and\x20is\x20final\x20BEFORE\x20publish\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)');if(h==='critical')i['push'](E);else j['push'](E);continue;}const y=x['data']??x,z=Array['isArray'](y?.['table'])?y['table']:[],A=Array['isArray'](y?.['relies'])?y['relies']:[];for(const H of w['slots']){const I=z['find'](K=>Number(K?.['identifier'])===H),J=I!=null&&I['b_submission']===!![]&&String(I['value_type'])==='Address';!J&&i['push'](c+':\x20allocator\x20guard\x20\x22'+w['ref']+'\x22\x20pays\x20a\x20{GuardIdentifier:\x20'+H+'}\x20leg\x20but\x20its\x20table\x20has\x20'+(I==null?'NO\x20slot\x20'+H+'\x20row':'slot\x20'+H+'\x20as\x20a\x20STATIC\x20row\x20(b_submission:\x20'+(I['b_submission']===!![])+',\x20value_type:\x20'+String(I['value_type'])+')')+'\x20—\x20the\x20passport\x20only\x20emits\x20DECLARED\x20submission\x20slots\x20and\x20allocation\x20asserts\x20the\x20slot\x20equals\x20the\x20paying\x20'+'order,\x20so\x20this\x20rail\x20aborts\x20at\x20alloc\x20(code\x2015,\x20ERECIPIENT_NOT_FOR_OBJECT)\x20with\x20the\x20leg\x27s\x20funds\x20stranded.\x20'+('Declare\x20{identifier:\x20'+H+',\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22}\x20in\x20the\x20guard\x20table\x20BEFORE\x20publish\x20')+'(templates\x20anchor\x20refund\x20rails\x20on\x20user\x20slot\x200\x20and\x20submit\x20the\x20Order\x20address\x20there).\x20Do\x20NOT\x20reach\x20for\x20'+'protocol\x20slot\x20254\x20as\x20the\x20payee:\x20it\x20is\x20the\x20task-binding/once\x20slot,\x20so\x20naming\x20it\x20arms\x20once-per-order\x20and\x20a\x20'+'second\x20fire\x20on\x20the\x20same\x20order\x20aborts\x20E_ONCE_TRIGGERED\x20(16)');}try{const K=z['some'](N=>Number(N?.['identifier'])===0x0&&N?.['b_submission']===!![]),L=w['slots']['has'](0x0),M=lintTaskBindingAdvisories({'guardRef':w['ref'],'table':z,'allocatorBound':!L&&K,'refundReentry':L});for(const N of M)j['push'](formatTaskBindingAdvisory(N,c));}catch{}const B={'description':typeof y?.['description']==='string'?y['description']:undefined,'table':z['map'](O=>({'identifier':Number(O?.['identifier']??0x0),'b_submission':!!O?.['b_submission'],'value_type':O?.['value_type']!==undefined?String(O['value_type']):undefined,'value':O?.['value'],'name':O?.['name']!==undefined?String(O['name']):undefined,'object_type':O?.['object_type']!==undefined?String(O['object_type']):undefined})),'root':y?.['root'],'rely':A['length']>0x0?{'guards':A['map'](O=>String(O)),'logic_or':!y?.['relies_logic_and']}:undefined,'binding_hint':{'host_object':'Service','binding_field':'order_allocators','sharing_recipients':w['recipients']['size']>0x0?[...w['recipients']]:undefined}},C=guardTimeProfileDetail({'ref':w['ref'],'description':typeof y?.['description']==='string'?y['description']:undefined,'table':z,'root':y?.['root']});if(C){const O='pre_publish:\x20R-TIME-PROFILE\x20—\x20allocator\x20guard\x20\x22'+w['ref']+'\x22:\x20'+C['detail'];if(C['level']==='critical')i['push'](O);else j['push'](O);}try{const P=await lintGuard(B,{'auto_fix':![],'host_published':!![]});for(const Q of P['diagnostics']){const R=c+':\x20allocator\x20guard\x20\x22'+w['ref']+'\x22\x20'+Q['code']+'\x20('+Q['source']+'):\x20'+Q['message']+'\x20at\x20'+Q['location']['path'];if(Q['severity']==='error')i['push'](R);else{if(Q['severity']==='warning')j['push'](R);}}}catch(S){j['push'](c+':\x20allocator\x20guard\x20\x22'+w['ref']+'\x22\x20lint\x20failed\x20'+('('+(S instanceof Error?S['message']:String(S))+')\x20—\x20non-blocking'));}}return{'critical':i,'warnings':j};}function collectForwardGuardRefs(a){const b=new Map();for(const c of a){const d=c,e=Array['isArray'](d?.['pairs'])?d['pairs']:Array['isArray'](d?.['value'])?d['value']:[];for(const h of e){const i=h,j=Array['isArray'](i?.['forwards'])?i['forwards']:[];for(const k of j){const l=k,m=l?.['guard'],n=typeof m==='string'&&m['trim']()!==''?m:m&&typeof m==='object'?m['guard']??m['$ref']:undefined;typeof n==='string'&&n['trim']()!==''&&b['set'](n['toLowerCase'](),n);}}}return b;}async function fetchForwardGuardIndex(a,b){const c=collectForwardGuardRefs(a),d=new Map();if(c['size']===0x0)return{'refs':c,'defs':d};try{const f=await batchQueryObjectsByIds([...c['values']()],b,!![]);for(const h of f??[]){const i=h;if(i?.['type']!=='Guard')continue;for(const j of[i['query_name'],i['object']]){if(typeof j==='string'&&j!=='')d['set'](j['toLowerCase'](),i);}}return{'refs':c,'defs':d};}catch(l){return{'refs':c,'defs':d,'error':l instanceof Error?l['message']:String(l)};}}function lintForwardGuardsTaskBinding(a){const b=[],c=[];if(a['refs']['size']===0x0)return{'critical':b,'warnings':c};if(a['error']!==undefined)return c['push']('pre_publish:\x20forward-guard\x20lints\x20(task-binding\x20+\x20review-lock)\x20DEGRADED\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+a['error']+');\x20verify\x20every\x20forward\x20guard\x20carries\x20the\x20protocol\x20slot\x20254\x20Address\x20submission\x20row\x20and\x20')+'that\x20no\x20settlement\x20rail\x20is\x20review-locked\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001).\x20'+'If\x20this\x20repeats,\x20fix\x20the\x20read\x20path\x20(RPC/network)\x20—\x20do\x20not\x20publish\x20blind'),{'critical':b,'warnings':c};for(const [d,e]of a['refs']){const f=a['defs']['get'](d);if(!f){const j='pre_publish:\x20forward-bound\x20guard\x20\x22'+e+'\x22\x20not\x20found\x20on-chain\x20—\x20'+(/^0x[0-9a-fA-F]{4,64}$/['test'](e)?'dangling\x20forward\x20binding;\x20publish\x20BLOCKED\x20(fail-closed,\x20IMMUT-001).\x20Bind\x20an\x20existing\x20guard\x20'+'(or\x20create\x20it\x20first)\x20BEFORE\x20publishing\x20—\x20a\x20frozen\x20machine\x20cannot\x20be\x20repaired':'task-binding\x20lint\x20skipped\x20for\x20it;\x20ensure\x20it\x20exists\x20and\x20carries\x20the\x20protocol\x20slot\x20254\x20Address\x20'+'submission\x20row\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001)');(/^0x[0-9a-fA-F]{4,64}$/['test'](e)?b:c)['push'](j);continue;}const g=f['data']??f,h=Array['isArray'](g?.['table'])?g['table']:[],i=h['some'](k=>Number(k?.['identifier'])===TASK_BINDING_SLOT&&k?.['b_submission']===!![]&&String(k?.['value_type'])==='Address');!i&&b['push']('pre_publish:\x20forward-bound\x20guard\x20\x22'+e+'\x22\x20has\x20NO\x20protocol\x20slot\x20'+TASK_BINDING_SLOT+'\x20Address\x20submission\x20row\x20—\x20'+'the\x20passport\x20only\x20emits\x20DECLARED\x20slots,\x20so\x20once\x20a\x20Service\x20binds\x20this\x20Machine\x20EVERY\x20forward\x20this\x20'+'guard\x20gates\x20aborts\x20(code\x2011)\x20and\x20escrowed\x20funds\x20can\x20never\x20advance.\x20Machine\x20topology\x20is\x20immutable\x20'+('after\x20publish\x20(IMMUT-001):\x20add\x20{identifier:'+TASK_BINDING_SLOT+',\x20b_submission:true,\x20value_type:\x22Address\x22}\x20to\x20the\x20')+'guard\x27s\x20table\x20(recreate\x20the\x20guard\x20unfrozen\x20if\x20it\x20is\x20frozen)\x20BEFORE\x20publishing\x20this\x20Machine');}return{'critical':b,'warnings':c};}function lintForwardReviewLocks(a,b){if(b['error']!==undefined||b['refs']['size']===0x0)return{'critical':[],'warnings':[]};const c=new Map();for(const [d,e]of b['defs']){const f=new Set();collectGuardNodeGates(e,f);if(f['size']>0x0)c['set'](d,[...f]);}return lintReviewLockedTerminals(a,c);}function lintForwardGuardsTimeProfile(a){const b=[],c=[];if(a['error']!==undefined||a['refs']['size']===0x0)return{'critical':b,'warnings':c};for(const [d,e]of a['refs']){const f=a['defs']['get'](d);if(!f)continue;const g=f['data']??f,h=guardTimeProfileDetail({'ref':e,'description':g?.['description'],'table':Array['isArray'](g?.['table'])?g['table']:undefined,'root':g?.['root']});if(h){const i='pre_publish:\x20R-TIME-PROFILE\x20—\x20forward-bound\x20guard\x20\x22'+e+'\x22:\x20'+h['detail'];if(h['level']==='critical')b['push'](i);else c['push'](i);}}return{'critical':b,'warnings':c};}async function lintAllocatorGuards(a,b){return lintAllocatorGuardSet([a['order_allocators'],a['order_allocators_append']],b,'pre_publish','warning');}async function lintAllocatorRailPairing(a,b){const c=[],d=[],h=[a['order_allocators'],a['order_allocators_append']],i=collectAllocatorGuards(h);if(i['size']===0x0)return{'critical':c,'warnings':d};let j;try{j=await batchQueryObjectsByRef([...i['values']()]['map'](q=>q['ref']),b,!![]);}catch(q){return d['push']('pre_publish:\x20claimed_by\x20rail-pairing\x20check\x20skipped\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+(q instanceof Error?q['message']:String(q))+');\x20run\x20template_scan\x20or\x20guard\x20lint\x20manually\x20')+'BEFORE\x20publish:\x20a\x20refund\x20rail\x20gated\x20on\x20order.claimed_by\x20none\x20MUST\x20be\x20paired\x20with\x20a\x20'+'merchant-recovery\x20rail\x20gated\x20on\x20claimed_by\x20some,\x20or\x20a\x20claimed\x20order\x20strands\x20its\x20escrow\x20'+'(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)'),{'critical':c,'warnings':d};}const l=new Map();for(const [r,s]of j){const t=s;if(t?.['type']!=='Guard')continue;l['set'](r['toLowerCase'](),t);for(const u of[t['query_name'],t['object']]){if(typeof u==='string'&&u!=='')l['set'](u['toLowerCase'](),t);}}const m=[];for(const [v,w]of i){const x=l['get'](v);if(!x)continue;const y=x?.['data']??x,z=Array['isArray'](y['table'])?y['table']:[];m['push']({'key':w['ref'],'track':w['slots']['has'](0x0)?'refund':'settlement','table':z,'root':y['root']});}if(m['length']===0x0)return d['push']('pre_publish:\x20claimed_by\x20rail-pairing\x20check\x20skipped\x20—\x20no\x20referenced\x20allocator\x20guard\x20was\x20'+'resolvable\x20on-chain;\x20verify\x20the\x20rails\x20BEFORE\x20publish\x20(IMMUT-002)'),{'critical':c,'warnings':d};const n=typeof a['machine']==='string'?a['machine']:undefined;let o=[];if(n&&n['trim']()!=='')try{const A=await fetchMachineNodes(n,b,!![]);o=A['map'](B=>({'name':B['name']}));}catch{d['push']('pre_publish:\x20claimed_by\x20rail-pairing\x20check\x20ran\x20WITHOUT\x20the\x20machine\x20node\x20matrix\x20'+'(machine\x20fetch\x20failed)\x20—\x20award-exit\x20coverage\x20is\x20evaluated\x20on\x20the\x20payload\x20rails\x20only');}else d['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call\x20—\x20claimed_by\x20rail-pairing\x20evaluated\x20without\x20'+'the\x20node\x20matrix;\x20if\x20the\x20store\x20binds\x20a\x20machine\x20later,\x20re-verify\x20after\x20binding');o['length']===0x0&&(o=[{'name':'*'}]);const p=verifyAllocatorRails(m,o,{'arbitrationBound':!![]});for(const B of p){const C='pre_publish:\x20claimed_by\x20rail\x20pairing\x20—\x20['+B['code']+']\x20'+B['detail'];B['level']==='info'?d['push']('pre_publish:\x20claimed_by\x20rail\x20DISCLOSURE\x20(not\x20a\x20violation)\x20—\x20['+B['code']+']\x20'+B['detail']):c['push'](C);}return{'critical':c,'warnings':d};}async function lintServiceEscrowExitCoverage(b,c,d,f){const h=[],i=[],j=new Map();let k=0x0;for(const r of c){if(r===null||r===undefined)continue;const s=Array['isArray'](r)?r:Array['isArray'](r['allocators'])?r['allocators']:[];for(const t of s){k++;const u=t?.['guard'];if(typeof u==='string'&&u['trim']()!=='')j['set'](u['toLowerCase'](),u);}}const l=c['some'](v=>v!==null&&v!==undefined);if(f){let v,w;try{const x=await batchQueryObjectsByIds([f],d,!![]);v=(x??[])['find'](y=>y?.['type']==='Service');}catch(y){w=y;}if(!v&&!b)return h['push']('pre_publish:\x20(R-ESCROW-LEAF)\x20escrow-exit\x20gate\x20could\x20not\x20resolve\x20service\x20\x22'+f+'\x22\x20'+('('+(w instanceof Error?w['message']:String(w))+')\x20—\x20terminal\x20coverage\x20UNVERIFIABLE;\x20publish\x20blocked.\x20')+'Retry\x20when\x20the\x20network\x20is\x20reachable'),{'critical':h,'warnings':i};!v&&w!==undefined&&i['push']('pre_publish:\x20escrow-exit\x20gate\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+f+'\x22\x20'+('('+(w instanceof Error?w['message']:String(w))+');\x20auditing\x20THIS\x20call\x27s\x20allocator\x20payload\x20only'));if(v){const z=v['data']??v;if(!b&&typeof z['machine']==='string'&&z['machine']['trim']()!=='')b=z['machine'];const A=z['order_allocators'],B=Array['isArray'](A)?A:Array['isArray'](A?.['allocators'])?A['allocators']:[];for(const C of B){const D=C?.['guard'];typeof D==='string'&&D['trim']()!==''&&!j['has'](D['toLowerCase']())&&j['set'](D['toLowerCase'](),D);}}}if(!b)return i['push']('pre_publish:\x20escrow-exit\x20gate\x20skipped\x20—\x20no\x20machine\x20in\x20this\x20call\x20and\x20the\x20published\x20service\x20carries\x20none;\x20'+'there\x20is\x20no\x20topology\x20to\x20cover'),{'critical':h,'warnings':i};let m=[];try{m=await fetchMachineNodes(b,d,!![]);}catch(E){return h['push']('pre_publish:\x20escrow-exit\x20gate\x20could\x20not\x20fetch\x20machine\x20\x22'+b+'\x22\x20nodes\x20'+('('+(E instanceof Error?E['message']:String(E))+')\x20—\x20terminal\x20coverage\x20UNVERIFIABLE;\x20publish\x20blocked.\x20')+'Retry\x20when\x20the\x20network\x20is\x20reachable'),{'critical':h,'warnings':i};}if(m['length']===0x0)return i['push']('pre_publish:\x20escrow-exit\x20gate\x20skipped\x20—\x20machine\x20has\x20no\x20nodes\x20to\x20cover'),{'critical':h,'warnings':i};const n=computeTerminalReachability(m);if(n['terminals']['length']===0x0)return{'critical':h,'warnings':i};if(j['size']===0x0)return l?h['push']('pre_publish:\x20(R-ESCROW-LEAF)\x20machine\x20terminal\x20node(s)\x20'+n['terminals']['map'](F=>'\x22'+F+'\x22')['join'](',\x20')+'\x20have\x20NO\x20allocator\x20rail\x20—\x20'+(k===0x0?'order_allocators\x20is\x20empty\x20in\x20this\x20call,\x20so\x20':'no\x20allocator\x20row\x20carries\x20a\x20guard\x20ref,\x20so\x20')+'an\x20order\x20stopping\x20at\x20any\x20terminal\x20strands\x20its\x20escrow\x20by\x20construction\x20(immutable\x20after\x20publish,\x20IMMUT-002).\x20'+'Every\x20terminal\x20needs\x20a\x20settlement/refund\x20allocator\x20whose\x20guard\x20gates\x20progress.current\x20==\x20<terminal>\x20'+'(canonical\x20designs:\x20tpl_allocator_node_gate_settle\x20/\x20tpl_allocator_node_gate_refund,\x20M-T12)'):i['push']('pre_publish:\x20(R-ESCROW-LEAF)\x20the\x20published\x20service\x20carries\x20NO\x20allocator\x20rails\x20on-chain\x20—\x20'+('if\x20it\x20ever\x20takes\x20payment,\x20every\x20terminal\x20('+n['terminals']['map'](F=>'\x22'+F+'\x22')['join'](',\x20')+')\x20strands\x20escrow\x20')+'with\x20no\x20exit.\x20Zero-payment\x20services\x20may\x20proceed;\x20otherwise\x20bind\x20settlement/refund\x20rails\x20BEFORE\x20publish\x20'+'(canonical\x20designs:\x20tpl_allocator_node_gate_settle\x20/\x20tpl_allocator_node_gate_refund,\x20M-T12;\x20immutable\x20after\x20publish,\x20IMMUT-002)'),{'critical':h,'warnings':i};let o;try{o=await batchQueryObjectsByRef([...j['values']()],d,!![]);}catch(F){return i['push']('pre_publish:\x20escrow-exit\x20coverage\x20UNVERIFIED\x20—\x20could\x20not\x20query\x20allocator\x20guards\x20'+('('+(F instanceof Error?F['message']:String(F))+');\x20run\x20guard\x20lint\x20manually\x20BEFORE\x20publish\x20')+'(terminal(s)\x20in\x20question:\x20'+n['terminals']['join'](',\x20')+')'),{'critical':h,'warnings':i};}const p=new Set();for(const G of o['values']()){const H=G;if(H?.['type']!=='Guard')continue;collectGuardNodeGates(H,p);}const q=n['terminals']['filter'](I=>!p['has'](I));return q['length']>0x0&&h['push']('pre_publish:\x20(R-ESCROW-LEAF)\x20terminal\x20node(s)\x20'+q['map'](I=>'\x22'+I+'\x22')['join'](',\x20')+'\x20have\x20NO\x20allocator\x20rail\x20—\x20'+'an\x20order\x20that\x20reaches\x20a\x20terminal\x20moves\x20no\x20money\x20by\x20itself,\x20so\x20its\x20escrow\x20strands\x20permanently\x20'+'(mainnet:\x200.299\x20stranded\x20at\x20an\x20un-railied\x20terminal;\x20ofshop:\x200.25\x20stranded\x20at\x20\x27expired\x27).\x20Every\x20terminal\x20'+'needs\x20a\x20settlement/refund\x20allocator\x20whose\x20guard\x20gates\x20progress.current\x20==\x20<terminal>\x20(canonical\x20designs:\x20'+'tpl_allocator_node_gate_settle\x20/\x20tpl_allocator_node_gate_refund,\x20M-T12).\x20If\x20the\x20pool\x20legitimately\x20drains\x20'+'at\x20an\x20earlier\x20node,\x20add\x20a\x20zero-value\x20anchor\x20row\x20on\x20the\x20terminal\x20rail\x20so\x20the\x20guard\x20resolves\x20without\x20paying'),{'critical':h,'warnings':i};}function collectGuardNodeGates(a,b){const c=a['data']??a;for(const d of parseGuardNodeGates(c?.['root'],c?.['table']))b['add'](d);}async function checkArbitrationNeutrality(b,c){const d=[],f=[],g=[],h=p=>{const q=typeof p==='string'?p:p?.['object']??p?.['name'];if(typeof q==='string'&&q!==''&&!g['includes'](q))g['push'](q);};for(const p of Array['isArray'](b['arbitrations'])?b['arbitrations']:[])h(p);let i=typeof b['permission']==='string'?b['permission']:undefined;const j=typeof b['object']==='string'?b['object']:undefined;if(j){let q;try{const r=await batchQueryObjectsByIds([j],c,!![]);q=(r??[])['find'](s=>s?.['type']==='Service');}catch(s){f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+j+'\x22\x20'+('('+(s instanceof Error?s['message']:String(s))+').\x20Verify\x20manually\x20that\x20every\x20bound\x20arbitration\x27s\x20')+'Permission\x20owner/admin\x20set\x20is\x20DISJOINT\x20from\x20the\x20service\x27s\x20controller\x20keys\x20before\x20publishing');}if(q){const t=q['data']??q;if(!i&&typeof t['permission']==='string')i=t['permission'];for(const u of Array['isArray'](t['arbitrations'])?t['arbitrations']:[])h(u);}}if(g['length']===0x0)return{'critical':d,'warnings':f};if(!i)return f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20the\x20service\x20Permission\x20address\x20is\x20not\x20resolvable\x20'+'from\x20this\x20call\x20(no\x20payload\x20\x27permission\x27,\x20service\x20object\x20not\x20found).\x20The\x20bound\x20arbitrations\x27\x20controller\x20'+'keys\x20are\x20UNVERIFIED:\x20confirm\x20each\x20arbitration\x20Permission\x27s\x20owner/admin\x20set\x20is\x20disjoint\x20from\x20the\x20service\x27s\x20'+'controller\x20keys\x20(same-controller\x20arbitration\x20=\x20the\x20merchant\x20can\x20rule\x20their\x20own\x20disputes)'),{'critical':d,'warnings':f};let k;try{k=await batchQueryObjectsByIds([i,...g],c,!![]);}catch(v){return f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20object\x20query\x20failed\x20'+('('+(v instanceof Error?v['message']:String(v))+').\x20Verify\x20the\x20arbitration\x20Permissions\x27\x20owner/admin\x20sets\x20')+'are\x20disjoint\x20from\x20the\x20service\x27s\x20controller\x20keys\x20before\x20publishing'),{'critical':d,'warnings':f};}const l=w=>(k??[])['find'](x=>{const y=x;return typeof y?.['object']==='string'&&y['object']['toLowerCase']()===w['toLowerCase']()||typeof y?.['query_name']==='string'&&y['query_name']['toLowerCase']()===w['toLowerCase']();}),m=w=>{if(!w)return new Set();const x=w['data']??w,y=new Set();for(const z of[x['builder']])if(typeof z==='string'&&z)y['add'](z['toLowerCase']());for(const A of Array['isArray'](x['admin'])?x['admin']:[])if(typeof A==='string'&&A)y['add'](A['toLowerCase']());return y;},n=l(i),o=m(n);if(o['size']===0x0)return f['push']('pre_publish:\x20arbitration\x20neutrality\x20check\x20DEGRADED\x20—\x20service\x20Permission\x20\x22'+i+'\x22\x20not\x20found\x20or\x20'+'carries\x20no\x20builder/admin\x20list.\x20The\x20bound\x20arbitrations\x27\x20controller\x20keys\x20are\x20UNVERIFIED\x20—\x20confirm\x20disjointness\x20manually'),{'critical':d,'warnings':f};for(const w of g){const x=l(w);if(!x){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20not\x20found\x20on-chain\x20(or\x20not\x20yet\x20indexed)\x20—\x20its\x20Permission\x20controller\x20'+'keys\x20are\x20UNVERIFIED.\x20Confirm\x20the\x20arbitration\x20Permission\x27s\x20builder/admin\x20set\x20is\x20disjoint\x20from\x20the\x20service\x27s\x20'+'controller\x20keys\x20(same-controller\x20arbitration\x20=\x20the\x20merchant\x20can\x20rule\x20their\x20own\x20disputes)');continue;}const y=x['data']??x;y['bPaused']===!![]&&d['push']('pre_publish:\x20R-ARB-PAUSED\x20—\x20arbitration\x20\x22'+w+'\x22\x20is\x20PAUSED.\x20Every\x20dispute\x20against\x20this\x20service\x20'+'will\x20abort\x20(arbitration::E_PAUSED)\x20while\x20the\x20arbitration\x20stays\x20paused\x20—\x20case_open,\x20voting\x20and\x20'+'conclusion\x20are\x20all\x20dead-locked.\x20New\x20Arbitrations\x20are\x20created\x20paused\x20by\x20default;\x20the\x20arbitration\x20'+('owner\x20must\x20un-pause\x20it\x20BEFORE\x20this\x20publish:\x20{operation_type:\x22arbitration\x22,\x20data:{object:\x22'+w+'\x22,\x20pause:false}}'));const z=typeof y['permission']==='string'?y['permission']:undefined;if(!z){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20exposes\x20no\x20permission\x20address\x20—\x20controller-key\x20disjointness\x20UNVERIFIED');continue;}if(z['toLowerCase']()===i['toLowerCase']()){d['push']('pre_publish:\x20R-ARB-SAME-CONTROLLER\x20—\x20arbitration\x20\x22'+w+'\x22\x20shares\x20the\x20service\x27s\x20Permission\x20object\x20'+('('+i+').\x20The\x20chain\x20aborts\x20this\x20binding\x20(E_ARBITRATION_PERMISSION_CONFLICT);\x20bind\x20an\x20')+'arbitration\x20with\x20its\x20own\x20independent\x20Permission');continue;}if(!l(z))try{const D=await batchQueryObjectsByIds([z],c,!![]);k=[...k??[],...D??[]];}catch(E){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20Permission\x20\x22'+z+'\x22\x20could\x20not\x20be\x20queried\x20'+('('+(E instanceof Error?E['message']:String(E))+')\x20—\x20controller-key\x20disjointness\x20UNVERIFIED'));continue;}const A=m(l(z));if(A['size']===0x0){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20Permission\x20\x22'+z+'\x22\x20not\x20found\x20or\x20carries\x20no\x20builder/admin\x20list\x20—\x20'+'controller-key\x20disjointness\x20UNVERIFIED');continue;}const B=[...o]['filter'](F=>A['has'](F));B['length']>0x0&&d['push']('pre_publish:\x20R-ARB-SAME-CONTROLLER\x20—\x20the\x20arbitration\x20\x22'+w+'\x22\x20is\x20NOT\x20controller-independent:\x20'+('EOA(s)\x20'+B['join'](',\x20')+'\x20appear\x20in\x20BOTH\x20the\x20service\x20Permission\x20('+i+')\x20and\x20the\x20')+('arbitration\x20Permission\x20('+z+')\x20builder/admin\x20sets.\x20Object\x20isolation\x20is\x20enforced\x20on-chain\x20')+'(different\x20Permission\x20objects),\x20but\x20controller\x20isolation\x20is\x20NOT:\x20a\x20shared\x20EOA\x20can\x20confirm,\x20vote\x20in,\x20'+'and\x20rule\x20the\x20service\x27s\x20disputes\x20—\x20arbitration\x20neutrality\x20collapses\x20(live\x20mainnet:\x20the\x20reused\x20arb\x27s\x20'+'Permission\x20builder\x20AND\x20sole\x20admin\x20was\x20the\x20merchant).\x20Bind\x20an\x20arbitration\x20whose\x20Permission\x20is\x20controlled\x20'+'by\x20physically\x20independent\x20keys');const C=arbitrationVotingLockDetail(y['voting_guard']);C!==null&&d['push']('pre_publish:\x20R-ARB-VOTE-LOCK\x20—\x20arbitration\x20\x22'+w+'\x22:\x20'+C);}return{'critical':d,'warnings':f};}async function runPreBuyChecks(a,b){const c=[],d=[],f=extractData(b)??{},g=b?.['env']?.['network'],h=f['object'];let i;try{i=await batchQueryObjectsByIds([h],g,!![]);}catch(m){return d['push']('pre_buy:\x20allocator\x20screening\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+h+'\x22\x20'+('('+(m instanceof Error?m['message']:String(m))+');\x20the\x20purchase\x20was\x20NOT\x20screened.\x20')+'Verify\x20the\x20service\x27s\x20order_allocators\x20yourself\x20(query_toolkit\x20query_type=\x27service_panorama\x27)\x20before\x20trusting\x20this\x20buy'),{'critical':c,'warnings':d};}const j=(i??[])['find'](n=>n?.['type']==='Service');if(!j)return d['push']('pre_buy:\x20allocator\x20screening\x20DEGRADED\x20—\x20service\x20\x22'+h+'\x22\x20not\x20found\x20on-chain\x20(or\x20not\x20yet\x20indexed);\x20'+'the\x20purchase\x20was\x20NOT\x20screened.\x20Verify\x20the\x20address/network\x20and\x20the\x20service\x27s\x20order_allocators\x20before\x20trusting\x20this\x20buy'),{'critical':c,'warnings':d};const k=j['data']??j;k['bPublished']!==!![]&&c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20is\x20NOT\x20published\x20—\x20the\x20buy\x20aborts\x20on-chain\x20(E_NOT_PUBLISHED)');k['bPaused']===!![]&&c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20is\x20paused\x20—\x20the\x20buy\x20aborts\x20on-chain\x20(E_PAUSED)');const l=k['order_allocators'];if(l==null)c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20has\x20NO\x20order_allocators\x20—\x20the\x20payment\x20step\x20aborts\x20(no\x20distribution\x20plan).\x20'+'Funds\x20committed\x20to\x20this\x20service\x20would\x20have\x20NO\x20distribution\x20path\x20(the\x20fund-lock\x20incident\x20class).\x20'+'Do\x20not\x20buy\x20until\x20the\x20merchant\x20configures\x20an\x20allocator\x20plan');else{if(!Array['isArray'](l['allocators'])||l['allocators']['length']===0x0)c['push']('pre_buy:\x20service\x20\x22'+h+'\x22\x20order_allocators\x20is\x20EMPTY\x20—\x20the\x20payment\x20step\x20aborts\x20(EALLOCATORS_EMPTY).\x20'+'Do\x20not\x20buy\x20until\x20the\x20merchant\x20configures\x20at\x20least\x20one\x20allocator');else{const n=f['buy'],o=Array['isArray'](n?.['items'])?n['items']:[],p=Array['isArray'](k['sales'])?k['sales']:[];let q=0x0,r=o['length']>0x0;const s=[];for(const v of o){const w=v,x=numericBalance(w?.['quantity']),y=p['find'](A=>A?.['name']===w?.['name']),z=numericBalance(y?.['price']);if(x===undefined||z===undefined){r=![],s['push'](typeof w?.['name']==='string'?w['name']:JSON['stringify'](w?.['name']));continue;}q+=z*x;}const t=numericBalance(l['threshold']);if(!r)d['push']('pre_buy:\x20could\x20not\x20price\x20'+s['length']+'\x20cart\x20item(s)\x20['+s['join'](',\x20')+']\x20against\x20the\x20service\x27s\x20on-chain\x20sales\x20—\x20'+'allocator-threshold\x20coverage\x20UNVERIFIED\x20for\x20this\x20cart\x20(unknown\x20items\x20also\x20abort\x20the\x20quote\x20step).\x20'+'Confirm\x20every\x20item\x20name\x20matches\x20a\x20current\x20sale\x20entry');else t!==undefined&&t>q&&c['push']('pre_buy:\x20allocator\x20threshold\x20'+t+'\x20exceeds\x20this\x20cart\x27s\x20total\x20'+q+'\x20(Σ\x20price×quantity\x20over\x20the\x20on-chain\x20sales)\x20—\x20'+'the\x20payment\x20step\x20aborts\x20(EINSUFFICIENT_BALANCE):\x20pool\x20creation\x20requires\x20amount\x20>=\x20threshold.\x20'+'The\x20merchant\x20must\x20lower\x20the\x20threshold\x20(new\x20service\x20—\x20threshold\x20is\x20frozen\x20at\x20publish)\x20or\x20the\x20cart\x20must\x20grow');n?.['discount']!=null&&r&&t!==undefined&&t<=q&&d['push']('pre_buy:\x20a\x20discount\x20is\x20applied\x20—\x20the\x20discounted\x20total\x20may\x20fall\x20below\x20the\x20list\x20total\x20'+q+'\x20used\x20here;\x20'+('if\x20it\x20lands\x20under\x20the\x20allocator\x20threshold\x20'+t+',\x20the\x20payment\x20step\x20aborts\x20(EINSUFFICIENT_BALANCE)'));const u=await lintAllocatorGuardSet([l],g,'pre_buy','critical');c['push'](...u['critical']),d['push'](...u['warnings']);}}return{'critical':c,'warnings':d};}export function lintSalesWipBindings(a,b){const c=[],d=[],e=Array['isArray'](a)?a:[];for(const f of e){const g=typeof f?.['wip']==='string'?f['wip']['trim']():'';if(g==='')continue;const h=typeof f?.['wip_hash']==='string'&&f['wip_hash']['trim']()!==''?f['wip_hash']['trim']():undefined,i=getWipVerifyRecord(g);if(i===undefined){c['push']('pre_publish:\x20a\x20sale\x20binds\x20WIP\x20\x22'+g+'\x22\x20that\x20THIS\x20session\x20never\x20verified\x20—\x20BLOCKED\x20(R2-08②,\x20alg26\x20'+'F-A26-03:\x20upload\x20responses\x20are\x20an\x20infra\x20passthrough\x20that\x20echoed\x20another\x20account\x27s\x20file\x20URL,\x20and\x20the\x20'+'chain\x20only\x20checks\x20hash-vs-URL\x20self-consistency\x20at\x20quote).\x20Before\x20publishing,\x20run\x20'+('wip_file\x20type=\x22verify\x22\x20wipFilePath=\x22'+g+'\x22')+(h!==undefined?'\x20hash_equal=\x22'+h+'\x22':'')+'\x20and\x20retry\x20only\x20on\x20a\x20valid\x20result.\x20(An\x20MCP\x20restart\x20clears\x20the\x20session\x20ledger\x20—\x20re-run\x20the\x20verify.)');continue;}if(h!==undefined){if(i['hash_equal']!==undefined&&i['hash_equal']!==h)c['push']('pre_publish:\x20a\x20sale\x20binds\x20wip_hash\x20\x22'+h+'\x22\x20but\x20the\x20WIP\x20\x22'+g+'\x22\x20was\x20equality-verified\x20'+('against\x20\x22'+i['hash_equal']+'\x22\x20—\x20hash\x20MISMATCH,\x20BLOCKED\x20(R2-08②).\x20Re-verify\x20with\x20')+('hash_equal=\x22'+h+'\x22\x20or\x20correct\x20the\x20sale\x27s\x20wip_hash.'));else i['hash_equal']===undefined&&d['push']('pre_publish:\x20sale\x20binds\x20wip_hash\x20on\x20WIP\x20\x22'+g+'\x22\x20that\x20was\x20only\x20integrity-verified\x20(no\x20'+'hash_equal)\x20—\x20run\x20wip_file\x20verify\x20with\x20hash_equal=\x22'+h+'\x22\x20to\x20close\x20the\x20gap\x20'+'(the\x20chain\x20re-checks\x20at\x20quote,\x20E_WIP_HASH_NOT_MATCH;\x20a\x20mismatched\x20bind\x20surfaces\x20as\x20a\x20buyer-side\x20abort)');}const j=i['upload_account'];j!==undefined&&b!==undefined&&j!==b&&!i['signature_verified']&&c['push']('pre_publish:\x20WIP\x20\x22'+g+'\x22\x20was\x20uploaded\x20by\x20account\x20\x22'+j+'\x22\x20but\x20is\x20bound/published\x20by\x20'+('\x22'+b+'\x22\x20without\x20an\x20owner\x20signature\x20—\x20BLOCKED\x20(R2-08③).\x20Either\x20upload\x20with\x20\x22'+b+'\x22,\x20')+'or\x20re-verify\x20with\x20requireSignature=true\x20(the\x20file\x27s\x20owner\x20signature\x20IS\x20the\x20explicit\x20delegate\x20proof)\x20and\x20retry.');}return{'critical':c,'warnings':d};}export async function runPrePublishChecks(a,b){const c=[],d=[],g=extractOperationType(a,b),h=extractData(b)??{},i=b?.['env']?.['network'];if(g==='machine'){const j=h['node'];let l=Array['isArray'](j)?j:Array['isArray'](j?.['nodes'])?j['nodes']:[];if(l['length']===0x0&&typeof h['object']==='string'){const m=h['object'];try{const n=await fetchMachineNodes(m,i,!![]);n['length']>0x0&&(l=n,d['push']('pre_publish:\x20machine\x20\x22'+m+'\x22\x20published\x20by\x20reference\x20—\x20audited\x20against\x20its\x20'+(n['length']+'\x20on-chain\x20node(s)\x20(effective-state\x20gate)')));}catch(o){c['push']('pre_publish:\x20could\x20not\x20fetch\x20on-chain\x20nodes\x20for\x20machine\x20\x22'+m+'\x22\x20'+('('+(o instanceof Error?o['message']:String(o))+')\x20—\x20topology\x20UNVERIFIABLE;\x20publish\x20blocked.\x20')+'Retry\x20when\x20the\x20network\x20is\x20reachable;\x20every\x20guarded\x20forward\x20must\x20carry\x20the\x20protocol\x20slot\x20254\x20'+'submission\x20row\x20and\x20topology\x20is\x20immutable\x20after\x20publish\x20(IMMUT-001)');}}if(l['length']>0x0){const p=h['reentry_kind'],q=p==='none'||p==='review-loop'||p==='paid-cycle'?p:undefined;p!==undefined&&q===undefined&&d['push']('pre_publish:\x20ignored\x20invalid\x20reentry_kind\x20\x22'+String(p)+'\x22\x20—\x20'+'valid\x20values:\x20none\x20(default,\x20word-stem\x20classification)\x20/\x20review-loop\x20(same-order\x20no-charge\x20revisits)\x20/\x20paid-cycle\x20(per-revisit\x20fee,\x20fund\x20gate\x20required)');const s=auditMachineNodes(l,q);c['push'](...s['critical']),d['push'](...s['warnings']);const t=await fetchForwardGuardIndex(l,i),u=lintForwardGuardsTaskBinding(t);c['push'](...u['critical']),d['push'](...u['warnings']);const v=lintForwardReviewLocks(l,t);c['push'](...v['critical']),d['push'](...v['warnings']);const w=lintForwardGuardsTimeProfile(t);c['push'](...w['critical']),d['push'](...w['warnings']);try{const x=lintMachineTaskBindingPreflight({'refs':[...t['refs']['values']()],'resolved':[...t['refs']]['flatMap'](([y,z])=>{const A=t['defs']['get'](y);if(A===undefined)return[];const B=A['data'],C=B!==null&&typeof B==='object'?B:A;return[{'ref':z,'table':C['table']}];}),'readError':t['error']});for(const y of x)d['push'](formatTaskBindingAdvisory(y));}catch{}}else typeof h['object']!=='string'&&d['push']('pre_publish:\x20publishing\x20machine\x20without\x20inline\x20node\x20data\x20—\x20topology\x20not\x20verifiable\x20in\x20this\x20call;\x20'+'verify\x20nodes/pairs/forwards\x20via\x20machineNode2file\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001)');d['push']('pre_publish:\x20machine\x20nodes/pairs/forwards\x20become\x20immutable\x20after\x20publish\x20(IMMUT-001)');}if(g==='service'){d['push']('pre_publish:\x20service\x20machine/order_allocators/arbitrations\x20become\x20immutable\x20after\x20publish\x20(IMMUT-002);\x20sales\x20remains\x20modifiable');h['machine']===undefined&&d['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call\x20(the\x20store\x20may\x20already\x20be\x20bound\x20—\x20verify\x20before\x20assuming\x20otherwise):\x20'+'query_toolkit\x20query_type=\x27service_panorama\x27\x20and\x20read\x20service.machine;\x20an\x20unset\x20machine\x20cannot\x20process\x20orders\x20and\x20CANNOT\x20be\x20fixed\x20after\x20publish\x20(IMMUT-002)');const z=h['order_allocators'];if(z!=null&&(!Array['isArray'](z['allocators'])||z['allocators']['length']===0x0))c['push']('pre_publish:\x20order_allocators\x20is\x20EMPTY\x20in\x20THIS\x20publish\x20call\x20—\x20the\x20publish\x20aborts\x20on-chain\x20'+'(\x22No\x20allocator\x20configured\x22).\x20Declare\x20at\x20least\x20one\x20allocator\x20row\x20in\x20the\x20payload\x20'+'(order_allocators\x20is\x20immutable\x20after\x20publish,\x20IMMUT-002)');else{if(z===undefined){const I=h['object'],J=typeof I==='string'?I['trim']():'';let K=![];if(J!=='')try{const L=await batchQueryObjectsByRef([J],i,!![]),M=L['get'](J['toLowerCase']()),N=M?.['data']??M;if(M!=null&&N!=null){K=!![];const O=N['order_allocators'],P=Array['isArray'](O?.['allocators'])?O['allocators']['length']:0x0;P===0x0?c['push']('pre_publish:\x20service\x20\x22'+J+'\x22\x20has\x20NO\x20order_allocators\x20on\x20chain\x20and\x20none\x20in\x20THIS\x20call\x20—\x20'+'the\x20publish\x20aborts\x20on-chain\x20(\x22No\x20allocator\x20configured\x22).\x20Declare\x20at\x20least\x20one\x20allocator\x20row\x20in\x20the\x20publish\x20payload\x20'+'(order_allocators\x20is\x20immutable\x20after\x20publish,\x20IMMUT-002)'):d['push']('pre_publish:\x20\x27order_allocators\x27\x20absent\x20from\x20THIS\x20call\x20—\x20chain\x20state\x20verified:\x20'+P+'\x20allocator\x20row(s)\x20already\x20configured');}}catch{}!K&&d['push']('pre_publish:\x20\x27order_allocators\x27\x20absent\x20from\x20THIS\x20call\x20(the\x20store\x20may\x20already\x20be\x20configured\x20—\x20verify\x20before\x20assuming\x20otherwise):\x20'+'query_toolkit\x20query_type=\x27service_panorama\x27\x20and\x20read\x20order_allocators;\x20immutable\x20after\x20publish,\x20and\x20a\x20NEVER-configured\x20service\x20aborts\x20the\x20publish\x20on-chain\x20'+'(\x22No\x20allocator\x20configured\x22)\x20(IMMUT-002)');}}if(h['publish']===!![])try{const Q=h,R=Q['object'],S=R??{};let T=typeof Q['machine']==='string'?Q['machine']:typeof Q['machine']?.['object']==='string'?Q['machine']['object']:typeof S['machine']==='string'?S['machine']:'',U=typeof S['permission']==='string'?S['permission']:'';const V=typeof R==='string'?R['trim']():'';if((!T||!U)&&V!==''){const W=await batchQueryObjectsByRef([V],i,!![]),X=W['get'](V['toLowerCase']()),Y=X?.['data']??X;if(Y!=null){if(!T&&typeof Y['machine']==='string')T=Y['machine'];if(!U&&typeof Y['permission']==='string')U=Y['permission'];}}if(T!==''&&U!==''){const Z=await fetchMachineNodes(T,i,!![]),a0=collectPermissionIndexes(Z),a1=a0['requiredIndexes']['filter'](a2=>a2>=0x3e8);if(a1['length']>0x0){let a2=U;if(!a2['startsWith']('0x')){const a3=await LocalMark['Instance']()['get'](a2)['catch'](()=>undefined);if(a3?.['address'])a2=a3['address'];}if(a2['startsWith']('0x')){const a4=await query_objects({'objects':[a2],'network':i}),a5=a4?.['objects']?.[0x0];if(a5){const a6={'address':a2,'entity_count':a5['entity_count'],'perm_remark':a5['perm_remark'],'owner':a5['owner']??a5['builder'],'admin':a5['admin']};try{a6['entityPermissions']=await fetchEntityPermissions(a2,i);}catch{}const a7=checkPermissionAuthorization(a1,a6);if(!a7['allAuthorized'])d['push']('pre_publish:\x20bound\x20Machine\x20\x22'+T+'\x22\x20forwards\x20use\x20permission\x20index(es)\x20['+a7['missingIndexes']['join'](',\x20')+']\x20'+('with\x20NO\x20entity\x20grant\x20in\x20the\x20bound\x20Permission\x20\x22'+a2+'\x22\x20—\x20every\x20rail\x20on\x20those\x20indexes\x20aborts\x20(code\x205)\x20until\x20granted\x20')+'(gfm31\x20P05:\x20a\x20store\x20shipped\x20with\x201000/1002\x20ungranted;\x20both\x20edges\x20aborted\x20for\x203.5\x20minutes\x20after\x20publish).\x20'+('Grant\x20NOW\x20via\x20{\x20operation_type:\x27permission\x27,\x20data:{\x20object:\x27'+a2+'\x27,\x20permission:{\x20op:\x27add\x20perm\x20by\x20index\x27,\x20index:<N>,\x20entity:[\x27<address>\x27]\x20}\x20}\x20}\x20—\x20')+'grantable\x20any\x20time\x20(Permission\x20is\x20NOT\x20frozen\x20by\x20publish,\x20L3),\x20but\x20grant\x20BEFORE\x20first\x20orders\x20to\x20keep\x20the\x20build\x20one-pass.');else!a7['allVerified']&&d['push']('pre_publish:\x20could\x20NOT\x20verify\x20grants\x20for\x20permission\x20index(es)\x20['+a1['join'](',\x20')+']\x20on\x20Permission\x20\x22'+a2+'\x22\x20'+'(PermissionPerm\x20entity\x20table\x20unreadable)\x20—\x20they\x20are\x20NOT\x20confirmed\x20authorized.\x20Verify\x20via\x20onchain_table\x20listing\x20the\x20Permission\x27s\x20'+'perm\x20entries\x20before\x20first\x20orders\x20(gfm31\x20P05\x20dead-rail\x20window).');}}}}}catch{}const A=h,B=numericBalance(A['compensation_fund_add']?.['balance']);if(B!==undefined&&B>0x0){const a8=A['sales'],a9=(Array['isArray'](a8?.['sales'])?a8['sales']:[])['map'](aa=>numericBalance(aa?.['price']?.['balance']))['filter'](aa=>aa!==undefined);if(a9['length']>0x0){const aa=a9['reduce']((ac,ad)=>ac+ad,0x0),ab=aa*0x3;if(ab>0x0){const ac=B/ab,ad='fund='+B+',\x20highest-SKU\x20single\x20order=Σ(price×1)='+aa+'\x20(quantity\x20set\x20at\x20buy\x20time),\x20'+('award\x20cap=3×order='+ab+'\x20(MAX_INDEMNITY_MULTIPLE),\x20coverage='+ac['toFixed'](0x2));ac<0x1&&d['push']('pre_publish:\x20compensation-fund\x20coverage\x20below\x20the\x20award\x20ceiling\x20—\x20'+ad+'\x20<\x201.\x20'+'Disclosure\x20only\x20(b6-11):\x20this\x20does\x20NOT\x20block\x20publish.\x20Per-order\x20coverage\x20is\x20enforced\x20at\x20'+'BUY\x20time\x20—\x20orders\x20are\x20rejected\x20while\x20the\x20fund\x20cannot\x20cover\x203x\x20that\x20order,\x20so\x20top\x20up\x20via\x20'+'compensation_fund_add\x20as\x20your\x20catalog\x27s\x20order\x20sizes\x20require\x20(no\x20cross-SKU\x20subsidy).\x20'+'Awards\x20beyond\x20the\x20fund\x20abort\x20the\x20claim\x20(code\x2027)\x20—\x20settlement\x20is\x20all-or-nothing,\x20nothing\x20partial\x20is\x20paid;\x20top\x20up\x20and\x20the\x20winner\x20retries.');}}else d['push']('pre_publish:\x20compensation_fund_add\x20present\x20but\x20\x27sales\x27\x20absent\x20from\x20THIS\x20call\x20(sales\x20may\x20already\x20be\x20configured\x20—\x20verify,\x20do\x20not\x20assume):\x20'+'the\x20fund\x20should\x20cover\x203×\x20each\x20order\x20you\x20want\x20to\x20sell\x20(MAX_INDEMNITY_MULTIPLE=3;\x20enforced\x20per-order\x20at\x20buy\x20time).\x20'+'query_toolkit\x20query_type=\x27service_panorama\x27\x20to\x20read\x20the\x20current\x20sales\x20prices,\x20then\x20re-check\x20coverage.');}const C=A['sales']?.['sales'];if(C!==undefined){const ae=typeof A['account']==='string'&&A['account']['trim']()!==''?A['account']['trim']():undefined,af=lintSalesWipBindings(C,ae);c['push'](...af['critical']),d['push'](...af['warnings']);}const D=await lintAllocatorGuards(A,i);c['push'](...D['critical']),d['push'](...D['warnings']);const E=A['order_allocators']!==undefined||A['order_allocators_append']!==undefined,F=A['publish']===!![]&&typeof A['object']==='string'&&A['object']['trim']()!=='';if(E||F){const ag=A['machine'],ah=typeof ag==='string'&&ag['trim']()!=='';if(ah||F){const ai=await lintServiceEscrowExitCoverage(ah?ag:undefined,[A['order_allocators'],A['order_allocators_append']],i,F?A['object']:undefined);c['push'](...ai['critical']),d['push'](...ai['warnings']);}else d['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call\x20—\x20escrow-exit\x20terminal\x20coverage\x20not\x20auditable\x20here;\x20'+'if\x20the\x20machine\x20is\x20already\x20bound,\x20every\x20machine\x20terminal\x20needs\x20an\x20allocator\x20rail\x20(immutable\x20after\x20publish,\x20IMMUT-002)');}const G=await checkArbitrationNeutrality(A,i);c['push'](...G['critical']),d['push'](...G['warnings']);if(A['arbitrations']!==undefined||A['arbitrations_append']!==undefined){const aj=await lintAllocatorRailPairing(A,i);c['push'](...aj['critical']),d['push'](...aj['warnings']);}const H=new Set(rewardRefsOf(A)['map'](ak=>ak['toLowerCase']()));if(H['size']===0x0&&A['publish']===!![]&&typeof A['object']==='string')try{const ak=await batchQueryObjectsByIds([A['object']],i,!![]),al=(ak??[])[0x0],am=al?.['data']??al,an=Array['isArray'](am?.['rewards'])?am['rewards']:[];for(const ao of an){if(typeof ao==='string'&&ao['trim']()!=='')H['add'](ao['toLowerCase']());}}catch(ap){d['push']('pre_publish:\x20reward-funding\x20gate\x20skipped\x20—\x20could\x20not\x20read\x20the\x20service\x27s\x20on-chain\x20rewards\x20'+('('+(ap instanceof Error?ap['message']:String(ap))+');\x20verify\x20every\x20attached\x20Reward\x20pool\x20is\x20funded\x20')+'up\x20to\x20expected_orders\x20x\x20per-claim\x20amount\x20BEFORE\x20publish');}if(H['size']>0x0)try{const aq=await batchQueryObjectsByIds([...H['values']()],i,!![]),ar=new Map();for(const as of aq??[]){const at=as;if(at?.['type']!=='Reward')continue;for(const au of[at['query_name'],at['object']]){if(typeof au==='string'&&au!=='')ar['set'](au['toLowerCase'](),at);}}for(const av of H){const aw=ar['get'](av);if(!aw){d['push']('pre_publish:\x20attached\x20reward\x20\x22'+av+'\x22\x20not\x20found\x20on-chain\x20—\x20funding\x20check\x20skipped\x20for\x20it;\x20'+'an\x20unfunded\x20pool\x20publishes\x20silently\x20and\x20claims\x20abort\x20when\x20it\x20drains');continue;}const ax=serviceRewardsUnfundedDetail(aw);ax&&c['push']('pre_publish:\x20OFN-C\x20reward-pool\x20funding\x20—\x20reward\x20\x22'+av+'\x22:\x20'+ax);}}catch(ay){d['push']('pre_publish:\x20reward-funding\x20gate\x20skipped\x20—\x20could\x20not\x20query\x20reward\x20objects\x20'+('('+(ay instanceof Error?ay['message']:String(ay))+');\x20verify\x20every\x20attached\x20Reward\x20pool\x20is\x20funded\x20')+'up\x20to\x20expected_orders\x20x\x20per-claim\x20amount\x20BEFORE\x20publish');}}return{'critical':c,'warnings':d};}function buildHarnessBlockResult(a,b,c,d,e,f){const g=[...c['map'](i=>'CRITICAL:\x20'+i),...d['map'](i=>'WARN:\x20'+i)]['join']('\x0a'),h='Error:\x20'+b+(g?'\x0a'+g:'')+'\x0aRecovery:\x20'+f;return{'content':[{'type':'text','text':h}],'structuredContent':{'outcome':'failed','result':{'type':'error','error':b+'\x20[gate='+a+']','error_code':e,'retryable':![],'recovery_hint':f},'message':h,'recovery':recover(e,'harness:'+a)}};}function extractCriticalFindingCount(a){const b=a?.['structuredContent'];if(!b)return 0x0;const c=b['semantic'],d=c?.['summary'];if(typeof d?.['critical_count']==='number'&&d['critical_count']>0x0)return d['critical_count'];const e=b['findings']??c?.['findings'];if(Array['isArray'](e))return e['filter'](h=>h?.['severity']==='error')['length'];const f=a?.['content']?.['map'](h=>'text'in h?h['text']:'')['join']('\x0a')??'',g=f['match'](/\[AUDIT ERROR\]/g);return g?g['length']:0x0;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wowok/agent-mcp",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
|
+
"wowok": {
|
|
5
|
+
"upgrade": {
|
|
6
|
+
"enforce": true
|
|
7
|
+
}
|
|
8
|
+
},
|
|
4
9
|
"description": "Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.",
|
|
5
10
|
"main": "dist/index.js",
|
|
6
11
|
"types": "dist/index.d.ts",
|
|
@@ -24,10 +29,6 @@
|
|
|
24
29
|
"import": "./dist/extensions/index.js"
|
|
25
30
|
}
|
|
26
31
|
},
|
|
27
|
-
"repository": {
|
|
28
|
-
"type": "git",
|
|
29
|
-
"url": "https://github.com/wowok-ai/agent.git"
|
|
30
|
-
},
|
|
31
32
|
"homepage": "https://wowok.net",
|
|
32
33
|
"files": [
|
|
33
34
|
"dist",
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"license": "Apache-2.0",
|
|
55
56
|
"dependencies": {
|
|
56
57
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
57
|
-
"@wowok/wowok": "3.
|
|
58
|
+
"@wowok/wowok": "3.4.0",
|
|
58
59
|
"lodash": "^4.18.1",
|
|
59
60
|
"pg": "^8.23.1",
|
|
60
61
|
"zod": "^4.2.0"
|