@wowok/agent-mcp 3.1.4 → 3.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/evaluation/arbitration-game.js +1 -1
- package/dist/evaluation/builtins/graph-service.js +1 -1
- package/dist/graph/onchain/analyze.js +1 -1
- package/dist/graph/onchain/analyze.spec.js +1 -1
- package/dist/graph/onchain/extract.js +1 -1
- package/dist/graph/onchain/facts.d.ts +1 -0
- package/dist/graph/onchain/facts.js +1 -1
- package/dist/graph/onchain/fixtures.js +1 -1
- package/dist/graph/onchain/onchain.spec.js +1 -1
- package/dist/graph/onchain/strategy.js +1 -1
- package/dist/graph/onchain/strategy.spec.js +1 -1
- package/dist/harness/recover.js +1 -1
- package/dist/knowledge/alloc-audit-policy.spec.js +1 -1
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/arbitration-ledger.js +1 -1
- package/dist/knowledge/audit-rules.d.ts +1 -0
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/rules/alloc_audit.json +20 -0
- package/dist/knowledge/baselines/rules/allocation.json +1 -19
- package/dist/knowledge/baselines/rules/arb.json +1 -1
- package/dist/knowledge/baselines/rules/guard.json +8 -8
- package/dist/knowledge/fund-layer.js +1 -1
- package/dist/knowledge/guard-design-patterns.d.ts +2 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-design-patterns.spec.d.ts +1 -0
- package/dist/knowledge/guard-design-patterns.spec.js +1 -0
- package/dist/knowledge/guard-lint.d.ts +1 -1
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-puzzle.js +1 -1
- package/dist/knowledge/guard-render.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-translation.js +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/permission-ledger.js +1 -1
- package/dist/knowledge/recipient-constraint.js +1 -1
- package/dist/knowledge/safety-rules.extract-amount.spec.d.ts +1 -0
- package/dist/knowledge/safety-rules.extract-amount.spec.js +1 -0
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/tool-constraints.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/pipeline-actions.d.ts +1 -1
- package/dist/playbooks/service-build/pipeline-actions.js +1 -1
- package/dist/playbooks/service-build/risk-aggregator.js +1 -1
- package/dist/role/derivation.d.ts +1 -1
- package/dist/role/derivation.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/call/allocation.d.ts +7 -0
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/arbitration.d.ts +4 -0
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +48 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +26 -0
- package/dist/schema/call/contact.d.ts +4 -0
- package/dist/schema/call/demand.d.ts +4 -0
- package/dist/schema/call/error-codes.d.ts +1 -1
- package/dist/schema/call/error-codes.js +1 -1
- package/dist/schema/call/guard.d.ts +12 -0
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +8 -0
- package/dist/schema/call/order.d.ts +4 -0
- package/dist/schema/call/order.js +1 -1
- package/dist/schema/call/payment.d.ts +4 -0
- package/dist/schema/call/permission.d.ts +4 -0
- package/dist/schema/call/personal.d.ts +4 -0
- package/dist/schema/call/progress.d.ts +4 -0
- package/dist/schema/call/proof.d.ts +8 -0
- package/dist/schema/call/repository.d.ts +4 -0
- package/dist/schema/call/repository.js +1 -1
- package/dist/schema/call/reward.d.ts +4 -0
- package/dist/schema/call/semantic-customer-advice.spec.js +1 -1
- package/dist/schema/call/semantic.d.ts +11 -0
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +14 -0
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/call/treasury.d.ts +4 -0
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/keeper/index.d.ts +5 -0
- package/dist/schema/local/index.d.ts +28 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +5 -0
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +83 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +16 -0
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/workflow/index.d.ts +2 -0
- package/dist/schema/workflow/index.js +1 -1
- package/dist/schema/workspace/index.d.ts +53 -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 +25 -1
- package/dist/schemas/bridge_operation.output.json +25 -1
- package/dist/schemas/bridge_operation.schema.json +40 -0
- package/dist/schemas/guard2file.schema.json +8 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/keeper_operation.output.json +24 -1
- package/dist/schemas/local_history_operation.output.json +25 -1
- package/dist/schemas/local_info_operation.output.json +25 -1
- package/dist/schemas/local_mark_operation.output.json +25 -1
- package/dist/schemas/machineNode2file.schema.json +8 -0
- package/dist/schemas/messenger_operation.output.json +24 -1
- package/dist/schemas/messenger_operation.schema.json +2 -2
- package/dist/schemas/monitor_events.output.json +24 -1
- package/dist/schemas/monitor_subscription.output.json +24 -1
- package/dist/schemas/onchain_events.output.json +24 -1
- package/dist/schemas/onchain_operations.output.json +73 -3
- package/dist/schemas/onchain_operations.schema.json +3286 -821
- package/dist/schemas/onchain_operations_allocation.schema.json +12 -0
- package/dist/schemas/onchain_operations_arbitration.schema.json +18 -10
- package/dist/schemas/onchain_operations_contact.schema.json +8 -0
- package/dist/schemas/onchain_operations_demand.schema.json +8 -0
- package/dist/schemas/onchain_operations_gen_passport.schema.json +8 -0
- package/dist/schemas/onchain_operations_gen_proof.schema.json +8 -0
- package/dist/schemas/onchain_operations_guard.schema.json +2896 -596
- package/dist/schemas/onchain_operations_machine.schema.json +8 -0
- package/dist/schemas/onchain_operations_order.schema.json +10 -2
- package/dist/schemas/onchain_operations_payment.schema.json +8 -0
- package/dist/schemas/onchain_operations_permission.schema.json +8 -0
- package/dist/schemas/onchain_operations_personal.schema.json +8 -0
- package/dist/schemas/onchain_operations_progress.schema.json +8 -0
- package/dist/schemas/onchain_operations_proof.schema.json +8 -0
- package/dist/schemas/onchain_operations_repository.schema.json +14 -6
- package/dist/schemas/onchain_operations_reward.schema.json +8 -0
- package/dist/schemas/onchain_operations_service.schema.json +43 -10
- package/dist/schemas/onchain_operations_treasury.schema.json +8 -0
- package/dist/schemas/onchain_table_data.output.json +35 -12
- package/dist/schemas/query_toolkit.output.json +1179 -10
- package/dist/schemas/query_toolkit.schema.json +11 -11
- package/dist/schemas/workflow_operation.schema.json +8 -0
- package/dist/schemas/workspace_operation.output.json +181 -1
- package/dist/schemas/workspace_operation.schema.json +61 -2
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/dispatch-expectations.js +1 -1
- package/dist/tools/handlers/dispatch-expectations.spec.d.ts +1 -0
- package/dist/tools/handlers/dispatch-expectations.spec.js +1 -0
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/handlers/workspace.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/move-fn-index.gen.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as a396a from'@wowok/wowok';const SDK_SCHEMA_VERSION=a396a['SCHEMA_VERSION']??'1.0.0',checkSchemaCompatibility=a396a['checkSchemaCompatibility']??((a,b)=>({'compatible':!![]}));export const MCP_SCHEMA_VERSION='1.0.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']}};}
|
|
@@ -162,6 +162,8 @@ export declare const WorkflowOperationInputSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
162
162
|
}, z.core.$strict>>;
|
|
163
163
|
}, z.core.$strict>>;
|
|
164
164
|
}, z.core.$strict>>;
|
|
165
|
+
confirmed: z.ZodOptional<z.ZodBoolean>;
|
|
166
|
+
dry_run: z.ZodOptional<z.ZodBoolean>;
|
|
165
167
|
network: z.ZodOptional<z.ZodEnum<{
|
|
166
168
|
testnet: import("@wowok/wowok").ENTRYPOINT.Testnet;
|
|
167
169
|
localnet: import("@wowok/wowok").ENTRYPOINT.Localnet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from'zod';import{EntrypointSchema,NameOrAddressSchema}from'../common/index.js';import{SubmissionCallSchema}from'../call/base.js';export const WorkflowOperateOpSchema=z['enum'](['next','hold','unhold','adminUnhold'])['describe']('Forward\x20operation:\x20\x27next\x27\x20=\x20accomplish\x20the\x20forward;\x20\x27hold\x27\x20=\x20block\x20the\x20forward;\x20'+'\x27unhold\x27\x20=\x20release\x20own\x20hold;\x20\x27adminUnhold\x27\x20=\x20force-release\x20via\x20permission\x20224.');export const WorkflowAccountSchema=z['object']({'address':z['string']()['describe']('Local\x20account\x20address'),'name':z['string']()['optional']()['describe']('Local\x20account\x20name\x20(if\x20any)')})['describe']('A\x20local\x20account\x20that\x20can\x20execute\x20a\x20forward');export const WorkflowForwardViewSchema=z['object']({'next_node':z['string']()['describe']('Target\x20node\x20this\x20forward\x20advances\x20INTO'),'forward':z['string']()['describe']('Forward\x20(operation)\x20name'),'weight':z['number']()['describe']('Forward\x20weight\x20contributed\x20toward\x20the\x20pair\x20threshold'),'threshold':z['number']()['describe']('Pair\x20threshold\x20the\x20forward\x20contributes\x20to'),'guard':z['string']()['optional']()['describe']('Guard\x20bound\x20to\x20this\x20forward\x20—\x20must\x20be\x20verified\x20(passport)\x20before\x20the\x20transition'),'guard_submissions':z['array'](z['object']({'identifier':z['number'](),'name':z['string']()['describe']('Human-readable\x20field\x20name'),'value_type':z['string']()['describe']('Expected\x20value\x20type\x20(Address,\x20U64,\x20String,\x20VecAddress,\x20...)'),'object_type':z['string']()['optional']()['describe']('When\x20value_type\x20is\x20an\x20object\x20address\x20—\x20the\x20expected\x20object\x20type\x20(e.g.\x20Order)')}))['optional']()['describe']('Guard\x20submission\x20fields\x20the\x20user\x20must\x20fill\x20to\x20advance\x20this\x20forward\x20(from\x20the\x20guard\x27s\x20b_submission\x20table\x20items)'),'operator_kind':z['enum'](['order_holder','named_operator','permission_index'])['describe']('How\x20this\x20forward\x27s\x20operator\x20is\x20resolved'),'permission_index':z['number']()['optional']()['describe']('Permission\x20index\x20when\x20operator_kind\x20is\x20\x27permission_index\x27'),'named_operator':z['string']()['optional']()['describe']('NamedOperator\x20namespace\x20when\x20operator_kind\x20is\x20\x27named_operator\x27'),'executable_accounts':z['array'](WorkflowAccountSchema)['describe']('LOCAL\x20accounts\x20that\x20can\x20execute\x20this\x20forward\x20(may\x20be\x20empty\x20—\x20then\x20no\x20local\x20account\x20is\x20authorized)')})['describe']('A\x20reachable\x20forward\x20with\x20its\x20permission\x20+\x20guard\x20+\x20executable\x20local\x20accounts');export const WorkflowTaskSchema=z['object']({'progress':z['string']()['describe']('Progress\x20object\x20address'),'progress_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20progress\x20(local\x20account/mark\x20name,\x20when\x20resolved)'),'current':z['string']()['describe']('Current\x20node\x20of\x20the\x20Progress\x20(\x27\x27\x20=\x20initial)'),'machine':z['string']()['describe']('Machine\x20object\x20address'),'machine_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20machine\x20object\x20(when\x20resolved)'),'task':z['string']()['nullable']()['describe']('Bound\x20task\x20(Order)\x20address,\x20or\x20null'),'task_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20bound\x20Order\x20(when\x20resolved)'),'service':z['string']()['optional']()['describe']('Service\x20address\x20(resolved\x20via\x20the\x20bound\x20Order,\x20if\x20any)'),'service_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20Service\x20object\x20(when\x20resolved)'),'context_repositories':z['array'](z['object']({'address':z['string']()['describe']('Context\x20repository\x20address'),'name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20repository\x20(when\x20resolved)')}))['optional']()['describe']('Context\x20repositories\x20bound\x20to\x20the\x20Progress\x20(zero\x20or\x20more)'),'options':z['array'](WorkflowForwardViewSchema)['describe']('ALL\x20reachable\x20next-node\x20forwards\x20with\x20permission\x20+\x20guard\x20+\x20executable\x20accounts\x20(may\x20be\x20empty\x20for\x20a\x20completed/terminal\x20progress)'),'terminal':z['boolean']()['describe']('True\x20when\x20the\x20current\x20node\x20has\x20no\x20outgoing\x20forwards\x20(workflow\x20is\x20stuck\x20or\x20finished)'),'actionable':z['boolean']()['describe']('True\x20when\x20at\x20least\x20one\x20LOCAL\x20account\x20can\x20execute\x20a\x20forward\x20right\x20now;\x20false\x20for\x20progress\x20that\x20is\x20merely\x20related\x20(e.g.\x20already\x20completed)'),'history_count':z['number']()['optional']()['describe']('On-chain\x20Progress.history\x20length\x20(append-only)\x20—\x200\x20when\x20no\x20migrations\x20yet'),'current_time':z['number']()['optional']()['describe']('Chain\x20clock\x20(ms)\x20when\x20the\x20current\x20node\x20was\x20entered\x20(Progress.current_time)\x20—\x20for\x20elapsed-dwell\x20display')})['describe']('A\x20progress\x20object\x20related\x20to\x20a\x20local\x20account:\x20actionable\x20(a\x20local\x20account\x20can\x20act\x20on\x20it)\x20or\x20related\x20(order\x20holder\x20/\x20named\x20operator\x20/\x20session\x20operator\x20involvement\x20—\x20viewable\x20history)');export const WorkflowOperationInputSchema=z['discriminatedUnion']('action',[z['object']({'action':z['literal']('list'),'limit':z['number']()['int']()['min'](0x1)['max'](0x64)['optional']()['describe']('Max\x20progress\x20entries\x20to\x20return,\x20actionable\x20first\x20(default\x2050)'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()}),z['object']({'action':z['literal']('operate'),'progress':NameOrAddressSchema['describe']('Progress\x20object\x20(name\x20or\x20address)\x20to\x20operate\x20on'),'account':z['string']()['optional']()['describe']('Signing\x20account\x20(name\x20or\x20address).\x20Defaults\x20to\x20the\x20first\x20executable\x20local\x20account.'),'operate':z['object']({'operation':z['object']({'next_node_name':z['string']()['describe']('Target\x20node\x20name'),'forward':z['string']()['describe']('Forward\x20name')})['strict'](),'op':WorkflowOperateOpSchema,'message':z['string']()['optional']()['describe']('Optional\x20human-readable\x20message\x20recorded\x20on-chain')})['strict']()['describe']('⚠️\x20SINGLE-OPERATOR\x20LOCK:\x20each\x20forward\x20is\x20locked\x20by\x20the\x20FIRST\x20operator\x20that\x20accomplishes\x20it\x20—\x20a\x20different\x20account\x20'+'re-executing\x20the\x20same\x20accomplished\x20forward\x20aborts\x20E_NOT_THE_HOLDER,\x20and\x20the\x20weight\x20is\x20counted\x20only\x20once.\x20'+'Multi-operator\x20cooperation\x20(threshold\x20>\x201)\x20is\x20done\x20via\x20DISTINCT\x20forwards\x20(one\x20per\x20contributor).\x20The\x20workflow\x20'+'\x27list\x27\x20action\x20already\x20hides\x20accomplished\x20forwards\x20and\x20restricts\x20held\x20forwards\x20to\x20their\x20holder.'),'submission':SubmissionCallSchema['optional']()['describe']('Guard\x20submissions\x20for\x20guarded\x20forwards\x20(forward.guard_submissions\x20in\x20the\x20list\x20describes\x20each\x20required\x20field).\x20'+'Fill\x20`submission:\x20[{\x20guard:\x20\x27<guard>\x27,\x20submission:\x20[{\x20identifier,\x20b_submission:\x20true,\x20value_type,\x20value\x20}]\x20}]`\x20'+'with\x20the\x20value\x20the\x20user\x20entered\x20for\x20each\x20b_submission\x20field.'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()}),z['object']({'action':z['literal']('task'),'progress':NameOrAddressSchema['describe']('Progress\x20object\x20(name\x20or\x20address)\x20to\x20snapshot'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()}),z['object']({'action':z['literal']('history'),'progress':NameOrAddressSchema['describe']('Progress\x20object\x20(name\x20or\x20address)\x20whose\x20history\x20to\x20sync\x20and\x20view'),'limit':z['number']()['int']()['min'](0x1)['max'](0x1f4)['optional']()['describe']('Max\x20history\x20records\x20to\x20return,\x20newest\x20first\x20(default\x2050)'),'prune':z['boolean']()['optional']()['describe']('Run\x20the\x2090-day\x20retention\x20cleanup\x20of\x20stale\x20progress\x20histories\x20(default\x20true)'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()})])['describe']('workflow_operation\x20input.\x20action=\x27list\x27\x20enumerates\x20progress\x20related\x20to\x20local\x20accounts\x20(actionable\x20first,\x20'+'plus\x20completed/related\x20progress\x20with\x20viewable\x20history);\x20'+'action=\x27task\x27\x20builds\x20the\x20SAME\x20snapshot\x20for\x20ONE\x20progress\x20(options\x20may\x20carry\x20empty\x20executable_accounts\x20—\x20the\x20client\x20grays\x20the\x20actions);\x20'+'action=\x27operate\x27\x20advances/holds/unholds\x20a\x20forward\x20as\x20a\x20chosen\x20local\x20account;\x20'+'action=\x27history\x27\x20incrementally\x20syncs\x20+\x20returns\x20a\x20progress\x27s\x20on-chain\x20history.');export const WorkflowHistoryForwardSchema=z['object']({'forward':z['string']()['describe']('Forward\x20(operation)\x20name'),'who':z['string']()['nullable']()['describe']('Operator\x20address\x20that\x20performed\x20the\x20forward\x20(null\x20=\x20not\x20yet\x20held)'),'who_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20operator\x20(account\x20name,\x20else\x20LocalMark)'),'msg':z['string']()['describe']('Message\x20recorded\x20with\x20the\x20forward'),'accomplished':z['boolean']()['describe']('Whether\x20the\x20forward\x20was\x20accomplished'),'weight':z['number']()['optional']()['describe']('Forward\x20weight\x20(from\x20the\x20machine\x20config;\x20the\x20chain\x20Holder\x20snapshot\x20stores\x20no\x20per-forward\x20weight)'),'time':z['number']()['describe']('Last\x20operation\x20time\x20(on-chain\x20clock\x20ms)'),'retained_submission':z['array'](z['object']({'identifier':z['number'](),'value_type':z['number'](),'value':z['unknown'](),'display_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20first\x20address-typed\x20value\x20(when\x20resolved)')}))['optional']()['describe']('Retained\x20Guard\x20submission\x20entries')})['describe']('One\x20forward\x20execution\x20inside\x20a\x20session\x20snapshot');export const WorkflowHistorySessionSchema=z['object']({'next_node':z['string']()['describe']('Session\x20target\x20node\x20(the\x20not-yet-migrated\x20direction)'),'weights':z['number']()['describe']('Accumulated\x20forward\x20weight\x20at\x20migration\x20time'),'threshold':z['number']()['describe']('Threshold\x20required\x20to\x20complete\x20the\x20pair'),'forwards':z['array'](WorkflowHistoryForwardSchema)['describe']('Forward\x20executions\x20in\x20this\x20session')})['describe']('Session\x20snapshot\x20captured\x20at\x20migration\x20time');export const WorkflowHistoryRecordSchema=z['object']({'index':z['number']()['describe']('On-chain\x20history\x20index\x20(0-based,\x20append-only)'),'node':z['string']()['describe']('Node\x20migrated\x20FROM'),'next_node':z['string']()['describe']('Node\x20migrated\x20TO'),'time':z['number']()['describe']('Migration\x20time\x20(on-chain\x20clock\x20ms)'),'session':z['array'](WorkflowHistorySessionSchema)['describe']('Full\x20session\x20snapshot\x20at\x20migration')})['describe']('One\x20on-chain\x20Progress\x20history\x20record\x20(a\x20completed\x20migration)');export const WorkflowHistoryViewSchema=z['object']({'progress':z['string']()['describe']('Progress\x20object\x20address'),'current':z['string']()['optional']()['describe']('Current\x20node\x20as\x20of\x20this\x20sync'),'records':z['array'](WorkflowHistoryRecordSchema)['describe']('History\x20records,\x20newest\x20first'),'synced':z['number']()['describe']('Number\x20of\x20records\x20newly\x20synced\x20in\x20this\x20call'),'cursor':z['number']()['describe']('Last\x20synced\x20history\x20index\x20(0-based;\x20-1\x20=\x20none\x20yet)'),'pruned':z['number']()['describe']('Progress\x20entries\x20cleaned\x20by\x20the\x2090-day\x20retention\x20in\x20this\x20call')})['describe']('A\x20progress\x27s\x20synced\x20on-chain\x20history');export const WorkflowOperationResultSchema=z['object']({'action':z['enum'](['list','task','operate','history']),'tasks':z['array'](WorkflowTaskSchema)['optional']()['describe']('Present\x20for\x20action=\x27list\x27\x20and\x20action=\x27task\x27\x20(a\x20one-element\x20array\x20—\x20the\x20same\x20snapshot\x20shape\x20as\x20a\x20list\x20item,\x20built\x20for\x20the\x20requested\x20progress\x20regardless\x20of\x20local-account\x20relation;\x20executable_accounts\x20may\x20be\x20empty\x20when\x20no\x20local\x20account\x20is\x20authorized)'),'operate':z['unknown']()['optional']()['describe']('Present\x20for\x20action=\x27operate\x27\x20(the\x20underlying\x20progress\x20operation\x20result)'),'history':WorkflowHistoryViewSchema['optional']()['describe']('Present\x20for\x20action=\x27history\x27'),'note':z['string']()['optional']()})['describe']('workflow_operation\x20result');export const WorkflowOperationOutputSchema=z['object']({'result':WorkflowOperationResultSchema})['describe']('workflow_operation\x20output\x20envelope');
|
|
1
|
+
import{z}from'zod';import{EntrypointSchema,NameOrAddressSchema}from'../common/index.js';import{SubmissionCallSchema}from'../call/base.js';export const WorkflowOperateOpSchema=z['enum'](['next','hold','unhold','adminUnhold'])['describe']('Forward\x20operation:\x20\x27next\x27\x20=\x20accomplish\x20the\x20forward;\x20\x27hold\x27\x20=\x20block\x20the\x20forward;\x20'+'\x27unhold\x27\x20=\x20release\x20own\x20hold;\x20\x27adminUnhold\x27\x20=\x20force-release\x20via\x20permission\x20224.');export const WorkflowAccountSchema=z['object']({'address':z['string']()['describe']('Local\x20account\x20address'),'name':z['string']()['optional']()['describe']('Local\x20account\x20name\x20(if\x20any)')})['describe']('A\x20local\x20account\x20that\x20can\x20execute\x20a\x20forward');export const WorkflowForwardViewSchema=z['object']({'next_node':z['string']()['describe']('Target\x20node\x20this\x20forward\x20advances\x20INTO'),'forward':z['string']()['describe']('Forward\x20(operation)\x20name'),'weight':z['number']()['describe']('Forward\x20weight\x20contributed\x20toward\x20the\x20pair\x20threshold'),'threshold':z['number']()['describe']('Pair\x20threshold\x20the\x20forward\x20contributes\x20to'),'guard':z['string']()['optional']()['describe']('Guard\x20bound\x20to\x20this\x20forward\x20—\x20must\x20be\x20verified\x20(passport)\x20before\x20the\x20transition'),'guard_submissions':z['array'](z['object']({'identifier':z['number'](),'name':z['string']()['describe']('Human-readable\x20field\x20name'),'value_type':z['string']()['describe']('Expected\x20value\x20type\x20(Address,\x20U64,\x20String,\x20VecAddress,\x20...)'),'object_type':z['string']()['optional']()['describe']('When\x20value_type\x20is\x20an\x20object\x20address\x20—\x20the\x20expected\x20object\x20type\x20(e.g.\x20Order)')}))['optional']()['describe']('Guard\x20submission\x20fields\x20the\x20user\x20must\x20fill\x20to\x20advance\x20this\x20forward\x20(from\x20the\x20guard\x27s\x20b_submission\x20table\x20items)'),'operator_kind':z['enum'](['order_holder','named_operator','permission_index'])['describe']('How\x20this\x20forward\x27s\x20operator\x20is\x20resolved'),'permission_index':z['number']()['optional']()['describe']('Permission\x20index\x20when\x20operator_kind\x20is\x20\x27permission_index\x27'),'named_operator':z['string']()['optional']()['describe']('NamedOperator\x20namespace\x20when\x20operator_kind\x20is\x20\x27named_operator\x27'),'executable_accounts':z['array'](WorkflowAccountSchema)['describe']('LOCAL\x20accounts\x20that\x20can\x20execute\x20this\x20forward\x20(may\x20be\x20empty\x20—\x20then\x20no\x20local\x20account\x20is\x20authorized)')})['describe']('A\x20reachable\x20forward\x20with\x20its\x20permission\x20+\x20guard\x20+\x20executable\x20local\x20accounts');export const WorkflowTaskSchema=z['object']({'progress':z['string']()['describe']('Progress\x20object\x20address'),'progress_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20progress\x20(local\x20account/mark\x20name,\x20when\x20resolved)'),'current':z['string']()['describe']('Current\x20node\x20of\x20the\x20Progress\x20(\x27\x27\x20=\x20initial)'),'machine':z['string']()['describe']('Machine\x20object\x20address'),'machine_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20machine\x20object\x20(when\x20resolved)'),'task':z['string']()['nullable']()['describe']('Bound\x20task\x20(Order)\x20address,\x20or\x20null'),'task_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20bound\x20Order\x20(when\x20resolved)'),'service':z['string']()['optional']()['describe']('Service\x20address\x20(resolved\x20via\x20the\x20bound\x20Order,\x20if\x20any)'),'service_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20Service\x20object\x20(when\x20resolved)'),'context_repositories':z['array'](z['object']({'address':z['string']()['describe']('Context\x20repository\x20address'),'name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20repository\x20(when\x20resolved)')}))['optional']()['describe']('Context\x20repositories\x20bound\x20to\x20the\x20Progress\x20(zero\x20or\x20more)'),'options':z['array'](WorkflowForwardViewSchema)['describe']('ALL\x20reachable\x20next-node\x20forwards\x20with\x20permission\x20+\x20guard\x20+\x20executable\x20accounts\x20(may\x20be\x20empty\x20for\x20a\x20completed/terminal\x20progress)'),'terminal':z['boolean']()['describe']('True\x20when\x20the\x20current\x20node\x20has\x20no\x20outgoing\x20forwards\x20(workflow\x20is\x20stuck\x20or\x20finished)'),'actionable':z['boolean']()['describe']('True\x20when\x20at\x20least\x20one\x20LOCAL\x20account\x20can\x20execute\x20a\x20forward\x20right\x20now;\x20false\x20for\x20progress\x20that\x20is\x20merely\x20related\x20(e.g.\x20already\x20completed)'),'history_count':z['number']()['optional']()['describe']('On-chain\x20Progress.history\x20length\x20(append-only)\x20—\x200\x20when\x20no\x20migrations\x20yet'),'current_time':z['number']()['optional']()['describe']('Chain\x20clock\x20(ms)\x20when\x20the\x20current\x20node\x20was\x20entered\x20(Progress.current_time)\x20—\x20for\x20elapsed-dwell\x20display')})['describe']('A\x20progress\x20object\x20related\x20to\x20a\x20local\x20account:\x20actionable\x20(a\x20local\x20account\x20can\x20act\x20on\x20it)\x20or\x20related\x20(order\x20holder\x20/\x20named\x20operator\x20/\x20session\x20operator\x20involvement\x20—\x20viewable\x20history)');export const WorkflowOperationInputSchema=z['discriminatedUnion']('action',[z['object']({'action':z['literal']('list'),'limit':z['number']()['int']()['min'](0x1)['max'](0x64)['optional']()['describe']('Max\x20progress\x20entries\x20to\x20return,\x20actionable\x20first\x20(default\x2050)'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()}),z['object']({'action':z['literal']('operate'),'progress':NameOrAddressSchema['describe']('Progress\x20object\x20(name\x20or\x20address)\x20to\x20operate\x20on'),'account':z['string']()['optional']()['describe']('Signing\x20account\x20(name\x20or\x20address).\x20Defaults\x20to\x20the\x20first\x20executable\x20local\x20account.'),'operate':z['object']({'operation':z['object']({'next_node_name':z['string']()['describe']('Target\x20node\x20name'),'forward':z['string']()['describe']('Forward\x20name')})['strict'](),'op':WorkflowOperateOpSchema,'message':z['string']()['optional']()['describe']('Optional\x20human-readable\x20message\x20recorded\x20on-chain')})['strict']()['describe']('⚠️\x20SINGLE-OPERATOR\x20LOCK:\x20each\x20forward\x20is\x20locked\x20by\x20the\x20FIRST\x20operator\x20that\x20accomplishes\x20it\x20—\x20a\x20different\x20account\x20'+'re-executing\x20the\x20same\x20accomplished\x20forward\x20aborts\x20E_NOT_THE_HOLDER,\x20and\x20the\x20weight\x20is\x20counted\x20only\x20once.\x20'+'Multi-operator\x20cooperation\x20(threshold\x20>\x201)\x20is\x20done\x20via\x20DISTINCT\x20forwards\x20(one\x20per\x20contributor).\x20The\x20workflow\x20'+'\x27list\x27\x20action\x20already\x20hides\x20accomplished\x20forwards\x20and\x20restricts\x20held\x20forwards\x20to\x20their\x20holder.'),'submission':SubmissionCallSchema['optional']()['describe']('Guard\x20submissions\x20for\x20guarded\x20forwards\x20(forward.guard_submissions\x20in\x20the\x20list\x20describes\x20each\x20required\x20field).\x20'+'Fill\x20`submission:\x20[{\x20guard:\x20\x27<guard>\x27,\x20submission:\x20[{\x20identifier,\x20b_submission:\x20true,\x20value_type,\x20value\x20}]\x20}]`\x20'+'with\x20the\x20value\x20the\x20user\x20entered\x20for\x20each\x20b_submission\x20field.'),'confirmed':z['boolean']()['optional']()['describe']('Phase\x202\x20ConfirmGate:\x20set\x20to\x20true\x20to\x20proceed\x20after\x20a\x20\x27pending_confirmation\x27\x20result\x20(required\x20when\x20submitting\x20guard\x20submission\x20data).\x20The\x20operation\x20is\x20NOT\x20executed\x20until\x20you\x20re-call\x20with\x20confirmed=true\x20after\x20user\x20consent.'),'dry_run':z['boolean']()['optional']()['describe']('Phase\x201\x20dry_run:\x20when\x20true,\x20SIMULATE\x20the\x20transaction\x20without\x20signing\x20or\x20submitting.\x20Returns\x20effects\x20+\x20events\x20showing\x20what\x20WOULD\x20happen\x20—\x20no\x20on-chain\x20state\x20is\x20modified,\x20no\x20gas\x20is\x20charged.\x20Use\x20this\x20to\x20verify\x20that\x20a\x20forward\x20(especially\x20a\x20guarded\x20one)\x20will\x20succeed\x20before\x20committing.'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()}),z['object']({'action':z['literal']('task'),'progress':NameOrAddressSchema['describe']('Progress\x20object\x20(name\x20or\x20address)\x20to\x20snapshot'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()}),z['object']({'action':z['literal']('history'),'progress':NameOrAddressSchema['describe']('Progress\x20object\x20(name\x20or\x20address)\x20whose\x20history\x20to\x20sync\x20and\x20view'),'limit':z['number']()['int']()['min'](0x1)['max'](0x1f4)['optional']()['describe']('Max\x20history\x20records\x20to\x20return,\x20newest\x20first\x20(default\x2050)'),'prune':z['boolean']()['optional']()['describe']('Run\x20the\x2090-day\x20retention\x20cleanup\x20of\x20stale\x20progress\x20histories\x20(default\x20true)'),'network':EntrypointSchema['optional'](),'no_cache':z['boolean']()['optional']()})])['describe']('workflow_operation\x20input.\x20action=\x27list\x27\x20enumerates\x20progress\x20related\x20to\x20local\x20accounts\x20(actionable\x20first,\x20'+'plus\x20completed/related\x20progress\x20with\x20viewable\x20history);\x20'+'action=\x27task\x27\x20builds\x20the\x20SAME\x20snapshot\x20for\x20ONE\x20progress\x20(options\x20may\x20carry\x20empty\x20executable_accounts\x20—\x20the\x20client\x20grays\x20the\x20actions);\x20'+'action=\x27operate\x27\x20advances/holds/unholds\x20a\x20forward\x20as\x20a\x20chosen\x20local\x20account;\x20'+'action=\x27history\x27\x20incrementally\x20syncs\x20+\x20returns\x20a\x20progress\x27s\x20on-chain\x20history.');export const WorkflowHistoryForwardSchema=z['object']({'forward':z['string']()['describe']('Forward\x20(operation)\x20name'),'who':z['string']()['nullable']()['describe']('Operator\x20address\x20that\x20performed\x20the\x20forward\x20(null\x20=\x20not\x20yet\x20held)'),'who_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20operator\x20(account\x20name,\x20else\x20LocalMark)'),'msg':z['string']()['describe']('Message\x20recorded\x20with\x20the\x20forward'),'accomplished':z['boolean']()['describe']('Whether\x20the\x20forward\x20was\x20accomplished'),'weight':z['number']()['optional']()['describe']('Forward\x20weight\x20(from\x20the\x20machine\x20config;\x20the\x20chain\x20Holder\x20snapshot\x20stores\x20no\x20per-forward\x20weight)'),'time':z['number']()['describe']('Last\x20operation\x20time\x20(on-chain\x20clock\x20ms)'),'retained_submission':z['array'](z['object']({'identifier':z['number'](),'value_type':z['number'](),'value':z['unknown'](),'display_name':z['string']()['optional']()['describe']('Display\x20name\x20for\x20the\x20first\x20address-typed\x20value\x20(when\x20resolved)')}))['optional']()['describe']('Retained\x20Guard\x20submission\x20entries')})['describe']('One\x20forward\x20execution\x20inside\x20a\x20session\x20snapshot');export const WorkflowHistorySessionSchema=z['object']({'next_node':z['string']()['describe']('Session\x20target\x20node\x20(the\x20not-yet-migrated\x20direction)'),'weights':z['number']()['describe']('Accumulated\x20forward\x20weight\x20at\x20migration\x20time'),'threshold':z['number']()['describe']('Threshold\x20required\x20to\x20complete\x20the\x20pair'),'forwards':z['array'](WorkflowHistoryForwardSchema)['describe']('Forward\x20executions\x20in\x20this\x20session')})['describe']('Session\x20snapshot\x20captured\x20at\x20migration\x20time');export const WorkflowHistoryRecordSchema=z['object']({'index':z['number']()['describe']('On-chain\x20history\x20index\x20(0-based,\x20append-only)'),'node':z['string']()['describe']('Node\x20migrated\x20FROM'),'next_node':z['string']()['describe']('Node\x20migrated\x20TO'),'time':z['number']()['describe']('Migration\x20time\x20(on-chain\x20clock\x20ms)'),'session':z['array'](WorkflowHistorySessionSchema)['describe']('Full\x20session\x20snapshot\x20at\x20migration')})['describe']('One\x20on-chain\x20Progress\x20history\x20record\x20(a\x20completed\x20migration)');export const WorkflowHistoryViewSchema=z['object']({'progress':z['string']()['describe']('Progress\x20object\x20address'),'current':z['string']()['optional']()['describe']('Current\x20node\x20as\x20of\x20this\x20sync'),'records':z['array'](WorkflowHistoryRecordSchema)['describe']('History\x20records,\x20newest\x20first'),'synced':z['number']()['describe']('Number\x20of\x20records\x20newly\x20synced\x20in\x20this\x20call'),'cursor':z['number']()['describe']('Last\x20synced\x20history\x20index\x20(0-based;\x20-1\x20=\x20none\x20yet)'),'pruned':z['number']()['describe']('Progress\x20entries\x20cleaned\x20by\x20the\x2090-day\x20retention\x20in\x20this\x20call')})['describe']('A\x20progress\x27s\x20synced\x20on-chain\x20history');export const WorkflowOperationResultSchema=z['object']({'action':z['enum'](['list','task','operate','history']),'tasks':z['array'](WorkflowTaskSchema)['optional']()['describe']('Present\x20for\x20action=\x27list\x27\x20and\x20action=\x27task\x27\x20(a\x20one-element\x20array\x20—\x20the\x20same\x20snapshot\x20shape\x20as\x20a\x20list\x20item,\x20built\x20for\x20the\x20requested\x20progress\x20regardless\x20of\x20local-account\x20relation;\x20executable_accounts\x20may\x20be\x20empty\x20when\x20no\x20local\x20account\x20is\x20authorized)'),'operate':z['unknown']()['optional']()['describe']('Present\x20for\x20action=\x27operate\x27\x20(the\x20underlying\x20progress\x20operation\x20result)'),'history':WorkflowHistoryViewSchema['optional']()['describe']('Present\x20for\x20action=\x27history\x27'),'note':z['string']()['optional']()})['describe']('workflow_operation\x20result');export const WorkflowOperationOutputSchema=z['object']({'result':WorkflowOperationResultSchema})['describe']('workflow_operation\x20output\x20envelope');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const WorkspaceOperationInputSchema: z.ZodObject<{
|
|
3
3
|
action: z.ZodEnum<{
|
|
4
|
+
search: "search";
|
|
4
5
|
rename: "rename";
|
|
5
6
|
list: "list";
|
|
6
7
|
read: "read";
|
|
@@ -11,11 +12,27 @@ export declare const WorkspaceOperationInputSchema: z.ZodObject<{
|
|
|
11
12
|
create_dir: "create_dir";
|
|
12
13
|
move: "move";
|
|
13
14
|
write: "write";
|
|
15
|
+
glob: "glob";
|
|
16
|
+
edit: "edit";
|
|
14
17
|
}>;
|
|
15
18
|
path: z.ZodOptional<z.ZodString>;
|
|
16
19
|
content: z.ZodOptional<z.ZodString>;
|
|
17
20
|
from: z.ZodOptional<z.ZodString>;
|
|
18
21
|
to: z.ZodOptional<z.ZodString>;
|
|
22
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
23
|
+
glob: z.ZodOptional<z.ZodString>;
|
|
24
|
+
ignore_case: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
max_results: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
context_lines: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
old_string: z.ZodOptional<z.ZodString>;
|
|
28
|
+
new_string: z.ZodOptional<z.ZodString>;
|
|
29
|
+
replace_all: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
encoding: z.ZodOptional<z.ZodEnum<{
|
|
33
|
+
text: "text";
|
|
34
|
+
base64: "base64";
|
|
35
|
+
}>>;
|
|
19
36
|
}, z.core.$strict>;
|
|
20
37
|
export declare const WorkspaceOperationOutputSchema: z.ZodObject<{
|
|
21
38
|
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -34,6 +51,15 @@ export declare const WorkspaceOperationOutputSchema: z.ZodObject<{
|
|
|
34
51
|
action: z.ZodLiteral<"read">;
|
|
35
52
|
path: z.ZodString;
|
|
36
53
|
content: z.ZodString;
|
|
54
|
+
encoding: z.ZodOptional<z.ZodEnum<{
|
|
55
|
+
text: "text";
|
|
56
|
+
base64: "base64";
|
|
57
|
+
}>>;
|
|
58
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
total_lines: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
37
63
|
}, z.core.$strip>, z.ZodObject<{
|
|
38
64
|
action: z.ZodLiteral<"write">;
|
|
39
65
|
path: z.ZodString;
|
|
@@ -65,5 +91,32 @@ export declare const WorkspaceOperationOutputSchema: z.ZodObject<{
|
|
|
65
91
|
from: z.ZodString;
|
|
66
92
|
to: z.ZodString;
|
|
67
93
|
ok: z.ZodBoolean;
|
|
94
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
95
|
+
action: z.ZodLiteral<"search">;
|
|
96
|
+
pattern: z.ZodString;
|
|
97
|
+
matches: z.ZodArray<z.ZodObject<{
|
|
98
|
+
path: z.ZodString;
|
|
99
|
+
line: z.ZodNumber;
|
|
100
|
+
text: z.ZodString;
|
|
101
|
+
before: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
102
|
+
after: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
total_matches: z.ZodNumber;
|
|
105
|
+
truncated: z.ZodBoolean;
|
|
106
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
107
|
+
action: z.ZodLiteral<"glob">;
|
|
108
|
+
pattern: z.ZodString;
|
|
109
|
+
files: z.ZodArray<z.ZodObject<{
|
|
110
|
+
path: z.ZodString;
|
|
111
|
+
is_dir: z.ZodBoolean;
|
|
112
|
+
size: z.ZodNumber;
|
|
113
|
+
mtime: z.ZodNumber;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
count: z.ZodNumber;
|
|
116
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
117
|
+
action: z.ZodLiteral<"edit">;
|
|
118
|
+
path: z.ZodString;
|
|
119
|
+
replacements: z.ZodNumber;
|
|
120
|
+
ok: z.ZodBoolean;
|
|
68
121
|
}, z.core.$strip>], "action">;
|
|
69
122
|
}, z.core.$strict>;
|
|
@@ -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'])['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).'),'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).')})['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).')}),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']()})])})['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\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 +1 @@
|
|
|
1
|
-
import{readFileSync,existsSync,writeFileSync,mkdirSync}from'fs';import{resolve,join,dirname}from'path';import{fileURLToPath}from'url';import{TOOLS_REFERENCE,getToolReference,searchToolReference,getToolSequence}from'../knowledge/tools-reference.js';import{GUARD_DESIGN_PATTERNS,getGuardDesignPattern,GUARD_DESIGN_PATTERNS_VERSION}from'../knowledge/guard-design-patterns.js';import{OBJECT_REUSE_RULES,CREATE_VS_MODIFY_PATTERN,IMMUTABILITY_RULES,OPERATION_TYPE_CLASSIFICATION,OPERATION_CLASS_META,NAMING_CONVENTIONS,SAFETY_RULES_VERSION}from'../knowledge/safety-rules.js';import{listTemplates as a405a,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';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['find'](q=>q&&typeof q==='object'&&q['properties']&&typeof q['properties']==='object');l&&b['push']('Common\x20fields\x20per\x20variant:\x20'+Object['keys'](l['properties'])['join'](',\x20')+'\x20—\x20'+'inspect\x20a\x20branch\x20via\x20action=\x27get_field\x27\x20with\x20field_path.');}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=a405a(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'},'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},'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,'operation_type_classification':OPERATION_TYPE_CLASSIFICATION,'operation_class_meta':OPERATION_CLASS_META,'naming_conventions':NAMING_CONVENTIONS},'message':'Retrieved\x20safety\x20rule\x20tables\x20(reuse\x20/\x20immutability\x20/\x20operation\x20classification\x20/\x20naming).\x20'+'Key\x20points:\x20prefer\x20REUSING\x20existing\x20objects\x20(string\x20reference\x20=\x20reuse,\x20object\x20shape\x20=\x20create);\x20'+'Machine\x20publish\x20locks\x20nodes/pairs/forwards,\x20Service\x20publish\x20locks\x20machine/order_allocators/arbitrations\x20(sales\x20stays\x20mutable);\x20'+'Guard\x20is\x20CREATE-only\x20immutable;\x20on-chain\x20writes\x20require\x20explicit\x20user\x20confirmation.'};if(!areSchemasAvailable())return{'success':![],'action':b,'data':null,'message':'Schema\x20files\x20are\x20not\x20available.\x20Please\x20run\x20\x27npm\x20run\x20generate:schemas\x27\x20first.','suggestions':['Run\x20\x27npm\x20run\x20generate:schemas\x27\x20to\x20generate\x20schema\x20files','Ensure\x20the\x20dist/schemas\x20directory\x20exists']};switch(b){case'list':{const 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_output':{if(!c)return{'success':![],'action':b,'data':null,'message':'Tool\x20name\x20is\x20required\x20for\x20\x27get_output\x27\x20action','suggestions':['Provide\x20a\x20tool\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools\x20and\x20their\x20outputPath']};const O=getOutputSchema(c);if(!O){const Q=listSchemas(),R=Q['find'](T=>T['name']===c);if(R)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 S=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':S['length']>0x0?S['map'](T=>'Did\x20you\x20mean:\x20'+T['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const T=writeResponseToFile(O,h);if(T)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+T,'output_file_path':T,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+T]};}const P=autoOverflowToFile(O,c);if(P)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](P['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':P['absolute_path'],'inline_summary':P['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+P['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+P['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':O,'message':'Retrieved\x20output\x20schema:\x20'+c};}default:return{'success':![],'action':b,'data':null,'message':'Unknown\x20action:\x20'+b,'suggestions':['Use\x20\x27list\x27,\x20\x27get\x27,\x20\x27get_field\x27,\x20\x27get_output\x27,\x20\x27search\x27,\x20\x27list_operations\x27,\x20\x27get_guard_templates\x27,\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'](j=>({'identifier':j['identifier'],'name':j['name'],'value_type':j['value_type']??'Address','b_submission':j['b_submission']??![],'value':j['value']})),'guardName':a['description']??null,'rely':a['rely']??null},d=renderGuardTreeIndented(c),e=renderGuardMermaid(a['root']),f=new Set();let g=![],h=![];walkGuardTree(a['root'],j=>{if(j['type']==='context'){if(j['context']==='Clock')g=!![];if(j['context']==='Signer')h=!![];}j['type']==='query'&&typeof j['query']==='number'&&f['add'](j['query']);});const i={'submission_requirements':(a['table']??[])['filter'](j=>j['b_submission']===!![])['map'](j=>({'identifier':j['identifier'],'value_type':j['value_type'],'object_type':j['object_type'],'name':j['name']})),'data_sources':(a['table']??[])['filter'](j=>j['b_submission']!==!![])['map'](j=>({'identifier':j['identifier'],'kind':j['is_system_address']?'system_address':j['object_type']?'object':'fixed_value','value_type':j['value_type'],'object_type':j['object_type'],'name':j['name'],'is_mutable_onchain':j['object_type']==='Repository'})),'query_dependencies':[...f]['sort']((j,k)=>j-k),'has_time_conditions':g,'has_signer_constraints':h,'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':i};}export{formatLintResult};
|
|
1
|
+
import{readFileSync,existsSync,writeFileSync,mkdirSync}from'fs';import{resolve,join,dirname}from'path';import{fileURLToPath}from'url';import{TOOLS_REFERENCE,getToolReference,searchToolReference,getToolSequence}from'../knowledge/tools-reference.js';import{GUARD_DESIGN_PATTERNS,getGuardDesignPattern,GUARD_DESIGN_PATTERNS_VERSION,GUARD_SCHEMA_NOTES}from'../knowledge/guard-design-patterns.js';import{OBJECT_REUSE_RULES,CREATE_VS_MODIFY_PATTERN,IMMUTABILITY_RULES,OPERATION_TYPE_CLASSIFICATION,OPERATION_CLASS_META,NAMING_CONVENTIONS,SAFETY_RULES_VERSION}from'../knowledge/safety-rules.js';import{listTemplates as a407a,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';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['find'](q=>q&&typeof q==='object'&&q['properties']&&typeof q['properties']==='object');l&&b['push']('Common\x20fields\x20per\x20variant:\x20'+Object['keys'](l['properties'])['join'](',\x20')+'\x20—\x20'+'inspect\x20a\x20branch\x20via\x20action=\x27get_field\x27\x20with\x20field_path.');}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=a407a(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,'operation_type_classification':OPERATION_TYPE_CLASSIFICATION,'operation_class_meta':OPERATION_CLASS_META,'naming_conventions':NAMING_CONVENTIONS},'message':'Retrieved\x20safety\x20rule\x20tables\x20(reuse\x20/\x20immutability\x20/\x20operation\x20classification\x20/\x20naming).\x20'+'Key\x20points:\x20prefer\x20REUSING\x20existing\x20objects\x20(string\x20reference\x20=\x20reuse,\x20object\x20shape\x20=\x20create);\x20'+'Machine\x20publish\x20locks\x20nodes/pairs/forwards,\x20Service\x20publish\x20locks\x20machine/order_allocators/arbitrations\x20(sales\x20stays\x20mutable);\x20'+'Guard\x20is\x20CREATE-only\x20immutable;\x20on-chain\x20writes\x20require\x20explicit\x20user\x20confirmation.'};if(!areSchemasAvailable())return{'success':![],'action':b,'data':null,'message':'Schema\x20files\x20are\x20not\x20available.\x20Please\x20run\x20\x27npm\x20run\x20generate:schemas\x27\x20first.','suggestions':['Run\x20\x27npm\x20run\x20generate:schemas\x27\x20to\x20generate\x20schema\x20files','Ensure\x20the\x20dist/schemas\x20directory\x20exists']};switch(b){case'list':{const 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_output':{if(!c)return{'success':![],'action':b,'data':null,'message':'Tool\x20name\x20is\x20required\x20for\x20\x27get_output\x27\x20action','suggestions':['Provide\x20a\x20tool\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools\x20and\x20their\x20outputPath']};const O=getOutputSchema(c);if(!O){const Q=listSchemas(),R=Q['find'](T=>T['name']===c);if(R)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 S=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':S['length']>0x0?S['map'](T=>'Did\x20you\x20mean:\x20'+T['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const T=writeResponseToFile(O,h);if(T)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+T,'output_file_path':T,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+T]};}const P=autoOverflowToFile(O,c);if(P)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20is\x20large\x20('+Math['round'](P['bytes']/0x400)+'\x20KB)\x20—\x20'+'written\x20to\x20file\x20instead\x20of\x20inlining\x20to\x20protect\x20your\x20context.','output_file_path':P['absolute_path'],'inline_summary':P['summary'],'suggestions':['Read\x20the\x20full\x20file\x20with\x20the\x20Read\x20tool:\x20'+P['absolute_path'],'If\x20the\x20sandbox\x20blocks\x20that\x20path,\x20resolve\x20the\x20relative\x20path\x20\x27'+P['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':O,'message':'Retrieved\x20output\x20schema:\x20'+c};}default:return{'success':![],'action':b,'data':null,'message':'Unknown\x20action:\x20'+b,'suggestions':['Use\x20\x27list\x27,\x20\x27get\x27,\x20\x27get_field\x27,\x20\x27get_output\x27,\x20\x27search\x27,\x20\x27list_operations\x27,\x20\x27get_guard_templates\x27,\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'](j=>({'identifier':j['identifier'],'name':j['name'],'value_type':j['value_type']??'Address','b_submission':j['b_submission']??![],'value':j['value']})),'guardName':a['description']??null,'rely':a['rely']??null},d=renderGuardTreeIndented(c),e=renderGuardMermaid(a['root']),f=new Set();let g=![],h=![];walkGuardTree(a['root'],j=>{if(j['type']==='context'){if(j['context']==='Clock')g=!![];if(j['context']==='Signer')h=!![];}j['type']==='query'&&typeof j['query']==='number'&&f['add'](j['query']);});const i={'submission_requirements':(a['table']??[])['filter'](j=>j['b_submission']===!![])['map'](j=>({'identifier':j['identifier'],'value_type':j['value_type'],'object_type':j['object_type'],'name':j['name']})),'data_sources':(a['table']??[])['filter'](j=>j['b_submission']!==!![])['map'](j=>({'identifier':j['identifier'],'kind':j['is_system_address']?'system_address':j['object_type']?'object':'fixed_value','value_type':j['value_type'],'object_type':j['object_type'],'name':j['name'],'is_mutable_onchain':j['object_type']==='Repository'})),'query_dependencies':[...f]['sort']((j,k)=>j-k),'has_time_conditions':g,'has_signer_constraints':h,'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':i};}export{formatLintResult};
|
|
@@ -2335,6 +2335,7 @@
|
|
|
2335
2335
|
"guard_rejected",
|
|
2336
2336
|
"state_conflict",
|
|
2337
2337
|
"insufficient_balance",
|
|
2338
|
+
"transaction_expired",
|
|
2338
2339
|
"stock_exhausted",
|
|
2339
2340
|
"sale_suspended",
|
|
2340
2341
|
"discount_invalid",
|
|
@@ -3139,7 +3140,7 @@
|
|
|
3139
3140
|
"type": "string"
|
|
3140
3141
|
},
|
|
3141
3142
|
"test_result": {
|
|
3142
|
-
"description": "gen_passport static test result.
|
|
3143
|
+
"description": "gen_passport static test result. status is read from the created Passport's on-chain result field; tx success alone never means the Guard passed.",
|
|
3143
3144
|
"type": "object",
|
|
3144
3145
|
"properties": {
|
|
3145
3146
|
"status": {
|
|
@@ -3157,6 +3158,29 @@
|
|
|
3157
3158
|
"passport_id": {
|
|
3158
3159
|
"description": "Generated Passport ID (if pass)",
|
|
3159
3160
|
"type": "string"
|
|
3161
|
+
},
|
|
3162
|
+
"guard_results": {
|
|
3163
|
+
"description": "Per-Guard evaluation result read from the Passport (docs#40: the pass/fail status comes from Passport.result, not transaction success)",
|
|
3164
|
+
"type": "array",
|
|
3165
|
+
"items": {
|
|
3166
|
+
"type": "object",
|
|
3167
|
+
"properties": {
|
|
3168
|
+
"guard": {
|
|
3169
|
+
"type": "string"
|
|
3170
|
+
},
|
|
3171
|
+
"result": {
|
|
3172
|
+
"type": "boolean"
|
|
3173
|
+
},
|
|
3174
|
+
"impack": {
|
|
3175
|
+
"type": "boolean"
|
|
3176
|
+
}
|
|
3177
|
+
},
|
|
3178
|
+
"required": [
|
|
3179
|
+
"guard",
|
|
3180
|
+
"result"
|
|
3181
|
+
],
|
|
3182
|
+
"additionalProperties": false
|
|
3183
|
+
}
|
|
3160
3184
|
}
|
|
3161
3185
|
},
|
|
3162
3186
|
"required": [
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"guard_rejected",
|
|
49
49
|
"state_conflict",
|
|
50
50
|
"insufficient_balance",
|
|
51
|
+
"transaction_expired",
|
|
51
52
|
"stock_exhausted",
|
|
52
53
|
"sale_suspended",
|
|
53
54
|
"discount_invalid",
|
|
@@ -847,7 +848,7 @@
|
|
|
847
848
|
"type": "string"
|
|
848
849
|
},
|
|
849
850
|
"test_result": {
|
|
850
|
-
"description": "gen_passport static test result.
|
|
851
|
+
"description": "gen_passport static test result. status is read from the created Passport's on-chain result field; tx success alone never means the Guard passed.",
|
|
851
852
|
"type": "object",
|
|
852
853
|
"properties": {
|
|
853
854
|
"status": {
|
|
@@ -865,6 +866,29 @@
|
|
|
865
866
|
"passport_id": {
|
|
866
867
|
"description": "Generated Passport ID (if pass)",
|
|
867
868
|
"type": "string"
|
|
869
|
+
},
|
|
870
|
+
"guard_results": {
|
|
871
|
+
"description": "Per-Guard evaluation result read from the Passport (docs#40: the pass/fail status comes from Passport.result, not transaction success)",
|
|
872
|
+
"type": "array",
|
|
873
|
+
"items": {
|
|
874
|
+
"type": "object",
|
|
875
|
+
"properties": {
|
|
876
|
+
"guard": {
|
|
877
|
+
"type": "string"
|
|
878
|
+
},
|
|
879
|
+
"result": {
|
|
880
|
+
"type": "boolean"
|
|
881
|
+
},
|
|
882
|
+
"impack": {
|
|
883
|
+
"type": "boolean"
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
"required": [
|
|
887
|
+
"guard",
|
|
888
|
+
"result"
|
|
889
|
+
],
|
|
890
|
+
"additionalProperties": false
|
|
891
|
+
}
|
|
868
892
|
}
|
|
869
893
|
},
|
|
870
894
|
"required": [
|
|
@@ -116,6 +116,14 @@
|
|
|
116
116
|
"description": "Phase 1 dry_run: when true, SIMULATE the transaction without signing or submitting. Returns effects + events showing what WOULD happen — no on-chain state is modified, no gas is charged. Use this to verify that an operation will succeed before committing. The returned digest will be 'dry_run:<timestamp>' and objectChanges will be empty (simulation only).",
|
|
117
117
|
"type": "boolean"
|
|
118
118
|
},
|
|
119
|
+
"response_level": {
|
|
120
|
+
"description": "Write-success response size. 'compact' (default) trims the structured result to key fields (digest + created object references); 'full' includes the complete raw result. Default: compact.",
|
|
121
|
+
"type": "string",
|
|
122
|
+
"enum": [
|
|
123
|
+
"compact",
|
|
124
|
+
"full"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
119
127
|
"confirm_mode": {
|
|
120
128
|
"description": "Confirmation frequency for this call. 'full': confirm every matched gate rule. 'streamlined' (client default): skip fail-open 'standard' level prompts — fail-closed levels (irreversible/publish/amount) ALWAYS still confirm. 'quiet': same hard floor as streamlined, for clients that batch/suppress repeat low-risk prompts in their own UI. This field NEVER downgrades fail-closed levels.",
|
|
121
129
|
"type": "string",
|
|
@@ -252,6 +260,14 @@
|
|
|
252
260
|
"description": "Phase 1 dry_run: when true, SIMULATE the transaction without signing or submitting. Returns effects + events showing what WOULD happen — no on-chain state is modified, no gas is charged. Use this to verify that an operation will succeed before committing. The returned digest will be 'dry_run:<timestamp>' and objectChanges will be empty (simulation only).",
|
|
253
261
|
"type": "boolean"
|
|
254
262
|
},
|
|
263
|
+
"response_level": {
|
|
264
|
+
"description": "Write-success response size. 'compact' (default) trims the structured result to key fields (digest + created object references); 'full' includes the complete raw result. Default: compact.",
|
|
265
|
+
"type": "string",
|
|
266
|
+
"enum": [
|
|
267
|
+
"compact",
|
|
268
|
+
"full"
|
|
269
|
+
]
|
|
270
|
+
},
|
|
255
271
|
"confirm_mode": {
|
|
256
272
|
"description": "Confirmation frequency for this call. 'full': confirm every matched gate rule. 'streamlined' (client default): skip fail-open 'standard' level prompts — fail-closed levels (irreversible/publish/amount) ALWAYS still confirm. 'quiet': same hard floor as streamlined, for clients that batch/suppress repeat low-risk prompts in their own UI. This field NEVER downgrades fail-closed levels.",
|
|
257
273
|
"type": "string",
|
|
@@ -362,6 +378,14 @@
|
|
|
362
378
|
"description": "Phase 1 dry_run: when true, SIMULATE the transaction without signing or submitting. Returns effects + events showing what WOULD happen — no on-chain state is modified, no gas is charged. Use this to verify that an operation will succeed before committing. The returned digest will be 'dry_run:<timestamp>' and objectChanges will be empty (simulation only).",
|
|
363
379
|
"type": "boolean"
|
|
364
380
|
},
|
|
381
|
+
"response_level": {
|
|
382
|
+
"description": "Write-success response size. 'compact' (default) trims the structured result to key fields (digest + created object references); 'full' includes the complete raw result. Default: compact.",
|
|
383
|
+
"type": "string",
|
|
384
|
+
"enum": [
|
|
385
|
+
"compact",
|
|
386
|
+
"full"
|
|
387
|
+
]
|
|
388
|
+
},
|
|
365
389
|
"confirm_mode": {
|
|
366
390
|
"description": "Confirmation frequency for this call. 'full': confirm every matched gate rule. 'streamlined' (client default): skip fail-open 'standard' level prompts — fail-closed levels (irreversible/publish/amount) ALWAYS still confirm. 'quiet': same hard floor as streamlined, for clients that batch/suppress repeat low-risk prompts in their own UI. This field NEVER downgrades fail-closed levels.",
|
|
367
391
|
"type": "string",
|
|
@@ -472,6 +496,14 @@
|
|
|
472
496
|
"description": "Phase 1 dry_run: when true, SIMULATE the transaction without signing or submitting. Returns effects + events showing what WOULD happen — no on-chain state is modified, no gas is charged. Use this to verify that an operation will succeed before committing. The returned digest will be 'dry_run:<timestamp>' and objectChanges will be empty (simulation only).",
|
|
473
497
|
"type": "boolean"
|
|
474
498
|
},
|
|
499
|
+
"response_level": {
|
|
500
|
+
"description": "Write-success response size. 'compact' (default) trims the structured result to key fields (digest + created object references); 'full' includes the complete raw result. Default: compact.",
|
|
501
|
+
"type": "string",
|
|
502
|
+
"enum": [
|
|
503
|
+
"compact",
|
|
504
|
+
"full"
|
|
505
|
+
]
|
|
506
|
+
},
|
|
475
507
|
"confirm_mode": {
|
|
476
508
|
"description": "Confirmation frequency for this call. 'full': confirm every matched gate rule. 'streamlined' (client default): skip fail-open 'standard' level prompts — fail-closed levels (irreversible/publish/amount) ALWAYS still confirm. 'quiet': same hard floor as streamlined, for clients that batch/suppress repeat low-risk prompts in their own UI. This field NEVER downgrades fail-closed levels.",
|
|
477
509
|
"type": "string",
|
|
@@ -614,6 +646,14 @@
|
|
|
614
646
|
"description": "Phase 1 dry_run: when true, SIMULATE the transaction without signing or submitting. Returns effects + events showing what WOULD happen — no on-chain state is modified, no gas is charged. Use this to verify that an operation will succeed before committing. The returned digest will be 'dry_run:<timestamp>' and objectChanges will be empty (simulation only).",
|
|
615
647
|
"type": "boolean"
|
|
616
648
|
},
|
|
649
|
+
"response_level": {
|
|
650
|
+
"description": "Write-success response size. 'compact' (default) trims the structured result to key fields (digest + created object references); 'full' includes the complete raw result. Default: compact.",
|
|
651
|
+
"type": "string",
|
|
652
|
+
"enum": [
|
|
653
|
+
"compact",
|
|
654
|
+
"full"
|
|
655
|
+
]
|
|
656
|
+
},
|
|
617
657
|
"confirm_mode": {
|
|
618
658
|
"description": "Confirmation frequency for this call. 'full': confirm every matched gate rule. 'streamlined' (client default): skip fail-open 'standard' level prompts — fail-closed levels (irreversible/publish/amount) ALWAYS still confirm. 'quiet': same hard floor as streamlined, for clients that batch/suppress repeat low-risk prompts in their own UI. This field NEVER downgrades fail-closed levels.",
|
|
619
659
|
"type": "string",
|
|
@@ -86,6 +86,14 @@
|
|
|
86
86
|
"description": "Phase 1 dry_run: when true, SIMULATE the transaction without signing or submitting. Returns effects + events showing what WOULD happen — no on-chain state is modified, no gas is charged. Use this to verify that an operation will succeed before committing. The returned digest will be 'dry_run:<timestamp>' and objectChanges will be empty (simulation only).",
|
|
87
87
|
"type": "boolean"
|
|
88
88
|
},
|
|
89
|
+
"response_level": {
|
|
90
|
+
"description": "Write-success response size. 'compact' (default) trims the structured result to key fields (digest + created object references); 'full' includes the complete raw result. Default: compact.",
|
|
91
|
+
"type": "string",
|
|
92
|
+
"enum": [
|
|
93
|
+
"compact",
|
|
94
|
+
"full"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
89
97
|
"confirm_mode": {
|
|
90
98
|
"description": "Confirmation frequency for this call. 'full': confirm every matched gate rule. 'streamlined' (client default): skip fail-open 'standard' level prompts — fail-closed levels (irreversible/publish/amount) ALWAYS still confirm. 'quiet': same hard floor as streamlined, for clients that batch/suppress repeat low-risk prompts in their own UI. This field NEVER downgrades fail-closed levels.",
|
|
91
99
|
"type": "string",
|
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-09-
|
|
5
|
+
"generatedAt": "2026-09-30T15:30:28.975Z",
|
|
6
6
|
"tools": [
|
|
7
7
|
{
|
|
8
8
|
"name": "onchain_operations",
|