@wowok/agent-mcp 3.0.4 → 3.0.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/evaluation/path-reasoning.d.ts +4 -2
- package/dist/evaluation/path-reasoning.js +1 -1
- package/dist/extensions/constraint-registry.d.ts +2 -2
- package/dist/extensions/constraint-registry.js +1 -1
- package/dist/extensions/custom-registry-file.d.ts +22 -0
- package/dist/extensions/custom-registry-file.js +1 -0
- package/dist/extensions/index.d.ts +2 -1
- package/dist/extensions/index.js +1 -1
- package/dist/extensions/industry-pack.d.ts +7 -0
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/metric-registry.d.ts +2 -2
- package/dist/extensions/metric-registry.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/extensions/registry.d.ts +2 -2
- package/dist/extensions/registry.js +1 -1
- package/dist/extensions/types.d.ts +4 -0
- package/dist/goal/GoalEngine.d.ts +13 -1
- package/dist/goal/GoalEngine.js +1 -1
- package/dist/goal/next-steps.d.ts +12 -0
- package/dist/goal/next-steps.js +1 -0
- package/dist/goal/pursue.d.ts +18 -0
- package/dist/goal/pursue.js +1 -0
- package/dist/goal/types.d.ts +72 -0
- package/dist/goal/types.js +1 -1
- package/dist/graph/onchain/analyze.d.ts +44 -0
- package/dist/graph/onchain/analyze.js +1 -0
- package/dist/graph/onchain/analyze.spec.d.ts +1 -0
- package/dist/graph/onchain/analyze.spec.js +1 -0
- package/dist/graph/onchain/anti-cheat.d.ts +39 -0
- package/dist/graph/onchain/anti-cheat.js +1 -0
- package/dist/graph/onchain/anti-cheat.spec.d.ts +1 -0
- package/dist/graph/onchain/anti-cheat.spec.js +1 -0
- package/dist/graph/onchain/dataplane.d.ts +44 -0
- package/dist/graph/onchain/dataplane.js +1 -0
- package/dist/graph/onchain/edge-schema.d.ts +60 -0
- package/dist/graph/onchain/edge-schema.js +1 -0
- package/dist/graph/onchain/expand.d.ts +4 -0
- package/dist/graph/onchain/expand.js +1 -0
- package/dist/graph/onchain/extract.d.ts +21 -0
- package/dist/graph/onchain/extract.js +1 -0
- package/dist/graph/onchain/index.d.ts +17 -0
- package/dist/graph/onchain/index.js +1 -0
- package/dist/graph/onchain/interest.d.ts +10 -0
- package/dist/graph/onchain/interest.js +1 -0
- package/dist/graph/onchain/interest.spec.d.ts +1 -0
- package/dist/graph/onchain/interest.spec.js +1 -0
- package/dist/graph/onchain/onchain.spec.d.ts +1 -0
- package/dist/graph/onchain/onchain.spec.js +1 -0
- package/dist/graph/onchain/order-status.d.ts +53 -0
- package/dist/graph/onchain/order-status.js +1 -0
- package/dist/graph/onchain/project-relationship.d.ts +3 -0
- package/dist/graph/onchain/project-relationship.js +1 -0
- package/dist/graph/onchain/sdk-batch.d.ts +117 -0
- package/dist/graph/onchain/sdk-batch.js +1 -0
- package/dist/graph/onchain/sdk-dataplane.d.ts +40 -0
- package/dist/graph/onchain/sdk-dataplane.js +1 -0
- package/dist/graph/onchain/strategy.d.ts +54 -0
- package/dist/graph/onchain/strategy.js +1 -0
- package/dist/graph/onchain/strategy.spec.d.ts +1 -0
- package/dist/graph/onchain/strategy.spec.js +1 -0
- package/dist/graph/onchain/types.d.ts +238 -0
- package/dist/graph/onchain/types.js +1 -0
- package/dist/graph/onchain/viewport.d.ts +5 -0
- package/dist/graph/onchain/viewport.js +1 -0
- package/dist/harness/recover.js +1 -1
- package/dist/index.js +1 -1
- package/dist/intent/enrich.js +1 -1
- package/dist/keeper/detectors.d.ts +1 -1
- package/dist/keeper/detectors.js +1 -1
- package/dist/knowledge/account-marks.js +1 -1
- package/dist/knowledge/anti-cheat.d.ts +2 -37
- package/dist/knowledge/anti-cheat.js +1 -1
- package/dist/knowledge/contract-invariants.js +1 -1
- package/dist/knowledge/getting-started.d.ts +37 -0
- package/dist/knowledge/getting-started.js +1 -0
- package/dist/knowledge/goal-completion.js +1 -1
- package/dist/knowledge/guard-render.d.ts +1 -0
- package/dist/knowledge/guard-render.js +1 -1
- package/dist/knowledge/guard-submission-brief.d.ts +83 -0
- package/dist/knowledge/guard-submission-brief.js +1 -0
- package/dist/knowledge/guard-submission-prompt.d.ts +13 -0
- package/dist/knowledge/guard-submission-prompt.js +1 -1
- package/dist/knowledge/index.d.ts +6 -4
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/industry-strategy.d.ts +91 -0
- package/dist/knowledge/industry-strategy.js +1 -0
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/market-metrics.d.ts +14 -3
- package/dist/knowledge/market-metrics.js +1 -1
- package/dist/knowledge/migration-preflight.js +1 -1
- package/dist/knowledge/operation-dictionary.d.ts +1 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/scenario-topology.d.ts +6 -1
- package/dist/knowledge/scenario-topology.js +1 -1
- package/dist/knowledge/service-risk-node.d.ts +3 -0
- package/dist/knowledge/service-risk-node.js +1 -0
- package/dist/knowledge/service-risk.d.ts +2 -0
- package/dist/knowledge/service-risk.js +1 -1
- package/dist/knowledge/service-templates.d.ts +2 -0
- package/dist/knowledge/service-templates.js +1 -1
- package/dist/knowledge/strategy-manuals.d.ts +17 -0
- package/dist/knowledge/strategy-manuals.js +1 -0
- package/dist/knowledge/supply-chain.d.ts +3 -1
- package/dist/knowledge/supply-chain.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +3 -118
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/knowledge/workspace-lists.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/monitor/ScopeResolver.js +1 -1
- package/dist/participation/radar-core.d.ts +15 -15
- package/dist/participation/radar-core.js +1 -1
- package/dist/persona/analyzer.d.ts +2 -1
- package/dist/persona/bridge.d.ts +5 -1
- package/dist/persona/bridge.js +1 -1
- package/dist/persona/defaults.js +1 -1
- package/dist/persona/distill-goal.d.ts +7 -1
- package/dist/persona/distill-goal.js +1 -1
- package/dist/persona/index.d.ts +13 -3
- package/dist/persona/index.js +1 -1
- package/dist/persona/model.d.ts +12 -2
- package/dist/persona/model.js +1 -1
- package/dist/persona/overrides.d.ts +1 -0
- package/dist/persona/overrides.js +1 -1
- package/dist/persona/topology-focus.d.ts +29 -0
- package/dist/persona/topology-focus.js +1 -0
- package/dist/persona/types.d.ts +81 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/context-assembly.js +1 -1
- package/dist/playbooks/service-build/machine-nodes.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.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.d.ts +1 -0
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +4 -0
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/topology-query.d.ts +14 -0
- package/dist/playbooks/service-build/topology-query.js +1 -0
- package/dist/role/index.d.ts +1 -0
- package/dist/role/index.js +1 -1
- package/dist/role/profiles.d.ts +26 -0
- package/dist/role/profiles.js +1 -0
- package/dist/safety/confirm-gate.d.ts +4 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/call/allocation.d.ts +6 -6
- package/dist/schema/call/bridge.d.ts +1 -1
- package/dist/schema/call/guard.d.ts +20 -20
- package/dist/schema/call/repository.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +4 -4
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/employee/index.d.ts +7 -7
- package/dist/schema/evaluation/index.d.ts +22 -9
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +37 -1
- package/dist/schema/goal/index.js +1 -1
- package/dist/schema/goal/planning.d.ts +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +7 -0
- package/dist/schema/industry-pack/index.js +1 -1
- package/dist/schema/local/index.d.ts +8 -4
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +318 -64
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +146 -11
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +15743 -0
- package/dist/schema/persona/index.js +1 -1
- package/dist/schema/query/bi.d.ts +869 -2
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +163 -41
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +16 -0
- package/dist/schema/schema-query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/strategy-review/index.d.ts +137 -0
- package/dist/schema/strategy-review/index.js +1 -0
- package/dist/schema/trust/index.d.ts +6 -6
- package/dist/schema/workflow/index.d.ts +2 -2
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +8 -4
- package/dist/schemas/account_operation.schema.json +6 -2
- package/dist/schemas/evaluation_operation.output.json +24 -0
- package/dist/schemas/goal_operation.schema.json +124 -0
- package/dist/schemas/index.json +7 -1
- package/dist/schemas/industry_pack_operation.output.json +39 -0
- package/dist/schemas/local_mark_operation.schema.json +2 -2
- package/dist/schemas/messenger_operation.output.json +670 -200
- package/dist/schemas/messenger_operation.schema.json +66 -239
- package/dist/schemas/onchain_operations.schema.json +3 -3
- package/dist/schemas/onchain_operations_repository.schema.json +3 -3
- package/dist/schemas/onchain_table_data.output.json +184 -0
- package/dist/schemas/onchain_table_data.schema.json +43 -43
- package/dist/schemas/persona_operation.output.json +37778 -262
- package/dist/schemas/persona_operation.schema.json +5960 -1
- package/dist/schemas/query_toolkit.output.json +1580 -2
- package/dist/schemas/query_toolkit.schema.json +194 -32
- package/dist/schemas/schema_query.schema.json +25 -1
- package/dist/schemas/strategy_review_operation.output.json +532 -0
- package/dist/schemas/strategy_review_operation.schema.json +66 -0
- package/dist/schemas/wowok_buildin_info.output.json +188 -6
- package/dist/schemas/wowok_buildin_info.schema.json +14 -0
- package/dist/strategy/collectors.d.ts +66 -0
- package/dist/strategy/collectors.js +1 -0
- package/dist/strategy/collectors.spec.d.ts +1 -0
- package/dist/strategy/collectors.spec.js +1 -0
- package/dist/strategy/index.d.ts +5 -0
- package/dist/strategy/index.js +1 -0
- package/dist/strategy/metrics.d.ts +20 -0
- package/dist/strategy/metrics.js +1 -0
- package/dist/strategy/review.d.ts +48 -0
- package/dist/strategy/review.js +1 -0
- package/dist/strategy/scorecard.d.ts +32 -0
- package/dist/strategy/scorecard.js +1 -0
- package/dist/strategy/store.d.ts +26 -0
- package/dist/strategy/store.js +1 -0
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/goal.js +1 -1
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/permission.js +1 -1
- package/dist/tools/handlers/persona.js +1 -1
- package/dist/tools/handlers/query.d.ts +6 -0
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/handlers/strategy-review.d.ts +2 -0
- package/dist/tools/handlers/strategy-review.js +1 -0
- package/dist/tools/handlers/watch.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/agent.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/local.js +1 -1
- package/dist/tools/registry/messenger.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/rules-hook.js +1 -1
- package/dist/tools/shared.d.ts +2 -1
- package/dist/tools/shared.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
package/dist/tools/shared.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{confirmGate}from'../safety/confirm-gate.js';import{renderPreview}from'../safety/preview.js';import{validateOperation,hasBlockingViolations,getWarningViolations}from'../knowledge/index.js';import{getHarness}from'../harness/index.js';import{isEnabled as
|
|
1
|
+
import{confirmGate}from'../safety/confirm-gate.js';import{renderPreview}from'../safety/preview.js';import{validateOperation,hasBlockingViolations,getWarningViolations}from'../knowledge/index.js';import{getHarness}from'../harness/index.js';import{isEnabled as a397a}from'../config/index.js';import{classifyError,buildDataSemantic}from'../schema/call/semantic.js';import{strictParse}from'../schema/index.js';export function withHarness(a,b,c){if(!a397a('harness'))return a;try{const d=getHarness(),e=d['expect'](b,c,a['operation_type'],a['data']);return{...a,'harness':d,'expected':e,'operation_id':a['operation_type']+'_'+Date['now']()};}catch{return a;}}export function wrapLocalHandler(a){const {schema:b,operationFn:c,parseLabel:d,buildContext:e}=a;return async f=>{let g;try{g=strictParse(b,f,d);const h=await c(g),i=e(g);return{'content':[{'type':'text','text':JSON['stringify'](h)}],'structuredContent':{'result':{'status':'success','data':h},'semantic':buildDataSemantic(h,i)}};}catch(j){const k=j instanceof Error?j['message']:String(j),l=g?e(g):undefined,m=classifyError(k),n={'status':'error','error':k};if(m['error_code']!==undefined)n['error_code']=m['error_code'];if(m['retryable']!==undefined)n['retryable']=m['retryable'];if(m['recovery_hint']!==undefined)n['recovery_hint']=m['recovery_hint'];return{'content':[{'type':'text','text':'Error:\x20'+k}],'structuredContent':{'result':n,'semantic':buildDataSemantic(undefined,l,!![],k)}};}};}export function buildPendingConfirmation(a,b,c,d,e){const f=confirmGate(a,b,c,c?.['user_intent_phrases'],d,e);if(f['pass'])return{'content':[],'structuredContent':null};const g=f['preview'],h=renderPreview(g),i={'message':h,'result':{'type':'pending_confirmation','preview':g,'rule_id':f['rule_id']},'semantic':{'intent':a+'_awaiting_confirmation','status':'pending_input','summary':'Operation\x20blocked\x20by\x20ConfirmGate\x20('+f['level']+').\x20Review\x20the\x20preview\x20and\x20re-call\x20with\x20env.confirmed=true\x20to\x20proceed.','next_actions':[{'action':'confirm:\x20re-call\x20the\x20SAME\x20operation\x20with\x20env.confirmed=true','reason':'ConfirmGate\x20rule\x20\x27'+f['rule_id']+'\x27\x20matched.\x20The\x20operation\x20was\x20NOT\x20executed.','tool':'onchain_operations','priority':'required'}],'warnings':g['warnings']??[]}};return{'content':[{'type':'text','text':h}],'structuredContent':i};}export function buildConstraintError(a,b){const c=b['filter'](g=>g['severity']==='error'),d=c['map'](g=>'\x20\x20•\x20['+g['field']+']\x20'+g['message'])['join']('\x0a'),e='Pre-call\x20constraint\x20violations\x20for\x20\x27'+a+'\x27:\x0a'+d+'\x0a\x0aFix\x20the\x20listed\x20field(s)\x20and\x20retry.',f={'message':e,'result':{'type':'error','error':e,'error_code':'invalid_parameter','retryable':![],'recovery_hint':'Review\x20the\x20constraint\x20violations\x20above\x20and\x20correct\x20the\x20corresponding\x20fields.'}};return{'content':[{'type':'text','text':e}],'structuredContent':f};}export function buildClassifiedErrorResult(a,b,c){const d={...a,'error':b};if(c['error_code']!==undefined)d['error_code']=c['error_code'];if(c['retryable']!==undefined)d['retryable']=c['retryable'];if(c['recovery_hint']!==undefined)d['recovery_hint']=c['recovery_hint'];return d;}export{validateOperation,hasBlockingViolations,getWarningViolations};
|
package/dist/tools/wrap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{classifyError,buildDataSemantic}from'../schema/call/semantic.js';import{buildClassifiedErrorResult}from'./shared.js';import{shouldRunLightHooks,shouldRunHeavyHooks,recordOperationFailure,recordCriticalRisk,recordCriticalOperation,recordSubstepFailure}from'../harness/auto-escalation.js';import{getHarnessTier,setHarnessTier,isEnabled}from'../config/runtime.js';import{getHarness}from'../harness/index.js';import{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';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\x20re-query\x20the\x20target\x20object\x20state\x20'+'(query_toolkit\x20onchain_objects)\x20and\x20only\x20retry\x20if\x20the\x20operation\x20truly\x20did\x20not\x20land.');f(new Error('Operation\x20\x27'+c+'\x27\x20timed\x20out\x20after\x20'+b+'ms.'+g));},b);})]);}export function wrapHandlerWithErrorShape(a,b,c,d){return async(e,f)=>{try{return await withTimeout(a(e,f),b,c);}catch(g){if(d){const h=g instanceof Error?g['message']:String(g),i=classifyError(h),j={'operation_type':c,'data':e},k=d(h,i,j);return{'content':[{'type':'text','text':'Error:\x20'+h}],'structuredContent':k};}throw g;}};}export const statusErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'status':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const operationErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'operation':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const strictStatusErrorShape=(a,b,c)=>({'result':{'status':'error','error':a}});function checkProjectStage(a,b,c){const d={'analyze_intent':'puzzle','aggregate_risks':'risk','trace_substeps':'substeps'},e=d[a];if(!e)return null;const f=getStageCache(b,c);if(!f){if(a==='analyze_intent')return null;return'project_stage:\x20calling\x20\x27'+a+'\x27\x20before\x20\x27analyze_intent\x27\x20—\x20recommend\x20calling\x20analyze_intent\x20first\x20for\x20project\x20\x27'+b+':'+c+'\x27';}if(stageIndexOf(f['stage'])<stageIndexOf(e)-0x1)return'project_stage:\x20calling\x20\x27'+a+'\x27\x20(stage\x20\x27'+e+'\x27)\x20but\x20project\x20is\x20at\x20stage\x20\x27'+f['stage']+'\x27\x20—\x20recommend\x20completing\x20prior\x20stages\x20first\x20for\x20\x27'+b+':'+c+'\x27';return null;}export function dispatchWithHarness(a,b){return async(d,f)=>{const g=[],h=getHarness(),i=shouldRunLightHooks(),j=shouldRunHeavyHooks(),k=isPublishOperation(b,d),l=isSignOperation(b,d),m=getHarnessTier();let n;if(i)try{const p=extractOperationType(b,d),q=extractIntent(b,d);p&&q&&(n=h['expect'](b,q,p,extractData(d)));}catch(r){g['push']('pre_call\x20hook\x20failed:\x20'+(r instanceof Error?r['message']:String(r)));}if(b==='goal_operation'&&i)try{const s=d,t=s?.['action'],u=s?.['project'],v=s?.['version'];if(t&&u&&v){const x=checkProjectStage(t,u,v);x&&g['push'](x);}}catch{}k&&m==='lightweight'&&(setHarnessTier('full'),g['push']('pre_publish:\x20tier\x20forced\x20to\x20full\x20for\x20publish-class\x20operation\x20(GLM5-21\x20§3.3)'));if(k&&m!=='off')try{const y=runPrePublishChecks(b,d);g['push'](...y['warnings']);if(y['critical']['length']>0x0){for(const z of y['critical']){const A=recordCriticalRisk(z);if(A)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+A['reason']);}return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20Harness\x20pre-publish\x20gate\x20(GLM5-21\x20V6):\x20'+(y['critical']['length']+'\x20CRITICAL\x20risk(s)\x20must\x20be\x20resolved\x20before\x20publish.'),y['critical'],y['warnings'],'immutable_violation','Fix\x20the\x20CRITICAL\x20risks\x20listed\x20in\x20the\x20message\x20(e.g.\x20rename\x20dispute/refund\x20nodes\x20per\x20R-M1-11,\x20add\x20the\x20entry\x20pair\x20prev_node=\x22\x22),\x20then\x20retry\x20publish.\x20Nodes/pairs/forwards\x20are\x20immutable\x20after\x20publish\x20—\x20verify\x20via\x20machineNode2file\x20first.');}}catch(B){g['push']('pre_publish\x20hook\x20failed:\x20'+(B instanceof Error?B['message']:String(B)));}if(l&&j)try{const C=extractData(d),D=C?extractAmount(C):null;if(D!==null){const E=getAmountThreshold();let F=null;try{F=BigInt(D);}catch{F=null;}if(F!==null&&F>E)return buildHarnessBlockResult('pre_sign','Sign\x20BLOCKED\x20by\x20Harness\x20pre-sign\x20gate\x20(GLM5-21\x20V7):\x20amount\x20'+formatAmount(F)+'\x20WOW\x20exceeds\x20the\x20full-tier\x20threshold\x20'+formatAmount(E)+'\x20WOW.',['amount\x20'+D+'\x20(smallest\x20unit)\x20>\x20threshold\x20'+E['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.');}}catch(G){g['push']('pre_sign\x20hook\x20failed:\x20'+(G instanceof Error?G['message']:String(G)));}let o;try{o=await a(d,f);}catch(H){const I=H instanceof Error?H['message']:String(H),J=recordOperationFailure(b,I);J&&g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+J['reason']);if(b==='onchain_operations')try{const K=classifyError(I,H);if(!K['retryable']&&K['error_code']!=='unknown'){const L=recordCriticalOperation(b,K['error_code']);if(L)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+L['reason']);}}catch{}throw H;}if(i&&n)try{if(o?.['structuredContent']){const M=buildVerifyInput(n,o),N=h['verify'](M);if(N['status']==='fail')g['push']('Harness\x20verify\x20FAIL:\x20'+N['summary']);else N['status']==='warn'&&g['push']('Harness\x20verify\x20WARN:\x20'+N['summary']);}}catch(O){g['push']('post_call\x20hook\x20failed:\x20'+(O instanceof Error?O['message']:String(O)));}if(b==='onchain_operations')try{if(classifyOutcome(o)==='failed'){const P=extractErrorCode(o)??'',Q=classifyError(P);if(!Q['retryable']&&Q['error_code']!=='unknown'){const R=recordCriticalOperation(b,Q['error_code']);if(R)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+R['reason']);}}}catch{}if(i){const S=extractIntent(b,d)??b;try{const T=classifyOutcome(o);if(T==='failed'){const U=extractErrorCode(o)??'',V=classifyError(U),W=h['recover'](V['error_code'],S,{'operation_type':b,'data':extractData(d)});g['push']('Harness\x20recover:\x20strategy='+W['strategy']+('\x20(attempt\x20'+W['current_attempt']+'/'+W['max_attempts']+')')+(W['should_retry']?'\x20—\x20retryable':'\x20—\x20do\x20NOT\x20retry\x20blindly')+(W['user_prompt']?'\x20—\x20'+W['user_prompt']:'\x20—\x20'+W['detail']));}else T==='success'&&h['resetRecovery'](S);}catch(X){g['push']('recover\x20hook\x20failed:\x20'+(X instanceof Error?X['message']:String(X)));}}if(b==='goal_operation')try{const Y=d?.['action'];if(Y==='trace_substeps'){const Z=extractCriticalFindingCount(o);if(Z>0x0){const a0=recordSubstepFailure(String(Y)+':\x20'+Z+'\x20critical\x20finding(s)');if(a0)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+a0['reason']);}}}catch{}if(isWriteClassTool(b)&&!SEMANTIC_RECORDED_TOOLS['has'](b))try{const a1=extractOperationType(b,d)??b,a2=extractIntent(b,d)??b,a3=extractData(d)??d,a4=classifyOutcome(o),a5=extractErrorCode(o),a6=isEnabled('experience_layer');if(a6)recordOperationOutcome(a1,a3,a2,a4,a5);else{const a7=extractIndustry(d);a7&&isEnabled('industry_evolution')&&recordIndustrySignal(a7,{'type':a1},{'success':a4==='success','error_code':a5});}}catch(a8){g['push']('signal\x20collection\x20failed:\x20'+(a8 instanceof Error?a8['message']:String(a8)));}if(g['length']>0x0){if(o?.['structuredContent']){const a9=o['structuredContent'],aa=a9['semantic'];if(aa){const ab=Array['isArray'](aa['warnings'])?aa['warnings']:[];aa['warnings']=[...ab,...g];}else for(const ac of g){console['warn']('[harness]\x20'+ac);}}else for(const ad of g){console['warn']('[harness]\x20'+ad);}}return o;};}function isPublishOperation(a,b){if(a!=='onchain_operations')return![];const c=extractOperationType(a,b);if(c!=='service'&&c!=='machine')return![];const d=extractData(b);return d?.['publish']===!![]||d?.['bPublished']===!![];}function isSignOperation(a,b){if(a==='wip_file'){const c=b?.['operation_type'];return c==='sign';}return a==='onchain_operations';}function 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')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')&&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 buildVerifyInput(a,b){const c=b['structuredContent']??{},d=c['semantic'];return{'expected':a,'actual':{'result_type':typeof c['result_type']==='string'?c['result_type']:undefined,'semantic':d,'error_code':typeof c['error_code']==='string'?c['error_code']:undefined,'error':typeof c['error']==='string'?c['error']:undefined}};}const WRITE_CLASS_TOOLS=new Set(['onchain_operations','goal_operation','industry_pack_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'],c=typeof b['status']==='string'?b['status']:typeof b['result_type']==='string'?b['result_type']:'';if(c==='error'||c==='failed')return'failed';if(c==='partial')return'partial';return'success';}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;}const ANTI_PATTERN_NODE_REGEX=/(^|_)(disputed?|refund(?:ed)?|arbitration|arb)(_|$)/i;function runPrePublishChecks(a,b){const c=[],d=[],e=extractOperationType(a,b),g=extractData(b)??{};if(e==='machine'){const h=g['node'],i=Array['isArray'](h)?h:Array['isArray'](h?.['nodes'])?h['nodes']:[];if(i['length']>0x0){for(const l of i){const m=typeof l?.['name']==='string'?l['name']:'';m&&ANTI_PATTERN_NODE_REGEX['test'](m)&&c['push']('R-M1-11:\x20machine\x20node\x20\x22'+m+'\x22\x20models\x20dispute/refund\x20flow\x20—\x20'+'refunds\x20must\x20route\x20via\x20an\x20Allocator\x20triggered\x20by\x20business\x20states,\x20'+'disputes\x20via\x20the\x20separate\x20Arbitration\x20object\x20(off-Machine)');}const j=new Set();for(const o of i){const q=typeof o?.['name']==='string'?o['name']:'';if(!q)continue;j['has'](q)&&c['push']('MC-C-04:\x20duplicate\x20machine\x20node\x20name\x20\x22'+q+'\x22\x20—\x20on-chain\x20will\x20reject\x20the\x20publish\x20transaction'),j['add'](q);}const k=i['some'](r=>Array['isArray'](r?.['pairs'])&&r['pairs']['some'](s=>s?.['prev_node']===''));!k&&c['push']('Machine\x20has\x20no\x20entry\x20pair\x20(prev_node=\x22\x22)\x20—\x20Progress\x20can\x20never\x20advance\x20'+'from\x20the\x20initial\x20state;\x20orders\x20are\x20permanently\x20stuck');for(const r of i){const s=typeof r?.['name']==='string'?r['name']:'?';for(const t of r?.['pairs']??[]){for(const u of t?.['forwards']??[]){const v=u?.['namedOperator']!==undefined&&u?.['namedOperator']!==null,w=u?.['permissionIndex']!==undefined&&u?.['permissionIndex']!==null;!v&&!w&&d['push']('pre_publish:\x20node\x20\x22'+s+'\x22\x20forward\x20\x22'+String(u?.['name']??'?')+'\x22\x20has\x20neither\x20namedOperator\x20nor\x20permissionIndex\x20—\x20no\x20one\x20can\x20advance\x20it');}}}}else 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)');}return e==='service'&&(d['push']('pre_publish:\x20service\x20machine/order_allocators/arbitrations\x20become\x20immutable\x20after\x20publish\x20(IMMUT-002);\x20sales\x20remains\x20modifiable'),g['machine']===undefined&&d['push']('pre_publish:\x20\x27machine\x27\x20not\x20set\x20in\x20this\x20call\x20—\x20if\x20the\x20service\x20was\x20never\x20bound\x20to\x20a\x20published\x20machine,\x20'+'it\x20cannot\x20process\x20orders\x20and\x20CANNOT\x20be\x20fixed\x20after\x20publish'),g['order_allocators']===undefined&&d['push']('pre_publish:\x20\x27order_allocators\x27\x20not\x20set\x20in\x20this\x20call\x20—\x20immutable\x20after\x20publish;\x20'+'orders\x20will\x20have\x20no\x20fund\x20distribution\x20if\x20never\x20configured')),{'critical':c,'warnings':d};}function buildHarnessBlockResult(a,b,c,d,e,f){const g=[...c['map'](i=>'CRITICAL:\x20'+i),...d['map'](i=>'WARN:\x20'+i)]['join']('\x0a'),h='Error:\x20'+b+(g?'\x0a'+g:'')+'\x0aRecovery:\x20'+f;return{'content':[{'type':'text','text':h}],'structuredContent':{'result':{'type':'error','error':b+'\x20[gate='+a+']','error_code':e,'retryable':![],'recovery_hint':f},'message':h}};}function extractCriticalFindingCount(a){const b=a?.['structuredContent'];if(!b)return 0x0;const c=b['semantic'],d=c?.['summary'];if(typeof d?.['critical_count']==='number'&&d['critical_count']>0x0)return d['critical_count'];const e=b['findings']??c?.['findings'];if(Array['isArray'](e))return e['filter'](h=>h?.['severity']==='error')['length'];const f=a?.['content']?.['map'](h=>'text'in h?h['text']:'')['join']('\x0a')??'',g=f['match'](/\[AUDIT ERROR\]/g);return g?g['length']:0x0;}
|
|
1
|
+
import{classifyError,buildDataSemantic}from'../schema/call/semantic.js';import{buildClassifiedErrorResult}from'./shared.js';import{shouldRunLightHooks,shouldRunHeavyHooks,recordOperationFailure,recordCriticalRisk,recordCriticalOperation,recordSubstepFailure}from'../harness/auto-escalation.js';import{getHarnessTier,setHarnessTier,isEnabled}from'../config/runtime.js';import{getHarness}from'../harness/index.js';import{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';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\x20re-query\x20the\x20target\x20object\x20state\x20'+'(query_toolkit\x20onchain_objects)\x20and\x20only\x20retry\x20if\x20the\x20operation\x20truly\x20did\x20not\x20land.');f(new Error('Operation\x20\x27'+c+'\x27\x20timed\x20out\x20after\x20'+b+'ms.'+g));},b);})]);}export function wrapHandlerWithErrorShape(a,b,c,d){return async(e,f)=>{try{return await withTimeout(a(e,f),b,c);}catch(g){if(d){const h=g instanceof Error?g['message']:String(g),i=classifyError(h),j={'operation_type':c,'data':e},k=d(h,i,j);return{'content':[{'type':'text','text':'Error:\x20'+h}],'structuredContent':k};}throw g;}};}export const statusErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'status':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const operationErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'operation':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const strictStatusErrorShape=(a,b,c)=>({'result':{'status':'error','error':a}});function checkProjectStage(a,b,c){const d={'analyze_intent':'puzzle','aggregate_risks':'risk','trace_substeps':'substeps'},e=d[a];if(!e)return null;const f=getStageCache(b,c);if(!f){if(a==='analyze_intent')return null;return'project_stage:\x20calling\x20\x27'+a+'\x27\x20before\x20\x27analyze_intent\x27\x20—\x20recommend\x20calling\x20analyze_intent\x20first\x20for\x20project\x20\x27'+b+':'+c+'\x27';}if(stageIndexOf(f['stage'])<stageIndexOf(e)-0x1)return'project_stage:\x20calling\x20\x27'+a+'\x27\x20(stage\x20\x27'+e+'\x27)\x20but\x20project\x20is\x20at\x20stage\x20\x27'+f['stage']+'\x27\x20—\x20recommend\x20completing\x20prior\x20stages\x20first\x20for\x20\x27'+b+':'+c+'\x27';return null;}export function dispatchWithHarness(a,b){return async(d,f)=>{const g=[],h=getHarness(),i=shouldRunLightHooks(),j=shouldRunHeavyHooks(),k=isPublishOperation(b,d),l=isSignOperation(b,d),m=getHarnessTier();let n;if(i)try{const p=extractOperationType(b,d),q=extractIntent(b,d);p&&q&&(n=h['expect'](b,q,p,extractData(d)));}catch(r){g['push']('pre_call\x20hook\x20failed:\x20'+(r instanceof Error?r['message']:String(r)));}if(b==='goal_operation'&&i)try{const s=d,t=s?.['action'],u=s?.['project'],v=s?.['version'];if(t&&u&&v){const x=checkProjectStage(t,u,v);x&&g['push'](x);}}catch{}k&&m==='lightweight'&&(setHarnessTier('full'),g['push']('pre_publish:\x20tier\x20forced\x20to\x20full\x20for\x20publish-class\x20operation\x20(GLM5-21\x20§3.3)'));if(k&&m!=='off')try{const y=runPrePublishChecks(b,d);g['push'](...y['warnings']);if(y['critical']['length']>0x0){for(const z of y['critical']){const A=recordCriticalRisk(z);if(A)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+A['reason']);}return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20Harness\x20pre-publish\x20gate\x20(GLM5-21\x20V6):\x20'+(y['critical']['length']+'\x20CRITICAL\x20risk(s)\x20must\x20be\x20resolved\x20before\x20publish.'),y['critical'],y['warnings'],'immutable_violation','Fix\x20the\x20CRITICAL\x20risks\x20listed\x20in\x20the\x20message\x20(e.g.\x20rename\x20dispute/refund\x20nodes\x20per\x20R-M1-11,\x20add\x20the\x20entry\x20pair\x20prev_node=\x22\x22),\x20then\x20retry\x20publish.\x20Nodes/pairs/forwards\x20are\x20immutable\x20after\x20publish\x20—\x20verify\x20via\x20machineNode2file\x20first.');}}catch(B){g['push']('pre_publish\x20hook\x20failed:\x20'+(B instanceof Error?B['message']:String(B)));}if(l&&j)try{const C=extractData(d),D=C?extractAmount(C):null;if(D!==null){const E=getAmountThreshold();let F=null;try{F=BigInt(D);}catch{F=null;}if(F!==null&&F>E)return buildHarnessBlockResult('pre_sign','Sign\x20BLOCKED\x20by\x20Harness\x20pre-sign\x20gate\x20(GLM5-21\x20V7):\x20amount\x20'+formatAmount(F)+'\x20WOW\x20exceeds\x20the\x20full-tier\x20threshold\x20'+formatAmount(E)+'\x20WOW.',['amount\x20'+D+'\x20(smallest\x20unit)\x20>\x20threshold\x20'+E['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.');}}catch(G){g['push']('pre_sign\x20hook\x20failed:\x20'+(G instanceof Error?G['message']:String(G)));}let o;try{o=await a(d,f);}catch(H){const I=H instanceof Error?H['message']:String(H),J=recordOperationFailure(b,I);J&&g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+J['reason']);if(b==='onchain_operations')try{const K=classifyError(I,H);if(!K['retryable']&&K['error_code']!=='unknown'){const L=recordCriticalOperation(b,K['error_code']);if(L)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+L['reason']);}}catch{}throw H;}if(i&&n)try{if(o?.['structuredContent']){const M=buildVerifyInput(n,o),N=h['verify'](M);if(N['status']==='fail')g['push']('Harness\x20verify\x20FAIL:\x20'+N['summary']);else N['status']==='warn'&&g['push']('Harness\x20verify\x20WARN:\x20'+N['summary']);}}catch(O){g['push']('post_call\x20hook\x20failed:\x20'+(O instanceof Error?O['message']:String(O)));}if(b==='onchain_operations')try{if(classifyOutcome(o)==='failed'){const P=extractErrorCode(o)??'',Q=classifyError(P);if(!Q['retryable']&&Q['error_code']!=='unknown'){const R=recordCriticalOperation(b,Q['error_code']);if(R)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+R['reason']);}}}catch{}if(i){const S=extractIntent(b,d)??b;try{const T=classifyOutcome(o);if(T==='failed'){const U=extractErrorCode(o)??'',V=classifyError(U),W=h['recover'](V['error_code'],S,{'operation_type':b,'data':extractData(d)});g['push']('Harness\x20recover:\x20strategy='+W['strategy']+('\x20(attempt\x20'+W['current_attempt']+'/'+W['max_attempts']+')')+(W['should_retry']?'\x20—\x20retryable':'\x20—\x20do\x20NOT\x20retry\x20blindly')+(W['user_prompt']?'\x20—\x20'+W['user_prompt']:'\x20—\x20'+W['detail']));}else T==='success'&&h['resetRecovery'](S);}catch(X){g['push']('recover\x20hook\x20failed:\x20'+(X instanceof Error?X['message']:String(X)));}}if(b==='goal_operation')try{const Y=d?.['action'];if(Y==='trace_substeps'){const Z=extractCriticalFindingCount(o);if(Z>0x0){const a0=recordSubstepFailure(String(Y)+':\x20'+Z+'\x20critical\x20finding(s)');if(a0)g['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+a0['reason']);}}}catch{}if(isWriteClassTool(b)&&!SEMANTIC_RECORDED_TOOLS['has'](b))try{const a1=extractOperationType(b,d)??b,a2=extractIntent(b,d)??b,a3=extractData(d)??d,a4=classifyOutcome(o),a5=extractErrorCode(o),a6=isEnabled('experience_layer');if(a6)recordOperationOutcome(a1,a3,a2,a4,a5);else{const a7=extractIndustry(d);a7&&isEnabled('industry_evolution')&&recordIndustrySignal(a7,{'type':a1},{'success':a4==='success','error_code':a5});}}catch(a8){g['push']('signal\x20collection\x20failed:\x20'+(a8 instanceof Error?a8['message']:String(a8)));}if(g['length']>0x0){if(o?.['structuredContent']){const a9=o['structuredContent'],aa=a9['semantic'];if(aa){const ab=Array['isArray'](aa['warnings'])?aa['warnings']:[];aa['warnings']=[...ab,...g];}else for(const ac of g){console['warn']('[harness]\x20'+ac);}}else for(const ad of g){console['warn']('[harness]\x20'+ad);}}return o;};}function isPublishOperation(a,b){if(a!=='onchain_operations')return![];const c=extractOperationType(a,b);if(c!=='service'&&c!=='machine')return![];const d=extractData(b);return d?.['publish']===!![]||d?.['bPublished']===!![];}function isSignOperation(a,b){if(a==='wip_file'){const c=b?.['operation_type'];return c==='sign';}return a==='onchain_operations';}function 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 buildVerifyInput(a,b){const c=b['structuredContent']??{},d=c['semantic'];return{'expected':a,'actual':{'result_type':typeof c['result_type']==='string'?c['result_type']:undefined,'semantic':d,'error_code':typeof c['error_code']==='string'?c['error_code']:undefined,'error':typeof c['error']==='string'?c['error']: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'],c=typeof b['status']==='string'?b['status']:typeof b['result_type']==='string'?b['result_type']:'';if(c==='error'||c==='failed')return'failed';if(c==='partial')return'partial';return'success';}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;}const ANTI_PATTERN_NODE_REGEX=/(^|_)(disputed?|refund(?:ed)?|arbitration|arb)(_|$)/i;function runPrePublishChecks(a,b){const c=[],d=[],e=extractOperationType(a,b),g=extractData(b)??{};if(e==='machine'){const h=g['node'],i=Array['isArray'](h)?h:Array['isArray'](h?.['nodes'])?h['nodes']:[];if(i['length']>0x0){for(const l of i){const m=typeof l?.['name']==='string'?l['name']:'';m&&ANTI_PATTERN_NODE_REGEX['test'](m)&&c['push']('R-M1-11:\x20machine\x20node\x20\x22'+m+'\x22\x20models\x20dispute/refund\x20flow\x20—\x20'+'refunds\x20must\x20route\x20via\x20an\x20Allocator\x20triggered\x20by\x20business\x20states,\x20'+'disputes\x20via\x20the\x20separate\x20Arbitration\x20object\x20(off-Machine)');}const j=new Set();for(const o of i){const q=typeof o?.['name']==='string'?o['name']:'';if(!q)continue;j['has'](q)&&c['push']('MC-C-04:\x20duplicate\x20machine\x20node\x20name\x20\x22'+q+'\x22\x20—\x20on-chain\x20will\x20reject\x20the\x20publish\x20transaction'),j['add'](q);}const k=i['some'](r=>Array['isArray'](r?.['pairs'])&&r['pairs']['some'](s=>s?.['prev_node']===''));!k&&c['push']('Machine\x20has\x20no\x20entry\x20pair\x20(prev_node=\x22\x22)\x20—\x20Progress\x20can\x20never\x20advance\x20'+'from\x20the\x20initial\x20state;\x20orders\x20are\x20permanently\x20stuck');for(const r of i){const s=typeof r?.['name']==='string'?r['name']:'?';for(const t of r?.['pairs']??[]){for(const u of t?.['forwards']??[]){const v=u?.['namedOperator']!==undefined&&u?.['namedOperator']!==null,w=u?.['permissionIndex']!==undefined&&u?.['permissionIndex']!==null;!v&&!w&&d['push']('pre_publish:\x20node\x20\x22'+s+'\x22\x20forward\x20\x22'+String(u?.['name']??'?')+'\x22\x20has\x20neither\x20namedOperator\x20nor\x20permissionIndex\x20—\x20no\x20one\x20can\x20advance\x20it');}}}}else 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)');}return e==='service'&&(d['push']('pre_publish:\x20service\x20machine/order_allocators/arbitrations\x20become\x20immutable\x20after\x20publish\x20(IMMUT-002);\x20sales\x20remains\x20modifiable'),g['machine']===undefined&&d['push']('pre_publish:\x20\x27machine\x27\x20not\x20set\x20in\x20this\x20call\x20—\x20if\x20the\x20service\x20was\x20never\x20bound\x20to\x20a\x20published\x20machine,\x20'+'it\x20cannot\x20process\x20orders\x20and\x20CANNOT\x20be\x20fixed\x20after\x20publish'),g['order_allocators']===undefined&&d['push']('pre_publish:\x20\x27order_allocators\x27\x20not\x20set\x20in\x20this\x20call\x20—\x20immutable\x20after\x20publish;\x20'+'orders\x20will\x20have\x20no\x20fund\x20distribution\x20if\x20never\x20configured')),{'critical':c,'warnings':d};}function buildHarnessBlockResult(a,b,c,d,e,f){const g=[...c['map'](i=>'CRITICAL:\x20'+i),...d['map'](i=>'WARN:\x20'+i)]['join']('\x0a'),h='Error:\x20'+b+(g?'\x0a'+g:'')+'\x0aRecovery:\x20'+f;return{'content':[{'type':'text','text':h}],'structuredContent':{'result':{'type':'error','error':b+'\x20[gate='+a+']','error_code':e,'retryable':![],'recovery_hint':f},'message':h}};}function extractCriticalFindingCount(a){const b=a?.['structuredContent'];if(!b)return 0x0;const c=b['semantic'],d=c?.['summary'];if(typeof d?.['critical_count']==='number'&&d['critical_count']>0x0)return d['critical_count'];const e=b['findings']??c?.['findings'];if(Array['isArray'](e))return e['filter'](h=>h?.['severity']==='error')['length'];const f=a?.['content']?.['map'](h=>'text'in h?h['text']:'')['join']('\x0a')??'',g=f['match'](/\[AUDIT ERROR\]/g);return g?g['length']:0x0;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wowok/agent-mcp",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"license": "Apache-2.0",
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
53
|
-
"@wowok/wowok": "3.0.
|
|
53
|
+
"@wowok/wowok": "3.0.7",
|
|
54
54
|
"lodash": "^4.18.1",
|
|
55
55
|
"zod": "^4.2.0"
|
|
56
56
|
},
|