@wowok/agent-mcp 3.0.2 → 3.0.3
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/LICENSE +0 -3
- package/dist/harness/recover.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/knowledge/account-marks.js +1 -1
- package/dist/knowledge/arbitration-risk.js +1 -1
- package/dist/knowledge/flywheel-loop.d.ts +4 -52
- package/dist/knowledge/flywheel-loop.js +1 -1
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/index.d.ts +2 -225
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/machine-risk.js +1 -1
- package/dist/knowledge/machine-translation.js +1 -1
- package/dist/knowledge/onchain-constants.js +1 -1
- package/dist/knowledge/order-ledger.d.ts +2 -2
- package/dist/knowledge/order-ledger.js +1 -1
- package/dist/knowledge/order-puzzle.d.ts +4 -4
- package/dist/knowledge/order-puzzle.js +1 -1
- package/dist/knowledge/order-risk.d.ts +1 -0
- package/dist/knowledge/order-risk.js +1 -1
- package/dist/knowledge/order-templates.d.ts +1 -1
- package/dist/knowledge/order-templates.js +1 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-risk.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workspace-lists.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/context-assembly.d.ts +3 -1
- package/dist/playbooks/service-build/context-assembly.js +1 -1
- package/dist/playbooks/service-build/machine-nodes.d.ts +2 -0
- package/dist/playbooks/service-build/machine-nodes.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.d.ts +7 -0
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/review/machine.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/call/base.d.ts +12 -3
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +4 -0
- package/dist/schema/call/bridge.js +1 -1
- package/dist/schema/call/error-codes.d.ts +2 -0
- package/dist/schema/call/error-codes.js +1 -0
- package/dist/schema/call/guard.d.ts +4 -4
- package/dist/schema/call/semantic.d.ts +9 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/goal/index.d.ts +3 -3
- package/dist/schema/goal/planning.d.ts +2 -2
- package/dist/schema/industry-pack/index.d.ts +4 -4
- package/dist/schema/industry-pack/modes.d.ts +4 -4
- package/dist/schema/local/index.d.ts +558 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +25 -25
- package/dist/schema/operations.d.ts +1 -1
- package/dist/schema/persona/index.d.ts +2 -2
- package/dist/schema/query/bi.d.ts +0 -4
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/trust/index.d.ts +3 -3
- package/dist/schema/workspace/index.d.ts +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +4 -0
- package/dist/schemas/bridge_operation.output.json +4 -0
- package/dist/schemas/index.json +7 -1
- package/dist/schemas/local_history_operation.output.json +1458 -0
- package/dist/schemas/local_history_operation.schema.json +105 -0
- package/dist/schemas/local_info_operation.output.json +4 -0
- package/dist/schemas/local_mark_operation.output.json +4 -0
- package/dist/schemas/onchain_operations.output.json +4 -1
- package/dist/schemas/onchain_operations.schema.json +30 -10
- package/dist/schemas/onchain_operations_guard.schema.json +30 -10
- package/dist/schemas/query_toolkit.output.json +17 -16
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/local.d.ts +1 -0
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/local.js +1 -1
- package/dist/tools/shared.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
- package/dist/knowledge/allocation-confirm.d.ts +0 -115
- package/dist/knowledge/allocation-confirm.js +0 -1
- package/dist/knowledge/allocation-context.d.ts +0 -58
- package/dist/knowledge/allocation-context.js +0 -1
- package/dist/knowledge/allocation-translation.d.ts +0 -72
- package/dist/knowledge/allocation-translation.js +0 -1
- package/dist/knowledge/arb-confirm.d.ts +0 -28
- package/dist/knowledge/arb-confirm.js +0 -1
- package/dist/knowledge/arb-translation.d.ts +0 -48
- package/dist/knowledge/arb-translation.js +0 -1
- package/dist/knowledge/arbitration-confirm.d.ts +0 -135
- package/dist/knowledge/arbitration-confirm.js +0 -1
- package/dist/knowledge/arbitration-context.d.ts +0 -81
- package/dist/knowledge/arbitration-context.js +0 -1
- package/dist/knowledge/arbitration-translation.d.ts +0 -91
- package/dist/knowledge/arbitration-translation.js +0 -1
- package/dist/knowledge/bridge-confirm.d.ts +0 -26
- package/dist/knowledge/bridge-confirm.js +0 -1
- package/dist/knowledge/bridge-translation.d.ts +0 -37
- package/dist/knowledge/bridge-translation.js +0 -1
- package/dist/knowledge/contact-confirm.d.ts +0 -27
- package/dist/knowledge/contact-confirm.js +0 -1
- package/dist/knowledge/contact-translation.d.ts +0 -39
- package/dist/knowledge/contact-translation.js +0 -1
- package/dist/knowledge/demand-confirm.d.ts +0 -32
- package/dist/knowledge/demand-confirm.js +0 -1
- package/dist/knowledge/demand-context.d.ts +0 -17
- package/dist/knowledge/demand-context.js +0 -1
- package/dist/knowledge/demand-ledger.d.ts +0 -26
- package/dist/knowledge/demand-ledger.js +0 -1
- package/dist/knowledge/demand-puzzle.d.ts +0 -29
- package/dist/knowledge/demand-puzzle.js +0 -1
- package/dist/knowledge/demand-templates.d.ts +0 -12
- package/dist/knowledge/demand-templates.js +0 -1
- package/dist/knowledge/demand-translation.d.ts +0 -55
- package/dist/knowledge/demand-translation.js +0 -1
- package/dist/knowledge/examples-scanner-cli.d.ts +0 -1
- package/dist/knowledge/examples-scanner-cli.js +0 -1
- package/dist/knowledge/examples-scanner.d.ts +0 -121
- package/dist/knowledge/examples-scanner.js +0 -1
- package/dist/knowledge/glossary.d.ts +0 -18
- package/dist/knowledge/glossary.js +0 -1
- package/dist/knowledge/guard-bytecode-spec.d.ts +0 -82
- package/dist/knowledge/guard-bytecode-spec.js +0 -1
- package/dist/knowledge/guard-confirm.d.ts +0 -86
- package/dist/knowledge/guard-confirm.js +0 -1
- package/dist/knowledge/immutability.d.ts +0 -11
- package/dist/knowledge/immutability.js +0 -1
- package/dist/knowledge/machine-confirm.d.ts +0 -102
- package/dist/knowledge/machine-confirm.js +0 -1
- package/dist/knowledge/machine-context.d.ts +0 -160
- package/dist/knowledge/machine-context.js +0 -1
- package/dist/knowledge/machine-render.d.ts +0 -41
- package/dist/knowledge/machine-render.js +0 -1
- package/dist/knowledge/mcp-schema-audit-cli.d.ts +0 -1
- package/dist/knowledge/mcp-schema-audit-cli.js +0 -1
- package/dist/knowledge/mcp-schema-audit.d.ts +0 -91
- package/dist/knowledge/mcp-schema-audit.js +0 -1
- package/dist/knowledge/messenger-guard-guidance.d.ts +0 -17
- package/dist/knowledge/messenger-guard-guidance.js +0 -1
- package/dist/knowledge/order-confirm.d.ts +0 -115
- package/dist/knowledge/order-confirm.js +0 -1
- package/dist/knowledge/order-context.d.ts +0 -66
- package/dist/knowledge/order-context.js +0 -1
- package/dist/knowledge/order-translation.d.ts +0 -78
- package/dist/knowledge/order-translation.js +0 -1
- package/dist/knowledge/overrides-loader.d.ts +0 -13
- package/dist/knowledge/overrides-loader.js +0 -1
- package/dist/knowledge/passport-confirm.d.ts +0 -130
- package/dist/knowledge/passport-confirm.js +0 -1
- package/dist/knowledge/passport-context.d.ts +0 -59
- package/dist/knowledge/passport-context.js +0 -1
- package/dist/knowledge/passport-puzzle.d.ts +0 -108
- package/dist/knowledge/passport-puzzle.js +0 -1
- package/dist/knowledge/passport-risk.d.ts +0 -70
- package/dist/knowledge/passport-risk.js +0 -1
- package/dist/knowledge/passport-translation.d.ts +0 -68
- package/dist/knowledge/passport-translation.js +0 -1
- package/dist/knowledge/payment-confirm.d.ts +0 -26
- package/dist/knowledge/payment-confirm.js +0 -1
- package/dist/knowledge/payment-translation.d.ts +0 -37
- package/dist/knowledge/payment-translation.js +0 -1
- package/dist/knowledge/permission-confirm.d.ts +0 -110
- package/dist/knowledge/permission-confirm.js +0 -1
- package/dist/knowledge/permission-context.d.ts +0 -69
- package/dist/knowledge/permission-context.js +0 -1
- package/dist/knowledge/permission-translation.d.ts +0 -57
- package/dist/knowledge/permission-translation.js +0 -1
- package/dist/knowledge/personal-confirm.d.ts +0 -29
- package/dist/knowledge/personal-confirm.js +0 -1
- package/dist/knowledge/personal-translation.d.ts +0 -37
- package/dist/knowledge/personal-translation.js +0 -1
- package/dist/knowledge/process-model.d.ts +0 -14
- package/dist/knowledge/process-model.js +0 -1
- package/dist/knowledge/progress-confirm.d.ts +0 -108
- package/dist/knowledge/progress-confirm.js +0 -1
- package/dist/knowledge/progress-context.d.ts +0 -123
- package/dist/knowledge/progress-context.js +0 -1
- package/dist/knowledge/progress-translation.d.ts +0 -52
- package/dist/knowledge/progress-translation.js +0 -1
- package/dist/knowledge/proof-confirm.d.ts +0 -31
- package/dist/knowledge/proof-confirm.js +0 -1
- package/dist/knowledge/proof-context.d.ts +0 -17
- package/dist/knowledge/proof-context.js +0 -1
- package/dist/knowledge/proof-ledger.d.ts +0 -34
- package/dist/knowledge/proof-ledger.js +0 -1
- package/dist/knowledge/proof-puzzle.d.ts +0 -35
- package/dist/knowledge/proof-puzzle.js +0 -1
- package/dist/knowledge/proof-templates.d.ts +0 -22
- package/dist/knowledge/proof-templates.js +0 -1
- package/dist/knowledge/proof-translation.d.ts +0 -52
- package/dist/knowledge/proof-translation.js +0 -1
- package/dist/knowledge/registrar-confirm.d.ts +0 -26
- package/dist/knowledge/registrar-confirm.js +0 -1
- package/dist/knowledge/registrar-translation.d.ts +0 -37
- package/dist/knowledge/registrar-translation.js +0 -1
- package/dist/knowledge/repository-confirm.d.ts +0 -40
- package/dist/knowledge/repository-confirm.js +0 -1
- package/dist/knowledge/repository-context.d.ts +0 -12
- package/dist/knowledge/repository-context.js +0 -1
- package/dist/knowledge/repository-ledger.d.ts +0 -25
- package/dist/knowledge/repository-ledger.js +0 -1
- package/dist/knowledge/repository-puzzle.d.ts +0 -30
- package/dist/knowledge/repository-puzzle.js +0 -1
- package/dist/knowledge/repository-templates.d.ts +0 -14
- package/dist/knowledge/repository-templates.js +0 -1
- package/dist/knowledge/repository-translation.d.ts +0 -58
- package/dist/knowledge/repository-translation.js +0 -1
- package/dist/knowledge/resource-confirm.d.ts +0 -25
- package/dist/knowledge/resource-confirm.js +0 -1
- package/dist/knowledge/resource-translation.d.ts +0 -37
- package/dist/knowledge/resource-translation.js +0 -1
- package/dist/knowledge/reward-confirm.d.ts +0 -116
- package/dist/knowledge/reward-confirm.js +0 -1
- package/dist/knowledge/reward-context.d.ts +0 -127
- package/dist/knowledge/reward-context.js +0 -1
- package/dist/knowledge/reward-translation.d.ts +0 -58
- package/dist/knowledge/reward-translation.js +0 -1
- package/dist/knowledge/service-confirm.d.ts +0 -161
- package/dist/knowledge/service-confirm.js +0 -1
- package/dist/knowledge/service-context.d.ts +0 -66
- package/dist/knowledge/service-context.js +0 -1
- package/dist/knowledge/service-translation.d.ts +0 -103
- package/dist/knowledge/service-translation.js +0 -1
- package/dist/knowledge/treasury-confirm.d.ts +0 -133
- package/dist/knowledge/treasury-confirm.js +0 -1
- package/dist/knowledge/treasury-context.d.ts +0 -64
- package/dist/knowledge/treasury-context.js +0 -1
- package/dist/knowledge/treasury-translation.d.ts +0 -78
- package/dist/knowledge/treasury-translation.js +0 -1
- package/dist/knowledge/util-confirm.d.ts +0 -24
- package/dist/knowledge/util-confirm.js +0 -1
- package/dist/knowledge/util-translation.d.ts +0 -39
- package/dist/knowledge/util-translation.js +0 -1
- package/dist/loop-engineering/aggregate.d.ts +0 -50
- package/dist/loop-engineering/aggregate.js +0 -1
- package/dist/loop-engineering/context-collect.d.ts +0 -7
- package/dist/loop-engineering/context-collect.js +0 -1
- package/dist/loop-engineering/diagnose.d.ts +0 -22
- package/dist/loop-engineering/diagnose.js +0 -1
- package/dist/loop-engineering/improve.d.ts +0 -55
- package/dist/loop-engineering/improve.js +0 -1
- package/dist/loop-engineering/index.d.ts +0 -4
- package/dist/loop-engineering/index.js +0 -1
- package/dist/loop-engineering/pipeline.d.ts +0 -17
- package/dist/loop-engineering/pipeline.js +0 -1
- package/dist/schema/utils/object-type-utils.d.ts +0 -12
- package/dist/schema/utils/object-type-utils.js +0 -1
- package/dist/telemetry/index.d.ts +0 -19
- package/dist/telemetry/index.js +0 -1
- package/dist/telemetry/redact.d.ts +0 -2
- package/dist/telemetry/redact.js +0 -1
- package/dist/telemetry/storage.d.ts +0 -8
- package/dist/telemetry/storage.js +0 -1
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}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='';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.'),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=>{try{return await withTimeout(a(e),b,c);}catch(f){if(d){const g=f instanceof Error?f['message']:String(f),h=classifyError(g),i={'operation_type':c,'data':e},j=d(g,h,i);return{'content':[{'type':'text','text':'Error:\x20'+g}],'structuredContent':j};}throw f;}};}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=>{const f=[],g=getHarness(),h=shouldRunLightHooks(),i=shouldRunHeavyHooks(),j=isPublishOperation(b,d),k=isSignOperation(b,d),l=getHarnessTier();let m;if(h)try{const o=extractOperationType(b,d),p=extractIntent(b,d);o&&p&&(m=g['expect'](b,p,o,extractData(d)));}catch(q){f['push']('pre_call\x20hook\x20failed:\x20'+(q instanceof Error?q['message']:String(q)));}if(b==='goal_operation'&&h)try{const r=d,s=r?.['action'],t=r?.['project'],u=r?.['version'];if(s&&t&&u){const v=checkProjectStage(s,t,u);v&&f['push'](v);}}catch{}j&&l==='lightweight'&&(setHarnessTier('full'),f['push']('pre_publish:\x20tier\x20forced\x20to\x20full\x20for\x20publish-class\x20operation\x20(GLM5-21\x20§3.3)'));if(j&&l!=='off')try{const x=runPrePublishChecks(b,d);f['push'](...x['warnings']);if(x['critical']['length']>0x0){for(const y of x['critical']){const z=recordCriticalRisk(y);if(z)f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+z['reason']);}return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20Harness\x20pre-publish\x20gate\x20(GLM5-21\x20V6):\x20'+(x['critical']['length']+'\x20CRITICAL\x20risk(s)\x20must\x20be\x20resolved\x20before\x20publish.'),x['critical'],x['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(A){f['push']('pre_publish\x20hook\x20failed:\x20'+(A instanceof Error?A['message']:String(A)));}if(k&&i)try{const B=extractData(d),C=B?extractAmount(B):null;if(C!==null){const D=getAmountThreshold();let E=null;try{E=BigInt(C);}catch{E=null;}if(E!==null&&E>D)return buildHarnessBlockResult('pre_sign','Sign\x20BLOCKED\x20by\x20Harness\x20pre-sign\x20gate\x20(GLM5-21\x20V7):\x20amount\x20'+formatAmount(E)+'\x20WOW\x20exceeds\x20the\x20full-tier\x20threshold\x20'+formatAmount(D)+'\x20WOW.',['amount\x20'+C+'\x20(smallest\x20unit)\x20>\x20threshold\x20'+D['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(F){f['push']('pre_sign\x20hook\x20failed:\x20'+(F instanceof Error?F['message']:String(F)));}let n;try{n=await a(d);}catch(G){const H=G instanceof Error?G['message']:String(G),I=recordOperationFailure(b,H);I&&f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+I['reason']);if(b==='onchain_operations')try{const J=classifyError(H,G);if(!J['retryable']&&J['error_code']!=='unknown'){const K=recordCriticalOperation(b,J['error_code']);if(K)f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+K['reason']);}}catch{}throw G;}if(h&&m)try{if(n?.['structuredContent']){const L=buildVerifyInput(m,n),M=g['verify'](L);if(M['status']==='fail')f['push']('Harness\x20verify\x20FAIL:\x20'+M['summary']);else M['status']==='warn'&&f['push']('Harness\x20verify\x20WARN:\x20'+M['summary']);}}catch(N){f['push']('post_call\x20hook\x20failed:\x20'+(N instanceof Error?N['message']:String(N)));}if(b==='onchain_operations')try{if(classifyOutcome(n)==='failed'){const O=extractErrorCode(n)??'',P=classifyError(O);if(!P['retryable']&&P['error_code']!=='unknown'){const Q=recordCriticalOperation(b,P['error_code']);if(Q)f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Q['reason']);}}}catch{}if(h){const R=extractIntent(b,d)??b;try{const S=classifyOutcome(n);if(S==='failed'){const T=extractErrorCode(n)??'',U=classifyError(T),V=g['recover'](U['error_code'],R,{'operation_type':b,'data':extractData(d)});f['push']('Harness\x20recover:\x20strategy='+V['strategy']+('\x20(attempt\x20'+V['current_attempt']+'/'+V['max_attempts']+')')+(V['should_retry']?'\x20—\x20retryable':'\x20—\x20do\x20NOT\x20retry\x20blindly')+(V['user_prompt']?'\x20—\x20'+V['user_prompt']:'\x20—\x20'+V['detail']));}else S==='success'&&g['resetRecovery'](R);}catch(W){f['push']('recover\x20hook\x20failed:\x20'+(W instanceof Error?W['message']:String(W)));}}if(b==='goal_operation')try{const X=d?.['action'];if(X==='trace_substeps'){const Y=extractCriticalFindingCount(n);if(Y>0x0){const Z=recordSubstepFailure(String(X)+':\x20'+Y+'\x20critical\x20finding(s)');if(Z)f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Z['reason']);}}}catch{}if(isWriteClassTool(b))try{const a0=extractOperationType(b,d)??b,a1=extractIntent(b,d)??b,a2=extractData(d)??d,a3=classifyOutcome(n),a4=extractErrorCode(n),a5=extractIndustry(d)??'general';recordOperationOutcome(a0,a2,a1,a3,a4),recordIndustrySignal(a5,{'type':a0},{'success':a3==='success','error_code':a4});}catch(a6){f['push']('signal\x20collection\x20failed:\x20'+(a6 instanceof Error?a6['message']:String(a6)));}if(f['length']>0x0){if(n?.['structuredContent']){const a7=n['structuredContent'],a8=a7['semantic'];if(a8){const a9=Array['isArray'](a8['warnings'])?a8['warnings']:[];a8['warnings']=[...a9,...f];}else for(const aa of f){console['warn']('[harness]\x20'+aa);}}else for(const ab of f){console['warn']('[harness]\x20'+ab);}}return n;};}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']);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='';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.'),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=>{try{return await withTimeout(a(e),b,c);}catch(f){if(d){const g=f instanceof Error?f['message']:String(f),h=classifyError(g),i={'operation_type':c,'data':e},j=d(g,h,i);return{'content':[{'type':'text','text':'Error:\x20'+g}],'structuredContent':j};}throw f;}};}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=>{const f=[],g=getHarness(),h=shouldRunLightHooks(),i=shouldRunHeavyHooks(),j=isPublishOperation(b,d),k=isSignOperation(b,d),l=getHarnessTier();let m;if(h)try{const o=extractOperationType(b,d),p=extractIntent(b,d);o&&p&&(m=g['expect'](b,p,o,extractData(d)));}catch(q){f['push']('pre_call\x20hook\x20failed:\x20'+(q instanceof Error?q['message']:String(q)));}if(b==='goal_operation'&&h)try{const r=d,s=r?.['action'],t=r?.['project'],u=r?.['version'];if(s&&t&&u){const v=checkProjectStage(s,t,u);v&&f['push'](v);}}catch{}j&&l==='lightweight'&&(setHarnessTier('full'),f['push']('pre_publish:\x20tier\x20forced\x20to\x20full\x20for\x20publish-class\x20operation\x20(GLM5-21\x20§3.3)'));if(j&&l!=='off')try{const x=runPrePublishChecks(b,d);f['push'](...x['warnings']);if(x['critical']['length']>0x0){for(const y of x['critical']){const z=recordCriticalRisk(y);if(z)f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+z['reason']);}return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20Harness\x20pre-publish\x20gate\x20(GLM5-21\x20V6):\x20'+(x['critical']['length']+'\x20CRITICAL\x20risk(s)\x20must\x20be\x20resolved\x20before\x20publish.'),x['critical'],x['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(A){f['push']('pre_publish\x20hook\x20failed:\x20'+(A instanceof Error?A['message']:String(A)));}if(k&&i)try{const B=extractData(d),C=B?extractAmount(B):null;if(C!==null){const D=getAmountThreshold();let E=null;try{E=BigInt(C);}catch{E=null;}if(E!==null&&E>D)return buildHarnessBlockResult('pre_sign','Sign\x20BLOCKED\x20by\x20Harness\x20pre-sign\x20gate\x20(GLM5-21\x20V7):\x20amount\x20'+formatAmount(E)+'\x20WOW\x20exceeds\x20the\x20full-tier\x20threshold\x20'+formatAmount(D)+'\x20WOW.',['amount\x20'+C+'\x20(smallest\x20unit)\x20>\x20threshold\x20'+D['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(F){f['push']('pre_sign\x20hook\x20failed:\x20'+(F instanceof Error?F['message']:String(F)));}let n;try{n=await a(d);}catch(G){const H=G instanceof Error?G['message']:String(G),I=recordOperationFailure(b,H);I&&f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+I['reason']);if(b==='onchain_operations')try{const J=classifyError(H,G);if(!J['retryable']&&J['error_code']!=='unknown'){const K=recordCriticalOperation(b,J['error_code']);if(K)f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+K['reason']);}}catch{}throw G;}if(h&&m)try{if(n?.['structuredContent']){const L=buildVerifyInput(m,n),M=g['verify'](L);if(M['status']==='fail')f['push']('Harness\x20verify\x20FAIL:\x20'+M['summary']);else M['status']==='warn'&&f['push']('Harness\x20verify\x20WARN:\x20'+M['summary']);}}catch(N){f['push']('post_call\x20hook\x20failed:\x20'+(N instanceof Error?N['message']:String(N)));}if(b==='onchain_operations')try{if(classifyOutcome(n)==='failed'){const O=extractErrorCode(n)??'',P=classifyError(O);if(!P['retryable']&&P['error_code']!=='unknown'){const Q=recordCriticalOperation(b,P['error_code']);if(Q)f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Q['reason']);}}}catch{}if(h){const R=extractIntent(b,d)??b;try{const S=classifyOutcome(n);if(S==='failed'){const T=extractErrorCode(n)??'',U=classifyError(T),V=g['recover'](U['error_code'],R,{'operation_type':b,'data':extractData(d)});f['push']('Harness\x20recover:\x20strategy='+V['strategy']+('\x20(attempt\x20'+V['current_attempt']+'/'+V['max_attempts']+')')+(V['should_retry']?'\x20—\x20retryable':'\x20—\x20do\x20NOT\x20retry\x20blindly')+(V['user_prompt']?'\x20—\x20'+V['user_prompt']:'\x20—\x20'+V['detail']));}else S==='success'&&g['resetRecovery'](R);}catch(W){f['push']('recover\x20hook\x20failed:\x20'+(W instanceof Error?W['message']:String(W)));}}if(b==='goal_operation')try{const X=d?.['action'];if(X==='trace_substeps'){const Y=extractCriticalFindingCount(n);if(Y>0x0){const Z=recordSubstepFailure(String(X)+':\x20'+Y+'\x20critical\x20finding(s)');if(Z)f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Z['reason']);}}}catch{}if(isWriteClassTool(b)&&!SEMANTIC_RECORDED_TOOLS['has'](b))try{const a0=extractOperationType(b,d)??b,a1=extractIntent(b,d)??b,a2=extractData(d)??d,a3=classifyOutcome(n),a4=extractErrorCode(n),a5=isEnabled('experience_layer');if(a5)recordOperationOutcome(a0,a2,a1,a3,a4);else{const a6=extractIndustry(d);a6&&isEnabled('industry_evolution')&&recordIndustrySignal(a6,{'type':a0},{'success':a3==='success','error_code':a4});}}catch(a7){f['push']('signal\x20collection\x20failed:\x20'+(a7 instanceof Error?a7['message']:String(a7)));}if(f['length']>0x0){if(n?.['structuredContent']){const a8=n['structuredContent'],a9=a8['semantic'];if(a9){const aa=Array['isArray'](a9['warnings'])?a9['warnings']:[];a9['warnings']=[...aa,...f];}else for(const ab of f){console['warn']('[harness]\x20'+ab);}}else for(const ac of f){console['warn']('[harness]\x20'+ac);}}return n;};}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;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wowok/agent-mcp",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
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.5",
|
|
54
54
|
"lodash": "^4.18.1",
|
|
55
55
|
"zod": "^4.2.0"
|
|
56
56
|
},
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { type AllocationRiskAssessment } from "./allocation-risk.js";
|
|
2
|
-
export type ConfirmGateStatus = "approved" | "blocked_checklist" | "blocked_risk" | "blocked_user" | "blocked_environment";
|
|
3
|
-
export interface ConfirmGateResult {
|
|
4
|
-
status: ConfirmGateStatus;
|
|
5
|
-
checklist_result: ChecklistResult;
|
|
6
|
-
risk_result?: AllocationRiskAssessment;
|
|
7
|
-
user_confirmation?: UserConfirmation;
|
|
8
|
-
environment_result?: EnvironmentResult;
|
|
9
|
-
confirmation_text?: string;
|
|
10
|
-
block_reason?: string;
|
|
11
|
-
decision_record: DecisionRecord;
|
|
12
|
-
}
|
|
13
|
-
export interface ChecklistResult {
|
|
14
|
-
all_passed: boolean;
|
|
15
|
-
items: ChecklistItem[];
|
|
16
|
-
}
|
|
17
|
-
export interface ChecklistItem {
|
|
18
|
-
id: string;
|
|
19
|
-
description: string;
|
|
20
|
-
passed: boolean;
|
|
21
|
-
message: string;
|
|
22
|
-
}
|
|
23
|
-
export interface UserConfirmation {
|
|
24
|
-
questions_asked: ConfirmationQuestion[];
|
|
25
|
-
responses: ConfirmationResponse[];
|
|
26
|
-
all_confirmed: boolean;
|
|
27
|
-
}
|
|
28
|
-
export interface ConfirmationQuestion {
|
|
29
|
-
id: string;
|
|
30
|
-
question: string;
|
|
31
|
-
requires_explicit_yes: boolean;
|
|
32
|
-
related_risk_ids?: string[];
|
|
33
|
-
}
|
|
34
|
-
export interface ConfirmationResponse {
|
|
35
|
-
question_id: string;
|
|
36
|
-
response: "yes" | "no" | "skip";
|
|
37
|
-
}
|
|
38
|
-
export interface EnvironmentResult {
|
|
39
|
-
passed: boolean;
|
|
40
|
-
checks: {
|
|
41
|
-
name: string;
|
|
42
|
-
passed: boolean;
|
|
43
|
-
message: string;
|
|
44
|
-
}[];
|
|
45
|
-
}
|
|
46
|
-
export interface DecisionRecord {
|
|
47
|
-
timestamp: string;
|
|
48
|
-
gate_version: string;
|
|
49
|
-
final_status: ConfirmGateStatus;
|
|
50
|
-
layers_passed: string[];
|
|
51
|
-
layers_failed: string[];
|
|
52
|
-
}
|
|
53
|
-
export interface AllocationJsonForConfirm {
|
|
54
|
-
object?: {
|
|
55
|
-
name: string;
|
|
56
|
-
type_parameter?: string;
|
|
57
|
-
} | string | null;
|
|
58
|
-
allocators?: {
|
|
59
|
-
description: string;
|
|
60
|
-
threshold: string | number;
|
|
61
|
-
allocators: {
|
|
62
|
-
guard: string;
|
|
63
|
-
sharing: {
|
|
64
|
-
who: {
|
|
65
|
-
GuardIdentifier: number;
|
|
66
|
-
} | {
|
|
67
|
-
Entity: string;
|
|
68
|
-
} | {
|
|
69
|
-
Signer: "signer";
|
|
70
|
-
};
|
|
71
|
-
sharing: string | number;
|
|
72
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
73
|
-
}[];
|
|
74
|
-
fix?: string | number;
|
|
75
|
-
max?: string | number | null;
|
|
76
|
-
}[];
|
|
77
|
-
};
|
|
78
|
-
coin?: {
|
|
79
|
-
name?: string;
|
|
80
|
-
address?: string;
|
|
81
|
-
} | string;
|
|
82
|
-
payment_info?: object;
|
|
83
|
-
received_coins?: {
|
|
84
|
-
token_type: string;
|
|
85
|
-
received: {
|
|
86
|
-
id: string;
|
|
87
|
-
payment: string;
|
|
88
|
-
}[];
|
|
89
|
-
};
|
|
90
|
-
alloc_by_guard?: string;
|
|
91
|
-
}
|
|
92
|
-
export interface ConfirmGateInput {
|
|
93
|
-
allocation_json: AllocationJsonForConfirm;
|
|
94
|
-
intent?: string;
|
|
95
|
-
operation_type?: "create" | "receive" | "alloc_by_guard" | "query";
|
|
96
|
-
guard_signer_bindings?: Record<string, boolean>;
|
|
97
|
-
order_already_has_allocation?: boolean;
|
|
98
|
-
bound_order?: string;
|
|
99
|
-
guard_conditions_mutually_exclusive?: boolean;
|
|
100
|
-
referenced_treasuries_permissions?: Record<string, string>;
|
|
101
|
-
passport_identifier_types?: Record<number, string>;
|
|
102
|
-
skip_user_confirmation?: boolean;
|
|
103
|
-
skip_environment_check?: boolean;
|
|
104
|
-
}
|
|
105
|
-
export declare const ALLOCATION_PUBLISH_CHECKLIST: ChecklistItem[];
|
|
106
|
-
export declare const ALLOCATION_CONFIRMATION_QUESTIONS: ConfirmationQuestion[];
|
|
107
|
-
export declare const ALLOCATION_CONFIRM_VERSION = "1.0.0";
|
|
108
|
-
export declare function runAllocationConfirmGate(input: ConfirmGateInput): ConfirmGateResult;
|
|
109
|
-
export interface ProgressiveCheckResult {
|
|
110
|
-
stage: "checklist" | "risk" | "confirmation" | "environment" | "complete";
|
|
111
|
-
status: "pass" | "fail" | "pending";
|
|
112
|
-
message: string;
|
|
113
|
-
next_action?: string;
|
|
114
|
-
}
|
|
115
|
-
export declare function progressiveAllocationCheck(input: ConfirmGateInput): ProgressiveCheckResult;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MAX_ALLOCATOR_COUNT,ALLOCATION_MAX_SHARING_COUNT,RATE_TOTAL_FULL,ALLOCATION_ERROR_CODES,isSignerRecipient,isEntityRecipient}from'./allocation-ledger.js';import{assessAllocationRisks}from'./allocation-risk.js';export const ALLOCATION_PUBLISH_CHECKLIST=[{'id':'C-A-01','description':'Allocator\x20count\x20<=\x20MAX_ALLOCATOR_COUNT\x20(100)','passed':![],'message':''},{'id':'C-A-02','description':'Sharing\x20count\x20per\x20Allocator\x20<=\x20MAX_SHARING_COUNT\x20(100)','passed':![],'message':''},{'id':'C-A-03','description':'At\x20most\x201\x20Surplus\x20sharing\x20per\x20Allocator\x20(EMULTIPLE_SURPLUS)','passed':![],'message':''},{'id':'C-A-04','description':'Pure\x20Rate\x20mode\x20sum(rates)\x20==\x2010000\x20(ERATE_NOT_10000)\x20OR\x20Rate+Surplus\x20sum\x20<=\x2010000\x20(ERATE_EXCEEDS_10000)','passed':![],'message':''},{'id':'C-A-05','description':'Pure\x20Amount\x20mode\x20sum(fix)\x20>=\x20threshold\x20(EAMOUNT_BELOW_THRESHOLD)','passed':![],'message':''},{'id':'C-A-06','description':'Amount\x20sum(fix)\x20<=\x20max\x20when\x20max\x20is\x20set\x20(EAMOUNT_EXCEEDS_MAX)','passed':![],'message':''},{'id':'C-A-07','description':'allocators[].guard\x20unique\x20within\x20the\x20same\x20Allocators\x20(F-A-14)','passed':![],'message':''},{'id':'C-A-08','description':'Guard\x20addresses\x20valid\x20(0x\x20prefix,\x20length\x20>=\x2040)','passed':![],'message':''},{'id':'C-A-09','description':'Entity\x20addresses\x20valid\x20(0x\x20prefix,\x20length\x20>=\x2040)','passed':![],'message':''},{'id':'C-A-10','description':'Signer\x20recipients\x20have\x20Guard\x20Signer\x20binding\x20(R-A-2-01\x20CRITICAL\x20theft\x20risk)','passed':![],'message':''},{'id':'C-A-11','description':'payment_info\x20present\x20(required\x20at\x20alloc()\x20time\x20—\x20ENO_PAYMENT_INFO)','passed':![],'message':''},{'id':'C-A-12','description':'coin\x20type\x20matches\x20type_parameter\x20(EINSUFFICIENT_BALANCE\x20if\x20mismatch)','passed':![],'message':''}];function isValidAddress(a){return typeof a==='string'&&a['startsWith']('0x')&&a['length']>=0x28;}function runStaticChecklist(b){const c=ALLOCATION_PUBLISH_CHECKLIST['map'](R=>({...R})),d=b['allocation_json'],e=d['object']!==null&&d['object']!==undefined&&typeof d['object']==='object'&&!Array['isArray'](d['object']);if(!e){for(const R of c)R['passed']=!![];if(typeof d['object']==='string'){const S=isValidAddress(d['object']);c['find'](T=>T['id']==='C-A-08')['passed']=S,c['find'](T=>T['id']==='C-A-08')['message']=S?'':'Allocation\x20object\x20address\x20'+d['object']+'\x20invalid';}if(d['alloc_by_guard']!==undefined){const T=isValidAddress(d['alloc_by_guard']);c['find'](U=>U['id']==='C-A-09')['passed']=T,c['find'](U=>U['id']==='C-A-09')['message']=T?'':'alloc_by_guard\x20address\x20'+d['alloc_by_guard']+'\x20invalid';}return{'all_passed':c['every'](U=>U['passed']),'items':c};}const f=d['allocators'];if(!f){for(const U of c){U['id']['startsWith']('C-A-0')?(U['passed']=![],U['message']='Missing\x20required\x20field:\x20allocators'):U['passed']=!![];}return{'all_passed':![],'items':c};}const g=f['allocators'],h=c['find'](V=>V['id']==='C-A-01');h['passed']=g['length']<=MAX_ALLOCATOR_COUNT,h['message']=h['passed']?'':'Allocator\x20count\x20'+g['length']+'\x20>\x20'+MAX_ALLOCATOR_COUNT;let k=!![],l='';for(let V=0x0;V<g['length'];V++){if(g[V]['sharing']['length']>ALLOCATION_MAX_SHARING_COUNT){k=![],l='Allocator\x20'+V+'\x20sharing\x20count\x20'+g[V]['sharing']['length']+'\x20>\x20'+ALLOCATION_MAX_SHARING_COUNT;break;}}const m=c['find'](W=>W['id']==='C-A-02');m['passed']=k,m['message']=l;let n=!![],o='';for(let W=0x0;W<g['length'];W++){const X=g[W]['sharing']['filter'](Y=>Y['mode']==='Surplus')['length'];if(X>0x1){n=![],o='Allocator\x20'+W+'\x20has\x20'+X+'\x20Surplus\x20(max\x201\x20allowed)';break;}}const p=c['find'](Y=>Y['id']==='C-A-03');p['passed']=n,p['message']=o;let q=!![],r='';for(let Y=0x0;Y<g['length'];Y++){const Z=g[Y],a0=Z['sharing']['filter'](a3=>a3['mode']==='Rate')['reduce']((a3,a4)=>a3+Number(a4['sharing']),0x0),a1=Z['sharing']['some'](a3=>a3['mode']==='Surplus'),a2=Z['sharing']['some'](a3=>a3['mode']==='Rate');if(a2&&!a1&&a0!==RATE_TOTAL_FULL){q=![],r='Allocator\x20'+Y+'\x20pure\x20Rate\x20sum\x20'+a0+'\x20!=\x20'+RATE_TOTAL_FULL;break;}if(a2&&a1&&a0>RATE_TOTAL_FULL){q=![],r='Allocator\x20'+Y+'\x20Rate+Surplus\x20sum\x20'+a0+'\x20>\x20'+RATE_TOTAL_FULL;break;}}const t=c['find'](a3=>a3['id']==='C-A-04');t['passed']=q,t['message']=r;let u=!![],v='';const w=Number(f['threshold']);for(let a3=0x0;a3<g['length'];a3++){const a4=g[a3],a5=a4['sharing']['some'](a8=>a8['mode']==='Rate'),a6=a4['sharing']['some'](a8=>a8['mode']==='Surplus'),a7=a4['sharing']['filter'](a8=>a8['mode']==='Amount')['reduce']((a8,a9)=>a8+Number(a9['sharing']),0x0);if(!a5&&!a6&&a7>0x0&&a7<w){u=![],v='Allocator\x20'+a3+'\x20pure\x20Amount\x20sum\x20'+a7+'\x20<\x20threshold\x20'+w;break;}}const x=c['find'](a8=>a8['id']==='C-A-05');x['passed']=u,x['message']=v;let y=!![],z='';for(let a8=0x0;a8<g['length'];a8++){const a9=g[a8];if(a9['max']==null)continue;const aa=a9['sharing']['filter'](ab=>ab['mode']==='Amount')['reduce']((ab,ac)=>ab+Number(ac['sharing']),0x0);if(aa>Number(a9['max'])){y=![],z='Allocator\x20'+a8+'\x20Amount\x20sum\x20'+aa+'\x20>\x20max\x20'+Number(a9['max']);break;}}const A=c['find'](ab=>ab['id']==='C-A-06');A['passed']=y,A['message']=z;const B=new Set();let C=!![],D='';for(let ab=0x0;ab<g['length'];ab++){if(B['has'](g[ab]['guard'])){C=![],D='Allocator\x20'+ab+'\x20guard\x20'+g[ab]['guard']+'\x20duplicates\x20an\x20earlier\x20Allocator\x20(F-A-14)';break;}B['add'](g[ab]['guard']);}const E=c['find'](ac=>ac['id']==='C-A-07');E['passed']=C,E['message']=D;let F=!![],G='';for(let ac=0x0;ac<g['length'];ac++){if(!isValidAddress(g[ac]['guard'])){F=![],G='Allocator\x20'+ac+'\x20guard\x20address\x20'+g[ac]['guard']+'\x20invalid';break;}}const H=c['find'](ad=>ad['id']==='C-A-08');H['passed']=F,H['message']=G;let I=!![],J='';al:for(let ad=0x0;ad<g['length'];ad++){for(let ae=0x0;ae<g[ad]['sharing']['length'];ae++){const af=g[ad]['sharing'][ae];if(isEntityRecipient(af['who'])){const ag=af['who']['Entity'];if(!isValidAddress(ag)){I=![],J='Allocator\x20'+ad+'\x20sharing\x20'+ae+'\x20Entity\x20address\x20'+ag+'\x20invalid';break al;}}}}const K=c['find'](ah=>ah['id']==='C-A-09');K['passed']=I,K['message']=J;let L=!![],M='';for(let ah=0x0;ah<g['length'];ah++){const ai=g[ah],aj=ai['sharing']['some'](al=>isSignerRecipient(al['who']));if(!aj)continue;const ak=b['guard_signer_bindings']?.[ai['guard']]===!![];if(!ak){L=![],M='Allocator\x20'+ah+'\x20(guard='+ai['guard']+')\x20has\x20Signer\x20recipient\x20but\x20no\x20Guard\x20Signer\x20binding\x20—\x20R-A-2-01\x20CRITICAL\x20theft\x20risk';break;}}const N=c['find'](al=>al['id']==='C-A-10');N['passed']=L,N['message']=M;const O=c['find'](al=>al['id']==='C-A-11');O['passed']=d['payment_info']!==undefined&&d['payment_info']!==null,O['message']=O['passed']?'':'payment_info\x20missing\x20—\x20required\x20at\x20alloc()\x20time\x20(ENO_PAYMENT_INFO=9)';const P=c['find'](al=>al['id']==='C-A-12'),Q=d['object'];if(Q['type_parameter']&&d['coin'])P['passed']=!![],P['message']='';else!Q['type_parameter']?(P['passed']=![],P['message']='type_parameter\x20missing\x20on\x20object'):(P['passed']=![],P['message']='coin\x20missing\x20—\x20required\x20for\x20create');return{'all_passed':c['every'](al=>al['passed']),'items':c};}function adaptRiskAssessment(a,b){const c={'object':typeof a['allocation_json']['object']==='string'?a['allocation_json']['object']:null,'allocators_config':a['allocation_json']['allocators'],'operation_type':a['operation_type']??'create','has_payment_info':a['allocation_json']['payment_info']!==undefined,'host_service_published':!![],'referenced_treasuries_permissions':a['referenced_treasuries_permissions'],'guard_signer_bindings':a['guard_signer_bindings'],'passport_identifier_types':a['passport_identifier_types'],'guard_conditions_mutually_exclusive':a['guard_conditions_mutually_exclusive'],'bound_order':a['bound_order'],'order_already_has_allocation':a['order_already_has_allocation']};return assessAllocationRisks(c);}export const ALLOCATION_CONFIRMATION_QUESTIONS=[{'id':'QA1','question':'Are\x20all\x20Treasury\x20/\x20Entity\x20recipient\x20addresses\x20correctly\x20verified\x20as\x20trusted\x20parties?','requires_explicit_yes':!![]},{'id':'QA2','question':'If\x20using\x20multiple\x20Allocators\x20(caller-specified\x20guard),\x20are\x20Guard\x20conditions\x20mutually\x20exclusive\x20to\x20prevent\x20caller\x20confusion\x20or\x20silent\x20lockup\x20(alloc_by_guard\x20silently\x20returns\x20on\x20no\x20match)?','requires_explicit_yes':!![],'related_risk_ids':['R-A-4-02']},{'id':'QA3','question':'⚠️\x20If\x20using\x20sharing.who=Signer:\x20is\x20the\x20Guard\x20Signer\x20binding\x20verified\x20(context(Signer)==authorized)?\x20Signer\x20without\x20Guard\x20binding\x20=\x20CRITICAL\x20theft\x20risk.','requires_explicit_yes':!![],'related_risk_ids':['R-A-2-01']},{'id':'QA4','question':'If\x20using\x20Amount+Surplus\x20hybrid\x20(refund-first):\x20is\x20threshold\x20set\x20to\x20refund\x20amount\x20(fix)\x20to\x20ensure\x20balance\x20covers\x20the\x20Amount\x20distribution?','requires_explicit_yes':!![],'related_risk_ids':['R-A-1-03']},{'id':'QA5','question':'Is\x20payment_info\x20correctly\x20configured?\x20alloc()\x20will\x20abort\x20with\x20ENO_PAYMENT_INFO\x20(9)\x20if\x20missing.','requires_explicit_yes':!![],'related_risk_ids':['R-A-5-02']},{'id':'QA6','question':'Has\x20the\x20Allocation\x20been\x20tested\x20on\x20testnet?\x20Allocation\x20is\x20a\x20\x27passive\x20object\x27\x20—\x20once\x20created,\x20allocators\x20cannot\x20be\x20reconfigured.','requires_explicit_yes':![]}];function processUserConfirmation(a,b){const c=[...ALLOCATION_CONFIRMATION_QUESTIONS],d=a['allocation_json']['allocators']?.['allocators']['some'](g=>g['sharing']['some'](h=>isSignerRecipient(h['who'])))??![];if(!d){const g=c['findIndex'](h=>h['id']==='QA3');if(g>=0x0)c['splice'](g,0x1);}const e=a['allocation_json']['allocators']?.['allocators']['length']??0x0;if(e<=0x1){const h=c['findIndex'](i=>i['id']==='QA2');if(h>=0x0)c['splice'](h,0x1);}const f=a['allocation_json']['allocators']?.['allocators']['some'](i=>i['sharing']['some'](j=>j['mode']==='Amount')&&i['sharing']['some'](j=>j['mode']==='Surplus'))??![];if(!f){const i=c['findIndex'](j=>j['id']==='QA4');if(i>=0x0)c['splice'](i,0x1);}if(a['skip_user_confirmation'])return{'questions_asked':c,'responses':c['map'](j=>({'question_id':j['id'],'response':'yes'})),'all_confirmed':!![]};return{'questions_asked':c,'responses':[],'all_confirmed':![]};}function verifyEnvironment(a){const b=[];typeof a['allocation_json']['object']==='string'&&b['push']({'name':'object_exists','passed':!![],'message':'Allocation\x20object\x20'+a['allocation_json']['object']+'\x20assumed\x20to\x20exist'});if(a['allocation_json']['alloc_by_guard']){const d=a['allocation_json']['alloc_by_guard'],e=isValidAddress(d);b['push']({'name':'alloc_by_guard_valid','passed':e,'message':e?'Guard\x20'+d+'\x20address\x20valid\x20(SDK\x20will\x20verify\x20it\x20exists\x20in\x20allocators[].guard)':'Guard\x20'+d+'\x20address\x20invalid'});}a['operation_type']==='create'&&b['push']({'name':'signer_authorized','passed':!![],'message':'Signer\x20must\x20hold\x20SERVICE_ORDER_ALLOCATOR=313\x20permission\x20(or\x20ARBITRATION_FEES_ALLOC=365\x20for\x20arbitration\x20fees)'});if(a['bound_order']){const f=a['order_already_has_allocation']===!![];b['push']({'name':'order_allocation_1to1','passed':!f,'message':f?'Order\x20'+a['bound_order']+'\x20already\x20has\x20an\x20Allocation\x20—\x20E_ALLOCATION_ALREADY_SPECIFIED\x20will\x20abort':'Order\x20'+a['bound_order']+'\x20has\x20no\x20Allocation\x20—\x201:1\x20constraint\x20satisfied'});}b['push']({'name':'testnet_test_recommended','passed':!![],'message':'Allocation\x20is\x20a\x20\x27passive\x20object\x27\x20—\x20strongly\x20recommend\x20testnet\x20test\x20before\x20mainnet\x20deployment'});const c=b['every'](g=>g['passed']);return{'passed':c,'checks':b};}export const ALLOCATION_CONFIRM_VERSION='1.0.0';export function runAllocationConfirmGate(a){const b=[],c=[],d=runStaticChecklist(a);if(!d['all_passed'])return c['push']('L1_checklist'),{'status':'blocked_checklist','checklist_result':d,'confirmation_text':generateConfirmationText(a,d),'block_reason':'Checklist\x20failed:\x20'+d['items']['filter'](g=>!g['passed'])['map'](g=>g['id'])['join'](',\x20'),'decision_record':{'timestamp':new Date()['toISOString'](),'gate_version':ALLOCATION_CONFIRM_VERSION,'final_status':'blocked_checklist','layers_passed':b,'layers_failed':c}};b['push']('L1_checklist');const e=adaptRiskAssessment(a,d);if(e['blocks_publish'])return c['push']('L2_risk'),{'status':'blocked_risk','checklist_result':d,'risk_result':e,'confirmation_text':generateConfirmationText(a,d,e),'block_reason':'CRITICAL\x20risks:\x20'+e['risks']['filter'](g=>g['level']==='CRITICAL')['map'](g=>g['id'])['join'](',\x20'),'decision_record':{'timestamp':new Date()['toISOString'](),'gate_version':ALLOCATION_CONFIRM_VERSION,'final_status':'blocked_risk','layers_passed':b,'layers_failed':c}};b['push']('L2_risk');const f=processUserConfirmation(a,e);if(!f['all_confirmed']){}b['push']('L3_user');if(a['skip_environment_check'])b['push']('L4_environment');else{const g=verifyEnvironment(a);if(!g['passed'])return c['push']('L4_environment'),{'status':'blocked_environment','checklist_result':d,'risk_result':e,'user_confirmation':f,'environment_result':g,'confirmation_text':generateConfirmationText(a,d,e),'block_reason':'Environment\x20check\x20failed:\x20'+g['checks']['filter'](h=>!h['passed'])['map'](h=>h['name'])['join'](',\x20'),'decision_record':{'timestamp':new Date()['toISOString'](),'gate_version':ALLOCATION_CONFIRM_VERSION,'final_status':'blocked_environment','layers_passed':b,'layers_failed':c}};b['push']('L4_environment');}return{'status':'approved','checklist_result':d,'risk_result':e,'user_confirmation':f,'confirmation_text':generateConfirmationText(a,d,e),'decision_record':{'timestamp':new Date()['toISOString'](),'gate_version':ALLOCATION_CONFIRM_VERSION,'final_status':'approved','layers_passed':b,'layers_failed':c}};}function generateConfirmationText(a,b,c){const d=[],e=a['allocation_json'];d['push']('═══\x20Allocation\x20Confirmation\x20═══'),d['push']('');const f=e['object']!==null&&e['object']!==undefined&&typeof e['object']==='object';if(f){const g=e['object'];d['push']('Allocation:\x20NEW\x20\x27'+g['name']+'\x27\x20('+(g['type_parameter']??'<missing>')+')');}else typeof e['object']==='string'&&d['push']('Allocation:\x20OPERATE\x20'+e['object']);d['push'](''),d['push']('─\x20Checklist\x20──────────────────');for(const h of b['items']){const i=h['passed']?'✓':'✗';d['push']('\x20\x20'+i+'\x20'+h['id']+':\x20'+h['description']+(h['message']?'\x20—\x20'+h['message']:''));}d['push']('');if(c){d['push']('─\x20Risk\x20Assessment\x20──────────────────'),d['push']('Overall:\x20'+c['overall_risk']),d['push']('Detected:\x20'+c['risks']['length']+'\x20risk(s)');for(const j of c['risks']){d['push']('\x20\x20['+j['level']+']\x20'+j['id']+':\x20'+j['title']);}d['push']('');}return d['push']('─\x20Operations\x20──────────────────'),f&&e['allocators']&&(d['push']('-\x20Description:\x20'+e['allocators']['description']),d['push']('-\x20Threshold:\x20'+e['allocators']['threshold']),d['push']('-\x20Allocators:\x20'+e['allocators']['allocators']['length']),e['allocators']['allocators']['forEach']((k,l)=>{const m=k['sharing']['filter'](p=>p['mode']==='Surplus')['length'],n=k['sharing']['filter'](p=>p['mode']==='Rate')['reduce']((p,q)=>p+Number(q['sharing']),0x0),o=k['sharing']['filter'](p=>p['mode']==='Amount')['reduce']((p,q)=>p+Number(q['sharing']),0x0);d['push']('\x20\x20['+l+']\x20guard='+k['guard']+',\x20sharing='+k['sharing']['length']+'\x20(Rate\x20sum='+n+',\x20Amount\x20sum='+o+',\x20Surplus='+m+'),\x20max='+(k['max']??'null'));})),e['received_coins']&&d['push']('-\x20Receive:\x20'+e['received_coins']['received']['length']+'\x20CoinWrapper\x20deposit(s)'),e['alloc_by_guard']&&d['push']('-\x20Alloc\x20by\x20Guard:\x20'+e['alloc_by_guard']),d['push'](''),d['push']('─\x20Error\x20Code\x20Reference\x20──────────────────'),d['push']('\x20\x20EALLOCATORS_EMPTY='+ALLOCATION_ERROR_CODES['EALLOCATORS_EMPTY']+',\x20ENO_ALLOCATOR='+ALLOCATION_ERROR_CODES['ENO_ALLOCATOR']+',\x20ERATE_NOT_10000='+ALLOCATION_ERROR_CODES['ERATE_NOT_10000']),d['push']('\x20\x20EMULTIPLE_SURPLUS='+ALLOCATION_ERROR_CODES['EMULTIPLE_SURPLUS']+',\x20ERATE_EXCEEDS_10000='+ALLOCATION_ERROR_CODES['ERATE_EXCEEDS_10000']+',\x20EINSUFFICIENT_BALANCE='+ALLOCATION_ERROR_CODES['EINSUFFICIENT_BALANCE']),d['push']('\x20\x20ENO_PAYMENT_INFO='+ALLOCATION_ERROR_CODES['ENO_PAYMENT_INFO']+',\x20ESHARING_COUNT_EXCEEDED='+ALLOCATION_ERROR_CODES['ESHARING_COUNT_EXCEEDED']+',\x20EAMOUNT_BELOW_THRESHOLD='+ALLOCATION_ERROR_CODES['EAMOUNT_BELOW_THRESHOLD']),d['push']('\x20\x20EAMOUNT_EXCEEDS_MAX='+ALLOCATION_ERROR_CODES['EAMOUNT_EXCEEDS_MAX']+',\x20EALLOCATOR_COUNT_EXCEEDED='+ALLOCATION_ERROR_CODES['EALLOCATOR_COUNT_EXCEEDED']),d['push'](''),d['join']('\x0a');}export function progressiveAllocationCheck(a){const b=runStaticChecklist(a);if(!b['all_passed'])return{'stage':'checklist','status':'fail','message':'Checklist\x20failed:\x20'+b['items']['filter'](d=>!d['passed'])['map'](d=>d['id'])['join'](',\x20'),'next_action':'Fix\x20failing\x20checklist\x20items\x20(C-A-XX)'};const c=adaptRiskAssessment(a,b);if(c['blocks_publish'])return{'stage':'risk','status':'fail','message':'CRITICAL\x20risks:\x20'+c['risks']['filter'](d=>d['level']==='CRITICAL')['map'](d=>d['id'])['join'](',\x20'),'next_action':'Resolve\x20CRITICAL\x20risks\x20(R-A-1-01\x20empty\x20allocators,\x20R-A-2-01\x20Signer\x20theft)\x20before\x20proceeding'};if(c['needs_human_review'])return{'stage':'confirmation','status':'pending','message':'Human\x20review\x20required\x20for\x20HIGH\x20risks','next_action':'Confirm\x20risk\x20acceptance\x20(QA1\x20~\x20QA6)'};return{'stage':'complete','status':'pass','message':'All\x20checks\x20passed'};}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { type AllocationScene, type AllocationMode, type TriggerSource } from "./allocation-ledger.js";
|
|
2
|
-
import { type AllocationTemplate } from "./allocation-templates.js";
|
|
3
|
-
import { type SemanticToSchemaRule } from "./allocation-translation.js";
|
|
4
|
-
import { type AllocationRiskRule, type AllocationRiskAssessment, type AllocationStakeholder } from "./allocation-risk.js";
|
|
5
|
-
import { type AllocationPuzzle, type AllocationPuzzleCompleteness } from "./allocation-puzzle.js";
|
|
6
|
-
import { type ChecklistItem, type ConfirmationQuestion, type AllocationJsonForConfirm } from "./allocation-confirm.js";
|
|
7
|
-
export declare const ALLOCATION_CONTEXT_VERSION = "1.0.0";
|
|
8
|
-
export type AllocationInjectionMode = "initial_design" | "mid_design_review" | "pre_publish" | "post_publish_modify" | "stakeholder_review" | "apply_check";
|
|
9
|
-
export type AllocationStakeholderPerspective = AllocationStakeholder | "system";
|
|
10
|
-
export interface AllocationContextBundle {
|
|
11
|
-
version: string;
|
|
12
|
-
mode: AllocationInjectionMode;
|
|
13
|
-
stakeholder_perspective?: AllocationStakeholderPerspective;
|
|
14
|
-
matched_scene?: AllocationScene;
|
|
15
|
-
matched_template?: AllocationTemplate;
|
|
16
|
-
matched_pattern?: SemanticToSchemaRule;
|
|
17
|
-
puzzle_state?: AllocationPuzzle;
|
|
18
|
-
puzzle_completeness?: AllocationPuzzleCompleteness;
|
|
19
|
-
relevant_risks: AllocationRiskRule[];
|
|
20
|
-
risk_assessment?: AllocationRiskAssessment;
|
|
21
|
-
relevant_checklist: ChecklistItem[];
|
|
22
|
-
relevant_questions: ConfirmationQuestion[];
|
|
23
|
-
cross_object_refs: AllocationCrossObjectRef[];
|
|
24
|
-
onchain_constraints: AllocationOnchainConstraint[];
|
|
25
|
-
rendering_hints: AllocationRenderingHints;
|
|
26
|
-
}
|
|
27
|
-
export interface AllocationCrossObjectRef {
|
|
28
|
-
object: "Service" | "Order" | "Arbitration" | "Treasury" | "Guard" | "Passport" | "Progress" | "Machine" | "Payment";
|
|
29
|
-
field: string;
|
|
30
|
-
scene_id: string;
|
|
31
|
-
description: string;
|
|
32
|
-
}
|
|
33
|
-
export interface AllocationOnchainConstraint {
|
|
34
|
-
name: string;
|
|
35
|
-
value: string | number;
|
|
36
|
-
description: string;
|
|
37
|
-
}
|
|
38
|
-
export interface AllocationRenderingHints {
|
|
39
|
-
include_puzzle_template: boolean;
|
|
40
|
-
include_risk_details: boolean;
|
|
41
|
-
include_questions: boolean;
|
|
42
|
-
include_immutability_warning: boolean;
|
|
43
|
-
include_trigger_warning: boolean;
|
|
44
|
-
include_rate_overflow_warning: boolean;
|
|
45
|
-
max_length: number;
|
|
46
|
-
}
|
|
47
|
-
export interface BuildAllocationContextInput {
|
|
48
|
-
mode: AllocationInjectionMode;
|
|
49
|
-
intent?: string;
|
|
50
|
-
allocation_json?: AllocationJsonForConfirm;
|
|
51
|
-
stakeholder?: AllocationStakeholderPerspective;
|
|
52
|
-
target_trigger_source?: TriggerSource;
|
|
53
|
-
target_mode?: AllocationMode;
|
|
54
|
-
max_length?: number;
|
|
55
|
-
}
|
|
56
|
-
export declare function buildAllocationContext(input: BuildAllocationContextInput): AllocationContextBundle;
|
|
57
|
-
export declare function buildPromptFromAllocationContext(bundle: AllocationContextBundle): string;
|
|
58
|
-
export declare function getAllocationContextSummary(bundle: AllocationContextBundle): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MAX_SHARING_COUNT}from'@wowok/wowok';import{ALLOCATION_SCENES,MAX_ALLOCATOR_COUNT,ALLOCATION_MAX_SHARING_COUNT,ALLOCATION_MODE_AMOUNT,ALLOCATION_MODE_RATE,ALLOCATION_MODE_SURPLUS,RATE_TOTAL_FULL,inferSceneFromIntent,getAllScenes}from'./allocation-ledger.js';import{suggestTemplateForScene}from'./allocation-templates.js';import{matchSemanticPattern}from'./allocation-translation.js';import{getAllRiskRules,assessAllocationRisks}from'./allocation-risk.js';import{initPuzzleFromIntent,checkPuzzleCompleteness}from'./allocation-puzzle.js';import{ALLOCATION_PUBLISH_CHECKLIST,ALLOCATION_CONFIRMATION_QUESTIONS}from'./allocation-confirm.js';export const ALLOCATION_CONTEXT_VERSION='1.0.0';export function buildAllocationContext(a){const b=a['max_length']??0xfa0;let c;a['intent']&&(c=inferSceneFromIntent(a['intent']));if(!c&&a['target_trigger_source']){const q=getAllScenes()['filter'](r=>r['trigger_source']===a['target_trigger_source']);if(q['length']>0x0)c=q[0x0];}if(!c&&a['target_mode']){const r=getAllScenes()['filter'](t=>t['modes_used']['includes'](a['target_mode']));if(r['length']>0x0)c=r[0x0];}let d;if(c){const s=suggestTemplateForScene(c['id']);if(s)d=s;}let e;if(a['intent']){const t=matchSemanticPattern(a['intent']);if(t['length']>0x0)e=t[0x0];}let f,g;a['mode']==='initial_design'&&a['intent']&&(f=initPuzzleFromIntent({'distribution_goal':a['intent']}),g=checkPuzzleCompleteness(f));const h=filterRiskRules(a['mode'],a['stakeholder'],c);let i;if(a['mode']==='pre_publish'&&a['allocation_json']){const u={'object':a['allocation_json']['object'],'allocators_config':a['allocation_json']['allocators'],'coin_type':typeof a['allocation_json']['coin']==='string'?a['allocation_json']['coin']:a['allocation_json']['coin']?.['name'],'has_payment_info':!!a['allocation_json']['payment_info']};i=assessAllocationRisks(u);}const j=filterChecklist(a['mode']),k=filterQuestions(a['mode']),l=buildCrossObjectRefs(c),m=buildOnchainConstraints(),n=a['allocation_json']?.['allocators']?.['allocators']?.['some'](v=>v['sharing']['some'](w=>w['mode']==='Rate'))??![],o=!!c&&c['trigger_source']!=='standalone',p=buildRenderingHints(a['mode'],b,o,n);return{'version':ALLOCATION_CONTEXT_VERSION,'mode':a['mode'],'stakeholder_perspective':a['stakeholder'],'matched_scene':c,'matched_template':d,'matched_pattern':e,'puzzle_state':f,'puzzle_completeness':g,'relevant_risks':h,'risk_assessment':i,'relevant_checklist':j,'relevant_questions':k,'cross_object_refs':l,'onchain_constraints':m,'rendering_hints':p};}function filterRiskRules(a,b,c){const d=getAllRiskRules();if(a==='initial_design')return d['filter'](e=>e['category']==='structural');if(a==='pre_publish')return d;if(a==='stakeholder_review'&&b){if(b==='owner')return d['filter'](e=>e['category']==='structural'||e['category']==='lifecycle');if(b==='allocator')return d['filter'](e=>e['category']==='structural'||e['category']==='semantic');if(b==='recipient')return d['filter'](e=>e['category']==='semantic');if(b==='service_provider')return d['filter'](e=>e['category']==='cross_object'||e['category']==='lifecycle');}return d;}function filterChecklist(a){if(a==='initial_design')return ALLOCATION_PUBLISH_CHECKLIST['filter'](b=>['C-A-01','C-A-02','C-A-03','C-A-04']['includes'](b['id']));if(a==='post_publish_modify')return ALLOCATION_PUBLISH_CHECKLIST['filter'](b=>['C-A-09','C-A-10','C-A-11','C-A-12']['includes'](b['id']));return ALLOCATION_PUBLISH_CHECKLIST;}function filterQuestions(a){if(a==='pre_publish')return ALLOCATION_CONFIRMATION_QUESTIONS;if(a==='post_publish_modify')return ALLOCATION_CONFIRMATION_QUESTIONS['filter'](b=>['QA4','QA5','QA6']['includes'](b['id']));return[];}function buildCrossObjectRefs(a){if(!a)return[];const b=[];for(const c of ALLOCATION_SCENES){if(c['id']===a['id'])continue;b['push']({'object':c['dependencies'][0x0]??'Service','field':'allocation','scene_id':c['id'],'description':c['name']+'\x20(trigger:\x20'+c['trigger_source']+')'});}return b;}function buildOnchainConstraints(){return[{'name':'MAX_SHARING_COUNT','value':MAX_SHARING_COUNT,'description':'Maximum\x20sharing\x20entries\x20per\x20allocator\x20(Move:\x20allocation.move:17)'},{'name':'MAX_ALLOCATOR_COUNT','value':MAX_ALLOCATOR_COUNT,'description':'Maximum\x20allocators\x20per\x20Allocation\x20object\x20(Move:\x20allocation.move:16)'},{'name':'ALLOCATION_MAX_SHARING_COUNT','value':ALLOCATION_MAX_SHARING_COUNT,'description':'Alias\x20of\x20MAX_SHARING_COUNT\x20(knowledge-layer\x20mirror)'},{'name':'ALLOCATION_MODE_AMOUNT','value':ALLOCATION_MODE_AMOUNT,'description':'Mode\x200:\x20fixed\x20amount\x20distribution'},{'name':'ALLOCATION_MODE_RATE','value':ALLOCATION_MODE_RATE,'description':'Mode\x201:\x20percentage\x20rate\x20(basis\x20points,\x20total\x20=\x20RATE_TOTAL_FULL)'},{'name':'ALLOCATION_MODE_SURPLUS','value':ALLOCATION_MODE_SURPLUS,'description':'Mode\x202:\x20surplus\x20(remainder)\x20distribution'},{'name':'RATE_TOTAL_FULL','value':RATE_TOTAL_FULL,'description':'100%\x20in\x20basis\x20points\x20(10000)\x20—\x20Rate\x20mode\x20shares\x20must\x20sum\x20to\x20this'}];}function buildRenderingHints(a,b,c,d){return{'include_puzzle_template':a==='initial_design','include_risk_details':a==='pre_publish'||a==='stakeholder_review','include_questions':a==='pre_publish','include_immutability_warning':a==='post_publish_modify','include_trigger_warning':c,'include_rate_overflow_warning':d,'max_length':b};}export function buildPromptFromAllocationContext(a){const b=[],d=a['rendering_hints'];b['push']('═══\x20Allocation\x20Context\x20(mode:\x20'+a['mode']+')\x20═══'),b['push']('');a['matched_scene']&&(b['push']('Scene:\x20'+a['matched_scene']['name']),b['push']('Trigger\x20source:\x20'+a['matched_scene']['trigger_source']),b['push']('Distribution\x20strategy:\x20'+a['matched_scene']['distribution_strategy']),b['push']('Typical\x20allocator\x20count:\x20'+a['matched_scene']['typical_allocator_count']),b['push'](''));a['matched_template']&&(b['push']('Suggested\x20template:\x20'+a['matched_template']['id']+'\x20—\x20'+a['matched_template']['name']),b['push'](''));if(d['include_puzzle_template']&&a['puzzle_completeness']){const e=a['puzzle_completeness'];b['push']('─\x20Puzzle\x20Completeness\x20──────────────'),b['push']('Complete:\x20'+(e['complete']?'YES':'NO')),e['missing']['length']>0x0&&b['push']('Missing:\x20'+e['missing']['join'](',\x20')),b['push']('Next:\x20'+e['next_step']),b['push']('');}if(d['include_risk_details']&&a['relevant_risks']['length']>0x0){b['push']('─\x20Relevant\x20Risk\x20Rules\x20('+a['relevant_risks']['length']+')\x20──────────────');for(const f of a['relevant_risks']['slice'](0x0,0x5)){b['push']('\x20\x20'+f['id']+'\x20—\x20'+f['trigger']);}a['relevant_risks']['length']>0x5&&b['push']('\x20\x20...\x20and\x20'+(a['relevant_risks']['length']-0x5)+'\x20more'),b['push']('');}a['risk_assessment']&&(b['push']('─\x20Risk\x20Assessment\x20──────────────'),b['push']('Overall:\x20'+a['risk_assessment']['summary']),b['push']('Detected:\x20'+a['risk_assessment']['risks']['length']+'\x20risk(s)'),b['push'](''));d['include_trigger_warning']&&(b['push']('⚠️\x20TRIGGER-AWARE\x20—\x20This\x20Allocation\x20is\x20bound\x20to\x20a\x20trigger\x20source\x20(Service/Arbitration).'),b['push']('\x20\x20\x20Funds\x20flow\x20is\x20automated\x20by\x20on-chain\x20events,\x20not\x20manual\x20invocation.'),b['push'](''));d['include_rate_overflow_warning']&&(b['push']('⚠️\x20RATE\x20MODE\x20—\x20Sharing\x20rates\x20must\x20sum\x20to\x20exactly\x20RATE_TOTAL_FULL\x20(10000\x20basis\x20points).'),b['push']('\x20\x20\x20Underflow\x20→\x20remaining\x20funds\x20stuck;\x20Overflow\x20→\x20transaction\x20aborts.'),b['push'](''));d['include_immutability_warning']&&(b['push']('⚠️\x20POST-PUBLISH\x20OPERATE\x20—\x20Allocation\x20object\x20is\x20on-chain.'),b['push']('\x20\x20\x20Only\x20receive\x20/\x20alloc_by_guard\x20operations\x20are\x20permitted;\x20allocators\x20are\x20immutable.'),b['push'](''));if(a['onchain_constraints']['length']>0x0){b['push']('─\x20On-chain\x20Constraints\x20──────────────');for(const g of a['onchain_constraints']){b['push']('\x20\x20'+g['name']+'\x20=\x20'+g['value']+'\x20—\x20'+g['description']);}b['push']('');}if(a['cross_object_refs']['length']>0x0){b['push']('─\x20Cross-object\x20References\x20('+a['cross_object_refs']['length']+')\x20──────────────');for(const i of a['cross_object_refs']['slice'](0x0,0x5)){b['push']('\x20\x20['+i['object']+']\x20'+i['scene_id']+':\x20'+i['description']);}a['cross_object_refs']['length']>0x5&&b['push']('\x20\x20...\x20and\x20'+(a['cross_object_refs']['length']-0x5)+'\x20more'),b['push']('');}return b['join']('\x0a');}export function getAllocationContextSummary(a){const b=['mode='+a['mode'],'scene='+(a['matched_scene']?.['id']??'none'),'risks='+a['relevant_risks']['length'],'refs='+a['cross_object_refs']['length']];if(a['stakeholder_perspective'])b['push']('stakeholder='+a['stakeholder_perspective']);if(a['risk_assessment'])b['push']('summary='+a['risk_assessment']['summary']);return b['join'](',\x20');}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
export interface SemanticToSchemaRule {
|
|
2
|
-
id: string;
|
|
3
|
-
pattern_name: string;
|
|
4
|
-
semantic_intent: string;
|
|
5
|
-
match_keywords: string[];
|
|
6
|
-
schema_fields: string[];
|
|
7
|
-
example_json: object;
|
|
8
|
-
reverse_explanation: string;
|
|
9
|
-
}
|
|
10
|
-
export interface SchemaToSemanticRule {
|
|
11
|
-
element_type: "field" | "op" | "mode" | "recipient";
|
|
12
|
-
type_name: string;
|
|
13
|
-
semantic_explanation: string;
|
|
14
|
-
constraints?: string[];
|
|
15
|
-
}
|
|
16
|
-
export interface AllocationConstraintRule {
|
|
17
|
-
id: string;
|
|
18
|
-
category: "structural" | "semantic" | "authority" | "lifecycle" | "cross_object";
|
|
19
|
-
rule: string;
|
|
20
|
-
applies_to: string[];
|
|
21
|
-
}
|
|
22
|
-
export declare const SEMANTIC_TO_SCHEMA_RULES: SemanticToSchemaRule[];
|
|
23
|
-
export declare const SCHEMA_TO_SEMANTIC_RULES: SchemaToSemanticRule[];
|
|
24
|
-
export declare const ALLOCATION_CONSTRAINT_RULES: AllocationConstraintRule[];
|
|
25
|
-
export declare const ALLOCATION_TRANSLATION_VERSION = "1.0.0";
|
|
26
|
-
export declare function matchSemanticPattern(userIntent: string): SemanticToSchemaRule[];
|
|
27
|
-
export interface AllocationCallData {
|
|
28
|
-
object?: {
|
|
29
|
-
name: string;
|
|
30
|
-
type_parameter?: string;
|
|
31
|
-
} | string | null;
|
|
32
|
-
allocators?: {
|
|
33
|
-
description: string;
|
|
34
|
-
threshold: string | number;
|
|
35
|
-
allocators: {
|
|
36
|
-
guard: string;
|
|
37
|
-
sharing: {
|
|
38
|
-
who: {
|
|
39
|
-
GuardIdentifier: number;
|
|
40
|
-
} | {
|
|
41
|
-
Entity: string;
|
|
42
|
-
} | {
|
|
43
|
-
Signer: "signer";
|
|
44
|
-
};
|
|
45
|
-
sharing: string | number;
|
|
46
|
-
mode: "Amount" | "Rate" | "Surplus";
|
|
47
|
-
}[];
|
|
48
|
-
fix?: string | number;
|
|
49
|
-
max?: string | number | null;
|
|
50
|
-
}[];
|
|
51
|
-
};
|
|
52
|
-
coin?: {
|
|
53
|
-
name?: string;
|
|
54
|
-
address?: string;
|
|
55
|
-
} | string;
|
|
56
|
-
payment_info?: object;
|
|
57
|
-
received_coins?: {
|
|
58
|
-
token_type: string;
|
|
59
|
-
received: {
|
|
60
|
-
id: string;
|
|
61
|
-
payment: string;
|
|
62
|
-
}[];
|
|
63
|
-
};
|
|
64
|
-
alloc_by_guard?: string;
|
|
65
|
-
}
|
|
66
|
-
export declare function explainAllocationCallData(data: AllocationCallData): string;
|
|
67
|
-
export declare function explainField(fieldName: string): SchemaToSemanticRule | undefined;
|
|
68
|
-
export declare function explainOp(opName: string): SchemaToSemanticRule | undefined;
|
|
69
|
-
export declare function explainMode(modeName: string): SchemaToSemanticRule | undefined;
|
|
70
|
-
export declare function explainRecipient(recipientName: string): SchemaToSemanticRule | undefined;
|
|
71
|
-
export declare function getConstraintsByCategory(category: AllocationConstraintRule["category"]): AllocationConstraintRule[];
|
|
72
|
-
export declare function explainError(code: number): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ALLOCATION_ERROR_CODES,MAX_ALLOCATOR_COUNT,RATE_TOTAL_FULL,allocationModeToNumber,getRecipientType,isSignerRecipient,isEntityRecipient,isGuardIdentifierRecipient}from'./allocation-ledger.js';export const SEMANTIC_TO_SCHEMA_RULES=[{'id':'P-A-01','pattern_name':'Create\x20standard\x20three-way\x20split','semantic_intent':'Create\x20an\x20Allocation\x20that\x20splits\x20payment\x203\x20ways\x20via\x20pure\x20Rate\x20(e.g.\x20merchant\x2080%\x20/\x20platform\x2010%\x20/\x20logistics\x2010%)','match_keywords':['split','three-way','rate','distribution'],'schema_fields':['object(TypeNamedObject)','allocators','coin','payment_info'],'example_json':{'object':{'name':'myshop_allocation','type_parameter':'0x2::wow::WOW'},'allocators':{'description':'Standard\x203-way\x20split:\x20merchant\x2080%\x20/\x20platform\x2010%\x20/\x20logistics\x2010%','threshold':'0','allocators':[{'guard':'0xGUARD_ORDER_COMPLETE','sharing':[{'who':{'Entity':'0xMERCHANT_TREASURY'},'sharing':'8000','mode':'Rate'},{'who':{'Entity':'0xPLATFORM_TREASURY'},'sharing':'1000','mode':'Rate'},{'who':{'Entity':'0xLOGISTICS_TREASURY'},'sharing':'1000','mode':'Rate'}],'max':null}]},'coin':{'name':'payment_coin'},'payment_info':{}},'reverse_explanation':'Single\x20Allocator\x20with\x203\x20Rate\x20sharing\x20items;\x20sum(rates)\x20MUST\x20equal\x2010000\x20(RATE_TOTAL_FULL)'},{'id':'P-A-02','pattern_name':'Create\x20Treasury\x20+\x20Personal\x20alternative\x20(caller-specified\x20guard)','semantic_intent':'Create\x20an\x20Allocation\x20with\x202\x20Allocators\x20as\x20alternative\x20strategies:\x20caller\x20selects\x20Treasury\x20or\x20Personal\x20wallet\x20via\x20alloc_by_guard\x20(hard\x20verification\x20per\x20call)','match_keywords':['alternative','fallback','priority','substitute','multi-strategy'],'schema_fields':['object(TypeNamedObject)','allocators','coin','payment_info'],'example_json':{'object':{'name':'myshop_allocation','type_parameter':'0x2::wow::WOW'},'allocators':{'description':'Treasury\x20/\x20Personal\x20alternative\x20(caller-specified\x20guard)','threshold':'0','allocators':[{'guard':'0xGUARD_TRESTRY_OK','sharing':[{'who':{'Entity':'0xTREASURY_ADDR'},'sharing':'10000','mode':'Rate'}],'max':null},{'guard':'0xGUARD_PERSONAL_OK','sharing':[{'who':{'Entity':'0xPERSONAL_ADDR'},'sharing':'10000','mode':'Rate'}],'max':null}]},'coin':{'name':'payment_coin'},'payment_info':{}},'reverse_explanation':'2\x20Allocators\x20each\x20with\x201\x20Rate=10000;\x20Guards\x20MUST\x20be\x20different\x20addresses\x20(F-A-14);\x20caller\x20selects\x20one\x20via\x20alloc_by_guard,\x20passport::result_for_guard\x20hard\x20verify\x20(failure\x20abort\x20E_VERIFY_FAILED,\x20no\x20auto-fallback)'},{'id':'P-A-03','pattern_name':'Create\x20refund-first\x20+\x20surplus-to-merchant\x20(Amount\x20+\x20Surplus\x20hybrid)','semantic_intent':'Create\x20an\x20Allocation\x20that\x20pays\x20a\x20fixed\x20refund\x20Amount\x20to\x20customer,\x20then\x20sends\x20remaining\x20Surplus\x20to\x20merchant','match_keywords':['refund','surplus','hybrid','remainder'],'schema_fields':['object(TypeNamedObject)','allocators','coin','payment_info'],'example_json':{'object':{'name':'refund_allocation','type_parameter':'0x2::wow::WOW'},'allocators':{'description':'Refund\x20100\x20WOW\x20to\x20customer,\x20surplus\x20to\x20merchant','threshold':'100000000000','allocators':[{'guard':'0xGUARD_REFUND_APPROVED','sharing':[{'who':{'Entity':'0xCUSTOMER_ADDR'},'sharing':'100000000000','mode':'Amount'},{'who':{'Entity':'0xMERCHANT_TREASURY'},'sharing':'0','mode':'Surplus'}],'max':null}]},'coin':{'name':'refund_coin'},'payment_info':{}},'reverse_explanation':'Single\x20Allocator\x20with\x20Amount+Surplus\x20hybrid;\x20fix\x20(Amount\x20sum)\x20cached\x20at\x20allocator_add\x20time;\x20threshold\x20MUST\x20be\x20<=\x20fix;\x20Surplus\x20sharing\x20value\x20is\x20ignored\x20(set\x20to\x200)'},{'id':'P-A-04','pattern_name':'Create\x20dynamic\x20recipient\x20via\x20GuardIdentifier','semantic_intent':'Create\x20an\x20Allocation\x20where\x20one\x20recipient\x20is\x20resolved\x20dynamically\x20from\x20the\x20customer\x27s\x20Passport\x20submission','match_keywords':['dynamic','guardidentifier','passport','referrer'],'schema_fields':['object(TypeNamedObject)','allocators','coin','payment_info'],'example_json':{'object':{'name':'dynamic_alloc','type_parameter':'0x2::wow::WOW'},'allocators':{'description':'Merchant\x2080%\x20/\x20platform\x2010%\x20/\x20referrer\x2010%\x20(referrer\x20from\x20Passport)','threshold':'0','allocators':[{'guard':'0xGUARD_ORDER_COMPLETE','sharing':[{'who':{'Entity':'0xMERCHANT_TREASURY'},'sharing':'8000','mode':'Rate'},{'who':{'Entity':'0xPLATFORM_TREASURY'},'sharing':'1000','mode':'Rate'},{'who':{'GuardIdentifier':0x0},'sharing':'1000','mode':'Rate'}],'max':null}]},'coin':{'name':'payment_coin'},'payment_info':{}},'reverse_explanation':'GuardIdentifier\x20references\x20Passport\x20table[identifier]\x20at\x20alloc()\x20time;\x20identifier\x20MUST\x20be\x20u8\x20(0-255);\x20Guard.is_identifier_address(guard,\x20identifier)\x20MUST\x20hold\x20at\x20allocator_add\x20time'},{'id':'P-A-05','pattern_name':'⚠️\x20Create\x20Signer-recipient\x20Allocation\x20(DANGEROUS)','semantic_intent':'Create\x20an\x20Allocation\x20where\x20the\x20recipient\x20is\x20the\x20tx\x20sender\x20(Signer).\x20Requires\x20strong\x20Guard\x20binding\x20to\x20prevent\x20theft.','match_keywords':['signer','self','tx\x20sender','dangerous','high-risk'],'schema_fields':['object(TypeNamedObject)','allocators','coin','payment_info'],'example_json':{'object':{'name':'signer_alloc','type_parameter':'0x2::wow::WOW'},'allocators':{'description':'⚠️\x20Signer-recipient\x20—\x20Guard\x20MUST\x20verify\x20authorized\x20caller','threshold':'0','allocators':[{'guard':'0xGUARD_STRICT_AUTHORIZATION','sharing':[{'who':{'Signer':'signer'},'sharing':'10000','mode':'Rate'}],'max':null}]},'coin':{'name':'payment_coin'},'payment_info':{}},'reverse_explanation':'⚠️\x20CRITICAL:\x20sharing.who=Signer\x20sends\x20funds\x20to\x20tx_context::sender(ctx).\x20Guard\x20MUST\x20verify\x20the\x20caller\x20is\x20an\x20authorized\x20recipient,\x20otherwise\x20anyone\x20can\x20claim\x20funds\x20by\x20triggering\x20alloc().'},{'id':'P-A-06','pattern_name':'Operate:\x20receive\x20CoinWrapper\x20deposits','semantic_intent':'Receive\x20pending\x20CoinWrapper<T>\x20deposits\x20into\x20an\x20existing\x20Allocation\x27s\x20balance','match_keywords':['receive','deposit'],'schema_fields':['object(string)','received_coins'],'example_json':{'object':'0xALLOCATION_ADDRESS','received_coins':{'token_type':'0x2::wow::WOW','received':[{'id':'0xCOINWRAPPER_1','payment':'0xPAYMENT_1'},{'id':'0xCOINWRAPPER_2','payment':'0xPAYMENT_2'}]}},'reverse_explanation':'received_coins.token_type\x20MUST\x20match\x20Allocation\x27s\x20type_parameter;\x20receive()\x20joins\x20balance\x20into\x20Allocation'},{'id':'P-A-07','pattern_name':'Operate:\x20alloc_by_guard\x20(trigger\x20distribution)','semantic_intent':'Trigger\x20fund\x20distribution\x20by\x20verifying\x20a\x20Guard\x20against\x20the\x20customer\x27s\x20Passport\x20submission','match_keywords':['alloc','distribute','trigger','split'],'schema_fields':['object(string)','alloc_by_guard'],'example_json':{'object':'0xALLOCATION_ADDRESS','alloc_by_guard':'0xGUARD_ADDRESS'},'reverse_explanation':'alloc_by_guard\x20MUST\x20be\x20one\x20of\x20allocators[].guard\x20addresses;\x20SDK\x20triggers\x202-phase\x20call\x20(submission\x20request\x20→\x20Passport\x20verify\x20→\x20on-chain\x20alloc())'},{'id':'P-A-08','pattern_name':'Create\x20max-capped\x20allocation\x20(retain\x20residual\x20balance)','semantic_intent':'Create\x20an\x20Allocation\x20with\x20max\x20field\x20to\x20cap\x20total\x20distribution;\x20residual\x20balance\x20remains\x20in\x20Allocation\x20for\x20subsequent\x20alloc()\x20calls','match_keywords':['max','cap','retain','capped'],'schema_fields':['object(TypeNamedObject)','allocators','coin','payment_info'],'example_json':{'object':{'name':'capped_alloc','type_parameter':'0x2::wow::WOW'},'allocators':{'description':'Max-capped:\x2050\x20WOW\x20fix\x20+\x2030%\x20rate\x20of\x20remainder,\x20surplus\x20to\x20merchant','threshold':'50000000000','allocators':[{'guard':'0xGUARD_ORDER_COMPLETE','sharing':[{'who':{'Entity':'0xPARTNER_ADDR'},'sharing':'50000000000','mode':'Amount'},{'who':{'Entity':'0xMERCHANT_TREASURY'},'sharing':'3000','mode':'Rate'},{'who':{'Entity':'0xMERCHANT_TREASURY'},'sharing':'0','mode':'Surplus'}],'max':'200000000000'}]},'coin':{'name':'payment_coin'},'payment_info':{}},'reverse_explanation':'max\x20triple\x20role:\x20(1)\x20Amount\x20sum\x20<=\x20max\x20(EAMOUNT_EXCEEDS_MAX),\x20(2)\x20Rate\x20base\x20=\x20max\x20-\x20fix\x20(NOT\x20balance\x20-\x20fix),\x20(3)\x20Surplus\x20amount\x20=\x20max\x20-\x20alloced_amount'},{'id':'P-A-09','pattern_name':'Create\x20multi-node\x20trigger\x20allocation\x20(3\x20mutually\x20exclusive\x20Allocators)','semantic_intent':'Create\x20an\x20Allocation\x20with\x203\x20Allocators\x20mapped\x20to\x20Machine\x20terminal\x20nodes\x20(Complete/Refund/Lost);\x20each\x20Guard\x20verifies\x20progress.current_node','match_keywords':['multi-node','machine','terminal','complete/refund/lost'],'schema_fields':['object(TypeNamedObject)','allocators','coin','payment_info'],'example_json':{'object':{'name':'multinode_alloc','type_parameter':'0x2::wow::WOW'},'allocators':{'description':'Multi-node:\x20Complete→3-way\x20split,\x20Refund→100%\x20customer,\x20Lost→100%\x20platform','threshold':'0','allocators':[{'guard':'0xGUARD_NODE_COMPLETE','sharing':[{'who':{'Entity':'0xMERCHANT_TREASURY'},'sharing':'8000','mode':'Rate'},{'who':{'Entity':'0xPLATFORM_TREASURY'},'sharing':'2000','mode':'Rate'}],'max':null},{'guard':'0xGUARD_NODE_REFUND','sharing':[{'who':{'Entity':'0xCUSTOMER_ADDR'},'sharing':'10000','mode':'Rate'}],'max':null},{'guard':'0xGUARD_NODE_LOST','sharing':[{'who':{'Entity':'0xPLATFORM_TREASURY'},'sharing':'10000','mode':'Rate'}],'max':null}]},'coin':{'name':'payment_coin'},'payment_info':{}},'reverse_explanation':'3\x20Allocators\x20with\x20mutually\x20exclusive\x20Guard\x20conditions\x20(only\x20one\x20terminal\x20node\x20active\x20at\x20a\x20time);\x20sequence\x20is\x20business-flow\x20order;\x20Machine.required_allocators[]\x20maps\x20trigger_node\x20to\x20Allocator\x20indices'}];export const SCHEMA_TO_SEMANTIC_RULES=[{'element_type':'field','type_name':'object','semantic_explanation':'Allocation\x20object\x20reference.\x20TypeNamedObject={name,type_parameter}=CREATE\x20new;\x20string=OPERATE\x20existing'},{'element_type':'field','type_name':'allocators','semantic_explanation':'Allocators\x20config\x20(description\x20+\x20threshold\x20+\x20allocators[]).\x20Immutable\x20after\x20create()\x20—\x20Allocation\x20is\x20a\x20passive\x20object'},{'element_type':'field','type_name':'allocators.threshold','semantic_explanation':'Minimum\x20balance\x20required\x20to\x20trigger\x20alloc().\x20Pure\x20Rate\x20mode\x20threshold=0;\x20Amount+Surplus\x20hybrid\x20threshold\x20<=\x20fix'},{'element_type':'field','type_name':'allocators.allocators','semantic_explanation':'Allocator\x20array.\x20Count\x20<=\x20MAX_ALLOCATOR_COUNT\x20(100).\x20Each\x20Allocator\x20is\x20selected\x20by\x20caller\x20via\x20alloc_by_guard\x20(guard\x20address\x20lookup),\x20no\x20auto-fallback'},{'element_type':'field','type_name':'allocators.allocators[].guard','semantic_explanation':'Guard\x20object\x20address.\x20MUST\x20be\x20unique\x20within\x20the\x20Allocators\x20(F-A-14).\x20Determines\x20which\x20Allocator\x20fires\x20on\x20alloc()'},{'element_type':'field','type_name':'allocators.allocators[].sharing','semantic_explanation':'Sharing\x20array.\x20Count\x20<=\x20MAX_SHARING_COUNT\x20(100).\x20At\x20most\x201\x20Surplus\x20per\x20Allocator\x20(F-A-04)'},{'element_type':'field','type_name':'allocators.allocators[].sharing[].who','semantic_explanation':'Recipient:\x20{Entity:\x20address}\x20|\x20{GuardIdentifier:\x20u8}\x20|\x20{Signer:\x20\x27signer\x27}.\x20Signer\x20is\x20DANGEROUS\x20without\x20Guard\x20binding'},{'element_type':'field','type_name':'allocators.allocators[].sharing[].sharing','semantic_explanation':'Numeric\x20value.\x20Amount=fixed\x20coin\x20amount;\x20Rate=basis\x20points\x20(10000=100%);\x20Surplus=ignored\x20(set\x20to\x200)'},{'element_type':'field','type_name':'allocators.allocators[].sharing[].mode','semantic_explanation':'Distribution\x20mode:\x20\x27Amount\x27=fixed,\x20\x27Rate\x27=basis\x20points,\x20\x27Surplus\x27=remainder-all'},{'element_type':'field','type_name':'allocators.allocators[].fix','semantic_explanation':'INTERNAL\x20ONLY\x20—\x20cached\x20Amount\x20sum,\x20computed\x20at\x20allocator_add()\x20time.\x20SDK\x20hides\x20this;\x20do\x20NOT\x20set\x20explicitly'},{'element_type':'field','type_name':'allocators.allocators[].max','semantic_explanation':'Optional\x20cap.\x20Triple\x20role:\x20Amount\x20sum\x20cap\x20+\x20Rate\x20base\x20+\x20Surplus\x20cap.\x20null=no\x20cap'},{'element_type':'field','type_name':'coin','semantic_explanation':'Initial\x20Coin<T>\x20to\x20seed\x20the\x20Allocation\x20balance.\x20Type\x20MUST\x20match\x20type_parameter'},{'element_type':'field','type_name':'payment_info','semantic_explanation':'Required\x20PaymentInfo\x20for\x20creating\x20Payment\x20objects\x20during\x20alloc().\x20Cannot\x20be\x20None\x20at\x20alloc()\x20time\x20(ENO_PAYMENT_INFO)'},{'element_type':'field','type_name':'received_coins','semantic_explanation':'Operate-only:\x20CoinWrapper<T>\x20deposits\x20to\x20receive.\x20token_type\x20MUST\x20match\x20Allocation\x20type_parameter'},{'element_type':'field','type_name':'alloc_by_guard','semantic_explanation':'Operate-only:\x20Guard\x20address\x20to\x20verify\x20against\x20customer\x27s\x20Passport.\x20MUST\x20be\x20one\x20of\x20allocators[].guard'},{'element_type':'op','type_name':'create','semantic_explanation':'new_with_balance\x20+\x20create\x20+\x20share_object.\x20Binds\x20Allocation\x20to\x20Order\x201:1\x20(F-A-12).\x20Cannot\x20be\x20reconfigured'},{'element_type':'op','type_name':'receive','semantic_explanation':'Deposit\x20CoinWrapper<T>\x20into\x20Allocation.balance.\x20Pre-condition\x20for\x20alloc()\x20when\x20initial\x20coin\x20is\x20insufficient'},{'element_type':'op','type_name':'alloc_by_guard','semantic_explanation':'2-phase:\x20(1)\x20request\x20Passport\x20submission,\x20(2)\x20on-chain\x20alloc()\x20—\x20caller-specified\x20guard:\x20traverse\x20to\x20locate\x20alloc.guard==alloc_by_guard\x20Allocator\x20→\x20passport::result_for_guard\x20hard\x20verify\x20(failure\x20abort\x20E_VERIFY_FAILED)'},{'element_type':'mode','type_name':'Amount','semantic_explanation':'Mode\x200\x20—\x20fixed\x20coin\x20amount\x20distribution.\x20sharing.sharing\x20is\x20the\x20absolute\x20amount\x20in\x20smallest\x20unit.\x20Sum\x20cached\x20in\x20fix'},{'element_type':'mode','type_name':'Rate','semantic_explanation':'Mode\x201\x20—\x20basis-point\x20distribution.\x20sharing.sharing\x20is\x20in\x20basis\x20points\x20(10000=100%).\x20Pure\x20Rate\x20sum\x20must\x20equal\x2010000'},{'element_type':'mode','type_name':'Surplus','semantic_explanation':'Mode\x202\x20—\x20remainder-all\x20distribution.\x20sharing.sharing\x20is\x20IGNORED\x20(set\x20to\x200).\x20At\x20most\x201\x20Surplus\x20per\x20Allocator\x20(EMULTIPLE_SURPLUS)'},{'element_type':'recipient','type_name':'Entity','semantic_explanation':'Static\x20address\x20—\x20Treasury\x20/\x20personal\x20wallet\x20/\x20Order\x20object\x20address.\x20Safest\x20recipient\x20type'},{'element_type':'recipient','type_name':'GuardIdentifier','semantic_explanation':'u8\x20identifier\x20resolved\x20from\x20Passport\x20table\x20at\x20alloc()\x20time.\x20Resolved\x20value\x20MUST\x20be\x20address\x20type\x20(ERECIPIENT_IDENTIFIER_NOT_ADDRESS)'},{'element_type':'recipient','type_name':'Signer','semantic_explanation':'⚠️\x20CRITICAL\x20—\x20tx_context::sender(ctx).\x20DANGEROUS\x20without\x20strict\x20Guard\x20binding\x20(theft\x20risk\x20R-A-2-01)'}];export const ALLOCATION_CONSTRAINT_RULES=[{'id':'MC-A-01','category':'structural','rule':'Allocator\x20count\x20<=\x20MAX_ALLOCATOR_COUNT\x20(100)\x20—\x20Move\x20EALLOCATOR_COUNT_EXCEEDED=2','applies_to':['allocators.allocators']},{'id':'MC-A-02','category':'structural','rule':'Sharing\x20count\x20per\x20Allocator\x20<=\x20MAX_SHARING_COUNT\x20(100)\x20—\x20Move\x20ESHARING_COUNT_EXCEEDED=10','applies_to':['allocators.allocators[].sharing']},{'id':'MC-A-03','category':'structural','rule':'At\x20most\x201\x20Surplus\x20sharing\x20per\x20Allocator\x20—\x20Move\x20EMULTIPLE_SURPLUS=5','applies_to':['allocators.allocators[].sharing\x20(mode=Surplus)']},{'id':'MC-A-04','category':'structural','rule':'Pure\x20Rate\x20mode\x20(no\x20Surplus):\x20sum(rates)\x20MUST\x20equal\x2010000\x20(RATE_TOTAL_FULL)\x20—\x20Move\x20ERATE_NOT_10000=4','applies_to':['allocators.allocators[].sharing\x20(mode=Rate,\x20no\x20Surplus\x20in\x20same\x20Allocator)']},{'id':'MC-A-05','category':'structural','rule':'Rate\x20+\x20Surplus\x20hybrid:\x20sum(rates)\x20MUST\x20be\x20<=\x2010000\x20—\x20Move\x20ERATE_EXCEEDS_10000=6','applies_to':['allocators.allocators[].sharing\x20(mode=Rate\x20with\x20Surplus)']},{'id':'MC-A-06','category':'structural','rule':'Amount\x20sum\x20(fix)\x20MUST\x20be\x20>=\x20threshold\x20—\x20Move\x20EAMOUNT_BELOW_THRESHOLD=12','applies_to':['allocators.allocators[].sharing\x20(mode=Amount)','allocators.threshold']},{'id':'MC-A-07','category':'structural','rule':'If\x20max\x20is\x20set:\x20Amount\x20sum\x20(fix)\x20MUST\x20be\x20<=\x20max\x20—\x20Move\x20EAMOUNT_EXCEEDS_MAX=13','applies_to':['allocators.allocators[].sharing\x20(mode=Amount)','allocators.allocators[].max']},{'id':'MC-A-08','category':'structural','rule':'Balance\x20MUST\x20be\x20>=\x20threshold\x20at\x20alloc()\x20time\x20—\x20Move\x20EINSUFFICIENT_BALANCE=7','applies_to':['allocators.threshold','alloc_by_guard\x20operation']},{'id':'MC-A-09','category':'semantic','rule':'allocators.allocators[].guard\x20MUST\x20be\x20unique\x20within\x20the\x20same\x20Allocators\x20(alloc_by_guard\x20address\x20matching\x20locates\x20a\x20unique\x20Allocator;\x20duplicate\x20guards\x20make\x20subsequent\x20Allocators\x20permanently\x20unreachable)','applies_to':['allocators.allocators[].guard']},{'id':'MC-A-10','category':'semantic','rule':'sharing.who=Signer\x20requires\x20strict\x20Guard\x20binding\x20(R-A-2-01\x20CRITICAL\x20theft\x20risk).\x20Guard\x20MUST\x20verify\x20caller\x20identity','applies_to':['allocators.allocators[].sharing[].who\x20(Signer)']},{'id':'MC-A-11','category':'semantic','rule':'sharing.who=GuardIdentifier\x20requires\x20Guard.is_identifier_address(guard,\x20identifier)=true\x20at\x20allocator_add\x20time','applies_to':['allocators.allocators[].sharing[].who\x20(GuardIdentifier)']},{'id':'MC-A-12','category':'lifecycle','rule':'Allocation\x20is\x20a\x20\x22passive\x20object\x22\x20—\x20no\x20Permission\x20field,\x20no\x20Owner\x20field,\x20structurally\x20immutable\x20after\x20create()','applies_to':['create\x20operation','operate\x20operation\x20(limited\x20to\x20receive/alloc_by_guard)']},{'id':'MC-A-13','category':'cross_object','rule':'Each\x20Order\x20may\x20bind\x20at\x20most\x201\x20Allocation\x20—\x20Move\x20order.move\x20E_ALLOCATION_ALREADY_SPECIFIED','applies_to':['allocators\x20(when\x20bound\x20via\x20Service.order_allocators)']},{'id':'MC-A-14','category':'cross_object','rule':'allocators\x20cannot\x20be\x20modified\x20after\x20Service\x20publish\x20—\x20Service.order_allocators\x20is\x20frozen\x20(R-A-3-01)','applies_to':['Service.order_allocators','Service\x20publish\x20operation']},{'id':'MC-A-15','category':'cross_object','rule':'Arbitration.fees_alloc\x20requires\x20ARBITRATION_FEES_ALLOC=365\x20permission\x20(independent\x20from\x20Service-order\x20Allocation)','applies_to':['Arbitration\x20fees_alloc\x20operation']}];export const ALLOCATION_TRANSLATION_VERSION='1.0.0';export function matchSemanticPattern(a){const b=a['toLowerCase']();return SEMANTIC_TO_SCHEMA_RULES['filter'](c=>c['match_keywords']['some'](d=>b['includes'](d['toLowerCase']())));}export function explainAllocationCallData(a){const b=[],c=a['object']!==null&&a['object']!==undefined&&typeof a['object']==='object'&&!Array['isArray'](a['object']);if(c){const d=a['object'];b['push']('Operation:\x20CREATE\x20new\x20Allocation\x20\x27'+d['name']+'\x27\x20('+(d['type_parameter']??'<missing\x20type_parameter>')+')');if(!a['allocators'])return b['push']('⚠️\x20Missing\x20required\x20field:\x20allocators'),b['join']('\x0a');const e=a['allocators'];b['push']('-\x20Description:\x20\x22'+e['description']+'\x22'),b['push']('-\x20Threshold:\x20'+e['threshold']),b['push']('-\x20Allocators:\x20'+e['allocators']['length']+'\x20(max\x20'+MAX_ALLOCATOR_COUNT+')'),e['allocators']['forEach']((f,g)=>{b['push']('\x20\x20[Allocator\x20'+g+']\x20guard='+f['guard']+',\x20fix='+(f['fix']??'<computed>')+',\x20max='+(f['max']??'null'));const h=f['sharing']['filter'](m=>m['mode']==='Surplus')['length'],i=f['sharing']['filter'](m=>m['mode']==='Rate')['reduce']((m,n)=>m+Number(n['sharing']),0x0),j=f['sharing']['filter'](m=>m['mode']==='Amount')['reduce']((m,n)=>m+Number(n['sharing']),0x0),k=h>0x0,l=f['sharing']['some'](m=>m['mode']==='Rate');h>0x1&&b['push']('\x20\x20\x20\x20⚠️\x20EMULTIPLE_SURPLUS:\x20'+h+'\x20Surplus\x20entries\x20(max\x201\x20allowed)'),l&&!k&&i!==RATE_TOTAL_FULL&&b['push']('\x20\x20\x20\x20⚠️\x20ERATE_NOT_10000:\x20pure\x20Rate\x20sum='+i+'\x20(must\x20equal\x20'+RATE_TOTAL_FULL+')'),l&&k&&i>RATE_TOTAL_FULL&&b['push']('\x20\x20\x20\x20⚠️\x20ERATE_EXCEEDS_10000:\x20Rate+Surplus\x20sum='+i+'\x20(must\x20be\x20<=\x20'+RATE_TOTAL_FULL+')'),!l&&!k&&j<Number(e['threshold'])&&b['push']('\x20\x20\x20\x20⚠️\x20EAMOUNT_BELOW_THRESHOLD:\x20Amount\x20sum='+j+'\x20<\x20threshold='+e['threshold']),f['max']!=null&&j>Number(f['max'])&&b['push']('\x20\x20\x20\x20⚠️\x20EAMOUNT_EXCEEDS_MAX:\x20Amount\x20sum='+j+'\x20>\x20max='+f['max']),f['sharing']['forEach']((m,n)=>{const o=getRecipientType(m['who']),p=allocationModeToNumber(m['mode']);let q='\x20\x20\x20\x20[Sharing\x20'+n+']\x20mode='+m['mode']+'('+p+'),\x20sharing='+m['sharing']+',\x20who='+o;if(isEntityRecipient(m['who']))q+='\x20('+m['who']['Entity']+')';else{if(isGuardIdentifierRecipient(m['who']))q+='\x20(identifier='+m['who']['GuardIdentifier']+')';else isSignerRecipient(m['who'])&&(q+='\x20⚠️\x20CRITICAL:\x20Signer\x20recipient\x20—\x20requires\x20strict\x20Guard\x20binding\x20(R-A-2-01\x20theft\x20risk)');}b['push'](q);});}),!a['coin']&&b['push']('⚠️\x20Missing\x20required\x20field:\x20coin\x20(initial\x20balance\x20seed)'),!a['payment_info']&&b['push']('⚠️\x20Missing\x20required\x20field:\x20payment_info\x20(required\x20at\x20alloc()\x20time\x20—\x20ENO_PAYMENT_INFO)');}else{if(a['object']&&typeof a['object']==='string'){b['push']('Operation:\x20OPERATE\x20existing\x20Allocation\x20at\x20'+a['object']);if(a['received_coins']){const f=a['received_coins'];b['push']('-\x20Receive:\x20'+f['received']['length']+'\x20CoinWrapper\x20deposit(s)\x20of\x20type\x20'+f['token_type']),f['received']['forEach']((g,h)=>{b['push']('\x20\x20['+h+']\x20id='+g['id']+',\x20payment='+g['payment']);});}a['alloc_by_guard']&&(b['push']('-\x20Alloc\x20by\x20Guard:\x20'+a['alloc_by_guard']),b['push']('\x20\x20→\x20Triggers\x202-phase\x20call:\x20Passport\x20submission\x20request\x20→\x20on-chain\x20alloc()'),b['push']('\x20\x20→\x20caller-specified\x20guard:\x20this\x20Guard\x20MUST\x20be\x20one\x20of\x20allocators[].guard;\x20on\x20verification\x20failure,\x20caller\x20must\x20actively\x20switch\x20guard\x20and\x20retry')),!a['received_coins']&&!a['alloc_by_guard']&&b['push']('⚠️\x20Operate\x20form\x20requires\x20at\x20least\x20one\x20of:\x20received_coins,\x20alloc_by_guard');}else b['push']('⚠️\x20Cannot\x20determine\x20operation:\x20object\x20must\x20be\x20TypeNamedObject\x20(create)\x20or\x20string\x20(operate)');}return b['join']('\x0a');}export function explainField(a){return SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='field'&&b['type_name']===a);}export function explainOp(a){return SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='op'&&b['type_name']===a);}export function explainMode(a){return SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='mode'&&b['type_name']===a);}export function explainRecipient(a){return SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='recipient'&&b['type_name']===a);}export function getConstraintsByCategory(a){return ALLOCATION_CONSTRAINT_RULES['filter'](b=>b['category']===a);}export function explainError(a){const b={[ALLOCATION_ERROR_CODES['ERECIPIENT_IDENTIFIER_NOT_ADDRESS']]:'GuardIdentifier\x20resolved\x20value\x20is\x20not\x20an\x20address\x20type\x20—\x20Passport\x20table[identifier]\x20must\x20be\x20address',[ALLOCATION_ERROR_CODES['EALLOCATOR_COUNT_EXCEEDED']]:'Allocator\x20count\x20exceeds\x20MAX_ALLOCATOR_COUNT\x20(100)',[ALLOCATION_ERROR_CODES['ENO_ALLOCATOR']]:'No\x20Allocator\x20in\x20the\x20allocators\x20vector\x20—\x20sharing\x20array\x20is\x20empty',[ALLOCATION_ERROR_CODES['ERATE_NOT_10000']]:'Pure\x20Rate\x20mode\x20sum(rates)\x20!=\x2010000\x20—\x20add\x20Surplus\x20or\x20adjust\x20rates\x20to\x20total\x2010000',[ALLOCATION_ERROR_CODES['EMULTIPLE_SURPLUS']]:'Multiple\x20Surplus\x20sharing\x20in\x20a\x20single\x20Allocator\x20—\x20at\x20most\x201\x20Surplus\x20allowed',[ALLOCATION_ERROR_CODES['ERATE_EXCEEDS_10000']]:'Rate\x20+\x20Surplus\x20sum(rates)\x20>\x2010000\x20—\x20reduce\x20rates\x20so\x20total\x20is\x20<=\x2010000',[ALLOCATION_ERROR_CODES['EINSUFFICIENT_BALANCE']]:'balance\x20<\x20threshold\x20(insufficient\x20balance\x20to\x20trigger\x20alloc)\x20—\x20deposit\x20more\x20via\x20receive()',[ALLOCATION_ERROR_CODES['EALLOCATORS_EMPTY']]:'allocators.allocators\x20is\x20empty\x20—\x20at\x20least\x201\x20Allocator\x20required',[ALLOCATION_ERROR_CODES['ENO_PAYMENT_INFO']]:'payment_info\x20is\x20None\x20when\x20alloc()\x20is\x20called\x20—\x20set\x20payment_info\x20at\x20create\x20time',[ALLOCATION_ERROR_CODES['ESHARING_COUNT_EXCEEDED']]:'sharing\x20count\x20exceeds\x20MAX_SHARING_COUNT\x20(100)\x20—\x20split\x20into\x20multiple\x20Allocators',[ALLOCATION_ERROR_CODES['ESHARING_MODE_INVALID']]:'sharing\x20mode\x20is\x20not\x200\x20(Amount)\x20/\x201\x20(Rate)\x20/\x202\x20(Surplus)\x20—\x20check\x20mode\x20value',[ALLOCATION_ERROR_CODES['EAMOUNT_BELOW_THRESHOLD']]:'Amount\x20sum\x20(fix)\x20<\x20threshold\x20—\x20increase\x20Amount\x20or\x20lower\x20threshold',[ALLOCATION_ERROR_CODES['EAMOUNT_EXCEEDS_MAX']]:'Amount\x20sum\x20(fix)\x20>\x20max\x20—\x20decrease\x20Amount\x20or\x20raise\x20max'};return b[a]??'Unknown\x20Allocation\x20error\x20code:\x20'+a;}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare const ARB_CONFIRM_VERSION = "1.0.0";
|
|
2
|
-
export type ConfirmSeverity = "block" | "warn" | "info";
|
|
3
|
-
export interface ArbConfirmItem {
|
|
4
|
-
id: string;
|
|
5
|
-
severity: ConfirmSeverity;
|
|
6
|
-
title: string;
|
|
7
|
-
description: string;
|
|
8
|
-
passed: boolean;
|
|
9
|
-
evidence?: string;
|
|
10
|
-
fix_hint?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface ArbOpCheckInput {
|
|
13
|
-
status?: number;
|
|
14
|
-
invalid_transition?: boolean;
|
|
15
|
-
proposition_count?: number;
|
|
16
|
-
votor_count?: number;
|
|
17
|
-
voting_deadline_none?: boolean;
|
|
18
|
-
withdraw_too_early?: boolean;
|
|
19
|
-
order_mismatch?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare function preCheckArbOp(input: ArbOpCheckInput): ArbConfirmItem[];
|
|
22
|
-
export declare function canProceedArbOp(input: ArbOpCheckInput): {
|
|
23
|
-
canProceed: boolean;
|
|
24
|
-
blockers: ArbConfirmItem[];
|
|
25
|
-
warnings: ArbConfirmItem[];
|
|
26
|
-
info: ArbConfirmItem[];
|
|
27
|
-
};
|
|
28
|
-
export declare function formatArbOpSummary(input: ArbOpCheckInput): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MAX_PROPOSITION_COUNT,MAX_VOTOR_COUNT}from'@wowok/wowok';export const ARB_CONFIRM_VERSION='1.0.0';function checkStatusTransition(a){if(!a['invalid_transition'])return{'id':'C-ARB-01','severity':'info','title':'Status\x20transition\x20is\x20valid','description':'Each\x20Arb\x20op\x20asserts\x20the\x20current\x20status;\x20out-of-order\x20calls\x20abort\x20with\x20E_STATUS_NOT_MATCH\x20(3).','passed':!![],'evidence':a['status']===undefined?'status\x20not\x20provided':'status='+a['status']};return{'id':'C-ARB-01','severity':'block','title':'Invalid\x20state\x20transition\x20—\x20will\x20abort\x20with\x20E_STATUS_NOT_MATCH\x20(3)','description':'Arb\x20is\x20a\x207-state\x20machine\x20(0\x20Principal_confirming\x20→\x20…\x20→\x206\x20Withdrawn).\x20Calling\x20an\x20op\x20out\x20of\x20order\x20leaves\x20the\x20case\x20stuck.','passed':![],'evidence':'invalid_transition=true,\x20status='+(a['status']??'?'),'fix_hint':'Validate\x20current\x20status\x20against\x20the\x20op\x27s\x20expected\x20pre-state\x20before\x20submitting.'};}function checkOrderMatch(a){if(!a['order_mismatch'])return{'id':'C-ARB-02','severity':'info','title':'Order\x20matches\x20arb.order','description':'ops\x20assert\x20self.order\x20==\x20id_address(order),\x20else\x20E_ARB_ORDER_NOT_MATCH\x20(2).','passed':!![],'evidence':'order\x20assumed\x20matching'};return{'id':'C-ARB-02','severity':'block','title':'Order\x20mismatch\x20—\x20aborts\x20with\x20E_ARB_ORDER_NOT_MATCH\x20(2)','description':'The\x20passed\x20Order\x20address\x20must\x20equal\x20the\x20Arb\x27s\x20bound\x20order.','passed':![],'evidence':'order_mismatch=true','fix_hint':'Pass\x20the\x20Order\x20that\x20created\x20this\x20Arb.'};}function checkPropositionCount(a){if(a['proposition_count']===undefined)return{'id':'C-ARB-03','severity':'info','title':'proposition_count\x20≤\x20MAX_PROPOSITION_COUNT\x20('+MAX_PROPOSITION_COUNT+')','description':'proposition_change\x20aborts\x20with\x20E_MAX_PROPOSITION_COUNT\x20(1)\x20above\x20the\x20cap.','passed':!![],'evidence':'not\x20provided'};const b=a['proposition_count']<=MAX_PROPOSITION_COUNT;return{'id':'C-ARB-03','severity':b?'info':'block','title':'proposition_count\x20≤\x20MAX_PROPOSITION_COUNT\x20('+MAX_PROPOSITION_COUNT+')','description':'proposition\x20may\x20hold\x20at\x20most\x20MAX_PROPOSITION_COUNT='+MAX_PROPOSITION_COUNT+'\x20entries.','passed':b,'evidence':'proposition_count='+a['proposition_count']+',\x20limit='+MAX_PROPOSITION_COUNT,'fix_hint':'Trim\x20the\x20proposition\x20list\x20to\x20the\x20voting\x20options.'};}function checkVotorCount(a){if(a['votor_count']===undefined)return{'id':'C-ARB-04','severity':'info','title':'votor_count\x20<\x20MAX_VOTOR_COUNT\x20('+MAX_VOTOR_COUNT+')','description':'vote\x20aborts\x20with\x20E_MAX_VOTOR_COUNT\x20(6)\x20at\x20the\x20boundary.','passed':!![],'evidence':'not\x20provided'};const b=a['votor_count']<MAX_VOTOR_COUNT;return{'id':'C-ARB-04','severity':b?'info':'warn','title':'votor_count\x20<\x20MAX_VOTOR_COUNT\x20('+MAX_VOTOR_COUNT+')','description':'A\x20single\x20Arb\x20may\x20record\x20up\x20to\x20MAX_VOTOR_COUNT='+MAX_VOTOR_COUNT+'\x20voters;\x20large\x20juries\x20inflate\x20tally\x20cost.','passed':b,'evidence':'votor_count='+a['votor_count']+',\x20limit='+MAX_VOTOR_COUNT,'fix_hint':'Self-limit\x20voter\x20count\x20based\x20on\x20the\x20Arbitration\x20rule\x27s\x20quorum.'};}function checkVotingDeadline(a){if(!a['voting_deadline_none'])return{'id':'C-ARB-05','severity':'info','title':'voting_deadline\x20is\x20set\x20(Some)','description':'When\x20Some(t),\x20vote()\x20aborts\x20with\x20E_VOTING_DEADLINE_PASSED\x20(7)\x20if\x20clock\x20>\x20t.','passed':!![],'evidence':'deadline\x20set'};return{'id':'C-ARB-05','severity':'warn','title':'voting_deadline\x20is\x20None\x20—\x20open-ended\x20vote','description':'None\x20means\x20no\x20deadline;\x20the\x20vote\x20can\x20stall\x20indefinitely\x20and\x20E_VOTING_DEADLINE_PASSED\x20never\x20triggers.','passed':![],'evidence':'voting_deadline_none=true','fix_hint':'Set\x20an\x20explicit\x20deadline\x20via\x20arbitrator_confirm\x20unless\x20an\x20open\x20vote\x20is\x20intended.'};}function checkWithdraw(a){if(!a['withdraw_too_early'])return{'id':'C-ARB-06','severity':'info','title':'Withdraw\x20timing\x20is\x20valid','description':'Finished(5)\x20withdraws\x20immediately;\x20Arbitrated(3)/Objectionable(4)\x20wait\x20WITHDRAW_DURATION_TIME\x20(30\x20days).','passed':!![],'evidence':'withdraw\x20timing\x20ok'};return{'id':'C-ARB-06','severity':'warn','title':'Withdraw\x20too\x20early\x20—\x20funds\x20still\x20locked\x20(30-day\x20window)','description':'From\x20Arbitrated/Objectionable,\x20the\x20fee\x20Balance\x20is\x20locked\x20until\x20indemnity.time\x20+\x20WITHDRAW_DURATION_TIME\x20(30\x20days).','passed':![],'evidence':'withdraw_too_early=true','fix_hint':'Drive\x20the\x20case\x20to\x20Finished(5)\x20for\x20immediate\x20withdraw,\x20or\x20wait\x20out\x20the\x20lock.'};}export function preCheckArbOp(a){return[checkStatusTransition(a),checkOrderMatch(a),checkPropositionCount(a),checkVotorCount(a),checkVotingDeadline(a),checkWithdraw(a)];}export function canProceedArbOp(a){const b=preCheckArbOp(a);return{'canProceed':b['every'](c=>c['severity']!=='block'||c['passed']),'blockers':b['filter'](c=>c['severity']==='block'&&!c['passed']),'warnings':b['filter'](c=>c['severity']==='warn'&&!c['passed']),'info':b['filter'](c=>c['severity']==='info')};}export function formatArbOpSummary(a){const {canProceed:b,blockers:c,warnings:d}=canProceedArbOp(a),e=[b?'✓\x20Arb\x20operation\x20pre-check\x20PASSED':'✗\x20Arb\x20operation\x20pre-check\x20FAILED',''];return c['length']>0x0&&(e['push']('BLOCKERS:'),c['forEach'](f=>e['push']('\x20\x20['+f['id']+']\x20'+f['title']+'\x20—\x20'+(f['evidence']??''))),e['push']('')),d['length']>0x0&&(e['push']('WARNINGS:'),d['forEach'](f=>e['push']('\x20\x20['+f['id']+']\x20'+f['title']+'\x20—\x20'+(f['evidence']??'')))),e['join']('\x0a');}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export declare const ARB_TRANSLATION_VERSION = "1.0.0";
|
|
2
|
-
export declare const ARB_STATUS: {
|
|
3
|
-
readonly PRINCIPAL_CONFIRMING: 0;
|
|
4
|
-
readonly ARBITRATOR_CONFIRMING: 1;
|
|
5
|
-
readonly VOTING: 2;
|
|
6
|
-
readonly ARBITRATED: 3;
|
|
7
|
-
readonly OBJECTIONABLE: 4;
|
|
8
|
-
readonly FINISHED: 5;
|
|
9
|
-
readonly WITHDRAWN: 6;
|
|
10
|
-
};
|
|
11
|
-
export interface SemanticToArbSchemaRule {
|
|
12
|
-
id: string;
|
|
13
|
-
pattern_name: string;
|
|
14
|
-
semantic_intent: string;
|
|
15
|
-
match_keywords: string[];
|
|
16
|
-
required_fields: string[];
|
|
17
|
-
optional_fields: string[];
|
|
18
|
-
example: Record<string, unknown>;
|
|
19
|
-
}
|
|
20
|
-
export declare const SEMANTIC_TO_ARB_SCHEMA_RULES: SemanticToArbSchemaRule[];
|
|
21
|
-
export interface ArbFieldTranslation {
|
|
22
|
-
field_name: string;
|
|
23
|
-
value_type: string;
|
|
24
|
-
semantic: string;
|
|
25
|
-
format_example: string;
|
|
26
|
-
validation_rules: string[];
|
|
27
|
-
}
|
|
28
|
-
export declare const ARB_FIELD_TRANSLATIONS: ArbFieldTranslation[];
|
|
29
|
-
export interface ArbConstraintRule {
|
|
30
|
-
id: string;
|
|
31
|
-
name: string;
|
|
32
|
-
description: string;
|
|
33
|
-
related_field: string;
|
|
34
|
-
}
|
|
35
|
-
export declare const ARB_CONSTRAINT_RULES: ArbConstraintRule[];
|
|
36
|
-
export interface ArbExplainInput {
|
|
37
|
-
status?: number;
|
|
38
|
-
voting_deadline?: number | null;
|
|
39
|
-
indemnity_amount?: number | null;
|
|
40
|
-
proposition_count?: number;
|
|
41
|
-
}
|
|
42
|
-
export interface ArbExplanation {
|
|
43
|
-
summary: string;
|
|
44
|
-
status_label: string;
|
|
45
|
-
deadline: string;
|
|
46
|
-
warnings: string[];
|
|
47
|
-
}
|
|
48
|
-
export declare function explainArb(input: ArbExplainInput): ArbExplanation;
|