@wowok/agent-mcp 3.4.4 → 3.4.5
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/.build-stamp.json +3 -3
- package/dist/chain-semantics/composition-truth.js +1 -1
- package/dist/composition/audit.js +1 -1
- package/dist/composition/compile.js +1 -1
- package/dist/composition/emit-phases.js +1 -1
- package/dist/composition/guard-fill.js +1 -1
- package/dist/composition/input-normalize.js +1 -1
- package/dist/composition/materialize.js +1 -1
- package/dist/composition/mode-gates.js +1 -1
- package/dist/composition/param-disclosure.js +1 -1
- package/dist/composition/plan-run-store.js +1 -0
- package/dist/composition/reflux.js +1 -1
- package/dist/composition/role-bindings.js +1 -0
- package/dist/composition/shape-expand.js +1 -1
- package/dist/composition/supply-chain-emit.js +1 -1
- package/dist/config/judgment.d.ts +13 -25
- package/dist/config/judgment.js +1 -1
- package/dist/config/match-policy-file.js +1 -1
- package/dist/config/rule-engine.d.ts +4 -10
- package/dist/config/rule-engine.js +1 -1
- package/dist/config/template-params.js +1 -1
- package/dist/evaluation/engine.js +1 -1
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/capability.js +1 -1
- package/dist/graph/onchain/expand.js +1 -1
- package/dist/graph/onchain/exposure.js +1 -1
- package/dist/harness/forward-roster-preflight.js +1 -0
- package/dist/keeper/detectors.js +1 -1
- package/dist/knowledge/allocator-rail-verifier.js +1 -1
- package/dist/knowledge/arb-operation-face.js +1 -1
- package/dist/knowledge/arbitration-rail-verifier.js +1 -1
- package/dist/knowledge/audit-rules.d.ts +17 -1
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/rules/alloc_audit.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/allocation.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/arb.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/arbitration.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/bridge.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/contact.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/demand.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/graph.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/guard.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/machine.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/oracle.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/order.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/payment.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/permission.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/personal.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/plan.json +153 -33
- package/dist/knowledge/baselines/rules/plan.json.good +153 -33
- package/dist/knowledge/baselines/rules/plan.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/progress.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/proof.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/registrar.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/repository.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/resource.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/reward.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/service.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/treasury.json.good.sha256 +1 -0
- package/dist/knowledge/baselines/rules/util.json.good.sha256 +1 -0
- package/dist/knowledge/builtin-templates.d.ts +1 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/discount-threshold.js +1 -1
- package/dist/knowledge/fee-param-bindings.js +1 -1
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-binding-table.js +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +3 -2
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/knob-docs.js +1 -1
- package/dist/knowledge/machine-topology.js +1 -1
- package/dist/knowledge/param-schema.js +1 -1
- package/dist/knowledge/param-tiers.js +1 -1
- package/dist/knowledge/path-oracle/products/alibaba-1688.js +1 -1
- package/dist/knowledge/path-oracle/products/amazon.js +1 -1
- package/dist/knowledge/path-oracle/products/booking-com.js +1 -1
- package/dist/knowledge/path-oracle/products/contra.js +1 -1
- package/dist/knowledge/path-oracle/products/costco.js +1 -1
- package/dist/knowledge/path-oracle/products/duoduo-maicai.js +1 -1
- package/dist/knowledge/path-oracle/products/etsy.js +1 -1
- package/dist/knowledge/path-oracle/products/gamefound.js +1 -1
- package/dist/knowledge/path-oracle/products/gofundme.js +1 -1
- package/dist/knowledge/path-oracle/products/klook.js +1 -1
- package/dist/knowledge/path-oracle/products/ninety-nine-designs.js +1 -1
- package/dist/knowledge/path-oracle/products/pinduoduo-kuaituantuan.js +1 -1
- package/dist/knowledge/path-oracle/products/shansong.js +1 -1
- package/dist/knowledge/path-oracle/products/taobao-presale.js +1 -1
- package/dist/knowledge/path-oracle/products/upwork-catalog.js +1 -1
- package/dist/knowledge/path-oracle/products/upwork.js +1 -1
- package/dist/knowledge/pattern-resolutions.js +1 -1
- package/dist/knowledge/protocol-facts.js +1 -1
- package/dist/knowledge/publish-gate.js +1 -1
- package/dist/knowledge/publish-surface-contract.js +1 -1
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/time-units.js +1 -0
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/radar-core.js +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.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.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/service-quote.js +1 -1
- package/dist/review/index.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +110 -2
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/boundary-coercion.js +1 -0
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +56 -8
- package/dist/schema/call/order.d.ts +37 -10
- package/dist/schema/call/order.js +1 -1
- package/dist/schema/call/permission.d.ts +210 -30
- package/dist/schema/call/personal.d.ts +56 -8
- package/dist/schema/call/progress.d.ts +28 -4
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +84 -12
- package/dist/schema/common/index.d.ts +14 -2
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +1 -1
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +168 -24
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +655 -22
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +22 -110
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/workflow/index.d.ts +4 -0
- package/dist/schema/workflow/index.js +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/benchmark_migration_operation.schema.json +1 -1
- package/dist/schemas/evaluation_operation.schema.json +1 -1
- package/dist/schemas/goal_operation.schema.json +1 -1
- package/dist/schemas/guard_rebind_replacement.schema.json +1 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/messenger_operation.schema.json +1 -1
- package/dist/schemas/onchain_operations.schema.json +1 -1
- package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
- package/dist/schemas/onchain_operations_arbitration.schema.json +1 -1
- package/dist/schemas/onchain_operations_contact.schema.json +1 -1
- package/dist/schemas/onchain_operations_demand.schema.json +1 -1
- package/dist/schemas/onchain_operations_gen_passport.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +1 -1
- package/dist/schemas/onchain_operations_order.schema.json +1 -1
- package/dist/schemas/onchain_operations_permission.schema.json +1 -1
- package/dist/schemas/onchain_operations_personal.schema.json +1 -1
- package/dist/schemas/onchain_operations_progress.schema.json +1 -1
- package/dist/schemas/onchain_operations_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_repository.schema.json +1 -1
- package/dist/schemas/onchain_operations_reward.schema.json +1 -1
- package/dist/schemas/onchain_operations_service.schema.json +1 -1
- package/dist/schemas/onchain_operations_treasury.schema.json +1 -1
- package/dist/schemas/persona_operation.schema.json +1 -1
- package/dist/schemas/time_convert.schema.json +1 -0
- package/dist/schemas/wip_file.schema.json +1 -1
- package/dist/schemas/workflow_operation.schema.json +1 -1
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/fund-rail-recipe.js +1 -1
- package/dist/tools/handlers/guard-rebind-replacement.js +1 -0
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/mark-namespace.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/settle-sweep.js +1 -1
- package/dist/tools/handlers/time-convert.js +1 -0
- package/dist/tools/handlers/wip.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/local.js +1 -1
- package/dist/tools/registry/onchain.js +1 -1
- package/dist/tools/wip-verify-ledger.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +6 -5
package/dist/tools/wrap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{classifyError,buildDataSemantic,normalizeErrorMessage}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,callerIndependentSlots,declaresTaskBindingSlot}from'../knowledge/onchain-constants.js';import{classifyRecipient}from'../knowledge/recipient-constraint.js';import{recover}from'../harness/recover.js';import{stableOperationId}from'../harness/operation-id.js';import{buildPublishReadinessVerdict,summarizeVerdict}from'../knowledge/publish-readiness.js';import{gatesForFace}from'../knowledge/publish-surface-contract.js';import{staleBuildHardGate}from'./handlers/stale-build-check.js';import{dryRunGateKey,recordDryRunAudit,hasDryRunAudit,recordDryRunFailure,lastDryRunFailure,dryRunGateWaived,pendingPlanFundingAmount}from'./publish-gate-state.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,ObjectType,objectTypeFromAddress}from'@wowok/wowok';import{arbitrationVotingLockDetail,arbitrationVotingGuardNoIdentityDetail,auditMachineNodes,chainNodeRailMatrix,computeTerminalReachability,formatTaskBindingAdvisory,guardTimeProfileDetail,lintMachineTaskBindingPreflight,lintReviewLockedTerminals,lintTaskBindingAdvisories,rewardRefsOf,rewardFundingGateFinding}from'../knowledge/audit-rules.js';import{lintGuard}from'../knowledge/guard-lint.js';import{walkGuardTreeSemantics}from'../knowledge/guard-semantic-walk.js';import{parseGuardNodeGates}from'../knowledge/guard-node-gates.js';import{lintRewardClaimNodeGateDeadlock}from'../knowledge/guard-node-gates.js';import{batchQueryObjectsByIds,batchQueryObjectsByRef,fetchMachineNodes}from'../graph/onchain/sdk-batch.js';import{collectPermissionIndexes,checkPermissionAuthorization,permissionGrantPayloadJson}from'../schema/utils/permission-machine-check.js';import{fetchEntityPermissions}from'../playbooks/service-build/participation-radar.js';import{railNodePins,verifyAllocatorRails}from'../knowledge/allocator-rail-verifier.js';import{projectMachineEdges,readArbRulingGuard,verifyArbitrationRulingRails}from'../knowledge/arbitration-rail-verifier.js';import{verifyRailExitSatisfiability}from'../knowledge/rail-exit-satisfiability.js';import{auditGuardRelies,verifyGuardBinding}from'../knowledge/guard-binding-verifier.js';import{bypassPathFindings,closureFindings,disputeStrandFindings,findRegistryDeadLegs,nettingFindings,opsReadyFindings,zombieConvergenceFindings}from'../knowledge/publish-gate.js';import{resolveMarkNamespaced}from'./handlers/mark-namespace.js';import{echoServicePublishBindings}from'./handlers/publish-binding-echo.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=normalizeErrorMessage(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,h);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'){const u=d?.['env'];if(u?.['window_profile']==='test'&&['testnet','mainnet']['includes']((u['network']??'')['toLowerCase']()))return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED:\x20env.window_profile=\x27test\x27\x20(compressed\x20time\x20windows)\x20is\x20not\x20allowed\x20on\x20a\x20real\x20network.',[],[],'immutable_violation','Trial\x20runs\x20belong\x20on\x20a\x20disposable\x20local/dev\x20chain\x20(re-issue\x20with\x20env.network=\x27localnet\x27);\x20a\x20production\x20store\x20re-issues\x20WITHOUT\x20window_profile=\x27test\x27\x20so\x20business\x20windows\x20stay\x20real\x20(guards\x20freeze\x20at\x20publish\x20—\x20compressed\x20windows\x20would\x20be\x20unrepairable).');const v=d?.['env']?.['dry_run']===!![],x=dryRunGateKey(b,d);if(!v&&!hasDryRunAudit(x)&&!dryRunGateWaived(d)){const y=lastDryRunFailure(x),z=y?'\x20IMPORTANT:\x20an\x20earlier\x20dry_run:true\x20audit\x20of\x20THIS\x20EXACT\x20payload\x20already\x20FAILED\x20with\x20'+(y['criticals']['length']+'\x20CRITICAL\x20risk(s)\x20—\x20re-issuing\x20it\x20unchanged\x20will\x20fail\x20identically.\x20Fix\x20these\x20first:\x0a')+y['criticals']['map'](A=>'\x20\x20-\x20'+A)['join']('\x0a'):'';return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20dry-run-first\x20mandate\x20(ruling\x202026-11-04):\x20no\x20PASSED\x20env\x20dry_run:true\x20'+'strict\x20pre-publish\x20audit\x20found\x20for\x20THIS\x20exact\x20payload\x20in\x20this\x20session.'+z,y?.['criticals']??[],[],'state_conflict','Re-issue\x20the\x20SAME\x20publish\x20with\x20env\x20dry_run:true\x20first\x20(strict\x20audit;\x20outage\x20fails\x20closed).\x20'+'With\x200\x20CRITICAL\x20it\x20registers\x20the\x20payload\x20in\x20the\x20session\x20ledger,\x20then\x20the\x20formal\x20publish\x20'+'passes\x20the\x20mandate.\x20Documented\x20waiver:\x20process\x20env\x20WOWOK_SKIP_DRYRUN_GATE=1.');}try{const A=await runPrePublishChecks(b,d);g['push'](...A['warnings']);if(A['verdict'])g['push'](summarizeVerdict(A['verdict']));const B=staleBuildHardGate('Publish');if(B['waiver'])g['push'](B['waiver']);if(B['blocked'])return buildHarnessBlockResult('pre_publish',B['message'],A['critical'],A['warnings'],'state_conflict','Rebuild\x20(pnpm\x20build),\x20restart\x20the\x20MCP\x20process,\x20and\x20retry\x20this\x20publish\x20—\x20'+'or\x20set\x20WOWOK_ALLOW_STALE_BUILD=1\x20to\x20run\x20deliberately\x20under\x20the\x20stale\x20face.');if(A['critical']['length']>0x0){for(const C of A['critical']){const D=recordCriticalRisk(C);if(D)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+D['reason']);}if(v)recordDryRunFailure(x,A['critical']);return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20Harness\x20pre-publish\x20gate\x20(GLM5-21\x20V6):\x20'+(A['critical']['length']+'\x20CRITICAL\x20risk(s)\x20must\x20be\x20resolved\x20before\x20publish.'),A['critical'],A['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.',A['verdict']);}v&&recordDryRunAudit(x);}catch(E){g['push']('pre_publish\x20hook\x20failed:\x20'+(E instanceof Error?E['message']:String(E)));}}if(b==='onchain_operations'&&n!=='off'){const F=extractOperationType(b,d);if(!isPublishOperation(b,d)){if(isGuardBindingOperation(b,d))try{const G=F==='gen_passport'?d['guard']!==undefined?{'guard':d['guard']}:harnessDataView(d):harnessDataView(d),H=d?.['env']?.['network'],I=G?await lintGuardBindingSemantics(G,F,H):{'critical':[],'warnings':[]};g['push'](...I['warnings']);const J=buildPublishReadinessVerdict('guard_binding',[{'gate':'lintGuardBindingSemantics','critical':I['critical'],'warnings':I['warnings']}],gatesForFace('guard_binding')['map'](L=>L['id']));g['push'](summarizeVerdict(J));const K=staleBuildHardGate('Guard\x20binding');if(K['waiver'])g['push'](K['waiver']);if(K['blocked'])return buildHarnessBlockResult('guard_binding',K['message'],I['critical'],I['warnings'],'state_conflict','Rebuild\x20(pnpm\x20build),\x20restart\x20the\x20MCP\x20process,\x20and\x20retry\x20this\x20bind\x20—\x20'+'or\x20set\x20WOWOK_ALLOW_STALE_BUILD=1\x20to\x20run\x20deliberately\x20under\x20the\x20stale\x20face.');if(I['critical']['length']>0x0){for(const L of I['critical']){const M=recordCriticalRisk(L);if(M)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+M['reason']);}return buildHarnessBlockResult('guard_binding','Guard\x20binding\x20BLOCKED\x20by\x20Harness\x20guard-binding\x20gate\x20(ruling\x202026-10-31):\x20'+(I['critical']['length']+'\x20CRITICAL\x20structural\x20finding(s)\x20on\x20the\x20guard(s)\x20')+'this\x20call\x20binds\x20—\x20the\x20defect\x20goes\x20LIVE\x20the\x20moment\x20this\x20tx\x20lands.',I['critical'],I['warnings'],'immutable_violation','Fix\x20the\x20CRITICAL\x20findings\x20(per-host\x20binding\x20semantics\x20—\x20see\x20the\x20finding\x20'+'details\x20and\x20guard-host-context),\x20rebuild\x20the\x20guard\x20(guards\x20are\x20immutable:\x20'+'create\x20a\x20NEW\x20guard,\x20then\x20unbind/rebind\x20on\x20the\x20host),\x20and\x20retry\x20the\x20bind.',J);}}catch(N){g['push']('guard_binding\x20hook\x20failed:\x20'+(N instanceof Error?N['message']:String(N)));}}}if(l&&j)try{const O=harnessDataView(d),P=O?extractAmount(O,{'excludeConfigAmounts':!![]}):null;if(P!==null){const Q=getAmountThreshold();let R=null;try{R=BigInt(P);}catch{R=null;}if(R!==null&&R>Q){const S=await skuMatchedOrderTotalExemption(O,d?.['env']?.['network']);if(S)g['push']('pre_sign:\x20order\x20total\x20'+P+'\x20exceeds\x20the\x20full-tier\x20threshold\x20'+Q['toString']()+'\x20(smallest\x20unit)\x20—\x20'+'EXEMPTED\x20(M-K11-a):\x20exact\x20catalog\x20match\x20Σ\x20price×quantity\x20against\x20the\x20Service\x27s\x20published\x20sales'+(S['coinType']?',\x20payment\x20coin\x20'+S['coinType']:'')+'.');else return buildHarnessBlockResult('pre_sign','Sign\x20BLOCKED\x20by\x20Harness\x20pre-sign\x20gate\x20(GLM5-21\x20V7):\x20amount\x20'+formatAmount(R)+'\x20WOW\x20exceeds\x20the\x20full-tier\x20threshold\x20'+formatAmount(Q)+'\x20WOW.',['amount\x20'+P+'\x20(smallest\x20unit)\x20>\x20threshold\x20'+Q['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(T){g['push']('pre_sign\x20hook\x20failed:\x20'+(T instanceof Error?T['message']:String(T)));}if(m&&n!=='off')try{const U=await runPreBuyChecks(b,d);g['push'](...U['warnings']);if(U['critical']['length']>0x0){const V=readHarnessOverrideNote(d);if(V)g['push']('pre_buy\x20HARNESS\x20OVERRIDE:\x20'+U['critical']['length']+'\x20CRITICAL\x20allocator\x20risk(s)\x20suppressed\x20by\x20explicit\x20override\x20note\x20—\x20'+('findings:\x20'+U['critical']['join']('\x20|\x20')+';\x20note:\x20\x22'+V+'\x22.\x20')+'On-chain\x20state\x20is\x20UNCHANGED\x20—\x20the\x20payment\x20may\x20still\x20fail\x20or\x20lock\x20funds.');else{for(const W of U['critical']){const X=recordCriticalRisk(W);if(X)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+X['reason']);}return buildHarnessBlockResult('pre_buy','Purchase\x20BLOCKED\x20by\x20Harness\x20pre-buy\x20gate:\x20'+U['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.',U['critical'],U['warnings'],'state_conflict',preBuyRecoveryHint(U['critical']));}}}catch(Y){g['push']('pre_buy\x20hook\x20failed:\x20'+(Y instanceof Error?Y['message']:String(Y)));}let o;try{o=await a(d,f);}catch(Z){const a0=Z instanceof Error?Z['message']:String(Z),a1=recordOperationFailure(b,a0);a1&&g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+a1['reason']);if(b==='onchain_operations')try{const a2=classifyError(a0,Z);if(!a2['retryable']&&a2['error_code']!=='unknown'){const a3=recordCriticalOperation(b,a2['error_code']);if(a3)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+a3['reason']);}}catch{}throw Z;}if(b==='onchain_operations')try{if(classifyOutcome(o)==='failed'){const a4=extractErrorCode(o)??'',a5=classifyError(a4);if(!a5['retryable']&&a5['error_code']!=='unknown'){const a6=recordCriticalOperation(b,a5['error_code']);if(a6)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+a6['reason']);}}}catch{}if(i&&!isOutcomeDiscriminated(o)){const a7=stableOperationId(extractIntent(b,d)??b,extractData(d));try{const a8=classifyOutcome(o);if(a8==='failed'){const a9=extractErrorCode(o)??'',aa=classifyError(a9),ab=h['recover'](aa['error_code'],a7,{'operation_type':b,'data':extractData(d),'retryable':aa['retryable']});g['push']('Harness\x20recover:\x20strategy='+ab['strategy']+('\x20(attempt\x20'+ab['current_attempt']+'/'+ab['max_attempts']+')')+(ab['should_retry']?'\x20—\x20retryable':'\x20—\x20do\x20NOT\x20retry\x20blindly')+(ab['user_prompt']?'\x20—\x20'+ab['user_prompt']:'\x20—\x20'+ab['detail']));}else a8==='success'&&h['resetRecovery'](a7);}catch(ac){g['push']('recover\x20hook\x20failed:\x20'+(ac instanceof Error?ac['message']:String(ac)));}}if(b==='goal_operation')try{const ad=d?.['action'];if(ad==='trace_substeps'){const ae=extractCriticalFindingCount(o);if(ae>0x0){const af=recordSubstepFailure(String(ad)+':\x20'+ae+'\x20critical\x20finding(s)');if(af)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+af['reason']);}}}catch{}if(isWriteClassTool(b)&&!SEMANTIC_RECORDED_TOOLS['has'](b))try{const ag=extractOperationType(b,d)??b,ah=extractIntent(b,d)??b,ai=extractData(d)??d,aj=classifyOutcome(o),ak=extractErrorCode(o),al=isEnabled('experience_layer');if(al)recordOperationOutcome(ag,ai,ah,aj,ak);else{const am=extractIndustry(d);am&&isEnabled('industry_evolution')&&recordIndustrySignal(am,{'type':ag},{'success':aj==='success','error_code':ak});}}catch(an){g['push']('signal\x20collection\x20failed:\x20'+(an instanceof Error?an['message']:String(an)));}if(g['length']>0x0){if(o?.['structuredContent']){const ao=o['structuredContent'],ap=ao['semantic'];if(ap){const aq=Array['isArray'](ap['warnings'])?ap['warnings']:[];ap['warnings']=[...aq,...g];}else for(const ar of g){console['warn']('[harness]\x20'+ar);}}else for(const as of g){console['warn']('[harness]\x20'+as);}}return o;};}function isPublishOperation(a,b){if(a!=='onchain_operations')return![];const c=extractOperationType(a,b);if(c!=='service'&&c!=='machine')return![];const d=harnessDataView(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=harnessDataView(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;}function harnessDataView(a){const b=a&&typeof a==='object'?a:undefined;if(!b)return undefined;const c=extractData(a);if(c)return c;if(typeof b['data']==='string')try{const g=JSON['parse'](b['data']);if(g&&typeof g==='object'&&!Array['isArray'](g))return g;}catch{}const d=typeof b['operation_type']==='string'?b['operation_type']:undefined;if(d===undefined)return undefined;const e=new Set(['operation_type','env','submission','info','idempotency_key']);if(d==='gen_passport')e['add']('guard');if(d==='gen_proof')for(const h of['proof','server_pubkey','server_signature','proof_type','description','item_count','about_address']){e['add'](h);}const f={};for(const [i,j]of Object['entries'](b)){if(!e['has'](i))f[i]=j;}return Object['keys'](f)['length']>0x0?f:undefined;}export function isGuardBindingOperation(a,b){if(a!=='onchain_operations')return![];const c=extractOperationType(a,b);if(c==='gen_passport'){const e=b&&typeof b==='object'?b:undefined;return e?.['guard']!==undefined||extractData(b)?.['guard']!==undefined;}const d=harnessDataView(b);if(!d)return![];return d['buy_guard']!==undefined||d['order_allocators']!==undefined||d['order_allocators_append']!==undefined||d['external_deposit_guard']!==undefined||d['external_withdraw_guard']!==undefined||d['usage_guard']!==undefined||d['voting_guard']!==undefined||d['guard_add']!==undefined||d['guards']!==undefined||d['policy']!==undefined||d['guard']!==undefined||d['node']!==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;}function railRecipientKinds(b,c){const d=[];let e=![];for(const f of b){const g=f?.['allocators'];if(!Array['isArray'](g))continue;for(const h of g){const i=h?.['guard'];if(typeof i!=='string'||i['toLowerCase']()!==c['toLowerCase']())continue;const j=h?.['sharing'];if(!Array['isArray'](j))continue;for(const k of j){const l=k['amount'];if(l!==undefined){let p=![];try{p=BigInt(String(l))===0x0n;}catch{p=![];}if(p)continue;}const m=k['percentage'];if(m!==undefined&&Number(m)===0x0)continue;const n=k['who'],o=classifyRecipient(typeof n==='string'?n==='Signer'?{'Signer':!![]}:{'Entity':n}:n);e=!![],d['push'](o?.['kind']??'unknown');}}}return e?d:undefined;}async function lintAllocatorGuardSet(a,b,c,h,i=![]){const j=[],l=[],m=collectAllocatorGuards(a);if(m['size']===0x0)return{'critical':j,'warnings':l};let n;try{n=await batchQueryObjectsByRef([...m['values']()]['map'](s=>s['ref']),b,!![]);}catch(s){const t=c+':\x20PG-CLOSURE-01\x20—\x20could\x20not\x20query\x20the\x20referenced\x20guard\x20object(s)\x20'+('('+(s instanceof Error?s['message']:String(s))+')\x20—\x20allocator-rail\x20reference\x20closure\x20UNVERIFIABLE.\x20')+(i?'Strict\x20audit\x20report:\x20the\x20outage\x20PROVES\x20NOTHING\x20about\x20chain\x20state\x20—\x20reported\x20for\x20YOUR\x20decision,\x20and\x20'+'whether\x20to\x20publish\x20remains\x20yours;\x20the\x20SAME\x20finding\x20rides\x20the\x20formal\x20publish\x20as\x20a\x20warning.\x20If\x20you\x20'+'want\x20this\x20audit\x20to\x20pass,\x20retry\x20when\x20the\x20network\x20is\x20stable\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)':'Publishing\x20WITHOUT\x20verification\x20risks\x20freezing\x20a\x20dangling\x20guard\x20ref\x20into\x20the\x20immutable\x20'+'order_allocators\x20plan\x20(IMMUT-002).\x20Re-run\x20the\x20SAME\x20publish\x20with\x20env\x20dry_run:true\x20for\x20the\x20strict\x20'+'pre-publish\x20audit\x20(an\x20outage\x20blocks\x20there),\x20or\x20retry\x20when\x20the\x20network\x20is\x20stable');if(c==='pre_publish'&&i)return j['push'](t),{'critical':j,'warnings':l};return l['push'](t),{'critical':j,'warnings':l};}const o=new Map(),p=new Set(),q=new Map();for(const [u,v]of n){const w=v;if(w?.['type']!=='Guard'){w!=null&&typeof w['object']==='string'&&w['object']!==''&&(p['add'](u['toLowerCase']()),p['add'](String(w['object'])['toLowerCase']()),typeof w['type']==='string'&&w['type']!==''&&q['set'](u['toLowerCase'](),String(w['type'])));continue;}o['set'](u['toLowerCase'](),w);for(const x of[w['query_name'],w['object']]){if(typeof x==='string'&&x!=='')o['set'](x['toLowerCase'](),w);}}const r=[];for(const [y,z]of m){const A=o['get'](y)??o['get'](z['ref']['toLowerCase']());if(!A){const G=z['ref']['toLowerCase']();if(p['has'](y)||p['has'](G)){const I=q['get'](y)??q['get'](G);if(I!==undefined){const J=c+':\x20allocator\x20guard\x20\x22'+z['ref']+'\x22\x20resolves\x20to\x20a\x20'+I+'\x20object,\x20not\x20a\x20Guard\x20—\x20'+'no\x20distribution\x20run\x20can\x20pass\x20a\x20guard\x20slot\x20that\x20names\x20a\x20different\x20object\x20type';if(h==='critical')j['push'](J);else l['push'](J);}else l['push'](c+':\x20allocator\x20guard\x20\x22'+z['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 H=c+':\x20allocator\x20guard\x20\x22'+z['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')j['push'](H);else l['push'](H);continue;}const B=A['data']??A;r['push'](A);const C=Array['isArray'](B?.['table'])?B['table']:[],D=Array['isArray'](B?.['relies'])?B['relies']:[];for(const K of z['slots']){const L=C['find'](N=>Number(N?.['identifier'])===K),M=L!=null&&L['b_submission']===!![]&&String(L['value_type'])==='Address';!M&&j['push'](c+':\x20allocator\x20guard\x20\x22'+z['ref']+'\x22\x20pays\x20a\x20{GuardIdentifier:\x20'+K+'}\x20leg\x20but\x20its\x20table\x20has\x20'+(L==null?'NO\x20slot\x20'+K+'\x20row':'slot\x20'+K+'\x20as\x20a\x20STATIC\x20row\x20(b_submission:\x20'+(L['b_submission']===!![])+',\x20value_type:\x20'+String(L['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'+K+',\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 N=C['some'](Q=>Number(Q?.['identifier'])===0x0&&Q?.['b_submission']===!![]),O=z['slots']['has'](0x0),P=lintTaskBindingAdvisories({'guardRef':z['ref'],'table':C,'allocatorBound':!O&&N,'refundReentry':O});for(const Q of P)l['push'](formatTaskBindingAdvisory(Q,c));}catch{}const E={'description':typeof B?.['description']==='string'?B['description']:undefined,'table':C['map'](R=>({'identifier':Number(R?.['identifier']??0x0),'b_submission':!!R?.['b_submission'],'value_type':R?.['value_type']!==undefined?String(R['value_type']):undefined,'value':R?.['value'],'name':R?.['name']!==undefined?String(R['name']):undefined,'object_type':R?.['object_type']!==undefined?String(R['object_type']):undefined})),'root':B?.['root'],'rely':D['length']>0x0?{'guards':D['map'](R=>String(R)),'logic_or':!B?.['relies_logic_and']}:undefined,'binding_hint':{'host_object':'Service','binding_field':'order_allocators','sharing_recipients':z['recipients']['size']>0x0?[...z['recipients']]:undefined}},F=guardTimeProfileDetail({'ref':z['ref'],'description':typeof B?.['description']==='string'?B['description']:undefined,'table':C,'root':B?.['root']});if(F){const R=c+':\x20R-TIME-PROFILE\x20—\x20allocator\x20guard\x20\x22'+z['ref']+'\x22:\x20'+F['detail'];if(F['level']==='critical')j['push'](R);else l['push'](R);}try{const S=await lintGuard(E,{'auto_fix':![],'host_published':!![]});for(const T of S['diagnostics']){const U=c+':\x20allocator\x20guard\x20\x22'+z['ref']+'\x22\x20'+T['code']+'\x20('+T['source']+'):\x20'+T['message']+'\x20at\x20'+T['location']['path'];if(T['severity']==='error')j['push'](U);else{if(T['severity']==='warning')l['push'](U);}}}catch(V){l['push'](c+':\x20allocator\x20guard\x20\x22'+z['ref']+'\x22\x20lint\x20failed\x20'+('('+(V instanceof Error?V['message']:String(V))+')\x20—\x20non-blocking'));}}return l['push'](...nettingFindings(r)['map'](W=>c+':\x20'+W)),{'critical':j,'warnings':l};}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=declaresTaskBindingSlot(h);!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 lintForwardArbRulingRails(a,b){const c=[],d=[];if(b['error']!==undefined||b['refs']['size']===0x0)return{'critical':c,'warnings':d};const e=new Map();for(const [h,i]of b['defs']){const j=i['data']??i;e['set'](h,readArbRulingGuard(j?.['root'],Array['isArray'](j?.['table'])?j['table']:undefined));}const g=verifyArbitrationRulingRails({'edges':projectMachineEdges(a),'readings':e});for(const k of g){const l='pre_publish:\x20arbitration\x20ruling-rail\x20verification\x20—\x20['+k['code']+']\x20'+k['detail'];if(k['level']==='critical')c['push'](l);else{if(k['level']==='warning')d['push'](l);else d['push']('pre_publish:\x20arbitration\x20ruling-rail\x20DISCLOSURE\x20(not\x20a\x20violation)\x20—\x20['+k['code']+']\x20'+k['detail']);}}return{'critical':c,'warnings':d};}async function lintArbVenueWhitelist(b,c,d){const f=[],g=[],h=new Map(),i=n=>{if(typeof n==='string'&&n['trim']()!=='')h['set'](n['trim']()['toLowerCase'](),n['trim']());else{if(n!==null&&typeof n==='object'){const o=n['object']??n['address'];if(typeof o==='string'&&o['trim']()!=='')h['set'](o['trim']()['toLowerCase'](),o['trim']());}}};for(const n of Array['isArray'](b['arbitrations'])?b['arbitrations']:[])i(n);const j=c&&typeof b['object']==='string'?b['object']['trim']():'';let k=typeof b['machine']==='string'?b['machine']['trim']():'';if(j!=='')try{const o=await batchQueryObjectsByIds([j],d,!![]),p=(o??[])['find'](r=>r?.['type']==='Service'),q=p?.['data']??p;for(const r of Array['isArray'](q?.['arbitrations'])?q['arbitrations']:[])i(r);if(k===''&&typeof q?.['machine']==='string')k=q['machine']['trim']();}catch(s){g['push']('pre_publish:\x20ARB-VENUE-WHITELIST\x20gate\x20ran\x20on\x20the\x20payload\x20arbitrations\x20only\x20—\x20the\x20on-chain\x20'+('service\x20read\x20failed\x20('+(s instanceof Error?s['message']:String(s))+');\x20verify\x20every\x20machine-bound\x20')+'arb-rail\x20guard\x27s\x20arb.arbitration\x20venue\x20is\x20on\x20the\x20service\x27s\x20arbitrations\x20list\x20BEFORE\x20publish\x20'+'(ktt2\x20F-15:\x20a\x20frozen\x20venue\x20off\x20the\x20whitelist\x20makes\x20every\x20ruling\x20rail\x20undrivable)');}if(h['size']===0x0||k==='')return{'critical':f,'warnings':g};let l;try{l=await fetchMachineNodes(k,d,!![]);}catch(t){return g['push']('pre_publish:\x20ARB-VENUE-WHITELIST\x20gate\x20skipped\x20—\x20machine\x20graph\x20unreadable\x20('+((t instanceof Error?t['message']:String(t))+');\x20verify\x20each\x20arb-rail\x20guard\x27s\x20bound\x20venue\x20against\x20')+'the\x20service\x20arbitrations\x20BEFORE\x20publish\x20(ktt2\x20F-15)'),{'critical':f,'warnings':g};}const m=await fetchForwardGuardIndex(l,d);if(m['error']!==undefined)return g['push']('pre_publish:\x20ARB-VENUE-WHITELIST\x20gate\x20degraded\x20—\x20forward-guard\x20read\x20failed\x20('+(m['error']+');\x20verify\x20each\x20arb-rail\x20guard\x27s\x20bound\x20venue\x20against\x20the\x20service\x20arbitrations\x20BEFORE\x20publish\x20(ktt2\x20F-15)')),{'critical':f,'warnings':g};for(const [u,v]of m['defs']){const w=v['data']??v,x=readArbRulingGuard(w?.['root'],Array['isArray'](w?.['table'])?w['table']:undefined);if(!x['venueBound']||x['venueValues']['length']===0x0)continue;const y=m['refs']['get'](u)??u;for(const z of x['venueValues']){!h['has'](z['toLowerCase']())&&f['push']('ARB-VENUE-WHITELIST:\x20forward-bound\x20arb-rail\x20guard\x20\x22'+y+'\x22\x20statically\x20binds\x20venue\x20'+(z+'\x20via\x20its\x20arb.arbitration\x20leg,\x20but\x20this\x20service\x27s\x20arbitrations\x20whitelist\x20is\x20')+('['+[...h['values']()]['join'](',\x20')+']\x20—\x20the\x20venue\x20is\x20not\x20on\x20it.\x20A\x20case\x20filed\x20at\x20the\x20whitelisted\x20')+'venue\x20can\x20never\x20satisfy\x20this\x20guard\x20(every\x20ruling\x20rail\x20it\x20carries\x20is\x20undrivable\x20forever:\x20guards\x20'+'freeze\x20at\x20create,\x20IMMUT-001),\x20and\x20orders\x20can\x20never\x20reach\x20the\x20guard\x27s\x20venue\x20through\x20this\x20graph.\x20'+'ktt2-mn-261109\x20F-15\x20shipped\x20exactly\x20this\x20mismatch\x20and\x20paid\x20a\x20full\x20machine\x20+\x20guard\x20rebuild\x20to\x20cure\x20it.\x20'+'Fix\x20BEFORE\x20publish:\x20publish\x20the\x20service\x20with\x20arbitrations\x20=\x20the\x20venues\x20the\x20machine\x27s\x20arb-rail\x20'+'guards\x20actually\x20bind\x20(or\x20re-create\x20the\x20guards\x20bound\x20to\x20the\x20whitelisted\x20venue\x20—\x20they\x20are\x20immutable)');}}return{'critical':f,'warnings':g};}function applyTestWindowProfile(a,b){if(b!=='test')return a;const c=[],d=[...a['warnings']];for(const e of a['critical']){e['includes']('R-TIME-PROFILE')?d['push'](e['replace']('R-TIME-PROFILE','R-TIME-PROFILE\x20TEST-WINDOW\x20PROFILE\x20(env\x20window_profile=\x27test\x27:\x20compressed\x20windows\x20allowed\x20on\x20this\x20disposable\x20run;\x20a\x20real-network\x20publish\x20still\x20BLOCKS;\x20a\x20production\x20store\x20must\x20re-issue\x20with\x20real\x20windows\x20—\x20guards\x20freeze\x20at\x20publish)')):c['push'](e);}return{'critical':c,'warnings':d};}export{applyTestWindowProfile};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};}function lintForwardGuardServiceConstants(a,b,c){const d=[],e=[];if(a['error']!==undefined||a['refs']['size']===0x0)return{'critical':d,'warnings':e};const f=b?.['toLowerCase']();for(const [g,h]of a['refs']){const i=a['defs']['get'](g);if(!i)continue;const j=i['data']??i,k=Array['isArray'](j?.['table'])?j['table']:[];for(const l of k){if(l?.['b_submission']===!![])continue;if(String(l?.['value_type']??'')!=='Address')continue;const m=l?.['value'];if(typeof m!=='string'||!m['startsWith']('0x'))continue;const n=m['toLowerCase'](),o=objectTypeFromAddress(m);if(o===ObjectType['Service']&&n!==f){const p=c+':\x20forward\x20guard\x20\x22'+h+'\x22\x20pins\x20Service-typed\x20address\x20'+m+'\x20as\x20a\x20STATIC\x20constant'+(f!==undefined?'\x20while\x20the\x20machine\x20binds\x20a\x20DIFFERENT\x20service':'')+'\x20—\x20every\x20forward\x20then\x20aborts\x20(guard\x20verify\x20fail,\x20code\x207)\x20on\x20that\x20service\x20and\x20in-flight\x20orders\x20strand\x20'+'permanently:\x20guards\x20freeze\x20(IMMUT-001)\x20and\x20allocator\x20appends\x20only\x20help\x20NEW\x20orders\x20'+'(mtb-tn-261030\x20P0-3:\x205.8\x20WOW\x20stranded\x20on\x20a\x20machine\x20reused\x20across\x20store\x20versions).\x20'+(f!==undefined?'Rebuild\x20the\x20guard\x20with\x20the\x20self-reference\x20pattern\x20(compare\x20order.service\x20against\x20THIS\x20service\x20'+f+')\x20BEFORE\x20publishing':'Safe\x20ONLY\x20if\x20this\x20machine\x20will\x20ever\x20bind\x20the\x20pinned\x20service;\x20otherwise\x20rebuild\x20the\x20guard\x20BEFORE\x20binding\x20any\x20other\x20service');if(f!==undefined)d['push'](p);else e['push'](p);}else o===null&&f!==undefined&&n!==f&&e['push'](c+':\x20forward\x20guard\x20\x22'+h+'\x22\x20pins\x20untagged\x20address\x20'+m+'\x20(slot\x20#'+l?.['identifier']+')\x20as\x20a\x20STATIC\x20constant\x20—\x20'+'not\x20a\x20protocol\x20object\x20(no\x20first-byte\x20type\x20tag).\x20Wallet\x20references\x20are\x20legal,\x20but\x20a\x20stale/non-object\x20'+'address\x20freezes\x20into\x20the\x20guard\x20(IMMUT-001)\x20and\x20silently\x20fails\x20its\x20comparison\x20against\x20real\x20orders.\x20'+'Confirm\x20this\x20is\x20the\x20intended\x20account\x20BEFORE\x20publish');}}return{'critical':d,'warnings':e};}async function lintMachineGuardServiceConstants(a,b,c,d){let f;try{f=await fetchMachineNodes(a,c,!![]);}catch(h){return{'critical':[],'warnings':[d+':\x20could\x20not\x20fetch\x20machine\x20\x22'+a+'\x22\x20nodes\x20for\x20the\x20guard-constant\x20consistency\x20check\x20'+('('+(h instanceof Error?h['message']:String(h))+')\x20—\x20cross-service\x20guard\x20pins\x20UNVERIFIED.\x20Audit\x20each\x20forward\x20')+'guard\x20manually\x20before\x20trusting\x20orders\x20on\x20this\x20machine\x20(mtb-tn-261030\x20P0-3:\x20a\x20frozen\x20guard\x20pinning\x20ANOTHER\x20'+'service\x27s\x20address\x20strands\x20every\x20order)']};}if(f['length']===0x0)return{'critical':[],'warnings':[]};const g=await fetchForwardGuardIndex(f,c);if(g['error']!==undefined)return{'critical':[],'warnings':[d+':\x20guard-constant\x20consistency\x20check\x20degraded\x20('+g['error']+')\x20—\x20cross-service\x20guard\x20pins\x20UNVERIFIED\x20'+'(mtb-tn-261030\x20P0-3)']};return lintForwardGuardServiceConstants(g,b,d);}async function lintAllocatorGuards(a,b,c=![]){return lintAllocatorGuardSet([a['order_allocators'],a['order_allocators_append']],b,'pre_publish','critical',c);}async function lintAllocatorRailPairing(a,b,c,d=![]){const h=[],i=[];let j,l;if(c)try{const w=await batchQueryObjectsByIds([c],b,!![]),x=(w??[])['find'](y=>y?.['type']==='Service');j=x?.['data']??x;}catch(y){l=y;}const m=[a['order_allocators'],a['order_allocators_append']];let n=m,o=collectAllocatorGuards(m);if(o['size']===0x0&&c){if(!j){const z=l!==undefined?'could\x20not\x20be\x20queried\x20('+(l instanceof Error?l['message']:String(l))+')':'resolved\x20no\x20Service\x20object\x20on-chain',A='pre_publish:\x20allocator\x20rail\x20verification\x20—\x20service\x20\x22'+c+'\x22\x20'+z+'\x20and\x20THIS\x20call\x20binds\x20no\x20'+'allocators,\x20so\x20the\x20effective\x20rails\x20are\x20UNVERIFIABLE.\x20'+(l!==undefined?d?'Strict\x20audit\x20report:\x20the\x20outage\x20proves\x20nothing\x20about\x20chain\x20state\x20—\x20reported\x20for\x20YOUR\x20decision;\x20'+'the\x20formal\x20publish\x20carries\x20this\x20as\x20a\x20warning.\x20Retry\x20when\x20the\x20network\x20is\x20stable:\x20a\x20fund\x20rail\x20'+'carrying\x20a\x20claimed_by\x20leg,\x20or\x20with\x20no\x20viable\x20exit,\x20strands\x20a\x20claimed\x20order\x20(order_allocators\x20'+'immutable\x20after\x20publish,\x20IMMUT-002)':'Publishing\x20WITHOUT\x20rail\x20verification\x20risks\x20stranding\x20a\x20claimed\x20order\x27s\x20escrow\x20(IMMUT-002).\x20'+'Re-run\x20the\x20SAME\x20publish\x20with\x20env\x20dry_run:true\x20for\x20the\x20strict\x20pre-publish\x20audit\x20(an\x20outage\x20'+'blocks\x20there),\x20or\x20retry\x20when\x20the\x20network\x20is\x20stable':'Settle\x20the\x20ref\x20with\x20query_toolkit\x20query_type=\x27service_panorama\x27\x20and\x20re-run:\x20a\x20fund\x20rail\x20carrying\x20a\x20'+'claimed_by\x20leg,\x20or\x20with\x20no\x20viable\x20exit,\x20strands\x20a\x20claimed\x20order\x20(IMMUT-002)');if(l!==undefined&&d)h['push'](A);else i['push'](A);return{'critical':h,'warnings':i};}o=collectAllocatorGuards([j['order_allocators']]),n=[j['order_allocators']];}if(o['size']===0x0)return{'critical':h,'warnings':i};let p;try{p=await batchQueryObjectsByRef([...o['values']()]['map'](B=>B['ref']),b,!![]);}catch(B){return i['push']('pre_publish:\x20allocator\x20rail\x20verification\x20skipped\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+(B instanceof Error?B['message']:String(B))+');\x20run\x20template_scan\x20or\x20guard\x20lint\x20manually\x20')+'BEFORE\x20publish:\x20fund\x20rails\x20must\x20be\x20node-gated\x20with\x20NO\x20claimed_by\x20leg\x20(decision\x2011,\x20'+'R-FUND-RAIL-CLAIMED-BY)\x20and\x20every\x20rail\x20must\x20reach\x20a\x20viable\x20exit,\x20or\x20a\x20claimed\x20order\x20'+'strands\x20its\x20escrow\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)'),{'critical':h,'warnings':i};}const q=new Map();for(const [C,D]of p){const E=D;if(E?.['type']!=='Guard')continue;q['set'](C['toLowerCase'](),E);for(const F of[E['query_name'],E['object']]){if(typeof F==='string'&&F!=='')q['set'](F['toLowerCase'](),E);}}const r=[],s=new Set();for(const [G,H]of o){const I=q['get'](G);if(!I)continue;const J=I?.['data']??I,K=Array['isArray'](J['table'])?J['table']:[];r['push']({'key':H['ref'],'track':H['slots']['has'](0x0)?'refund':'settlement','table':K,'root':J['root'],'recipientKinds':railRecipientKinds(n,H['ref'])});const L=J['description'];typeof L==='string'&&L['includes']('merchant-declared\x20exemption:\x20rail\x20\x27')&&s['add'](H['ref']);}if(r['length']===0x0)return i['push']('pre_publish:\x20allocator\x20rail\x20verification\x20skipped\x20—\x20no\x20referenced\x20allocator\x20guard\x20was\x20'+'resolvable\x20on-chain;\x20verify\x20the\x20rails\x20BEFORE\x20publish\x20(IMMUT-002)'),{'critical':h,'warnings':i};let t=typeof a['machine']==='string'&&a['machine']['trim']()!==''?a['machine']:undefined;!t&&typeof j?.['machine']==='string'&&j['machine']['trim']()!==''&&(t=j['machine']);let u=[];if(t&&t['trim']()!=='')try{const M=await fetchMachineNodes(t,b,!![]);u=chainNodeRailMatrix(M);}catch{i['push']('pre_publish:\x20allocator\x20rail\x20verification\x20ran\x20WITHOUT\x20the\x20machine\x20node\x20matrix\x20'+'(machine\x20fetch\x20failed)\x20—\x20award-exit\x20coverage\x20is\x20evaluated\x20on\x20the\x20payload\x20rails\x20only');}else i['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call'+(c?'\x20and\x20from\x20the\x20published\x20service\x27s\x20on-chain\x20binding':'')+'\x20—\x20allocator\x20rail\x20verification\x20evaluated\x20without\x20'+'the\x20node\x20matrix;\x20if\x20the\x20store\x20binds\x20a\x20machine\x20later,\x20re-verify\x20after\x20binding');u['length']===0x0&&(u=[{'name':'*'}]);const v=verifyAllocatorRails(r,u,{'declaredKeys':s});for(const N of v){const O='pre_publish:\x20allocator\x20rail\x20verification\x20—\x20['+N['code']+']\x20'+N['detail'];N['level']==='info'?i['push']('pre_publish:\x20allocator\x20rail\x20DISCLOSURE\x20(not\x20a\x20violation)\x20—\x20['+N['code']+']\x20'+N['detail']):h['push'](O);}return{'critical':h,'warnings':i};}function collectGuardBindingRefs(a,b){const c=[],d=(e,h,i)=>{typeof e==='string'&&e['trim']()!==''&&c['push']({'ref':e['trim'](),'host':h,'facts':i});};if(b==='service'){d(a['buy_guard'],'service_buy_guard');for(const e of collectAllocatorGuards([a['order_allocators'],a['order_allocators_append']])['values']()){c['push']({'ref':e['ref'],'host':'service_allocator_guard'});}}if(b==='treasury'){const h=a['external_deposit_guard'];if(Array['isArray'](h))for(const j of h){d(j?.['guard'],'treasury_external_deposit',{'amount_slot':typeof j?.['identifier']==='number'?j['identifier']:undefined});}const i=a['external_withdraw_guard'];if(Array['isArray'](i))for(const k of i){d(k?.['guard'],'treasury_external_withdraw',{'amount_slot':typeof k?.['identifier']==='number'?k['identifier']:undefined});}}if(b==='arbitration'){d(a['usage_guard'],'arbitration_usage');const l=a['voting_guard'];if(l&&typeof l==='object'&&Array['isArray'](l['guards'])&&l['op']!=='remove'&&l['op']!=='clear')for(const m of l['guards']){d(m?.['guard'],'arbitration_voting');}}if(b==='reward'){const o=a['guard_add'];if(Array['isArray'](o))for(const q of o){d(q?.['guard'],'reward_claim');}}if(b==='demand'){const r=a['guards'];if(Array['isArray'](r))for(const s of r){d(typeof s==='string'?s:s?.['guard'],'demand_present');}}if(b==='permission'){const t=a['policy'];if(Array['isArray'](t))for(const u of t){const v=u?.['write_guard'];if(Array['isArray'](v))for(const w of v){d(typeof w==='string'?w:w?.['guard'],'repository_write');}d(u?.['quote_guard'],'repository_quote');}}if(b==='machine'){const x=a['node'],y=x&&typeof x==='object'&&!('json_or_markdown_file'in x)?x['nodes']:undefined;if(Array['isArray'](y))for(const z of y){const A=Array['isArray'](z?.['pairs'])?z['pairs']:[];for(const B of A){const C=Array['isArray'](B?.['forwards'])?B['forwards']:[];for(const D of C){const E=D?.['guard'],F=D?.['permissionIndex']??D?.['permission_index'],G=typeof F==='number'?F:undefined;d(typeof E==='string'?E:E?.['guard'],'machine_forward',{'source_node':typeof B?.['prev_node']==='string'?B['prev_node']:undefined,...G!==undefined?{'declared_permission_indexes':[G]}:{}});}}}}if(b==='gen_passport'){const H=a['guard'];if(typeof H==='string')d(H,'gen_passport');else{if(Array['isArray'](H))for(const I of H){d(typeof I==='string'?I:I?.['guard'],'gen_passport');}}}return c;}function lintGuardSemanticWalk(a,b,c,d){const e=[],g=[];for(const h of walkGuardTreeSemantics(c,d)){const i='pre_publish:\x20guard\x20semantic\x20walk\x20on\x20'+a+'\x20(guard\x20\x22'+b+'\x22)\x20—\x20['+h['code']+']\x20'+h['detail'];if(h['level']==='critical')e['push'](i);else g['push'](i);}return{'critical':e,'warnings':g};}async function verifyCollectedGuardBindings(a,b){const c=[],d=[];if(a['length']===0x0)return{'critical':c,'warnings':d};const h=new Set(),i=a['filter'](m=>{const n=m['ref']['toLowerCase']()+'|'+m['host']+'|'+(m['facts']?.['source_node']??'')+'|'+(m['facts']?.['declared_permission_indexes']??[])['join'](',');if(h['has'](n))return![];return h['add'](n),!![];});let j;try{j=await batchQueryObjectsByRef([...new Set(i['map'](m=>m['ref']))],b,!![]);}catch(m){return d['push']('pre_publish:\x20guard-binding\x20semantics\x20check\x20skipped\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+(m instanceof Error?m['message']:String(m))+');\x20run\x20analyze_guard_semantics\x20on\x20every\x20bound\x20')+'guard\x20BEFORE\x20the\x20binding\x20goes\x20live\x20(guards\x20are\x20immutable\x20after\x20create)'),{'critical':c,'warnings':d};}const l=new Map();for(const [n,o]of j){const p=o;if(p?.['type']!=='Guard')continue;l['set'](n['toLowerCase'](),p);for(const q of[p['query_name'],p['object']]){if(typeof q==='string'&&q!=='')l['set'](q['toLowerCase'](),p);}}for(const r of i){const s=l['get'](r['ref']['toLowerCase']());if(!s)continue;const t=s?.['data']??s,u=Array['isArray'](t['table'])?t['table']:[],v={...r['facts']};r['host']==='machine_forward'&&(v['declared_slots']=callerIndependentSlots(u),v['pinned_node_names']=parseGuardNodeGates(t['root'],u,{'equalityOnly':!![]}));const w=typeof s['object']==='string'?s['object']:r['ref'],x=verifyGuardBinding({'host':r['host'],'root':t['root'],'facts':v,'guard_ref':w}),y=t['rely']??t['relies'];r['host']!=='guard_relied'&&Array['isArray'](y)&&y['length']>0x0&&x['push'](...auditGuardRelies({'from_host':'','to_host':r['host'],'child_count':y['length']}));for(const z of x){const A='guard\x20'+(z['guard']??w);z['level']==='critical'?c['push']('pre_publish:\x20guard\x20binding\x20on\x20'+r['host']+'\x20('+A+')\x20—\x20['+z['code']+']\x20'+z['detail']):d['push']('pre_publish:\x20guard-binding\x20'+z['level']['toUpperCase']()+'\x20on\x20'+r['host']+'\x20('+A+')\x20—\x20['+z['code']+']\x20'+z['detail']);}{const B=lintGuardSemanticWalk(r['host'],w,t['root'],u);c['push'](...B['critical']),d['push'](...B['warnings']);}}return{'critical':c,'warnings':d};}export async function lintGuardBindingSemantics(a,b,d,g){const h=[],i=[],j=collectGuardBindingRefs(a,b);let k=typeof a['machine']==='string'?a['machine']['trim']():'';k===''&&b==='machine'&&typeof a['object']==='string'&&(k=a['object']['trim']());if(k!=='')try{const m=await fetchMachineNodes(k,d,!![]),o=new Set();for(const q of m){for(const r of q['pairs']){for(const s of r['forwards']){if(typeof s['guard']==='string'&&s['guard']['trim']()!==''){const t=s['guard']['toLowerCase']()+'|'+r['prev_node']+'|'+(s['permissionIndex']??'');if(o['has'](t))continue;o['add'](t),j['push']({'ref':s['guard'],'host':'machine_forward','facts':{'source_node':r['prev_node'],...s['permissionIndex']!=null?{'declared_permission_indexes':[s['permissionIndex']]}:{}}});}}}}}catch(u){i['push']('pre_publish:\x20guard-binding\x20check\x20ran\x20WITHOUT\x20the\x20machine\x20forwards\x20(machine\x20fetch\x20failed:\x20'+((u instanceof Error?u['message']:String(u))+')\x20—\x20forward-guard\x20host\x20semantics\x20were\x20not\x20')+'audited\x20here;\x20run\x20analyze_guard_semantics\x20on\x20every\x20forward\x20guard\x20BEFORE\x20publish');}if(g)for(const v of j){v['host']==='machine_forward'&&(v['facts']={...v['facts'],...g['permission_indexes']!==undefined?{'host_permission_indexes':g['permission_indexes']}:{},...g['entity_count']!==undefined?{'host_permission_entity_count':g['entity_count']}:{}});}const l=await verifyCollectedGuardBindings(j,d);return{'critical':[...h,...l['critical']],'warnings':[...i,...l['warnings']]};}async function lintServiceEscrowExitCoverage(b,c,d,h,i=![]){const j=[],k=[],l=new Map();let m=0x0;for(const w of c){if(w===null||w===undefined)continue;const x=Array['isArray'](w)?w:Array['isArray'](w['allocators'])?w['allocators']:[];for(const y of x){m++;const z=y?.['guard'];if(typeof z==='string'&&z['trim']()!=='')l['set'](z['toLowerCase'](),z);}}const n=c['some'](A=>A!==null&&A!==undefined);if(h){let A,B;try{const C=await batchQueryObjectsByIds([h],d,!![]);A=(C??[])['find'](D=>D?.['type']==='Service');}catch(D){B=D;}if(!A&&!b){const E='pre_publish:\x20(R-ESCROW-LEAF)\x20escrow-exit\x20gate\x20could\x20not\x20resolve\x20service\x20\x22'+h+'\x22\x20'+('('+(B instanceof Error?B['message']:String(B))+')\x20—\x20terminal\x20coverage\x20UNVERIFIABLE.\x20')+(i?'Strict\x20audit\x20report:\x20the\x20outage\x20proves\x20nothing\x20about\x20chain\x20state\x20—\x20reported\x20for\x20YOUR\x20decision;\x20'+'the\x20formal\x20publish\x20carries\x20this\x20as\x20a\x20warning.\x20To\x20pass\x20the\x20audit,\x20retry\x20when\x20the\x20network\x20is\x20stable;\x20'+'publishing\x20unverified\x20risks\x20stranding\x20escrow\x20at\x20an\x20unrailed\x20terminal\x20(R-ESCROW-LEAF)':'Publishing\x20WITHOUT\x20terminal-coverage\x20verification\x20risks\x20stranding\x20escrow\x20at\x20an\x20unrailed\x20'+'terminal\x20(R-ESCROW-LEAF).\x20Re-run\x20the\x20SAME\x20publish\x20with\x20env\x20dry_run:true\x20for\x20the\x20strict\x20'+'pre-publish\x20audit\x20(an\x20outage\x20blocks\x20there),\x20or\x20retry\x20when\x20the\x20network\x20is\x20stable');return(i?j:k)['push'](E),{'critical':j,'warnings':k};}!A&&B!==undefined&&k['push']('pre_publish:\x20escrow-exit\x20gate\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+h+'\x22\x20'+('('+(B instanceof Error?B['message']:String(B))+');\x20auditing\x20THIS\x20call\x27s\x20allocator\x20payload\x20only'));if(A){const F=A['data']??A;if(!b&&typeof F['machine']==='string'&&F['machine']['trim']()!=='')b=F['machine'];const G=F['order_allocators'],H=Array['isArray'](G)?G:Array['isArray'](G?.['allocators'])?G['allocators']:[];for(const I of H){const J=I?.['guard'];typeof J==='string'&&J['trim']()!==''&&!l['has'](J['toLowerCase']())&&l['set'](J['toLowerCase'](),J);}}}if(!b)return k['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':j,'warnings':k};let o=[];try{o=await fetchMachineNodes(b,d,!![]);}catch(K){return(i?j:k)['push']('pre_publish:\x20escrow-exit\x20gate\x20could\x20not\x20fetch\x20machine\x20\x22'+b+'\x22\x20nodes\x20'+('('+(K instanceof Error?K['message']:String(K))+')\x20—\x20terminal\x20coverage\x20UNVERIFIABLE.\x20')+(i?'Strict\x20audit\x20report:\x20the\x20outage\x20proves\x20nothing\x20about\x20chain\x20state\x20—\x20reported\x20for\x20YOUR\x20decision;\x20'+'the\x20formal\x20publish\x20carries\x20this\x20as\x20a\x20warning.\x20To\x20pass\x20the\x20audit,\x20retry\x20when\x20the\x20network\x20is\x20stable;\x20'+'publishing\x20unverified\x20risks\x20stranding\x20escrow\x20at\x20an\x20unrailed\x20terminal':'Re-run\x20the\x20SAME\x20publish\x20with\x20env\x20dry_run:true\x20for\x20the\x20strict\x20pre-publish\x20audit\x20'+'(an\x20outage\x20blocks\x20there);\x20publishing\x20unverified\x20risks\x20stranding\x20escrow\x20at\x20an\x20unrailed\x20terminal')),{'critical':j,'warnings':k};}if(o['length']===0x0)return k['push']('pre_publish:\x20escrow-exit\x20gate\x20skipped\x20—\x20machine\x20has\x20no\x20nodes\x20to\x20cover'),{'critical':j,'warnings':k};const p=computeTerminalReachability(o);k['push'](...zombieConvergenceFindings(o)['map'](L=>'pre_publish:\x20'+L));if(p['terminals']['length']===0x0)return{'critical':j,'warnings':k};if(l['size']===0x0)return n?j['push']('pre_publish:\x20(R-ESCROW-LEAF)\x20machine\x20terminal\x20node(s)\x20'+p['terminals']['map'](L=>'\x22'+L+'\x22')['join'](',\x20')+'\x20have\x20NO\x20allocator\x20rail\x20—\x20'+(m===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)'):k['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('+p['terminals']['map'](L=>'\x22'+L+'\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':j,'warnings':k};let r;try{r=await batchQueryObjectsByRef([...l['values']()],d,!![]);}catch(L){return k['push']('pre_publish:\x20escrow-exit\x20coverage\x20UNVERIFIED\x20—\x20could\x20not\x20query\x20allocator\x20guards\x20'+('('+(L instanceof Error?L['message']:String(L))+');\x20run\x20guard\x20lint\x20manually\x20BEFORE\x20publish\x20')+'(terminal(s)\x20in\x20question:\x20'+p['terminals']['join'](',\x20')+')'),{'critical':j,'warnings':k};}const s=new Set(),t=new Set();for(const M of r['values']()){const N=M;if(N?.['type']!=='Guard')continue;collectGuardNodeGates(N,s);const O=N['data']??N;for(const P of findRegistryDeadLegs(O?.['root']))t['add'](P);}t['size']>0x0&&j['push']('pre_publish:\x20PG-DRIVER-01\x20—\x20allocator\x20rail\x20guard\x20leg\x20query(es)\x20'+[...t]['map'](Q=>'\x22'+Q+'\x22')['join'](',\x20')+'\x20are\x20NOT\x20in\x20'+'the\x20chain\x20query\x20registry\x20(their\x20namespace\x20is\x20known;\x20the\x20full\x20query\x20is\x20not)\x20—\x20these\x20legs\x20can\x20never\x20evaluate,\x20so\x20the\x20rail\x20'+'each\x20one\x20gates\x20is\x20structurally\x20dead:\x20under\x20AND\x20the\x20rail\x20rejects\x20forever\x20(its\x20terminal\x20strands\x20escrow),\x20negated\x20it\x20always\x20'+'releases.\x20Rebuild\x20the\x20rail\x20guard\x20with\x20registered\x20queries\x20BEFORE\x20publish\x20(order_allocators\x20immutable,\x20IMMUT-002;\x20gf32\x20F-30\x20class)');const u=p['terminals']['filter'](Q=>!s['has'](Q));u['length']>0x0&&j['push']('pre_publish:\x20(R-ESCROW-LEAF)\x20terminal\x20node(s)\x20'+u['map'](Q=>'\x22'+Q+'\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');const v=[];for(const [Q,R]of r){const S=R;if(S?.['type']!=='Guard')continue;const T=S['data']??S,U=Array['isArray'](T['table'])?T['table']:[],V=railNodePins(T['root'],U);v['push']({'ref':Q,'root':T['root'],'table':U,'pos':V['pos'],'neg':V['neg']});}for(const W of verifyRailExitSatisfiability({'rails':v,'terminals':p['terminals']})){j['push']('pre_publish:\x20SV-RAILEXIT-01\x20—\x20['+W['code']+']\x20'+W['detail']);}return{'critical':j,'warnings':k};}function collectGuardNodeGates(a,b){const c=a['data']??a;for(const d of parseGuardNodeGates(c?.['root'],c?.['table']))b['add'](d);}function creationPlanAcksVotingSurface(a){const b=a['creation_plan'],c=b?.['plan']?.['steps']??b?.['steps'];if(!Array['isArray'](c))return![];return c['some'](d=>d!=null&&typeof d==='object'&&d['op']==='configure'&&d['method']==='voting_guard');}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 E=await batchQueryObjectsByIds([z],c,!![]);k=[...k??[],...E??[]];}catch(F){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20Permission\x20\x22'+z+'\x22\x20could\x20not\x20be\x20queried\x20'+('('+(F instanceof Error?F['message']:String(F))+')\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'](G=>A['has'](G));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 G=l(z),H=G?.['data']??G,I=typeof H?.['entity_count']==='number'?H['entity_count']:undefined;f['push'](...opsReadyFindings([w],{'entity_count':I}));}const C=arbitrationVotingLockDetail(y['voting_guard']);C!==null&&d['push']('pre_publish:\x20R-ARB-VOTE-LOCK\x20—\x20arbitration\x20\x22'+w+'\x22:\x20'+C);const D=(Array['isArray'](y['voting_guard'])?y['voting_guard']:[])['map'](J=>typeof J==='string'?J:J?.['guard'])['filter'](J=>typeof J==='string'&&J['length']>0x0);if(D['length']>0x0){const J=D['filter'](K=>!l(K));if(J['length']>0x0)try{const K=await batchQueryObjectsByIds(J,c,!![]);k=[...k??[],...K??[]];}catch{}for(const L of D){const M=l(L);if(!M)continue;const N=M['data']??M,O=arbitrationVotingGuardNoIdentityDetail(N['root'],N['table']);if(O!==null){const P=b['arbitration_open_vote_ack']===!![]||creationPlanAcksVotingSurface(b);(P?f:d)['push']('pre_publish:\x20R-ARB-VOTE-LOCK\x20(double\x20insurance,\x20TRIAGE-261109\x20item\x20D)\x20—\x20arbitration\x20\x22'+w+'\x22\x20'+('voting_guard\x20'+L+':\x20'+O)+(P?'\x20[acked\x20voting\x20surface\x20—\x20deliberate\x20open\x20venue;\x20keep\x20the\x20disclosure\x20in\x20the\x20service\x20description]':'\x20Remedy:\x20bind\x20a\x20party/roster\x20voting\x20guard\x20(tpl_voting_guard_party_only\x20/\x20tpl_voting_guard_numeric_weight)\x20via\x20arbitration\x20voting_guard\x20op=\x27set\x27\x20and\x20re-publish;\x20or\x20pass\x20arbitration_open_vote_ack:true\x20on\x20THIS\x20publish\x20to\x20declare\x20a\x20deliberately\x20public\x20venue.\x20Note:\x20the\x20acked\x20canonical\x20shape\x20itself\x20now\x20carries\x20party-exclusion\x20legs\x20(HIS-50,\x20mainnet\x2031uLR2nh\x20—\x20the\x20disputed\x20order\x27s\x20buyer\x20can\x20no\x20longer\x20self-vote\x20their\x20own\x20case),\x20but\x20the\x20merchant\x20side\x20is\x20NOT\x20excludable\x20inside\x20any\x20guard\x20(order.service\x20is\x20an\x20object\x20address,\x20no\x20service.owner\x20query),\x20so\x20a\x20closed\x20commercial\x20venue\x20must\x20rebind\x20a\x20party/roster\x20guard\x20rather\x20than\x20ack\x20an\x20open\x20surface.'));}}}}return{'critical':d,'warnings':f};}async function runPreBuyChecks(a,b){const c=[],d=[],f=harnessDataView(b)??{},g=b?.['env']?.['network'],h=f['object'];let i;try{i=await batchQueryObjectsByIds([h],g,!![]);}catch(n){return d['push']('pre_buy:\x20allocator\x20screening\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+h+'\x22\x20'+('('+(n instanceof Error?n['message']:String(n))+');\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'](p=>p?.['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 o=((()=>{const w=[f['buy'],f['order_new']?.['buy'],f['order']?.['buy'],f['order_new']?.['order']?.['buy']];for(const x of w){if(x&&typeof x==='object'&&Array['isArray'](x['items']))return x;}return undefined;})()),p=Array['isArray'](o?.['items'])?o['items']:[],q=Array['isArray'](k['sales'])?k['sales']:[];let r=0x0,s=p['length']>0x0;const t=[];for(const w of p){const x=w,y=numericBalance(x?.['quantity']),z=q['find'](B=>B?.['name']===x?.['name']),A=numericBalance(z?.['price']);if(y===undefined||A===undefined){s=![],t['push'](typeof x?.['name']==='string'?x['name']:JSON['stringify'](x?.['name']));continue;}r+=A*y;}const u=numericBalance(l['threshold']);if(!s)d['push']('pre_buy:\x20could\x20not\x20price\x20'+t['length']+'\x20cart\x20item(s)\x20['+t['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 u!==undefined&&u>r&&c['push']('pre_buy:\x20allocator\x20threshold\x20'+u+'\x20exceeds\x20this\x20cart\x27s\x20total\x20'+r+'\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');o?.['discount']!=null&&s&&u!==undefined&&u<=r&&d['push']('pre_buy:\x20a\x20discount\x20is\x20applied\x20—\x20the\x20discounted\x20total\x20may\x20fall\x20below\x20the\x20list\x20total\x20'+r+'\x20used\x20here;\x20'+('if\x20it\x20lands\x20under\x20the\x20allocator\x20threshold\x20'+u+',\x20the\x20payment\x20step\x20aborts\x20(EINSUFFICIENT_BALANCE)'));const v=await lintAllocatorGuardSet([l],g,'pre_buy','critical');c['push'](...v['critical']),d['push'](...v['warnings']);}}const m=typeof k['machine']==='string'?k['machine']['trim']():'';if(m!=='')try{const B=await lintMachineGuardServiceConstants(m,String(j?.['object']??h),g,'pre_buy');c['push'](...B['critical']),d['push'](...B['warnings']);}catch(C){d['push']('pre_buy:\x20guard-constant\x20consistency\x20check\x20failed\x20'+('('+(C instanceof Error?C['message']:String(C))+')\x20—\x20cross-service\x20guard\x20pins\x20UNVERIFIED\x20(mtb-tn-261030\x20P0-3)'));}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};}async function resolveServicePermissionFace(a,b){const c=a['object']??{};let d=typeof c['permission']==='string'?c['permission']:'';const e=typeof a['object']==='string'?a['object']['trim']():'';if(d===''&&e!==''){const l=await batchQueryObjectsByRef([e],b,!![]),m=l['get'](e['toLowerCase']()),n=m?.['data']??m;if(typeof n?.['permission']==='string')d=n['permission'];}if(d==='')return undefined;let f=d;if(!f['startsWith']('0x')){const o=await LocalMark['Instance']()['get'](f)['catch'](()=>undefined);if(o?.['address'])f=o['address'];}if(!f['startsWith']('0x'))return undefined;const g=await query_objects({'objects':[f],'network':b}),h=g?.['objects']?.[0x0];if(!h)return undefined;const j={},k=typeof h['entity_count']==='number'?h['entity_count']:undefined;if(k!==undefined)j['entity_count']=k;try{const p=await fetchEntityPermissions(f,b);if(p){const q=new Set();for(const r of p['values']()){for(const s of r)q['add'](s);}j['permission_indexes']=[...q]['sort']((t,u)=>t-u);}}catch{}return j['entity_count']!==undefined||j['permission_indexes']!==undefined?j:undefined;}function lintForwardGuardEvidenceMarkers(a){const b=[];if(a['defs']['size']===0x0)return b;const c=[],d=e=>{let f=![];const g=h=>{if(!h||typeof h!=='object'||f)return;const i=h;if(typeof i['query']==='string'&&/repository/i['test'](i['query'])&&/(find_where|count_where)/['test'](i['query'])){f=!![];return;}if(Array['isArray'](i['nodes'])){for(const j of i['nodes'])g(j);}if(i['node']!==undefined)g(i['node']);};return g(e),f;};for(const [e,f]of a['defs']){const g=f?.['data'],h=g!==null&&typeof g==='object'?g:f;if(d(h?.['root'])){const i=a['refs']['get'](e)??e;if(!c['includes'](i))c['push'](i);}}return c['length']>0x0&&b['push']('pre_publish:\x20(F-REX7-P0-12)\x20forward\x20guard(s)\x20['+c['map'](j=>'\x22'+j+'\x22')['join'](',\x20')+']\x20gate\x20a\x20'+'machine\x20edge\x20on\x20REPOSITORY\x20EVIDENCE\x20ROWS\x20(marker-presence\x20find/count\x20legs\x20—\x20e.g.\x20a\x20\x27royalty\x27/\x27grant\x27\x20'+'certificate\x20row).\x20The\x20marker\x20write\x20side\x20has\x20NO\x20on-chain\x20validation:\x20a\x20malicious\x20or\x20mistaken\x20marker\x20'+'write\x20can\x20make\x20this\x20delivery\x20gate\x20permanently\x20FALSE\x20(rex7\x20F-REX7-P0-12)\x20—\x20with\x20a\x20write-once\x20policy\x20'+'the\x20wrong\x20row\x20is\x20uncorrectable.\x20Keep\x20marker\x20writes\x20on\x20a\x20credentialed\x20writer\x20rail\x20(policy\x20write_guard\x20'+'allowlist)\x20and\x20prefer\x20order-anchored\x20rows\x20(id_from\x20order)\x20so\x20the\x20reader\x27s\x20order\x20pin\x20decides\x20WHICH\x20'+'row\x20counts;\x20verify\x20the\x20feeding\x20policies\x20before\x20publish.'),b;}export async function runPrePublishChecks(a,b){const c=[],d=[],h=extractOperationType(a,b),i=harnessDataView(b)??{},j=b?.['env']?.['network'],l=b?.['env']?.['dry_run']===!![],m=b?.['env']?.['window_profile'];if(h==='machine'){const s=i['node'];let t=Array['isArray'](s)?s:Array['isArray'](s?.['nodes'])?s['nodes']:[];if(t['length']===0x0&&typeof i['object']==='string'){const u=i['object'];try{const v=await fetchMachineNodes(u,j,!![]);v['length']>0x0&&(t=v,d['push']('pre_publish:\x20machine\x20\x22'+u+'\x22\x20published\x20by\x20reference\x20—\x20audited\x20against\x20its\x20'+(v['length']+'\x20on-chain\x20node(s)\x20(effective-state\x20gate)')));}catch(w){c['push']('pre_publish:\x20could\x20not\x20fetch\x20on-chain\x20nodes\x20for\x20machine\x20\x22'+u+'\x22\x20'+('('+(w instanceof Error?w['message']:String(w))+')\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(t['length']>0x0){const x=i['reentry_kind'],y=x==='none'||x==='review-loop'||x==='paid-cycle'?x:undefined;x!==undefined&&y===undefined&&d['push']('pre_publish:\x20ignored\x20invalid\x20reentry_kind\x20\x22'+String(x)+'\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 z=auditMachineNodes(t,y);c['push'](...z['critical']),d['push'](...z['warnings']);const A=await fetchForwardGuardIndex(t,j);{const H=[],I=[];for(const K of A['refs']['values']()){(K['trim']()['toLowerCase']()['startsWith']('0x')?H:I)['push'](K);}const J=closureFindings({'refs':H,'softRefs':I,'resolvedLowerKeys':A['defs']['keys'](),'readError':A['error']},{'strictAudit':l});J['outage']!==undefined&&(l?c:d)['push'](J['outage']),c['push'](...J['blockers']),d['push'](...J['disclosures']);}const B=lintForwardGuardsTaskBinding(A);c['push'](...B['critical']),d['push'](...B['warnings']);const C=lintForwardReviewLocks(t,A);c['push'](...C['critical']),d['push'](...C['warnings']);const D=lintForwardArbRulingRails(t,A);c['push'](...D['critical']),d['push'](...D['warnings']);{const L=new Map();for(const [M,N]of A['defs']){const O=N['data']??N;L['set'](M,O?.['root']);}d['push'](...disputeStrandFindings(projectMachineEdges(t),L)['map'](P=>'pre_publish:\x20'+P)),d['push'](...bypassPathFindings(projectMachineEdges(t),L)['map'](P=>'pre_publish:\x20'+P));}const E=applyTestWindowProfile(lintForwardGuardsTimeProfile(A),m);c['push'](...E['critical']),d['push'](...E['warnings']);const F=lintForwardGuardServiceConstants(A,undefined,'pre_publish');c['push'](...F['critical']),d['push'](...F['warnings']),d['push'](...lintForwardGuardEvidenceMarkers(A));const G=await lintGuardBindingSemantics(i,'machine',j);c['push'](...G['critical']),d['push'](...G['warnings']);try{const P=lintMachineTaskBindingPreflight({'refs':[...A['refs']['values']()],'resolved':[...A['refs']]['flatMap'](([Q,R])=>{const S=A['defs']['get'](Q);if(S===undefined)return[];const T=S['data'],U=T!==null&&typeof T==='object'?T:S;return[{'ref':R,'table':U['table']}];}),'readError':A['error']});for(const Q of P)d['push'](formatTaskBindingAdvisory(Q));}catch{}}else typeof i['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(h==='service'){d['push']('pre_publish:\x20service\x20machine/order_allocators/arbitrations\x20become\x20immutable\x20after\x20publish\x20(IMMUT-002);\x20sales\x20remains\x20modifiable');i['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)');if(i['publish']===!![]&&i['machine']===undefined&&i['allow_machineless']!==!![]){const a2=i['object'],a3=typeof a2==='string'?a2['trim']():'';let a4=null,a5=![];if(a3!=='')try{const a6=await batchQueryObjectsByRef([a3],j,!![]);a5=!![];const a7=a6['get'](a3['toLowerCase']()),a8=a7?.['data']??a7;a7!=null&&a8!=null&&(a4=typeof a8['machine']==='string'?a8['machine']['trim']():'');}catch{}if(a4!==null)a4===''?c['push']('pre_publish:\x20publishing\x20a\x20Service\x20with\x20NO\x20bound\x20Machine\x20—\x20the\x20publish\x20would\x20succeed\x20on-chain,\x20but\x20machine\x20binding\x20is\x20then\x20PERMANENTLY\x20blocked\x20'+'(the\x20kernel\x20rejects\x20any\x20later\x20machine\x20bind\x20on\x20a\x20published\x20Service:\x20assert\x20!bPublished)\x20and\x20the\x20store\x20can\x20never\x20process\x20workflow\x20orders.\x20'+'Bind\x20the\x20machine\x20(service\x20op\x20with\x20data.machine)\x20BEFORE\x20publishing.\x20If\x20this\x20store\x20is\x20intentionally\x20machine-less,\x20re-issue\x20with\x20data.allow_machineless=true'):d['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call\x20—\x20chain\x20state\x20verified:\x20machine\x20\x22'+a4+'\x22\x20already\x20bound\x20(publish\x20keeps\x20the\x20binding)');else a5&&c['push']('pre_publish:\x20publish\x20payload\x20carries\x20NO\x20machine\x20and\x20no\x20on-chain\x20binding\x20exists\x20to\x20inherit\x20—\x20a\x20machine-less\x20publish\x20permanently\x20blocks\x20machine\x20binding\x20'+'(the\x20kernel\x20rejects\x20any\x20later\x20machine\x20bind\x20on\x20a\x20published\x20Service:\x20assert\x20!bPublished)\x20and\x20the\x20store\x20can\x20never\x20process\x20workflow\x20orders.\x20'+'Set\x20data.machine\x20(published\x20machine)\x20in\x20this\x20publish,\x20or\x20re-issue\x20with\x20data.allow_machineless=true\x20for\x20intentionally\x20machine-less\x20commerce');}const R=i['order_allocators'];if(R!=null&&(!Array['isArray'](R['allocators'])||R['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(R===undefined){const a9=i['object'],aa=typeof a9==='string'?a9['trim']():'';let ab=![];if(aa!=='')try{const ac=await batchQueryObjectsByRef([aa],j,!![]),ad=ac['get'](aa['toLowerCase']()),ae=ad?.['data']??ad;if(ad!=null&&ae!=null){ab=!![];const af=ae['order_allocators'],ag=Array['isArray'](af?.['allocators'])?af['allocators']['length']:0x0;ag===0x0?c['push']('pre_publish:\x20service\x20\x22'+aa+'\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'+ag+'\x20allocator\x20row(s)\x20already\x20configured');}}catch{}!ab&&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(i['publish']===!![])try{const ah=i,ai=ah['object'],aj=ai??{};let ak=typeof ah['machine']==='string'?ah['machine']:typeof ah['machine']?.['object']==='string'?ah['machine']['object']:typeof aj['machine']==='string'?aj['machine']:'',al=typeof aj['permission']==='string'?aj['permission']:'';const am=typeof ai==='string'?ai['trim']():'';if((!ak||!al)&&am!==''){const an=await batchQueryObjectsByRef([am],j,!![]),ao=an['get'](am['toLowerCase']()),ap=ao?.['data']??ao;if(ap!=null){if(!ak&&typeof ap['machine']==='string')ak=ap['machine'];if(!al&&typeof ap['permission']==='string')al=ap['permission'];}}if(ak!==''&&al!==''){const aq=await fetchMachineNodes(ak,j,!![]),ar=collectPermissionIndexes(aq),as=ar['requiredIndexes']['filter'](at=>at>=0x3e8);if(as['length']>0x0){let at=al;if(!at['startsWith']('0x')){const au=await LocalMark['Instance']()['get'](at)['catch'](()=>undefined);if(au?.['address'])at=au['address'];}if(at['startsWith']('0x')){const av=await query_objects({'objects':[at],'network':j}),aw=av?.['objects']?.[0x0];if(aw){const ax={'address':at,'entity_count':aw['entity_count'],'perm_remark':aw['perm_remark'],'owner':aw['owner']??aw['builder'],'admin':aw['admin']};try{ax['entityPermissions']=await fetchEntityPermissions(at,j);}catch{}const ay=checkPermissionAuthorization(as,ax);if(!ay['allAuthorized'])d['push']('pre_publish:\x20bound\x20Machine\x20\x22'+ak+'\x22\x20forwards\x20use\x20permission\x20index(es)\x20['+ay['missingIndexes']['join'](',\x20')+']\x20'+('with\x20NO\x20entity\x20grant\x20in\x20the\x20bound\x20Permission\x20\x22'+at+'\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:'+permissionGrantPayloadJson(at,ay['missingIndexes'][0x0],['<address>'])+'\x20}\x20')+'(one\x20call\x20per\x20missing\x20index;\x20the\x20op\x20lives\x20under\x20data.table,\x20entity\x20is\x20{entities:[{name_or_address}]})\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!ay['allVerified']&&d['push']('pre_publish:\x20could\x20NOT\x20verify\x20grants\x20for\x20permission\x20index(es)\x20['+as['join'](',\x20')+']\x20on\x20Permission\x20\x22'+at+'\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{}if(i['publish']===!![])try{const az=i,aA=az['object']??{};let aB=typeof az['machine']==='string'&&az['machine']['trim']()!==''?az['machine']['trim']():typeof az['machine']?.['object']==='string'?az['machine']['object']:typeof aA['machine']==='string'&&aA['machine']!==''?aA['machine']:'';const aC=typeof az['object']==='string'?az['object']['trim']():'';let aD=aC;if(aD!==''){const aE=await batchQueryObjectsByRef([aD],j,!![]),aF=aE['get'](aD['toLowerCase']()),aG=aF?.['data']??aF;if(aF?.['object'])aD=String(aF['object']);aB===''&&typeof aG?.['machine']==='string'&&(aB=aG['machine']);}if(aB!==''&&aD['startsWith']('0x')){const aH=await lintMachineGuardServiceConstants(aB,aD,j,'pre_publish');c['push'](...aH['critical']),d['push'](...aH['warnings']);}}catch(aI){d['push']('pre_publish:\x20guard-constant\x20consistency\x20check\x20failed\x20'+('('+(aI instanceof Error?aI['message']:String(aI))+')\x20—\x20cross-service\x20guard\x20pins\x20UNVERIFIED\x20(mtb-tn-261030\x20P0-3)'));}const S=i;{const aJ=typeof S['object']==='string'?S['object']['trim']():'';if(aJ!==''&&S['publish']===!![])try{const aK=await batchQueryObjectsByIds([aJ],j,!![]),aL=(aK??[])['find'](aN=>aN?.['type']==='Service'),aM=aL?.['data']??aL;if(aM?.['bPublished']===!![]){const aN=['machine','order_allocators','order_allocators_append']['filter'](aO=>S[aO]!==undefined);d['push']('pre_publish:\x20KTT2-21\x20—\x20service\x20\x22'+aJ+'\x22\x20is\x20ALREADY\x20PUBLISHED\x20on-chain.\x20'+'Re-publish\x20is\x20a\x20chain-level\x20NO-OP\x20(the\x20publish\x20routine\x20sets\x20the\x20published\x20flag\x20unconditionally)'+(aN['length']>0x0?',\x20and\x20the\x20publish-locked\x20payloads\x20in\x20THIS\x20call\x20('+aN['join'](',\x20')+')\x20will\x20abort\x20'+'E_ALREADY_PUBLISHED(6)\x20—\x20machine/order_allocators\x20bind\x20ONLY\x20before\x20first\x20publish,\x20so\x20your\x20'+'config\x20changes\x20are\x20NOT\x20applied\x20despite\x20the\x20success\x20envelope.\x20':';\x20no\x20publish-locked\x20payload\x20(machine/order_allocators)\x20rides\x20this\x20call.\x20')+'Sales\x20stay\x20re-configurable\x20post-publish;\x20for\x20machine/allocator\x20changes\x20use\x20a\x20fresh\x20service\x20'+'(clone_apply)\x20—\x20IMMUT-002:\x20the\x20publish-locked\x20faces\x20never\x20reopen.');}}catch{}}const T=numericBalance(S['compensation_fund_add']?.['balance']);if(T!==undefined&&T>0x0){const aO=S['sales'],aP=(Array['isArray'](aO?.['sales'])?aO['sales']:[])['map'](aQ=>numericBalance(aQ?.['price']?.['balance']))['filter'](aQ=>aQ!==undefined);if(aP['length']>0x0){const aQ=aP['reduce']((aS,aT)=>aS+aT,0x0),aR=aQ*0x3;if(aR>0x0){const aS=T/aR,aT='fund='+T+',\x20highest-SKU\x20single\x20order=Σ(price×1)='+aQ+'\x20(quantity\x20set\x20at\x20buy\x20time),\x20'+('award\x20cap=3×order='+aR+'\x20(MAX_INDEMNITY_MULTIPLE),\x20coverage='+aS['toFixed'](0x2));aS<0x1&&d['push']('pre_publish:\x20compensation-fund\x20coverage\x20below\x20the\x20award\x20ceiling\x20—\x20'+aT+'\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 U=S['sales']?.['sales'];if(U!==undefined){const aU=typeof S['account']==='string'&&S['account']['trim']()!==''?S['account']['trim']():undefined,aV=lintSalesWipBindings(U,aU);c['push'](...aV['critical']),d['push'](...aV['warnings']);}const V=applyTestWindowProfile(await lintAllocatorGuards(S,j,l),m);c['push'](...V['critical']),d['push'](...V['warnings']);const W=S['order_allocators']!==undefined||S['order_allocators_append']!==undefined,X=S['publish']===!![]&&typeof S['object']==='string'&&S['object']['trim']()!=='';if(W||X){const aW=S['machine'],aX=typeof aW==='string'&&aW['trim']()!=='';if(aX||X){const aY=await lintServiceEscrowExitCoverage(aX?aW:undefined,[S['order_allocators'],S['order_allocators_append']],j,X?S['object']:undefined,l);c['push'](...aY['critical']),d['push'](...aY['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 Y=await checkArbitrationNeutrality(S,j);c['push'](...Y['critical']),d['push'](...Y['warnings']);{const aZ=await lintArbVenueWhitelist(S,X,j);c['push'](...aZ['critical']),d['push'](...aZ['warnings']);}{const b0=await lintAllocatorRailPairing(S,j,X?S['object']:undefined,l);c['push'](...b0['critical']),d['push'](...b0['warnings']);}let Z;if(S['publish']===!![])try{Z=await resolveServicePermissionFace(S,j);}catch{}const a0=await lintGuardBindingSemantics(S,extractOperationType(a,b),j,Z);c['push'](...a0['critical']),d['push'](...a0['warnings']);const a1=new Set(rewardRefsOf(S)['map'](b1=>b1['toLowerCase']()));if(a1['size']===0x0&&S['publish']===!![]&&typeof S['object']==='string')try{const b1=await batchQueryObjectsByIds([S['object']],j,!![]),b2=(b1??[])[0x0],b3=b2?.['data']??b2,b4=Array['isArray'](b3?.['rewards'])?b3['rewards']:[];for(const b5 of b4){if(typeof b5==='string'&&b5['trim']()!=='')a1['add'](b5['toLowerCase']());}}catch(b6){d['push']('pre_publish:\x20reward-funding\x20gate\x20skipped\x20—\x20could\x20not\x20read\x20the\x20service\x27s\x20on-chain\x20rewards\x20'+('('+(b6 instanceof Error?b6['message']:String(b6))+');\x20verify\x20every\x20attached\x20Reward\x20pool\x20is\x20funded\x20')+'up\x20to\x20expected_orders\x20x\x20per-claim\x20amount\x20BEFORE\x20publish');}if(a1['size']>0x0)try{const b7=await batchQueryObjectsByIds([...a1['values']()],j,!![]),b8=new Map();for(const ba of b7??[]){const bb=ba;if(bb?.['type']!=='Reward')continue;for(const bc of[bb['query_name'],bb['object']]){if(typeof bc==='string'&&bc!=='')b8['set'](bc['toLowerCase'](),bb);}}const b9=new Map();for(const bd of a1){const be=b8['get'](bd);if(!be)continue;const bf=be['data']??be,bg=Array['isArray'](bf?.['guards'])?bf['guards']:[];for(const bh of bg){const bi=bh?.['guard'];typeof bi==='string'&&bi['trim']()!==''&&b9['set'](bi['toLowerCase'](),bd);}}if(b9['size']>0x0){let bj=typeof S['machine']==='string'&&S['machine']['trim']()!==''?S['machine']['trim']():'';if(bj===''&&X)try{const bm=await batchQueryObjectsByIds([S['object']],j,!![]),bn=(bm??[])['find'](bp=>bp?.['type']==='Service'),bo=bn?.['data']??bn;if(typeof bo?.['machine']==='string')bj=bo['machine']['trim']();}catch{}let bk;if(bj!=='')try{const bp=await fetchMachineNodes(bj,j,!![]),bq=(bp??[])['map'](bs=>bs?.['name'])['filter'](bs=>typeof bs==='string'),br=[];for(const bs of bp??[]){if(!bs?.['name'])continue;for(const bt of bs['pairs']??[]){typeof bt?.['prev_node']==='string'&&bt['prev_node']!==''&&br['push']({'from':bt['prev_node'],'to':bs['name']});}}bk={'names':bq,'edges':br};}catch{}let bl;try{bl=await batchQueryObjectsByRef([...new Set(b9['keys']())],j,!![]);}catch{}for(const [bu,bv]of b9){const bw=bl?.['get'](bu),bx=bw?.['data']??bw??undefined;if(!bx){d['push']('pre_publish:\x20F-MTW-12\x20reward\x20node-gate\x20check\x20skipped\x20—\x20claim\x20guard\x20\x22'+bu+'\x22\x20of\x20'+('reward\x20\x22'+bv+'\x22\x20could\x20not\x20be\x20read;\x20verify\x20manually\x20that\x20its\x20claim-allowed\x20')+'node\x20set\x20includes\x20the\x20machine\x27s\x20evidence-marker\x20node\x20(guards\x20are\x20immutable\x20after\x20create)');continue;}const by=Array['isArray'](bx['table'])?bx['table']:[],bz=parseGuardNodeGates(bx['root'],by,{'equalityOnly':!![]}),bA=typeof bw['object']==='string'?bw['object']:bu,bB=lintRewardClaimNodeGateDeadlock({'rewardKey':bv,'guardRef':bA,'claimGates':bz,'machineGraph':bk});c['push'](...bB['critical']),d['push'](...bB['warnings']);}}for(const bC of a1){const bD=b8['get'](bC);if(!bD){d['push']('pre_publish:\x20attached\x20reward\x20\x22'+bC+'\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 bE=typeof bD['object']==='string'?bD['object']:bC,bF=rewardFundingGateFinding(bD,bC,pendingPlanFundingAmount(bE));if(bF){if(bF['level']==='critical')c['push'](bF['message']);else d['push'](bF['message']);}}}catch(bG){d['push']('pre_publish:\x20reward-funding\x20gate\x20skipped\x20—\x20could\x20not\x20query\x20reward\x20objects\x20'+('('+(bG instanceof Error?bG['message']:String(bG))+');\x20verify\x20every\x20attached\x20Reward\x20pool\x20is\x20funded\x20')+'up\x20to\x20expected_orders\x20x\x20per-claim\x20amount\x20BEFORE\x20publish');}}const o=extractOperationType(a,b)==='machine'?'machine_publish':'service_publish';if(o==='service_publish')try{const bH={'getAddress':bJ=>LocalMark['Instance']()['get_address'](bJ??'',j),'put':async()=>{throw new Error('SV-ECHO-01\x20is\x20a\x20read-only\x20gate');}},bI=await echoServicePublishBindings({'data':i,'dryRun':l,'resolve':bJ=>resolveMarkNamespaced(bH,bJ),'typeOf':bJ=>objectTypeFromAddress(bJ)??null});d['push'](...bI['echo']),d['push'](...bI['warnings']),c['push'](...bI['critical']);}catch(bJ){d['push']('pre_publish:\x20SV-ECHO-01\x20binding\x20echo\x20skipped\x20—\x20'+((bJ instanceof Error?bJ['message']:String(bJ))+';\x20verify\x20name→address\x20bindings\x20manually\x20before\x20publish'));}const q=buildPublishReadinessVerdict(o,[{'gate':'pre_publish','critical':c,'warnings':d}],gatesForFace(o)['map'](bK=>bK['id']));return{'critical':c,'warnings':d,'verdict':q};}function readHarnessOverrideNote(b){if(typeof b!=='object'||b===null)return undefined;const c=b,d=c['harness_override_note'];if(typeof d!=='string')return undefined;const e=d['trim']();if(!e)return undefined;return delete c['harness_override_note'],e;}function preBuyRecoveryHint(a){const b=a['map']((d,e)=>'leg\x20'+(e+0x1)+':\x20'+d+'\x0a'+'\x20\x20appeal:\x20resolve\x20THIS\x20leg\x20only\x20(see\x20the\x20finding)\x20—\x20or,\x20after\x20verifying\x20it\x20is\x20safe\x20for\x20this\x20purchase,\x20'+('resend\x20the\x20buy\x20with\x20a\x20top-level\x20harness_override_note\x20explaining\x20why\x20leg\x20'+(e+0x1)+'\x20is\x20acceptable.'))['join']('\x0a');return'Do\x20NOT\x20retry\x20unchanged\x20against\x20the\x20current\x20service\x20state.\x20One\x20entry\x20per\x20blocking\x20finding:\x0a'+b+'\x0aConfirm\x20each\x20leg\x20against\x20the\x20service\x27s\x20effective\x20allocator\x20plan\x20(query_toolkit\x20query_type=\x27service_panorama\x27,\x20'+'field\x20order_allocators):\x20the\x20merchant\x20fixes\x20the\x20plan\x20(post-publish\x20append\x20is\x20allowed)\x20or\x20the\x20guard\x20definitions\x20'+'are\x20repaired.\x20A\x20harness_override_note\x20leaves\x20an\x20audit\x20trail\x20but\x20does\x20NOT\x20change\x20on-chain\x20state\x20—\x20a\x20failing\x20'+'payment\x20still\x20burns\x20gas.';}function buildHarnessBlockResult(a,b,c,d,e,f,g){const h=[...c['map'](j=>'CRITICAL:\x20'+j),...d['map'](j=>'WARN:\x20'+j)]['join']('\x0a'),i='Error:\x20'+b+(h?'\x0a'+h:'')+'\x0aRecovery:\x20'+f;return{'content':[{'type':'text','text':i}],'structuredContent':{'outcome':'failed','result':{'type':'error','error':b+'\x20[gate='+a+']','error_code':e,'retryable':![],'recovery_hint':f},'message':i,'recovery':recover(e,'harness:'+a),...g?{'publish_readiness':g}:{}}};}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,normalizeErrorMessage}from'../schema/call/semantic.js';import{buildClassifiedErrorResult}from'./shared.js';import{getWipVerifyRecord}from'./wip-verify-ledger.js';import{readFileSync}from'fs';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,callerIndependentSlots,declaresTaskBindingSlot}from'../knowledge/onchain-constants.js';import{classifyRecipient}from'../knowledge/recipient-constraint.js';import{recover}from'../harness/recover.js';import{stableOperationId}from'../harness/operation-id.js';import{buildPublishReadinessVerdict,summarizeVerdict}from'../knowledge/publish-readiness.js';import{gatesForFace}from'../knowledge/publish-surface-contract.js';import{staleBuildHardGate}from'./handlers/stale-build-check.js';import{dryRunGateKey,recordDryRunAudit,hasDryRunAudit,recordDryRunFailure,lastDryRunFailure,dryRunGateWaived,pendingPlanFundingAmount}from'./publish-gate-state.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,ObjectType,objectTypeFromAddress}from'@wowok/wowok';import{arbitrationVotingLockDetail,arbitrationVotingGuardNoIdentityDetail,auditMachineNodes,chainNodeRailMatrix,computeTerminalReachability,formatTaskBindingAdvisory,guardTimeProfileDetail,lintMachineTaskBindingPreflight,lintRefundReplayPublishGate,lintReviewLockedTerminals,lintTaskBindingAdvisories,railOwedTerminals,rewardRefsOf,rewardFundingGateFinding}from'../knowledge/audit-rules.js';import{lintGuard}from'../knowledge/guard-lint.js';import{walkGuardTreeSemantics}from'../knowledge/guard-semantic-walk.js';import{parseGuardNodeGates}from'../knowledge/guard-node-gates.js';import{lintRewardClaimNodeGateDeadlock}from'../knowledge/guard-node-gates.js';import{batchQueryObjectsByIds,batchQueryObjectsByRef,fetchMachineNodes}from'../graph/onchain/sdk-batch.js';import{collectPermissionIndexes,checkPermissionAuthorization,permissionGrantPayloadJson}from'../schema/utils/permission-machine-check.js';import{fetchEntityPermissions}from'../playbooks/service-build/participation-radar.js';import{railNodePins,verifyAllocatorRails}from'../knowledge/allocator-rail-verifier.js';import{projectMachineEdges,readArbRulingGuard,verifyArbitrationRulingRails}from'../knowledge/arbitration-rail-verifier.js';import{isArbRulingExecutionEdge}from'../knowledge/arb-operation-face.js';import{verifyRailExitSatisfiability}from'../knowledge/rail-exit-satisfiability.js';import{auditGuardRelies,verifyGuardBinding}from'../knowledge/guard-binding-verifier.js';import{arbZeroCaseFindings,bypassPathFindings,closureFindings,disputeStrandFindings,findRegistryDeadLegs,nettingFindings,opsReadyFindings,roleSpanFindings,zombieConvergenceFindings}from'../knowledge/publish-gate.js';import{resolveMarkNamespaced}from'./handlers/mark-namespace.js';import{echoServicePublishBindings}from'./handlers/publish-binding-echo.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=normalizeErrorMessage(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,h);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'){const u=d?.['env'];if(u?.['window_profile']==='test'&&['testnet','mainnet']['includes']((u['network']??'')['toLowerCase']())){const y=readHarnessOverrideNote(d);if(typeof y==='string'&&y!=='')g['push']('pre_publish:\x20HARNESS\x20OVERRIDE\x20—\x20env.window_profile=\x27test\x27\x20(compressed\x20time\x20windows)\x20is\x20being\x20published\x20onto\x20a\x20REAL\x20network\x20'+('('+(u['network']??'')['toLowerCase']()+')\x20under\x20an\x20explicit\x20harness_override_note:\x20\x22'+y+'\x22.\x20')+'IMMUT-001:\x20the\x20compressed\x20windows\x20are\x20now\x20FROZEN\x20into\x20immutable\x20guards\x20—\x20this\x20store\x20can\x20never\x20carry\x20real\x20business\x20windows\x20again\x20without\x20a\x20full\x20rebuild\x20(clone_apply).\x20'+'Every\x20OTHER\x20pre-publish\x20gate\x20stays\x20armed\x20for\x20this\x20call.');else return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED:\x20env.window_profile=\x27test\x27\x20(compressed\x20time\x20windows)\x20is\x20not\x20allowed\x20on\x20a\x20real\x20network.',[],[],'immutable_violation','Trial\x20runs\x20belong\x20on\x20a\x20disposable\x20local/dev\x20chain\x20(re-issue\x20with\x20env.network=\x27localnet\x27);\x20a\x20production\x20store\x20re-issues\x20WITHOUT\x20window_profile=\x27test\x27\x20so\x20business\x20windows\x20stay\x20real\x20(guards\x20freeze\x20at\x20publish\x20—\x20compressed\x20windows\x20would\x20be\x20unrepairable).\x20'+'If\x20you\x20deliberately\x20need\x20a\x20compressed-window\x20trial\x20on\x20THIS\x20real\x20network\x20(e.g.\x20a\x20mainnet\x20dry-run\x20of\x20the\x20full\x20business\x20flow),\x20re-issue\x20the\x20SAME\x20publish\x20with\x20a\x20top-level\x20harness_override_note\x20saying\x20so\x20—\x20that\x20waives\x20THIS\x20face\x20only,\x20stays\x20recorded\x20in\x20the\x20receipt,\x20and\x20keeps\x20every\x20other\x20gate\x20armed\x20(never\x20disable\x20the\x20whole\x20harness\x20for\x20one\x20rule).');}const v=d?.['env']?.['dry_run']===!![],x=dryRunGateKey(b,d);if(!v&&!hasDryRunAudit(x)&&!dryRunGateWaived(d)){const z=lastDryRunFailure(x),A=z?'\x20IMPORTANT:\x20an\x20earlier\x20dry_run:true\x20audit\x20of\x20THIS\x20EXACT\x20payload\x20already\x20FAILED\x20with\x20'+(z['criticals']['length']+'\x20CRITICAL\x20risk(s)\x20—\x20re-issuing\x20it\x20unchanged\x20will\x20fail\x20identically.\x20Fix\x20these\x20first:\x0a')+z['criticals']['map'](B=>'\x20\x20-\x20'+B)['join']('\x0a'):'';return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20dry-run-first\x20mandate\x20(ruling\x202026-11-04):\x20no\x20PASSED\x20env\x20dry_run:true\x20'+'strict\x20pre-publish\x20audit\x20found\x20for\x20THIS\x20exact\x20payload\x20in\x20this\x20session.'+A,z?.['criticals']??[],[],'state_conflict','Re-issue\x20the\x20SAME\x20publish\x20with\x20env\x20dry_run:true\x20first\x20(strict\x20audit;\x20outage\x20fails\x20closed).\x20'+'With\x200\x20CRITICAL\x20it\x20registers\x20the\x20payload\x20in\x20the\x20session\x20ledger,\x20then\x20the\x20formal\x20publish\x20'+'passes\x20the\x20mandate.\x20Documented\x20waiver:\x20process\x20env\x20WOWOK_SKIP_DRYRUN_GATE=1.');}try{const B=await runPrePublishChecks(b,d);g['push'](...B['warnings']);if(B['verdict'])g['push'](summarizeVerdict(B['verdict']));const C=staleBuildHardGate('Publish');if(C['waiver'])g['push'](C['waiver']);if(C['blocked'])return buildHarnessBlockResult('pre_publish',C['message'],B['critical'],B['warnings'],'state_conflict','Rebuild\x20(pnpm\x20build),\x20restart\x20the\x20MCP\x20process,\x20and\x20retry\x20this\x20publish\x20—\x20'+'or\x20set\x20WOWOK_ALLOW_STALE_BUILD=1\x20to\x20run\x20deliberately\x20under\x20the\x20stale\x20face.');if(B['critical']['length']>0x0){for(const D of B['critical']){const E=recordCriticalRisk(D);if(E)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+E['reason']);}if(v)recordDryRunFailure(x,B['critical']);return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20Harness\x20pre-publish\x20gate\x20(GLM5-21\x20V6):\x20'+(B['critical']['length']+'\x20CRITICAL\x20risk(s)\x20must\x20be\x20resolved\x20before\x20publish.'),B['critical'],B['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.',B['verdict']);}v&&recordDryRunAudit(x);}catch(F){g['push']('pre_publish\x20hook\x20failed:\x20'+(F instanceof Error?F['message']:String(F)));}}if(b==='onchain_operations'&&n!=='off'){const G=extractOperationType(b,d);if(!isPublishOperation(b,d)){if(isGuardBindingOperation(b,d))try{const H=G==='gen_passport'?d['guard']!==undefined?{'guard':d['guard']}:harnessDataView(d):harnessDataView(d),I=d?.['env']?.['network'],J=H?await lintGuardBindingSemantics(H,G,I):{'critical':[],'warnings':[]};g['push'](...J['warnings']);const K=buildPublishReadinessVerdict('guard_binding',[{'gate':'lintGuardBindingSemantics','critical':J['critical'],'warnings':J['warnings']}],gatesForFace('guard_binding')['map'](M=>M['id']));g['push'](summarizeVerdict(K));const L=staleBuildHardGate('Guard\x20binding');if(L['waiver'])g['push'](L['waiver']);if(L['blocked'])return buildHarnessBlockResult('guard_binding',L['message'],J['critical'],J['warnings'],'state_conflict','Rebuild\x20(pnpm\x20build),\x20restart\x20the\x20MCP\x20process,\x20and\x20retry\x20this\x20bind\x20—\x20'+'or\x20set\x20WOWOK_ALLOW_STALE_BUILD=1\x20to\x20run\x20deliberately\x20under\x20the\x20stale\x20face.');if(J['critical']['length']>0x0){for(const M of J['critical']){const N=recordCriticalRisk(M);if(N)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+N['reason']);}return buildHarnessBlockResult('guard_binding','Guard\x20binding\x20BLOCKED\x20by\x20Harness\x20guard-binding\x20gate\x20(ruling\x202026-10-31):\x20'+(J['critical']['length']+'\x20CRITICAL\x20structural\x20finding(s)\x20on\x20the\x20guard(s)\x20')+'this\x20call\x20binds\x20—\x20the\x20defect\x20goes\x20LIVE\x20the\x20moment\x20this\x20tx\x20lands.',J['critical'],J['warnings'],'immutable_violation','Fix\x20the\x20CRITICAL\x20findings\x20(per-host\x20binding\x20semantics\x20—\x20see\x20the\x20finding\x20'+'details\x20and\x20guard-host-context),\x20rebuild\x20the\x20guard\x20(guards\x20are\x20immutable:\x20'+'create\x20a\x20NEW\x20guard,\x20then\x20unbind/rebind\x20on\x20the\x20host),\x20and\x20retry\x20the\x20bind.',K);}}catch(O){g['push']('guard_binding\x20hook\x20failed:\x20'+(O instanceof Error?O['message']:String(O)));}}}if(l&&j)try{const P=harnessDataView(d),Q=P?extractAmount(P,{'excludeConfigAmounts':!![]}):null;if(Q!==null){const R=getAmountThreshold();let S=null;try{S=BigInt(Q);}catch{S=null;}if(S!==null&&S>R){const T=await skuMatchedOrderTotalExemption(P,d?.['env']?.['network']);if(T)g['push']('pre_sign:\x20order\x20total\x20'+Q+'\x20exceeds\x20the\x20full-tier\x20threshold\x20'+R['toString']()+'\x20(smallest\x20unit)\x20—\x20'+'EXEMPTED\x20(M-K11-a):\x20exact\x20catalog\x20match\x20Σ\x20price×quantity\x20against\x20the\x20Service\x27s\x20published\x20sales'+(T['coinType']?',\x20payment\x20coin\x20'+T['coinType']:'')+'.');else return buildHarnessBlockResult('pre_sign','Sign\x20BLOCKED\x20by\x20Harness\x20pre-sign\x20gate\x20(GLM5-21\x20V7):\x20amount\x20'+formatAmount(S)+'\x20WOW\x20exceeds\x20the\x20full-tier\x20threshold\x20'+formatAmount(R)+'\x20WOW.',['amount\x20'+Q+'\x20(smallest\x20unit)\x20>\x20threshold\x20'+R['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(U){g['push']('pre_sign\x20hook\x20failed:\x20'+(U instanceof Error?U['message']:String(U)));}if(m&&n!=='off')try{const V=await runPreBuyChecks(b,d);g['push'](...V['warnings']);if(V['critical']['length']>0x0){const W=readHarnessOverrideNote(d);if(W)g['push']('pre_buy\x20HARNESS\x20OVERRIDE:\x20'+V['critical']['length']+'\x20CRITICAL\x20allocator\x20risk(s)\x20suppressed\x20by\x20explicit\x20override\x20note\x20—\x20'+('findings:\x20'+V['critical']['join']('\x20|\x20')+';\x20note:\x20\x22'+W+'\x22.\x20')+'On-chain\x20state\x20is\x20UNCHANGED\x20—\x20the\x20payment\x20may\x20still\x20fail\x20or\x20lock\x20funds.');else{for(const X of V['critical']){const Y=recordCriticalRisk(X);if(Y)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Y['reason']);}return buildHarnessBlockResult('pre_buy','Purchase\x20BLOCKED\x20by\x20Harness\x20pre-buy\x20gate:\x20'+V['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.',V['critical'],V['warnings'],'state_conflict',preBuyRecoveryHint(V['critical']));}}}catch(Z){g['push']('pre_buy\x20hook\x20failed:\x20'+(Z instanceof Error?Z['message']:String(Z)));}let o;try{o=await a(d,f);}catch(a0){const a1=a0 instanceof Error?a0['message']:String(a0),a2=recordOperationFailure(b,a1);a2&&g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+a2['reason']);if(b==='onchain_operations')try{const a3=classifyError(a1,a0);if(!a3['retryable']&&a3['error_code']!=='unknown'){const a4=recordCriticalOperation(b,a3['error_code']);if(a4)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+a4['reason']);}}catch{}throw a0;}if(b==='onchain_operations')try{if(classifyOutcome(o)==='failed'){const a5=extractErrorCode(o)??'',a6=classifyError(a5);if(!a6['retryable']&&a6['error_code']!=='unknown'){const a7=recordCriticalOperation(b,a6['error_code']);if(a7)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+a7['reason']);}}}catch{}if(i&&!isOutcomeDiscriminated(o)){const a8=stableOperationId(extractIntent(b,d)??b,extractData(d));try{const a9=classifyOutcome(o);if(a9==='failed'){const aa=extractErrorCode(o)??'',ab=classifyError(aa),ac=h['recover'](ab['error_code'],a8,{'operation_type':b,'data':extractData(d),'retryable':ab['retryable']});g['push']('Harness\x20recover:\x20strategy='+ac['strategy']+('\x20(attempt\x20'+ac['current_attempt']+'/'+ac['max_attempts']+')')+(ac['should_retry']?'\x20—\x20retryable':'\x20—\x20do\x20NOT\x20retry\x20blindly')+(ac['user_prompt']?'\x20—\x20'+ac['user_prompt']:'\x20—\x20'+ac['detail']));}else a9==='success'&&h['resetRecovery'](a8);}catch(ad){g['push']('recover\x20hook\x20failed:\x20'+(ad instanceof Error?ad['message']:String(ad)));}}if(b==='goal_operation')try{const ae=d?.['action'];if(ae==='trace_substeps'){const af=extractCriticalFindingCount(o);if(af>0x0){const ag=recordSubstepFailure(String(ae)+':\x20'+af+'\x20critical\x20finding(s)');if(ag)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+ag['reason']);}}}catch{}if(isWriteClassTool(b)&&!SEMANTIC_RECORDED_TOOLS['has'](b))try{const ah=extractOperationType(b,d)??b,ai=extractIntent(b,d)??b,aj=extractData(d)??d,ak=classifyOutcome(o),al=extractErrorCode(o),am=isEnabled('experience_layer');if(am)recordOperationOutcome(ah,aj,ai,ak,al);else{const an=extractIndustry(d);an&&isEnabled('industry_evolution')&&recordIndustrySignal(an,{'type':ah},{'success':ak==='success','error_code':al});}}catch(ao){g['push']('signal\x20collection\x20failed:\x20'+(ao instanceof Error?ao['message']:String(ao)));}if(g['length']>0x0){if(o?.['structuredContent']){const ap=o['structuredContent'],aq=ap['semantic'];if(aq){const ar=Array['isArray'](aq['warnings'])?aq['warnings']:[];aq['warnings']=[...ar,...g];}else for(const as of g){console['warn']('[harness]\x20'+as);}}else for(const at of g){console['warn']('[harness]\x20'+at);}}return o;};}function isPublishOperation(a,b){if(a!=='onchain_operations')return![];const c=extractOperationType(a,b);if(c!=='service'&&c!=='machine')return![];const d=harnessDataView(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=harnessDataView(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;}function harnessDataView(a){const b=a&&typeof a==='object'?a:undefined;if(!b)return undefined;const c=extractData(a);if(c)return c;if(typeof b['data']==='string')try{const g=JSON['parse'](b['data']);if(g&&typeof g==='object'&&!Array['isArray'](g))return g;}catch{}const d=typeof b['operation_type']==='string'?b['operation_type']:undefined;if(d===undefined)return undefined;const e=new Set(['operation_type','env','submission','info','idempotency_key']);if(d==='gen_passport')e['add']('guard');if(d==='gen_proof')for(const h of['proof','server_pubkey','server_signature','proof_type','description','item_count','about_address']){e['add'](h);}const f={};for(const [i,j]of Object['entries'](b)){if(!e['has'](i))f[i]=j;}return Object['keys'](f)['length']>0x0?f:undefined;}export function isGuardBindingOperation(a,b){if(a!=='onchain_operations')return![];const c=extractOperationType(a,b);if(c==='gen_passport'){const e=b&&typeof b==='object'?b:undefined;return e?.['guard']!==undefined||extractData(b)?.['guard']!==undefined;}const d=harnessDataView(b);if(!d)return![];return d['buy_guard']!==undefined||d['order_allocators']!==undefined||d['order_allocators_append']!==undefined||d['external_deposit_guard']!==undefined||d['external_withdraw_guard']!==undefined||d['usage_guard']!==undefined||d['voting_guard']!==undefined||d['guard_add']!==undefined||d['guards']!==undefined||d['policy']!==undefined||d['guard']!==undefined||d['node']!==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;}function railRecipientKinds(b,c){const d=[];let e=![];for(const f of b){const g=f?.['allocators'];if(!Array['isArray'](g))continue;for(const h of g){const i=h?.['guard'];if(typeof i!=='string'||i['toLowerCase']()!==c['toLowerCase']())continue;const j=h?.['sharing'];if(!Array['isArray'](j))continue;for(const k of j){const l=k['amount'];if(l!==undefined){let p=![];try{p=BigInt(String(l))===0x0n;}catch{p=![];}if(p)continue;}const m=k['percentage'];if(m!==undefined&&Number(m)===0x0)continue;const n=k['who'],o=classifyRecipient(typeof n==='string'?n==='Signer'?{'Signer':!![]}:{'Entity':n}:n);e=!![],d['push'](o?.['kind']??'unknown');}}}return e?d:undefined;}async function lintAllocatorGuardSet(a,b,c,h,i=![]){const j=[],l=[],m=collectAllocatorGuards(a);if(m['size']===0x0)return{'critical':j,'warnings':l};let n;try{n=await batchQueryObjectsByRef([...m['values']()]['map'](s=>s['ref']),b,!![]);}catch(s){const t=c+':\x20PG-CLOSURE-01\x20—\x20could\x20not\x20query\x20the\x20referenced\x20guard\x20object(s)\x20'+('('+(s instanceof Error?s['message']:String(s))+')\x20—\x20allocator-rail\x20reference\x20closure\x20UNVERIFIABLE.\x20')+(i?'Strict\x20audit\x20report:\x20the\x20outage\x20PROVES\x20NOTHING\x20about\x20chain\x20state\x20—\x20reported\x20for\x20YOUR\x20decision,\x20and\x20'+'whether\x20to\x20publish\x20remains\x20yours;\x20the\x20SAME\x20finding\x20rides\x20the\x20formal\x20publish\x20as\x20a\x20warning.\x20If\x20you\x20'+'want\x20this\x20audit\x20to\x20pass,\x20retry\x20when\x20the\x20network\x20is\x20stable\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)':'Publishing\x20WITHOUT\x20verification\x20risks\x20freezing\x20a\x20dangling\x20guard\x20ref\x20into\x20the\x20immutable\x20'+'order_allocators\x20plan\x20(IMMUT-002).\x20Re-run\x20the\x20SAME\x20publish\x20with\x20env\x20dry_run:true\x20for\x20the\x20strict\x20'+'pre-publish\x20audit\x20(an\x20outage\x20blocks\x20there),\x20or\x20retry\x20when\x20the\x20network\x20is\x20stable');if(c==='pre_publish'&&i)return j['push'](t),{'critical':j,'warnings':l};return l['push'](t),{'critical':j,'warnings':l};}const o=new Map(),p=new Set(),q=new Map();for(const [u,v]of n){const w=v;if(w?.['type']!=='Guard'){w!=null&&typeof w['object']==='string'&&w['object']!==''&&(p['add'](u['toLowerCase']()),p['add'](String(w['object'])['toLowerCase']()),typeof w['type']==='string'&&w['type']!==''&&q['set'](u['toLowerCase'](),String(w['type'])));continue;}o['set'](u['toLowerCase'](),w);for(const x of[w['query_name'],w['object']]){if(typeof x==='string'&&x!=='')o['set'](x['toLowerCase'](),w);}}const r=[];for(const [y,z]of m){const A=o['get'](y)??o['get'](z['ref']['toLowerCase']());if(!A){const G=z['ref']['toLowerCase']();if(p['has'](y)||p['has'](G)){const I=q['get'](y)??q['get'](G);if(I!==undefined){const J=c+':\x20allocator\x20guard\x20\x22'+z['ref']+'\x22\x20resolves\x20to\x20a\x20'+I+'\x20object,\x20not\x20a\x20Guard\x20—\x20'+'no\x20distribution\x20run\x20can\x20pass\x20a\x20guard\x20slot\x20that\x20names\x20a\x20different\x20object\x20type';if(h==='critical')j['push'](J);else l['push'](J);}else l['push'](c+':\x20allocator\x20guard\x20\x22'+z['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 H=c+':\x20allocator\x20guard\x20\x22'+z['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')j['push'](H);else l['push'](H);continue;}const B=A['data']??A;r['push'](A);const C=Array['isArray'](B?.['table'])?B['table']:[],D=Array['isArray'](B?.['relies'])?B['relies']:[];for(const K of z['slots']){const L=C['find'](N=>Number(N?.['identifier'])===K),M=L!=null&&L['b_submission']===!![]&&String(L['value_type'])==='Address';!M&&j['push'](c+':\x20allocator\x20guard\x20\x22'+z['ref']+'\x22\x20pays\x20a\x20{GuardIdentifier:\x20'+K+'}\x20leg\x20but\x20its\x20table\x20has\x20'+(L==null?'NO\x20slot\x20'+K+'\x20row':'slot\x20'+K+'\x20as\x20a\x20STATIC\x20row\x20(b_submission:\x20'+(L['b_submission']===!![])+',\x20value_type:\x20'+String(L['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'+K+',\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 N=z['slots']['has'](0x0),O=lintTaskBindingAdvisories({'guardRef':z['ref'],'table':C,'refundReentry':N});for(const P of O)l['push'](formatTaskBindingAdvisory(P,c));}catch{}const E={'description':typeof B?.['description']==='string'?B['description']:undefined,'table':C['map'](Q=>({'identifier':Number(Q?.['identifier']??0x0),'b_submission':!!Q?.['b_submission'],'value_type':Q?.['value_type']!==undefined?String(Q['value_type']):undefined,'value':Q?.['value'],'name':Q?.['name']!==undefined?String(Q['name']):undefined,'object_type':Q?.['object_type']!==undefined?String(Q['object_type']):undefined})),'root':B?.['root'],'rely':D['length']>0x0?{'guards':D['map'](Q=>String(Q)),'logic_or':!B?.['relies_logic_and']}:undefined,'binding_hint':{'host_object':'Service','binding_field':'order_allocators','sharing_recipients':z['recipients']['size']>0x0?[...z['recipients']]:undefined}},F=guardTimeProfileDetail({'ref':z['ref'],'description':typeof B?.['description']==='string'?B['description']:undefined,'table':C,'root':B?.['root']});if(F){const Q=c+':\x20R-TIME-PROFILE\x20—\x20allocator\x20guard\x20\x22'+z['ref']+'\x22:\x20'+F['detail'];if(F['level']==='critical')j['push'](Q);else l['push'](Q);}try{const R=await lintGuard(E,{'auto_fix':![],'host_published':!![]});for(const S of R['diagnostics']){const T=c+':\x20allocator\x20guard\x20\x22'+z['ref']+'\x22\x20'+S['code']+'\x20('+S['source']+'):\x20'+S['message']+'\x20at\x20'+S['location']['path'];if(S['severity']==='error')j['push'](T);else{if(S['severity']==='warning')l['push'](T);}}}catch(U){l['push'](c+':\x20allocator\x20guard\x20\x22'+z['ref']+'\x22\x20lint\x20failed\x20'+('('+(U instanceof Error?U['message']:String(U))+')\x20—\x20non-blocking'));}}return l['push'](...nettingFindings(r)['map'](V=>c+':\x20'+V)),{'critical':j,'warnings':l};}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=declaresTaskBindingSlot(h);!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 lintForwardArbRulingRails(a,b){const c=[],d=[];if(b['error']!==undefined||b['refs']['size']===0x0)return{'critical':c,'warnings':d};const e=new Map();for(const [h,i]of b['defs']){const j=i['data']??i;e['set'](h,readArbRulingGuard(j?.['root'],Array['isArray'](j?.['table'])?j['table']:undefined));}const g=verifyArbitrationRulingRails({'edges':projectMachineEdges(a),'readings':e});for(const k of g){const l='pre_publish:\x20arbitration\x20ruling-rail\x20verification\x20—\x20['+k['code']+']\x20'+k['detail'];if(k['level']==='critical')c['push'](l);else{if(k['level']==='warning')d['push'](l);else d['push']('pre_publish:\x20arbitration\x20ruling-rail\x20DISCLOSURE\x20(not\x20a\x20violation)\x20—\x20['+k['code']+']\x20'+k['detail']);}}return{'critical':c,'warnings':d};}async function lintArbVenueWhitelist(b,c,d){const f=[],g=[],h=new Map(),i=n=>{if(typeof n==='string'&&n['trim']()!=='')h['set'](n['trim']()['toLowerCase'](),n['trim']());else{if(n!==null&&typeof n==='object'){const o=n['object']??n['address'];if(typeof o==='string'&&o['trim']()!=='')h['set'](o['trim']()['toLowerCase'](),o['trim']());}}};for(const n of Array['isArray'](b['arbitrations'])?b['arbitrations']:[])i(n);const j=c&&typeof b['object']==='string'?b['object']['trim']():'';let k=typeof b['machine']==='string'?b['machine']['trim']():'';if(j!=='')try{const o=await batchQueryObjectsByIds([j],d,!![]),p=(o??[])['find'](r=>r?.['type']==='Service'),q=p?.['data']??p;for(const r of Array['isArray'](q?.['arbitrations'])?q['arbitrations']:[])i(r);if(k===''&&typeof q?.['machine']==='string')k=q['machine']['trim']();}catch(s){g['push']('pre_publish:\x20ARB-VENUE-WHITELIST\x20gate\x20ran\x20on\x20the\x20payload\x20arbitrations\x20only\x20—\x20the\x20on-chain\x20'+('service\x20read\x20failed\x20('+(s instanceof Error?s['message']:String(s))+');\x20verify\x20every\x20machine-bound\x20')+'arb-rail\x20guard\x27s\x20arb.arbitration\x20venue\x20is\x20on\x20the\x20service\x27s\x20arbitrations\x20list\x20BEFORE\x20publish\x20'+'(ktt2\x20F-15:\x20a\x20frozen\x20venue\x20off\x20the\x20whitelist\x20makes\x20every\x20ruling\x20rail\x20undrivable)');}if(h['size']===0x0||k==='')return{'critical':f,'warnings':g};let l;try{l=await fetchMachineNodes(k,d,!![]);}catch(t){return g['push']('pre_publish:\x20ARB-VENUE-WHITELIST\x20gate\x20skipped\x20—\x20machine\x20graph\x20unreadable\x20('+((t instanceof Error?t['message']:String(t))+');\x20verify\x20each\x20arb-rail\x20guard\x27s\x20bound\x20venue\x20against\x20')+'the\x20service\x20arbitrations\x20BEFORE\x20publish\x20(ktt2\x20F-15)'),{'critical':f,'warnings':g};}const m=await fetchForwardGuardIndex(l,d);if(m['error']!==undefined)return g['push']('pre_publish:\x20ARB-VENUE-WHITELIST\x20gate\x20degraded\x20—\x20forward-guard\x20read\x20failed\x20('+(m['error']+');\x20verify\x20each\x20arb-rail\x20guard\x27s\x20bound\x20venue\x20against\x20the\x20service\x20arbitrations\x20BEFORE\x20publish\x20(ktt2\x20F-15)')),{'critical':f,'warnings':g};for(const [u,v]of m['defs']){const w=v['data']??v,x=readArbRulingGuard(w?.['root'],Array['isArray'](w?.['table'])?w['table']:undefined);if(!x['venueBound']||x['venueValues']['length']===0x0)continue;const y=m['refs']['get'](u)??u;for(const z of x['venueValues']){!h['has'](z['toLowerCase']())&&f['push']('ARB-VENUE-WHITELIST:\x20forward-bound\x20arb-rail\x20guard\x20\x22'+y+'\x22\x20statically\x20binds\x20venue\x20'+(z+'\x20via\x20its\x20arb.arbitration\x20leg,\x20but\x20this\x20service\x27s\x20arbitrations\x20whitelist\x20is\x20')+('['+[...h['values']()]['join'](',\x20')+']\x20—\x20the\x20venue\x20is\x20not\x20on\x20it.\x20A\x20case\x20filed\x20at\x20the\x20whitelisted\x20')+'venue\x20can\x20never\x20satisfy\x20this\x20guard\x20(every\x20ruling\x20rail\x20it\x20carries\x20is\x20undrivable\x20forever:\x20guards\x20'+'freeze\x20at\x20create,\x20IMMUT-001),\x20and\x20orders\x20can\x20never\x20reach\x20the\x20guard\x27s\x20venue\x20through\x20this\x20graph.\x20'+'ktt2-mn-261109\x20F-15\x20shipped\x20exactly\x20this\x20mismatch\x20and\x20paid\x20a\x20full\x20machine\x20+\x20guard\x20rebuild\x20to\x20cure\x20it.\x20'+'Fix\x20BEFORE\x20publish:\x20publish\x20the\x20service\x20with\x20arbitrations\x20=\x20the\x20venues\x20the\x20machine\x27s\x20arb-rail\x20'+'guards\x20actually\x20bind\x20(or\x20re-create\x20the\x20guards\x20bound\x20to\x20the\x20whitelisted\x20venue\x20—\x20they\x20are\x20immutable)');}}return{'critical':f,'warnings':g};}function applyTestWindowProfile(a,b){if(b!=='test')return a;const c=[],d=[...a['warnings']];for(const e of a['critical']){e['includes']('R-TIME-PROFILE')?d['push'](e['replace']('R-TIME-PROFILE','R-TIME-PROFILE\x20TEST-WINDOW\x20PROFILE\x20(env\x20window_profile=\x27test\x27:\x20compressed\x20windows\x20allowed\x20on\x20this\x20disposable\x20run;\x20a\x20real-network\x20publish\x20still\x20BLOCKS;\x20a\x20production\x20store\x20must\x20re-issue\x20with\x20real\x20windows\x20—\x20guards\x20freeze\x20at\x20publish)')):c['push'](e);}return{'critical':c,'warnings':d};}export{applyTestWindowProfile};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};}function lintForwardGuardServiceConstants(a,b,c){const d=[],e=[];if(a['error']!==undefined||a['refs']['size']===0x0)return{'critical':d,'warnings':e};const f=b?.['toLowerCase']();for(const [g,h]of a['refs']){const i=a['defs']['get'](g);if(!i)continue;const j=i['data']??i,k=Array['isArray'](j?.['table'])?j['table']:[];for(const l of k){if(l?.['b_submission']===!![])continue;if(String(l?.['value_type']??'')!=='Address')continue;const m=l?.['value'];if(typeof m!=='string'||!m['startsWith']('0x'))continue;const n=m['toLowerCase'](),o=objectTypeFromAddress(m);if(o===ObjectType['Service']&&n!==f){const p=c+':\x20forward\x20guard\x20\x22'+h+'\x22\x20pins\x20Service-typed\x20address\x20'+m+'\x20as\x20a\x20STATIC\x20constant'+(f!==undefined?'\x20while\x20the\x20machine\x20binds\x20a\x20DIFFERENT\x20service':'')+'\x20—\x20every\x20forward\x20then\x20aborts\x20(guard\x20verify\x20fail,\x20code\x207)\x20on\x20that\x20service\x20and\x20in-flight\x20orders\x20strand\x20'+'permanently:\x20guards\x20freeze\x20(IMMUT-001)\x20and\x20allocator\x20appends\x20only\x20help\x20NEW\x20orders\x20'+'(mtb-tn-261030\x20P0-3:\x205.8\x20WOW\x20stranded\x20on\x20a\x20machine\x20reused\x20across\x20store\x20versions).\x20'+(f!==undefined?'Rebuild\x20the\x20guard\x20with\x20the\x20self-reference\x20pattern\x20(compare\x20order.service\x20against\x20THIS\x20service\x20'+f+')\x20BEFORE\x20publishing':'Safe\x20ONLY\x20if\x20this\x20machine\x20will\x20ever\x20bind\x20the\x20pinned\x20service;\x20otherwise\x20rebuild\x20the\x20guard\x20BEFORE\x20binding\x20any\x20other\x20service');if(f!==undefined)d['push'](p);else e['push'](p);}else o===null&&f!==undefined&&n!==f&&e['push'](c+':\x20forward\x20guard\x20\x22'+h+'\x22\x20pins\x20untagged\x20address\x20'+m+'\x20(slot\x20#'+l?.['identifier']+')\x20as\x20a\x20STATIC\x20constant\x20—\x20'+'not\x20a\x20protocol\x20object\x20(no\x20first-byte\x20type\x20tag).\x20Wallet\x20references\x20are\x20legal,\x20but\x20a\x20stale/non-object\x20'+'address\x20freezes\x20into\x20the\x20guard\x20(IMMUT-001)\x20and\x20silently\x20fails\x20its\x20comparison\x20against\x20real\x20orders.\x20'+'Confirm\x20this\x20is\x20the\x20intended\x20account\x20BEFORE\x20publish');}}return{'critical':d,'warnings':e};}async function lintMachineGuardServiceConstants(a,b,c,d){let f;try{f=await fetchMachineNodes(a,c,!![]);}catch(h){return{'critical':[],'warnings':[d+':\x20could\x20not\x20fetch\x20machine\x20\x22'+a+'\x22\x20nodes\x20for\x20the\x20guard-constant\x20consistency\x20check\x20'+('('+(h instanceof Error?h['message']:String(h))+')\x20—\x20cross-service\x20guard\x20pins\x20UNVERIFIED.\x20Audit\x20each\x20forward\x20')+'guard\x20manually\x20before\x20trusting\x20orders\x20on\x20this\x20machine\x20(mtb-tn-261030\x20P0-3:\x20a\x20frozen\x20guard\x20pinning\x20ANOTHER\x20'+'service\x27s\x20address\x20strands\x20every\x20order)']};}if(f['length']===0x0)return{'critical':[],'warnings':[]};const g=await fetchForwardGuardIndex(f,c);if(g['error']!==undefined)return{'critical':[],'warnings':[d+':\x20guard-constant\x20consistency\x20check\x20degraded\x20('+g['error']+')\x20—\x20cross-service\x20guard\x20pins\x20UNVERIFIED\x20'+'(mtb-tn-261030\x20P0-3)']};return lintForwardGuardServiceConstants(g,b,d);}async function lintAllocatorGuards(a,b,c=![]){return lintAllocatorGuardSet([a['order_allocators'],a['order_allocators_append']],b,'pre_publish','critical',c);}async function lintAllocatorRailPairing(a,b,c,d=![]){const h=[],i=[];let j,l;if(c)try{const w=await batchQueryObjectsByIds([c],b,!![]),x=(w??[])['find'](y=>y?.['type']==='Service');j=x?.['data']??x;}catch(y){l=y;}const m=[a['order_allocators'],a['order_allocators_append']];let n=m,o=collectAllocatorGuards(m);if(o['size']===0x0&&c){if(!j){const z=l!==undefined?'could\x20not\x20be\x20queried\x20('+(l instanceof Error?l['message']:String(l))+')':'resolved\x20no\x20Service\x20object\x20on-chain',A='pre_publish:\x20allocator\x20rail\x20verification\x20—\x20service\x20\x22'+c+'\x22\x20'+z+'\x20and\x20THIS\x20call\x20binds\x20no\x20'+'allocators,\x20so\x20the\x20effective\x20rails\x20are\x20UNVERIFIABLE.\x20'+(l!==undefined?d?'Strict\x20audit\x20report:\x20the\x20outage\x20proves\x20nothing\x20about\x20chain\x20state\x20—\x20reported\x20for\x20YOUR\x20decision;\x20'+'the\x20formal\x20publish\x20carries\x20this\x20as\x20a\x20warning.\x20Retry\x20when\x20the\x20network\x20is\x20stable:\x20a\x20fund\x20rail\x20'+'carrying\x20a\x20claimed_by\x20leg,\x20or\x20with\x20no\x20viable\x20exit,\x20strands\x20a\x20claimed\x20order\x20(order_allocators\x20'+'immutable\x20after\x20publish,\x20IMMUT-002)':'Publishing\x20WITHOUT\x20rail\x20verification\x20risks\x20stranding\x20a\x20claimed\x20order\x27s\x20escrow\x20(IMMUT-002).\x20'+'Re-run\x20the\x20SAME\x20publish\x20with\x20env\x20dry_run:true\x20for\x20the\x20strict\x20pre-publish\x20audit\x20(an\x20outage\x20'+'blocks\x20there),\x20or\x20retry\x20when\x20the\x20network\x20is\x20stable':'Settle\x20the\x20ref\x20with\x20query_toolkit\x20query_type=\x27service_panorama\x27\x20and\x20re-run:\x20a\x20fund\x20rail\x20carrying\x20a\x20'+'claimed_by\x20leg,\x20or\x20with\x20no\x20viable\x20exit,\x20strands\x20a\x20claimed\x20order\x20(IMMUT-002)');if(l!==undefined&&d)h['push'](A);else i['push'](A);return{'critical':h,'warnings':i};}o=collectAllocatorGuards([j['order_allocators']]),n=[j['order_allocators']];}if(o['size']===0x0)return{'critical':h,'warnings':i};let p;try{p=await batchQueryObjectsByRef([...o['values']()]['map'](B=>B['ref']),b,!![]);}catch(B){return i['push']('pre_publish:\x20allocator\x20rail\x20verification\x20skipped\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+(B instanceof Error?B['message']:String(B))+');\x20run\x20template_scan\x20or\x20guard\x20lint\x20manually\x20')+'BEFORE\x20publish:\x20fund\x20rails\x20must\x20be\x20node-gated\x20with\x20NO\x20claimed_by\x20leg\x20(decision\x2011,\x20'+'R-FUND-RAIL-CLAIMED-BY)\x20and\x20every\x20rail\x20must\x20reach\x20a\x20viable\x20exit,\x20or\x20a\x20claimed\x20order\x20'+'strands\x20its\x20escrow\x20(order_allocators\x20immutable\x20after\x20publish,\x20IMMUT-002)'),{'critical':h,'warnings':i};}const q=new Map();for(const [C,D]of p){const E=D;if(E?.['type']!=='Guard')continue;q['set'](C['toLowerCase'](),E);for(const F of[E['query_name'],E['object']]){if(typeof F==='string'&&F!=='')q['set'](F['toLowerCase'](),E);}}const r=[],s=new Set();for(const [G,H]of o){const I=q['get'](G);if(!I)continue;const J=I?.['data']??I,K=Array['isArray'](J['table'])?J['table']:[];r['push']({'key':H['ref'],'track':H['slots']['has'](0x0)?'refund':'settlement','table':K,'root':J['root'],'recipientKinds':railRecipientKinds(n,H['ref'])});const L=J['description'];typeof L==='string'&&L['includes']('merchant-declared\x20exemption:\x20rail\x20\x27')&&s['add'](H['ref']);}if(r['length']===0x0)return i['push']('pre_publish:\x20allocator\x20rail\x20verification\x20skipped\x20—\x20no\x20referenced\x20allocator\x20guard\x20was\x20'+'resolvable\x20on-chain;\x20verify\x20the\x20rails\x20BEFORE\x20publish\x20(IMMUT-002)'),{'critical':h,'warnings':i};let t=typeof a['machine']==='string'&&a['machine']['trim']()!==''?a['machine']:undefined;!t&&typeof j?.['machine']==='string'&&j['machine']['trim']()!==''&&(t=j['machine']);let u=[];if(t&&t['trim']()!=='')try{const M=await fetchMachineNodes(t,b,!![]);u=chainNodeRailMatrix(M);}catch{i['push']('pre_publish:\x20allocator\x20rail\x20verification\x20ran\x20WITHOUT\x20the\x20machine\x20node\x20matrix\x20'+'(machine\x20fetch\x20failed)\x20—\x20award-exit\x20coverage\x20is\x20evaluated\x20on\x20the\x20payload\x20rails\x20only');}else i['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call'+(c?'\x20and\x20from\x20the\x20published\x20service\x27s\x20on-chain\x20binding':'')+'\x20—\x20allocator\x20rail\x20verification\x20evaluated\x20without\x20'+'the\x20node\x20matrix;\x20if\x20the\x20store\x20binds\x20a\x20machine\x20later,\x20re-verify\x20after\x20binding');u['length']===0x0&&(u=[{'name':'*'}]);const v=verifyAllocatorRails(r,u,{'declaredKeys':s});for(const N of v){const O='pre_publish:\x20allocator\x20rail\x20verification\x20—\x20['+N['code']+']\x20'+N['detail'];N['level']==='info'?i['push']('pre_publish:\x20allocator\x20rail\x20DISCLOSURE\x20(not\x20a\x20violation)\x20—\x20['+N['code']+']\x20'+N['detail']):h['push'](O);}return{'critical':h,'warnings':i};}export function lintPermissionSupplyDag(a,b,c){if(b!=='machine')return{'warnings':[]};const d=[],e=a['node'],g=e&&typeof e==='object'&&!('json_or_markdown_file'in e)?e['nodes']:undefined;if(!Array['isArray'](g))return{'warnings':[]};for(const r of g){const s=Array['isArray'](r?.['pairs'])?r['pairs']:[];for(const t of s){const u=Array['isArray'](t?.['forwards'])?t['forwards']:[];for(const v of u){if(v?.['guard']!==undefined&&v?.['guard']!==null&&v?.['guard']!=='')continue;const w=v?.['permissionIndex']??v?.['permission_index'];if(typeof w!=='number')continue;const x=typeof v?.['next_node']==='string'?v['next_node']:typeof t?.['prev_node']==='string'?t['prev_node']:'?';d['push']({'index':w,'edge':x});}}}const h=d['filter'](y=>y['index']>=0x3e8);if(h['length']===0x0)return{'warnings':[]};const i=c?.['permission_indexes']!==undefined||c?.['entity_count']!==undefined,j=new Set(c?.['permission_indexes']??[]),k=c?.['entity_count']===0x0,l=i?h['filter'](y=>k||!j['has'](y['index'])):h;if(l['length']===0x0)return{'warnings':[]};const m=new Set(),o=l['map'](y=>y['index'])['filter'](y=>m['has'](y)?![]:(m['add'](y),!![])),q=l['map'](y=>'\x22->'+y['edge']+'\x22(idx\x20'+y['index']+')')['join'](',\x20');return{'warnings':['pre_publish:\x20(ROLE-SUPPLY-DAG,\x20advisory)\x20unguarded\x20machine\x20edge(s)\x20'+q+'\x20declare\x20custom\x20'+'permission\x20index(es)\x20['+o['join'](',\x20')+']\x20but\x20this\x20publish\x20report\x20shows\x20NO\x20entity\x20grant\x20'+(i?'on\x20the\x20host\x20Permission\x20face':'(the\x20host\x20Permission\x20face\x20was\x20not\x20readable\x20here)')+'\x20—\x20no\x20one\x20can\x20execute\x20these\x20edges\x20until\x20a\x20permission\x20grant\x20step\x20(add\x20perm\x20by\x20index)\x20supplies\x20the\x20'+'role,\x20and\x20the\x20track\x20they\x20carry\x20stays\x20unreachable\x20(rex7\x20o9\x20precedent).\x20Add\x20the\x20grant\x20step\x20to\x20the\x20'+'build\x20plan\x20or\x20verify\x20the\x20grant\x20exists\x20on\x20chain\x20BEFORE\x20the\x20machine\x20binds\x20its\x20service.']};}function collectGuardBindingRefs(a,b){const c=[],d=(e,h,i)=>{typeof e==='string'&&e['trim']()!==''&&c['push']({'ref':e['trim'](),'host':h,'facts':i});};if(b==='service'){d(a['buy_guard'],'service_buy_guard');for(const e of collectAllocatorGuards([a['order_allocators'],a['order_allocators_append']])['values']()){c['push']({'ref':e['ref'],'host':'service_allocator_guard'});}}if(b==='treasury'){const h=a['external_deposit_guard'];if(Array['isArray'](h))for(const j of h){d(j?.['guard'],'treasury_external_deposit',{'amount_slot':typeof j?.['identifier']==='number'?j['identifier']:undefined});}const i=a['external_withdraw_guard'];if(Array['isArray'](i))for(const k of i){d(k?.['guard'],'treasury_external_withdraw',{'amount_slot':typeof k?.['identifier']==='number'?k['identifier']:undefined});}}if(b==='arbitration'){d(a['usage_guard'],'arbitration_usage');const l=a['voting_guard'];if(l&&typeof l==='object'&&Array['isArray'](l['guards'])&&l['op']!=='remove'&&l['op']!=='clear')for(const m of l['guards']){d(m?.['guard'],'arbitration_voting');}}if(b==='reward'){const o=a['guard_add'];if(Array['isArray'](o))for(const q of o){d(q?.['guard'],'reward_claim');}}if(b==='demand'){const r=a['guards'];if(Array['isArray'](r))for(const s of r){d(typeof s==='string'?s:s?.['guard'],'demand_present');}}if(b==='permission'){const t=a['policy'];if(Array['isArray'](t))for(const u of t){const v=u?.['write_guard'];if(Array['isArray'](v))for(const w of v){d(typeof w==='string'?w:w?.['guard'],'repository_write');}d(u?.['quote_guard'],'repository_quote');}}if(b==='machine'){const x=a['node'],y=x&&typeof x==='object'&&!('json_or_markdown_file'in x)?x['nodes']:undefined;if(Array['isArray'](y))for(const z of y){const A=Array['isArray'](z?.['pairs'])?z['pairs']:[];for(const B of A){const C=Array['isArray'](B?.['forwards'])?B['forwards']:[];for(const D of C){const E=D?.['guard'],F=D?.['permissionIndex']??D?.['permission_index'],G=typeof F==='number'?F:undefined;d(typeof E==='string'?E:E?.['guard'],'machine_forward',{'source_node':typeof B?.['prev_node']==='string'?B['prev_node']:undefined,...G!==undefined?{'declared_permission_indexes':[G]}:{}});}}}}if(b==='gen_passport'){const H=a['guard'];if(typeof H==='string')d(H,'gen_passport');else{if(Array['isArray'](H))for(const I of H){d(typeof I==='string'?I:I?.['guard'],'gen_passport');}}}return c;}function lintGuardSemanticWalk(a,b,c,d){const e=[],g=[];for(const h of walkGuardTreeSemantics(c,d)){const i='pre_publish:\x20guard\x20semantic\x20walk\x20on\x20'+a+'\x20(guard\x20\x22'+b+'\x22)\x20—\x20['+h['code']+']\x20'+h['detail'];if(h['level']==='critical')e['push'](i);else g['push'](i);}return{'critical':e,'warnings':g};}async function verifyCollectedGuardBindings(a,b){const c=[],d=[];if(a['length']===0x0)return{'critical':c,'warnings':d};const h=new Set(),i=a['filter'](m=>{const n=m['ref']['toLowerCase']()+'|'+m['host']+'|'+(m['facts']?.['source_node']??'')+'|'+(m['facts']?.['declared_permission_indexes']??[])['join'](',');if(h['has'](n))return![];return h['add'](n),!![];});let j;try{j=await batchQueryObjectsByRef([...new Set(i['map'](m=>m['ref']))],b,!![]);}catch(m){return d['push']('pre_publish:\x20guard-binding\x20semantics\x20check\x20skipped\x20—\x20could\x20not\x20query\x20guard\x20objects\x20'+('('+(m instanceof Error?m['message']:String(m))+');\x20run\x20analyze_guard_semantics\x20on\x20every\x20bound\x20')+'guard\x20BEFORE\x20the\x20binding\x20goes\x20live\x20(guards\x20are\x20immutable\x20after\x20create)'),{'critical':c,'warnings':d};}const l=new Map();for(const [n,o]of j){const p=o;if(p?.['type']!=='Guard')continue;l['set'](n['toLowerCase'](),p);for(const q of[p['query_name'],p['object']]){if(typeof q==='string'&&q!=='')l['set'](q['toLowerCase'](),p);}}for(const r of i){const s=l['get'](r['ref']['toLowerCase']());if(!s)continue;const t=s?.['data']??s,u=Array['isArray'](t['table'])?t['table']:[],v={...r['facts']};r['host']==='machine_forward'&&(v['declared_slots']=callerIndependentSlots(u),v['pinned_node_names']=parseGuardNodeGates(t['root'],u,{'equalityOnly':!![]}));const w=typeof s['object']==='string'?s['object']:r['ref'],x=verifyGuardBinding({'host':r['host'],'root':t['root'],'facts':v,'guard_ref':w}),y=t['rely']??t['relies'];r['host']!=='guard_relied'&&Array['isArray'](y)&&y['length']>0x0&&x['push'](...auditGuardRelies({'from_host':'','to_host':r['host'],'child_count':y['length']}));for(const z of x){const A='guard\x20'+(z['guard']??w);z['level']==='critical'?c['push']('pre_publish:\x20guard\x20binding\x20on\x20'+r['host']+'\x20('+A+')\x20—\x20['+z['code']+']\x20'+z['detail']):d['push']('pre_publish:\x20guard-binding\x20'+z['level']['toUpperCase']()+'\x20on\x20'+r['host']+'\x20('+A+')\x20—\x20['+z['code']+']\x20'+z['detail']);}{const B=lintGuardSemanticWalk(r['host'],w,t['root'],u);c['push'](...B['critical']),d['push'](...B['warnings']);}}return{'critical':c,'warnings':d};}export async function lintGuardBindingSemantics(a,b,d,g){const h=[],i=[],j=collectGuardBindingRefs(a,b);let k=typeof a['machine']==='string'?a['machine']['trim']():'';k===''&&b==='machine'&&typeof a['object']==='string'&&(k=a['object']['trim']());if(k!=='')try{const m=await fetchMachineNodes(k,d,!![]),o=new Set();for(const q of m){for(const r of q['pairs']){for(const s of r['forwards']){if(typeof s['guard']==='string'&&s['guard']['trim']()!==''){const t=s['guard']['toLowerCase']()+'|'+r['prev_node']+'|'+(s['permissionIndex']??'');if(o['has'](t))continue;o['add'](t),j['push']({'ref':s['guard'],'host':'machine_forward','facts':{'source_node':r['prev_node'],...s['permissionIndex']!=null?{'declared_permission_indexes':[s['permissionIndex']]}:{}}});}}}}}catch(u){i['push']('pre_publish:\x20guard-binding\x20check\x20ran\x20WITHOUT\x20the\x20machine\x20forwards\x20(machine\x20fetch\x20failed:\x20'+((u instanceof Error?u['message']:String(u))+')\x20—\x20forward-guard\x20host\x20semantics\x20were\x20not\x20')+'audited\x20here;\x20run\x20analyze_guard_semantics\x20on\x20every\x20forward\x20guard\x20BEFORE\x20publish');}if(g)for(const v of j){v['host']==='machine_forward'&&(v['facts']={...v['facts'],...g['permission_indexes']!==undefined?{'host_permission_indexes':g['permission_indexes']}:{},...g['entity_count']!==undefined?{'host_permission_entity_count':g['entity_count']}:{}});}const l=await verifyCollectedGuardBindings(j,d);return{'critical':[...h,...l['critical']],'warnings':[...i,...l['warnings']]};}const WIP_REVIEW_REWARD_PROMISE=/(?:\u597d\u8bc4|five[\s-]?star|5[\s-]?star|positive[\s-]?review)[^\n]{0,40}(?:\u5956|\u8fd4|reward|rebate|cashback|bounty)|(?:reward|rebate|cashback|bounty)[^\n]{0,40}(?:\u597d\u8bc4|five[\s-]?star|5[\s-]?star)/i;function guardCarriesRatingSignal(a){return a['includes']('\x22rating\x22')||a['includes']('114,97,116,105,110,103')||a['toLowerCase']()['includes']('726174696e67')||a['includes']('cmF0aW5n')||a['includes']('\x22like\x22')||a['includes']('\x22dislike\x22');}export async function lintReviewRewardFloor(a,b,c,d,f=batchQueryObjectsByIds){const h=[],i=[];if(a['length']===0x0)return{'critical':h,'warnings':i};let j=![];const k=Array['isArray'](b)?b:[];for(const o of k){const p=typeof o?.['wip']==='string'?o['wip']['trim']():'';if(p===''||/^https?:\/\//i['test'](p)||p['startsWith']('data:'))continue;try{if(WIP_REVIEW_REWARD_PROMISE['test'](readFileSync(p,'utf-8'))){j=!![];break;}}catch{}}if(!j)return{'critical':h,'warnings':i};let l;try{l=await f(a,d);}catch(q){return i['push']('pre_publish:\x20(R-REVIEW-REWARD-FLOOR)\x20the\x20WIP\x20promises\x20a\x20rating-conditioned\x20reward\x20but\x20the\x20claim\x20'+('guard\x20JSON\x20could\x20not\x20be\x20read\x20('+(q instanceof Error?q['message']:String(q))+')\x20—\x20verify\x20MANUALLY\x20that\x20')+'the\x20claim\x20guard\x20carries\x20a\x20rating\x20floor\x20leg\x20BEFORE\x20publish;\x20guards\x20freeze\x20at\x20create\x20(IMMUT-002)'),{'critical':h,'warnings':i};}const m=[];for(const r of l??[]){const s=r;if(!s||s['type']!=='Guard')continue;const t=s['data']??s,u=typeof t?.['root']==='string'?t['root']:JSON['stringify'](t?.['root']??t??'');!guardCarriesRatingSignal(u)&&m['push'](String(s['query_name']??s['object']??'?'));}if(m['length']===0x0)return{'critical':h,'warnings':i};const n='the\x20WIP\x20promises\x20a\x20rating-conditioned\x20reward\x20(praise\x20bounty)\x20but\x20claim\x20guard(s)\x20'+m['map'](v=>'\x22'+v+'\x22')['join'](',\x20')+'\x20'+'carry\x20NO\x20rating\x20leg\x20—\x20every\x20review\x20(1-star\x20included)\x20earns\x20the\x20bounty,\x20and\x20guards\x20freeze\x20at\x20create\x20so\x20the\x20gap\x20is\x20permanent\x20(IMMUT-002)';return c?i['push']('pre_publish:\x20(R-REVIEW-REWARD-FLOOR,\x20advisory\x20—\x20existing\x20store)\x20'+n+'\x20The\x20pool\x20and\x20guards\x20are\x20already\x20frozen\x20on\x20chain;\x20block\x20publish\x20would\x20strand\x20the\x20whole\x20store\x20for\x20an\x20'+'unrepairable-in-place\x20defect.\x20Options:\x20disclose\x20the\x20reward\x20as\x20unconditional\x20in\x20the\x20WIP,\x20or\x20stop\x20the\x20'+'reward\x20payouts\x20at\x20their\x20funding\x20source\x20and\x20re-issue\x20the\x20bounty\x20on\x20a\x20NEW\x20claim\x20guard.'):h['push']('pre_publish:\x20(R-REVIEW-REWARD-FLOOR)\x20NEW\x20STORE\x20—\x20'+n+'\x20Fix\x20BEFORE\x20this\x20publish:\x20add\x20a\x20rating>=floor\x20leg\x20to\x20the\x20claim\x20guard\x20(compile-track\x20claim\x20guards\x20'+'inject\x20floor\x204\x20by\x20default;\x20guard\x20template\x20tpl_progress_state_check\x20+\x20a\x20rating\x20leg),\x20or\x20rewrite\x20the\x20'+'WIP\x20to\x20promise\x20an\x20unconditional\x20review\x20reward\x20honestly.'),{'critical':h,'warnings':i};}async function lintServiceEscrowExitCoverage(b,c,d,h,i=![]){const j=[],k=[],l=new Map();let m=0x0;for(const w of c){if(w===null||w===undefined)continue;const x=Array['isArray'](w)?w:Array['isArray'](w['allocators'])?w['allocators']:[];for(const y of x){m++;const z=y?.['guard'];if(typeof z==='string'&&z['trim']()!=='')l['set'](z['toLowerCase'](),z);}}const n=c['some'](A=>A!==null&&A!==undefined);if(h){let A,B;try{const C=await batchQueryObjectsByIds([h],d,!![]);A=(C??[])['find'](D=>D?.['type']==='Service');}catch(D){B=D;}if(!A&&!b){const E='pre_publish:\x20(R-ESCROW-LEAF)\x20escrow-exit\x20gate\x20could\x20not\x20resolve\x20service\x20\x22'+h+'\x22\x20'+('('+(B instanceof Error?B['message']:String(B))+')\x20—\x20terminal\x20coverage\x20UNVERIFIABLE.\x20')+(i?'Strict\x20audit\x20report:\x20the\x20outage\x20proves\x20nothing\x20about\x20chain\x20state\x20—\x20reported\x20for\x20YOUR\x20decision;\x20'+'the\x20formal\x20publish\x20carries\x20this\x20as\x20a\x20warning.\x20To\x20pass\x20the\x20audit,\x20retry\x20when\x20the\x20network\x20is\x20stable;\x20'+'publishing\x20unverified\x20risks\x20stranding\x20escrow\x20at\x20an\x20unrailed\x20terminal\x20(R-ESCROW-LEAF)':'Publishing\x20WITHOUT\x20terminal-coverage\x20verification\x20risks\x20stranding\x20escrow\x20at\x20an\x20unrailed\x20'+'terminal\x20(R-ESCROW-LEAF).\x20Re-run\x20the\x20SAME\x20publish\x20with\x20env\x20dry_run:true\x20for\x20the\x20strict\x20'+'pre-publish\x20audit\x20(an\x20outage\x20blocks\x20there),\x20or\x20retry\x20when\x20the\x20network\x20is\x20stable');return(i?j:k)['push'](E),{'critical':j,'warnings':k};}!A&&B!==undefined&&k['push']('pre_publish:\x20escrow-exit\x20gate\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+h+'\x22\x20'+('('+(B instanceof Error?B['message']:String(B))+');\x20auditing\x20THIS\x20call\x27s\x20allocator\x20payload\x20only'));if(A){const F=A['data']??A;if(!b&&typeof F['machine']==='string'&&F['machine']['trim']()!=='')b=F['machine'];const G=F['order_allocators'],H=Array['isArray'](G)?G:Array['isArray'](G?.['allocators'])?G['allocators']:[];for(const I of H){const J=I?.['guard'];typeof J==='string'&&J['trim']()!==''&&!l['has'](J['toLowerCase']())&&l['set'](J['toLowerCase'](),J);}}}if(!b)return k['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':j,'warnings':k};let o=[];try{o=await fetchMachineNodes(b,d,!![]);}catch(K){return(i?j:k)['push']('pre_publish:\x20escrow-exit\x20gate\x20could\x20not\x20fetch\x20machine\x20\x22'+b+'\x22\x20nodes\x20'+('('+(K instanceof Error?K['message']:String(K))+')\x20—\x20terminal\x20coverage\x20UNVERIFIABLE.\x20')+(i?'Strict\x20audit\x20report:\x20the\x20outage\x20proves\x20nothing\x20about\x20chain\x20state\x20—\x20reported\x20for\x20YOUR\x20decision;\x20'+'the\x20formal\x20publish\x20carries\x20this\x20as\x20a\x20warning.\x20To\x20pass\x20the\x20audit,\x20retry\x20when\x20the\x20network\x20is\x20stable;\x20'+'publishing\x20unverified\x20risks\x20stranding\x20escrow\x20at\x20an\x20unrailed\x20terminal':'Re-run\x20the\x20SAME\x20publish\x20with\x20env\x20dry_run:true\x20for\x20the\x20strict\x20pre-publish\x20audit\x20'+'(an\x20outage\x20blocks\x20there);\x20publishing\x20unverified\x20risks\x20stranding\x20escrow\x20at\x20an\x20unrailed\x20terminal')),{'critical':j,'warnings':k};}if(o['length']===0x0)return k['push']('pre_publish:\x20escrow-exit\x20gate\x20skipped\x20—\x20machine\x20has\x20no\x20nodes\x20to\x20cover'),{'critical':j,'warnings':k};const p=computeTerminalReachability(o);k['push'](...zombieConvergenceFindings(o)['map'](L=>'pre_publish:\x20'+L)),p['terminals']=railOwedTerminals(p['terminals']);if(p['terminals']['length']===0x0)return{'critical':j,'warnings':k};if(l['size']===0x0)return n?j['push']('pre_publish:\x20(R-ESCROW-LEAF)\x20machine\x20terminal\x20node(s)\x20'+p['terminals']['map'](L=>'\x22'+L+'\x22')['join'](',\x20')+'\x20have\x20NO\x20allocator\x20rail\x20—\x20'+(m===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)'):k['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('+p['terminals']['map'](L=>'\x22'+L+'\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':j,'warnings':k};let r;try{r=await batchQueryObjectsByRef([...l['values']()],d,!![]);}catch(L){return k['push']('pre_publish:\x20escrow-exit\x20coverage\x20UNVERIFIED\x20—\x20could\x20not\x20query\x20allocator\x20guards\x20'+('('+(L instanceof Error?L['message']:String(L))+');\x20run\x20guard\x20lint\x20manually\x20BEFORE\x20publish\x20')+'(terminal(s)\x20in\x20question:\x20'+p['terminals']['join'](',\x20')+')'),{'critical':j,'warnings':k};}const s=new Set(),t=new Set();for(const M of r['values']()){const N=M;if(N?.['type']!=='Guard')continue;collectGuardNodeGates(N,s);const O=N['data']??N;for(const P of findRegistryDeadLegs(O?.['root']))t['add'](P);}t['size']>0x0&&j['push']('pre_publish:\x20PG-DRIVER-01\x20—\x20allocator\x20rail\x20guard\x20leg\x20query(es)\x20'+[...t]['map'](Q=>'\x22'+Q+'\x22')['join'](',\x20')+'\x20are\x20NOT\x20in\x20'+'the\x20chain\x20query\x20registry\x20(their\x20namespace\x20is\x20known;\x20the\x20full\x20query\x20is\x20not)\x20—\x20these\x20legs\x20can\x20never\x20evaluate,\x20so\x20the\x20rail\x20'+'each\x20one\x20gates\x20is\x20structurally\x20dead:\x20under\x20AND\x20the\x20rail\x20rejects\x20forever\x20(its\x20terminal\x20strands\x20escrow),\x20negated\x20it\x20always\x20'+'releases.\x20Rebuild\x20the\x20rail\x20guard\x20with\x20registered\x20queries\x20BEFORE\x20publish\x20(order_allocators\x20immutable,\x20IMMUT-002;\x20gf32\x20F-30\x20class)');const u=p['terminals']['filter'](Q=>!s['has'](Q));u['length']>0x0&&j['push']('pre_publish:\x20(R-ESCROW-LEAF)\x20terminal\x20node(s)\x20'+u['map'](Q=>'\x22'+Q+'\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');const v=[];for(const [Q,R]of r){const S=R;if(S?.['type']!=='Guard')continue;const T=S['data']??S,U=Array['isArray'](T['table'])?T['table']:[],V=railNodePins(T['root'],U);v['push']({'ref':Q,'root':T['root'],'table':U,'pos':V['pos'],'neg':V['neg']});}for(const W of verifyRailExitSatisfiability({'rails':v,'terminals':p['terminals']})){j['push']('pre_publish:\x20SV-RAILEXIT-01\x20—\x20['+W['code']+']\x20'+W['detail']);}return{'critical':j,'warnings':k};}function collectGuardNodeGates(a,b){const c=a['data']??a;for(const d of parseGuardNodeGates(c?.['root'],c?.['table']))b['add'](d);}function creationPlanAcksVotingSurface(a){const b=a['creation_plan'],c=b?.['plan']?.['steps']??b?.['steps'];if(!Array['isArray'](c))return![];return c['some'](d=>d!=null&&typeof d==='object'&&d['op']==='configure'&&d['method']==='voting_guard');}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 E=await batchQueryObjectsByIds([z],c,!![]);k=[...k??[],...E??[]];}catch(F){f['push']('pre_publish:\x20arbitration\x20\x22'+w+'\x22\x20Permission\x20\x22'+z+'\x22\x20could\x20not\x20be\x20queried\x20'+('('+(F instanceof Error?F['message']:String(F))+')\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'](G=>A['has'](G));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 G=l(z),H=G?.['data']??G,I=typeof H?.['entity_count']==='number'?H['entity_count']:undefined;f['push'](...opsReadyFindings([w],{'entity_count':I})),f['push'](...arbZeroCaseFindings([w]));}const C=arbitrationVotingLockDetail(y['voting_guard']);C!==null&&d['push']('pre_publish:\x20R-ARB-VOTE-LOCK\x20—\x20arbitration\x20\x22'+w+'\x22:\x20'+C);const D=(Array['isArray'](y['voting_guard'])?y['voting_guard']:[])['map'](J=>typeof J==='string'?J:J?.['guard'])['filter'](J=>typeof J==='string'&&J['length']>0x0);if(D['length']>0x0){const J=D['filter'](K=>!l(K));if(J['length']>0x0)try{const K=await batchQueryObjectsByIds(J,c,!![]);k=[...k??[],...K??[]];}catch{}for(const L of D){const M=l(L);if(!M)continue;const N=M['data']??M,O=arbitrationVotingGuardNoIdentityDetail(N['root'],N['table']);if(O!==null){const P=b['arbitration_open_vote_ack']===!![]||creationPlanAcksVotingSurface(b);(P?f:d)['push']('pre_publish:\x20R-ARB-VOTE-LOCK\x20(double\x20insurance,\x20TRIAGE-261109\x20item\x20D)\x20—\x20arbitration\x20\x22'+w+'\x22\x20'+('voting_guard\x20'+L+':\x20'+O)+(P?'\x20[acked\x20voting\x20surface\x20—\x20deliberate\x20open\x20venue;\x20keep\x20the\x20disclosure\x20in\x20the\x20service\x20description]':'\x20Remedy:\x20bind\x20a\x20party/roster\x20voting\x20guard\x20(tpl_voting_guard_party_only\x20/\x20tpl_voting_guard_numeric_weight)\x20via\x20arbitration\x20voting_guard\x20op=\x27set\x27\x20and\x20re-publish;\x20or\x20pass\x20arbitration_open_vote_ack:true\x20on\x20THIS\x20publish\x20to\x20declare\x20a\x20deliberately\x20public\x20venue.\x20Note:\x20the\x20acked\x20canonical\x20shape\x20itself\x20now\x20carries\x20party-exclusion\x20legs\x20(HIS-50,\x20mainnet\x2031uLR2nh\x20—\x20the\x20disputed\x20order\x27s\x20buyer\x20can\x20no\x20longer\x20self-vote\x20their\x20own\x20case),\x20but\x20the\x20merchant\x20side\x20is\x20NOT\x20excludable\x20inside\x20any\x20guard\x20(order.service\x20is\x20an\x20object\x20address,\x20no\x20service.owner\x20query),\x20so\x20a\x20closed\x20commercial\x20venue\x20must\x20rebind\x20a\x20party/roster\x20guard\x20rather\x20than\x20ack\x20an\x20open\x20surface.'));}}}}return{'critical':d,'warnings':f};}async function runPreBuyChecks(a,b){const c=[],d=[],f=harnessDataView(b)??{},g=b?.['env']?.['network'],h=f['object'];let i;try{i=await batchQueryObjectsByIds([h],g,!![]);}catch(n){return d['push']('pre_buy:\x20allocator\x20screening\x20DEGRADED\x20—\x20could\x20not\x20query\x20service\x20\x22'+h+'\x22\x20'+('('+(n instanceof Error?n['message']:String(n))+');\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'](p=>p?.['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 o=((()=>{const w=[f['buy'],f['order_new']?.['buy'],f['order']?.['buy'],f['order_new']?.['order']?.['buy']];for(const x of w){if(x&&typeof x==='object'&&Array['isArray'](x['items']))return x;}return undefined;})()),p=Array['isArray'](o?.['items'])?o['items']:[],q=Array['isArray'](k['sales'])?k['sales']:[];let r=0x0,s=p['length']>0x0;const t=[];for(const w of p){const x=w,y=numericBalance(x?.['quantity']),z=q['find'](B=>B?.['name']===x?.['name']),A=numericBalance(z?.['price']);if(y===undefined||A===undefined){s=![],t['push'](typeof x?.['name']==='string'?x['name']:JSON['stringify'](x?.['name']));continue;}r+=A*y;}const u=numericBalance(l['threshold']);if(!s)d['push']('pre_buy:\x20could\x20not\x20price\x20'+t['length']+'\x20cart\x20item(s)\x20['+t['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 u!==undefined&&u>r&&c['push']('pre_buy:\x20allocator\x20threshold\x20'+u+'\x20exceeds\x20this\x20cart\x27s\x20total\x20'+r+'\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');o?.['discount']!=null&&s&&u!==undefined&&u<=r&&d['push']('pre_buy:\x20a\x20discount\x20is\x20applied\x20—\x20the\x20discounted\x20total\x20may\x20fall\x20below\x20the\x20list\x20total\x20'+r+'\x20used\x20here;\x20'+('if\x20it\x20lands\x20under\x20the\x20allocator\x20threshold\x20'+u+',\x20the\x20payment\x20step\x20aborts\x20(EINSUFFICIENT_BALANCE)'));const v=applyTestWindowProfile(await lintAllocatorGuardSet([l],g,'pre_buy','critical'),b?.['env']?.['window_profile']);c['push'](...v['critical']),d['push'](...v['warnings']);}}const m=typeof k['machine']==='string'?k['machine']['trim']():'';if(m!=='')try{const B=await lintMachineGuardServiceConstants(m,String(j?.['object']??h),g,'pre_buy');c['push'](...B['critical']),d['push'](...B['warnings']);}catch(C){d['push']('pre_buy:\x20guard-constant\x20consistency\x20check\x20failed\x20'+('('+(C instanceof Error?C['message']:String(C))+')\x20—\x20cross-service\x20guard\x20pins\x20UNVERIFIED\x20(mtb-tn-261030\x20P0-3)'));}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};}async function resolveServicePermissionFace(a,b){const c=a['object']??{};let d=typeof c['permission']==='string'?c['permission']:'';const e=typeof a['object']==='string'?a['object']['trim']():'';if(d===''&&e!==''){const l=await batchQueryObjectsByRef([e],b,!![]),m=l['get'](e['toLowerCase']()),n=m?.['data']??m;if(typeof n?.['permission']==='string')d=n['permission'];}if(d==='')return undefined;let f=d;if(!f['startsWith']('0x')){const o=await LocalMark['Instance']()['get'](f)['catch'](()=>undefined);if(o?.['address'])f=o['address'];}if(!f['startsWith']('0x'))return undefined;const g=await query_objects({'objects':[f],'network':b}),h=g?.['objects']?.[0x0];if(!h)return undefined;const j={},k=typeof h['entity_count']==='number'?h['entity_count']:undefined;if(k!==undefined)j['entity_count']=k;try{const p=await fetchEntityPermissions(f,b);if(p){const q=new Set();for(const r of p['values']()){for(const s of r)q['add'](s);}j['permission_indexes']=[...q]['sort']((t,u)=>t-u);}}catch{}return j['entity_count']!==undefined||j['permission_indexes']!==undefined?j:undefined;}function lintForwardGuardEvidenceMarkers(a){const b=[];if(a['defs']['size']===0x0)return b;const c=[],d=e=>{let f=![];const g=h=>{if(!h||typeof h!=='object'||f)return;const i=h;if(typeof i['query']==='string'&&/repository/i['test'](i['query'])&&/(find_where|count_where)/['test'](i['query'])){f=!![];return;}if(Array['isArray'](i['nodes'])){for(const j of i['nodes'])g(j);}if(i['node']!==undefined)g(i['node']);};return g(e),f;};for(const [e,f]of a['defs']){const g=f?.['data'],h=g!==null&&typeof g==='object'?g:f;if(d(h?.['root'])){const i=a['refs']['get'](e)??e;if(!c['includes'](i))c['push'](i);}}return c['length']>0x0&&b['push']('pre_publish:\x20(F-REX7-P0-12)\x20forward\x20guard(s)\x20['+c['map'](j=>'\x22'+j+'\x22')['join'](',\x20')+']\x20gate\x20a\x20'+'machine\x20edge\x20on\x20REPOSITORY\x20EVIDENCE\x20ROWS\x20(marker-presence\x20find/count\x20legs\x20—\x20e.g.\x20a\x20\x27royalty\x27/\x27grant\x27\x20'+'certificate\x20row).\x20The\x20marker\x20write\x20side\x20has\x20NO\x20on-chain\x20validation:\x20a\x20malicious\x20or\x20mistaken\x20marker\x20'+'write\x20can\x20make\x20this\x20delivery\x20gate\x20permanently\x20FALSE\x20(rex7\x20F-REX7-P0-12)\x20—\x20with\x20a\x20write-once\x20policy\x20'+'the\x20wrong\x20row\x20is\x20uncorrectable.\x20Keep\x20marker\x20writes\x20on\x20a\x20credentialed\x20writer\x20rail\x20(policy\x20write_guard\x20'+'allowlist)\x20and\x20prefer\x20order-anchored\x20rows\x20(id_from\x20order)\x20so\x20the\x20reader\x27s\x20order\x20pin\x20decides\x20WHICH\x20'+'row\x20counts;\x20verify\x20the\x20feeding\x20policies\x20before\x20publish.'),b;}export async function lintArbitrationFundZero(a,b){const c=[],d=[],f=i=>Array['isArray'](i)?i['filter'](j=>j!==null&&j!==undefined&&String(typeof j==='object'?JSON['stringify'](j):j)['trim']()!==''):[],g=f(a['arbitrations']);if(a['publish']!==!![])return{'critical':c,'warnings':d};const h=numericBalance(a['compensation_fund_add']?.['balance']);if(h!==undefined&&h>0x0)return{'critical':c,'warnings':d};if(g['length']===0x0&&typeof a['object']!=='string')return{'critical':c,'warnings':d};try{const i=typeof a['object']==='string'?a['object']['trim']():'';if(i==='')return{'critical':c,'warnings':d};const j=await batchQueryObjectsByRef([i],b,!![]),k=j['get'](i['toLowerCase']()),l=k?.['data']??k??{},m=f(l['arbitrations']),n=g['length']>0x0?g:m,o=numericBalance(l['compensation_fund'])??numericBalance(l['compensation_fund']?.['balance'])??0x0;n['length']>0x0&&o===0x0&&c['push']('pre_publish:\x20O7-a\x20—\x20'+n['length']+'\x20arbitration(s)\x20mounted\x20but\x20the\x20compensation\x20fund\x20is\x200\x20'+'(payload\x20fund\x20add:\x20absent/zero;\x20on-chain\x20fund:\x200).\x20Every\x20dispute\x20award\x20claim\x20will\x20abort\x2027\x20'+'while\x20the\x20buyer\x27s\x20payment\x20fee\x20is\x20already\x20non-refundable\x20—\x20publish\x20BLOCKED.\x20'+'Top\x20up\x20with\x20onchain_operations\x20(compensation_fund_add,\x20e.g.\x20fund\x20>=\x203x\x20your\x20highest\x20SKU\x20price)\x20'+'and\x20re-publish;\x20funding\x20before\x20publish\x20is\x20always\x20possible.\x20'+'(Template\x20builds\x20are\x20auto-sized\x20at\x20compile\x20—\x20N1;\x20this\x20is\x20the\x20direct-path\x20twin.)');}catch(p){d['push']('pre_publish:\x20O7-a\x20arbitration/fund\x20consistency\x20check\x20failed\x20'+('('+(p instanceof Error?p['message']:String(p))+')\x20—\x20fund\x20presence\x20UNVERIFIED;\x20')+'a\x20zero\x20fund\x20with\x20arbitrations\x20mounted\x20strands\x20every\x20dispute\x20award\x20(abort\x2027).');}return{'critical':c,'warnings':d};}export async function runPrePublishChecks(a,b){const c=[],d=[],h=extractOperationType(a,b),i=harnessDataView(b)??{},j=b?.['env']?.['network'],l=b?.['env']?.['dry_run']===!![],m=b?.['env']?.['window_profile'];if(h==='machine'){const s=i['node'];let t=Array['isArray'](s)?s:Array['isArray'](s?.['nodes'])?s['nodes']:[];if(t['length']===0x0&&typeof i['object']==='string'){const u=i['object'];try{const w=await fetchMachineNodes(u,j,!![]);w['length']>0x0&&(t=w,d['push']('pre_publish:\x20machine\x20\x22'+u+'\x22\x20published\x20by\x20reference\x20—\x20audited\x20against\x20its\x20'+(w['length']+'\x20on-chain\x20node(s)\x20(effective-state\x20gate)')));}catch(x){c['push']('pre_publish:\x20could\x20not\x20fetch\x20on-chain\x20nodes\x20for\x20machine\x20\x22'+u+'\x22\x20'+('('+(x instanceof Error?x['message']:String(x))+')\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(t['length']>0x0){const y=i['reentry_kind'],z=y==='none'||y==='review-loop'||y==='paid-cycle'?y:undefined;y!==undefined&&z===undefined&&d['push']('pre_publish:\x20ignored\x20invalid\x20reentry_kind\x20\x22'+String(y)+'\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 A=auditMachineNodes(t,z);c['push'](...A['critical']),d['push'](...A['warnings']);const B=await fetchForwardGuardIndex(t,j);{const I=[],J=[];for(const L of B['refs']['values']()){(L['trim']()['toLowerCase']()['startsWith']('0x')?I:J)['push'](L);}const K=closureFindings({'refs':I,'softRefs':J,'resolvedLowerKeys':B['defs']['keys'](),'readError':B['error']},{'strictAudit':l});K['outage']!==undefined&&(l?c:d)['push'](K['outage']),c['push'](...K['blockers']),d['push'](...K['disclosures']);}const C=lintForwardGuardsTaskBinding(B);c['push'](...C['critical']),d['push'](...C['warnings']);const D=lintForwardReviewLocks(t,B);c['push'](...D['critical']),d['push'](...D['warnings']);const E=lintForwardArbRulingRails(t,B);c['push'](...E['critical']),d['push'](...E['warnings']);{const M=new Map();for(const [O,P]of B['defs']){const Q=P['data']??P;M['set'](O,Q?.['root']);}d['push'](...disputeStrandFindings(projectMachineEdges(t),M)['map'](R=>'pre_publish:\x20'+R)),d['push'](...bypassPathFindings(projectMachineEdges(t),M)['map'](R=>'pre_publish:\x20'+R));const N=projectMachineEdges(t)['filter'](R=>isArbRulingExecutionEdge(R['forward']));if(N['length']>0x0){const R=[...new Set(N['map'](T=>T['forward']))]['join'](',\x20'),S=[...new Set(N['map'](T=>T['permissionIndex'])['filter'](T=>T!==undefined))]['join'](',\x20');d['push']('pre_publish:\x20P0-3\x20arbitration\x20independence\x20—\x20this\x20machine\x20carries\x20'+N['length']+'\x20'+('ruling-execution\x20rail(s)\x20('+R+')'+(S===''?'':'\x20on\x20permission\x20index\x20'+S)+'.\x20')+'Their\x20executors\x20are\x20whoever\x20holds\x20that\x20index\x20on\x20the\x20host\x20Permission\x20table,\x20and\x20the\x20deploy\x20'+'signer\x20is\x20ALWAYS\x20armed\x20as\x20the\x20fallback\x20—\x20verify\x20an\x20INDEPENDENT\x20executor\x20roster\x20is\x20granted\x20'+'there\x20(compile\x20input\x20arb_executors\x20lands\x20it\x20in\x20the\x20same\x20deploy;\x20otherwise\x20re-grant\x20the\x20index\x20'+'on-chain\x20right\x20after\x20publish).\x20A\x20deployer-only\x20grant\x20means\x20the\x20merchant\x20executes\x20rulings\x20on\x20'+'its\x20own\x20venue\x20(self-dealing)\x20and,\x20if\x20the\x20arbitration\x20module\x20refuses\x20that\x20conflicted\x20executor,\x20'+'nobody\x20can\x20execute\x20the\x20ruling\x20and\x20the\x20rail\x20is\x20dead.');}}const F=applyTestWindowProfile(lintForwardGuardsTimeProfile(B),m);c['push'](...F['critical']),d['push'](...F['warnings']);const G=lintForwardGuardServiceConstants(B,undefined,'pre_publish');c['push'](...G['critical']),d['push'](...G['warnings']),d['push'](...lintForwardGuardEvidenceMarkers(B));const H=await lintGuardBindingSemantics(i,'machine',j);c['push'](...H['critical']),d['push'](...H['warnings']);try{const T=lintMachineTaskBindingPreflight({'refs':[...B['refs']['values']()],'resolved':[...B['refs']]['flatMap'](([U,V])=>{const W=B['defs']['get'](U);if(W===undefined)return[];const X=W['data'],Y=X!==null&&typeof X==='object'?X:W;return[{'ref':V,'table':Y['table']}];}),'readError':B['error']});for(const U of T)d['push'](formatTaskBindingAdvisory(U));}catch{}try{const V=lintRefundReplayPublishGate({'edges':projectMachineEdges(t)['map'](W=>({'prev':W['prev'],'next':W['next'],'guardRef':W['guardRef']})),'guards':new Map([...B['defs']]['flatMap'](([W,X])=>{const Y=X['data'],Z=Y!==null&&typeof Y==='object'?Y:X;return[[W['toLowerCase'](),{'table':Z['table']}]];}))});c['push'](...V['map'](W=>formatTaskBindingAdvisory(W,'pre_publish')));}catch{}}else typeof i['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(h==='service'){d['push']('pre_publish:\x20service\x20machine/order_allocators/arbitrations\x20become\x20immutable\x20after\x20publish\x20(IMMUT-002);\x20sales\x20remains\x20modifiable');i['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)');if(i['publish']===!![]&&i['machine']===undefined&&i['allow_machineless']!==!![]){const a7=i['object'],a8=typeof a7==='string'?a7['trim']():'';let a9=null,aa=![];if(a8!=='')try{const ab=await batchQueryObjectsByRef([a8],j,!![]);aa=!![];const ac=ab['get'](a8['toLowerCase']()),ad=ac?.['data']??ac;ac!=null&&ad!=null&&(a9=typeof ad['machine']==='string'?ad['machine']['trim']():'');}catch{}if(a9!==null)a9===''?c['push']('pre_publish:\x20publishing\x20a\x20Service\x20with\x20NO\x20bound\x20Machine\x20—\x20the\x20publish\x20would\x20succeed\x20on-chain,\x20but\x20machine\x20binding\x20is\x20then\x20PERMANENTLY\x20blocked\x20'+'(the\x20kernel\x20rejects\x20any\x20later\x20machine\x20bind\x20on\x20a\x20published\x20Service:\x20assert\x20!bPublished)\x20and\x20the\x20store\x20can\x20never\x20process\x20workflow\x20orders.\x20'+'Bind\x20the\x20machine\x20(service\x20op\x20with\x20data.machine)\x20BEFORE\x20publishing.\x20If\x20this\x20store\x20is\x20intentionally\x20machine-less,\x20re-issue\x20with\x20data.allow_machineless=true'):d['push']('pre_publish:\x20\x27machine\x27\x20absent\x20from\x20THIS\x20call\x20—\x20chain\x20state\x20verified:\x20machine\x20\x22'+a9+'\x22\x20already\x20bound\x20(publish\x20keeps\x20the\x20binding)');else aa&&c['push']('pre_publish:\x20publish\x20payload\x20carries\x20NO\x20machine\x20and\x20no\x20on-chain\x20binding\x20exists\x20to\x20inherit\x20—\x20a\x20machine-less\x20publish\x20permanently\x20blocks\x20machine\x20binding\x20'+'(the\x20kernel\x20rejects\x20any\x20later\x20machine\x20bind\x20on\x20a\x20published\x20Service:\x20assert\x20!bPublished)\x20and\x20the\x20store\x20can\x20never\x20process\x20workflow\x20orders.\x20'+'Set\x20data.machine\x20(published\x20machine)\x20in\x20this\x20publish,\x20or\x20re-issue\x20with\x20data.allow_machineless=true\x20for\x20intentionally\x20machine-less\x20commerce');}const W=i['order_allocators'];if(W!=null&&(!Array['isArray'](W['allocators'])||W['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(W===undefined){const ae=i['object'],af=typeof ae==='string'?ae['trim']():'';let ag=![];if(af!=='')try{const ah=await batchQueryObjectsByRef([af],j,!![]),ai=ah['get'](af['toLowerCase']()),aj=ai?.['data']??ai;if(ai!=null&&aj!=null){ag=!![];const ak=aj['order_allocators'],al=Array['isArray'](ak?.['allocators'])?ak['allocators']['length']:0x0;al===0x0?c['push']('pre_publish:\x20service\x20\x22'+af+'\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'+al+'\x20allocator\x20row(s)\x20already\x20configured');}}catch{}!ag&&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(i['publish']===!![])try{const am=i,an=am['object'],ao=an??{};let ap=typeof am['machine']==='string'?am['machine']:typeof am['machine']?.['object']==='string'?am['machine']['object']:typeof ao['machine']==='string'?ao['machine']:'',aq=typeof ao['permission']==='string'?ao['permission']:'';const ar=typeof an==='string'?an['trim']():'';if((!ap||!aq)&&ar!==''){const as=await batchQueryObjectsByRef([ar],j,!![]),at=as['get'](ar['toLowerCase']()),au=at?.['data']??at;if(au!=null){if(!ap&&typeof au['machine']==='string')ap=au['machine'];if(!aq&&typeof au['permission']==='string')aq=au['permission'];}}if(ap!==''&&aq!==''){const av=await fetchMachineNodes(ap,j,!![]),aw=collectPermissionIndexes(av),ax=aw['requiredIndexes']['filter'](ay=>ay>=0x3e8);if(ax['length']>0x0){let ay=aq;if(!ay['startsWith']('0x')){const az=await LocalMark['Instance']()['get'](ay)['catch'](()=>undefined);if(az?.['address'])ay=az['address'];}if(ay['startsWith']('0x')){const aA=await query_objects({'objects':[ay],'network':j}),aB=aA?.['objects']?.[0x0];if(aB){const aC={'address':ay,'entity_count':aB['entity_count'],'perm_remark':aB['perm_remark'],'owner':aB['owner']??aB['builder'],'admin':aB['admin']};try{aC['entityPermissions']=await fetchEntityPermissions(ay,j);}catch{}const aD=checkPermissionAuthorization(ax,aC);if(!aD['allAuthorized'])d['push']('pre_publish:\x20bound\x20Machine\x20\x22'+ap+'\x22\x20forwards\x20use\x20permission\x20index(es)\x20['+aD['missingIndexes']['join'](',\x20')+']\x20'+('with\x20NO\x20entity\x20grant\x20in\x20the\x20bound\x20Permission\x20\x22'+ay+'\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:'+permissionGrantPayloadJson(ay,aD['missingIndexes'][0x0],['<address>'])+'\x20}\x20')+'(one\x20call\x20per\x20missing\x20index;\x20the\x20op\x20lives\x20under\x20data.table,\x20entity\x20is\x20{entities:[{name_or_address}]})\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!aD['allVerified']&&d['push']('pre_publish:\x20could\x20NOT\x20verify\x20grants\x20for\x20permission\x20index(es)\x20['+ax['join'](',\x20')+']\x20on\x20Permission\x20\x22'+ay+'\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).');for(const aE of roleSpanFindings(aC['entityPermissions'],ax)){d['push']('pre_publish:\x20'+aE);}}}}}}catch{}if(i['publish']===!![])try{const aF=i,aG=aF['object']??{};let aH=typeof aF['machine']==='string'&&aF['machine']['trim']()!==''?aF['machine']['trim']():typeof aF['machine']?.['object']==='string'?aF['machine']['object']:typeof aG['machine']==='string'&&aG['machine']!==''?aG['machine']:'';const aI=typeof aF['object']==='string'?aF['object']['trim']():'';let aJ=aI;if(aJ!==''){const aK=await batchQueryObjectsByRef([aJ],j,!![]),aL=aK['get'](aJ['toLowerCase']()),aM=aL?.['data']??aL;if(aL?.['object'])aJ=String(aL['object']);aH===''&&typeof aM?.['machine']==='string'&&(aH=aM['machine']);}if(aH!==''&&aJ['startsWith']('0x')){const aN=await lintMachineGuardServiceConstants(aH,aJ,j,'pre_publish');c['push'](...aN['critical']),d['push'](...aN['warnings']);}}catch(aO){d['push']('pre_publish:\x20guard-constant\x20consistency\x20check\x20failed\x20'+('('+(aO instanceof Error?aO['message']:String(aO))+')\x20—\x20cross-service\x20guard\x20pins\x20UNVERIFIED\x20(mtb-tn-261030\x20P0-3)'));}const X=i;{const aP=typeof X['object']==='string'?X['object']['trim']():'';if(aP!==''&&X['publish']===!![])try{const aQ=await batchQueryObjectsByIds([aP],j,!![]),aR=(aQ??[])['find'](aT=>aT?.['type']==='Service'),aS=aR?.['data']??aR;if(aS?.['bPublished']===!![]){const aT=['machine','order_allocators','order_allocators_append']['filter'](aU=>X[aU]!==undefined);d['push']('pre_publish:\x20KTT2-21\x20—\x20service\x20\x22'+aP+'\x22\x20is\x20ALREADY\x20PUBLISHED\x20on-chain.\x20'+'Re-publish\x20is\x20a\x20chain-level\x20NO-OP\x20(the\x20publish\x20routine\x20sets\x20the\x20published\x20flag\x20unconditionally)'+(aT['length']>0x0?',\x20and\x20the\x20publish-locked\x20payloads\x20in\x20THIS\x20call\x20('+aT['join'](',\x20')+')\x20will\x20abort\x20'+'E_ALREADY_PUBLISHED(6)\x20—\x20machine/order_allocators\x20bind\x20ONLY\x20before\x20first\x20publish,\x20so\x20your\x20'+'config\x20changes\x20are\x20NOT\x20applied\x20despite\x20the\x20success\x20envelope.\x20':';\x20no\x20publish-locked\x20payload\x20(machine/order_allocators)\x20rides\x20this\x20call.\x20')+'Sales\x20stay\x20re-configurable\x20post-publish;\x20for\x20machine/allocator\x20changes\x20use\x20a\x20fresh\x20service\x20'+'(clone_apply)\x20—\x20IMMUT-002:\x20the\x20publish-locked\x20faces\x20never\x20reopen.');}}catch{}}{const aU=await lintArbitrationFundZero(X,j);c['push'](...aU['critical']),d['push'](...aU['warnings']);}const Y=numericBalance(X['compensation_fund_add']?.['balance']);if(Y!==undefined&&Y>0x0){const aV=X['sales'],aW=(Array['isArray'](aV?.['sales'])?aV['sales']:[])['map'](aX=>numericBalance(aX?.['price']?.['balance']))['filter'](aX=>aX!==undefined);if(aW['length']>0x0){const aX=aW['reduce']((aZ,b0)=>aZ+b0,0x0),aY=aX*0x3;if(aY>0x0){const aZ=Y/aY,b0='fund='+Y+',\x20highest-SKU\x20single\x20order=Σ(price×1)='+aX+'\x20(quantity\x20set\x20at\x20buy\x20time),\x20'+('award\x20cap=3×order='+aY+'\x20(MAX_INDEMNITY_MULTIPLE),\x20coverage='+aZ['toFixed'](0x2));aZ<0x1&&d['push']('pre_publish:\x20compensation-fund\x20coverage\x20below\x20the\x20award\x20ceiling\x20—\x20'+b0+'\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 Z=X['sales']?.['sales'];if(Z!==undefined){const b1=typeof X['account']==='string'&&X['account']['trim']()!==''?X['account']['trim']():undefined,b2=lintSalesWipBindings(Z,b1);c['push'](...b2['critical']),d['push'](...b2['warnings']);}const a0=applyTestWindowProfile(await lintAllocatorGuards(X,j,l),m);c['push'](...a0['critical']),d['push'](...a0['warnings']);{const b3=X['order_allocators']??X['order_allocators_append'],b4=numericBalance(b3?.['threshold']);if(b4!==undefined&&b4>0x0){const b5=[];for(const b8 of Array['isArray'](b3?.['allocators'])?b3['allocators']:[]){const b9=b8,ba=numericBalance(b9?.['fix'])??numericBalance(b9?.['sharing'])??numericBalance(b9?.['value']);if(ba!==undefined&&ba>0x2710)b5['push'](ba);}b5['length']>0x0&&b4>Math['min'](...b5)&&c['push']('pre_publish:\x20R-THRESHOLD-FLOOR\x20—\x20allocator\x20threshold\x20'+b4+'\x20exceeds\x20the\x20smallest\x20fixed\x20Amount\x20leg\x20'+Math['min'](...b5)+'.\x20'+'The\x20kernel\x20asserts\x20balance\x20>=\x20threshold\x20on\x20EVERY\x20alloc\x20and\x20the\x20pool\x20shrinks\x20after\x20each\x20release/refund,\x20so\x20the\x20tail\x20legs\x20abort\x20(EINSUFFICIENT_BALANCE)\x20once\x20the\x20pool\x20draws\x20down.\x20'+'Rule:\x20threshold\x20<=\x20min(fixed\x20Amount\x20leg)\x20—\x20lower\x20the\x20threshold;\x20allocators\x20are\x20immutable\x20after\x20publish\x20(IMMUT-002)');const b6=Array['isArray'](Z)?Z:[],b7=b6['map'](bb=>numericBalance(bb?.['price']?.['balance']))['filter'](bb=>bb!==undefined);b7['length']>0x0&&b4>Math['min'](...b7)&&c['push']('pre_publish:\x20R-PRICE-LOCK\x20—\x20allocator\x20threshold\x20'+b4+'\x20exceeds\x20the\x20cheapest\x20single-unit\x20order\x20total\x20'+Math['min'](...b7)+'\x20'+'(min\x20sale\x20price).\x20Pool\x20creation\x20requires\x20amount\x20>=\x20threshold\x20(EINSUFFICIENT_BALANCE),\x20so\x20EVERY\x20buy\x20of\x20that\x20SKU\x20aborts:\x20the\x20store\x20publishes\x20UNBUYABLE\x20and\x20only\x20a\x20full\x20rebuild\x20cures\x20it\x20(IMMUT-002).\x20'+'Rule:\x20threshold\x20<=\x20min(sale\x20price)\x20—\x20resolve\x20the\x20allocator\x20legs\x20from\x20the\x20merchant\x27s\x20real\x20pricing\x20knobs,\x20not\x20template\x20defaults');}}const a1=X['order_allocators']!==undefined||X['order_allocators_append']!==undefined,a2=X['publish']===!![]&&typeof X['object']==='string'&&X['object']['trim']()!=='';if(a1||a2){const bb=X['machine'],bc=typeof bb==='string'&&bb['trim']()!=='';if(bc||a2){const bd=await lintServiceEscrowExitCoverage(bc?bb:undefined,[X['order_allocators'],X['order_allocators_append']],j,a2?X['object']:undefined,l);c['push'](...bd['critical']),d['push'](...bd['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 a3=await checkArbitrationNeutrality(X,j);c['push'](...a3['critical']),d['push'](...a3['warnings']);{const be=await lintArbVenueWhitelist(X,a2,j);c['push'](...be['critical']),d['push'](...be['warnings']);}{const bf=await lintAllocatorRailPairing(X,j,a2?X['object']:undefined,l);c['push'](...bf['critical']),d['push'](...bf['warnings']);}let a4;if(X['publish']===!![])try{a4=await resolveServicePermissionFace(X,j);}catch{}const a5=await lintGuardBindingSemantics(X,extractOperationType(a,b),j,a4);c['push'](...a5['critical']),d['push'](...a5['warnings']),d['push'](...lintPermissionSupplyDag(X,extractOperationType(a,b),a4)['warnings']);const a6=new Set(rewardRefsOf(X)['map'](bg=>bg['toLowerCase']()));if(a6['size']===0x0&&X['publish']===!![]&&typeof X['object']==='string')try{const bg=await batchQueryObjectsByIds([X['object']],j,!![]),bh=(bg??[])[0x0],bi=bh?.['data']??bh,bj=Array['isArray'](bi?.['rewards'])?bi['rewards']:[];for(const bk of bj){if(typeof bk==='string'&&bk['trim']()!=='')a6['add'](bk['toLowerCase']());}}catch(bl){d['push']('pre_publish:\x20reward-funding\x20gate\x20skipped\x20—\x20could\x20not\x20read\x20the\x20service\x27s\x20on-chain\x20rewards\x20'+('('+(bl instanceof Error?bl['message']:String(bl))+');\x20verify\x20every\x20attached\x20Reward\x20pool\x20is\x20funded\x20')+'up\x20to\x20expected_orders\x20x\x20per-claim\x20amount\x20BEFORE\x20publish');}if(a6['size']>0x0)try{const bm=await batchQueryObjectsByIds([...a6['values']()],j,!![]),bn=new Map();for(const bp of bm??[]){const bq=bp;if(bq?.['type']!=='Reward')continue;for(const br of[bq['query_name'],bq['object']]){if(typeof br==='string'&&br!=='')bn['set'](br['toLowerCase'](),bq);}}const bo=new Map();for(const bs of a6){const bt=bn['get'](bs);if(!bt)continue;const bu=bt['data']??bt,bv=Array['isArray'](bu?.['guards'])?bu['guards']:[];for(const bw of bv){const bx=bw?.['guard'];typeof bx==='string'&&bx['trim']()!==''&&bo['set'](bx['toLowerCase'](),bs);}}if(bo['size']>0x0){const by=await lintReviewRewardFloor([...bo['keys']()],Z,a2,j);c['push'](...by['critical']),d['push'](...by['warnings']);let bz=typeof X['machine']==='string'&&X['machine']['trim']()!==''?X['machine']['trim']():'';if(bz===''&&a2)try{const bC=await batchQueryObjectsByIds([X['object']],j,!![]),bD=(bC??[])['find'](bF=>bF?.['type']==='Service'),bE=bD?.['data']??bD;if(typeof bE?.['machine']==='string')bz=bE['machine']['trim']();}catch{}let bA;if(bz!=='')try{const bF=await fetchMachineNodes(bz,j,!![]),bG=(bF??[])['map'](bI=>bI?.['name'])['filter'](bI=>typeof bI==='string'),bH=[];for(const bI of bF??[]){if(!bI?.['name'])continue;for(const bJ of bI['pairs']??[]){typeof bJ?.['prev_node']==='string'&&bJ['prev_node']!==''&&bH['push']({'from':bJ['prev_node'],'to':bI['name']});}}bA={'names':bG,'edges':bH};}catch{}let bB;try{bB=await batchQueryObjectsByRef([...new Set(bo['keys']())],j,!![]);}catch{}for(const [bK,bL]of bo){const bM=bB?.['get'](bK),bN=bM?.['data']??bM??undefined;if(!bN){d['push']('pre_publish:\x20F-MTW-12\x20reward\x20node-gate\x20check\x20skipped\x20—\x20claim\x20guard\x20\x22'+bK+'\x22\x20of\x20'+('reward\x20\x22'+bL+'\x22\x20could\x20not\x20be\x20read;\x20verify\x20manually\x20that\x20its\x20claim-allowed\x20')+'node\x20set\x20includes\x20the\x20machine\x27s\x20evidence-marker\x20node\x20(guards\x20are\x20immutable\x20after\x20create)');continue;}const bO=Array['isArray'](bN['table'])?bN['table']:[],bP=parseGuardNodeGates(bN['root'],bO,{'equalityOnly':!![]}),bQ=typeof bM['object']==='string'?bM['object']:bK,bR=lintRewardClaimNodeGateDeadlock({'rewardKey':bL,'guardRef':bQ,'claimGates':bP,'machineGraph':bA});c['push'](...bR['critical']),d['push'](...bR['warnings']);}}for(const bS of a6){const bT=bn['get'](bS);if(!bT){d['push']('pre_publish:\x20attached\x20reward\x20\x22'+bS+'\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 bU=typeof bT['object']==='string'?bT['object']:bS,bV=rewardFundingGateFinding(bT,bS,pendingPlanFundingAmount(bU));if(bV){if(bV['level']==='critical')c['push'](bV['message']);else d['push'](bV['message']);}}}catch(bW){d['push']('pre_publish:\x20reward-funding\x20gate\x20skipped\x20—\x20could\x20not\x20query\x20reward\x20objects\x20'+('('+(bW instanceof Error?bW['message']:String(bW))+');\x20verify\x20every\x20attached\x20Reward\x20pool\x20is\x20funded\x20')+'up\x20to\x20expected_orders\x20x\x20per-claim\x20amount\x20BEFORE\x20publish');}}const o=extractOperationType(a,b)==='machine'?'machine_publish':'service_publish';if(o==='service_publish')try{const bX={'getAddress':bZ=>LocalMark['Instance']()['get_address'](bZ??'',j),'put':async()=>{throw new Error('SV-ECHO-01\x20is\x20a\x20read-only\x20gate');}},bY=await echoServicePublishBindings({'data':i,'dryRun':l,'resolve':bZ=>resolveMarkNamespaced(bX,bZ),'typeOf':bZ=>objectTypeFromAddress(bZ)??null});d['push'](...bY['echo']),d['push'](...bY['warnings']),c['push'](...bY['critical']);}catch(bZ){d['push']('pre_publish:\x20SV-ECHO-01\x20binding\x20echo\x20skipped\x20—\x20'+((bZ instanceof Error?bZ['message']:String(bZ))+';\x20verify\x20name→address\x20bindings\x20manually\x20before\x20publish'));}const q=buildPublishReadinessVerdict(o,[{'gate':'pre_publish','critical':c,'warnings':d}],gatesForFace(o)['map'](c0=>c0['id']));return{'critical':c,'warnings':d,'verdict':q};}function readHarnessOverrideNote(b){if(typeof b!=='object'||b===null)return undefined;const c=b,d=c['harness_override_note'];if(typeof d!=='string')return undefined;const e=d['trim']();if(!e)return undefined;return delete c['harness_override_note'],e;}function preBuyRecoveryHint(a){const b=a['map']((d,e)=>'leg\x20'+(e+0x1)+':\x20'+d+'\x0a'+'\x20\x20appeal:\x20resolve\x20THIS\x20leg\x20only\x20(see\x20the\x20finding)\x20—\x20or,\x20after\x20verifying\x20it\x20is\x20safe\x20for\x20this\x20purchase,\x20'+('resend\x20the\x20buy\x20with\x20a\x20top-level\x20harness_override_note\x20explaining\x20why\x20leg\x20'+(e+0x1)+'\x20is\x20acceptable.'))['join']('\x0a');return'Do\x20NOT\x20retry\x20unchanged\x20against\x20the\x20current\x20service\x20state.\x20One\x20entry\x20per\x20blocking\x20finding:\x0a'+b+'\x0aConfirm\x20each\x20leg\x20against\x20the\x20service\x27s\x20effective\x20allocator\x20plan\x20(query_toolkit\x20query_type=\x27service_panorama\x27,\x20'+'field\x20order_allocators):\x20the\x20merchant\x20fixes\x20the\x20plan\x20(post-publish\x20append\x20is\x20allowed)\x20or\x20the\x20guard\x20definitions\x20'+'are\x20repaired.\x20A\x20harness_override_note\x20leaves\x20an\x20audit\x20trail\x20but\x20does\x20NOT\x20change\x20on-chain\x20state\x20—\x20a\x20failing\x20'+'payment\x20still\x20burns\x20gas.';}function buildHarnessBlockResult(a,b,c,d,e,f,g){const h=[...c['map'](j=>'CRITICAL:\x20'+j),...d['map'](j=>'WARN:\x20'+j)]['join']('\x0a'),i='Error:\x20'+b+(h?'\x0a'+h:'')+'\x0aRecovery:\x20'+f;return{'content':[{'type':'text','text':i}],'structuredContent':{'outcome':'failed','result':{'type':'error','error':b+'\x20[gate='+a+']','error_code':e,'retryable':![],'recovery_hint':f},'message':i,'recovery':recover(e,'harness:'+a),...g?{'publish_readiness':g}:{}}};}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;}
|