@wowok/agent-mcp 3.3.6 → 3.3.7

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.
Files changed (137) hide show
  1. package/dist/chain-semantics/eval-order.js +1 -1
  2. package/dist/chain-semantics/field-capability.js +1 -1
  3. package/dist/chain-semantics/fund-flow.js +1 -1
  4. package/dist/chain-semantics/guard-verbs.js +1 -1
  5. package/dist/chain-semantics/object-graph.js +1 -1
  6. package/dist/composition/audit.js +1 -1
  7. package/dist/composition/compile.d.ts +2 -1
  8. package/dist/composition/compile.js +1 -1
  9. package/dist/composition/materialize.js +1 -1
  10. package/dist/data/projection/facets.spec.js +1 -1
  11. package/dist/evaluation/match-policy.d.ts +30 -6
  12. package/dist/evaluation/match-policy.js +1 -1
  13. package/dist/evaluation/match-policy.spec.js +1 -1
  14. package/dist/extensions/business-modules.js +1 -1
  15. package/dist/harness/recover.js +1 -1
  16. package/dist/intent/types.d.ts +1 -1
  17. package/dist/intent/types.js +1 -1
  18. package/dist/keeper/detectors.d.ts +3 -0
  19. package/dist/keeper/detectors.js +1 -1
  20. package/dist/keeper/keeper.spec.js +1 -1
  21. package/dist/knowledge/allocator-rail-verifier.js +1 -1
  22. package/dist/knowledge/audit-rules.js +1 -1
  23. package/dist/knowledge/baselines/rules/plan.json +97 -2
  24. package/dist/knowledge/builtin-templates.d.ts +6 -1
  25. package/dist/knowledge/builtin-templates.js +1 -1
  26. package/dist/knowledge/event-semantics.js +1 -1
  27. package/dist/knowledge/guard-design-patterns.js +1 -1
  28. package/dist/knowledge/guard-templates.d.ts +1 -1
  29. package/dist/knowledge/guard-templates.js +1 -1
  30. package/dist/knowledge/industry-generalizer.d.ts +4 -0
  31. package/dist/knowledge/industry-generalizer.js +1 -1
  32. package/dist/knowledge/semantic-ir.d.ts +113 -0
  33. package/dist/knowledge/semantic-ir.js +1 -0
  34. package/dist/knowledge/strategy-manuals.js +1 -1
  35. package/dist/knowledge/template-loader.d.ts +34 -0
  36. package/dist/knowledge/template-loader.js +1 -1
  37. package/dist/knowledge/template-prose.d.ts +50 -0
  38. package/dist/knowledge/template-prose.js +1 -0
  39. package/dist/knowledge/template-registry.js +1 -1
  40. package/dist/knowledge/template-scanner.d.ts +1 -1
  41. package/dist/knowledge/template-scanner.js +1 -1
  42. package/dist/knowledge/tools-reference.js +1 -1
  43. package/dist/monitor/MonitorLoop.js +1 -1
  44. package/dist/monitor/normalize.d.ts +1 -1
  45. package/dist/monitor/normalize.js +1 -1
  46. package/dist/monitor/types.js +1 -1
  47. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  48. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  49. package/dist/playbooks/service-build/merchant-guide.d.ts +4 -0
  50. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  51. package/dist/playbooks/service-build/migration-planner.d.ts +2 -1
  52. package/dist/playbooks/service-build/migration-planner.js +1 -1
  53. package/dist/playbooks/service-build/mode-actions.d.ts +7 -0
  54. package/dist/playbooks/service-build/mode-actions.js +1 -1
  55. package/dist/playbooks/service-build/object-panorama.d.ts +22 -1
  56. package/dist/playbooks/service-build/object-panorama.js +1 -1
  57. package/dist/playbooks/service-build/participation-radar.js +1 -1
  58. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  59. package/dist/playbooks/service-build/reverse-mapping-nk4.spec.js +1 -1
  60. package/dist/playbooks/service-build/reverse-mapping.d.ts +1 -0
  61. package/dist/playbooks/service-build/reverse-mapping.js +1 -1
  62. package/dist/playbooks/service-build/service-panorama.js +1 -1
  63. package/dist/playbooks/service-build/service-quote.js +1 -1
  64. package/dist/review/index.js +1 -1
  65. package/dist/safety/confirm-gate.js +1 -1
  66. package/dist/schema/benchmark-migration/index.d.ts +64 -10
  67. package/dist/schema/benchmark-migration/index.js +1 -1
  68. package/dist/schema/call/arbitration.js +1 -1
  69. package/dist/schema/call/base.d.ts +8 -0
  70. package/dist/schema/call/bridge.d.ts +2 -0
  71. package/dist/schema/call/error-codes.d.ts +1 -1
  72. package/dist/schema/call/error-codes.js +1 -1
  73. package/dist/schema/call/reward.d.ts +10 -0
  74. package/dist/schema/call/reward.js +1 -1
  75. package/dist/schema/call/semantic.js +1 -1
  76. package/dist/schema/call/service.js +1 -1
  77. package/dist/schema/common/index.js +1 -1
  78. package/dist/schema/evaluation/index.d.ts +152 -0
  79. package/dist/schema/evaluation/index.js +1 -1
  80. package/dist/schema/goal/index.d.ts +2 -0
  81. package/dist/schema/goal/planning.d.ts +3 -0
  82. package/dist/schema/goal/planning.js +1 -1
  83. package/dist/schema/industry-pack/index.d.ts +62 -0
  84. package/dist/schema/industry-pack/modes.d.ts +62 -0
  85. package/dist/schema/industry-pack/modes.js +1 -1
  86. package/dist/schema/intent-radar/index.d.ts +3 -0
  87. package/dist/schema/intent-radar/index.js +1 -1
  88. package/dist/schema/local/index.d.ts +20 -0
  89. package/dist/schema/local/index.js +1 -1
  90. package/dist/schema/operations.d.ts +5 -0
  91. package/dist/schema/query/index.d.ts +145 -47
  92. package/dist/schema/query/index.js +1 -1
  93. package/dist/schema/schema-version.js +1 -1
  94. package/dist/schema-query-impl/index.js +1 -1
  95. package/dist/schemas/account_operation.output.json +2 -0
  96. package/dist/schemas/benchmark_migration_operation.output.json +42 -0
  97. package/dist/schemas/benchmark_migration_operation.schema.json +208 -5
  98. package/dist/schemas/bridge_operation.output.json +2 -0
  99. package/dist/schemas/evaluation_operation.output.json +240 -0
  100. package/dist/schemas/evaluation_operation.schema.json +397 -1
  101. package/dist/schemas/goal_operation.schema.json +18 -10
  102. package/dist/schemas/index.json +1 -1
  103. package/dist/schemas/industry_pack_operation.output.json +86 -2
  104. package/dist/schemas/industry_pack_operation.schema.json +199 -0
  105. package/dist/schemas/intent_radar.output.json +2 -0
  106. package/dist/schemas/intent_radar.schema.json +1 -0
  107. package/dist/schemas/local_cache_operation.output.json +2 -0
  108. package/dist/schemas/local_history_operation.output.json +2 -0
  109. package/dist/schemas/local_info_operation.output.json +2 -0
  110. package/dist/schemas/local_mark_operation.output.json +2 -0
  111. package/dist/schemas/onchain_events.output.json +281 -11
  112. package/dist/schemas/onchain_events.schema.json +5 -1
  113. package/dist/schemas/onchain_operations.output.json +2 -0
  114. package/dist/schemas/onchain_operations.schema.json +37 -3
  115. package/dist/schemas/onchain_operations_arbitration.schema.json +1 -1
  116. package/dist/schemas/onchain_operations_reward.schema.json +35 -1
  117. package/dist/schemas/onchain_operations_service.schema.json +1 -1
  118. package/dist/schemas/query_toolkit.output.json +34 -0
  119. package/dist/tools/handlers/benchmark-migration.d.ts +1 -0
  120. package/dist/tools/handlers/benchmark-migration.js +1 -1
  121. package/dist/tools/handlers/config.js +1 -1
  122. package/dist/tools/handlers/evaluation.js +1 -1
  123. package/dist/tools/handlers/evaluation.spec.js +1 -1
  124. package/dist/tools/handlers/intent-radar.js +1 -1
  125. package/dist/tools/handlers/messenger.d.ts +1 -0
  126. package/dist/tools/handlers/messenger.js +1 -1
  127. package/dist/tools/handlers/onchain.d.ts +1 -0
  128. package/dist/tools/handlers/onchain.js +1 -1
  129. package/dist/tools/handlers/query.js +1 -1
  130. package/dist/tools/handlers/wip.js +1 -1
  131. package/dist/tools/registry/agent.js +1 -1
  132. package/dist/tools/registry/query.js +1 -1
  133. package/dist/tools/wip-verify-ledger.d.ts +14 -0
  134. package/dist/tools/wip-verify-ledger.js +1 -0
  135. package/dist/tools/wrap.d.ts +4 -0
  136. package/dist/tools/wrap.js +1 -1
  137. package/package.json +2 -2
