@wowok/agent-mcp 2.7.6 → 2.7.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.
- package/dist/project/evaluation-fix.spec.d.ts +1 -0
- package/dist/project/evaluation-fix.spec.js +1 -0
- package/dist/project/evaluation.js +1 -1
- package/dist/project/index.js +1 -1
- package/dist/project/rollback-policy.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/call/allocation.d.ts +9 -0
- package/dist/schema/call/arbitration.d.ts +10 -0
- package/dist/schema/call/contact.d.ts +10 -0
- package/dist/schema/call/demand.d.ts +10 -0
- package/dist/schema/call/machine.d.ts +10 -0
- package/dist/schema/call/order.d.ts +10 -0
- package/dist/schema/call/payment.d.ts +3 -3
- package/dist/schema/call/payment.js +1 -1
- package/dist/schema/call/permission.d.ts +10 -0
- package/dist/schema/call/progress.d.ts +10 -0
- package/dist/schema/call/repository.d.ts +10 -0
- package/dist/schema/call/reward.d.ts +16 -0
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +16 -0
- package/dist/schema/call/treasury.d.ts +16 -0
- package/dist/schema/common/index.d.ts +21 -0
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/operations.d.ts +68 -1
- package/dist/schema/operations.js +1 -1
- package/dist/schema/query/index.d.ts +5 -0
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/onchain_operations.schema.json +274 -7
- package/dist/schemas/onchain_operations_allocation.schema.json +12 -0
- package/dist/schemas/onchain_operations_arbitration.schema.json +20 -0
- package/dist/schemas/onchain_operations_contact.schema.json +20 -0
- package/dist/schemas/onchain_operations_demand.schema.json +20 -0
- package/dist/schemas/onchain_operations_machine.schema.json +20 -0
- package/dist/schemas/onchain_operations_order.schema.json +20 -0
- package/dist/schemas/onchain_operations_payment.schema.json +6 -7
- package/dist/schemas/onchain_operations_permission.schema.json +20 -0
- package/dist/schemas/onchain_operations_progress.schema.json +20 -0
- package/dist/schemas/onchain_operations_repository.schema.json +20 -0
- package/dist/schemas/onchain_operations_reward.schema.json +32 -0
- package/dist/schemas/onchain_operations_service.schema.json +32 -0
- package/dist/schemas/onchain_operations_treasury.schema.json +32 -0
- package/dist/schemas/query_toolkit.output.json +20 -0
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/shared.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFileSync,existsSync,writeFileSync,mkdirSync,readdirSync}from'fs';import{resolve,join,dirname}from'path';import{fileURLToPath}from'url';import{TOOLS_REFERENCE,getToolReference,searchToolReference,getToolSequence}from'../knowledge/tools-reference.js';import{GUARD_DESIGN_PATTERNS,getGuardDesignPattern,GUARD_DESIGN_PATTERNS_VERSION}from'../knowledge/guard-design-patterns.js';import{OBJECT_REUSE_RULES,CREATE_VS_MODIFY_PATTERN,IMMUTABILITY_RULES,OPERATION_TYPE_CLASSIFICATION,OPERATION_CLASS_META,NAMING_CONVENTIONS,SAFETY_RULES_VERSION}from'../knowledge/safety-rules.js';import{listTemplates as a347a,getTemplateDetail,instantiateTemplate,getTemplateCounts,TEMPLATE_OBJECT_TYPES}from'../knowledge/template-registry.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,EXAMPLES_DIR_SCRIPTS=resolve(__dirname,'../../scripts/examples'),EXAMPLES_DIR_DIST=resolve(__dirname,'../examples');export const EXAMPLES_DIR=existsSync(EXAMPLES_DIR_SCRIPTS)?EXAMPLES_DIR_SCRIPTS:EXAMPLES_DIR_DIST;const 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 searchExamples(a){if(!existsSync(EXAMPLES_DIR))return[];let b;try{b=readdirSync(EXAMPLES_DIR);}catch{return[];}const c=a['toLowerCase']()['trim']();if(!c)return[];const d=[];for(const e of b){if(!e['endsWith']('.json'))continue;const f=join(EXAMPLES_DIR,e);try{const g=readFileSync(f,'utf-8'),h=JSON['parse'](g),i=String(h['title']??''),j=String(h['description']??''),k=Array['isArray'](h['tags'])?h['tags']['map'](o=>String(o)):[],l=String(h['operation_type']??''),m=String(h['industry']??''),n=[];i['toLowerCase']()['includes'](c)&&n['push']('title'),j['toLowerCase']()['includes'](c)&&n['push']('description'),k['some'](o=>o['toLowerCase']()===c)&&n['push']('tags'),l&&l['toLowerCase']()===c&&n['push']('operation_type'),m&&m['toLowerCase']()===c&&n['push']('industry'),n['length']>0x0&&d['push']({'file':e,'title':i,'description':j,'tags':k,'industry':m,'operation_type':l,'verified':h['verified']===!![],'score':n['length'],'matched_fields':n});}catch{continue;}}return d['sort']((o,p)=>{if(p['score']!==o['score'])return p['score']-o['score'];return o['file']['localeCompare'](p['file']);}),d;}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;}}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=a347a(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==='search_examples'){if(!d)return{'success':![],'action':b,'data':null,'message':'Search\x20query\x20is\x20required\x20for\x20\x27search_examples\x27\x20action','suggestions':['Provide\x20a\x20\x27query\x27\x20string\x20(e.g.\x20\x27rental\x27,\x20\x27guard\x27,\x20\x27service\x27,\x20\x27machine\x27)','Searchable\x20fields:\x20title,\x20description,\x20tags,\x20operation_type,\x20industry']};const y=searchExamples(d);return{'success':!![],'action':b,'data':y,'message':'Found\x20'+y['length']+'\x20example(s)\x20matching\x20\x27'+d+'\x27','suggestions':y['length']===0x0?['Try\x20broader\x20terms\x20like\x20\x27service\x27,\x20\x27machine\x27,\x20\x27guard\x27,\x20\x27permission\x27','Try\x20an\x20industry\x20name:\x20\x27rental\x27,\x20\x27retail\x27,\x20\x27general\x27','Use\x20\x27get\x27\x20action\x20with\x20a\x20schema\x20name\x20to\x20see\x20the\x20full\x20JSON\x20Schema']:undefined};}if(b==='get_tool_reference'){if(c){const A=getToolReference(c);if(!A)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'](C=>C['name'])['join'](',\x20')]};const B=getToolSequence(c);return{'success':!![],'action':b,'data':{'tool':A,'call_sequence':B??null},'message':'Retrieved\x20tool\x20reference:\x20'+c};}if(d){const C=searchToolReference(d);return{'success':!![],'action':b,'data':{'tools':C,'count':C['length']},'message':'Found\x20'+C['length']+'\x20tool(s)\x20matching\x20\x27'+d+'\x27','suggestions':C['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 z=TOOLS_REFERENCE['map'](D=>({'name':D['name'],'summary':D['summary'],'actions':D['actions']??[],'notes':D['notes']??[]}));return{'success':!![],'action':b,'data':{'tools':z,'count':z['length']},'message':'Retrieved\x20reference\x20for\x20'+z['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 E=getGuardDesignPattern(c);if(!E)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'](F=>F['id'])['join'](',\x20')]};return{'success':!![],'action':b,'data':{'pattern':E},'message':'Retrieved\x20Guard\x20design\x20pattern:\x20'+c};}if(d){const F=GUARD_DESIGN_PATTERNS['filter'](H=>H['host']===d),G=F['length']>0x0?F:GUARD_DESIGN_PATTERNS['filter'](H=>H['business_requirement']['toLowerCase']()['includes'](d['toLowerCase']())||H['logic_summary']['toLowerCase']()['includes'](d['toLowerCase']()));return{'success':!![],'action':b,'data':{'patterns':G,'count':G['length'],'filtered_by':F['length']>0x0?'host':'keyword'},'message':'Found\x20'+G['length']+'\x20Guard\x20design\x20pattern(s)\x20matching\x20\x27'+d+'\x27','suggestions':G['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 D=GUARD_DESIGN_PATTERNS['map'](H=>({'id':H['id'],'business_requirement':H['business_requirement'],'host':H['host'],'data_source':H['data_source'],'verifier_level':H['verifier_level'],'logic_summary':H['logic_summary'],'key_queries':H['key_queries'],'notes':H['notes']??[]}));return{'success':!![],'action':b,'data':{'patterns':D,'count':D['length'],'version':GUARD_DESIGN_PATTERNS_VERSION},'message':'Retrieved\x20'+D['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,'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/\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.'};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 H=listSchemas();return{'success':!![],'action':b,'data':H,'message':'Found\x20'+H['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 I=getSchema(c);if(!I){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(I,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]};}return{'success':!![],'action':b,'data':I,'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_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 O=getOutputSchema(c);if(!O){const P=listSchemas(),Q=P['find'](S=>S['name']===c);if(Q)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 R=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':R['length']>0x0?R['map'](S=>'Did\x20you\x20mean:\x20'+S['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const S=writeResponseToFile(O,h);if(S)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+S,'output_file_path':S,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+S]};}return{'success':!![],'action':b,'data':O,'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,\x20or\x20\x27search_examples\x27']};}}
|
|
1
|
+
import{readFileSync,existsSync,writeFileSync,mkdirSync,readdirSync}from'fs';import{resolve,join,dirname}from'path';import{fileURLToPath}from'url';import{TOOLS_REFERENCE,getToolReference,searchToolReference,getToolSequence}from'../knowledge/tools-reference.js';import{GUARD_DESIGN_PATTERNS,getGuardDesignPattern,GUARD_DESIGN_PATTERNS_VERSION}from'../knowledge/guard-design-patterns.js';import{OBJECT_REUSE_RULES,CREATE_VS_MODIFY_PATTERN,IMMUTABILITY_RULES,OPERATION_TYPE_CLASSIFICATION,OPERATION_CLASS_META,NAMING_CONVENTIONS,SAFETY_RULES_VERSION}from'../knowledge/safety-rules.js';import{listTemplates as a348a,getTemplateDetail,instantiateTemplate,getTemplateCounts,TEMPLATE_OBJECT_TYPES}from'../knowledge/template-registry.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,EXAMPLES_DIR_SCRIPTS=resolve(__dirname,'../../scripts/examples'),EXAMPLES_DIR_DIST=resolve(__dirname,'../examples');export const EXAMPLES_DIR=existsSync(EXAMPLES_DIR_SCRIPTS)?EXAMPLES_DIR_SCRIPTS:EXAMPLES_DIR_DIST;const 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 searchExamples(a){if(!existsSync(EXAMPLES_DIR))return[];let b;try{b=readdirSync(EXAMPLES_DIR);}catch{return[];}const c=a['toLowerCase']()['trim']();if(!c)return[];const d=[];for(const e of b){if(!e['endsWith']('.json'))continue;const f=join(EXAMPLES_DIR,e);try{const g=readFileSync(f,'utf-8'),h=JSON['parse'](g),i=String(h['title']??''),j=String(h['description']??''),k=Array['isArray'](h['tags'])?h['tags']['map'](o=>String(o)):[],l=String(h['operation_type']??''),m=String(h['industry']??''),n=[];i['toLowerCase']()['includes'](c)&&n['push']('title'),j['toLowerCase']()['includes'](c)&&n['push']('description'),k['some'](o=>o['toLowerCase']()===c)&&n['push']('tags'),l&&l['toLowerCase']()===c&&n['push']('operation_type'),m&&m['toLowerCase']()===c&&n['push']('industry'),n['length']>0x0&&d['push']({'file':e,'title':i,'description':j,'tags':k,'industry':m,'operation_type':l,'verified':h['verified']===!![],'score':n['length'],'matched_fields':n});}catch{continue;}}return d['sort']((o,p)=>{if(p['score']!==o['score'])return p['score']-o['score'];return o['file']['localeCompare'](p['file']);}),d;}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;}}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=a348a(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==='search_examples'){if(!d)return{'success':![],'action':b,'data':null,'message':'Search\x20query\x20is\x20required\x20for\x20\x27search_examples\x27\x20action','suggestions':['Provide\x20a\x20\x27query\x27\x20string\x20(e.g.\x20\x27rental\x27,\x20\x27guard\x27,\x20\x27service\x27,\x20\x27machine\x27)','Searchable\x20fields:\x20title,\x20description,\x20tags,\x20operation_type,\x20industry']};const y=searchExamples(d);return{'success':!![],'action':b,'data':y,'message':'Found\x20'+y['length']+'\x20example(s)\x20matching\x20\x27'+d+'\x27','suggestions':y['length']===0x0?['Try\x20broader\x20terms\x20like\x20\x27service\x27,\x20\x27machine\x27,\x20\x27guard\x27,\x20\x27permission\x27','Try\x20an\x20industry\x20name:\x20\x27rental\x27,\x20\x27retail\x27,\x20\x27general\x27','Use\x20\x27get\x27\x20action\x20with\x20a\x20schema\x20name\x20to\x20see\x20the\x20full\x20JSON\x20Schema']:undefined};}if(b==='get_tool_reference'){if(c){const A=getToolReference(c);if(!A)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'](C=>C['name'])['join'](',\x20')]};const B=getToolSequence(c);return{'success':!![],'action':b,'data':{'tool':A,'call_sequence':B??null},'message':'Retrieved\x20tool\x20reference:\x20'+c};}if(d){const C=searchToolReference(d);return{'success':!![],'action':b,'data':{'tools':C,'count':C['length']},'message':'Found\x20'+C['length']+'\x20tool(s)\x20matching\x20\x27'+d+'\x27','suggestions':C['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 z=TOOLS_REFERENCE['map'](D=>({'name':D['name'],'summary':D['summary'],'actions':D['actions']??[],'notes':D['notes']??[]}));return{'success':!![],'action':b,'data':{'tools':z,'count':z['length']},'message':'Retrieved\x20reference\x20for\x20'+z['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 E=getGuardDesignPattern(c);if(!E)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'](F=>F['id'])['join'](',\x20')]};return{'success':!![],'action':b,'data':{'pattern':E},'message':'Retrieved\x20Guard\x20design\x20pattern:\x20'+c};}if(d){const F=GUARD_DESIGN_PATTERNS['filter'](H=>H['host']===d),G=F['length']>0x0?F:GUARD_DESIGN_PATTERNS['filter'](H=>H['business_requirement']['toLowerCase']()['includes'](d['toLowerCase']())||H['logic_summary']['toLowerCase']()['includes'](d['toLowerCase']()));return{'success':!![],'action':b,'data':{'patterns':G,'count':G['length'],'filtered_by':F['length']>0x0?'host':'keyword'},'message':'Found\x20'+G['length']+'\x20Guard\x20design\x20pattern(s)\x20matching\x20\x27'+d+'\x27','suggestions':G['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 D=GUARD_DESIGN_PATTERNS['map'](H=>({'id':H['id'],'business_requirement':H['business_requirement'],'host':H['host'],'data_source':H['data_source'],'verifier_level':H['verifier_level'],'logic_summary':H['logic_summary'],'key_queries':H['key_queries'],'notes':H['notes']??[]}));return{'success':!![],'action':b,'data':{'patterns':D,'count':D['length'],'version':GUARD_DESIGN_PATTERNS_VERSION},'message':'Retrieved\x20'+D['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,'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/\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.'};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 H=listSchemas();return{'success':!![],'action':b,'data':H,'message':'Found\x20'+H['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 I=getSchema(c);if(!I){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(I,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]};}return{'success':!![],'action':b,'data':I,'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_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 O=getOutputSchema(c);if(!O){const P=listSchemas(),Q=P['find'](S=>S['name']===c);if(Q)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 R=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':R['length']>0x0?R['map'](S=>'Did\x20you\x20mean:\x20'+S['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const S=writeResponseToFile(O,h);if(S)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+S,'output_file_path':S,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+S]};}return{'success':!![],'action':b,'data':O,'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,\x20or\x20\x27search_examples\x27']};}}
|
package/dist/schemas/index.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"title": "WoWok MCP Schema Index",
|
|
4
4
|
"description": "Index of all available JSON schemas for WoWok MCP tools",
|
|
5
|
-
"generatedAt": "2026-08-
|
|
5
|
+
"generatedAt": "2026-08-23T01:48:18.281Z",
|
|
6
6
|
"tools": [
|
|
7
7
|
{
|
|
8
8
|
"name": "onchain_operations",
|
|
@@ -1221,6 +1221,18 @@
|
|
|
1221
1221
|
"payment": {
|
|
1222
1222
|
"type": "string",
|
|
1223
1223
|
"description": "Payment object ID"
|
|
1224
|
+
},
|
|
1225
|
+
"type": {
|
|
1226
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
1227
|
+
"type": "string"
|
|
1228
|
+
},
|
|
1229
|
+
"version": {
|
|
1230
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
1231
|
+
"type": "string"
|
|
1232
|
+
},
|
|
1233
|
+
"digest": {
|
|
1234
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
1235
|
+
"type": "string"
|
|
1224
1236
|
}
|
|
1225
1237
|
},
|
|
1226
1238
|
"required": [
|
|
@@ -1268,6 +1280,14 @@
|
|
|
1268
1280
|
},
|
|
1269
1281
|
"content_raw": {
|
|
1270
1282
|
"description": "Raw content data"
|
|
1283
|
+
},
|
|
1284
|
+
"version": {
|
|
1285
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
1286
|
+
"type": "string"
|
|
1287
|
+
},
|
|
1288
|
+
"digest": {
|
|
1289
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
1290
|
+
"type": "string"
|
|
1271
1291
|
}
|
|
1272
1292
|
},
|
|
1273
1293
|
"required": [
|
|
@@ -1319,6 +1339,18 @@
|
|
|
1319
1339
|
"payment": {
|
|
1320
1340
|
"type": "string",
|
|
1321
1341
|
"description": "Payment object ID"
|
|
1342
|
+
},
|
|
1343
|
+
"type": {
|
|
1344
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
1345
|
+
"type": "string"
|
|
1346
|
+
},
|
|
1347
|
+
"version": {
|
|
1348
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
1349
|
+
"type": "string"
|
|
1350
|
+
},
|
|
1351
|
+
"digest": {
|
|
1352
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
1353
|
+
"type": "string"
|
|
1322
1354
|
}
|
|
1323
1355
|
},
|
|
1324
1356
|
"required": [
|
|
@@ -3038,6 +3070,14 @@
|
|
|
3038
3070
|
},
|
|
3039
3071
|
"content_raw": {
|
|
3040
3072
|
"description": "Raw content data"
|
|
3073
|
+
},
|
|
3074
|
+
"version": {
|
|
3075
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
3076
|
+
"type": "string"
|
|
3077
|
+
},
|
|
3078
|
+
"digest": {
|
|
3079
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
3080
|
+
"type": "string"
|
|
3041
3081
|
}
|
|
3042
3082
|
},
|
|
3043
3083
|
"required": [
|
|
@@ -3089,6 +3129,18 @@
|
|
|
3089
3129
|
"payment": {
|
|
3090
3130
|
"type": "string",
|
|
3091
3131
|
"description": "Payment object ID"
|
|
3132
|
+
},
|
|
3133
|
+
"type": {
|
|
3134
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
3135
|
+
"type": "string"
|
|
3136
|
+
},
|
|
3137
|
+
"version": {
|
|
3138
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
3139
|
+
"type": "string"
|
|
3140
|
+
},
|
|
3141
|
+
"digest": {
|
|
3142
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
3143
|
+
"type": "string"
|
|
3092
3144
|
}
|
|
3093
3145
|
},
|
|
3094
3146
|
"required": [
|
|
@@ -3952,6 +4004,14 @@
|
|
|
3952
4004
|
},
|
|
3953
4005
|
"content_raw": {
|
|
3954
4006
|
"description": "Raw content data"
|
|
4007
|
+
},
|
|
4008
|
+
"version": {
|
|
4009
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
4010
|
+
"type": "string"
|
|
4011
|
+
},
|
|
4012
|
+
"digest": {
|
|
4013
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
4014
|
+
"type": "string"
|
|
3955
4015
|
}
|
|
3956
4016
|
},
|
|
3957
4017
|
"required": [
|
|
@@ -4003,6 +4063,18 @@
|
|
|
4003
4063
|
"payment": {
|
|
4004
4064
|
"type": "string",
|
|
4005
4065
|
"description": "Payment object ID"
|
|
4066
|
+
},
|
|
4067
|
+
"type": {
|
|
4068
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
4069
|
+
"type": "string"
|
|
4070
|
+
},
|
|
4071
|
+
"version": {
|
|
4072
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
4073
|
+
"type": "string"
|
|
4074
|
+
},
|
|
4075
|
+
"digest": {
|
|
4076
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
4077
|
+
"type": "string"
|
|
4006
4078
|
}
|
|
4007
4079
|
},
|
|
4008
4080
|
"required": [
|
|
@@ -5488,6 +5560,14 @@
|
|
|
5488
5560
|
},
|
|
5489
5561
|
"content_raw": {
|
|
5490
5562
|
"description": "Raw content data"
|
|
5563
|
+
},
|
|
5564
|
+
"version": {
|
|
5565
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
5566
|
+
"type": "string"
|
|
5567
|
+
},
|
|
5568
|
+
"digest": {
|
|
5569
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
5570
|
+
"type": "string"
|
|
5491
5571
|
}
|
|
5492
5572
|
},
|
|
5493
5573
|
"required": [
|
|
@@ -5539,6 +5619,18 @@
|
|
|
5539
5619
|
"payment": {
|
|
5540
5620
|
"type": "string",
|
|
5541
5621
|
"description": "Payment object ID"
|
|
5622
|
+
},
|
|
5623
|
+
"type": {
|
|
5624
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
5625
|
+
"type": "string"
|
|
5626
|
+
},
|
|
5627
|
+
"version": {
|
|
5628
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
5629
|
+
"type": "string"
|
|
5630
|
+
},
|
|
5631
|
+
"digest": {
|
|
5632
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
5633
|
+
"type": "string"
|
|
5542
5634
|
}
|
|
5543
5635
|
},
|
|
5544
5636
|
"required": [
|
|
@@ -6773,6 +6865,14 @@
|
|
|
6773
6865
|
},
|
|
6774
6866
|
"content_raw": {
|
|
6775
6867
|
"description": "Raw content data"
|
|
6868
|
+
},
|
|
6869
|
+
"version": {
|
|
6870
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
6871
|
+
"type": "string"
|
|
6872
|
+
},
|
|
6873
|
+
"digest": {
|
|
6874
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
6875
|
+
"type": "string"
|
|
6776
6876
|
}
|
|
6777
6877
|
},
|
|
6778
6878
|
"required": [
|
|
@@ -6824,6 +6924,18 @@
|
|
|
6824
6924
|
"payment": {
|
|
6825
6925
|
"type": "string",
|
|
6826
6926
|
"description": "Payment object ID"
|
|
6927
|
+
},
|
|
6928
|
+
"type": {
|
|
6929
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
6930
|
+
"type": "string"
|
|
6931
|
+
},
|
|
6932
|
+
"version": {
|
|
6933
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
6934
|
+
"type": "string"
|
|
6935
|
+
},
|
|
6936
|
+
"digest": {
|
|
6937
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
6938
|
+
"type": "string"
|
|
6827
6939
|
}
|
|
6828
6940
|
},
|
|
6829
6941
|
"required": [
|
|
@@ -7706,6 +7818,14 @@
|
|
|
7706
7818
|
},
|
|
7707
7819
|
"content_raw": {
|
|
7708
7820
|
"description": "Raw content data"
|
|
7821
|
+
},
|
|
7822
|
+
"version": {
|
|
7823
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
7824
|
+
"type": "string"
|
|
7825
|
+
},
|
|
7826
|
+
"digest": {
|
|
7827
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
7828
|
+
"type": "string"
|
|
7709
7829
|
}
|
|
7710
7830
|
},
|
|
7711
7831
|
"required": [
|
|
@@ -7757,6 +7877,18 @@
|
|
|
7757
7877
|
"payment": {
|
|
7758
7878
|
"type": "string",
|
|
7759
7879
|
"description": "Payment object ID"
|
|
7880
|
+
},
|
|
7881
|
+
"type": {
|
|
7882
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
7883
|
+
"type": "string"
|
|
7884
|
+
},
|
|
7885
|
+
"version": {
|
|
7886
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
7887
|
+
"type": "string"
|
|
7888
|
+
},
|
|
7889
|
+
"digest": {
|
|
7890
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
7891
|
+
"type": "string"
|
|
7760
7892
|
}
|
|
7761
7893
|
},
|
|
7762
7894
|
"required": [
|
|
@@ -8531,6 +8663,18 @@
|
|
|
8531
8663
|
"payment": {
|
|
8532
8664
|
"type": "string",
|
|
8533
8665
|
"description": "Payment object ID"
|
|
8666
|
+
},
|
|
8667
|
+
"type": {
|
|
8668
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
8669
|
+
"type": "string"
|
|
8670
|
+
},
|
|
8671
|
+
"version": {
|
|
8672
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
8673
|
+
"type": "string"
|
|
8674
|
+
},
|
|
8675
|
+
"digest": {
|
|
8676
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
8677
|
+
"type": "string"
|
|
8534
8678
|
}
|
|
8535
8679
|
},
|
|
8536
8680
|
"required": [
|
|
@@ -9144,6 +9288,14 @@
|
|
|
9144
9288
|
},
|
|
9145
9289
|
"content_raw": {
|
|
9146
9290
|
"description": "Raw content data"
|
|
9291
|
+
},
|
|
9292
|
+
"version": {
|
|
9293
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
9294
|
+
"type": "string"
|
|
9295
|
+
},
|
|
9296
|
+
"digest": {
|
|
9297
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
9298
|
+
"type": "string"
|
|
9147
9299
|
}
|
|
9148
9300
|
},
|
|
9149
9301
|
"required": [
|
|
@@ -9195,6 +9347,18 @@
|
|
|
9195
9347
|
"payment": {
|
|
9196
9348
|
"type": "string",
|
|
9197
9349
|
"description": "Payment object ID"
|
|
9350
|
+
},
|
|
9351
|
+
"type": {
|
|
9352
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
9353
|
+
"type": "string"
|
|
9354
|
+
},
|
|
9355
|
+
"version": {
|
|
9356
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
9357
|
+
"type": "string"
|
|
9358
|
+
},
|
|
9359
|
+
"digest": {
|
|
9360
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
9361
|
+
"type": "string"
|
|
9198
9362
|
}
|
|
9199
9363
|
},
|
|
9200
9364
|
"required": [
|
|
@@ -10024,6 +10188,18 @@
|
|
|
10024
10188
|
"payment": {
|
|
10025
10189
|
"type": "string",
|
|
10026
10190
|
"description": "Payment object ID"
|
|
10191
|
+
},
|
|
10192
|
+
"type": {
|
|
10193
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
10194
|
+
"type": "string"
|
|
10195
|
+
},
|
|
10196
|
+
"version": {
|
|
10197
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
10198
|
+
"type": "string"
|
|
10199
|
+
},
|
|
10200
|
+
"digest": {
|
|
10201
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
10202
|
+
"type": "string"
|
|
10027
10203
|
}
|
|
10028
10204
|
},
|
|
10029
10205
|
"required": [
|
|
@@ -10238,6 +10414,14 @@
|
|
|
10238
10414
|
},
|
|
10239
10415
|
"content_raw": {
|
|
10240
10416
|
"description": "Raw content data"
|
|
10417
|
+
},
|
|
10418
|
+
"version": {
|
|
10419
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
10420
|
+
"type": "string"
|
|
10421
|
+
},
|
|
10422
|
+
"digest": {
|
|
10423
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
10424
|
+
"type": "string"
|
|
10241
10425
|
}
|
|
10242
10426
|
},
|
|
10243
10427
|
"required": [
|
|
@@ -10289,6 +10473,18 @@
|
|
|
10289
10473
|
"payment": {
|
|
10290
10474
|
"type": "string",
|
|
10291
10475
|
"description": "Payment object ID"
|
|
10476
|
+
},
|
|
10477
|
+
"type": {
|
|
10478
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
10479
|
+
"type": "string"
|
|
10480
|
+
},
|
|
10481
|
+
"version": {
|
|
10482
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
10483
|
+
"type": "string"
|
|
10484
|
+
},
|
|
10485
|
+
"digest": {
|
|
10486
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
10487
|
+
"type": "string"
|
|
10292
10488
|
}
|
|
10293
10489
|
},
|
|
10294
10490
|
"required": [
|
|
@@ -11307,6 +11503,18 @@
|
|
|
11307
11503
|
"payment": {
|
|
11308
11504
|
"type": "string",
|
|
11309
11505
|
"description": "Payment object ID"
|
|
11506
|
+
},
|
|
11507
|
+
"type": {
|
|
11508
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
11509
|
+
"type": "string"
|
|
11510
|
+
},
|
|
11511
|
+
"version": {
|
|
11512
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
11513
|
+
"type": "string"
|
|
11514
|
+
},
|
|
11515
|
+
"digest": {
|
|
11516
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
11517
|
+
"type": "string"
|
|
11310
11518
|
}
|
|
11311
11519
|
},
|
|
11312
11520
|
"required": [
|
|
@@ -12618,6 +12826,14 @@
|
|
|
12618
12826
|
},
|
|
12619
12827
|
"content_raw": {
|
|
12620
12828
|
"description": "Raw content data"
|
|
12829
|
+
},
|
|
12830
|
+
"version": {
|
|
12831
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
12832
|
+
"type": "string"
|
|
12833
|
+
},
|
|
12834
|
+
"digest": {
|
|
12835
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
12836
|
+
"type": "string"
|
|
12621
12837
|
}
|
|
12622
12838
|
},
|
|
12623
12839
|
"required": [
|
|
@@ -12669,6 +12885,18 @@
|
|
|
12669
12885
|
"payment": {
|
|
12670
12886
|
"type": "string",
|
|
12671
12887
|
"description": "Payment object ID"
|
|
12888
|
+
},
|
|
12889
|
+
"type": {
|
|
12890
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
12891
|
+
"type": "string"
|
|
12892
|
+
},
|
|
12893
|
+
"version": {
|
|
12894
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
12895
|
+
"type": "string"
|
|
12896
|
+
},
|
|
12897
|
+
"digest": {
|
|
12898
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
12899
|
+
"type": "string"
|
|
12672
12900
|
}
|
|
12673
12901
|
},
|
|
12674
12902
|
"required": [
|
|
@@ -16229,28 +16457,27 @@
|
|
|
16229
16457
|
"type": "object",
|
|
16230
16458
|
"properties": {
|
|
16231
16459
|
"object": {
|
|
16232
|
-
"
|
|
16233
|
-
"
|
|
16460
|
+
"description": "CoinWrapper object ID (0x...) or local name to unwrap. OPTIONAL: when omitted, AUTO-RECEIVE mode unwraps EVERY CoinWrapper currently owned by the caller in a single transaction — no need to look up IDs first. Find received CoinWrappers via query_toolkit with query_type='onchain_received'.",
|
|
16461
|
+
"type": "string"
|
|
16234
16462
|
},
|
|
16235
16463
|
"receive": {
|
|
16236
16464
|
"type": "boolean",
|
|
16237
16465
|
"const": true,
|
|
16238
|
-
"description": "Set to true to activate receive mode. CoinWrapper objects ARE transferred to recipients via transfer::public_transfer (they arrive as owned objects), but they are NOT spendable coins. This mode unwraps a CoinWrapper into actual coins in your wallet via payment::unwrap_to_myself. The caller must be the CoinWrapper's owner (the recipient specified in the Allocation's revenue split)."
|
|
16466
|
+
"description": "Set to true to activate receive mode. CoinWrapper objects ARE transferred to recipients via transfer::public_transfer (they arrive as owned objects), but they are NOT spendable coins. This mode unwraps a CoinWrapper into actual coins in your wallet via payment::unwrap_to_myself. The caller must be the CoinWrapper's owner (the recipient specified in the Allocation's revenue split). When 'object' is omitted, every CoinWrapper owned by the caller is unwrapped at once."
|
|
16239
16467
|
},
|
|
16240
16468
|
"type_parameter": {
|
|
16241
|
-
"description": "Coin type of the CoinWrapper, e.g. '0x2::wow::WOW'. OPTIONAL: when omitted it is auto-derived from the CoinWrapper's own on-chain type (the inner T of `CoinWrapper<T>`), so {object, receive:true} alone unwraps to spendable coins. Only provide it explicitly when auto-derivation fails.",
|
|
16469
|
+
"description": "Coin type of the CoinWrapper, e.g. '0x2::wow::WOW'. OPTIONAL: when omitted it is auto-derived from the CoinWrapper's own on-chain type (the inner T of `CoinWrapper<T>`), so {object, receive:true} alone unwraps to spendable coins. Only provide it explicitly when auto-derivation fails. In AUTO-RECEIVE mode (no object) the type is always derived per-wrapper.",
|
|
16242
16470
|
"type": "string"
|
|
16243
16471
|
}
|
|
16244
16472
|
},
|
|
16245
16473
|
"required": [
|
|
16246
|
-
"object",
|
|
16247
16474
|
"receive"
|
|
16248
16475
|
],
|
|
16249
16476
|
"additionalProperties": false,
|
|
16250
|
-
"description": "Receive mode: unwrap a CoinWrapper to the caller's wallet. Use after Allocation's alloc_by_guard creates a Payment with your address as a revenue recipient. The CoinWrapper holds your share — call this to convert it to actual coins in your wallet."
|
|
16477
|
+
"description": "Receive mode: unwrap a CoinWrapper to the caller's wallet. Use after Allocation's alloc_by_guard creates a Payment with your address as a revenue recipient. The CoinWrapper holds your share — call this to convert it to actual coins in your wallet. Provide 'object' to unwrap a specific CoinWrapper, or OMIT it to auto-unwrap every CoinWrapper owned by the caller."
|
|
16251
16478
|
}
|
|
16252
16479
|
],
|
|
16253
|
-
"description": "On-chain Payment operations. TWO modes:\n(1) CREATE: Set 'object' with {name, type_parameter, ...}, 'revenue', and 'info' to create a new Payment.\n(2) RECEIVE: Set {
|
|
16480
|
+
"description": "On-chain Payment operations. TWO modes:\n(1) CREATE: Set 'object' with {name, type_parameter, ...}, 'revenue', and 'info' to create a new Payment.\n(2) RECEIVE: Set {receive: true} to unwrap CoinWrappers to your wallet. Provide 'object' (<coinwrapper_id_or_name>) to unwrap a specific one, or OMIT it to auto-unwrap every CoinWrapper owned by the caller. type_parameter optional — auto-derived from the CoinWrapper's type."
|
|
16254
16481
|
},
|
|
16255
16482
|
"env": {
|
|
16256
16483
|
"type": "object",
|
|
@@ -16702,6 +16929,14 @@
|
|
|
16702
16929
|
},
|
|
16703
16930
|
"content_raw": {
|
|
16704
16931
|
"description": "Raw content data"
|
|
16932
|
+
},
|
|
16933
|
+
"version": {
|
|
16934
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
16935
|
+
"type": "string"
|
|
16936
|
+
},
|
|
16937
|
+
"digest": {
|
|
16938
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
16939
|
+
"type": "string"
|
|
16705
16940
|
}
|
|
16706
16941
|
},
|
|
16707
16942
|
"required": [
|
|
@@ -16753,6 +16988,18 @@
|
|
|
16753
16988
|
"payment": {
|
|
16754
16989
|
"type": "string",
|
|
16755
16990
|
"description": "Payment object ID"
|
|
16991
|
+
},
|
|
16992
|
+
"type": {
|
|
16993
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
16994
|
+
"type": "string"
|
|
16995
|
+
},
|
|
16996
|
+
"version": {
|
|
16997
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
16998
|
+
"type": "string"
|
|
16999
|
+
},
|
|
17000
|
+
"digest": {
|
|
17001
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
17002
|
+
"type": "string"
|
|
16756
17003
|
}
|
|
16757
17004
|
},
|
|
16758
17005
|
"required": [
|
|
@@ -17585,6 +17832,14 @@
|
|
|
17585
17832
|
},
|
|
17586
17833
|
"content_raw": {
|
|
17587
17834
|
"description": "Raw content data"
|
|
17835
|
+
},
|
|
17836
|
+
"version": {
|
|
17837
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
17838
|
+
"type": "string"
|
|
17839
|
+
},
|
|
17840
|
+
"digest": {
|
|
17841
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
17842
|
+
"type": "string"
|
|
17588
17843
|
}
|
|
17589
17844
|
},
|
|
17590
17845
|
"required": [
|
|
@@ -17636,6 +17891,18 @@
|
|
|
17636
17891
|
"payment": {
|
|
17637
17892
|
"type": "string",
|
|
17638
17893
|
"description": "Payment object ID"
|
|
17894
|
+
},
|
|
17895
|
+
"type": {
|
|
17896
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
17897
|
+
"type": "string"
|
|
17898
|
+
},
|
|
17899
|
+
"version": {
|
|
17900
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
17901
|
+
"type": "string"
|
|
17902
|
+
},
|
|
17903
|
+
"digest": {
|
|
17904
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
17905
|
+
"type": "string"
|
|
17639
17906
|
}
|
|
17640
17907
|
},
|
|
17641
17908
|
"required": [
|
|
@@ -374,6 +374,18 @@
|
|
|
374
374
|
"payment": {
|
|
375
375
|
"type": "string",
|
|
376
376
|
"description": "Payment object ID"
|
|
377
|
+
},
|
|
378
|
+
"type": {
|
|
379
|
+
"description": "Type of the received object (or inner coin type); used for token_type detection",
|
|
380
|
+
"type": "string"
|
|
381
|
+
},
|
|
382
|
+
"version": {
|
|
383
|
+
"description": "Object version, required to build a Receiving<T> argument for owner_receive",
|
|
384
|
+
"type": "string"
|
|
385
|
+
},
|
|
386
|
+
"digest": {
|
|
387
|
+
"description": "Object digest, required to build a Receiving<T> argument for owner_receive",
|
|
388
|
+
"type": "string"
|
|
377
389
|
}
|
|
378
390
|
},
|
|
379
391
|
"required": [
|