@wowok/agent-mcp 3.0.4 → 3.0.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/README.md +25 -20
- package/dist/customer/account-events.js +1 -1
- package/dist/evaluation/path-reasoning.d.ts +4 -2
- package/dist/evaluation/path-reasoning.js +1 -1
- package/dist/extensions/constraint-registry.d.ts +2 -2
- package/dist/extensions/constraint-registry.js +1 -1
- package/dist/extensions/custom-registry-file.d.ts +22 -0
- package/dist/extensions/custom-registry-file.js +1 -0
- package/dist/extensions/index.d.ts +2 -1
- package/dist/extensions/index.js +1 -1
- package/dist/extensions/industry-pack.d.ts +7 -0
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/metric-registry.d.ts +2 -2
- package/dist/extensions/metric-registry.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/extensions/registry.d.ts +2 -2
- package/dist/extensions/registry.js +1 -1
- package/dist/extensions/types.d.ts +4 -0
- package/dist/goal/GoalEngine.d.ts +13 -1
- package/dist/goal/GoalEngine.js +1 -1
- package/dist/goal/next-steps.d.ts +12 -0
- package/dist/goal/next-steps.js +1 -0
- package/dist/goal/pursue.d.ts +18 -0
- package/dist/goal/pursue.js +1 -0
- package/dist/goal/types.d.ts +72 -0
- package/dist/goal/types.js +1 -1
- package/dist/graph/onchain/analyze.d.ts +44 -0
- package/dist/graph/onchain/analyze.js +1 -0
- package/dist/graph/onchain/analyze.spec.d.ts +1 -0
- package/dist/graph/onchain/analyze.spec.js +1 -0
- package/dist/graph/onchain/anti-cheat.d.ts +39 -0
- package/dist/graph/onchain/anti-cheat.js +1 -0
- package/dist/graph/onchain/anti-cheat.spec.d.ts +1 -0
- package/dist/graph/onchain/anti-cheat.spec.js +1 -0
- package/dist/graph/onchain/dataplane.d.ts +44 -0
- package/dist/graph/onchain/dataplane.js +1 -0
- package/dist/graph/onchain/edge-schema.d.ts +60 -0
- package/dist/graph/onchain/edge-schema.js +1 -0
- package/dist/graph/onchain/expand.d.ts +4 -0
- package/dist/graph/onchain/expand.js +1 -0
- package/dist/graph/onchain/extract.d.ts +21 -0
- package/dist/graph/onchain/extract.js +1 -0
- package/dist/graph/onchain/index.d.ts +17 -0
- package/dist/graph/onchain/index.js +1 -0
- package/dist/graph/onchain/interest.d.ts +10 -0
- package/dist/graph/onchain/interest.js +1 -0
- package/dist/graph/onchain/interest.spec.d.ts +1 -0
- package/dist/graph/onchain/interest.spec.js +1 -0
- package/dist/graph/onchain/onchain.spec.d.ts +1 -0
- package/dist/graph/onchain/onchain.spec.js +1 -0
- package/dist/graph/onchain/order-status.d.ts +53 -0
- package/dist/graph/onchain/order-status.js +1 -0
- package/dist/graph/onchain/project-relationship.d.ts +3 -0
- package/dist/graph/onchain/project-relationship.js +1 -0
- package/dist/graph/onchain/sdk-batch.d.ts +123 -0
- package/dist/graph/onchain/sdk-batch.js +1 -0
- package/dist/graph/onchain/sdk-dataplane.d.ts +43 -0
- package/dist/graph/onchain/sdk-dataplane.js +1 -0
- package/dist/graph/onchain/strategy.d.ts +54 -0
- package/dist/graph/onchain/strategy.js +1 -0
- package/dist/graph/onchain/strategy.spec.d.ts +1 -0
- package/dist/graph/onchain/strategy.spec.js +1 -0
- package/dist/graph/onchain/types.d.ts +238 -0
- package/dist/graph/onchain/types.js +1 -0
- package/dist/graph/onchain/viewport.d.ts +5 -0
- package/dist/graph/onchain/viewport.js +1 -0
- package/dist/harness/recover.js +1 -1
- package/dist/index.js +1 -1
- package/dist/intent/enrich.js +1 -1
- package/dist/keeper/detectors.d.ts +1 -1
- package/dist/keeper/detectors.js +1 -1
- package/dist/knowledge/account-marks.js +1 -1
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/allocation-templates.js +1 -1
- package/dist/knowledge/anti-cheat.d.ts +2 -37
- package/dist/knowledge/anti-cheat.js +1 -1
- package/dist/knowledge/contract-invariants.js +1 -1
- package/dist/knowledge/getting-started.d.ts +37 -0
- package/dist/knowledge/getting-started.js +1 -0
- package/dist/knowledge/goal-completion.d.ts +12 -0
- package/dist/knowledge/goal-completion.js +1 -1
- package/dist/knowledge/guard-render.d.ts +1 -0
- package/dist/knowledge/guard-render.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-submission-brief.d.ts +83 -0
- package/dist/knowledge/guard-submission-brief.js +1 -0
- package/dist/knowledge/guard-submission-prompt.d.ts +13 -0
- package/dist/knowledge/guard-submission-prompt.js +1 -1
- package/dist/knowledge/index.d.ts +10 -4
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/industry-strategy.d.ts +91 -0
- package/dist/knowledge/industry-strategy.js +1 -0
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/market-metrics.d.ts +14 -3
- package/dist/knowledge/market-metrics.js +1 -1
- package/dist/knowledge/migration-preflight.js +1 -1
- package/dist/knowledge/operation-dictionary.d.ts +1 -1
- package/dist/knowledge/payment-tracker.d.ts +63 -0
- package/dist/knowledge/payment-tracker.js +1 -0
- package/dist/knowledge/recipient-constraint.d.ts +160 -0
- package/dist/knowledge/recipient-constraint.js +1 -0
- package/dist/knowledge/safety-rules.d.ts +1 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/scenario-topology.d.ts +6 -1
- package/dist/knowledge/scenario-topology.js +1 -1
- package/dist/knowledge/service-risk-node.d.ts +3 -0
- package/dist/knowledge/service-risk-node.js +1 -0
- package/dist/knowledge/service-risk.d.ts +2 -0
- package/dist/knowledge/service-risk.js +1 -1
- package/dist/knowledge/service-templates.d.ts +2 -0
- package/dist/knowledge/service-templates.js +1 -1
- package/dist/knowledge/strategy-manuals.d.ts +17 -0
- package/dist/knowledge/strategy-manuals.js +1 -0
- package/dist/knowledge/supply-chain.d.ts +3 -1
- package/dist/knowledge/supply-chain.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +3 -118
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/knowledge/workspace-lists.d.ts +4 -0
- package/dist/knowledge/workspace-lists.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/monitor/ScopeResolver.js +1 -1
- package/dist/participation/arbitrator-interest.d.ts +2 -0
- package/dist/participation/arbitrator-interest.js +1 -1
- package/dist/participation/collaborator-interest.d.ts +2 -0
- package/dist/participation/collaborator-interest.js +1 -1
- package/dist/participation/customer-interest.d.ts +2 -0
- package/dist/participation/customer-interest.js +1 -1
- package/dist/participation/merchant-interest.d.ts +2 -0
- package/dist/participation/merchant-interest.js +1 -1
- package/dist/participation/radar-core.d.ts +15 -15
- package/dist/participation/radar-core.js +1 -1
- package/dist/participation/supplier-interest.d.ts +2 -0
- package/dist/participation/supplier-interest.js +1 -1
- package/dist/persona/analyzer.d.ts +2 -1
- package/dist/persona/bridge.d.ts +5 -1
- package/dist/persona/bridge.js +1 -1
- package/dist/persona/defaults.js +1 -1
- package/dist/persona/distill-goal.d.ts +7 -1
- package/dist/persona/distill-goal.js +1 -1
- package/dist/persona/index.d.ts +13 -3
- package/dist/persona/index.js +1 -1
- package/dist/persona/model.d.ts +12 -2
- package/dist/persona/model.js +1 -1
- package/dist/persona/overrides.d.ts +1 -0
- package/dist/persona/overrides.js +1 -1
- package/dist/persona/topology-focus.d.ts +29 -0
- package/dist/persona/topology-focus.js +1 -0
- package/dist/persona/types.d.ts +81 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/context-assembly.js +1 -1
- package/dist/playbooks/service-build/machine-nodes.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +7 -0
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/pipeline-actions.d.ts +2 -2
- package/dist/playbooks/service-build/pipeline-actions.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.d.ts +1 -0
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/risk-aggregator.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +4 -0
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/topology-query.d.ts +14 -0
- package/dist/playbooks/service-build/topology-query.js +1 -0
- package/dist/relationship/derivation.js +1 -1
- package/dist/role/index.d.ts +1 -0
- package/dist/role/index.js +1 -1
- package/dist/role/profiles.d.ts +26 -0
- package/dist/role/profiles.js +1 -0
- package/dist/safety/confirm-gate.d.ts +4 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/call/allocation.d.ts +6 -6
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +1 -1
- package/dist/schema/call/guard.d.ts +20 -20
- package/dist/schema/call/repository.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +4 -4
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/employee/index.d.ts +7 -7
- package/dist/schema/evaluation/index.d.ts +26 -13
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +53 -17
- package/dist/schema/goal/index.js +1 -1
- package/dist/schema/goal/planning.d.ts +7 -7
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +13 -6
- package/dist/schema/industry-pack/index.js +1 -1
- package/dist/schema/industry-pack/modes.d.ts +6 -6
- package/dist/schema/intent-radar/index.d.ts +16 -16
- package/dist/schema/local/index.d.ts +8 -4
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +428 -72
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +177 -34
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +15744 -1
- package/dist/schema/persona/index.js +1 -1
- package/dist/schema/query/bi.d.ts +891 -24
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +168 -43
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +16 -0
- package/dist/schema/schema-query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/strategy-review/index.d.ts +137 -0
- package/dist/schema/strategy-review/index.js +1 -0
- package/dist/schema/trust/index.d.ts +6 -6
- package/dist/schema/workflow/index.d.ts +2 -2
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +8 -4
- package/dist/schemas/account_operation.schema.json +6 -2
- package/dist/schemas/bridge_operation.schema.json +10 -10
- package/dist/schemas/evaluation_operation.output.json +24 -0
- package/dist/schemas/evaluation_operation.schema.json +7 -7
- package/dist/schemas/goal_operation.schema.json +124 -0
- package/dist/schemas/guard2file.schema.json +2 -2
- package/dist/schemas/index.json +7 -1
- package/dist/schemas/industry_pack_operation.output.json +39 -0
- package/dist/schemas/local_mark_operation.schema.json +2 -2
- package/dist/schemas/machineNode2file.schema.json +2 -2
- package/dist/schemas/messenger_operation.output.json +934 -236
- package/dist/schemas/messenger_operation.schema.json +93 -242
- package/dist/schemas/onchain_events.schema.json +1 -1
- package/dist/schemas/onchain_operations.schema.json +54 -54
- package/dist/schemas/onchain_operations_allocation.schema.json +5 -5
- package/dist/schemas/onchain_operations_arbitration.schema.json +2 -2
- package/dist/schemas/onchain_operations_contact.schema.json +2 -2
- package/dist/schemas/onchain_operations_demand.schema.json +2 -2
- package/dist/schemas/onchain_operations_gen_passport.schema.json +2 -2
- package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -2
- package/dist/schemas/onchain_operations_guard.schema.json +2 -2
- package/dist/schemas/onchain_operations_machine.schema.json +8 -8
- package/dist/schemas/onchain_operations_order.schema.json +2 -2
- package/dist/schemas/onchain_operations_payment.schema.json +3 -3
- package/dist/schemas/onchain_operations_permission.schema.json +2 -2
- package/dist/schemas/onchain_operations_personal.schema.json +2 -2
- package/dist/schemas/onchain_operations_progress.schema.json +2 -2
- package/dist/schemas/onchain_operations_proof.schema.json +2 -2
- package/dist/schemas/onchain_operations_repository.schema.json +5 -5
- package/dist/schemas/onchain_operations_reward.schema.json +2 -2
- package/dist/schemas/onchain_operations_service.schema.json +5 -5
- package/dist/schemas/onchain_operations_treasury.schema.json +4 -4
- package/dist/schemas/onchain_table_data.output.json +197 -13
- package/dist/schemas/onchain_table_data.schema.json +43 -43
- package/dist/schemas/persona_operation.output.json +37778 -262
- package/dist/schemas/persona_operation.schema.json +5960 -1
- package/dist/schemas/query_toolkit.output.json +1615 -10
- package/dist/schemas/query_toolkit.schema.json +232 -42
- package/dist/schemas/schema_query.schema.json +25 -1
- package/dist/schemas/strategy_review_operation.output.json +532 -0
- package/dist/schemas/strategy_review_operation.schema.json +66 -0
- package/dist/schemas/wowok_buildin_info.output.json +188 -6
- package/dist/schemas/wowok_buildin_info.schema.json +14 -0
- package/dist/strategy/collectors.d.ts +66 -0
- package/dist/strategy/collectors.js +1 -0
- package/dist/strategy/collectors.spec.d.ts +1 -0
- package/dist/strategy/collectors.spec.js +1 -0
- package/dist/strategy/index.d.ts +5 -0
- package/dist/strategy/index.js +1 -0
- package/dist/strategy/metrics.d.ts +20 -0
- package/dist/strategy/metrics.js +1 -0
- package/dist/strategy/review.d.ts +48 -0
- package/dist/strategy/review.js +1 -0
- package/dist/strategy/scorecard.d.ts +32 -0
- package/dist/strategy/scorecard.js +1 -0
- package/dist/strategy/store.d.ts +26 -0
- package/dist/strategy/store.js +1 -0
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/goal.js +1 -1
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/permission.js +1 -1
- package/dist/tools/handlers/persona.js +1 -1
- package/dist/tools/handlers/query.d.ts +6 -0
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/handlers/strategy-review.d.ts +2 -0
- package/dist/tools/handlers/strategy-review.js +1 -0
- package/dist/tools/handlers/watch.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/agent.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/local.js +1 -1
- package/dist/tools/registry/messenger.js +1 -1
- package/dist/tools/registry/onchain.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/rules-hook.d.ts +2 -0
- package/dist/tools/rules-hook.js +1 -1
- package/dist/tools/shared.d.ts +2 -1
- package/dist/tools/shared.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
|
@@ -34,6 +34,22 @@ export declare const SchemaQueryInputSchema: z.ZodObject<{
|
|
|
34
34
|
params: z.ZodOptional<z.ZodString>;
|
|
35
35
|
output_file: z.ZodOptional<z.ZodString>;
|
|
36
36
|
guard: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
37
|
+
binding: z.ZodOptional<z.ZodEnum<{
|
|
38
|
+
custom: "custom";
|
|
39
|
+
forward: "forward";
|
|
40
|
+
dispute: "dispute";
|
|
41
|
+
vote: "vote";
|
|
42
|
+
allocate: "allocate";
|
|
43
|
+
gen_passport: "gen_passport";
|
|
44
|
+
buy: "buy";
|
|
45
|
+
claim_reward: "claim_reward";
|
|
46
|
+
write_repository: "write_repository";
|
|
47
|
+
submit_progress: "submit_progress";
|
|
48
|
+
}>>;
|
|
49
|
+
network: z.ZodOptional<z.ZodEnum<{
|
|
50
|
+
testnet: "testnet";
|
|
51
|
+
mainnet: "mainnet";
|
|
52
|
+
}>>;
|
|
37
53
|
}, z.core.$strict>;
|
|
38
54
|
export declare const SchemaQueryOutputSchema: z.ZodObject<{
|
|
39
55
|
success: z.ZodBoolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from'zod';export const SchemaQueryInputSchema=z['object']({'action':z['enum'](['list','get','get_output','search','list_operations','get_guard_templates','get_field','get_tool_reference','get_guard_design_patterns','get_safety_rules','get_templates','analyze_guard_semantics'])['describe']('Action\x20to\x20perform:\x20\x27list\x27\x20(all\x20schemas),\x20\x27get\x27\x20(specific\x20input\x20schema),\x20\x27get_output\x27\x20(tool\x20output\x20schema),\x20\x27get_field\x27\x20(field-path\x20query\x20e.g.\x20field_path=\x27data.node\x27),\x20\x27search\x27\x20(by\x20keyword),\x20\x27list_operations\x27\x20(on-chain\x20operations),\x20\x27get_guard_templates\x27\x20(Guard\x20creation\x20templates\x20+\x20best\x20practices),\x20\x27get_tool_reference\x27\x20(MCP\x20tool\x20usage\x20reference:\x20summaries,\x20actions,\x20prerequisites,\x20notes\x20—\x20sunk\x20from\x20wowok-tools\x20skill),\x20\x27get_guard_design_patterns\x27\x20(curated\x20Guard\x20design\x20pattern\x20catalog:\x20business\x20requirement\x20→\x20logic\x20tree\x20template\x20—\x20sunk\x20from\x20wowok-guard\x20skill),\x20\x27get_safety_rules\x27\x20(object\x20reuse/immutability/operation-classification/naming\x20rules\x20—\x20sunk\x20from\x20wowok-safety\x20skill),\x20\x27get_templates\x27\x20(unified\x20template\x20registry:\x20~90\x20parameterized\x20templates\x20across\x2011\x20object\x20types\x20—\x20guard/machine/service/order/progress/arbitration/treasury/permission/passport/allocation/reward;\x20omit\x20\x27template\x27\x20to\x20list\x20metadata,\x20provide\x20\x27template\x27\x20for\x20full\x20detail,\x20provide\x20\x27template\x27\x20+\x20\x27params\x27\x20to\x20instantiate\x20into\x20executable\x20JSON),\x20\x27analyze_guard_semantics\x27\x20(parse\x20+\x20evaluate\x20any\x20Guard\x20JSON:\x20rendered\x20logic\x20tree,\x20lint\x20diagnostics,\x20risk\x20assessment,\x20and\x20a\x20party-perspective\x20reading\x20—\x20who\x20can\x20trigger,\x20under\x20what\x20conditions,\x20with\x20what\x20evidence.\x20Both\x20transacting\x20parties\x20should\x20run\x20this\x20BEFORE\x20relying\x20on\x20a\x20Guard).'),'name':z['string']()['optional']()['describe']('Schema/tool\x20name\x20for\x20\x27get\x27/\x27get_output\x27/\x27get_field\x27/\x27get_tool_reference\x27\x20action\x20(e.g.,\x20\x27onchain_operations\x27,\x20\x27onchain_operations_machine\x27),\x20or\x20pattern\x20id\x20for\x20\x27get_guard_design_patterns\x27\x20(e.g.,\x20\x27pattern.identity_check_allowlist\x27).'),'query':z['string']()['optional']()['describe']('Search\x20query\x20for\x20\x27search\x27\x20action,\x20keyword\x20filter\x20for\x20\x27get_tool_reference\x27,\x20or\x20host\x20filter\x20for\x20\x27get_guard_design_patterns\x27\x20(e.g.\x20\x27service_buy_guard\x27,\x20\x27machine_forward\x27,\x20\x27reward_claim\x27).'),'field_path':z['string']()['optional']()['describe']('Dot-separated\x20field\x20path\x20for\x20\x27get_field\x27\x20action\x20(e.g.\x20\x27data.node\x27,\x20\x27data.node.nodes.0.pairs\x27).\x20Navigates\x20schema.properties.*\x20and\x20schema.items.*.'),'template':z['string']()['optional']()['describe']('Guard\x20template\x20name\x20for\x20\x27get_guard_templates\x27\x20action.\x20Omit\x20to\x20list\x20all\x20available\x20templates.\x20Available:\x20signer_verification,\x20progress_node_check,\x20order_owner_verification,\x20service_belonging_check,\x20reward_not_claimed,\x20combined_reward_guard.\x20For\x20\x27get_templates\x27:\x20unified\x20template\x20id\x20(e.g.\x20\x27tpl_buy_guard_whitelist\x27,\x20\x27tpl_machine_ecommerce_standard\x27,\x20\x27T-S-01\x27,\x20\x27T-O-01\x27,\x20\x27first_order\x27).'),'object_type':z['enum'](['guard','machine','service','order','progress','arbitration','treasury','permission','passport','allocation','reward'])['optional']()['describe']('Object-type\x20filter\x20for\x20\x27get_templates\x27\x20list\x20mode\x20(e.g.\x20\x27guard\x27\x20lists\x20only\x20Guard\x20templates).'),'params':z['string']()['optional']()['describe']('JSON-encoded\x20parameter\x20object\x20for\x20\x27get_templates\x27\x20instantiation\x20mode\x20(e.g.\x20\x27{\x22whitelist\x22:[\x220xabc\x22]}\x27).\x20Required\x20params\x20are\x20declared\x20in\x20each\x20template\x27s\x20\x27parameters\x27\x20list\x20(see\x20detail\x20mode).'),'output_file':z['string']()['optional']()['describe']('When\x20set,\x20writes\x20the\x20response\x20data\x20to\x20this\x20file\x20path\x20(relative\x20to\x20cwd)\x20and\x20returns\x20the\x20path\x20instead\x20of\x20inline\x20data.\x20Use\x20for\x20large\x20schemas\x20that\x20would\x20be\x20truncated.\x20Prefer\x20workspace\x20paths\x20like\x20\x27.trae/tmp/schema.json\x27\x20so\x20the\x20Read\x20tool\x20can\x20access\x20them.'),'guard':z['union']([z['string'](),z['record'](z['string'](),z['unknown']())])['optional']()['describe']('Guard\
|
|
1
|
+
import{z}from'zod';export const SchemaQueryInputSchema=z['object']({'action':z['enum'](['list','get','get_output','search','list_operations','get_guard_templates','get_field','get_tool_reference','get_guard_design_patterns','get_safety_rules','get_templates','analyze_guard_semantics'])['describe']('Action\x20to\x20perform:\x20\x27list\x27\x20(all\x20schemas),\x20\x27get\x27\x20(specific\x20input\x20schema),\x20\x27get_output\x27\x20(tool\x20output\x20schema),\x20\x27get_field\x27\x20(field-path\x20query\x20e.g.\x20field_path=\x27data.node\x27),\x20\x27search\x27\x20(by\x20keyword),\x20\x27list_operations\x27\x20(on-chain\x20operations),\x20\x27get_guard_templates\x27\x20(Guard\x20creation\x20templates\x20+\x20best\x20practices),\x20\x27get_tool_reference\x27\x20(MCP\x20tool\x20usage\x20reference:\x20summaries,\x20actions,\x20prerequisites,\x20notes\x20—\x20sunk\x20from\x20wowok-tools\x20skill),\x20\x27get_guard_design_patterns\x27\x20(curated\x20Guard\x20design\x20pattern\x20catalog:\x20business\x20requirement\x20→\x20logic\x20tree\x20template\x20—\x20sunk\x20from\x20wowok-guard\x20skill),\x20\x27get_safety_rules\x27\x20(object\x20reuse/immutability/operation-classification/naming\x20rules\x20—\x20sunk\x20from\x20wowok-safety\x20skill),\x20\x27get_templates\x27\x20(unified\x20template\x20registry:\x20~90\x20parameterized\x20templates\x20across\x2011\x20object\x20types\x20—\x20guard/machine/service/order/progress/arbitration/treasury/permission/passport/allocation/reward;\x20omit\x20\x27template\x27\x20to\x20list\x20metadata,\x20provide\x20\x27template\x27\x20for\x20full\x20detail,\x20provide\x20\x27template\x27\x20+\x20\x27params\x27\x20to\x20instantiate\x20into\x20executable\x20JSON),\x20\x27analyze_guard_semantics\x27\x20(parse\x20+\x20evaluate\x20any\x20Guard\x20JSON:\x20rendered\x20logic\x20tree,\x20lint\x20diagnostics,\x20risk\x20assessment,\x20and\x20a\x20party-perspective\x20reading\x20—\x20who\x20can\x20trigger,\x20under\x20what\x20conditions,\x20with\x20what\x20evidence.\x20Both\x20transacting\x20parties\x20should\x20run\x20this\x20BEFORE\x20relying\x20on\x20a\x20Guard).'),'name':z['string']()['optional']()['describe']('Schema/tool\x20name\x20for\x20\x27get\x27/\x27get_output\x27/\x27get_field\x27/\x27get_tool_reference\x27\x20action\x20(e.g.,\x20\x27onchain_operations\x27,\x20\x27onchain_operations_machine\x27),\x20or\x20pattern\x20id\x20for\x20\x27get_guard_design_patterns\x27\x20(e.g.,\x20\x27pattern.identity_check_allowlist\x27).'),'query':z['string']()['optional']()['describe']('Search\x20query\x20for\x20\x27search\x27\x20action,\x20keyword\x20filter\x20for\x20\x27get_tool_reference\x27,\x20or\x20host\x20filter\x20for\x20\x27get_guard_design_patterns\x27\x20(e.g.\x20\x27service_buy_guard\x27,\x20\x27machine_forward\x27,\x20\x27reward_claim\x27).'),'field_path':z['string']()['optional']()['describe']('Dot-separated\x20field\x20path\x20for\x20\x27get_field\x27\x20action\x20(e.g.\x20\x27data.node\x27,\x20\x27data.node.nodes.0.pairs\x27).\x20Navigates\x20schema.properties.*\x20and\x20schema.items.*.'),'template':z['string']()['optional']()['describe']('Guard\x20template\x20name\x20for\x20\x27get_guard_templates\x27\x20action.\x20Omit\x20to\x20list\x20all\x20available\x20templates.\x20Available:\x20signer_verification,\x20progress_node_check,\x20order_owner_verification,\x20service_belonging_check,\x20reward_not_claimed,\x20combined_reward_guard.\x20For\x20\x27get_templates\x27:\x20unified\x20template\x20id\x20(e.g.\x20\x27tpl_buy_guard_whitelist\x27,\x20\x27tpl_machine_ecommerce_standard\x27,\x20\x27T-S-01\x27,\x20\x27T-O-01\x27,\x20\x27first_order\x27).'),'object_type':z['enum'](['guard','machine','service','order','progress','arbitration','treasury','permission','passport','allocation','reward'])['optional']()['describe']('Object-type\x20filter\x20for\x20\x27get_templates\x27\x20list\x20mode\x20(e.g.\x20\x27guard\x27\x20lists\x20only\x20Guard\x20templates).'),'params':z['string']()['optional']()['describe']('JSON-encoded\x20parameter\x20object\x20for\x20\x27get_templates\x27\x20instantiation\x20mode\x20(e.g.\x20\x27{\x22whitelist\x22:[\x220xabc\x22]}\x27).\x20Required\x20params\x20are\x20declared\x20in\x20each\x20template\x27s\x20\x27parameters\x27\x20list\x20(see\x20detail\x20mode).'),'output_file':z['string']()['optional']()['describe']('When\x20set,\x20writes\x20the\x20response\x20data\x20to\x20this\x20file\x20path\x20(relative\x20to\x20cwd)\x20and\x20returns\x20the\x20path\x20instead\x20of\x20inline\x20data.\x20Use\x20for\x20large\x20schemas\x20that\x20would\x20be\x20truncated.\x20Prefer\x20workspace\x20paths\x20like\x20\x27.trae/tmp/schema.json\x27\x20so\x20the\x20Read\x20tool\x20can\x20access\x20them.'),'guard':z['union']([z['string'](),z['record'](z['string'](),z['unknown']())])['optional']()['describe']('Guard\x20for\x20\x27analyze_guard_semantics\x27\x20action.\x20THREE\x20accepted\x20forms:\x20(1)\x20Guard\x20JSON\x20object,\x20(2)\x20JSON-encoded\x20string\x20(the\x20guard2file\x20export\x20format:\x20{description?,\x20table:\x20[...],\x20root:\x20{...},\x20rely?,\x20binding_hint?}),\x20(3)\x20an\x20on-chain\x20Guard\x20ADDRESS\x20(0x...)\x20or\x20LocalMark\x20name\x20—\x20loaded\x20from\x20chain\x20automatically.\x20Forms\x20(1)/(2)\x20analyze\x20a\x20local\x20definition;\x20form\x20(3)\x20analyzes\x20the\x20LIVE\x20on-chain\x20Guard.'),'binding':z['enum'](['buy','forward','allocate','claim_reward','vote','dispute','write_repository','submit_progress','gen_passport','custom'])['optional']()['describe']('Optional\x20business-slot\x20binding\x20for\x20\x27analyze_guard_semantics\x27\x20(G1).\x20When\x20set,\x20the\x20analysis\x20includes\x20the\x20slot\x27s\x20business\x20semantics\x20(what\x20the\x20Guard\x20means,\x20what\x20your\x20submission\x20means,\x20pass/fail\x20consequences,\x20stakes).\x20E.g.\x20\x27buy\x27\x20for\x20a\x20Service.buy_guard,\x20\x27forward\x27\x20for\x20a\x20Machine\x20Forward.guard,\x20\x27allocate\x27\x20when\x20the\x20submission\x20identifies\x20a\x20payment\x20recipient.'),'network':z['enum'](['mainnet','testnet'])['optional']()['describe']('Network\x20for\x20\x27analyze_guard_semantics\x27\x20when\x20the\x20guard\x20is\x20given\x20as\x20an\x20on-chain\x20address/name\x20(G1).\x20Defaults\x20to\x20the\x20configured\x20network.')})['strict']();const SchemaListItemSchema=z['object']({'name':z['string']()['describe']('Schema/tool\x20identifier\x20(e.g.\x20\x27onchain_operations\x27).'),'title':z['string']()['optional']()['describe']('Human-readable\x20title,\x20if\x20known.'),'description':z['string']()['optional']()['describe']('Short\x20description,\x20if\x20known.')})['strict']();export const SchemaQueryOutputSchema=z['object']({'success':z['boolean']()['describe']('Whether\x20the\x20request\x20was\x20successful'),'action':z['string']()['describe']('The\x20action\x20that\x20was\x20performed'),'data':z['union']([z['array'](SchemaListItemSchema)['describe']('List\x20of\x20schema\x20summaries\x20(list/search/list_operations).'),z['record'](z['string'](),z['unknown']())['describe']('JSON\x20Schema\x20object\x20(get/get_output/get_field),\x20Guard\x20template\x20data,\x20tool\x20reference\x20data\x20(get_tool_reference),\x20Guard\x20design\x20pattern\x20catalog\x20(get_guard_design_patterns),\x20or\x20safety\x20rules\x20tables\x20(get_safety_rules).'),z['null']()['describe']('No\x20data\x20—\x20lookup\x20failed\x20or\x20returned\x20nothing,\x20or\x20data\x20was\x20written\x20to\x20output_file.')])['describe']('Response\x20data\x20—\x20array\x20of\x20schema\x20summaries\x20for\x20list-like\x20actions,\x20JSON\x20Schema\x20object\x20for\x20get/get_output/get_field,\x20Guard\x20template\x20data\x20for\x20get_guard_templates,\x20null\x20on\x20failure\x20or\x20when\x20output_file\x20is\x20used.'),'message':z['string']()['describe']('Human-readable\x20message\x20describing\x20the\x20result'),'suggestions':z['array'](z['string']())['optional']()['describe']('Suggested\x20next\x20steps\x20or\x20alternatives'),'output_file_path':z['string']()['optional']()['describe']('When\x20output_file\x20is\x20used,\x20contains\x20the\x20absolute\x20file\x20path\x20where\x20data\x20was\x20written.')})['strict']();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as a332a from'@wowok/wowok';const SDK_SCHEMA_VERSION=a332a['SCHEMA_VERSION']??'1.0.0',checkSchemaCompatibility=a332a['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']}};}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const StrategyReviewOperationInputSchema: z.ZodObject<{
|
|
3
|
+
action: z.ZodEnum<{
|
|
4
|
+
review: "review";
|
|
5
|
+
collect: "collect";
|
|
6
|
+
list_snapshots: "list_snapshots";
|
|
7
|
+
}>;
|
|
8
|
+
account: z.ZodString;
|
|
9
|
+
industry: z.ZodString;
|
|
10
|
+
posture: z.ZodOptional<z.ZodEnum<{
|
|
11
|
+
balanced: "balanced";
|
|
12
|
+
volume: "volume";
|
|
13
|
+
margin: "margin";
|
|
14
|
+
}>>;
|
|
15
|
+
network: z.ZodOptional<z.ZodEnum<{
|
|
16
|
+
testnet: "testnet";
|
|
17
|
+
mainnet: "mainnet";
|
|
18
|
+
}>>;
|
|
19
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
no_cache: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
discovery_terms: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export declare const StrategyReviewOperationOutputSchema: z.ZodObject<{
|
|
24
|
+
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
25
|
+
action: z.ZodLiteral<"collect">;
|
|
26
|
+
snapshot_id: z.ZodString;
|
|
27
|
+
stored: z.ZodBoolean;
|
|
28
|
+
storage_error: z.ZodOptional<z.ZodString>;
|
|
29
|
+
posture: z.ZodEnum<{
|
|
30
|
+
balanced: "balanced";
|
|
31
|
+
volume: "volume";
|
|
32
|
+
margin: "margin";
|
|
33
|
+
}>;
|
|
34
|
+
collection: z.ZodObject<{
|
|
35
|
+
account: z.ZodString;
|
|
36
|
+
industry: z.ZodString;
|
|
37
|
+
network: z.ZodString;
|
|
38
|
+
collected_at: z.ZodNumber;
|
|
39
|
+
metrics: z.ZodArray<z.ZodObject<{
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
source: z.ZodString;
|
|
42
|
+
status: z.ZodEnum<{
|
|
43
|
+
error: "error";
|
|
44
|
+
ok: "ok";
|
|
45
|
+
unavailable: "unavailable";
|
|
46
|
+
}>;
|
|
47
|
+
value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
48
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
49
|
+
collected_at: z.ZodNumber;
|
|
50
|
+
}, z.core.$strip>>;
|
|
51
|
+
unavailable: z.ZodArray<z.ZodString>;
|
|
52
|
+
errors: z.ZodArray<z.ZodString>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
55
|
+
action: z.ZodLiteral<"review">;
|
|
56
|
+
review: z.ZodObject<{
|
|
57
|
+
account: z.ZodString;
|
|
58
|
+
industry: z.ZodString;
|
|
59
|
+
posture: z.ZodEnum<{
|
|
60
|
+
balanced: "balanced";
|
|
61
|
+
volume: "volume";
|
|
62
|
+
margin: "margin";
|
|
63
|
+
}>;
|
|
64
|
+
generated_at: z.ZodNumber;
|
|
65
|
+
scorecard: z.ZodObject<{
|
|
66
|
+
posture: z.ZodEnum<{
|
|
67
|
+
balanced: "balanced";
|
|
68
|
+
volume: "volume";
|
|
69
|
+
margin: "margin";
|
|
70
|
+
}>;
|
|
71
|
+
overall: z.ZodNullable<z.ZodNumber>;
|
|
72
|
+
scored_metric_count: z.ZodNumber;
|
|
73
|
+
metric_scores: z.ZodArray<z.ZodObject<{
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
label: z.ZodString;
|
|
76
|
+
status: z.ZodEnum<{
|
|
77
|
+
error: "error";
|
|
78
|
+
ok: "ok";
|
|
79
|
+
unavailable: "unavailable";
|
|
80
|
+
}>;
|
|
81
|
+
value: z.ZodNullable<z.ZodNumber>;
|
|
82
|
+
weight: z.ZodNumber;
|
|
83
|
+
score: z.ZodNullable<z.ZodNumber>;
|
|
84
|
+
delta: z.ZodNullable<z.ZodObject<{
|
|
85
|
+
id: z.ZodString;
|
|
86
|
+
from: z.ZodNumber;
|
|
87
|
+
to: z.ZodNumber;
|
|
88
|
+
change: z.ZodNumber;
|
|
89
|
+
direction: z.ZodEnum<{
|
|
90
|
+
flat: "flat";
|
|
91
|
+
up: "up";
|
|
92
|
+
down: "down";
|
|
93
|
+
}>;
|
|
94
|
+
improved: z.ZodNullable<z.ZodBoolean>;
|
|
95
|
+
}, z.core.$strip>>;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
unavailable: z.ZodArray<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
cadence: z.ZodObject<{
|
|
100
|
+
cadence_days: z.ZodNumber;
|
|
101
|
+
days_since_last: z.ZodNullable<z.ZodNumber>;
|
|
102
|
+
due: z.ZodBoolean;
|
|
103
|
+
next_review_after: z.ZodNullable<z.ZodNumber>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
summary: z.ZodString;
|
|
106
|
+
findings: z.ZodArray<z.ZodString>;
|
|
107
|
+
recommendations: z.ZodArray<z.ZodString>;
|
|
108
|
+
proposals: z.ZodArray<z.ZodObject<{
|
|
109
|
+
id: z.ZodString;
|
|
110
|
+
rationale: z.ZodString;
|
|
111
|
+
target_layer: z.ZodLiteral<"current">;
|
|
112
|
+
delta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
113
|
+
apply_via: z.ZodObject<{
|
|
114
|
+
tool: z.ZodLiteral<"persona_operation">;
|
|
115
|
+
action: z.ZodLiteral<"apply_delta">;
|
|
116
|
+
note: z.ZodString;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
unavailable: z.ZodArray<z.ZodString>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
previous_snapshot_id: z.ZodNullable<z.ZodString>;
|
|
122
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
123
|
+
action: z.ZodLiteral<"list_snapshots">;
|
|
124
|
+
snapshots: z.ZodArray<z.ZodObject<{
|
|
125
|
+
id: z.ZodString;
|
|
126
|
+
account: z.ZodString;
|
|
127
|
+
industry: z.ZodString;
|
|
128
|
+
posture: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
129
|
+
balanced: "balanced";
|
|
130
|
+
volume: "volume";
|
|
131
|
+
margin: "margin";
|
|
132
|
+
}>>>;
|
|
133
|
+
collected_at: z.ZodNumber;
|
|
134
|
+
created_at: z.ZodNumber;
|
|
135
|
+
}, z.core.$strip>>;
|
|
136
|
+
}, z.core.$strip>], "action">;
|
|
137
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from'zod';const PostureEnum=z['enum'](['volume','balanced','margin']),NetworkEnum=z['enum'](['mainnet','testnet']),CollectedMetricSchema=z['object']({'id':z['string']()['describe']('Catalog\x20metric\x20id,\x20e.g.\x20order_count,\x20repeat_customer_rate.'),'source':z['string']()['describe']('Which\x20evidence\x20source\x20produced\x20it.'),'status':z['enum'](['ok','unavailable','error'])['describe']('ok\x20=\x20value\x20present;\x20unavailable\x20=\x20source\x20returned\x20no\x20evidence;\x20error\x20=\x20source\x20failed\x20(degraded,\x20never\x20zero-filled).'),'value':z['number']()['nullable']()['optional'](),'reason':z['string']()['optional']()['describe']('Why\x20status\x20is\x20unavailable/error,\x20when\x20known.'),'collected_at':z['number']()}),ScorecardCollectionSchema=z['object']({'account':z['string'](),'industry':z['string'](),'network':z['string'](),'collected_at':z['number'](),'metrics':z['array'](CollectedMetricSchema),'unavailable':z['array'](z['string']())['describe']('Metric\x20ids\x20with\x20no\x20evidence\x20this\x20cycle.'),'errors':z['array'](z['string']())['describe']('Evidence\x20sources\x20that\x20failed\x20this\x20cycle.')}),MetricDeltaSchema=z['object']({'id':z['string'](),'from':z['number'](),'to':z['number'](),'change':z['number'](),'direction':z['enum'](['up','down','flat']),'improved':z['boolean']()['nullable']()['describe']('Whether\x20the\x20change\x20is\x20good\x20for\x20this\x20metric;\x20null\x20when\x20flat/unoriented.')}),MetricScoreSchema=z['object']({'id':z['string'](),'label':z['string'](),'status':z['enum'](['ok','unavailable','error']),'value':z['number']()['nullable'](),'weight':z['number']()['describe']('Posture-specific\x20weight\x20actually\x20applied.'),'score':z['number']()['nullable']()['describe']('0–100\x20anchored\x20score;\x20null\x20for\x20contextual/unavailable\x20metrics.'),'delta':MetricDeltaSchema['nullable']()}),StrategyProposalSchema=z['object']({'id':z['string'](),'rationale':z['string'](),'target_layer':z['literal']('current')['describe']('AI-generated\x20proposals\x20may\x20only\x20touch\x20the\x20CURRENT\x20persona\x20layer.'),'delta':z['record'](z['string'](),z['unknown']())['describe']('Partial\x20PersonaLayer\x20to\x20merge;\x20applied\x20ONLY\x20via\x20explicit\x20user\x20confirmation.'),'apply_via':z['object']({'tool':z['literal']('persona_operation'),'action':z['literal']('apply_delta'),'note':z['string']()})}),ReviewCadenceSchema=z['object']({'cadence_days':z['number'](),'days_since_last':z['number']()['nullable'](),'due':z['boolean'](),'next_review_after':z['number']()['nullable']()}),ScorecardScoreSchema=z['object']({'posture':PostureEnum,'overall':z['number']()['nullable']()['describe']('0–100\x20renormalized\x20over\x20available\x20anchored\x20metrics;\x20null\x20when\x20no\x20SHOP-performance\x20evidence\x20exists\x20(market-environment\x20metrics\x20alone\x20never\x20grade\x20the\x20shop).'),'scored_metric_count':z['number'](),'metric_scores':z['array'](MetricScoreSchema),'unavailable':z['array'](z['string']())}),StrategyReviewSchema=z['object']({'account':z['string'](),'industry':z['string'](),'posture':PostureEnum,'generated_at':z['number'](),'scorecard':ScorecardScoreSchema,'cadence':ReviewCadenceSchema,'summary':z['string']()['describe']('Markdown\x20review\x20card\x20body.'),'findings':z['array'](z['string']()),'recommendations':z['array'](z['string']()),'proposals':z['array'](StrategyProposalSchema)['describe']('At\x20most\x20two\x20current-layer\x20proposals;\x20NEVER\x20applied\x20automatically.'),'unavailable':z['array'](z['string']())});export const StrategyReviewOperationInputSchema=z['object']({'action':z['enum'](['collect','review','list_snapshots'])['describe']('collect\x20=\x20gather\x20fresh\x20on-chain/derived\x20evidence,\x20persist\x20ONE\x20local\x20snapshot\x20(append-only\x20SQLite\x20KV),\x20return\x20the\x20raw\x20collection;\x20'+'review\x20=\x20gather\x20fresh\x20evidence\x20WITHOUT\x20persisting,\x20diff\x20against\x20the\x20latest\x20stored\x20snapshot,\x20score\x20under\x20the\x20persona\x20posture\x20and\x20assemble\x20findings/recommendations/current-layer\x20proposals\x20(proposals\x20are\x20never\x20auto-applied);\x20'+'list_snapshots\x20=\x20list\x20stored\x20snapshot\x20summaries\x20for\x20account+industry.'),'account':z['string']()['describe']('Chain\x20account\x20address.\x20Required\x20for\x20every\x20action\x20(scope\x20of\x20evidence\x20and\x20snapshots).'),'industry':z['string']()['describe']('Industry\x20id\x20(e.g.\x20education,\x20rental,\x20freelance,\x20subscription,\x20travel,\x20retail,\x20or\x20a\x20pack-registered\x20id).\x20Required\x20for\x20every\x20action.'),'posture':PostureEnum['optional']()['describe']('Override\x20the\x20scoring\x20posture.\x20Defaults\x20to\x20the\x20merchant\x20posture\x20in\x20the\x20effective\x20persona,\x20then\x20\x27balanced\x27.'),'network':NetworkEnum['optional']()['describe']('Network\x20for\x20evidence\x20queries\x20(default\x20testnet).'),'limit':z['number']()['int']()['min'](0x1)['max'](0xc8)['optional']()['describe']('Max\x20records\x20per\x20evidence\x20query\x20(default\x20follows\x20the\x20fetchers).'),'no_cache':z['boolean']()['optional']()['describe']('Bypass\x20caches\x20in\x20evidence\x20fetchers.'),'discovery_terms':z['array'](z['string']())['optional']()['describe']('Override\x20discovery\x20search\x20terms\x20for\x20service/competitor\x20enumeration\x20(default:\x20built-in\x20bilingual\x20terms\x20for\x20the\x20industry).')})['strict']();export const StrategyReviewOperationOutputSchema=z['object']({'result':z['discriminatedUnion']('action',[z['object']({'action':z['literal']('collect'),'snapshot_id':z['string'](),'stored':z['boolean']()['describe']('Whether\x20the\x20snapshot\x20was\x20persisted\x20(false\x20=\x20storage\x20failed\x20fail-soft;\x20collection\x20still\x20returned).'),'storage_error':z['string']()['optional'](),'posture':PostureEnum,'collection':ScorecardCollectionSchema}),z['object']({'action':z['literal']('review'),'review':StrategyReviewSchema,'previous_snapshot_id':z['string']()['nullable']()['describe']('Snapshot\x20id\x20the\x20deltas\x20were\x20computed\x20against;\x20null\x20when\x20there\x20is\x20no\x20history.')}),z['object']({'action':z['literal']('list_snapshots'),'snapshots':z['array'](z['object']({'id':z['string'](),'account':z['string'](),'industry':z['string'](),'posture':PostureEnum['nullable']()['optional'](),'collected_at':z['number'](),'created_at':z['number']()}))})])})['strict']();
|
|
@@ -27,8 +27,8 @@ export declare const TrustScoreInputSchema: z.ZodObject<{
|
|
|
27
27
|
}, z.core.$strict>>;
|
|
28
28
|
value_orientation: z.ZodOptional<z.ZodEnum<{
|
|
29
29
|
budget: "budget";
|
|
30
|
-
quality: "quality";
|
|
31
30
|
balanced: "balanced";
|
|
31
|
+
quality: "quality";
|
|
32
32
|
}>>;
|
|
33
33
|
discount_sensitivity: z.ZodOptional<z.ZodNumber>;
|
|
34
34
|
delivery_speed_priority: z.ZodOptional<z.ZodEnum<{
|
|
@@ -39,9 +39,9 @@ export declare const TrustScoreInputSchema: z.ZodObject<{
|
|
|
39
39
|
max_acceptable_cycle: z.ZodOptional<z.ZodNumber>;
|
|
40
40
|
response_time_expectation: z.ZodOptional<z.ZodNumber>;
|
|
41
41
|
merchant_preference: z.ZodOptional<z.ZodEnum<{
|
|
42
|
+
neutral: "neutral";
|
|
42
43
|
established: "established";
|
|
43
44
|
emerging: "emerging";
|
|
44
|
-
neutral: "neutral";
|
|
45
45
|
}>>;
|
|
46
46
|
min_order_history: z.ZodOptional<z.ZodNumber>;
|
|
47
47
|
bargain_hunting: z.ZodOptional<z.ZodNumber>;
|
|
@@ -59,8 +59,8 @@ export declare const TrustScoreInputSchema: z.ZodObject<{
|
|
|
59
59
|
minimal: "minimal";
|
|
60
60
|
}>>;
|
|
61
61
|
risk_appetite: z.ZodOptional<z.ZodEnum<{
|
|
62
|
-
balanced: "balanced";
|
|
63
62
|
conservative: "conservative";
|
|
63
|
+
balanced: "balanced";
|
|
64
64
|
aggressive: "aggressive";
|
|
65
65
|
}>>;
|
|
66
66
|
min_trust_score: z.ZodOptional<z.ZodNumber>;
|
|
@@ -166,8 +166,8 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
|
|
|
166
166
|
advice: z.ZodArray<z.ZodString>;
|
|
167
167
|
dimensions: z.ZodArray<z.ZodObject<{
|
|
168
168
|
name: z.ZodEnum<{
|
|
169
|
-
workflow: "workflow";
|
|
170
169
|
fund: "fund";
|
|
170
|
+
workflow: "workflow";
|
|
171
171
|
trust: "trust";
|
|
172
172
|
behavior: "behavior";
|
|
173
173
|
}>;
|
|
@@ -176,8 +176,8 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
|
|
|
176
176
|
checks: z.ZodArray<z.ZodObject<{
|
|
177
177
|
id: z.ZodString;
|
|
178
178
|
dimension: z.ZodEnum<{
|
|
179
|
-
workflow: "workflow";
|
|
180
179
|
fund: "fund";
|
|
180
|
+
workflow: "workflow";
|
|
181
181
|
trust: "trust";
|
|
182
182
|
behavior: "behavior";
|
|
183
183
|
}>;
|
|
@@ -240,8 +240,8 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
|
|
|
240
240
|
checks: z.ZodArray<z.ZodObject<{
|
|
241
241
|
id: z.ZodString;
|
|
242
242
|
dimension: z.ZodEnum<{
|
|
243
|
-
workflow: "workflow";
|
|
244
243
|
fund: "fund";
|
|
244
|
+
workflow: "workflow";
|
|
245
245
|
trust: "trust";
|
|
246
246
|
behavior: "behavior";
|
|
247
247
|
}>;
|
|
@@ -286,9 +286,9 @@ export declare const WorkflowHistoryViewSchema: z.ZodObject<{
|
|
|
286
286
|
export declare const WorkflowOperationResultSchema: z.ZodObject<{
|
|
287
287
|
action: z.ZodEnum<{
|
|
288
288
|
list: "list";
|
|
289
|
+
task: "task";
|
|
289
290
|
operate: "operate";
|
|
290
291
|
history: "history";
|
|
291
|
-
task: "task";
|
|
292
292
|
}>;
|
|
293
293
|
tasks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
294
294
|
progress: z.ZodString;
|
|
@@ -373,9 +373,9 @@ export declare const WorkflowOperationOutputSchema: z.ZodObject<{
|
|
|
373
373
|
result: z.ZodObject<{
|
|
374
374
|
action: z.ZodEnum<{
|
|
375
375
|
list: "list";
|
|
376
|
+
task: "task";
|
|
376
377
|
operate: "operate";
|
|
377
378
|
history: "history";
|
|
378
|
-
task: "task";
|
|
379
379
|
}>;
|
|
380
380
|
tasks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
381
381
|
progress: z.ZodString;
|
|
@@ -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 a310a,getTemplateDetail,instantiateTemplate,getTemplateCounts,TEMPLATE_OBJECT_TYPES}from'../knowledge/template-registry.js';import{lintGuard,formatLintResult}from'../knowledge/guard-lint.js';import{renderGuardTreeIndented,renderGuardMermaid}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;}}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=a310a(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 I=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20not\x20found','suggestions':I['length']>0x0?I['map'](J=>'Did\x20you\x20mean:\x20'+J['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};}if(h){const J=writeResponseToFile(H,h);if(J)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+J,'output_file_path':J,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+J]};}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 K=getSchemaField(c,f);if(!K)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':K,'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 L=searchSchemas(d);return{'success':!![],'action':b,'data':L,'message':'Found\x20'+L['length']+'\x20schemas\x20matching\x20\x27'+d+'\x27'};}case'list_operations':{const M=listOperations();return{'success':!![],'action':b,'data':M,'message':'Found\x20'+M['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 N=getOutputSchema(c);if(!N){const O=listSchemas(),P=O['find'](R=>R['name']===c);if(P)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 Q=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':Q['length']>0x0?Q['map'](R=>'Did\x20you\x20mean:\x20'+R['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const R=writeResponseToFile(N,h);if(R)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+R,'output_file_path':R,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+R]};}return{'success':!![],'action':b,'data':N,'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)?'];function walkGuardTree(a,b){const c=[a];while(c['length']>0x0){const d=c['pop']();if(!d||typeof d!=='object')continue;b(d);if(Array['isArray'](d['nodes']))c['push'](...d['nodes']);if(d['node'])c['push'](d['node']);if(d['nodeLeft'])c['push'](d['nodeLeft']);if(d['nodeRight'])c['push'](d['nodeRight']);if(Array['isArray'](d['parameters']))c['push'](...d['parameters']);if(d['historyIdx'])c['push'](d['historyIdx']);if(d['sessionIdx'])c['push'](d['sessionIdx']);if(d['forwardIdx'])c['push'](d['forwardIdx']);if(d['where'])c['push'](d['where']);if(d['find'])c['push'](d['find']);if(d['objectLeft'])c['push'](d['objectLeft']);if(d['objectRight'])c['push'](d['objectRight']);if(d['recipient'])c['push'](d['recipient']);}}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}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 a344a,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;}}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=a344a(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 I=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20not\x20found','suggestions':I['length']>0x0?I['map'](J=>'Did\x20you\x20mean:\x20'+J['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};}if(h){const J=writeResponseToFile(H,h);if(J)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+J,'output_file_path':J,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+J]};}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 K=getSchemaField(c,f);if(!K)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':K,'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 L=searchSchemas(d);return{'success':!![],'action':b,'data':L,'message':'Found\x20'+L['length']+'\x20schemas\x20matching\x20\x27'+d+'\x27'};}case'list_operations':{const M=listOperations();return{'success':!![],'action':b,'data':M,'message':'Found\x20'+M['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 N=getOutputSchema(c);if(!N){const O=listSchemas(),P=O['find'](R=>R['name']===c);if(P)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 Q=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':Q['length']>0x0?Q['map'](R=>'Did\x20you\x20mean:\x20'+R['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const R=writeResponseToFile(N,h);if(R)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+R,'output_file_path':R,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+R]};}return{'success':!![],'action':b,'data':N,'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};
|
|
@@ -2214,11 +2214,15 @@
|
|
|
2214
2214
|
"additionalProperties": false
|
|
2215
2215
|
},
|
|
2216
2216
|
"get": {
|
|
2217
|
-
"description": "Result of
|
|
2217
|
+
"description": "Result of producing a coin object with the required balance (on-chain split/merge + self-delivery transaction)",
|
|
2218
2218
|
"type": "object",
|
|
2219
2219
|
"properties": {
|
|
2220
2220
|
"coin_address": {
|
|
2221
|
-
"description": "
|
|
2221
|
+
"description": "Coin object ID carrying at least the required balance (split/merged + self-delivered on-chain)",
|
|
2222
|
+
"type": "string"
|
|
2223
|
+
},
|
|
2224
|
+
"digest": {
|
|
2225
|
+
"description": "Digest of the on-chain split/merge + self-delivery transaction that produced coin_address; absent only when no transaction was executed",
|
|
2222
2226
|
"type": "string"
|
|
2223
2227
|
},
|
|
2224
2228
|
"name_or_address": {
|
|
@@ -2234,7 +2238,7 @@
|
|
|
2234
2238
|
"type": "number"
|
|
2235
2239
|
}
|
|
2236
2240
|
],
|
|
2237
|
-
"description": "Required coin object balance"
|
|
2241
|
+
"description": "Required coin object balance (raw smallest units executed on-chain)"
|
|
2238
2242
|
},
|
|
2239
2243
|
"token_type": {
|
|
2240
2244
|
"description": "Token type; default token type is 0x2::wow::WOW",
|
|
@@ -2390,7 +2394,7 @@
|
|
|
2390
2394
|
"rule_id"
|
|
2391
2395
|
],
|
|
2392
2396
|
"additionalProperties": false,
|
|
2393
|
-
"description": "Pending confirmation — the transfer was NOT executed. Read message first; if the user consents, re-invoke the SAME call with transfer.confirmed=true."
|
|
2397
|
+
"description": "Pending confirmation — the on-chain fund movement (transfer or get) was NOT executed. Read message first; if the user consents, re-invoke the SAME call with transfer.confirmed=true or get.confirmed=true."
|
|
2394
2398
|
}
|
|
2395
2399
|
],
|
|
2396
2400
|
"description": "Account operation output schema with discriminator"
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
"additionalProperties": false
|
|
156
156
|
},
|
|
157
157
|
"get": {
|
|
158
|
-
"description": "
|
|
158
|
+
"description": "💰 FUND MOVEMENT (on-chain, irreversible, spends gas): split/merge the account's coins to produce a coin object carrying AT LEAST the required balance, then self-deliver it to the same account. The account's total balance does not leave the account (minus gas), but a real on-chain transaction IS executed and its digest is returned. Amount parsing: display strings like \"2.5WOW\" are converted to raw smallest units with the token's decimals; bare decimal numbers are rejected. Requires confirmation — first call previews, re-call with confirmed=true.",
|
|
159
159
|
"type": "object",
|
|
160
160
|
"properties": {
|
|
161
161
|
"name_or_address": {
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
"type": "number"
|
|
172
172
|
}
|
|
173
173
|
],
|
|
174
|
-
"description": "Required balance
|
|
174
|
+
"description": "Required coin object balance. Accepts: raw smallest-unit integer (string/number, e.g. \"2500000000\"), or display format with the token symbol (e.g. \"2.5WOW\") — converted with the token's own decimals. Bare decimals like \"2.5\" or 2.5 are REJECTED (must carry the symbol suffix)."
|
|
175
175
|
},
|
|
176
176
|
"token_type": {
|
|
177
177
|
"description": "Token type; default token type is 0x2::wow::WOW",
|
|
@@ -185,6 +185,10 @@
|
|
|
185
185
|
"mainnet"
|
|
186
186
|
],
|
|
187
187
|
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Recreate all objects on the target network via onchain_operations with env.network=target_network, then re-register the LocalMark names."
|
|
188
|
+
},
|
|
189
|
+
"confirmed": {
|
|
190
|
+
"description": "ConfirmGate: set to true to proceed after a 'pending_confirmation' result. Producing the coin object is an on-chain transaction (split/merge coins + self-transfer) that is irreversible and spends gas — the first call returns a pending_confirmation preview (amount, token, account); re-call with confirmed=true after user consent.",
|
|
191
|
+
"type": "boolean"
|
|
188
192
|
}
|
|
189
193
|
},
|
|
190
194
|
"required": [
|
|
@@ -72,13 +72,13 @@
|
|
|
72
72
|
"type": "boolean"
|
|
73
73
|
},
|
|
74
74
|
"network": {
|
|
75
|
+
"description": "Omit in client/chat contexts — the runtime stamps the user's CURRENT network (the client's UI selection). Standalone MCP/CLI: omit to use the current network; set ONLY when the user explicitly names a different network (a mismatch pauses for user confirmation). Never guess or hardcode a network.",
|
|
75
76
|
"type": "string",
|
|
76
77
|
"enum": [
|
|
77
78
|
"localnet",
|
|
78
79
|
"testnet",
|
|
79
80
|
"mainnet"
|
|
80
|
-
]
|
|
81
|
-
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Recreate all objects on the target network via onchain_operations with env.network=target_network, then re-register the LocalMark names."
|
|
81
|
+
]
|
|
82
82
|
},
|
|
83
83
|
"referrer": {
|
|
84
84
|
"description": "Referrer ID. If the user is using the network for the first time, the referrer ID will be recorded (also applied when the SDK auto-registers the sender in the global Entity table).",
|
|
@@ -208,13 +208,13 @@
|
|
|
208
208
|
"type": "boolean"
|
|
209
209
|
},
|
|
210
210
|
"network": {
|
|
211
|
+
"description": "Omit in client/chat contexts — the runtime stamps the user's CURRENT network (the client's UI selection). Standalone MCP/CLI: omit to use the current network; set ONLY when the user explicitly names a different network (a mismatch pauses for user confirmation). Never guess or hardcode a network.",
|
|
211
212
|
"type": "string",
|
|
212
213
|
"enum": [
|
|
213
214
|
"localnet",
|
|
214
215
|
"testnet",
|
|
215
216
|
"mainnet"
|
|
216
|
-
]
|
|
217
|
-
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Recreate all objects on the target network via onchain_operations with env.network=target_network, then re-register the LocalMark names."
|
|
217
|
+
]
|
|
218
218
|
},
|
|
219
219
|
"referrer": {
|
|
220
220
|
"description": "Referrer ID. If the user is using the network for the first time, the referrer ID will be recorded (also applied when the SDK auto-registers the sender in the global Entity table).",
|
|
@@ -318,13 +318,13 @@
|
|
|
318
318
|
"type": "boolean"
|
|
319
319
|
},
|
|
320
320
|
"network": {
|
|
321
|
+
"description": "Omit in client/chat contexts — the runtime stamps the user's CURRENT network (the client's UI selection). Standalone MCP/CLI: omit to use the current network; set ONLY when the user explicitly names a different network (a mismatch pauses for user confirmation). Never guess or hardcode a network.",
|
|
321
322
|
"type": "string",
|
|
322
323
|
"enum": [
|
|
323
324
|
"localnet",
|
|
324
325
|
"testnet",
|
|
325
326
|
"mainnet"
|
|
326
|
-
]
|
|
327
|
-
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Recreate all objects on the target network via onchain_operations with env.network=target_network, then re-register the LocalMark names."
|
|
327
|
+
]
|
|
328
328
|
},
|
|
329
329
|
"referrer": {
|
|
330
330
|
"description": "Referrer ID. If the user is using the network for the first time, the referrer ID will be recorded (also applied when the SDK auto-registers the sender in the global Entity table).",
|
|
@@ -428,13 +428,13 @@
|
|
|
428
428
|
"type": "boolean"
|
|
429
429
|
},
|
|
430
430
|
"network": {
|
|
431
|
+
"description": "Omit in client/chat contexts — the runtime stamps the user's CURRENT network (the client's UI selection). Standalone MCP/CLI: omit to use the current network; set ONLY when the user explicitly names a different network (a mismatch pauses for user confirmation). Never guess or hardcode a network.",
|
|
431
432
|
"type": "string",
|
|
432
433
|
"enum": [
|
|
433
434
|
"localnet",
|
|
434
435
|
"testnet",
|
|
435
436
|
"mainnet"
|
|
436
|
-
]
|
|
437
|
-
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Recreate all objects on the target network via onchain_operations with env.network=target_network, then re-register the LocalMark names."
|
|
437
|
+
]
|
|
438
438
|
},
|
|
439
439
|
"referrer": {
|
|
440
440
|
"description": "Referrer ID. If the user is using the network for the first time, the referrer ID will be recorded (also applied when the SDK auto-registers the sender in the global Entity table).",
|
|
@@ -570,13 +570,13 @@
|
|
|
570
570
|
"type": "boolean"
|
|
571
571
|
},
|
|
572
572
|
"network": {
|
|
573
|
+
"description": "Omit in client/chat contexts — the runtime stamps the user's CURRENT network (the client's UI selection). Standalone MCP/CLI: omit to use the current network; set ONLY when the user explicitly names a different network (a mismatch pauses for user confirmation). Never guess or hardcode a network.",
|
|
573
574
|
"type": "string",
|
|
574
575
|
"enum": [
|
|
575
576
|
"localnet",
|
|
576
577
|
"testnet",
|
|
577
578
|
"mainnet"
|
|
578
|
-
]
|
|
579
|
-
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Recreate all objects on the target network via onchain_operations with env.network=target_network, then re-register the LocalMark names."
|
|
579
|
+
]
|
|
580
580
|
},
|
|
581
581
|
"referrer": {
|
|
582
582
|
"description": "Referrer ID. If the user is using the network for the first time, the referrer ID will be recorded (also applied when the SDK auto-registers the sender in the global Entity table).",
|