@@ -1 +1 @@
1
- import*as a468a from'@wowok/wowok';const SDK_SCHEMA_VERSION=a468a['SCHEMA_VERSION']??'1.0.0',checkSchemaCompatibility=a468a['checkSchemaCompatibility']??((a,b)=>({'compatible':!![]}));export const MCP_SCHEMA_VERSION='1.2.0';export function getSchemaVersions(){return{'sdk':SDK_SCHEMA_VERSION,'mcp':MCP_SCHEMA_VERSION};}export function checkClientSchemaCompatibility(a,b={}){const c=getSchemaVersions(),d={'compatible':!![],'warnings':[],'errors':[],'versions':c,'client_version':a};if(!a)return d;const e=checkSchemaCompatibility(a,c['sdk']);if(!e['compatible']){d['compatible']=![];const g='SDK\x20schema\x20incompatibility:\x20'+e['reason'];b['mode']==='strict'?d['errors']['push'](g):d['warnings']['push'](g);}const f=checkSchemaCompatibility(a,c['mcp']);if(!f['compatible']){d['compatible']=![];const h='MCP\x20schema\x20incompatibility:\x20'+f['reason'];b['mode']==='strict'?d['errors']['push'](h):d['warnings']['push'](h);}return d;}export function attachSchemaWarning(a,b){if(b['warnings']['length']===0x0&&b['errors']['length']===0x0)return a;const c=[];b['warnings']['length']>0x0&&c['push'](...b['warnings']);b['errors']['length']>0x0&&c['push'](...b['errors']);const d=a['semantic']?{...a['semantic'],'warnings':[...a['semantic']['warnings']||[],...c]}:undefined;return{...a,'semantic':d,'schema_warning':{'compatible':b['compatible'],'warnings':c,'client_version':b['client_version'],'server_versions':b['versions']}};}
1
+ import*as a470a from'@wowok/wowok';const SDK_SCHEMA_VERSION=a470a['SCHEMA_VERSION']??'1.0.0',checkSchemaCompatibility=a470a['checkSchemaCompatibility']??((a,b)=>({'compatible':!![]}));export const MCP_SCHEMA_VERSION='1.2.0';export function getSchemaVersions(){return{'sdk':SDK_SCHEMA_VERSION,'mcp':MCP_SCHEMA_VERSION};}export function checkClientSchemaCompatibility(a,b={}){const c=getSchemaVersions(),d={'compatible':!![],'warnings':[],'errors':[],'versions':c,'client_version':a};if(!a)return d;const e=checkSchemaCompatibility(a,c['sdk']);if(!e['compatible']){d['compatible']=![];const g='SDK\x20schema\x20incompatibility:\x20'+e['reason'];b['mode']==='strict'?d['errors']['push'](g):d['warnings']['push'](g);}const f=checkSchemaCompatibility(a,c['mcp']);if(!f['compatible']){d['compatible']=![];const h='MCP\x20schema\x20incompatibility:\x20'+f['reason'];b['mode']==='strict'?d['errors']['push'](h):d['warnings']['push'](h);}return d;}export function attachSchemaWarning(a,b){if(b['warnings']['length']===0x0&&b['errors']['length']===0x0)return a;const c=[];b['warnings']['length']>0x0&&c['push'](...b['warnings']);b['errors']['length']>0x0&&c['push'](...b['errors']);const d=a['semantic']?{...a['semantic'],'warnings':[...a['semantic']['warnings']||[],...c]}:undefined;return{...a,'semantic':d,'schema_warning':{'compatible':b['compatible'],'warnings':c,'client_version':b['client_version'],'server_versions':b['versions']}};}
@@ -1 +1 @@
1
- import{readFileSync,existsSync,writeFileSync,mkdirSync}from'fs';import{resolve,join,dirname}from'path';import{fileURLToPath}from'url';import{GUARDQUERY,ObjectType,ValueType}from'@wowok/wowok';import{TOOLS_REFERENCE,getToolReference,searchToolReference,getToolSequence}from'../knowledge/tools-reference.js';import{GUARD_DESIGN_PATTERNS,getGuardDesignPattern,GUARD_DESIGN_PATTERNS_VERSION,GUARD_SCHEMA_NOTES}from'../knowledge/guard-design-patterns.js';import{OBJECT_REUSE_RULES,CREATE_VS_MODIFY_PATTERN,IMMUTABILITY_RULES,PROTOCOL_SLOT_RULES,OPERATION_TYPE_CLASSIFICATION,OPERATION_CLASS_META,NAMING_CONVENTIONS,SAFETY_RULES_VERSION}from'../knowledge/safety-rules.js';import{listTemplates as a480a,getTemplateDetail,instantiateTemplate,getTemplateCounts,TEMPLATE_OBJECT_TYPES}from'../knowledge/template-registry.js';import{lintGuard,formatLintResult}from'../knowledge/guard-lint.js';import{renderGuardTreeIndented,renderGuardMermaid,walkGuardTree}from'../knowledge/guard-render.js';import{getGuardQueryByIdOrName}from'../schema/utils/guard-query-utils.js';const __filename=fileURLToPath(import.meta.url),__dirname=fileURLToPath(new URL('.',import.meta.url)),SCHEMAS_DIR=resolve(__dirname,'../../dist/schemas'),GUARD_TEMPLATES_PATH_SCRIPTS=resolve(__dirname,'../../scripts/guard-templates.json'),GUARD_TEMPLATES_PATH_DIST=resolve(__dirname,'../../dist/schemas/guard-templates.json'),GUARD_TEMPLATES_PATH=existsSync(GUARD_TEMPLATES_PATH_SCRIPTS)?GUARD_TEMPLATES_PATH_SCRIPTS:GUARD_TEMPLATES_PATH_DIST,WORKSPACE_TMP_DIR=resolve(process['cwd'](),'.trae','tmp');export function areSchemasAvailable(){return existsSync(SCHEMAS_DIR)&&existsSync(join(SCHEMAS_DIR,'index.json'));}export function getSchemaIndex(){try{const a=join(SCHEMAS_DIR,'index.json');if(!existsSync(a))return null;const b=readFileSync(a,'utf-8');return JSON['parse'](b);}catch{return null;}}export function listSchemas(){const a=getSchemaIndex();if(!a)return[];return[...a['tools']||[],...a['operations']||[]];}export function getSchema(a){try{let b=join(SCHEMAS_DIR,a+'.schema.json');!existsSync(b)&&(b=join(SCHEMAS_DIR,a+'.json'));if(!existsSync(b))return null;const c=readFileSync(b,'utf-8'),d=JSON['parse'](c);return resolveSchemaRefs(d);}catch{return null;}}export function getOutputSchema(a){try{const b=join(SCHEMAS_DIR,a+'.output.json');if(!existsSync(b))return null;const c=readFileSync(b,'utf-8'),d=JSON['parse'](c);return resolveSchemaRefs(d);}catch{return null;}}export function getGuardTemplates(a){try{if(!existsSync(GUARD_TEMPLATES_PATH))return null;const b=readFileSync(GUARD_TEMPLATES_PATH,'utf-8'),c=JSON['parse'](b);if(!a)return{'version':c['version'],'description':c['description'],'templates':(c['templates']||[])['map'](e=>({'name':e['name'],'title':e['title'],'description':e['description'],'use_case':e['use_case']})),'query_reference':c['query_reference'],'node_return_types':c['node_return_types']};const d=(c['templates']||[])['find'](e=>e['name']===a);if(!d)return null;return d;}catch{return null;}}export function getSchemaField(a,b){const c=getSchema(a);if(!c)return null;const d=b['split']('.')['filter'](Boolean);let e=c;for(const f of d){if(!e||typeof e!=='object')return null;if(e['properties']&&f in e['properties']){e=e['properties'][f];continue;}if(e['items']&&typeof e['items']==='object'){if(/^\d+$/['test'](f)){e=e['items'];continue;}if(e['items']['properties']&&f in e['items']['properties']){e=e['items']['properties'][f];continue;}}if(Array['isArray'](e['oneOf'])||Array['isArray'](e['anyOf'])){const g=e['oneOf']??e['anyOf'];for(const h of g){if(h&&typeof h==='object'&&h['properties']&&f in h['properties']){e=h['properties'][f];break;}}continue;}if(f in e){e=e[f];continue;}return null;}return e;}function resolveSchemaRefs(a,b=new Set()){if(!a||typeof a!=='object')return a;if(Array['isArray'](a))return a['map'](d=>resolveSchemaRefs(d,b));const c={};for(const [d,e]of Object['entries'](a)){if(d==='$ref'&&typeof e==='string'){if(e['startsWith']('#'))c[d]=e;else{const f=loadRefSchema(e,b);f&&Object['assign'](c,resolveSchemaRefs(f,b));}}else typeof e==='object'?c[d]=resolveSchemaRefs(e,b):c[d]=e;}return c;}function loadRefSchema(a,b){if(a['startsWith']('#'))return null;if(b['has'](a))return{'description':'Circular\x20reference\x20to\x20'+a};b['add'](a);try{const c=join(SCHEMAS_DIR,a);if(!existsSync(c))return null;const d=readFileSync(c,'utf-8');return JSON['parse'](d);}catch{return null;}}export function searchSchemas(a){const b=listSchemas(),c=a['toLowerCase']();return b['filter'](d=>{const e=d['name']['toLowerCase']()['includes'](c),f=d['title']?.['toLowerCase']()['includes'](c),g=d['description']?.['toLowerCase']()['includes'](c);return e||f||g;});}export function listOperations(){const a=getSchemaIndex();if(!a)return[];return(a['operations']||[])['filter'](b=>b['name']['startsWith']('onchain_operations_'));}function writeResponseToFile(a,b){try{let c;if(b)c=resolve(process['cwd'](),b);else{!existsSync(WORKSPACE_TMP_DIR)&&mkdirSync(WORKSPACE_TMP_DIR,{'recursive':!![]});const g=Date['now']();c=join(WORKSPACE_TMP_DIR,'schema-'+g+'.json');}const d=dirname(c);!existsSync(d)&&mkdirSync(d,{'recursive':!![]});const f=typeof a==='string'?a:JSON['stringify'](a,null,0x2);return writeFileSync(c,f,'utf-8'),c;}catch(h){return null;}}const INLINE_CHAR_LIMIT=0x20*0x400,AUTO_OVERFLOW_DIR='.wowok/tmp';function unionVariantLabel(a){if(!a||typeof a!=='object')return'variant';const b=a['properties']&&typeof a['properties']==='object'?a['properties']:undefined;if(b)for(const [c,d]of Object['entries'](b)){if(d&&typeof d==='object'&&d['const']!==undefined)return c+'='+String(d['const']);}return typeof a['title']==='string'?a['title']:'variant';}export function buildSchemaSummary(a){const b=[];a&&typeof a['title']==='string'&&b['push']('Title:\x20'+a['title']);const c=a&&typeof a==='object'?a['properties']:undefined;if(c&&typeof c==='object'&&!Array['isArray'](c)){const d=Array['isArray'](a['required'])?a['required']:[],e=Object['keys'](c);b['push']('Top-level\x20fields\x20('+e['length']+',\x20*\x20=\x20required):');for(const f of e['slice'](0x0,0x28)){const g=c[f]??{},h=Array['isArray'](g['type'])?g['type']['join']('|'):g['type']??(g['$ref']?'ref':g['anyOf']||g['oneOf']?'union':'any'),i=d['includes'](f)?'*':'',j=typeof g['description']==='string'&&g['description']['length']>0x0?'\x20—\x20'+g['description']['split']('\x0a')[0x0]['slice'](0x0,0x50):'';b['push']('\x20\x20-\x20'+f+i+':\x20'+h+j);}e['length']>0x28&&b['push']('\x20\x20-\x20...and\x20'+(e['length']-0x28)+'\x20more\x20—\x20use\x20action=\x27get_field\x27\x20with\x20field_path\x20to\x20inspect');}else{if(a&&(Array['isArray'](a['oneOf'])||Array['isArray'](a['anyOf']))){const k=a['oneOf']??a['anyOf'];b['push']('Union\x20of\x20'+k['length']+'\x20variants:');for(const m of k['slice'](0x0,0x28)){const o=m&&typeof m['description']==='string'&&m['description']['length']>0x0?'\x20—\x20'+m['description']['split']('\x0a')[0x0]['slice'](0x0,0x50):'';b['push']('\x20\x20-\x20'+unionVariantLabel(m)+o);}k['length']>0x28&&b['push']('\x20\x20-\x20...and\x20'+(k['length']-0x28)+'\x20more');const l=k['filter'](q=>q&&typeof q==='object'&&q['properties']&&typeof q['properties']==='object');if(l['length']===k['length']&&l['length']>0x0){const q=Object['keys'](l[0x0]['properties'])['filter'](r=>l['every'](s=>Object['prototype']['hasOwnProperty']['call'](s['properties'],r)));b['push'](q['length']>0x0?'Common\x20fields\x20(declared\x20by\x20ALL\x20'+l['length']+'\x20variants):\x20'+q['join'](',\x20')+'.':'No\x20field\x20is\x20declared\x20by\x20all\x20'+l['length']+'\x20variants\x20—\x20each\x20variant\x20takes\x20its\x20own\x20parameters.');}else b['push']('Field\x20names\x20differ\x20per\x20variant\x20—\x20read\x20the\x20variant\x27s\x20own\x20list\x20above.\x20'+'The\x20discriminator\x20(\x22operation\x22\x20and\x20friends)\x20is\x20the\x20only\x20shared\x20key.');for(const r of k['slice'](0x0,0x28)){const s=r&&typeof r==='object'&&r['properties']&&typeof r['properties']==='object'?Object['keys'](r['properties']):[];if(s['length']===0x0)continue;b['push']('\x20\x20\x20\x20'+unionVariantLabel(r)+'\x20fields:\x20'+s['join'](',\x20'));}b['push']('Drill\x20into\x20the\x20variant\x20you\x20need\x20with\x20action=\x27get_field\x27\x20(name\x20+\x20field_path)\x20—\x20the\x20lists\x20above\x20are\x20a\x20summary,\x20not\x20the\x20schema.');}else b['push']('No\x20top-level\x20properties\x20map\x20—\x20use\x20action=\x27get_field\x27\x20with\x20a\x20field_path\x20to\x20inspect\x20this\x20schema.');}return b['join']('\x0a');}export function autoOverflowToFile(a,b){try{const c=JSON['stringify'](a)['length'];if(c<=INLINE_CHAR_LIMIT)return null;const d=process['env']['WOWOK_SCHEMA_TMP_DIR'],e=d?resolve(d):resolve(process['cwd'](),AUTO_OVERFLOW_DIR);!existsSync(e)&&mkdirSync(e,{'recursive':!![]});const f=b['replace'](/[^a-zA-Z0-9_-]/g,'_'),g=f+'.schema.json',h=join(e,g);return writeFileSync(h,JSON['stringify'](a,null,0x2),'utf-8'),{'absolute_path':h,'relative_path':d?h:join(AUTO_OVERFLOW_DIR,g),'bytes':c,'summary':buildSchemaSummary(a)};}catch{return null;}}export function processSchemaQuery(a){const {action:b,name:c,query:d,field_path:f,template:g,output_file:h,object_type:i,params:j}=a;if(b==='get_guard_templates'){const k=getGuardTemplates(g);if(!k)return{'success':![],'action':b,'data':null,'message':g?'Guard\x20template\x20\x27'+g+'\x27\x20not\x20found.\x20Omit\x20\x27template\x27\x20to\x20list\x20all\x20available\x20templates.':'Guard\x20templates\x20file\x20not\x20found.\x20Ensure\x20scripts/guard-templates.json\x20exists.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20available\x20templates.','Available\x20template\x20names:\x20signer_verification,\x20progress_node_check,\x20order_owner_verification,\x20service_belonging_check,\x20reward_not_claimed,\x20combined_reward_guard']};if(h){const l=writeResponseToFile(k,h);if(l)return{'success':!![],'action':b,'data':null,'message':'Guard\x20template'+(g?'\x20\x27'+g+'\x27':'s')+'\x20written\x20to\x20file:\x20'+l,'output_file_path':l,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+l]};}return{'success':!![],'action':b,'data':k,'message':g?'Retrieved\x20Guard\x20template:\x20'+g:'Retrieved\x20'+(Array['isArray'](k['templates'])?k['templates']['length']:0x0)+'\x20Guard\x20templates'};}if(b==='get_templates'){if(!g){const p=a480a(i),q=getTemplateCounts(),r={'total':p['length'],'filter':i??null,'counts_by_object_type':q,'templates':p};if(h){const s=writeResponseToFile(r,h);if(s)return{'success':!![],'action':b,'data':null,'message':p['length']+'\x20templates\x20written\x20to\x20file:\x20'+s,'output_file_path':s,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+s]};}return{'success':!![],'action':b,'data':r,'message':p['length']+'\x20template(s)'+(i?'\x20for\x20object_type=\x27'+i+'\x27':'')+'\x20'+('(total\x20registry:\x20'+Object['values'](q)['reduce']((t,u)=>t+u,0x0)+'\x20across\x20'+TEMPLATE_OBJECT_TYPES['length']+'\x20object\x20types).\x20')+'Provide\x20\x27template\x27\x20(id)\x20for\x20full\x20detail;\x20add\x20\x27params\x27\x20(JSON\x20string)\x20to\x20instantiate.'};}if(!j){const t=getTemplateDetail(g);if(!t)return{'success':![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20not\x20found\x20in\x20the\x20unified\x20registry.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20template\x20metadata\x20(id\x20+\x20object_type\x20+\x20parameters).','Filter\x20by\x20object_type:\x20'+TEMPLATE_OBJECT_TYPES['join'](',\x20')]};if(h){const u=writeResponseToFile(t,h);if(u)return{'success':!![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20detail\x20written\x20to\x20file:\x20'+u,'output_file_path':u,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+u]};}return{'success':!![],'action':b,'data':t,'message':'Template\x20\x27'+g+'\x27\x20('+t['object_type']+',\x20'+(t['instantiable']?'instantiable':'guidance-only')+').\x20'+'To\x20instantiate,\x20call\x20again\x20with\x20\x27params\x27\x20=\x20JSON\x20object\x20of\x20the\x20declared\x20parameters.'};}let m;try{const v=JSON['parse'](j);if(!v||typeof v!=='object'||Array['isArray'](v))return{'success':![],'action':b,'data':null,'message':'\x27params\x27\x20must\x20be\x20a\x20JSON\x20object\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27),\x20got\x20'+(Array['isArray'](v)?'array':typeof v)+'.'};m=v;}catch(w){return{'success':![],'action':b,'data':null,'message':'Failed\x20to\x20parse\x20\x27params\x27\x20as\x20JSON:\x20'+(w instanceof Error?w['message']:String(w)),'suggestions':['Example:\x20params=\x27{\x22whitelist\x22:[\x220xabc...\x22]}\x27']};}const n=instantiateTemplate(g,m);if(!n['ok'])return{'success':![],'action':b,'data':n['guidance']!==undefined?{'guidance':n['guidance']}:null,'message':'Instantiation\x20failed\x20for\x20\x27'+g+'\x27:\x20'+n['error'],'suggestions':n['missing_params']?['Missing\x20required\x20params:\x20'+n['missing_params']['join'](',\x20'),'Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']:['Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']};const o={'object_type':n['object_type'],'template_id':n['template_id'],'body':n['body'],...n['notes']?{'notes':n['notes']}:{}};if(h){const x=writeResponseToFile(o,h);if(x)return{'success':!![],'action':b,'data':null,'message':'Instantiated\x20template\x20\x27'+g+'\x27\x20written\x20to\x20file:\x20'+x,'output_file_path':x,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+x]};}return{'success':!![],'action':b,'data':o,'message':'Instantiated\x20\x27'+g+'\x27\x20('+n['object_type']+').\x20'+'Review\x20the\x20body\x20against\x20the\x20onchain_operations\x20schema\x20before\x20submitting.'};}if(b==='get_tool_reference'){if(c){const z=getToolReference(c);if(!z)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found\x20in\x20the\x20tool\x20reference.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20all\x20tools.','Available\x20tools:\x20'+TOOLS_REFERENCE['map'](B=>B['name'])['join'](',\x20')]};const A=getToolSequence(c);return{'success':!![],'action':b,'data':{'tool':z,'call_sequence':A??null},'message':'Retrieved\x20tool\x20reference:\x20'+c};}if(d){const B=searchToolReference(d);return{'success':!![],'action':b,'data':{'tools':B,'count':B['length']},'message':'Found\x20'+B['length']+'\x20tool(s)\x20matching\x20\x27'+d+'\x27','suggestions':B['length']===0x0?['Try\x20a\x20broader\x20keyword\x20(e.g.\x20\x27onchain\x27,\x20\x27guard\x27,\x20\x27schema\x27),\x20or\x20omit\x20\x27query\x27\x20to\x20list\x20all\x20tools.']:undefined};}const y=TOOLS_REFERENCE['map'](C=>({'name':C['name'],'summary':C['summary'],'actions':C['actions']??[],'notes':C['notes']??[]}));return{'success':!![],'action':b,'data':{'tools':y,'count':y['length']},'message':'Retrieved\x20reference\x20for\x20'+y['length']+'\x20MCP\x20tools.\x20Pass\x20name=\x27<tool>\x27\x20for\x20full\x20detail\x20(params,\x20prerequisites,\x20follow-ups).'};}if(b==='get_guard_design_patterns'){if(c){const D=getGuardDesignPattern(c);if(!D)return{'success':![],'action':b,'data':null,'message':'Guard\x20design\x20pattern\x20\x27'+c+'\x27\x20not\x20found.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20the\x20full\x20catalog.','Available\x20pattern\x20ids:\x20'+GUARD_DESIGN_PATTERNS['map'](E=>E['id'])['join'](',\x20')]};return{'success':!![],'action':b,'data':{'pattern':D},'message':'Retrieved\x20Guard\x20design\x20pattern:\x20'+c};}if(d){const E=GUARD_DESIGN_PATTERNS['filter'](G=>G['host']===d),F=E['length']>0x0?E:GUARD_DESIGN_PATTERNS['filter'](G=>G['business_requirement']['toLowerCase']()['includes'](d['toLowerCase']())||G['logic_summary']['toLowerCase']()['includes'](d['toLowerCase']()));return{'success':!![],'action':b,'data':{'patterns':F,'count':F['length'],'filtered_by':E['length']>0x0?'host':'keyword','schema_notes':GUARD_SCHEMA_NOTES},'message':'Found\x20'+F['length']+'\x20Guard\x20design\x20pattern(s)\x20matching\x20\x27'+d+'\x27','suggestions':F['length']===0x0?['Filter\x20by\x20host:\x20service_buy_guard,\x20service_allocator_guard,\x20machine_forward,\x20progress_submission,\x20reward_claim,\x20repository_write,\x20arbitration_usage,\x20arbitration_voting,\x20gen_passport']:undefined};}const C=GUARD_DESIGN_PATTERNS['map'](G=>({'id':G['id'],'business_requirement':G['business_requirement'],'host':G['host'],'data_source':G['data_source'],'verifier_level':G['verifier_level'],'logic_summary':G['logic_summary'],'key_queries':G['key_queries'],'notes':G['notes']??[]}));return{'success':!![],'action':b,'data':{'patterns':C,'count':C['length'],'version':GUARD_DESIGN_PATTERNS_VERSION,'schema_notes':GUARD_SCHEMA_NOTES},'message':'Retrieved\x20'+C['length']+'\x20Guard\x20design\x20patterns.\x20Pass\x20name=\x27<pattern_id>\x27\x20for\x20full\x20detail\x20(witness\x20types,\x20mitigated\x20risks,\x20industries).'};}if(b==='get_safety_rules')return{'success':!![],'action':b,'data':{'version':SAFETY_RULES_VERSION,'object_reuse_rules':OBJECT_REUSE_RULES,'create_vs_modify_pattern':CREATE_VS_MODIFY_PATTERN,'immutability_rules':IMMUTABILITY_RULES,'protocol_slot_rules':PROTOCOL_SLOT_RULES,'operation_type_classification':OPERATION_TYPE_CLASSIFICATION,'operation_class_meta':OPERATION_CLASS_META,'naming_conventions':NAMING_CONVENTIONS},'message':'Retrieved\x20safety\x20rule\x20tables\x20(reuse\x20/\x20immutability\x20/\x20protocol\x20slots\x20/\x20operation\x20classification\x20/\x20naming).\x20'+'Key\x20points:\x20prefer\x20REUSING\x20existing\x20objects\x20(string\x20reference\x20=\x20reuse,\x20object\x20shape\x20=\x20create);\x20'+'Machine\x20publish\x20locks\x20nodes/pairs/forwards,\x20Service\x20publish\x20locks\x20machine/order_allocators/arbitrations\x20(sales\x20stays\x20mutable);\x20'+'Guard\x20is\x20CREATE-only\x20immutable;\x20on-chain\x20writes\x20require\x20explicit\x20user\x20confirmation;\x20'+'Guards\x20bound\x20on\x20machine\x20forwards\x20MUST\x20declare\x20protocol\x20slot\x20254\x20(task\x20binding),\x20and\x20every\x20allocator\x20{GuardIdentifier:N}\x20leg\x20MUST\x20name\x20a\x20declared\x20b_submission\x20Address\x20slot.'};if(!areSchemasAvailable())return{'success':![],'action':b,'data':null,'message':'Schema\x20files\x20are\x20not\x20available.\x20Please\x20run\x20\x27npm\x20run\x20generate:schemas\x27\x20first.','suggestions':['Run\x20\x27npm\x20run\x20generate:schemas\x27\x20to\x20generate\x20schema\x20files','Ensure\x20the\x20dist/schemas\x20directory\x20exists']};switch(b){case'list':{const G=listSchemas();return{'success':!![],'action':b,'data':G,'message':'Found\x20'+G['length']+'\x20available\x20schemas'};}case'get':{if(!c)return{'success':![],'action':b,'data':null,'message':'Schema\x20name\x20is\x20required\x20for\x20\x27get\x27\x20action','suggestions':['Provide\x20a\x20schema\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};const H=getSchema(c);if(!H){const J=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20not\x20found','suggestions':J['length']>0x0?J['map'](K=>'Did\x20you\x20mean:\x20'+K['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};}if(h){const K=writeResponseToFile(H,h);if(K)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+K,'output_file_path':K,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+K]};}const I=autoOverflowToFile(H,c);if(I)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](I['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':I['absolute_path'],'inline_summary':I['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+I['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+I['relative_path']+'\x27\x20against\x20the\x20workspace\x20root\x20and\x20read\x20that.','Without\x20file\x20access,\x20query\x20specific\x20fields\x20via\x20action=\x27get_field\x27\x20with\x20name=\x27'+c+'\x27\x20and\x20a\x20field_path\x20from\x20the\x20summary\x20below.']};return{'success':!![],'action':b,'data':H,'message':'Retrieved\x20schema:\x20'+c};}case'get_field':{if(!c||!f)return{'success':![],'action':b,'data':null,'message':'Both\x20\x27name\x27\x20and\x20\x27field_path\x27\x20are\x20required\x20for\x20\x27get_field\x27\x20action','suggestions':['Example:\x20{action:\x20\x27get_field\x27,\x20name:\x20\x27onchain_operations_machine\x27,\x20field_path:\x20\x27data.node\x27}','Use\x20\x27get\x27\x20action\x20to\x20retrieve\x20the\x20full\x20schema']};const L=getSchemaField(c,f);if(!L)return{'success':![],'action':b,'data':null,'message':'Field\x20path\x20\x27'+f+'\x27\x20not\x20found\x20in\x20schema\x20\x27'+c+'\x27','suggestions':['Check\x20the\x20field\x20path\x20(dot-separated,\x20e.g.\x20\x27data.node\x27)','Use\x20\x27get\x27\x20action\x20to\x20see\x20the\x20full\x20schema\x20structure']};return{'success':!![],'action':b,'data':L,'message':'Retrieved\x20field\x20\x27'+f+'\x27\x20from\x20schema\x20\x27'+c+'\x27'};}case'search':{if(!d)return{'success':![],'action':b,'data':null,'message':'Search\x20query\x20is\x20required\x20for\x20\x27search\x27\x20action'};const M=searchSchemas(d);return{'success':!![],'action':b,'data':M,'message':'Found\x20'+M['length']+'\x20schemas\x20matching\x20\x27'+d+'\x27'};}case'list_operations':{const N=listOperations();return{'success':!![],'action':b,'data':N,'message':'Found\x20'+N['length']+'\x20on-chain\x20operations'};}case'get_guard_queries':{const O=d?.['trim']()['toLowerCase'](),P=R=>({'id':R['id'],'name':R['name'],'objectType':ObjectType[R['objectType']]??String(R['objectType']),'returnType':ValueType[R['return']]??String(R['return'])});if(O){const R=GUARDQUERY['filter'](S=>S['name']['toLowerCase']()['includes'](O)||S['description']?.['toLowerCase']()['includes'](O)||String(S['id'])===O)['map'](S=>({...P(S),'description':S['description']}));return{'success':!![],'action':b,'data':R,'message':'Found\x20'+R['length']+'\x20GUARDQUERY\x20entries\x20matching\x20\x27'+d+'\x27\x20'+('(of\x20'+GUARDQUERY['length']+'\x20total).\x20Use\x20names,\x20not\x20numeric\x20ids,\x20in\x20Guard\x20trees\x20—\x20')+'names\x20fail\x20loudly\x20at\x20validation\x20when\x20wrong;\x20a\x20wrong-but-existing\x20id\x20silently\x20checks\x20a\x20different\x20field.'};}if(h){const S=GUARDQUERY['map'](U=>({...P(U),'description':U['description']})),T=writeResponseToFile(S,h);if(T)return{'success':!![],'action':b,'data':null,'message':'Full\x20GUARDQUERY\x20catalog\x20('+S['length']+'\x20entries)\x20written\x20to\x20file:\x20'+T,'output_file_path':T,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+T]};}const Q=GUARDQUERY['map'](P);return{'success':!![],'action':b,'data':Q,'message':'GUARDQUERY\x20catalog:\x20'+Q['length']+'\x20entries\x20(compact\x20form\x20—\x20id,\x20name,\x20objectType,\x20returnType).\x20'+'Add\x20query=\x27<keyword>\x27\x20for\x20full\x20entries\x20with\x20descriptions,\x20or\x20output_file\x20to\x20dump\x20all\x20details\x20to\x20a\x20file.\x20'+'Prefer\x20NAME\x20references\x20in\x20Guard\x20trees;\x20a\x20numeric\x20id\x20is\x20resolved\x20verbatim\x20and\x20a\x20wrong-but-existing\x20id\x20'+'silently\x20checks\x20a\x20different\x20field.'};}case'get_output':{if(!c)return{'success':![],'action':b,'data':null,'message':'Tool\x20name\x20is\x20required\x20for\x20\x27get_output\x27\x20action','suggestions':['Provide\x20a\x20tool\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools\x20and\x20their\x20outputPath']};const U=getOutputSchema(c);if(!U){const W=listSchemas(),X=W['find'](Z=>Z['name']===c);if(X)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20exists\x20but\x20has\x20no\x20output\x20schema\x20file.\x20The\x20tool\x20may\x20not\x20declare\x20an\x20outputSchema,\x20or\x20the\x20schema\x20file\x20was\x20not\x20generated.','suggestions':['Use\x20\x27get\x27\x20action\x20with\x20name=\x27'+c+'\x27\x20to\x20retrieve\x20its\x20input\x20schema']};const Y=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':Y['length']>0x0?Y['map'](Z=>'Did\x20you\x20mean:\x20'+Z['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const Z=writeResponseToFile(U,h);if(Z)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+Z,'output_file_path':Z,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+Z]};}const V=autoOverflowToFile(U,c);if(V)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](V['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':V['absolute_path'],'inline_summary':V['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+V['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+V['relative_path']+'\x27\x20against\x20the\x20workspace\x20root\x20and\x20read\x20that.','Without\x20file\x20access,\x20query\x20specific\x20fields\x20via\x20action=\x27get_field\x27\x20with\x20name=\x27'+c+'\x27\x20and\x20a\x20field_path\x20from\x20the\x20summary\x20below.']};return{'success':!![],'action':b,'data':U,'message':'Retrieved\x20output\x20schema:\x20'+c};}default:return{'success':![],'action':b,'data':null,'message':'Unknown\x20action:\x20'+b,'suggestions':['Use\x20\x27list\x27,\x20\x27get\x27,\x20\x27get_field\x27,\x20\x27get_output\x27,\x20\x27search\x27,\x20\x27list_operations\x27,\x20\x27get_guard_templates\x27,\x20\x27get_tool_reference\x27,\x20\x27get_guard_design_patterns\x27,\x20\x27get_safety_rules\x27,\x20\x27get_templates\x27,\x20or\x20\x27analyze_guard_semantics\x27']};}}const GUARD_SEMANTICS_READING_CHECKLIST=['WHO\x20can\x20satisfy\x20this\x20Guard\x20(identity:\x20Signer\x20bindings,\x20Entity\x20membership,\x20allowlists)?','WHEN\x20can\x20it\x20be\x20satisfied\x20(time:\x20Clock\x20comparisons,\x20deadlines,\x20windows)?','WHAT\x20evidence\x20must\x20the\x20caller\x20submit\x20(b_submission\x20table\x20entries\x20—\x20Payment/Order/Proof\x20objects)?','WHICH\x20on-chain\x20data\x20does\x20it\x20read,\x20and\x20can\x20that\x20data\x20change\x20(Repository\x20entries\x20are\x20MUTABLE\x20—\x20who\x20controls\x20the\x20writes)?','WHAT\x20does\x20the\x20counterparty\x20gain/lose\x20in\x20each\x20branch\x20of\x20the\x20logic\x20tree?','ARE\x20there\x20error-level\x20diagnostics\x20or\x20critical\x20risks\x20(they\x20block\x20or\x20endanger\x20execution)?'];export async function analyzeGuardSemantics(a){const b=await lintGuard(a,{'auto_fix':![]}),c={'root':a['root'],'table':(a['table']??[])['map'](k=>({'identifier':k['identifier'],'name':k['name'],'value_type':k['value_type']??'Address','b_submission':k['b_submission']??![],'value':k['value']})),'guardName':a['description']??null,'rely':a['rely']??null},d=renderGuardTreeIndented(c),e=renderGuardMermaid(a['root']),f=new Set(),g=[];let h=![],i=![];walkGuardTree(a['root'],k=>{if(k['type']==='context'){if(k['context']==='Clock')h=!![];if(k['context']==='Signer')i=!![];}if(k['type']==='query'&&k['query']!==undefined&&k['query']!==null){if(typeof k['query']==='number'){const l=getGuardQueryByIdOrName(k['query']);if(l)f['add'](l['id']);else g['push'](k['query']);}else{const m=getGuardQueryByIdOrName(k['query']);if(m)f['add'](m['id']);else g['push'](k['query']);}}});const j={'submission_requirements':(a['table']??[])['filter'](k=>k['b_submission']===!![])['map'](k=>({'identifier':k['identifier'],'value_type':k['value_type'],'object_type':k['object_type'],'name':k['name']})),'data_sources':(a['table']??[])['filter'](k=>k['b_submission']!==!![])['map'](k=>({'identifier':k['identifier'],'kind':k['is_system_address']?'system_address':k['object_type']?'object':'fixed_value','value_type':k['value_type'],'object_type':k['object_type'],'name':k['name'],'is_mutable_onchain':k['object_type']==='Repository'})),'query_dependencies':[...f]['sort']((k,l)=>k-l),'unresolved_queries':g,'has_time_conditions':h,'has_signer_constraints':i,'has_rely_composition':Array['isArray'](a['rely']?.['guards'])&&a['rely']['guards']['length']>0x0,'reading_checklist':GUARD_SEMANTICS_READING_CHECKLIST};return{'render':{'tree_indented':d,'mermaid':e},'lint':b,'party_evaluation':j};}export{formatLintResult};
1
+ import{readFileSync,existsSync,writeFileSync,mkdirSync}from'fs';import{resolve,join,dirname}from'path';import{fileURLToPath}from'url';import{GUARDQUERY,ObjectType,ValueType}from'@wowok/wowok';import{TOOLS_REFERENCE,getToolReference,searchToolReference,getToolSequence}from'../knowledge/tools-reference.js';import{GUARD_DESIGN_PATTERNS,getGuardDesignPattern,GUARD_DESIGN_PATTERNS_VERSION,GUARD_SCHEMA_NOTES}from'../knowledge/guard-design-patterns.js';import{OBJECT_REUSE_RULES,CREATE_VS_MODIFY_PATTERN,IMMUTABILITY_RULES,PROTOCOL_SLOT_RULES,OPERATION_TYPE_CLASSIFICATION,OPERATION_CLASS_META,NAMING_CONVENTIONS,SAFETY_RULES_VERSION}from'../knowledge/safety-rules.js';import{listTemplates as a482a,getTemplateDetail,instantiateTemplate,getTemplateCounts,TEMPLATE_OBJECT_TYPES}from'../knowledge/template-registry.js';import{lintGuard,formatLintResult}from'../knowledge/guard-lint.js';import{renderGuardTreeIndented,renderGuardMermaid,walkGuardTree}from'../knowledge/guard-render.js';import{getGuardQueryByIdOrName}from'../schema/utils/guard-query-utils.js';const __filename=fileURLToPath(import.meta.url),__dirname=fileURLToPath(new URL('.',import.meta.url)),SCHEMAS_DIR=resolve(__dirname,'../../dist/schemas'),GUARD_TEMPLATES_PATH_SCRIPTS=resolve(__dirname,'../../scripts/guard-templates.json'),GUARD_TEMPLATES_PATH_DIST=resolve(__dirname,'../../dist/schemas/guard-templates.json'),GUARD_TEMPLATES_PATH=existsSync(GUARD_TEMPLATES_PATH_SCRIPTS)?GUARD_TEMPLATES_PATH_SCRIPTS:GUARD_TEMPLATES_PATH_DIST,WORKSPACE_TMP_DIR=resolve(process['cwd'](),'.trae','tmp');export function areSchemasAvailable(){return existsSync(SCHEMAS_DIR)&&existsSync(join(SCHEMAS_DIR,'index.json'));}export function getSchemaIndex(){try{const a=join(SCHEMAS_DIR,'index.json');if(!existsSync(a))return null;const b=readFileSync(a,'utf-8');return JSON['parse'](b);}catch{return null;}}export function listSchemas(){const a=getSchemaIndex();if(!a)return[];return[...a['tools']||[],...a['operations']||[]];}export function getSchema(a){try{let b=join(SCHEMAS_DIR,a+'.schema.json');!existsSync(b)&&(b=join(SCHEMAS_DIR,a+'.json'));if(!existsSync(b))return null;const c=readFileSync(b,'utf-8'),d=JSON['parse'](c);return resolveSchemaRefs(d);}catch{return null;}}export function getOutputSchema(a){try{const b=join(SCHEMAS_DIR,a+'.output.json');if(!existsSync(b))return null;const c=readFileSync(b,'utf-8'),d=JSON['parse'](c);return resolveSchemaRefs(d);}catch{return null;}}export function getGuardTemplates(a){try{if(!existsSync(GUARD_TEMPLATES_PATH))return null;const b=readFileSync(GUARD_TEMPLATES_PATH,'utf-8'),c=JSON['parse'](b);if(!a)return{'version':c['version'],'description':c['description'],'templates':(c['templates']||[])['map'](e=>({'name':e['name'],'title':e['title'],'description':e['description'],'use_case':e['use_case']})),'query_reference':c['query_reference'],'node_return_types':c['node_return_types']};const d=(c['templates']||[])['find'](e=>e['name']===a);if(!d)return null;return d;}catch{return null;}}export function getSchemaField(a,b){const c=getSchema(a);if(!c)return null;const d=b['split']('.')['filter'](Boolean);let e=c;for(const f of d){if(!e||typeof e!=='object')return null;if(e['properties']&&f in e['properties']){e=e['properties'][f];continue;}if(e['items']&&typeof e['items']==='object'){if(/^\d+$/['test'](f)){e=e['items'];continue;}if(e['items']['properties']&&f in e['items']['properties']){e=e['items']['properties'][f];continue;}}if(Array['isArray'](e['oneOf'])||Array['isArray'](e['anyOf'])){const g=e['oneOf']??e['anyOf'];for(const h of g){if(h&&typeof h==='object'&&h['properties']&&f in h['properties']){e=h['properties'][f];break;}}continue;}if(f in e){e=e[f];continue;}return null;}return e;}function resolveSchemaRefs(a,b=new Set()){if(!a||typeof a!=='object')return a;if(Array['isArray'](a))return a['map'](d=>resolveSchemaRefs(d,b));const c={};for(const [d,e]of Object['entries'](a)){if(d==='$ref'&&typeof e==='string'){if(e['startsWith']('#'))c[d]=e;else{const f=loadRefSchema(e,b);f&&Object['assign'](c,resolveSchemaRefs(f,b));}}else typeof e==='object'?c[d]=resolveSchemaRefs(e,b):c[d]=e;}return c;}function loadRefSchema(a,b){if(a['startsWith']('#'))return null;if(b['has'](a))return{'description':'Circular\x20reference\x20to\x20'+a};b['add'](a);try{const c=join(SCHEMAS_DIR,a);if(!existsSync(c))return null;const d=readFileSync(c,'utf-8');return JSON['parse'](d);}catch{return null;}}export function searchSchemas(a){const b=listSchemas(),c=a['toLowerCase']();return b['filter'](d=>{const e=d['name']['toLowerCase']()['includes'](c),f=d['title']?.['toLowerCase']()['includes'](c),g=d['description']?.['toLowerCase']()['includes'](c);return e||f||g;});}export function listOperations(){const a=getSchemaIndex();if(!a)return[];return(a['operations']||[])['filter'](b=>b['name']['startsWith']('onchain_operations_'));}function writeResponseToFile(a,b){try{let c;if(b)c=resolve(process['cwd'](),b);else{!existsSync(WORKSPACE_TMP_DIR)&&mkdirSync(WORKSPACE_TMP_DIR,{'recursive':!![]});const g=Date['now']();c=join(WORKSPACE_TMP_DIR,'schema-'+g+'.json');}const d=dirname(c);!existsSync(d)&&mkdirSync(d,{'recursive':!![]});const f=typeof a==='string'?a:JSON['stringify'](a,null,0x2);return writeFileSync(c,f,'utf-8'),c;}catch(h){return null;}}const INLINE_CHAR_LIMIT=0x20*0x400,AUTO_OVERFLOW_DIR='.wowok/tmp';function unionVariantLabel(a){if(!a||typeof a!=='object')return'variant';const b=a['properties']&&typeof a['properties']==='object'?a['properties']:undefined;if(b)for(const [c,d]of Object['entries'](b)){if(d&&typeof d==='object'&&d['const']!==undefined)return c+'='+String(d['const']);}return typeof a['title']==='string'?a['title']:'variant';}export function buildSchemaSummary(a){const b=[];a&&typeof a['title']==='string'&&b['push']('Title:\x20'+a['title']);const c=a&&typeof a==='object'?a['properties']:undefined;if(c&&typeof c==='object'&&!Array['isArray'](c)){const d=Array['isArray'](a['required'])?a['required']:[],e=Object['keys'](c);b['push']('Top-level\x20fields\x20('+e['length']+',\x20*\x20=\x20required):');for(const f of e['slice'](0x0,0x28)){const g=c[f]??{},h=Array['isArray'](g['type'])?g['type']['join']('|'):g['type']??(g['$ref']?'ref':g['anyOf']||g['oneOf']?'union':'any'),i=d['includes'](f)?'*':'',j=typeof g['description']==='string'&&g['description']['length']>0x0?'\x20—\x20'+g['description']['split']('\x0a')[0x0]['slice'](0x0,0x50):'';b['push']('\x20\x20-\x20'+f+i+':\x20'+h+j);}e['length']>0x28&&b['push']('\x20\x20-\x20...and\x20'+(e['length']-0x28)+'\x20more\x20—\x20use\x20action=\x27get_field\x27\x20with\x20field_path\x20to\x20inspect');}else{if(a&&(Array['isArray'](a['oneOf'])||Array['isArray'](a['anyOf']))){const k=a['oneOf']??a['anyOf'];b['push']('Union\x20of\x20'+k['length']+'\x20variants:');for(const m of k['slice'](0x0,0x28)){const o=m&&typeof m['description']==='string'&&m['description']['length']>0x0?'\x20—\x20'+m['description']['split']('\x0a')[0x0]['slice'](0x0,0x50):'';b['push']('\x20\x20-\x20'+unionVariantLabel(m)+o);}k['length']>0x28&&b['push']('\x20\x20-\x20...and\x20'+(k['length']-0x28)+'\x20more');const l=k['filter'](q=>q&&typeof q==='object'&&q['properties']&&typeof q['properties']==='object');if(l['length']===k['length']&&l['length']>0x0){const q=Object['keys'](l[0x0]['properties'])['filter'](r=>l['every'](s=>Object['prototype']['hasOwnProperty']['call'](s['properties'],r)));b['push'](q['length']>0x0?'Common\x20fields\x20(declared\x20by\x20ALL\x20'+l['length']+'\x20variants):\x20'+q['join'](',\x20')+'.':'No\x20field\x20is\x20declared\x20by\x20all\x20'+l['length']+'\x20variants\x20—\x20each\x20variant\x20takes\x20its\x20own\x20parameters.');}else b['push']('Field\x20names\x20differ\x20per\x20variant\x20—\x20read\x20the\x20variant\x27s\x20own\x20list\x20above.\x20'+'The\x20discriminator\x20(\x22operation\x22\x20and\x20friends)\x20is\x20the\x20only\x20shared\x20key.');for(const r of k['slice'](0x0,0x28)){const s=r&&typeof r==='object'&&r['properties']&&typeof r['properties']==='object'?Object['keys'](r['properties']):[];if(s['length']===0x0)continue;b['push']('\x20\x20\x20\x20'+unionVariantLabel(r)+'\x20fields:\x20'+s['join'](',\x20'));}b['push']('Drill\x20into\x20the\x20variant\x20you\x20need\x20with\x20action=\x27get_field\x27\x20(name\x20+\x20field_path)\x20—\x20the\x20lists\x20above\x20are\x20a\x20summary,\x20not\x20the\x20schema.');}else b['push']('No\x20top-level\x20properties\x20map\x20—\x20use\x20action=\x27get_field\x27\x20with\x20a\x20field_path\x20to\x20inspect\x20this\x20schema.');}return b['join']('\x0a');}export function autoOverflowToFile(a,b){try{const c=JSON['stringify'](a)['length'];if(c<=INLINE_CHAR_LIMIT)return null;const d=process['env']['WOWOK_SCHEMA_TMP_DIR'],e=d?resolve(d):resolve(process['cwd'](),AUTO_OVERFLOW_DIR);!existsSync(e)&&mkdirSync(e,{'recursive':!![]});const f=b['replace'](/[^a-zA-Z0-9_-]/g,'_'),g=f+'.schema.json',h=join(e,g);return writeFileSync(h,JSON['stringify'](a,null,0x2),'utf-8'),{'absolute_path':h,'relative_path':d?h:join(AUTO_OVERFLOW_DIR,g),'bytes':c,'summary':buildSchemaSummary(a)};}catch{return null;}}export function processSchemaQuery(a){const {action:b,name:c,query:d,field_path:f,template:g,output_file:h,object_type:i,params:j}=a;if(b==='get_guard_templates'){const k=getGuardTemplates(g);if(!k)return{'success':![],'action':b,'data':null,'message':g?'Guard\x20template\x20\x27'+g+'\x27\x20not\x20found.\x20Omit\x20\x27template\x27\x20to\x20list\x20all\x20available\x20templates.':'Guard\x20templates\x20file\x20not\x20found.\x20Ensure\x20scripts/guard-templates.json\x20exists.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20available\x20templates.','Available\x20template\x20names:\x20signer_verification,\x20progress_node_check,\x20order_owner_verification,\x20service_belonging_check,\x20reward_not_claimed,\x20combined_reward_guard']};if(h){const l=writeResponseToFile(k,h);if(l)return{'success':!![],'action':b,'data':null,'message':'Guard\x20template'+(g?'\x20\x27'+g+'\x27':'s')+'\x20written\x20to\x20file:\x20'+l,'output_file_path':l,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+l]};}return{'success':!![],'action':b,'data':k,'message':g?'Retrieved\x20Guard\x20template:\x20'+g:'Retrieved\x20'+(Array['isArray'](k['templates'])?k['templates']['length']:0x0)+'\x20Guard\x20templates'};}if(b==='get_templates'){if(!g){const p=a482a(i),q=getTemplateCounts(),r={'total':p['length'],'filter':i??null,'counts_by_object_type':q,'templates':p};if(h){const s=writeResponseToFile(r,h);if(s)return{'success':!![],'action':b,'data':null,'message':p['length']+'\x20templates\x20written\x20to\x20file:\x20'+s,'output_file_path':s,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+s]};}return{'success':!![],'action':b,'data':r,'message':p['length']+'\x20template(s)'+(i?'\x20for\x20object_type=\x27'+i+'\x27':'')+'\x20'+('(total\x20registry:\x20'+Object['values'](q)['reduce']((t,u)=>t+u,0x0)+'\x20across\x20'+TEMPLATE_OBJECT_TYPES['length']+'\x20object\x20types).\x20')+'Provide\x20\x27template\x27\x20(id)\x20for\x20full\x20detail;\x20add\x20\x27params\x27\x20(JSON\x20string)\x20to\x20instantiate.'};}if(!j){const t=getTemplateDetail(g);if(!t)return{'success':![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20not\x20found\x20in\x20the\x20unified\x20registry.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20template\x20metadata\x20(id\x20+\x20object_type\x20+\x20parameters).','Filter\x20by\x20object_type:\x20'+TEMPLATE_OBJECT_TYPES['join'](',\x20')]};if(h){const u=writeResponseToFile(t,h);if(u)return{'success':!![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20detail\x20written\x20to\x20file:\x20'+u,'output_file_path':u,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+u]};}return{'success':!![],'action':b,'data':t,'message':'Template\x20\x27'+g+'\x27\x20('+t['object_type']+',\x20'+(t['instantiable']?'instantiable':'guidance-only')+').\x20'+'To\x20instantiate,\x20call\x20again\x20with\x20\x27params\x27\x20=\x20JSON\x20object\x20of\x20the\x20declared\x20parameters.'};}let m;try{const v=JSON['parse'](j);if(!v||typeof v!=='object'||Array['isArray'](v))return{'success':![],'action':b,'data':null,'message':'\x27params\x27\x20must\x20be\x20a\x20JSON\x20object\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27),\x20got\x20'+(Array['isArray'](v)?'array':typeof v)+'.'};m=v;}catch(w){return{'success':![],'action':b,'data':null,'message':'Failed\x20to\x20parse\x20\x27params\x27\x20as\x20JSON:\x20'+(w instanceof Error?w['message']:String(w)),'suggestions':['Example:\x20params=\x27{\x22whitelist\x22:[\x220xabc...\x22]}\x27']};}const n=instantiateTemplate(g,m);if(!n['ok'])return{'success':![],'action':b,'data':n['guidance']!==undefined?{'guidance':n['guidance']}:null,'message':'Instantiation\x20failed\x20for\x20\x27'+g+'\x27:\x20'+n['error'],'suggestions':n['missing_params']?['Missing\x20required\x20params:\x20'+n['missing_params']['join'](',\x20'),'Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']:['Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']};const o={'object_type':n['object_type'],'template_id':n['template_id'],'body':n['body'],...n['notes']?{'notes':n['notes']}:{}};if(h){const x=writeResponseToFile(o,h);if(x)return{'success':!![],'action':b,'data':null,'message':'Instantiated\x20template\x20\x27'+g+'\x27\x20written\x20to\x20file:\x20'+x,'output_file_path':x,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+x]};}return{'success':!![],'action':b,'data':o,'message':'Instantiated\x20\x27'+g+'\x27\x20('+n['object_type']+').\x20'+'Review\x20the\x20body\x20against\x20the\x20onchain_operations\x20schema\x20before\x20submitting.'};}if(b==='get_tool_reference'){if(c){const z=getToolReference(c);if(!z)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found\x20in\x20the\x20tool\x20reference.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20all\x20tools.','Available\x20tools:\x20'+TOOLS_REFERENCE['map'](B=>B['name'])['join'](',\x20')]};const A=getToolSequence(c);return{'success':!![],'action':b,'data':{'tool':z,'call_sequence':A??null},'message':'Retrieved\x20tool\x20reference:\x20'+c};}if(d){const B=searchToolReference(d);return{'success':!![],'action':b,'data':{'tools':B,'count':B['length']},'message':'Found\x20'+B['length']+'\x20tool(s)\x20matching\x20\x27'+d+'\x27','suggestions':B['length']===0x0?['Try\x20a\x20broader\x20keyword\x20(e.g.\x20\x27onchain\x27,\x20\x27guard\x27,\x20\x27schema\x27),\x20or\x20omit\x20\x27query\x27\x20to\x20list\x20all\x20tools.']:undefined};}const y=TOOLS_REFERENCE['map'](C=>({'name':C['name'],'summary':C['summary'],'actions':C['actions']??[],'notes':C['notes']??[]}));return{'success':!![],'action':b,'data':{'tools':y,'count':y['length']},'message':'Retrieved\x20reference\x20for\x20'+y['length']+'\x20MCP\x20tools.\x20Pass\x20name=\x27<tool>\x27\x20for\x20full\x20detail\x20(params,\x20prerequisites,\x20follow-ups).'};}if(b==='get_guard_design_patterns'){if(c){const D=getGuardDesignPattern(c);if(!D)return{'success':![],'action':b,'data':null,'message':'Guard\x20design\x20pattern\x20\x27'+c+'\x27\x20not\x20found.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20the\x20full\x20catalog.','Available\x20pattern\x20ids:\x20'+GUARD_DESIGN_PATTERNS['map'](E=>E['id'])['join'](',\x20')]};return{'success':!![],'action':b,'data':{'pattern':D},'message':'Retrieved\x20Guard\x20design\x20pattern:\x20'+c};}if(d){const E=GUARD_DESIGN_PATTERNS['filter'](G=>G['host']===d),F=E['length']>0x0?E:GUARD_DESIGN_PATTERNS['filter'](G=>G['business_requirement']['toLowerCase']()['includes'](d['toLowerCase']())||G['logic_summary']['toLowerCase']()['includes'](d['toLowerCase']()));return{'success':!![],'action':b,'data':{'patterns':F,'count':F['length'],'filtered_by':E['length']>0x0?'host':'keyword','schema_notes':GUARD_SCHEMA_NOTES},'message':'Found\x20'+F['length']+'\x20Guard\x20design\x20pattern(s)\x20matching\x20\x27'+d+'\x27','suggestions':F['length']===0x0?['Filter\x20by\x20host:\x20service_buy_guard,\x20service_allocator_guard,\x20machine_forward,\x20progress_submission,\x20reward_claim,\x20repository_write,\x20arbitration_usage,\x20arbitration_voting,\x20gen_passport']:undefined};}const C=GUARD_DESIGN_PATTERNS['map'](G=>({'id':G['id'],'business_requirement':G['business_requirement'],'host':G['host'],'data_source':G['data_source'],'verifier_level':G['verifier_level'],'logic_summary':G['logic_summary'],'key_queries':G['key_queries'],'notes':G['notes']??[]}));return{'success':!![],'action':b,'data':{'patterns':C,'count':C['length'],'version':GUARD_DESIGN_PATTERNS_VERSION,'schema_notes':GUARD_SCHEMA_NOTES},'message':'Retrieved\x20'+C['length']+'\x20Guard\x20design\x20patterns.\x20Pass\x20name=\x27<pattern_id>\x27\x20for\x20full\x20detail\x20(witness\x20types,\x20mitigated\x20risks,\x20industries).'};}if(b==='get_safety_rules')return{'success':!![],'action':b,'data':{'version':SAFETY_RULES_VERSION,'object_reuse_rules':OBJECT_REUSE_RULES,'create_vs_modify_pattern':CREATE_VS_MODIFY_PATTERN,'immutability_rules':IMMUTABILITY_RULES,'protocol_slot_rules':PROTOCOL_SLOT_RULES,'operation_type_classification':OPERATION_TYPE_CLASSIFICATION,'operation_class_meta':OPERATION_CLASS_META,'naming_conventions':NAMING_CONVENTIONS},'message':'Retrieved\x20safety\x20rule\x20tables\x20(reuse\x20/\x20immutability\x20/\x20protocol\x20slots\x20/\x20operation\x20classification\x20/\x20naming).\x20'+'Key\x20points:\x20prefer\x20REUSING\x20existing\x20objects\x20(string\x20reference\x20=\x20reuse,\x20object\x20shape\x20=\x20create);\x20'+'Machine\x20publish\x20locks\x20nodes/pairs/forwards,\x20Service\x20publish\x20locks\x20machine/order_allocators/arbitrations\x20(sales\x20stays\x20mutable);\x20'+'Guard\x20is\x20CREATE-only\x20immutable;\x20on-chain\x20writes\x20require\x20explicit\x20user\x20confirmation;\x20'+'Guards\x20bound\x20on\x20machine\x20forwards\x20MUST\x20declare\x20protocol\x20slot\x20254\x20(task\x20binding),\x20and\x20every\x20allocator\x20{GuardIdentifier:N}\x20leg\x20MUST\x20name\x20a\x20declared\x20b_submission\x20Address\x20slot.'};if(!areSchemasAvailable())return{'success':![],'action':b,'data':null,'message':'Schema\x20files\x20are\x20not\x20available.\x20Please\x20run\x20\x27npm\x20run\x20generate:schemas\x27\x20first.','suggestions':['Run\x20\x27npm\x20run\x20generate:schemas\x27\x20to\x20generate\x20schema\x20files','Ensure\x20the\x20dist/schemas\x20directory\x20exists']};switch(b){case'list':{const G=listSchemas();return{'success':!![],'action':b,'data':G,'message':'Found\x20'+G['length']+'\x20available\x20schemas'};}case'get':{if(!c)return{'success':![],'action':b,'data':null,'message':'Schema\x20name\x20is\x20required\x20for\x20\x27get\x27\x20action','suggestions':['Provide\x20a\x20schema\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};const H=getSchema(c);if(!H){const J=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20not\x20found','suggestions':J['length']>0x0?J['map'](K=>'Did\x20you\x20mean:\x20'+K['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};}if(h){const K=writeResponseToFile(H,h);if(K)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+K,'output_file_path':K,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+K]};}const I=autoOverflowToFile(H,c);if(I)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](I['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':I['absolute_path'],'inline_summary':I['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+I['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+I['relative_path']+'\x27\x20against\x20the\x20workspace\x20root\x20and\x20read\x20that.','Without\x20file\x20access,\x20query\x20specific\x20fields\x20via\x20action=\x27get_field\x27\x20with\x20name=\x27'+c+'\x27\x20and\x20a\x20field_path\x20from\x20the\x20summary\x20below.']};return{'success':!![],'action':b,'data':H,'message':'Retrieved\x20schema:\x20'+c};}case'get_field':{if(!c||!f)return{'success':![],'action':b,'data':null,'message':'Both\x20\x27name\x27\x20and\x20\x27field_path\x27\x20are\x20required\x20for\x20\x27get_field\x27\x20action','suggestions':['Example:\x20{action:\x20\x27get_field\x27,\x20name:\x20\x27onchain_operations_machine\x27,\x20field_path:\x20\x27data.node\x27}','Use\x20\x27get\x27\x20action\x20to\x20retrieve\x20the\x20full\x20schema']};const L=getSchemaField(c,f);if(!L)return{'success':![],'action':b,'data':null,'message':'Field\x20path\x20\x27'+f+'\x27\x20not\x20found\x20in\x20schema\x20\x27'+c+'\x27','suggestions':['Check\x20the\x20field\x20path\x20(dot-separated,\x20e.g.\x20\x27data.node\x27)','Use\x20\x27get\x27\x20action\x20to\x20see\x20the\x20full\x20schema\x20structure']};return{'success':!![],'action':b,'data':L,'message':'Retrieved\x20field\x20\x27'+f+'\x27\x20from\x20schema\x20\x27'+c+'\x27'};}case'search':{if(!d)return{'success':![],'action':b,'data':null,'message':'Search\x20query\x20is\x20required\x20for\x20\x27search\x27\x20action'};const M=searchSchemas(d);return{'success':!![],'action':b,'data':M,'message':'Found\x20'+M['length']+'\x20schemas\x20matching\x20\x27'+d+'\x27'};}case'list_operations':{const N=listOperations();return{'success':!![],'action':b,'data':N,'message':'Found\x20'+N['length']+'\x20on-chain\x20operations'};}case'get_guard_queries':{const O=d?.['trim']()['toLowerCase'](),P=R=>({'id':R['id'],'name':R['name'],'objectType':ObjectType[R['objectType']]??String(R['objectType']),'returnType':ValueType[R['return']]??String(R['return'])});if(O){const R=GUARDQUERY['filter'](S=>S['name']['toLowerCase']()['includes'](O)||S['description']?.['toLowerCase']()['includes'](O)||String(S['id'])===O)['map'](S=>({...P(S),'description':S['description']}));return{'success':!![],'action':b,'data':R,'message':'Found\x20'+R['length']+'\x20GUARDQUERY\x20entries\x20matching\x20\x27'+d+'\x27\x20'+('(of\x20'+GUARDQUERY['length']+'\x20total).\x20Use\x20names,\x20not\x20numeric\x20ids,\x20in\x20Guard\x20trees\x20—\x20')+'names\x20fail\x20loudly\x20at\x20validation\x20when\x20wrong;\x20a\x20wrong-but-existing\x20id\x20silently\x20checks\x20a\x20different\x20field.'};}if(h){const S=GUARDQUERY['map'](U=>({...P(U),'description':U['description']})),T=writeResponseToFile(S,h);if(T)return{'success':!![],'action':b,'data':null,'message':'Full\x20GUARDQUERY\x20catalog\x20('+S['length']+'\x20entries)\x20written\x20to\x20file:\x20'+T,'output_file_path':T,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+T]};}const Q=GUARDQUERY['map'](P);return{'success':!![],'action':b,'data':Q,'message':'GUARDQUERY\x20catalog:\x20'+Q['length']+'\x20entries\x20(compact\x20form\x20—\x20id,\x20name,\x20objectType,\x20returnType).\x20'+'Add\x20query=\x27<keyword>\x27\x20for\x20full\x20entries\x20with\x20descriptions,\x20or\x20output_file\x20to\x20dump\x20all\x20details\x20to\x20a\x20file.\x20'+'Prefer\x20NAME\x20references\x20in\x20Guard\x20trees;\x20a\x20numeric\x20id\x20is\x20resolved\x20verbatim\x20and\x20a\x20wrong-but-existing\x20id\x20'+'silently\x20checks\x20a\x20different\x20field.'};}case'get_output':{if(!c)return{'success':![],'action':b,'data':null,'message':'Tool\x20name\x20is\x20required\x20for\x20\x27get_output\x27\x20action','suggestions':['Provide\x20a\x20tool\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools\x20and\x20their\x20outputPath']};const U=getOutputSchema(c);if(!U){const W=listSchemas(),X=W['find'](Z=>Z['name']===c);if(X)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20exists\x20but\x20has\x20no\x20output\x20schema\x20file.\x20The\x20tool\x20may\x20not\x20declare\x20an\x20outputSchema,\x20or\x20the\x20schema\x20file\x20was\x20not\x20generated.','suggestions':['Use\x20\x27get\x27\x20action\x20with\x20name=\x27'+c+'\x27\x20to\x20retrieve\x20its\x20input\x20schema']};const Y=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':Y['length']>0x0?Y['map'](Z=>'Did\x20you\x20mean:\x20'+Z['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const Z=writeResponseToFile(U,h);if(Z)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+Z,'output_file_path':Z,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+Z]};}const V=autoOverflowToFile(U,c);if(V)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](V['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':V['absolute_path'],'inline_summary':V['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+V['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+V['relative_path']+'\x27\x20against\x20the\x20workspace\x20root\x20and\x20read\x20that.','Without\x20file\x20access,\x20query\x20specific\x20fields\x20via\x20action=\x27get_field\x27\x20with\x20name=\x27'+c+'\x27\x20and\x20a\x20field_path\x20from\x20the\x20summary\x20below.']};return{'success':!![],'action':b,'data':U,'message':'Retrieved\x20output\x20schema:\x20'+c};}default:return{'success':![],'action':b,'data':null,'message':'Unknown\x20action:\x20'+b,'suggestions':['Use\x20\x27list\x27,\x20\x27get\x27,\x20\x27get_field\x27,\x20\x27get_output\x27,\x20\x27search\x27,\x20\x27list_operations\x27,\x20\x27get_guard_templates\x27,\x20\x27get_tool_reference\x27,\x20\x27get_guard_design_patterns\x27,\x20\x27get_safety_rules\x27,\x20\x27get_templates\x27,\x20or\x20\x27analyze_guard_semantics\x27']};}}const GUARD_SEMANTICS_READING_CHECKLIST=['WHO\x20can\x20satisfy\x20this\x20Guard\x20(identity:\x20Signer\x20bindings,\x20Entity\x20membership,\x20allowlists)?','WHEN\x20can\x20it\x20be\x20satisfied\x20(time:\x20Clock\x20comparisons,\x20deadlines,\x20windows)?','WHAT\x20evidence\x20must\x20the\x20caller\x20submit\x20(b_submission\x20table\x20entries\x20—\x20Payment/Order/Proof\x20objects)?','WHICH\x20on-chain\x20data\x20does\x20it\x20read,\x20and\x20can\x20that\x20data\x20change\x20(Repository\x20entries\x20are\x20MUTABLE\x20—\x20who\x20controls\x20the\x20writes)?','WHAT\x20does\x20the\x20counterparty\x20gain/lose\x20in\x20each\x20branch\x20of\x20the\x20logic\x20tree?','ARE\x20there\x20error-level\x20diagnostics\x20or\x20critical\x20risks\x20(they\x20block\x20or\x20endanger\x20execution)?'];export async function analyzeGuardSemantics(a){const b=await lintGuard(a,{'auto_fix':![]}),c={'root':a['root'],'table':(a['table']??[])['map'](k=>({'identifier':k['identifier'],'name':k['name'],'value_type':k['value_type']??'Address','b_submission':k['b_submission']??![],'value':k['value']})),'guardName':a['description']??null,'rely':a['rely']??null},d=renderGuardTreeIndented(c),e=renderGuardMermaid(a['root']),f=new Set(),g=[];let h=![],i=![];walkGuardTree(a['root'],k=>{if(k['type']==='context'){if(k['context']==='Clock')h=!![];if(k['context']==='Signer')i=!![];}if(k['type']==='query'&&k['query']!==undefined&&k['query']!==null){if(typeof k['query']==='number'){const l=getGuardQueryByIdOrName(k['query']);if(l)f['add'](l['id']);else g['push'](k['query']);}else{const m=getGuardQueryByIdOrName(k['query']);if(m)f['add'](m['id']);else g['push'](k['query']);}}});const j={'submission_requirements':(a['table']??[])['filter'](k=>k['b_submission']===!![])['map'](k=>({'identifier':k['identifier'],'value_type':k['value_type'],'object_type':k['object_type'],'name':k['name']})),'data_sources':(a['table']??[])['filter'](k=>k['b_submission']!==!![])['map'](k=>({'identifier':k['identifier'],'kind':k['is_system_address']?'system_address':k['object_type']?'object':'fixed_value','value_type':k['value_type'],'object_type':k['object_type'],'name':k['name'],'is_mutable_onchain':k['object_type']==='Repository'})),'query_dependencies':[...f]['sort']((k,l)=>k-l),'unresolved_queries':g,'has_time_conditions':h,'has_signer_constraints':i,'has_rely_composition':Array['isArray'](a['rely']?.['guards'])&&a['rely']['guards']['length']>0x0,'reading_checklist':GUARD_SEMANTICS_READING_CHECKLIST};return{'render':{'tree_indented':d,'mermaid':e},'lint':b,'party_evaluation':j};}export{formatLintResult};
@@ -2387,6 +2387,8 @@
2387
2387
  "move_abort_unmapped",
2388
2388
  "missing_data",
2389
2389
  "state_not_visible",
2390
+ "anchor_unavailable",
2391
+ "delivery_unknown",
2390
2392
  "unknown"
2391
2393
  ]
2392
2394
  },
@@ -130,6 +130,17 @@
130
130
  "template_id": {
131
131
  "type": "string"
132
132
  },
133
+ "semantic_ir_digest": {
134
+ "description": "sha256 of the frozen Semantic IR artifact (present only when semantic_ir was supplied).",
135
+ "type": "string"
136
+ },
137
+ "semantic_ir_issues": {
138
+ "description": "IR claims dropped/clamped/conflicting during validation (unknown vocabulary, inverted span, sub-threshold confidence).",
139
+ "type": "array",
140
+ "items": {
141
+ "type": "string"
142
+ }
143
+ },
133
144
  "scan": {
134
145
  "type": "object",
135
146
  "properties": {
@@ -555,6 +566,26 @@
555
566
  "additionalProperties": false,
556
567
  "description": "The structured migration log."
557
568
  },
569
+ "inference_source": {
570
+ "description": "Which layer resolved the industry: 'keywords' = English lexical match only; 'semantic_ir' = the caller's IR decided; 'semantic_ir+keywords' = both contributed. Present only when semantic_ir was supplied.",
571
+ "type": "string",
572
+ "enum": [
573
+ "keywords",
574
+ "semantic_ir",
575
+ "semantic_ir+keywords"
576
+ ]
577
+ },
578
+ "semantic_ir_digest": {
579
+ "description": "sha256 of the frozen Semantic IR artifact (present only when semantic_ir was supplied).",
580
+ "type": "string"
581
+ },
582
+ "semantic_ir_issues": {
583
+ "description": "IR claims dropped/clamped/conflicting during validation (unknown vocabulary, inverted span, sub-threshold confidence).",
584
+ "type": "array",
585
+ "items": {
586
+ "type": "string"
587
+ }
588
+ },
558
589
  "next_action": {
559
590
  "type": "string",
560
591
  "description": "Next chain step: run migration_review with this log (C6 — the chain is self-describing, no agent re-exploration)."
@@ -833,6 +864,17 @@
833
864
  "localnet"
834
865
  ]
835
866
  },
867
+ "semantic_ir_digest": {
868
+ "description": "sha256 of the frozen Semantic IR artifact (present only when semantic_ir was supplied).",
869
+ "type": "string"
870
+ },
871
+ "semantic_ir_issues": {
872
+ "description": "IR claims dropped/clamped/conflicting during validation (unknown vocabulary, inverted span, sub-threshold confidence).",
873
+ "type": "array",
874
+ "items": {
875
+ "type": "string"
876
+ }
877
+ },
836
878
  "scan": {
837
879
  "type": "object",
838
880
  "properties": {
@@ -30,6 +30,205 @@
30
30
  "description": "Natural-language business/competitor description (required for migration_import; used by template_generate as the intent text).",
31
31
  "type": "string"
32
32
  },
33
+ "semantic_ir": {
34
+ "description": "Canonical Semantic IR produced by the CALLING agent for a NON-ENGLISH (or lexicon-outside) description — this server runs no LLM. The server validates it, then reuses it on the same deterministic surfaces as recommend_industry: (a) migration_import narrows template matching to the IR-resolved industry (an explicit product_ref or 'industry' hint still wins); (b) template_generate / migration_apply read the numeric claim 'reward_pool_amount' as the review-reward pool prefill — explicit fee_overrides > IR claim > the English regex fallback. Shape: {schema_version: 1, locale: '<BCP-47>', traits?, domains?, claims?: [{key, value, confidence?}], provenance: {source: 'caller_llm'}}. Unknown traits/domains/claims and out-of-vocabulary values are dropped and reported in semantic_ir_issues.",
35
+ "type": "object",
36
+ "properties": {
37
+ "schema_version": {
38
+ "type": "number",
39
+ "const": 1
40
+ },
41
+ "locale": {
42
+ "type": "string",
43
+ "minLength": 2,
44
+ "maxLength": 35
45
+ },
46
+ "traits": {
47
+ "maxItems": 20,
48
+ "type": "array",
49
+ "items": {
50
+ "type": "object",
51
+ "properties": {
52
+ "trait": {
53
+ "type": "string",
54
+ "maxLength": 64
55
+ },
56
+ "value": {
57
+ "anyOf": [
58
+ {
59
+ "type": "boolean"
60
+ },
61
+ {
62
+ "type": "string",
63
+ "maxLength": 32
64
+ }
65
+ ]
66
+ },
67
+ "confidence": {
68
+ "type": "number"
69
+ },
70
+ "span": {
71
+ "type": "object",
72
+ "properties": {
73
+ "start": {
74
+ "type": "integer",
75
+ "minimum": 0,
76
+ "maximum": 9007199254740991
77
+ },
78
+ "end": {
79
+ "type": "integer",
80
+ "minimum": 0,
81
+ "maximum": 9007199254740991
82
+ }
83
+ },
84
+ "required": [
85
+ "start",
86
+ "end"
87
+ ],
88
+ "additionalProperties": false
89
+ },
90
+ "quote": {
91
+ "type": "string",
92
+ "maxLength": 300
93
+ }
94
+ },
95
+ "required": [
96
+ "trait",
97
+ "value",
98
+ "confidence"
99
+ ],
100
+ "additionalProperties": false
101
+ }
102
+ },
103
+ "domains": {
104
+ "maxItems": 10,
105
+ "type": "array",
106
+ "items": {
107
+ "type": "object",
108
+ "properties": {
109
+ "domain": {
110
+ "type": "string",
111
+ "maxLength": 64
112
+ },
113
+ "confidence": {
114
+ "type": "number"
115
+ },
116
+ "span": {
117
+ "type": "object",
118
+ "properties": {
119
+ "start": {
120
+ "type": "integer",
121
+ "minimum": 0,
122
+ "maximum": 9007199254740991
123
+ },
124
+ "end": {
125
+ "type": "integer",
126
+ "minimum": 0,
127
+ "maximum": 9007199254740991
128
+ }
129
+ },
130
+ "required": [
131
+ "start",
132
+ "end"
133
+ ],
134
+ "additionalProperties": false
135
+ },
136
+ "quote": {
137
+ "type": "string",
138
+ "maxLength": 300
139
+ }
140
+ },
141
+ "required": [
142
+ "domain"
143
+ ],
144
+ "additionalProperties": false
145
+ }
146
+ },
147
+ "claims": {
148
+ "maxItems": 10,
149
+ "type": "array",
150
+ "items": {
151
+ "type": "object",
152
+ "properties": {
153
+ "key": {
154
+ "type": "string",
155
+ "maxLength": 64
156
+ },
157
+ "value": {
158
+ "type": "number"
159
+ },
160
+ "confidence": {
161
+ "type": "number"
162
+ },
163
+ "span": {
164
+ "type": "object",
165
+ "properties": {
166
+ "start": {
167
+ "type": "integer",
168
+ "minimum": 0,
169
+ "maximum": 9007199254740991
170
+ },
171
+ "end": {
172
+ "type": "integer",
173
+ "minimum": 0,
174
+ "maximum": 9007199254740991
175
+ }
176
+ },
177
+ "required": [
178
+ "start",
179
+ "end"
180
+ ],
181
+ "additionalProperties": false
182
+ },
183
+ "quote": {
184
+ "type": "string",
185
+ "maxLength": 300
186
+ }
187
+ },
188
+ "required": [
189
+ "key",
190
+ "value"
191
+ ],
192
+ "additionalProperties": false
193
+ }
194
+ },
195
+ "provenance": {
196
+ "type": "object",
197
+ "properties": {
198
+ "source": {
199
+ "type": "string",
200
+ "enum": [
201
+ "caller_llm",
202
+ "human"
203
+ ]
204
+ },
205
+ "model": {
206
+ "type": "string",
207
+ "maxLength": 120
208
+ },
209
+ "prompt_version": {
210
+ "type": "string",
211
+ "maxLength": 60
212
+ },
213
+ "generated_at": {
214
+ "type": "integer",
215
+ "minimum": 0,
216
+ "maximum": 9007199254740991
217
+ }
218
+ },
219
+ "required": [
220
+ "source"
221
+ ],
222
+ "additionalProperties": false
223
+ }
224
+ },
225
+ "required": [
226
+ "schema_version",
227
+ "locale",
228
+ "provenance"
229
+ ],
230
+ "additionalProperties": false
231
+ },
33
232
  "url": {
34
233
  "description": "Competitor store/profile URL for migration_import (recorded as provenance only).",
35
234
  "type": "string"
@@ -158,8 +357,12 @@
158
357
  "description": "Review reward pool funding, smallest-unit string. HARD-REQUIRED when the effective review mode is review_reward (INV-4): template_generate refuses the build up-front with error_code 'reward_funding_required' rather than promising an unfunded incentive — pass this, or drop the mode explicitly (review_mode 'review' keeps the rail without the bounty; 'none' removes the rail). The compile kernel also blocks with REVIEW_REWARD_UNFUNDED — this input gate just fails before the pipeline runs.",
159
358
  "type": "string"
160
359
  },
360
+ "reward_claim_amount": {
361
+ "description": "Per-claim reward bounty mounted on the claim guard_add, smallest-unit string. Schema-required on the mount (BK15-F09): compile blocks with REVIEW_REWARD_AMOUNT_MISSING when absent — the kernel never fabricates a real-money parameter.",
362
+ "type": "string"
363
+ },
161
364
  "after_sales_mode": {
162
- "description": "Per-build after-sales mode (D12 重构 4). Absent = the template's declared after_sales_mode applies. Declaring a mode with no backing rail in machine_shape is a compile blocker (AFTER_SALES_RAIL_MISSING).",
365
+ "description": "Per-build after-sales mode (D12 refactor 4). Absent = the template's declared after_sales_mode applies. Declaring a mode with no backing rail in machine_shape is a compile blocker (AFTER_SALES_RAIL_MISSING).",
163
366
  "type": "string",
164
367
  "enum": [
165
368
  "return",
@@ -169,7 +372,7 @@
169
372
  ]
170
373
  },
171
374
  "acceptance_mode": {
172
- "description": "Per-build acceptance/judging mode (D12 重构 2). Absent = the template's declared acceptance_mode applies. A judge-decided mode (contest/bounty/agent) without arbitration_mode 'third_party' is a compile blocker (ACCEPTANCE_JUDGE_NOT_INDEPENDENT); a finite revision_rounds_max with no counter Repository guard is a compile blocker (ACCEPTANCE_REVISION_UNBOUNDED).",
375
+ "description": "Per-build acceptance/judging mode (D12 refactor 2). Absent = the template's declared acceptance_mode applies. A judge-decided mode (contest/bounty/agent) without arbitration_mode 'third_party' is a compile blocker (ACCEPTANCE_JUDGE_NOT_INDEPENDENT); a finite revision_rounds_max with no counter Repository guard is a compile blocker (ACCEPTANCE_REVISION_UNBOUNDED).",
173
376
  "type": "string",
174
377
  "enum": [
175
378
  "milestone",
@@ -180,7 +383,7 @@
180
383
  ]
181
384
  },
182
385
  "installment_mode": {
183
- "description": "Per-build installment/deposit mode (D12 重构 3). Absent = the template's declared installment_mode applies. A capture forward with no fund-gate Guard is a compile blocker (INSTALLMENT_FUNDING_UNGATED); a deposit-held state with no exit rail is a compile blocker (INSTALLMENT_DEPOSIT_STRANDED).",
386
+ "description": "Per-build installment/deposit mode (D12 refactor 3). Absent = the template's declared installment_mode applies. A capture forward with no fund-gate Guard is a compile blocker (INSTALLMENT_FUNDING_UNGATED); a deposit-held state with no exit rail is a compile blocker (INSTALLMENT_DEPOSIT_STRANDED).",
184
387
  "type": "string",
185
388
  "enum": [
186
389
  "deposit_balance",
@@ -189,7 +392,7 @@
189
392
  ]
190
393
  },
191
394
  "affiliate_mode": {
192
- "description": "Per-build affiliate commission overlay (D12 批 5). Absent = the template's declared affiliate_mode applies. A declared commission overlay with no commission rail is a compile blocker (AFFILIATE_RAIL_MISSING); a commission with no post-lock no-clawback disclosure build_note is a compile blocker (AFFILIATE_CLAWBACK_UNDISCLOSED).",
395
+ "description": "Per-build affiliate commission overlay (D12 batch 5). Absent = the template's declared affiliate_mode applies. A declared commission overlay with no commission rail is a compile blocker (AFFILIATE_RAIL_MISSING); a commission with no post-lock no-clawback disclosure build_note is a compile blocker (AFFILIATE_CLAWBACK_UNDISCLOSED).",
193
396
  "type": "string",
194
397
  "enum": [
195
398
  "commission",
@@ -197,7 +400,7 @@
197
400
  ]
198
401
  },
199
402
  "crowdfunding_mode": {
200
- "description": "Per-build crowdfunding campaign overlay (D12 批 7). Absent = the template's declared crowdfunding_mode applies. A declared threshold/flexible overlay with no two-leg escrow-exit gate (release XOR refund, D-BUG-2) is a compile blocker (CROWDFUNDING_THRESHOLD_GATE_MISSING); a threshold gate whose aggregate is NOT a writer-bound sum-where (id_from signer) is a compile blocker (CROWDFUNDING_AGGREGATE_UNBOUND); a missing L-04/L-01/L-05 disclosure build_note is a compile blocker (CROWDFUNDING_DISCLOSURE_MISSING).",
403
+ "description": "Per-build crowdfunding campaign overlay (D12 batch 7). Absent = the template's declared crowdfunding_mode applies. A declared threshold/flexible overlay with no two-leg escrow-exit gate (release XOR refund, D-BUG-2) is a compile blocker (CROWDFUNDING_THRESHOLD_GATE_MISSING); a threshold gate whose aggregate is NOT a writer-bound sum-where (id_from signer) is a compile blocker (CROWDFUNDING_AGGREGATE_UNBOUND); a missing L-04/L-01/L-05 disclosure build_note is a compile blocker (CROWDFUNDING_DISCLOSURE_MISSING).",
201
404
  "type": "string",
202
405
  "enum": [
203
406
  "threshold",
@@ -71,6 +71,8 @@
71
71
  "move_abort_unmapped",
72
72
  "missing_data",
73
73
  "state_not_visible",
74
+ "anchor_unavailable",
75
+ "delivery_unknown",
74
76
  "unknown"
75
77
  ]
76
78
  },