@wowok/agent-mcp 3.3.0 → 3.3.2
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/chain-semantics/field-capability.js +1 -1
- package/dist/chain-semantics/freeze-map.js +1 -1
- package/dist/chain-semantics/fund-flow.js +1 -1
- package/dist/chain-semantics/guard-verbs.js +1 -1
- package/dist/chain-semantics/object-graph.js +1 -1
- package/dist/composition/audit.d.ts +5 -0
- package/dist/composition/audit.js +1 -1
- package/dist/composition/blueprint-view.d.ts +0 -1
- package/dist/composition/blueprint-view.js +1 -1
- package/dist/composition/compile.d.ts +4 -2
- package/dist/composition/compile.js +1 -1
- package/dist/composition/inflight.d.ts +8 -4
- package/dist/composition/inflight.js +1 -1
- package/dist/customer/industry-risks.js +1 -1
- package/dist/customer/user-preferences.js +1 -1
- package/dist/extensions/business-modules.d.ts +7 -2
- package/dist/extensions/business-modules.js +1 -1
- package/dist/extensions/industry-audit.spec.js +1 -1
- package/dist/extensions/industry-pack.d.ts +3 -2
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/graph/onchain/project-relationship.js +1 -1
- package/dist/knowledge/acquisition-flywheel.js +1 -1
- package/dist/knowledge/allocation-ledger.d.ts +4 -1
- package/dist/knowledge/allocation-ledger.js +1 -1
- package/dist/knowledge/allocation-puzzle.d.ts +1 -0
- package/dist/knowledge/allocation-puzzle.js +1 -1
- package/dist/knowledge/allocation-risk.d.ts +1 -1
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/arb-fund-facts.d.ts +5 -0
- package/dist/knowledge/arb-fund-facts.js +1 -1
- package/dist/knowledge/audit-rules.d.ts +4 -3
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/rules/plan.json +48 -2
- package/dist/knowledge/baselines/rules/reward.json +1 -1
- package/dist/knowledge/builtin-templates.d.ts +9 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/discount-threshold.js +1 -1
- package/dist/knowledge/guard-bindings.js +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-field-cognition.js +1 -1
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-submission-brief.d.ts +5 -0
- package/dist/knowledge/guard-submission-brief.js +1 -1
- package/dist/knowledge/guard-submission-prompt.d.ts +2 -1
- package/dist/knowledge/guard-submission-prompt.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +1 -1
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/industry-generalizer.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/industry-strategy.js +1 -1
- package/dist/knowledge/reward-ledger.js +1 -1
- package/dist/knowledge/reward-puzzle.d.ts +1 -1
- package/dist/knowledge/reward-risk.d.ts +1 -1
- package/dist/knowledge/scenario-modes.d.ts +2 -2
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/scenario-topology.js +1 -1
- package/dist/knowledge/strategy-manuals.js +1 -1
- package/dist/knowledge/template-index.d.ts +19 -0
- package/dist/knowledge/template-index.js +1 -0
- package/dist/knowledge/template-loader.d.ts +36 -0
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +7 -0
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/tool-constraints.js +1 -1
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/radar-core.d.ts +1 -0
- package/dist/participation/radar-core.js +1 -1
- package/dist/persona/defaults.js +1 -1
- package/dist/persona/topology-focus.js +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/game-theory.d.ts +4 -1
- package/dist/playbooks/service-build/game-theory.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +25 -1
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/migration-planner.js +1 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/pipeline-actions.d.ts +4 -1
- package/dist/playbooks/service-build/pipeline-actions.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +4 -0
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/service-quote.js +1 -1
- package/dist/relationship/derivation.d.ts +1 -1
- package/dist/review/index.js +1 -1
- package/dist/rules.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +35 -0
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/allocation.d.ts +46 -3
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/contact.js +1 -1
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/order.js +1 -1
- package/dist/schema/call/progress.d.ts +6 -3
- package/dist/schema/call/progress.js +1 -1
- package/dist/schema/call/repository.js +1 -1
- package/dist/schema/call/reward.d.ts +2 -2
- package/dist/schema/call/reward.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +8 -4
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/goal/index.d.ts +54 -0
- package/dist/schema/goal/planning.d.ts +86 -0
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/local/index.d.ts +39 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/operations.d.ts +20 -5
- package/dist/schema/operations.js +1 -1
- package/dist/schema/query/bi.d.ts +2 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +24 -12
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-version.d.ts +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/workspace/index.d.ts +9 -0
- package/dist/schema/workspace/index.js +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +28 -3
- package/dist/schemas/benchmark_migration_operation.schema.json +87 -0
- package/dist/schemas/goal_operation.schema.json +94 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/onchain_operations.output.json +1 -1
- package/dist/schemas/onchain_operations.schema.json +409 -119
- package/dist/schemas/onchain_operations_allocation.schema.json +290 -6
- package/dist/schemas/onchain_operations_arbitration.schema.json +2 -2
- package/dist/schemas/onchain_operations_contact.schema.json +2 -2
- package/dist/schemas/onchain_operations_demand.schema.json +3 -3
- package/dist/schemas/onchain_operations_gen_passport.schema.json +1 -1
- package/dist/schemas/onchain_operations_guard.schema.json +63 -63
- package/dist/schemas/onchain_operations_machine.schema.json +1 -1
- package/dist/schemas/onchain_operations_order.schema.json +2 -2
- package/dist/schemas/onchain_operations_progress.schema.json +7 -3
- package/dist/schemas/onchain_operations_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_repository.schema.json +2 -2
- package/dist/schemas/onchain_operations_reward.schema.json +8 -8
- package/dist/schemas/onchain_operations_service.schema.json +20 -18
- package/dist/schemas/onchain_operations_treasury.schema.json +7 -7
- package/dist/schemas/query_toolkit.output.json +67 -53
- package/dist/schemas/workflow_operation.schema.json +1 -1
- package/dist/schemas/workspace_operation.output.json +23 -3
- package/dist/schemas/workspace_operation.schema.json +3 -3
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/file-export.js +1 -1
- package/dist/tools/handlers/industry-pack.d.ts +1 -0
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/onchain.d.ts +24 -0
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/review-chain.d.ts +1 -1
- package/dist/tools/handlers/review-chain.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/handlers/workspace.js +1 -1
- package/dist/tools/registry/agent.js +1 -1
- package/dist/tools/registry/local.js +1 -1
- package/dist/tools/wip-deploy-assist.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as a424a from'@wowok/wowok';const SDK_SCHEMA_VERSION=a424a['SCHEMA_VERSION']??'1.0.0',checkSchemaCompatibility=a424a['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']}};}
|
|
@@ -103,6 +103,10 @@ export declare const WorkspaceOperationOutputSchema: z.ZodObject<{
|
|
|
103
103
|
}, z.core.$strip>>;
|
|
104
104
|
total_matches: z.ZodNumber;
|
|
105
105
|
truncated: z.ZodBoolean;
|
|
106
|
+
engine: z.ZodOptional<z.ZodEnum<{
|
|
107
|
+
ripgrep: "ripgrep";
|
|
108
|
+
js: "js";
|
|
109
|
+
}>>;
|
|
106
110
|
}, z.core.$strip>, z.ZodObject<{
|
|
107
111
|
action: z.ZodLiteral<"glob">;
|
|
108
112
|
pattern: z.ZodString;
|
|
@@ -113,6 +117,11 @@ export declare const WorkspaceOperationOutputSchema: z.ZodObject<{
|
|
|
113
117
|
mtime: z.ZodNumber;
|
|
114
118
|
}, z.core.$strip>>;
|
|
115
119
|
count: z.ZodNumber;
|
|
120
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
121
|
+
engine: z.ZodOptional<z.ZodEnum<{
|
|
122
|
+
ripgrep: "ripgrep";
|
|
123
|
+
js: "js";
|
|
124
|
+
}>>;
|
|
116
125
|
}, z.core.$strip>, z.ZodObject<{
|
|
117
126
|
action: z.ZodLiteral<"edit">;
|
|
118
127
|
path: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from'zod';export const WorkspaceOperationInputSchema=z['object']({'action':z['enum'](['resolve','list','read','write','delete','create_file','create_dir','copy','move','rename','search','glob','edit'])['describe']('Action:\x20\x27resolve\x27\x20=\x20return\x20the\x20workspace\x20root\x20directory;\x20\x27list\x27\x20=\x20list\x20files;\x20'+'\x27read\x27\x20=\x20read\x20a\x20file\x20(path\x20required);\x20\x27write\x27\x20=\x20write/overwrite\x20a\x20file\x20'+'(path\x20+\x20content\x20required);\x20\x27delete\x27\x20=\x20delete\x20a\x20file\x20or\x20directory\x20(path\x20required).\x20'+'\x27create_file\x27\x20=\x20create\x20an\x20empty\x20file\x20(path\x20required;\x20content\x20optional).\x20'+'\x27create_dir\x27\x20=\x20create\x20a\x20directory\x20recursively\x20(path\x20required).\x20'+'\x27copy\x27\x20=\x20copy\x20a\x20file\x20or\x20directory\x20(from\x20+\x20to\x20required).\x20'+'\x27move\x27\x20/\x20\x27rename\x27\x20=\x20move\x20or\x20rename\x20a\x20file\x20or\x20directory\x20(from\x20+\x20to\x20required).\x20'+'\x27search\x27\x20=\x20regex\x20content\x20search\x20across\x20workspace\x20files\x20(pattern\x20required).\x20'+'\x27glob\x27\x20=\x20list\x20files\x20whose\x20workspace-relative\x20path\x20matches\x20a\x20wildcard\x20pattern\x20(pattern\x20required).\x20'+'\x27edit\x27\x20=\x20exact\x20string\x20replacement\x20inside\x20a\x20file\x20(path\x20+\x20old_string\x20+\x20new_string\x20required).'),'path':z['string']()['optional']()['describe']('Path\x20relative\x20to\x20the\x20workspace\x20root\x20(required\x20for\x20read/write/delete/create_file/create_dir).'),'content':z['string']()['optional']()['describe']('File\x20content\x20(required\x20for\x20write;\x20optional\x20for\x20create_file).'),'from':z['string']()['optional']()['describe']('Source\x20path\x20relative\x20to\x20root\x20(required\x20for\x20copy/move/rename).'),'to':z['string']()['optional']()['describe']('Destination\x20path\x20relative\x20to\x20root\x20(required\x20for\x20copy/move/rename).'),'pattern':z['string']()['optional']()['describe']('search:\x20regular\x20expression\x20matched\x20against\x20every\x20file\x20line\x20(required\x20for\x20search).\x20'+'glob:\x20wildcard\x20pattern\x20matched\x20against\x20workspace-relative\x20paths\x20—\x20\x27**\x27\x20spans\x20directory\x20'+'segments,\x20\x27*\x27\x20stays\x20within\x20one\x20segment,\x20\x27?\x27\x20is\x20a\x20single\x20char\x20(e.g.\x20\x27**/*.json\x27,\x20\x27*.md\x27;\x20required\x20for\x20glob).'),'glob':z['string']()['optional']()['describe']('search\x20only:\x20optional\x20filename\x20wildcard\x20filter\x20matched\x20on\x20the\x20file\x20basename\x20(e.g.\x20\x27*.md\x27,\x20\x27*.{ts,tsx}\x27).'),'ignore_case':z['boolean']()['optional']()['describe']('search\x20only:\x20case-insensitive\x20pattern\x20matching\x20(default\x20false).'),'max_results':z['number']()['int']()['min'](0x1)['max'](0xc8)['optional']()['describe']('search\x20only:\x20maximum\x20matches\x20returned\x20(default\x2050,\x20hard\x20cap\x20200);\x20total_matches\x20still\x20counts\x20every\x20match.'),'context_lines':z['number']()['int']()['min'](0x0)['max'](0x5)['optional']()['describe']('search\x20only:\x20context\x20lines\x20included\x20before/after\x20each\x20match\x20(default\x202).'),'old_string':z['string']()['optional']()['describe']('edit\x20only:\x20exact\x20text\x20to\x20replace\x20(non-empty;\x20required\x20for\x20edit).'),'new_string':z['string']()['optional']()['describe']('edit\x20only:\x20replacement\x20text\x20(required\x20for\x20edit;\x20may\x20be\x20empty\x20to\x20delete).'),'replace_all':z['boolean']()['optional']()['describe']('edit\x20only:\x20replace\x20every\x20occurrence\x20of\x20old_string\x20(default\x20false\x20—\x20errors\x20when\x20old_string\x20is\x20not\x20unique).'),'offset':z['number']()['int']()['min'](0x1)['optional']()['describe']('read\x20only:\x201-based\x20line\x20number\x20to\x20start\x20from\x20(default\x201).'),'limit':z['number']()['int']()['min'](0x1)['max'](0x7d0)['optional']()['describe']('read\x20only:\x20maximum\x20lines\x20to\x20return\x20(default\x20and\x20hard\x20cap\x202000;\x20only\x20applied\x20when\x20offset\x20or\x20limit\x20is\x20given).'),'encoding':z['enum'](['text','base64'])['optional']()['describe']('read:\x20\x27text\x27\x20(default,\x20utf-8)\x20or\x20\x27base64\x27\x20(raw\x20bytes,\x20files\x20up\x20to\x2010MB).\x20'+'write/create_file:\x20\x27text\x27\x20(default,\x20utf-8)\x20or\x20\x27base64\x27\x20(content\x20is\x20base64-encoded\x20raw\x20bytes,\x20e.g.\x20binary\x20files).')})['strict']();export const WorkspaceOperationOutputSchema=z['object']({'result':z['discriminatedUnion']('action',[z['object']({'action':z['literal']('resolve'),'dir':z['string']()['describe']('Absolute\x20workspace\x20root\x20directory.')}),z['object']({'action':z['literal']('list'),'dir':z['string']()['describe']('Absolute\x20workspace\x20root\x20directory.'),'files':z['array'](z['object']({'path':z['string']()['describe']('Path\x20relative\x20to\x20the\x20workspace\x20root.'),'is_dir':z['boolean'](),'size':z['number']()['describe']('File\x20size\x20in\x20bytes\x20(0\x20for\x20directories).'),'mtime':z['number']()['describe']('Last-modified\x20time\x20(epoch\x20ms).')}))['describe']('Files\x20under\x20the\x20workspace\x20root.')}),z['object']({'action':z['literal']('read'),'path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20read\x20file.'),'content':z['string']()['describe']('File\x20content\x20(text,\x20possibly\x20sliced\x20by\x20offset/limit;\x20base64\x20when\x20encoding=\x27base64\x27).'),'encoding':z['enum'](['text','base64'])['optional']()['describe']('\x27base64\x27\x20when\x20raw\x20bytes\x20are\x20returned;\x20absent/undefined\x20for\x20text.'),'size':z['number']()['optional']()['describe']('File\x20size\x20in\x20bytes\x20(base64\x20reads\x20only).'),'total_lines':z['number']()['optional']()['describe']('Total\x20line\x20count\x20of\x20the\x20file\x20(text\x20reads\x20only).'),'offset':z['number']()['optional']()['describe']('1-based\x20start\x20line\x20of\x20the\x20returned\x20slice\x20(text\x20reads\x20only).'),'limit':z['number']()['optional']()['describe']('Max\x20lines\x20in\x20the\x20returned\x20slice\x20(text\x20reads\x20only).'),'truncated':z['boolean']()['optional']()['describe']('True\x20when\x20lines\x20were\x20cut\x20off\x20by\x20offset/limit\x20(text\x20reads\x20only).')}),z['object']({'action':z['literal']('write'),'path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20written\x20file.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('delete'),'path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20deleted\x20file.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('create_file'),'path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20created\x20file.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('create_dir'),'path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20created\x20directory.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('copy'),'from':z['string']()['describe']('Absolute\x20source\x20path.'),'to':z['string']()['describe']('Absolute\x20destination\x20path.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('move'),'from':z['string']()['describe']('Absolute\x20source\x20path.'),'to':z['string']()['describe']('Absolute\x20destination\x20path.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('rename'),'from':z['string']()['describe']('Absolute\x20old\x20path.'),'to':z['string']()['describe']('Absolute\x20new\x20path.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('search'),'pattern':z['string']()['describe']('The\x20regex\x20pattern\x20that\x20was\x20searched.'),'matches':z['array'](z['object']({'path':z['string']()['describe']('Workspace-relative\x20file\x20path.'),'line':z['number']()['describe']('1-based\x20line\x20number\x20of\x20the\x20match.'),'text':z['string']()['describe']('The\x20matched\x20line.'),'before':z['array'](z['string']())['optional']()['describe']('Context\x20lines\x20before\x20the\x20match.'),'after':z['array'](z['string']())['optional']()['describe']('Context\x20lines\x20after\x20the\x20match.')}))['describe']('Matches\x20(at\x20most\x20max_results).'),'total_matches':z['number']()['describe']('Total\x20number\x20of\x20matches\x20found\x20across\x20all\x20scanned\x20files.'),'truncated':z['boolean']()['describe']('True\x20when\x20matches\x20were\x20cut\x20off\x20by\x20max_results.')}),z['object']({'action':z['literal']('glob'),'pattern':z['string']()['describe']('The\x20wildcard\x20pattern\x20that\x20was\x20matched.'),'files':z['array'](z['object']({'path':z['string']()['describe']('Path\x20relative\x20to\x20the\x20workspace\x20root.'),'is_dir':z['boolean'](),'size':z['number']()['describe']('File\x20size\x20in\x20bytes\x20(0\x20for\x20directories).'),'mtime':z['number']()['describe']('Last-modified\x20time\x20(epoch\x20ms).')}))['describe']('Files\x20whose\x20workspace-relative\x20path\x20matches\x20the\x20pattern.'),'count':z['number']()['describe']('Number\x20of\x20matching\x20files.')}),z['object']({'action':z['literal']('edit'),'path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20edited\x20file.'),'replacements':z['number']()['describe']('Number\x20of\x20replacements\x20performed.'),'ok':z['boolean']()})])})['strict']();
|
|
1
|
+
import{z}from'zod';export const WorkspaceOperationInputSchema=z['object']({'action':z['enum'](['resolve','list','read','write','delete','create_file','create_dir','copy','move','rename','search','glob','edit'])['describe']('Action:\x20\x27resolve\x27\x20=\x20return\x20the\x20workspace\x20root\x20directory;\x20\x27list\x27\x20=\x20list\x20files;\x20'+'\x27read\x27\x20=\x20read\x20a\x20file\x20(path\x20required);\x20\x27write\x27\x20=\x20write/overwrite\x20a\x20file\x20'+'(path\x20+\x20content\x20required);\x20\x27delete\x27\x20=\x20delete\x20a\x20file\x20or\x20directory\x20(path\x20required).\x20'+'\x27create_file\x27\x20=\x20create\x20an\x20empty\x20file\x20(path\x20required;\x20content\x20optional).\x20'+'\x27create_dir\x27\x20=\x20create\x20a\x20directory\x20recursively\x20(path\x20required).\x20'+'\x27copy\x27\x20=\x20copy\x20a\x20file\x20or\x20directory\x20(from\x20+\x20to\x20required).\x20'+'\x27move\x27\x20/\x20\x27rename\x27\x20=\x20move\x20or\x20rename\x20a\x20file\x20or\x20directory\x20(from\x20+\x20to\x20required).\x20'+'\x27search\x27\x20=\x20regex\x20content\x20search\x20across\x20workspace\x20files\x20(pattern\x20required).\x20'+'\x27glob\x27\x20=\x20list\x20files\x20by\x20wildcard\x20name\x20/\x20path\x20pattern\x20(pattern\x20required).\x20'+'\x27edit\x27\x20=\x20exact\x20string\x20replacement\x20inside\x20a\x20file\x20(path\x20+\x20old_string\x20+\x20new_string\x20required).'),'path':z['string']()['optional']()['describe']('Path\x20relative\x20to\x20the\x20workspace\x20root\x20(required\x20for\x20read/write/delete/create_file/create_dir).'),'content':z['string']()['optional']()['describe']('File\x20content\x20(required\x20for\x20write;\x20optional\x20for\x20create_file).'),'from':z['string']()['optional']()['describe']('Source\x20path\x20relative\x20to\x20root\x20(required\x20for\x20copy/move/rename).'),'to':z['string']()['optional']()['describe']('Destination\x20path\x20relative\x20to\x20root\x20(required\x20for\x20copy/move/rename).'),'pattern':z['string']()['optional']()['describe']('search:\x20regular\x20expression\x20matched\x20against\x20every\x20file\x20line\x20(required\x20for\x20search).\x20Runs\x20on\x20the\x20bundled\x20ripgrep\x20engine,\x20so\x20no\x20lookaround\x20or\x20backreferences;\x20such\x20patterns\x20fall\x20back\x20to\x20a\x20JavaScript\x20scan.\x20'+'glob:\x20wildcard\x20pattern\x20matched\x20against\x20file\x20names\x20—\x20\x27*\x27\x20stays\x20within\x20one\x20path\x20'+'segment,\x20\x27?\x27\x20is\x20a\x20single\x20char,\x20\x27**/\x27\x20spans\x20directories.\x20A\x20pattern\x20without\x20\x27/\x27\x20'+'matches\x20the\x20BASENAME\x20at\x20any\x20depth\x20(\x27*.json\x27,\x20\x27readme*\x27);\x20one\x20containing\x20\x27/\x27\x20is\x20'+'anchored\x20to\x20the\x20search\x20scope\x20—\x20the\x20\x27path\x27\x20directory,\x20or\x20the\x20workspace\x20root\x20when\x20'+'\x27path\x27\x20is\x20absent\x20—\x20and\x20a\x20leading\x20\x27/\x27\x20states\x20that\x20anchor\x20explicitly\x20'+'(required\x20for\x20glob).'),'glob':z['string']()['optional']()['describe']('search\x20only:\x20optional\x20filename\x20filter,\x20ripgrep\x20--glob\x20syntax\x20—\x20\x27*.md\x27\x20matches\x20at\x20any\x20depth,\x20\x27src/*.md\x27\x20is\x20anchored\x20to\x20the\x20search\x20scope,\x20a\x20leading\x20\x27!\x27\x20negates.'),'ignore_case':z['boolean']()['optional']()['describe']('search\x20only:\x20case-insensitive\x20pattern\x20matching\x20(default\x20false).'),'max_results':z['number']()['int']()['min'](0x1)['max'](0xc8)['optional']()['describe']('search\x20only:\x20maximum\x20matches\x20returned\x20(default\x2050,\x20hard\x20cap\x20200);\x20total_matches\x20still\x20counts\x20every\x20match.'),'context_lines':z['number']()['int']()['min'](0x0)['max'](0x5)['optional']()['describe']('search\x20only:\x20context\x20lines\x20included\x20before/after\x20each\x20match\x20(default\x202).'),'old_string':z['string']()['optional']()['describe']('edit\x20only:\x20exact\x20text\x20to\x20replace\x20(non-empty;\x20required\x20for\x20edit).'),'new_string':z['string']()['optional']()['describe']('edit\x20only:\x20replacement\x20text\x20(required\x20for\x20edit;\x20may\x20be\x20empty\x20to\x20delete).'),'replace_all':z['boolean']()['optional']()['describe']('edit\x20only:\x20replace\x20every\x20occurrence\x20of\x20old_string\x20(default\x20false\x20—\x20errors\x20when\x20old_string\x20is\x20not\x20unique).'),'offset':z['number']()['int']()['min'](0x1)['optional']()['describe']('read\x20only:\x201-based\x20line\x20number\x20to\x20start\x20from\x20(default\x201).'),'limit':z['number']()['int']()['min'](0x1)['max'](0x7d0)['optional']()['describe']('read\x20only:\x20maximum\x20lines\x20to\x20return\x20(default\x20and\x20hard\x20cap\x202000;\x20only\x20applied\x20when\x20offset\x20or\x20limit\x20is\x20given).'),'encoding':z['enum'](['text','base64'])['optional']()['describe']('read:\x20\x27text\x27\x20(default,\x20utf-8)\x20or\x20\x27base64\x27\x20(raw\x20bytes,\x20files\x20up\x20to\x2010MB).\x20'+'write/create_file:\x20\x27text\x27\x20(default,\x20utf-8)\x20or\x20\x27base64\x27\x20(content\x20is\x20base64-encoded\x20raw\x20bytes,\x20e.g.\x20binary\x20files).')})['strict']();export const WorkspaceOperationOutputSchema=z['object']({'result':z['discriminatedUnion']('action',[z['object']({'action':z['literal']('resolve'),'dir':z['string']()['describe']('Absolute\x20workspace\x20root\x20directory.')}),z['object']({'action':z['literal']('list'),'dir':z['string']()['describe']('Absolute\x20workspace\x20root\x20directory.'),'files':z['array'](z['object']({'path':z['string']()['describe']('Path\x20relative\x20to\x20the\x20workspace\x20root.'),'is_dir':z['boolean'](),'size':z['number']()['describe']('File\x20size\x20in\x20bytes\x20(0\x20for\x20directories).'),'mtime':z['number']()['describe']('Last-modified\x20time\x20(epoch\x20ms).')}))['describe']('Files\x20under\x20the\x20workspace\x20root.')}),z['object']({'action':z['literal']('read'),'path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20read\x20file.'),'content':z['string']()['describe']('File\x20content\x20(text,\x20possibly\x20sliced\x20by\x20offset/limit;\x20base64\x20when\x20encoding=\x27base64\x27).'),'encoding':z['enum'](['text','base64'])['optional']()['describe']('\x27base64\x27\x20when\x20raw\x20bytes\x20are\x20returned;\x20absent/undefined\x20for\x20text.'),'size':z['number']()['optional']()['describe']('File\x20size\x20in\x20bytes\x20(base64\x20reads\x20only).'),'total_lines':z['number']()['optional']()['describe']('Total\x20line\x20count\x20of\x20the\x20file\x20(text\x20reads\x20only).'),'offset':z['number']()['optional']()['describe']('1-based\x20start\x20line\x20of\x20the\x20returned\x20slice\x20(text\x20reads\x20only).'),'limit':z['number']()['optional']()['describe']('Max\x20lines\x20in\x20the\x20returned\x20slice\x20(text\x20reads\x20only).'),'truncated':z['boolean']()['optional']()['describe']('True\x20when\x20lines\x20were\x20cut\x20off\x20by\x20offset/limit\x20(text\x20reads\x20only).')}),z['object']({'action':z['literal']('write'),'path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20written\x20file.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('delete'),'path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20deleted\x20file.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('create_file'),'path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20created\x20file.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('create_dir'),'path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20created\x20directory.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('copy'),'from':z['string']()['describe']('Absolute\x20source\x20path.'),'to':z['string']()['describe']('Absolute\x20destination\x20path.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('move'),'from':z['string']()['describe']('Absolute\x20source\x20path.'),'to':z['string']()['describe']('Absolute\x20destination\x20path.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('rename'),'from':z['string']()['describe']('Absolute\x20old\x20path.'),'to':z['string']()['describe']('Absolute\x20new\x20path.'),'ok':z['boolean']()}),z['object']({'action':z['literal']('search'),'pattern':z['string']()['describe']('The\x20regex\x20pattern\x20that\x20was\x20searched.'),'matches':z['array'](z['object']({'path':z['string']()['describe']('Workspace-relative\x20file\x20path.'),'line':z['number']()['describe']('1-based\x20line\x20number\x20of\x20the\x20match.'),'text':z['string']()['describe']('The\x20matched\x20line.'),'before':z['array'](z['string']())['optional']()['describe']('Context\x20lines\x20before\x20the\x20match.'),'after':z['array'](z['string']())['optional']()['describe']('Context\x20lines\x20after\x20the\x20match.')}))['describe']('Matches\x20(at\x20most\x20max_results).'),'total_matches':z['number']()['describe']('Total\x20number\x20of\x20matches\x20found\x20across\x20all\x20scanned\x20files.'),'truncated':z['boolean']()['describe']('True\x20when\x20matches\x20were\x20cut\x20off\x20by\x20max_results,\x20the\x20scan\x20budget\x20or\x20the\x20timeout.'),'engine':z['enum'](['ripgrep','js'])['optional']()['describe']('Which\x20scanner\x20answered:\x20\x27ripgrep\x27\x20(bundled\x20binary)\x20or\x20\x27js\x27\x20(in-process\x20fallback\x20—\x20ripgrep\x20absent,\x20or\x20a\x20pattern\x20its\x20regex\x20engine\x20rejects).')}),z['object']({'action':z['literal']('glob'),'pattern':z['string']()['describe']('The\x20wildcard\x20pattern\x20that\x20was\x20matched.'),'files':z['array'](z['object']({'path':z['string']()['describe']('Path\x20relative\x20to\x20the\x20workspace\x20root.'),'is_dir':z['boolean'](),'size':z['number']()['describe']('File\x20size\x20in\x20bytes\x20(0\x20for\x20directories).'),'mtime':z['number']()['describe']('Last-modified\x20time\x20(epoch\x20ms).')}))['describe']('Files\x20matching\x20the\x20pattern,\x20at\x20most\x201000.'),'count':z['number']()['describe']('Number\x20of\x20files\x20returned\x20(at\x20most\x201000).'),'truncated':z['boolean']()['optional']()['describe']('True\x20when\x20more\x20files\x20matched\x20than\x20the\x201000-file\x20cap,\x20or\x20the\x20listing\x20was\x20cut\x20short.'),'engine':z['enum'](['ripgrep','js'])['optional']()['describe']('Which\x20scanner\x20answered:\x20\x27ripgrep\x27\x20(bundled\x20binary)\x20or\x20\x27js\x27\x20(in-process\x20fallback).')}),z['object']({'action':z['literal']('edit'),'path':z['string']()['describe']('Absolute\x20path\x20of\x20the\x20edited\x20file.'),'replacements':z['number']()['describe']('Number\x20of\x20replacements\x20performed.'),'ok':z['boolean']()})])})['strict']();
|
|
@@ -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 a435a,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=a435a(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 a436a,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=a436a(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};
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
"additionalProperties": false
|
|
178
178
|
},
|
|
179
179
|
"transfer": {
|
|
180
|
-
"description": "Result of token transfer transaction",
|
|
180
|
+
"description": "Result of token transfer transaction, annotated with the network it executed on and where that network came from",
|
|
181
181
|
"type": "object",
|
|
182
182
|
"properties": {
|
|
183
183
|
"balanceChanges": {
|
|
@@ -2206,6 +2206,23 @@
|
|
|
2206
2206
|
"type": "null"
|
|
2207
2207
|
}
|
|
2208
2208
|
]
|
|
2209
|
+
},
|
|
2210
|
+
"network": {
|
|
2211
|
+
"description": "Chain the transfer transaction executed on, echoed back by the MCP layer so a same-session caller can detect a silently wrong chain (the session default network can change between calls).",
|
|
2212
|
+
"type": "string",
|
|
2213
|
+
"enum": [
|
|
2214
|
+
"localnet",
|
|
2215
|
+
"testnet",
|
|
2216
|
+
"mainnet"
|
|
2217
|
+
]
|
|
2218
|
+
},
|
|
2219
|
+
"network_source": {
|
|
2220
|
+
"description": "Where the echoed network came from: 'request' = the call's explicit transfer.network input; 'session_default' = the SDK session default was used (no transfer.network in the request).",
|
|
2221
|
+
"type": "string",
|
|
2222
|
+
"enum": [
|
|
2223
|
+
"request",
|
|
2224
|
+
"session_default"
|
|
2225
|
+
]
|
|
2209
2226
|
}
|
|
2210
2227
|
},
|
|
2211
2228
|
"required": [
|
|
@@ -2249,13 +2266,21 @@
|
|
|
2249
2266
|
"type": "string"
|
|
2250
2267
|
},
|
|
2251
2268
|
"network": {
|
|
2269
|
+
"description": "Chain the coin-production transaction executed on, annotated by the MCP layer with the RESOLVED network so a same-session caller can detect a silently wrong chain (the SDK alone echoes only the raw input, which is undefined when omitted).",
|
|
2252
2270
|
"type": "string",
|
|
2253
2271
|
"enum": [
|
|
2254
2272
|
"localnet",
|
|
2255
2273
|
"testnet",
|
|
2256
2274
|
"mainnet"
|
|
2257
|
-
]
|
|
2258
|
-
|
|
2275
|
+
]
|
|
2276
|
+
},
|
|
2277
|
+
"network_source": {
|
|
2278
|
+
"description": "Where the echoed network came from: 'request' = the call's explicit get.network input; 'session_default' = the SDK session default was used (no get.network in the request).",
|
|
2279
|
+
"type": "string",
|
|
2280
|
+
"enum": [
|
|
2281
|
+
"request",
|
|
2282
|
+
"session_default"
|
|
2283
|
+
]
|
|
2259
2284
|
}
|
|
2260
2285
|
},
|
|
2261
2286
|
"required": [
|
|
@@ -158,6 +158,93 @@
|
|
|
158
158
|
"description": "Review reward pool funding, smallest-unit string. Required by template_generate/migration_apply when the effective review mode is review_reward (INV-4: the incentive must be funded at build time).",
|
|
159
159
|
"type": "string"
|
|
160
160
|
},
|
|
161
|
+
"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).",
|
|
163
|
+
"type": "string",
|
|
164
|
+
"enum": [
|
|
165
|
+
"return",
|
|
166
|
+
"exchange",
|
|
167
|
+
"warranty",
|
|
168
|
+
"none"
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
"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).",
|
|
173
|
+
"type": "string",
|
|
174
|
+
"enum": [
|
|
175
|
+
"milestone",
|
|
176
|
+
"contest",
|
|
177
|
+
"bounty",
|
|
178
|
+
"agent",
|
|
179
|
+
"none"
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
"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).",
|
|
184
|
+
"type": "string",
|
|
185
|
+
"enum": [
|
|
186
|
+
"deposit_balance",
|
|
187
|
+
"milestone_n",
|
|
188
|
+
"none"
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
"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).",
|
|
193
|
+
"type": "string",
|
|
194
|
+
"enum": [
|
|
195
|
+
"commission",
|
|
196
|
+
"none"
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
"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).",
|
|
201
|
+
"type": "string",
|
|
202
|
+
"enum": [
|
|
203
|
+
"threshold",
|
|
204
|
+
"flexible",
|
|
205
|
+
"none"
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
"sales": {
|
|
209
|
+
"description": "The sellable SKU catalog (upwc-cat-261017 CAT-A1 / PLAN-SALES-01). Absent/empty = the plan ships no sales step, the published Service freezes with sales: [] and every order_new aborts — a HIGH audit blocker. Item shape follows the chain's SaleItem: { name, price, quantity?, wip_hash? } with price in smallest units. OPTIONAL per item: a structured `incentive` object (G-07: { amount, conditions, basis, claim_window }, all strings) declaring the buyer-perceivable reward terms — carried verbatim into the compiled plan's service_sales step for quote-time disclosure; it is plan metadata only and never an on-chain SaleItem field.",
|
|
210
|
+
"type": "array",
|
|
211
|
+
"items": {
|
|
212
|
+
"type": "object",
|
|
213
|
+
"properties": {
|
|
214
|
+
"incentive": {
|
|
215
|
+
"type": "object",
|
|
216
|
+
"properties": {
|
|
217
|
+
"amount": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"description": "Incentive amount as a buyer-readable string (e.g. \"5 USDC\" or \"1000000000 WOW smallest units\"). Quote-time disclosure only — fund the actual rail separately (e.g. the template's review_reward_pool)."
|
|
220
|
+
},
|
|
221
|
+
"conditions": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"description": "What the buyer must do to earn it (e.g. \"leave a written + rated review of the delivered work\"). Must be perceptible BEFORE the order is placed."
|
|
224
|
+
},
|
|
225
|
+
"basis": {
|
|
226
|
+
"type": "string",
|
|
227
|
+
"description": "Accrual scope: \"per-order\" / \"once-per-buyer\" / \"once-per-buyer-per-order\". Matches the claim guard's replay semantics — a recipient-only gate is once-per-buyer-for-life, an order-scoped stamp is per-order (SV-2)."
|
|
228
|
+
},
|
|
229
|
+
"claim_window": {
|
|
230
|
+
"type": "string",
|
|
231
|
+
"description": "How long the buyer has to claim (e.g. \"14 days from the review\"). Mirror the reward claim guard's window fee_param so the quote never promises more than the rail pays."
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
"required": [
|
|
235
|
+
"amount",
|
|
236
|
+
"conditions",
|
|
237
|
+
"basis",
|
|
238
|
+
"claim_window"
|
|
239
|
+
],
|
|
240
|
+
"additionalProperties": false,
|
|
241
|
+
"description": "Optional structured incentive for one sale item (G-07): buyer-perceivable reward terms carried to the compiled plan for quote-time disclosure. DECLARATION ONLY — the chain SaleItem has no such field; the actual payout rail is configured separately."
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"additionalProperties": {},
|
|
245
|
+
"description": "One sellable SKU in the plan catalog: the chain SaleItem fields plus the optional structured `incentive` declaration (G-07). Unknown keys pass through so chain-side fields can evolve without schema changes."
|
|
246
|
+
}
|
|
247
|
+
},
|
|
161
248
|
"log": {
|
|
162
249
|
"description": "A prior MigrationLog (required for migration_review).",
|
|
163
250
|
"type": "object",
|
|
@@ -1136,6 +1136,53 @@
|
|
|
1136
1136
|
"reward_funding": {
|
|
1137
1137
|
"description": "Review reward pool funding, smallest-unit string (required when the effective review mode is review_reward).",
|
|
1138
1138
|
"type": "string"
|
|
1139
|
+
},
|
|
1140
|
+
"after_sales_mode": {
|
|
1141
|
+
"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).",
|
|
1142
|
+
"type": "string",
|
|
1143
|
+
"enum": [
|
|
1144
|
+
"return",
|
|
1145
|
+
"exchange",
|
|
1146
|
+
"warranty",
|
|
1147
|
+
"none"
|
|
1148
|
+
]
|
|
1149
|
+
},
|
|
1150
|
+
"acceptance_mode": {
|
|
1151
|
+
"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).",
|
|
1152
|
+
"type": "string",
|
|
1153
|
+
"enum": [
|
|
1154
|
+
"milestone",
|
|
1155
|
+
"contest",
|
|
1156
|
+
"bounty",
|
|
1157
|
+
"agent",
|
|
1158
|
+
"none"
|
|
1159
|
+
]
|
|
1160
|
+
},
|
|
1161
|
+
"installment_mode": {
|
|
1162
|
+
"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).",
|
|
1163
|
+
"type": "string",
|
|
1164
|
+
"enum": [
|
|
1165
|
+
"deposit_balance",
|
|
1166
|
+
"milestone_n",
|
|
1167
|
+
"none"
|
|
1168
|
+
]
|
|
1169
|
+
},
|
|
1170
|
+
"affiliate_mode": {
|
|
1171
|
+
"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).",
|
|
1172
|
+
"type": "string",
|
|
1173
|
+
"enum": [
|
|
1174
|
+
"commission",
|
|
1175
|
+
"none"
|
|
1176
|
+
]
|
|
1177
|
+
},
|
|
1178
|
+
"crowdfunding_mode": {
|
|
1179
|
+
"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).",
|
|
1180
|
+
"type": "string",
|
|
1181
|
+
"enum": [
|
|
1182
|
+
"threshold",
|
|
1183
|
+
"flexible",
|
|
1184
|
+
"none"
|
|
1185
|
+
]
|
|
1139
1186
|
}
|
|
1140
1187
|
},
|
|
1141
1188
|
"required": [
|
|
@@ -1289,6 +1336,53 @@
|
|
|
1289
1336
|
"reward_funding": {
|
|
1290
1337
|
"description": "Step 6 confirmation: review reward pool funding, smallest-unit string (required when the effective review mode is review_reward).",
|
|
1291
1338
|
"type": "string"
|
|
1339
|
+
},
|
|
1340
|
+
"after_sales_mode": {
|
|
1341
|
+
"description": "Step 6 confirmation: per-build after-sales mode (D12 重构 4). Absent = the template's declared after_sales_mode applies.",
|
|
1342
|
+
"type": "string",
|
|
1343
|
+
"enum": [
|
|
1344
|
+
"return",
|
|
1345
|
+
"exchange",
|
|
1346
|
+
"warranty",
|
|
1347
|
+
"none"
|
|
1348
|
+
]
|
|
1349
|
+
},
|
|
1350
|
+
"acceptance_mode": {
|
|
1351
|
+
"description": "Step 6 confirmation: per-build acceptance/judging mode (D12 重构 2). Absent = the template's declared acceptance_mode applies.",
|
|
1352
|
+
"type": "string",
|
|
1353
|
+
"enum": [
|
|
1354
|
+
"milestone",
|
|
1355
|
+
"contest",
|
|
1356
|
+
"bounty",
|
|
1357
|
+
"agent",
|
|
1358
|
+
"none"
|
|
1359
|
+
]
|
|
1360
|
+
},
|
|
1361
|
+
"installment_mode": {
|
|
1362
|
+
"description": "Step 6 confirmation: per-build installment/deposit mode (D12 重构 3). Absent = the template's declared installment_mode applies.",
|
|
1363
|
+
"type": "string",
|
|
1364
|
+
"enum": [
|
|
1365
|
+
"deposit_balance",
|
|
1366
|
+
"milestone_n",
|
|
1367
|
+
"none"
|
|
1368
|
+
]
|
|
1369
|
+
},
|
|
1370
|
+
"affiliate_mode": {
|
|
1371
|
+
"description": "Step 6 confirmation: per-build affiliate commission overlay (D12 批 5). Absent = the template's declared affiliate_mode applies.",
|
|
1372
|
+
"type": "string",
|
|
1373
|
+
"enum": [
|
|
1374
|
+
"commission",
|
|
1375
|
+
"none"
|
|
1376
|
+
]
|
|
1377
|
+
},
|
|
1378
|
+
"crowdfunding_mode": {
|
|
1379
|
+
"description": "Step 6 confirmation: per-build crowdfunding campaign overlay (D12 批 7). Absent = the template's declared crowdfunding_mode applies.",
|
|
1380
|
+
"type": "string",
|
|
1381
|
+
"enum": [
|
|
1382
|
+
"threshold",
|
|
1383
|
+
"flexible",
|
|
1384
|
+
"none"
|
|
1385
|
+
]
|
|
1292
1386
|
}
|
|
1293
1387
|
},
|
|
1294
1388
|
"additionalProperties": false
|
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-10-
|
|
5
|
+
"generatedAt": "2026-10-21T08:54:30.902Z",
|
|
6
6
|
"tools": [
|
|
7
7
|
{
|
|
8
8
|
"name": "onchain_operations",
|
|
@@ -3797,7 +3797,7 @@
|
|
|
3797
3797
|
"type": "integer",
|
|
3798
3798
|
"minimum": 0,
|
|
3799
3799
|
"maximum": 255,
|
|
3800
|
-
"description": "Identifier (0-255) for data lookup in Guard table. Slot consensus (enforced on-chain at guard table construction): 0-220 = user slots (free for business guards); 221-253 = PROTOCOL-RESERVED (rejected on-chain — reserved so future protocol features get fixed slots without colliding with published guards); 255 = ONCE replay-protection slot on Allocation (byte-keyed, the submitted bytes are the once-key — use for per-period keys like period-<N>); 254 = ONCE-FOR-OBJECT slot on Allocation (chain-derived key = bcs(the Allocation's payment_info.for_object); the submitted bytes are ignored and the submission only arms the slot — use for one-shot per-order rails such as full refunds)."
|
|
3800
|
+
"description": "Identifier (0-255) for data lookup in Guard table. Slot consensus (enforced on-chain at guard table construction): 0-220 = user slots (free for business guards); 221-253 = PROTOCOL-RESERVED (rejected on-chain — reserved so future protocol features get fixed slots without colliding with published guards); 255 = ONCE replay-protection slot on Allocation (byte-keyed, the submitted bytes are the once-key — use for per-period keys like period-<N>); 254 = ONCE-FOR-OBJECT slot on Allocation (chain-derived key = bcs(the Allocation's payment_info.for_object); the submitted bytes are ignored and the submission only arms the slot — use for one-shot per-order rails such as full refunds). SLOT 0 SEMANTICS (protocol 154): slot 0 carries the transacted Order address by convention. As a submission slot it is legal on order/allocation/machine rails (the order exists when those verify), but FORBIDDEN on a Service buy_guard — the order does not exist when the buy-time passport is verified, so the mount is refused (service abort 43)."
|
|
3801
3801
|
},
|
|
3802
3802
|
"b_submission": {
|
|
3803
3803
|
"type": "boolean",
|