@wowok/agent-mcp 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/communication/evidence.d.ts +6 -0
- package/dist/communication/evidence.js +1 -0
- package/dist/evaluation/acceptance.d.ts +24 -0
- package/dist/evaluation/acceptance.js +1 -0
- package/dist/evaluation/builtins/demand-match.d.ts +3 -2
- package/dist/evaluation/builtins/demand-match.js +1 -1
- package/dist/evaluation/builtins/service-risk.d.ts +2 -1
- package/dist/evaluation/builtins/service-risk.js +1 -1
- package/dist/evaluation/index.d.ts +1 -0
- package/dist/evaluation/index.js +1 -1
- package/dist/evaluation/match-operation.d.ts +14 -0
- package/dist/evaluation/match-operation.js +1 -0
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/goal/GoalClassifier.js +1 -1
- package/dist/goal/GoalEngine.d.ts +8 -0
- package/dist/goal/GoalEngine.js +1 -1
- package/dist/goal/types.d.ts +1 -1
- package/dist/harness/auto-escalation.d.ts +0 -12
- package/dist/harness/auto-escalation.js +1 -1
- package/dist/harness/index.d.ts +1 -14
- package/dist/harness/index.js +1 -1
- package/dist/harness/types.d.ts +0 -38
- package/dist/intent/types.d.ts +1 -1
- package/dist/intent/types.js +1 -1
- package/dist/keeper/KeeperScan.d.ts +39 -0
- package/dist/keeper/KeeperScan.js +1 -0
- package/dist/keeper/KeeperStore.d.ts +43 -0
- package/dist/keeper/KeeperStore.js +1 -0
- package/dist/keeper/detectors.d.ts +23 -0
- package/dist/keeper/detectors.js +1 -0
- package/dist/keeper/keeper.spec.d.ts +1 -0
- package/dist/keeper/keeper.spec.js +1 -0
- package/dist/keeper/types.d.ts +65 -0
- package/dist/keeper/types.js +1 -0
- package/dist/knowledge/demand-risk.js +1 -1
- package/dist/knowledge/event-semantics.d.ts +3 -0
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/event-semantics.spec.d.ts +1 -0
- package/dist/knowledge/event-semantics.spec.js +1 -0
- package/dist/knowledge/evidence-review.d.ts +23 -0
- package/dist/knowledge/evidence-review.js +1 -1
- package/dist/knowledge/examples-scanner-cli.js +1 -1
- package/dist/knowledge/examples-scanner.js +1 -1
- package/dist/knowledge/guard-bytecode-spec.d.ts +82 -0
- package/dist/knowledge/guard-bytecode-spec.js +1 -0
- package/dist/knowledge/guard-design-patterns.d.ts +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/index.d.ts +10 -6
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -1
- package/dist/knowledge/mcp-schema-audit.js +1 -1
- package/dist/knowledge/migration-preflight.d.ts +27 -0
- package/dist/knowledge/migration-preflight.js +1 -0
- package/dist/knowledge/scenario-modes.d.ts +1 -1
- package/dist/knowledge/scenario-modes.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 +20 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.d.ts +1 -0
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/monitor/ScopeResolver.js +1 -1
- package/dist/monitor/SuggestionBridge.d.ts +1 -1
- package/dist/monitor/SuggestionBridge.js +1 -1
- package/dist/monitor/SuggestionBridge.spec.d.ts +1 -0
- package/dist/monitor/SuggestionBridge.spec.js +1 -0
- package/dist/monitor/normalize.js +1 -1
- package/dist/monitor/types.d.ts +0 -1
- package/dist/monitor/types.js +1 -1
- package/dist/participation/employee-kpi.d.ts +12 -0
- package/dist/participation/employee-kpi.js +1 -1
- package/dist/participation/employee-kpi.spec.d.ts +1 -0
- package/dist/participation/employee-kpi.spec.js +1 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/mode-actions.d.ts +19 -6
- package/dist/playbooks/service-build/mode-actions.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/relationship/derivation.d.ts +6 -0
- package/dist/relationship/derivation.js +1 -1
- package/dist/relationship/derivation.spec.d.ts +1 -0
- package/dist/relationship/derivation.spec.js +1 -0
- package/dist/role/index.d.ts +2 -2
- package/dist/role/index.js +1 -1
- package/dist/role/model.d.ts +2 -1
- package/dist/role/model.js +1 -1
- package/dist/role/types.d.ts +5 -0
- package/dist/rules.d.ts +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/employee/index.d.ts +61 -1
- package/dist/schema/employee/index.js +1 -1
- package/dist/schema/evaluation/index.d.ts +70 -5
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +43 -7
- package/dist/schema/industry-pack/modes.d.ts +42 -6
- package/dist/schema/industry-pack/modes.js +1 -1
- package/dist/schema/intent-radar/index.d.ts +3 -0
- package/dist/schema/intent-radar/index.js +1 -1
- package/dist/schema/keeper/index.d.ts +475 -0
- package/dist/schema/keeper/index.js +1 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +2 -0
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +34 -0
- package/dist/schema/query/bi.d.ts +188 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +48 -48
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +2 -11
- package/dist/schema/schema-query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/utils/skills-recommendation.js +1 -1
- package/dist/schema/watch/index.d.ts +4 -0
- package/dist/schema/watch/index.js +1 -1
- package/dist/schema-query-impl/index.d.ts +33 -14
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/employee_operation.output.json +100 -0
- package/dist/schemas/employee_operation.schema.json +148 -5
- package/dist/schemas/evaluation_operation.output.json +135 -9
- package/dist/schemas/evaluation_operation.schema.json +176 -7
- package/dist/schemas/index.json +7 -1
- package/dist/schemas/industry_pack_operation.output.json +158 -32
- package/dist/schemas/intent_radar.output.json +2 -0
- package/dist/schemas/intent_radar.schema.json +1 -0
- package/dist/schemas/keeper_operation.output.json +1274 -0
- package/dist/schemas/keeper_operation.schema.json +359 -0
- package/dist/schemas/messenger_operation.schema.json +8 -0
- package/dist/schemas/onchain_events.output.json +55 -11
- package/dist/schemas/onchain_events.schema.json +4 -0
- package/dist/schemas/onchain_table_data.output.json +59 -0
- package/dist/schemas/query_toolkit.output.json +428 -0
- package/dist/schemas/query_toolkit.schema.json +59 -0
- package/dist/schemas/schema_query.output.json +1 -64
- package/dist/schemas/schema_query.schema.json +18 -3
- package/dist/schemas/watch_operation.output.json +21 -1
- package/dist/task/playbook.js +1 -1
- package/dist/task/types.d.ts +1 -1
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/employee.d.ts +6 -0
- package/dist/tools/handlers/employee.js +1 -1
- package/dist/tools/handlers/employee.spec.d.ts +1 -0
- package/dist/tools/handlers/employee.spec.js +1 -0
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/evaluation.spec.d.ts +1 -0
- package/dist/tools/handlers/evaluation.spec.js +1 -0
- package/dist/tools/handlers/intent-radar.js +1 -1
- package/dist/tools/handlers/keeper.d.ts +12 -0
- package/dist/tools/handlers/keeper.js +1 -0
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/handlers/watch.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/agent.d.ts +2 -0
- package/dist/tools/registry/agent.js +1 -0
- package/dist/tools/registry/bridge.d.ts +2 -0
- package/dist/tools/registry/bridge.js +1 -0
- package/dist/tools/registry/business.d.ts +2 -0
- package/dist/tools/registry/business.js +1 -0
- package/dist/tools/registry/config.d.ts +2 -0
- package/dist/tools/registry/config.js +1 -0
- package/dist/tools/registry/files.d.ts +2 -0
- package/dist/tools/registry/files.js +1 -0
- package/dist/tools/registry/identity.d.ts +2 -0
- package/dist/tools/registry/identity.js +1 -0
- package/dist/tools/registry/local.d.ts +2 -0
- package/dist/tools/registry/local.js +1 -0
- package/dist/tools/registry/messenger.d.ts +2 -0
- package/dist/tools/registry/messenger.js +1 -0
- package/dist/tools/registry/monitor.d.ts +2 -0
- package/dist/tools/registry/monitor.js +1 -0
- package/dist/tools/registry/onchain.d.ts +2 -0
- package/dist/tools/registry/onchain.js +1 -0
- package/dist/tools/registry/query.d.ts +2 -0
- package/dist/tools/registry/query.js +1 -0
- package/dist/tools/registry/trust.d.ts +2 -0
- package/dist/tools/registry/trust.js +1 -0
- package/dist/tools/shared.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
- package/dist/examples/arbitration-dispute-create.json +0 -41
- package/dist/examples/arbitration-vote-weighted.json +0 -35
- package/dist/examples/arbitration-voting-guard-add.json +0 -38
- package/dist/examples/demand-present-service.json +0 -33
- package/dist/examples/education-contact-create.json +0 -40
- package/dist/examples/freelance-contact-create.json +0 -40
- package/dist/examples/gen-passport-verify-guard.json +0 -48
- package/dist/examples/guard-template-balance-check.json +0 -59
- package/dist/examples/guard-template-time-lock.json +0 -60
- package/dist/examples/insurance-guard-claim-timelock.json +0 -75
- package/dist/examples/insurance-guard-withdraw-allocation.json +0 -96
- package/dist/examples/insurance-machine-create.json +0 -75
- package/dist/examples/insurance-service-allocators.json +0 -55
- package/dist/examples/machine-multisig-threshold.json +0 -87
- package/dist/examples/machine-publish.json +0 -30
- package/dist/examples/machine-template-7node-rental.json +0 -119
- package/dist/examples/payment-scenario-bound.json +0 -45
- package/dist/examples/rental-ziroom-machine-create.json +0 -148
- package/dist/examples/rental-ziroom-permission-create.json +0 -41
- package/dist/examples/rental-ziroom-service-create.json +0 -36
- package/dist/examples/retail-adv-guard-customer-win-create.json +0 -80
- package/dist/examples/retail-adv-guard-messenger-proof-create.json +0 -65
- package/dist/examples/retail-adv-guard-reward-timeout-create.json +0 -92
- package/dist/examples/retail-adv-reward-guard-add.json +0 -51
- package/dist/examples/retail-myshop-allocation-activate.json +0 -55
- package/dist/examples/retail-myshop-arbitration-create.json +0 -40
- package/dist/examples/retail-myshop-contact-create.json +0 -43
- package/dist/examples/retail-myshop-order-create.json +0 -56
- package/dist/examples/retail-myshop-progress-operate.json +0 -38
- package/dist/examples/retail-myshop-reward-create.json +0 -35
- package/dist/examples/retail-myshop-service-create.json +0 -38
- package/dist/examples/retail-myshop-service-customer-required.json +0 -31
- package/dist/examples/service-discount-issue.json +0 -46
- package/dist/examples/subscription-contact-create.json +0 -40
- package/dist/examples/threebody-guard-create.json +0 -56
- package/dist/examples/threebody-machine-create.json +0 -71
- package/dist/examples/threebody-permission-create.json +0 -38
- package/dist/examples/threebody-service-allocators.json +0 -48
- package/dist/examples/travel-guard-time-lock.json +0 -69
- package/dist/examples/travel-guard-weather-oracle.json +0 -70
- package/dist/examples/travel-machine-create.json +0 -135
- package/dist/examples/travel-repository-create.json +0 -47
- package/dist/examples/travel-service-create.json +0 -34
- package/dist/examples/travel-treasury-create.json +0 -34
- package/dist/examples/treasury-deposit.json +0 -37
- package/dist/examples/treasury-withdraw.json +0 -38
- package/dist/harness/plan.d.ts +0 -33
- package/dist/harness/plan.js +0 -1
- package/dist/knowledge/demand-matching.d.ts +0 -29
- package/dist/knowledge/demand-matching.js +0 -1
- package/dist/knowledge/guard-context.d.ts +0 -56
- package/dist/knowledge/guard-context.js +0 -1
- package/dist/knowledge/guard-migration.d.ts +0 -48
- package/dist/knowledge/guard-migration.js +0 -1
- package/dist/schemas/guard-node-schema.json +0 -1000
- package/dist/task/stage-gate.d.ts +0 -22
- package/dist/task/stage-gate.js +0 -1
|
@@ -8,11 +8,11 @@ export declare const SchemaQueryInputSchema: z.ZodObject<{
|
|
|
8
8
|
get_field: "get_field";
|
|
9
9
|
list_operations: "list_operations";
|
|
10
10
|
get_guard_templates: "get_guard_templates";
|
|
11
|
-
search_examples: "search_examples";
|
|
12
11
|
get_tool_reference: "get_tool_reference";
|
|
13
12
|
get_guard_design_patterns: "get_guard_design_patterns";
|
|
14
13
|
get_safety_rules: "get_safety_rules";
|
|
15
14
|
get_templates: "get_templates";
|
|
15
|
+
analyze_guard_semantics: "analyze_guard_semantics";
|
|
16
16
|
}>;
|
|
17
17
|
name: z.ZodOptional<z.ZodString>;
|
|
18
18
|
query: z.ZodOptional<z.ZodString>;
|
|
@@ -33,6 +33,7 @@ export declare const SchemaQueryInputSchema: z.ZodObject<{
|
|
|
33
33
|
}>>;
|
|
34
34
|
params: z.ZodOptional<z.ZodString>;
|
|
35
35
|
output_file: z.ZodOptional<z.ZodString>;
|
|
36
|
+
guard: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
36
37
|
}, z.core.$strict>;
|
|
37
38
|
export declare const SchemaQueryOutputSchema: z.ZodObject<{
|
|
38
39
|
success: z.ZodBoolean;
|
|
@@ -41,16 +42,6 @@ export declare const SchemaQueryOutputSchema: z.ZodObject<{
|
|
|
41
42
|
name: z.ZodString;
|
|
42
43
|
title: z.ZodOptional<z.ZodString>;
|
|
43
44
|
description: z.ZodOptional<z.ZodString>;
|
|
44
|
-
}, z.core.$strict>>, z.ZodArray<z.ZodObject<{
|
|
45
|
-
file: z.ZodString;
|
|
46
|
-
title: z.ZodString;
|
|
47
|
-
description: z.ZodString;
|
|
48
|
-
tags: z.ZodArray<z.ZodString>;
|
|
49
|
-
industry: z.ZodString;
|
|
50
|
-
operation_type: z.ZodString;
|
|
51
|
-
verified: z.ZodBoolean;
|
|
52
|
-
score: z.ZodNumber;
|
|
53
|
-
matched_fields: z.ZodArray<z.ZodString>;
|
|
54
45
|
}, z.core.$strict>>, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodNull]>;
|
|
55
46
|
message: z.ZodString;
|
|
56
47
|
suggestions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -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','
|
|
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\x20JSON\x20for\x20\x27analyze_guard_semantics\x27\x20action\x20(object\x20or\x20JSON-encoded\x20string).\x20Shape:\x20{description?,\x20table:\x20[{identifier,\x20b_submission?,\x20value_type?,\x20value?,\x20name?,\x20object_type?}],\x20root:\x20{...},\x20rely?:\x20{guards,\x20logic_or?},\x20binding_hint?:\x20{host_object?,\x20binding_field?,\x20action?,\x20sharing_recipients?}}.\x20This\x20is\x20the\x20export\x20format\x20of\x20guard2file\x20/\x20the\x20\x27data\x27\x20payload\x20of\x20onchain_operations\x20guard\x20creation.')})['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 a380a from'@wowok/wowok';const SDK_SCHEMA_VERSION=a380a['SCHEMA_VERSION']??'1.0.0',checkSchemaCompatibility=a380a['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']}};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const SKILLS_BY_OPERATION_TYPE={'service':['wowok-provider'],'machine':['wowok-machine'],'guard':[],'arbitration':['wowok-arbitrator'],'allocation':['wowok-provider'],'permission':[],'treasury':['wowok-provider'],'reward':['wowok-provider'],'repository':['wowok-provider'],'demand':['wowok-provider','wowok-supplier'],'contact':['wowok-messenger'],'order':['wowok-order'],'progress':['wowok-collaborator'],'personal':[],'payment':[],'proof':[]};export function getSkillsHintForOnchain(a,b){const c=SKILLS_BY_OPERATION_TYPE[a];if(!c||c['length']===0x0)return undefined;const d=b?.['publish']===!![],e=!!b?.['order_allocators'],f=d||e,g=f?'SKILLS\x20RECOMMENDED\x20(complex\x20operation\x20—\x20skills\x20provide\x20business-semantic\x20guidance):':'SKILLS\x20RECOMMENDED\x20(optional\x20—\x20skills\x20provide\x20deeper\x20guidance):';return g+'\x20'+c['join'](',\x20')+'.\x20'+'skills\x20focus\x20on\x20business\x20intent\x20→\x20object\x20parameter\x20translation;\x20'+'MCP\x20handles\x20object\x20structure\x20and\x20on-chain\x20execution.\x20'+'If\x20skills\x20are\x20installed,\x20consult\x20them\x20BEFORE\x20this\x20call\x20for\x20design\x20rationale.\x20'+'If\x20not\x20installed,\x20MCP\x20executes\x20independently\x20—\x20this\x20hint\x20is\x20informational\x20only.';}const SKILLS_BY_EVALUATION_ACTION={'match_discover':['wowok-market'],'discover_services':['wowok-market'],'discover_demands':['wowok-market'],'arbitration_score':['wowok-market','wowok-arbitrator'],'account_events':['wowok-market'],'market_metrics':['wowok-market'],'anti_cheat':['wowok-market'],'market_operations':['wowok-market']};export function getSkillsHintForEvaluation(a){const b=SKILLS_BY_EVALUATION_ACTION[a];if(!b||b['length']===0x0)return undefined;return'SKILLS\x20RECOMMENDED\x20(optional\x20—\x20skills\x20provide\x20deeper\x20guidance):\x20'+b['join'](',\x20')+'.\x20'+'skills\x20focus\x20on\x20market/operational\x20intent\x20→\x20action\x20parameters;\x20'+'MCP\x20handles\x20enumeration,\x20scoring\x20and\x20on-chain\x20execution.\x20'+'If\x20not\x20installed,\x20MCP\x20executes\x20independently\x20—\x20this\x20hint\x20is\x20informational\x20only.';}
|
|
1
|
+
const SKILLS_BY_OPERATION_TYPE={'service':['wowok-provider'],'machine':['wowok-machine'],'guard':[],'arbitration':['wowok-arbitrator'],'allocation':['wowok-provider'],'permission':['wowok-governance'],'treasury':['wowok-provider','wowok-governance'],'reward':['wowok-provider'],'repository':['wowok-provider'],'demand':['wowok-provider','wowok-supplier'],'contact':['wowok-messenger'],'order':['wowok-order'],'progress':['wowok-collaborator'],'personal':['wowok-governance'],'payment':[],'proof':[]};export function getSkillsHintForOnchain(a,b){const c=SKILLS_BY_OPERATION_TYPE[a];if(!c||c['length']===0x0)return undefined;const d=b?.['publish']===!![],e=!!b?.['order_allocators'],f=d||e,g=f?'SKILLS\x20RECOMMENDED\x20(complex\x20operation\x20—\x20skills\x20provide\x20business-semantic\x20guidance):':'SKILLS\x20RECOMMENDED\x20(optional\x20—\x20skills\x20provide\x20deeper\x20guidance):';return g+'\x20'+c['join'](',\x20')+'.\x20'+'skills\x20focus\x20on\x20business\x20intent\x20→\x20object\x20parameter\x20translation;\x20'+'MCP\x20handles\x20object\x20structure\x20and\x20on-chain\x20execution.\x20'+'If\x20skills\x20are\x20installed,\x20consult\x20them\x20BEFORE\x20this\x20call\x20for\x20design\x20rationale.\x20'+'If\x20not\x20installed,\x20MCP\x20executes\x20independently\x20—\x20this\x20hint\x20is\x20informational\x20only.';}const SKILLS_BY_EVALUATION_ACTION={'match_discover':['wowok-market'],'discover_services':['wowok-market'],'discover_demands':['wowok-market'],'arbitration_score':['wowok-market','wowok-arbitrator'],'account_events':['wowok-market'],'market_metrics':['wowok-market'],'anti_cheat':['wowok-market'],'market_operations':['wowok-market']};export function getSkillsHintForEvaluation(a){const b=SKILLS_BY_EVALUATION_ACTION[a];if(!b||b['length']===0x0)return undefined;return'SKILLS\x20RECOMMENDED\x20(optional\x20—\x20skills\x20provide\x20deeper\x20guidance):\x20'+b['join'](',\x20')+'.\x20'+'skills\x20focus\x20on\x20market/operational\x20intent\x20→\x20action\x20parameters;\x20'+'MCP\x20handles\x20enumeration,\x20scoring\x20and\x20on-chain\x20execution.\x20'+'If\x20not\x20installed,\x20MCP\x20executes\x20independently\x20—\x20this\x20hint\x20is\x20informational\x20only.';}
|
|
@@ -161,6 +161,10 @@ export declare const WatchOperationOutputSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
161
161
|
prefer: z.ZodArray<z.ZodString>;
|
|
162
162
|
avoid: z.ZodArray<z.ZodString>;
|
|
163
163
|
sensitivity: z.ZodNumber;
|
|
164
|
+
value_proposition: z.ZodObject<{
|
|
165
|
+
offers: z.ZodString;
|
|
166
|
+
seeks: z.ZodString;
|
|
167
|
+
}, z.core.$strict>;
|
|
164
168
|
}, z.core.$strict>>;
|
|
165
169
|
game: z.ZodNullable<z.ZodObject<{
|
|
166
170
|
power: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from'zod';const WatchScenarioEnum=z['enum'](['order','service','demand','arbitration','progress','permission','account','generic']),ReasonDirectionEnum=z['enum'](['objective','game']),WatchRoleSchema=z['object']({'manifest_role':z['string']()['describe']('On-chain\x20derived\x20role\x20(may\x20be\x20\x27neutral\x27\x20when\x20the\x20account\x20has\x20no\x20operative\x20relationship).'),'latent_role':z['string']()['optional']()['describe']('Persona\x20identity-preference\x20role,\x20if\x20a\x20non-system\x20persona\x20is\x20set.'),'participation_role':z['string']()['describe']('Authoritative\x20role\x20for\x20participation/operation\x20—\x20ALWAYS\x20manifest_role.'),'evaluation_role':z['string']()['describe']('Role\x20for\x20evaluation\x20injection\x20—\x20latent\x20preference\x20when\x20set,\x20else\x20manifest.'),'conflicting':z['boolean']()['describe']('True\x20when\x20the\x20latent\x20persona\x20role\x20disagrees\x20with\x20the\x20manifest\x20role.'),'reason_direction':ReasonDirectionEnum['describe']('objective\x20=\x20only\x20narrate\x20facts;\x20game\x20=\x20full\x20four-stage\x20reasoning.'),'derivation':z['string']()['describe']('Traceable\x20derivation\x20basis\x20from\x20the\x20manifest\x20role.'),'note':z['string']()['describe']('Human-readable\x20resolution\x20note.')})['strict'](),WatchObjectSchema=z['object']({'address':z['string']()['describe']('Object\x20address\x20(or\x20the\x20resolved\x20address\x20for\x20a\x20name\x20input).'),'object_type':z['string']()['describe']('Normalized\x20short\x20object\x20type\x20(e.g.\x20Service,\x20Order,\x20Progress,\x20Demand,\x20Arbitration).'),'name':z['string']()['optional']()['describe']('Human-readable\x20name\x20/\x20LocalMark\x20name\x20if\x20resolvable.'),'fields':z['record'](z['string'](),z['unknown']())['describe']('Raw\x20on-chain\x20fields\x20of\x20interest\x20(subset\x20of\x20the\x20object\x20data).')})['strict'](),WatchRelationSchema=z['object']({'relation':z['string']()['describe']('Relationship\x20kind\x20(e.g.\x20machine,\x20permission,\x20arbitration,\x20order,\x20sub_service).'),'target':z['string']()['describe']('Related\x20object\x20address.'),'target_type':z['string']()['describe']('Normalized\x20short\x20type\x20of\x20the\x20related\x20object.'),'note':z['string']()['optional']()['describe']('Semantic\x20note\x20for\x20the\x20relation.')})['strict'](),WatchOperationSchema=z['object']({'operation':z['string']()['describe']('Operation\x20identifier\x20(e.g.\x20progress_next,\x20service_param_update,\x20order_holder_confirm).'),'can_execute':z['boolean']()['describe']('Whether\x20the\x20account\x20can\x20execute\x20this\x20operation\x20on-chain\x20RIGHT\x20NOW.'),'path':z['string']()['describe']('Execution\x20path\x20(e.g.\x20order_holder\x20/\x20permission_index\x20/\x20named_operator\x20/\x20guard_submission).'),'note':z['string']()['optional']()['describe']('Execution\x20note\x20or\x20guard\x20requirement.')})['strict'](),WatchReasonValueSchema=z['object']({'perspective':z['string']()['describe']('Value\x20perspective:\x20consumer\x20/\x20producer\x20/\x20neutral.'),'interest_analyzer':z['string']()['describe']('Interest\x20analyzer\x20id\x20for\x20the\x20evaluation\x20role.'),'prefer':z['array'](z['string']())['describe']('Value\x20anchors\x20the\x20role\x20seeks\x20(gains).'),'avoid':z['array'](z['string']())['describe']('Value\x20anchors\x20the\x20role\x20avoids\x20(risks).'),'sensitivity':z['number']()['describe']('Risk\x20sensitivity\x20(1.0\x20neutral;\x20>1\x20more\x20risk-averse).')})['strict'](),WatchReasonGameSchema=z['object']({'power':z['string']()['describe']('Game-theory\x20power:\x20strong\x20/\x20weak\x20/\x20peer\x20/\x20neutral.'),'strategy':z['string']()['describe']('Game-strategy\x20plugin\x20id.'),'weaker_party':z['boolean']()['describe']('True\x20when\x20the\x20role\x20is\x20the\x20weaker\x20party\x20(prioritize\x20protection).'),'stronger_party':z['boolean']()['describe']('True\x20when\x20the\x20role\x20is\x20the\x20stronger\x20party\x20(constrain\x20on-chain).')})['strict'](),WatchReasonPathSchema=z['object']({'operations':z['array'](WatchOperationSchema)['describe']('Actionable\x20operations\x20(identity-filtered).'),'summary':z['string']()['describe']('Human-readable\x20path\x20summary.'),'path_reasoning':z['object']({'current_node':z['string'](),'perspective':z['string'](),'optimal_path':z['object']({'nodes':z['array'](z['string']()),'forwards':z['array'](z['string']()),'terminal':z['string'](),'score':z['number'](),'length':z['number'](),'guard_gates':z['number']()})['strict']()['optional']()['describe']('The\x20single\x20optimal\x20path\x20to\x20a\x20terminal\x20(absent\x20when\x20no\x20terminal\x20is\x20reachable).'),'ranked_paths':z['array'](z['object']({'terminal':z['string'](),'score':z['number'](),'length':z['number'](),'guard_gates':z['number']()})['strict']())['describe']('Paths\x20ranked\x20by\x20composite\x20score\x20descending.'),'foregone_terminals':z['array'](z['string']())['describe']('Terminals\x20closed\x20by\x20choosing\x20the\x20optimal\x20path\x20(opportunity\x20competition).'),'summary':z['string']()})['strict']()['optional']()['describe']('Path-level\x20game\x20reasoning\x20(present\x20only\x20for\x20Progress\x20focus).')})['strict']();export const WatchOperationInputSchema=z['discriminatedUnion']('action',[z['object']({'action':z['literal']('focus'),'focus':z['string']()['describe']('Object\x20address\x20or\x20LocalMark\x20name\x20to\x20focus\x20on.'),'account':z['string']()['optional']()['describe']('Active\x20account\x20address;\x20its\x20on-chain\x20role\x20+\x20persona\x20are\x20resolved\x20against\x20the\x20focus.'),'scenario':WatchScenarioEnum['optional']()['describe']('Optional\x20scenario\x20hint\x20to\x20guide\x20identity\x20assembly.'),'network':z['string']()['optional']()['describe']('Network\x20(default\x20testnet).')})['strict'](),z['object']({'action':z['literal']('expand'),'focus':z['string']()['describe']('Object\x20address\x20or\x20LocalMark\x20name\x20to\x20expand\x20relations\x20from.'),'account':z['string']()['optional']()['describe']('Active\x20account\x20address\x20(for\x20identity-aware\x20relation\x20semantics).'),'relation':z['string']()['optional']()['describe']('Filter\x20to\x20a\x20single\x20relation\x20kind\x20(e.g.\x20machine,\x20permission,\x20arbitration,\x20sub_service).'),'network':z['string']()['optional']()['describe']('Network\x20(default\x20testnet).')})['strict'](),z['object']({'action':z['literal']('actions'),'focus':z['string']()['describe']('Object\x20address\x20or\x20LocalMark\x20name\x20to\x20enumerate\x20actionable\x20operations\x20for.'),'account':z['string']()['describe']('Active\x20account\x20address\x20—\x20operations\x20are\x20judged\x20against\x20THIS\x20account.'),'network':z['string']()['optional']()['describe']('Network\x20(default\x20testnet).')})['strict'](),z['object']({'action':z['literal']('reason'),'focus':z['string']()['describe']('Object\x20address\x20or\x20LocalMark\x20name\x20to\x20reason\x20about.'),'account':z['string']()['optional']()['describe']('Active\x20account\x20address\x20—\x20identity\x20drives\x20the\x20reasoning\x20direction\x20(objective\x20vs\x20game).'),'scenario':WatchScenarioEnum['optional']()['describe']('Optional\x20scenario\x20hint\x20to\x20guide\x20identity\x20assembly.'),'network':z['string']()['optional']()['describe']('Network\x20(default\x20testnet).')})['strict']()]);export const WatchOperationOutputSchema=z['discriminatedUnion']('action',[z['object']({'action':z['literal']('focus'),'result':z['object']({'object':WatchObjectSchema['nullable']()['describe']('Focused\x20object\x20base\x20data\x20(null\x20when\x20unresolvable).'),'role':WatchRoleSchema['describe']('Resolved\x20identity\x20of\x20the\x20account\x20against\x20the\x20focus\x20object.')})['strict']()}),z['object']({'action':z['literal']('expand'),'result':z['object']({'object':WatchObjectSchema['nullable']()['describe']('Focused\x20object\x20base\x20data\x20(null\x20when\x20unresolvable).'),'relations':z['array'](WatchRelationSchema)['describe']('Direct\x20relations\x20out\x20of\x20the\x20focus\x20object.'),'supply_chain':z['object']({'service':z['string'](),'machine':z['string']()['optional'](),'edges':z['array'](z['object']({'node':z['string'](),'prev_node':z['string'](),'forward':z['string'](),'guard':z['string'](),'purchased_services':z['array'](z['object']({'identifier':z['number'](),'name':z['string'](),'address':z['string']()})['strict']()),'required_submissions':z['array'](z['object']({'identifier':z['number'](),'name':z['string'](),'value_type':z['string']()})['strict']())})['strict']())})['strict']()['optional']()['describe']('Transparent\x20sub-order\x20purchasing\x20graph\x20(present\x20when\x20the\x20focus\x20is\x20a\x20Service\x20with\x20purchasing-commitment\x20guards).')})['strict']()}),z['object']({'action':z['literal']('actions'),'result':z['object']({'object':WatchObjectSchema['nullable']()['describe']('Focused\x20object\x20base\x20data\x20(null\x20when\x20unresolvable).'),'role':WatchRoleSchema['describe']('Resolved\x20identity\x20of\x20the\x20account\x20against\x20the\x20focus\x20object.'),'operations':z['array'](WatchOperationSchema)['describe']('Actionable\x20operations\x20for\x20the\x20account\x20on\x20this\x20object,\x20with\x20executability\x20judgment.')})['strict']()}),z['object']({'action':z['literal']('reason'),'result':z['object']({'object':WatchObjectSchema['nullable']()['describe']('Focused\x20object\x20base\x20data\x20(null\x20when\x20unresolvable).'),'identity':WatchRoleSchema['nullable']()['describe']('Resolved\x20identity\x20of\x20the\x20account\x20against\x20the\x20focus\x20object.'),'reason_direction':ReasonDirectionEnum['describe']('objective\x20=\x20only\x20narrate\x20facts;\x20game\x20=\x20full\x20four-stage\x20reasoning.'),'value':WatchReasonValueSchema['nullable']()['describe']('Value\x20stage\x20(perspective\x20+\x20interest\x20anchors);\x20null\x20when\x20objective.'),'game':WatchReasonGameSchema['nullable']()['describe']('Game\x20stage\x20(power\x20+\x20strategy);\x20null\x20when\x20objective.'),'path':WatchReasonPathSchema['nullable']()['describe']('Path/operation\x20stage;\x20null\x20when\x20objective.'),'objective_note':z['string']()['optional']()['describe']('Narration\x20note\x20when\x20reason_direction\x20is\x20objective.')})['strict']()})]);
|
|
1
|
+
import{z}from'zod';const WatchScenarioEnum=z['enum'](['order','service','demand','arbitration','progress','permission','account','generic']),ReasonDirectionEnum=z['enum'](['objective','game']),WatchRoleSchema=z['object']({'manifest_role':z['string']()['describe']('On-chain\x20derived\x20role\x20(may\x20be\x20\x27neutral\x27\x20when\x20the\x20account\x20has\x20no\x20operative\x20relationship).'),'latent_role':z['string']()['optional']()['describe']('Persona\x20identity-preference\x20role,\x20if\x20a\x20non-system\x20persona\x20is\x20set.'),'participation_role':z['string']()['describe']('Authoritative\x20role\x20for\x20participation/operation\x20—\x20ALWAYS\x20manifest_role.'),'evaluation_role':z['string']()['describe']('Role\x20for\x20evaluation\x20injection\x20—\x20latent\x20preference\x20when\x20set,\x20else\x20manifest.'),'conflicting':z['boolean']()['describe']('True\x20when\x20the\x20latent\x20persona\x20role\x20disagrees\x20with\x20the\x20manifest\x20role.'),'reason_direction':ReasonDirectionEnum['describe']('objective\x20=\x20only\x20narrate\x20facts;\x20game\x20=\x20full\x20four-stage\x20reasoning.'),'derivation':z['string']()['describe']('Traceable\x20derivation\x20basis\x20from\x20the\x20manifest\x20role.'),'note':z['string']()['describe']('Human-readable\x20resolution\x20note.')})['strict'](),WatchObjectSchema=z['object']({'address':z['string']()['describe']('Object\x20address\x20(or\x20the\x20resolved\x20address\x20for\x20a\x20name\x20input).'),'object_type':z['string']()['describe']('Normalized\x20short\x20object\x20type\x20(e.g.\x20Service,\x20Order,\x20Progress,\x20Demand,\x20Arbitration).'),'name':z['string']()['optional']()['describe']('Human-readable\x20name\x20/\x20LocalMark\x20name\x20if\x20resolvable.'),'fields':z['record'](z['string'](),z['unknown']())['describe']('Raw\x20on-chain\x20fields\x20of\x20interest\x20(subset\x20of\x20the\x20object\x20data).')})['strict'](),WatchRelationSchema=z['object']({'relation':z['string']()['describe']('Relationship\x20kind\x20(e.g.\x20machine,\x20permission,\x20arbitration,\x20order,\x20sub_service).'),'target':z['string']()['describe']('Related\x20object\x20address.'),'target_type':z['string']()['describe']('Normalized\x20short\x20type\x20of\x20the\x20related\x20object.'),'note':z['string']()['optional']()['describe']('Semantic\x20note\x20for\x20the\x20relation.')})['strict'](),WatchOperationSchema=z['object']({'operation':z['string']()['describe']('Operation\x20identifier\x20(e.g.\x20progress_next,\x20service_param_update,\x20order_holder_confirm).'),'can_execute':z['boolean']()['describe']('Whether\x20the\x20account\x20can\x20execute\x20this\x20operation\x20on-chain\x20RIGHT\x20NOW.'),'path':z['string']()['describe']('Execution\x20path\x20(e.g.\x20order_holder\x20/\x20permission_index\x20/\x20named_operator\x20/\x20guard_submission).'),'note':z['string']()['optional']()['describe']('Execution\x20note\x20or\x20guard\x20requirement.')})['strict'](),WatchReasonValueSchema=z['object']({'perspective':z['string']()['describe']('Value\x20perspective:\x20consumer\x20/\x20producer\x20/\x20neutral.'),'interest_analyzer':z['string']()['describe']('Interest\x20analyzer\x20id\x20for\x20the\x20evaluation\x20role.'),'prefer':z['array'](z['string']())['describe']('Value\x20anchors\x20the\x20role\x20seeks\x20(gains).'),'avoid':z['array'](z['string']())['describe']('Value\x20anchors\x20the\x20role\x20avoids\x20(risks).'),'sensitivity':z['number']()['describe']('Risk\x20sensitivity\x20(1.0\x20neutral;\x20>1\x20more\x20risk-averse).'),'value_proposition':z['object']({'offers':z['string']()['describe']('What\x20this\x20role\x20contributes\x20/\x20provides\x20into\x20the\x20transaction.'),'seeks':z['string']()['describe']('What\x20this\x20role\x20wants\x20/\x20gets\x20out\x20of\x20the\x20transaction.')})['strict']()['describe']('Value\x20proposition\x20—\x20what\x20the\x20role\x20offers\x20and\x20seeks\x20(K3\x2027\x20G6).')})['strict'](),WatchReasonGameSchema=z['object']({'power':z['string']()['describe']('Game-theory\x20power:\x20strong\x20/\x20weak\x20/\x20peer\x20/\x20neutral.'),'strategy':z['string']()['describe']('Game-strategy\x20plugin\x20id.'),'weaker_party':z['boolean']()['describe']('True\x20when\x20the\x20role\x20is\x20the\x20weaker\x20party\x20(prioritize\x20protection).'),'stronger_party':z['boolean']()['describe']('True\x20when\x20the\x20role\x20is\x20the\x20stronger\x20party\x20(constrain\x20on-chain).')})['strict'](),WatchReasonPathSchema=z['object']({'operations':z['array'](WatchOperationSchema)['describe']('Actionable\x20operations\x20(identity-filtered).'),'summary':z['string']()['describe']('Human-readable\x20path\x20summary.'),'path_reasoning':z['object']({'current_node':z['string'](),'perspective':z['string'](),'optimal_path':z['object']({'nodes':z['array'](z['string']()),'forwards':z['array'](z['string']()),'terminal':z['string'](),'score':z['number'](),'length':z['number'](),'guard_gates':z['number']()})['strict']()['optional']()['describe']('The\x20single\x20optimal\x20path\x20to\x20a\x20terminal\x20(absent\x20when\x20no\x20terminal\x20is\x20reachable).'),'ranked_paths':z['array'](z['object']({'terminal':z['string'](),'score':z['number'](),'length':z['number'](),'guard_gates':z['number']()})['strict']())['describe']('Paths\x20ranked\x20by\x20composite\x20score\x20descending.'),'foregone_terminals':z['array'](z['string']())['describe']('Terminals\x20closed\x20by\x20choosing\x20the\x20optimal\x20path\x20(opportunity\x20competition).'),'summary':z['string']()})['strict']()['optional']()['describe']('Path-level\x20game\x20reasoning\x20(present\x20only\x20for\x20Progress\x20focus).')})['strict']();export const WatchOperationInputSchema=z['discriminatedUnion']('action',[z['object']({'action':z['literal']('focus'),'focus':z['string']()['describe']('Object\x20address\x20or\x20LocalMark\x20name\x20to\x20focus\x20on.'),'account':z['string']()['optional']()['describe']('Active\x20account\x20address;\x20its\x20on-chain\x20role\x20+\x20persona\x20are\x20resolved\x20against\x20the\x20focus.'),'scenario':WatchScenarioEnum['optional']()['describe']('Optional\x20scenario\x20hint\x20to\x20guide\x20identity\x20assembly.'),'network':z['string']()['optional']()['describe']('Network\x20(default\x20testnet).')})['strict'](),z['object']({'action':z['literal']('expand'),'focus':z['string']()['describe']('Object\x20address\x20or\x20LocalMark\x20name\x20to\x20expand\x20relations\x20from.'),'account':z['string']()['optional']()['describe']('Active\x20account\x20address\x20(for\x20identity-aware\x20relation\x20semantics).'),'relation':z['string']()['optional']()['describe']('Filter\x20to\x20a\x20single\x20relation\x20kind\x20(e.g.\x20machine,\x20permission,\x20arbitration,\x20sub_service).'),'network':z['string']()['optional']()['describe']('Network\x20(default\x20testnet).')})['strict'](),z['object']({'action':z['literal']('actions'),'focus':z['string']()['describe']('Object\x20address\x20or\x20LocalMark\x20name\x20to\x20enumerate\x20actionable\x20operations\x20for.'),'account':z['string']()['describe']('Active\x20account\x20address\x20—\x20operations\x20are\x20judged\x20against\x20THIS\x20account.'),'network':z['string']()['optional']()['describe']('Network\x20(default\x20testnet).')})['strict'](),z['object']({'action':z['literal']('reason'),'focus':z['string']()['describe']('Object\x20address\x20or\x20LocalMark\x20name\x20to\x20reason\x20about.'),'account':z['string']()['optional']()['describe']('Active\x20account\x20address\x20—\x20identity\x20drives\x20the\x20reasoning\x20direction\x20(objective\x20vs\x20game).'),'scenario':WatchScenarioEnum['optional']()['describe']('Optional\x20scenario\x20hint\x20to\x20guide\x20identity\x20assembly.'),'network':z['string']()['optional']()['describe']('Network\x20(default\x20testnet).')})['strict']()]);export const WatchOperationOutputSchema=z['discriminatedUnion']('action',[z['object']({'action':z['literal']('focus'),'result':z['object']({'object':WatchObjectSchema['nullable']()['describe']('Focused\x20object\x20base\x20data\x20(null\x20when\x20unresolvable).'),'role':WatchRoleSchema['describe']('Resolved\x20identity\x20of\x20the\x20account\x20against\x20the\x20focus\x20object.')})['strict']()}),z['object']({'action':z['literal']('expand'),'result':z['object']({'object':WatchObjectSchema['nullable']()['describe']('Focused\x20object\x20base\x20data\x20(null\x20when\x20unresolvable).'),'relations':z['array'](WatchRelationSchema)['describe']('Direct\x20relations\x20out\x20of\x20the\x20focus\x20object.'),'supply_chain':z['object']({'service':z['string'](),'machine':z['string']()['optional'](),'edges':z['array'](z['object']({'node':z['string'](),'prev_node':z['string'](),'forward':z['string'](),'guard':z['string'](),'purchased_services':z['array'](z['object']({'identifier':z['number'](),'name':z['string'](),'address':z['string']()})['strict']()),'required_submissions':z['array'](z['object']({'identifier':z['number'](),'name':z['string'](),'value_type':z['string']()})['strict']())})['strict']())})['strict']()['optional']()['describe']('Transparent\x20sub-order\x20purchasing\x20graph\x20(present\x20when\x20the\x20focus\x20is\x20a\x20Service\x20with\x20purchasing-commitment\x20guards).')})['strict']()}),z['object']({'action':z['literal']('actions'),'result':z['object']({'object':WatchObjectSchema['nullable']()['describe']('Focused\x20object\x20base\x20data\x20(null\x20when\x20unresolvable).'),'role':WatchRoleSchema['describe']('Resolved\x20identity\x20of\x20the\x20account\x20against\x20the\x20focus\x20object.'),'operations':z['array'](WatchOperationSchema)['describe']('Actionable\x20operations\x20for\x20the\x20account\x20on\x20this\x20object,\x20with\x20executability\x20judgment.')})['strict']()}),z['object']({'action':z['literal']('reason'),'result':z['object']({'object':WatchObjectSchema['nullable']()['describe']('Focused\x20object\x20base\x20data\x20(null\x20when\x20unresolvable).'),'identity':WatchRoleSchema['nullable']()['describe']('Resolved\x20identity\x20of\x20the\x20account\x20against\x20the\x20focus\x20object.'),'reason_direction':ReasonDirectionEnum['describe']('objective\x20=\x20only\x20narrate\x20facts;\x20game\x20=\x20full\x20four-stage\x20reasoning.'),'value':WatchReasonValueSchema['nullable']()['describe']('Value\x20stage\x20(perspective\x20+\x20interest\x20anchors);\x20null\x20when\x20objective.'),'game':WatchReasonGameSchema['nullable']()['describe']('Game\x20stage\x20(power\x20+\x20strategy);\x20null\x20when\x20objective.'),'path':WatchReasonPathSchema['nullable']()['describe']('Path/operation\x20stage;\x20null\x20when\x20objective.'),'objective_note':z['string']()['optional']()['describe']('Narration\x20note\x20when\x20reason_direction\x20is\x20objective.')})['strict']()})]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TemplateObjectType } from "../knowledge/template-registry.js";
|
|
2
|
-
|
|
2
|
+
import { lintGuard, formatLintResult, type GuardJsonInput } from "../knowledge/guard-lint.js";
|
|
3
3
|
export interface SchemaInfo {
|
|
4
4
|
name: string;
|
|
5
5
|
title: string;
|
|
@@ -8,7 +8,7 @@ export interface SchemaInfo {
|
|
|
8
8
|
outputPath?: string;
|
|
9
9
|
}
|
|
10
10
|
export interface SchemaQueryRequest {
|
|
11
|
-
action: "list" | "get" | "search" | "list_operations" | "get_output" | "get_guard_templates" | "get_field" | "
|
|
11
|
+
action: "list" | "get" | "search" | "list_operations" | "get_output" | "get_guard_templates" | "get_field" | "get_tool_reference" | "get_guard_design_patterns" | "get_safety_rules" | "get_templates";
|
|
12
12
|
name?: string;
|
|
13
13
|
query?: string;
|
|
14
14
|
field_path?: string;
|
|
@@ -17,17 +17,6 @@ export interface SchemaQueryRequest {
|
|
|
17
17
|
params?: string;
|
|
18
18
|
output_file?: string;
|
|
19
19
|
}
|
|
20
|
-
export interface ExampleSearchResult {
|
|
21
|
-
file: string;
|
|
22
|
-
title: string;
|
|
23
|
-
description: string;
|
|
24
|
-
tags: string[];
|
|
25
|
-
industry: string;
|
|
26
|
-
operation_type: string;
|
|
27
|
-
verified: boolean;
|
|
28
|
-
score: number;
|
|
29
|
-
matched_fields: string[];
|
|
30
|
-
}
|
|
31
20
|
export interface SchemaQueryResponse {
|
|
32
21
|
[key: string]: unknown;
|
|
33
22
|
success: boolean;
|
|
@@ -46,8 +35,38 @@ export declare function listSchemas(): SchemaInfo[];
|
|
|
46
35
|
export declare function getSchema(name: string): any | null;
|
|
47
36
|
export declare function getOutputSchema(name: string): any | null;
|
|
48
37
|
export declare function getGuardTemplates(templateName?: string): any | null;
|
|
49
|
-
export declare function searchExamples(query: string): ExampleSearchResult[];
|
|
50
38
|
export declare function getSchemaField(name: string, fieldPath: string): any | null;
|
|
51
39
|
export declare function searchSchemas(query: string): SchemaInfo[];
|
|
52
40
|
export declare function listOperations(): SchemaInfo[];
|
|
53
41
|
export declare function processSchemaQuery(request: SchemaQueryRequest): SchemaQueryResponse;
|
|
42
|
+
export interface GuardSemanticsPartyEvaluation {
|
|
43
|
+
submission_requirements: Array<{
|
|
44
|
+
identifier: number;
|
|
45
|
+
value_type?: string;
|
|
46
|
+
object_type?: string;
|
|
47
|
+
name?: string;
|
|
48
|
+
}>;
|
|
49
|
+
data_sources: Array<{
|
|
50
|
+
identifier: number;
|
|
51
|
+
kind: "fixed_value" | "object" | "system_address";
|
|
52
|
+
value_type?: string;
|
|
53
|
+
object_type?: string;
|
|
54
|
+
name?: string;
|
|
55
|
+
is_mutable_onchain: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
query_dependencies: number[];
|
|
58
|
+
has_time_conditions: boolean;
|
|
59
|
+
has_signer_constraints: boolean;
|
|
60
|
+
has_rely_composition: boolean;
|
|
61
|
+
reading_checklist: string[];
|
|
62
|
+
}
|
|
63
|
+
export interface GuardSemanticsAnalysis {
|
|
64
|
+
render: {
|
|
65
|
+
tree_indented: string;
|
|
66
|
+
mermaid: string;
|
|
67
|
+
};
|
|
68
|
+
lint: Awaited<ReturnType<typeof lintGuard>>;
|
|
69
|
+
party_evaluation: GuardSemanticsPartyEvaluation;
|
|
70
|
+
}
|
|
71
|
+
export declare function analyzeGuardSemantics(guard: GuardJsonInput): Promise<GuardSemanticsAnalysis>;
|
|
72
|
+
export { formatLintResult };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFileSync,existsSync,writeFileSync,mkdirSync,readdirSync}from'fs';import{resolve,join,dirname}from'path';import{fileURLToPath}from'url';import{TOOLS_REFERENCE,getToolReference,searchToolReference,getToolSequence}from'../knowledge/tools-reference.js';import{GUARD_DESIGN_PATTERNS,getGuardDesignPattern,GUARD_DESIGN_PATTERNS_VERSION}from'../knowledge/guard-design-patterns.js';import{OBJECT_REUSE_RULES,CREATE_VS_MODIFY_PATTERN,IMMUTABILITY_RULES,OPERATION_TYPE_CLASSIFICATION,OPERATION_CLASS_META,NAMING_CONVENTIONS,SAFETY_RULES_VERSION}from'../knowledge/safety-rules.js';import{listTemplates as a381a,getTemplateDetail,instantiateTemplate,getTemplateCounts,TEMPLATE_OBJECT_TYPES}from'../knowledge/template-registry.js';const __filename=fileURLToPath(import.meta.url),__dirname=fileURLToPath(new URL('.',import.meta.url)),SCHEMAS_DIR=resolve(__dirname,'../../dist/schemas'),GUARD_TEMPLATES_PATH_SCRIPTS=resolve(__dirname,'../../scripts/guard-templates.json'),GUARD_TEMPLATES_PATH_DIST=resolve(__dirname,'../../dist/schemas/guard-templates.json'),GUARD_TEMPLATES_PATH=existsSync(GUARD_TEMPLATES_PATH_SCRIPTS)?GUARD_TEMPLATES_PATH_SCRIPTS:GUARD_TEMPLATES_PATH_DIST,EXAMPLES_DIR_SCRIPTS=resolve(__dirname,'../../scripts/examples'),EXAMPLES_DIR_DIST=resolve(__dirname,'../examples');export const EXAMPLES_DIR=existsSync(EXAMPLES_DIR_SCRIPTS)?EXAMPLES_DIR_SCRIPTS:EXAMPLES_DIR_DIST;const WORKSPACE_TMP_DIR=resolve(process['cwd'](),'.trae','tmp');export function areSchemasAvailable(){return existsSync(SCHEMAS_DIR)&&existsSync(join(SCHEMAS_DIR,'index.json'));}export function getSchemaIndex(){try{const a=join(SCHEMAS_DIR,'index.json');if(!existsSync(a))return null;const b=readFileSync(a,'utf-8');return JSON['parse'](b);}catch{return null;}}export function listSchemas(){const a=getSchemaIndex();if(!a)return[];return[...a['tools']||[],...a['operations']||[]];}export function getSchema(a){try{let b=join(SCHEMAS_DIR,a+'.schema.json');!existsSync(b)&&(b=join(SCHEMAS_DIR,a+'.json'));if(!existsSync(b))return null;const c=readFileSync(b,'utf-8'),d=JSON['parse'](c);return resolveSchemaRefs(d);}catch{return null;}}export function getOutputSchema(a){try{const b=join(SCHEMAS_DIR,a+'.output.json');if(!existsSync(b))return null;const c=readFileSync(b,'utf-8'),d=JSON['parse'](c);return resolveSchemaRefs(d);}catch{return null;}}export function getGuardTemplates(a){try{if(!existsSync(GUARD_TEMPLATES_PATH))return null;const b=readFileSync(GUARD_TEMPLATES_PATH,'utf-8'),c=JSON['parse'](b);if(!a)return{'version':c['version'],'description':c['description'],'templates':(c['templates']||[])['map'](e=>({'name':e['name'],'title':e['title'],'description':e['description'],'use_case':e['use_case']})),'query_reference':c['query_reference'],'node_return_types':c['node_return_types']};const d=(c['templates']||[])['find'](e=>e['name']===a);if(!d)return null;return d;}catch{return null;}}export function searchExamples(a){if(!existsSync(EXAMPLES_DIR))return[];let b;try{b=readdirSync(EXAMPLES_DIR);}catch{return[];}const c=a['toLowerCase']()['trim']();if(!c)return[];const d=[];for(const e of b){if(!e['endsWith']('.json'))continue;const f=join(EXAMPLES_DIR,e);try{const g=readFileSync(f,'utf-8'),h=JSON['parse'](g),i=String(h['title']??''),j=String(h['description']??''),k=Array['isArray'](h['tags'])?h['tags']['map'](o=>String(o)):[],l=String(h['operation_type']??''),m=String(h['industry']??''),n=[];i['toLowerCase']()['includes'](c)&&n['push']('title'),j['toLowerCase']()['includes'](c)&&n['push']('description'),k['some'](o=>o['toLowerCase']()===c)&&n['push']('tags'),l&&l['toLowerCase']()===c&&n['push']('operation_type'),m&&m['toLowerCase']()===c&&n['push']('industry'),n['length']>0x0&&d['push']({'file':e,'title':i,'description':j,'tags':k,'industry':m,'operation_type':l,'verified':h['verified']===!![],'score':n['length'],'matched_fields':n});}catch{continue;}}return d['sort']((o,p)=>{if(p['score']!==o['score'])return p['score']-o['score'];return o['file']['localeCompare'](p['file']);}),d;}export function getSchemaField(a,b){const c=getSchema(a);if(!c)return null;const d=b['split']('.')['filter'](Boolean);let e=c;for(const f of d){if(!e||typeof e!=='object')return null;if(e['properties']&&f in e['properties']){e=e['properties'][f];continue;}if(e['items']&&typeof e['items']==='object'){if(/^\d+$/['test'](f)){e=e['items'];continue;}if(e['items']['properties']&&f in e['items']['properties']){e=e['items']['properties'][f];continue;}}if(Array['isArray'](e['oneOf'])||Array['isArray'](e['anyOf'])){const g=e['oneOf']??e['anyOf'];for(const h of g){if(h&&typeof h==='object'&&h['properties']&&f in h['properties']){e=h['properties'][f];break;}}continue;}if(f in e){e=e[f];continue;}return null;}return e;}function resolveSchemaRefs(a,b=new Set()){if(!a||typeof a!=='object')return a;if(Array['isArray'](a))return a['map'](d=>resolveSchemaRefs(d,b));const c={};for(const [d,e]of Object['entries'](a)){if(d==='$ref'&&typeof e==='string'){if(e['startsWith']('#'))c[d]=e;else{const f=loadRefSchema(e,b);f&&Object['assign'](c,resolveSchemaRefs(f,b));}}else typeof e==='object'?c[d]=resolveSchemaRefs(e,b):c[d]=e;}return c;}function loadRefSchema(a,b){if(a['startsWith']('#'))return null;if(b['has'](a))return{'description':'Circular\x20reference\x20to\x20'+a};b['add'](a);try{const c=join(SCHEMAS_DIR,a);if(!existsSync(c))return null;const d=readFileSync(c,'utf-8');return JSON['parse'](d);}catch{return null;}}export function searchSchemas(a){const b=listSchemas(),c=a['toLowerCase']();return b['filter'](d=>{const e=d['name']['toLowerCase']()['includes'](c),f=d['title']?.['toLowerCase']()['includes'](c),g=d['description']?.['toLowerCase']()['includes'](c);return e||f||g;});}export function listOperations(){const a=getSchemaIndex();if(!a)return[];return(a['operations']||[])['filter'](b=>b['name']['startsWith']('onchain_operations_'));}function writeResponseToFile(a,b){try{let c;if(b)c=resolve(process['cwd'](),b);else{!existsSync(WORKSPACE_TMP_DIR)&&mkdirSync(WORKSPACE_TMP_DIR,{'recursive':!![]});const g=Date['now']();c=join(WORKSPACE_TMP_DIR,'schema-'+g+'.json');}const d=dirname(c);!existsSync(d)&&mkdirSync(d,{'recursive':!![]});const f=typeof a==='string'?a:JSON['stringify'](a,null,0x2);return writeFileSync(c,f,'utf-8'),c;}catch(h){return null;}}export function processSchemaQuery(a){const {action:b,name:c,query:d,field_path:f,template:g,output_file:h,object_type:i,params:j}=a;if(b==='get_guard_templates'){const k=getGuardTemplates(g);if(!k)return{'success':![],'action':b,'data':null,'message':g?'Guard\x20template\x20\x27'+g+'\x27\x20not\x20found.\x20Omit\x20\x27template\x27\x20to\x20list\x20all\x20available\x20templates.':'Guard\x20templates\x20file\x20not\x20found.\x20Ensure\x20scripts/guard-templates.json\x20exists.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20available\x20templates.','Available\x20template\x20names:\x20signer_verification,\x20progress_node_check,\x20order_owner_verification,\x20service_belonging_check,\x20reward_not_claimed,\x20combined_reward_guard']};if(h){const l=writeResponseToFile(k,h);if(l)return{'success':!![],'action':b,'data':null,'message':'Guard\x20template'+(g?'\x20\x27'+g+'\x27':'s')+'\x20written\x20to\x20file:\x20'+l,'output_file_path':l,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+l]};}return{'success':!![],'action':b,'data':k,'message':g?'Retrieved\x20Guard\x20template:\x20'+g:'Retrieved\x20'+(Array['isArray'](k['templates'])?k['templates']['length']:0x0)+'\x20Guard\x20templates'};}if(b==='get_templates'){if(!g){const p=a381a(i),q=getTemplateCounts(),r={'total':p['length'],'filter':i??null,'counts_by_object_type':q,'templates':p};if(h){const s=writeResponseToFile(r,h);if(s)return{'success':!![],'action':b,'data':null,'message':p['length']+'\x20templates\x20written\x20to\x20file:\x20'+s,'output_file_path':s,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+s]};}return{'success':!![],'action':b,'data':r,'message':p['length']+'\x20template(s)'+(i?'\x20for\x20object_type=\x27'+i+'\x27':'')+'\x20'+('(total\x20registry:\x20'+Object['values'](q)['reduce']((t,u)=>t+u,0x0)+'\x20across\x20'+TEMPLATE_OBJECT_TYPES['length']+'\x20object\x20types).\x20')+'Provide\x20\x27template\x27\x20(id)\x20for\x20full\x20detail;\x20add\x20\x27params\x27\x20(JSON\x20string)\x20to\x20instantiate.'};}if(!j){const t=getTemplateDetail(g);if(!t)return{'success':![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20not\x20found\x20in\x20the\x20unified\x20registry.','suggestions':['Omit\x20\x27template\x27\x20to\x20list\x20all\x20template\x20metadata\x20(id\x20+\x20object_type\x20+\x20parameters).','Filter\x20by\x20object_type:\x20'+TEMPLATE_OBJECT_TYPES['join'](',\x20')]};if(h){const u=writeResponseToFile(t,h);if(u)return{'success':!![],'action':b,'data':null,'message':'Template\x20\x27'+g+'\x27\x20detail\x20written\x20to\x20file:\x20'+u,'output_file_path':u,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+u]};}return{'success':!![],'action':b,'data':t,'message':'Template\x20\x27'+g+'\x27\x20('+t['object_type']+',\x20'+(t['instantiable']?'instantiable':'guidance-only')+').\x20'+'To\x20instantiate,\x20call\x20again\x20with\x20\x27params\x27\x20=\x20JSON\x20object\x20of\x20the\x20declared\x20parameters.'};}let m;try{const v=JSON['parse'](j);if(!v||typeof v!=='object'||Array['isArray'](v))return{'success':![],'action':b,'data':null,'message':'\x27params\x27\x20must\x20be\x20a\x20JSON\x20object\x20(e.g.\x20\x27{\x22key\x22:\x22value\x22}\x27),\x20got\x20'+(Array['isArray'](v)?'array':typeof v)+'.'};m=v;}catch(w){return{'success':![],'action':b,'data':null,'message':'Failed\x20to\x20parse\x20\x27params\x27\x20as\x20JSON:\x20'+(w instanceof Error?w['message']:String(w)),'suggestions':['Example:\x20params=\x27{\x22whitelist\x22:[\x220xabc...\x22]}\x27']};}const n=instantiateTemplate(g,m);if(!n['ok'])return{'success':![],'action':b,'data':n['guidance']!==undefined?{'guidance':n['guidance']}:null,'message':'Instantiation\x20failed\x20for\x20\x27'+g+'\x27:\x20'+n['error'],'suggestions':n['missing_params']?['Missing\x20required\x20params:\x20'+n['missing_params']['join'](',\x20'),'Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']:['Call\x20with\x20\x27template\x27\x20only\x20(no\x20\x27params\x27)\x20to\x20see\x20full\x20parameter\x20declarations.']};const o={'object_type':n['object_type'],'template_id':n['template_id'],'body':n['body'],...n['notes']?{'notes':n['notes']}:{}};if(h){const x=writeResponseToFile(o,h);if(x)return{'success':!![],'action':b,'data':null,'message':'Instantiated\x20template\x20\x27'+g+'\x27\x20written\x20to\x20file:\x20'+x,'output_file_path':x,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+x]};}return{'success':!![],'action':b,'data':o,'message':'Instantiated\x20\x27'+g+'\x27\x20('+n['object_type']+').\x20'+'Review\x20the\x20body\x20against\x20the\x20onchain_operations\x20schema\x20before\x20submitting.'};}if(b==='search_examples'){if(!d)return{'success':![],'action':b,'data':null,'message':'Search\x20query\x20is\x20required\x20for\x20\x27search_examples\x27\x20action','suggestions':['Provide\x20a\x20\x27query\x27\x20string\x20(e.g.\x20\x27rental\x27,\x20\x27guard\x27,\x20\x27service\x27,\x20\x27machine\x27)','Searchable\x20fields:\x20title,\x20description,\x20tags,\x20operation_type,\x20industry']};const y=searchExamples(d);return{'success':!![],'action':b,'data':y,'message':'Found\x20'+y['length']+'\x20example(s)\x20matching\x20\x27'+d+'\x27','suggestions':y['length']===0x0?['Try\x20broader\x20terms\x20like\x20\x27service\x27,\x20\x27machine\x27,\x20\x27guard\x27,\x20\x27permission\x27','Try\x20an\x20industry\x20name:\x20\x27rental\x27,\x20\x27retail\x27,\x20\x27general\x27','Use\x20\x27get\x27\x20action\x20with\x20a\x20schema\x20name\x20to\x20see\x20the\x20full\x20JSON\x20Schema']:undefined};}if(b==='get_tool_reference'){if(c){const A=getToolReference(c);if(!A)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found\x20in\x20the\x20tool\x20reference.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20all\x20tools.','Available\x20tools:\x20'+TOOLS_REFERENCE['map'](C=>C['name'])['join'](',\x20')]};const B=getToolSequence(c);return{'success':!![],'action':b,'data':{'tool':A,'call_sequence':B??null},'message':'Retrieved\x20tool\x20reference:\x20'+c};}if(d){const C=searchToolReference(d);return{'success':!![],'action':b,'data':{'tools':C,'count':C['length']},'message':'Found\x20'+C['length']+'\x20tool(s)\x20matching\x20\x27'+d+'\x27','suggestions':C['length']===0x0?['Try\x20a\x20broader\x20keyword\x20(e.g.\x20\x27onchain\x27,\x20\x27guard\x27,\x20\x27schema\x27),\x20or\x20omit\x20\x27query\x27\x20to\x20list\x20all\x20tools.']:undefined};}const z=TOOLS_REFERENCE['map'](D=>({'name':D['name'],'summary':D['summary'],'actions':D['actions']??[],'notes':D['notes']??[]}));return{'success':!![],'action':b,'data':{'tools':z,'count':z['length']},'message':'Retrieved\x20reference\x20for\x20'+z['length']+'\x20MCP\x20tools.\x20Pass\x20name=\x27<tool>\x27\x20for\x20full\x20detail\x20(params,\x20prerequisites,\x20follow-ups).'};}if(b==='get_guard_design_patterns'){if(c){const E=getGuardDesignPattern(c);if(!E)return{'success':![],'action':b,'data':null,'message':'Guard\x20design\x20pattern\x20\x27'+c+'\x27\x20not\x20found.','suggestions':['Omit\x20\x27name\x27\x20to\x20list\x20the\x20full\x20catalog.','Available\x20pattern\x20ids:\x20'+GUARD_DESIGN_PATTERNS['map'](F=>F['id'])['join'](',\x20')]};return{'success':!![],'action':b,'data':{'pattern':E},'message':'Retrieved\x20Guard\x20design\x20pattern:\x20'+c};}if(d){const F=GUARD_DESIGN_PATTERNS['filter'](H=>H['host']===d),G=F['length']>0x0?F:GUARD_DESIGN_PATTERNS['filter'](H=>H['business_requirement']['toLowerCase']()['includes'](d['toLowerCase']())||H['logic_summary']['toLowerCase']()['includes'](d['toLowerCase']()));return{'success':!![],'action':b,'data':{'patterns':G,'count':G['length'],'filtered_by':F['length']>0x0?'host':'keyword'},'message':'Found\x20'+G['length']+'\x20Guard\x20design\x20pattern(s)\x20matching\x20\x27'+d+'\x27','suggestions':G['length']===0x0?['Filter\x20by\x20host:\x20service_buy_guard,\x20service_allocator_guard,\x20machine_forward,\x20progress_submission,\x20reward_claim,\x20repository_write,\x20arbitration_usage,\x20arbitration_voting,\x20gen_passport']:undefined};}const D=GUARD_DESIGN_PATTERNS['map'](H=>({'id':H['id'],'business_requirement':H['business_requirement'],'host':H['host'],'data_source':H['data_source'],'verifier_level':H['verifier_level'],'logic_summary':H['logic_summary'],'key_queries':H['key_queries'],'notes':H['notes']??[]}));return{'success':!![],'action':b,'data':{'patterns':D,'count':D['length'],'version':GUARD_DESIGN_PATTERNS_VERSION},'message':'Retrieved\x20'+D['length']+'\x20Guard\x20design\x20patterns.\x20Pass\x20name=\x27<pattern_id>\x27\x20for\x20full\x20detail\x20(witness\x20types,\x20mitigated\x20risks,\x20industries).'};}if(b==='get_safety_rules')return{'success':!![],'action':b,'data':{'version':SAFETY_RULES_VERSION,'object_reuse_rules':OBJECT_REUSE_RULES,'create_vs_modify_pattern':CREATE_VS_MODIFY_PATTERN,'immutability_rules':IMMUTABILITY_RULES,'operation_type_classification':OPERATION_TYPE_CLASSIFICATION,'operation_class_meta':OPERATION_CLASS_META,'naming_conventions':NAMING_CONVENTIONS},'message':'Retrieved\x20safety\x20rule\x20tables\x20(reuse\x20/\x20immutability\x20/\x20operation\x20classification\x20/\x20naming).\x20'+'Key\x20points:\x20prefer\x20REUSING\x20existing\x20objects\x20(string\x20reference\x20=\x20reuse,\x20object\x20shape\x20=\x20create);\x20'+'Machine\x20publish\x20locks\x20nodes/pairs/forwards,\x20Service\x20publish\x20locks\x20machine/order_allocators/arbitrations\x20(sales\x20stays\x20mutable);\x20'+'Guard\x20is\x20CREATE-only\x20immutable;\x20on-chain\x20writes\x20require\x20explicit\x20user\x20confirmation.'};if(!areSchemasAvailable())return{'success':![],'action':b,'data':null,'message':'Schema\x20files\x20are\x20not\x20available.\x20Please\x20run\x20\x27npm\x20run\x20generate:schemas\x27\x20first.','suggestions':['Run\x20\x27npm\x20run\x20generate:schemas\x27\x20to\x20generate\x20schema\x20files','Ensure\x20the\x20dist/schemas\x20directory\x20exists']};switch(b){case'list':{const H=listSchemas();return{'success':!![],'action':b,'data':H,'message':'Found\x20'+H['length']+'\x20available\x20schemas'};}case'get':{if(!c)return{'success':![],'action':b,'data':null,'message':'Schema\x20name\x20is\x20required\x20for\x20\x27get\x27\x20action','suggestions':['Provide\x20a\x20schema\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};const I=getSchema(c);if(!I){const J=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20not\x20found','suggestions':J['length']>0x0?J['map'](K=>'Did\x20you\x20mean:\x20'+K['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20schemas']};}if(h){const K=writeResponseToFile(I,h);if(K)return{'success':!![],'action':b,'data':null,'message':'Schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+K,'output_file_path':K,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+K]};}return{'success':!![],'action':b,'data':I,'message':'Retrieved\x20schema:\x20'+c};}case'get_field':{if(!c||!f)return{'success':![],'action':b,'data':null,'message':'Both\x20\x27name\x27\x20and\x20\x27field_path\x27\x20are\x20required\x20for\x20\x27get_field\x27\x20action','suggestions':['Example:\x20{action:\x20\x27get_field\x27,\x20name:\x20\x27onchain_operations_machine\x27,\x20field_path:\x20\x27data.node\x27}','Use\x20\x27get\x27\x20action\x20to\x20retrieve\x20the\x20full\x20schema']};const L=getSchemaField(c,f);if(!L)return{'success':![],'action':b,'data':null,'message':'Field\x20path\x20\x27'+f+'\x27\x20not\x20found\x20in\x20schema\x20\x27'+c+'\x27','suggestions':['Check\x20the\x20field\x20path\x20(dot-separated,\x20e.g.\x20\x27data.node\x27)','Use\x20\x27get\x27\x20action\x20to\x20see\x20the\x20full\x20schema\x20structure']};return{'success':!![],'action':b,'data':L,'message':'Retrieved\x20field\x20\x27'+f+'\x27\x20from\x20schema\x20\x27'+c+'\x27'};}case'search':{if(!d)return{'success':![],'action':b,'data':null,'message':'Search\x20query\x20is\x20required\x20for\x20\x27search\x27\x20action'};const M=searchSchemas(d);return{'success':!![],'action':b,'data':M,'message':'Found\x20'+M['length']+'\x20schemas\x20matching\x20\x27'+d+'\x27'};}case'list_operations':{const N=listOperations();return{'success':!![],'action':b,'data':N,'message':'Found\x20'+N['length']+'\x20on-chain\x20operations'};}case'get_output':{if(!c)return{'success':![],'action':b,'data':null,'message':'Tool\x20name\x20is\x20required\x20for\x20\x27get_output\x27\x20action','suggestions':['Provide\x20a\x20tool\x20name','Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools\x20and\x20their\x20outputPath']};const O=getOutputSchema(c);if(!O){const P=listSchemas(),Q=P['find'](S=>S['name']===c);if(Q)return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20exists\x20but\x20has\x20no\x20output\x20schema\x20file.\x20The\x20tool\x20may\x20not\x20declare\x20an\x20outputSchema,\x20or\x20the\x20schema\x20file\x20was\x20not\x20generated.','suggestions':['Use\x20\x27get\x27\x20action\x20with\x20name=\x27'+c+'\x27\x20to\x20retrieve\x20its\x20input\x20schema']};const R=searchSchemas(c)['slice'](0x0,0x5);return{'success':![],'action':b,'data':null,'message':'Tool\x20\x27'+c+'\x27\x20not\x20found','suggestions':R['length']>0x0?R['map'](S=>'Did\x20you\x20mean:\x20'+S['name']+'?'):['Use\x20\x27list\x27\x20action\x20to\x20see\x20available\x20tools']};}if(h){const S=writeResponseToFile(O,h);if(S)return{'success':!![],'action':b,'data':null,'message':'Output\x20schema\x20\x27'+c+'\x27\x20written\x20to\x20file:\x20'+S,'output_file_path':S,'suggestions':['Use\x20Read\x20tool\x20to\x20open\x20'+S]};}return{'success':!![],'action':b,'data':O,'message':'Retrieved\x20output\x20schema:\x20'+c};}default:return{'success':![],'action':b,'data':null,'message':'Unknown\x20action:\x20'+b,'suggestions':['Use\x20\x27list\x27,\x20\x27get\x27,\x20\x27get_field\x27,\x20\x27get_output\x27,\x20\x27search\x27,\x20\x27list_operations\x27,\x20\x27get_guard_templates\x27,\x20or\x20\x27search_examples\x27']};}}
|
|
1
|
+
import{readFileSync,existsSync,writeFileSync,mkdirSync}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 a392a,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=a392a(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};
|
|
@@ -163,6 +163,42 @@
|
|
|
163
163
|
"warn",
|
|
164
164
|
"fail"
|
|
165
165
|
]
|
|
166
|
+
},
|
|
167
|
+
"timing": {
|
|
168
|
+
"description": "Present when any timestamp was derived from monitored ProgressEvents (P1-3).",
|
|
169
|
+
"type": "object",
|
|
170
|
+
"properties": {
|
|
171
|
+
"node": {
|
|
172
|
+
"type": "string"
|
|
173
|
+
},
|
|
174
|
+
"assigned_at": {
|
|
175
|
+
"description": "Derived entry-into-node timestamp (ms).",
|
|
176
|
+
"type": "integer",
|
|
177
|
+
"minimum": -9007199254740991,
|
|
178
|
+
"maximum": 9007199254740991
|
|
179
|
+
},
|
|
180
|
+
"advanced_at": {
|
|
181
|
+
"description": "Derived exit-from-node timestamp (ms); absent = node still current.",
|
|
182
|
+
"type": "integer",
|
|
183
|
+
"minimum": -9007199254740991,
|
|
184
|
+
"maximum": 9007199254740991
|
|
185
|
+
},
|
|
186
|
+
"source": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"enum": [
|
|
189
|
+
"monitor_events",
|
|
190
|
+
"none"
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
"gap": {
|
|
194
|
+
"type": "string"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"required": [
|
|
198
|
+
"node",
|
|
199
|
+
"source"
|
|
200
|
+
],
|
|
201
|
+
"additionalProperties": false
|
|
166
202
|
}
|
|
167
203
|
},
|
|
168
204
|
"required": [
|
|
@@ -202,6 +238,70 @@
|
|
|
202
238
|
"note"
|
|
203
239
|
],
|
|
204
240
|
"additionalProperties": false
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"type": "object",
|
|
244
|
+
"properties": {
|
|
245
|
+
"action": {
|
|
246
|
+
"type": "string",
|
|
247
|
+
"const": "suggest_incentive"
|
|
248
|
+
},
|
|
249
|
+
"employee": {
|
|
250
|
+
"type": "string"
|
|
251
|
+
},
|
|
252
|
+
"kind": {
|
|
253
|
+
"type": "string",
|
|
254
|
+
"enum": [
|
|
255
|
+
"reward_grant",
|
|
256
|
+
"compensation_offset",
|
|
257
|
+
"correction_notice",
|
|
258
|
+
"none"
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
"rationale": {
|
|
262
|
+
"type": "string"
|
|
263
|
+
},
|
|
264
|
+
"requires_confirmation": {
|
|
265
|
+
"type": "boolean",
|
|
266
|
+
"const": true
|
|
267
|
+
},
|
|
268
|
+
"reward_candidates": {
|
|
269
|
+
"type": "array",
|
|
270
|
+
"items": {
|
|
271
|
+
"type": "object",
|
|
272
|
+
"properties": {
|
|
273
|
+
"address": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"description": "Reward object address."
|
|
276
|
+
},
|
|
277
|
+
"description": {
|
|
278
|
+
"type": "string"
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
"required": [
|
|
282
|
+
"address"
|
|
283
|
+
],
|
|
284
|
+
"additionalProperties": false
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"execution_hint": {
|
|
288
|
+
"type": "string"
|
|
289
|
+
},
|
|
290
|
+
"kpi_rollup": {
|
|
291
|
+
"type": "string"
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"required": [
|
|
295
|
+
"action",
|
|
296
|
+
"employee",
|
|
297
|
+
"kind",
|
|
298
|
+
"rationale",
|
|
299
|
+
"requires_confirmation",
|
|
300
|
+
"reward_candidates",
|
|
301
|
+
"execution_hint",
|
|
302
|
+
"kpi_rollup"
|
|
303
|
+
],
|
|
304
|
+
"additionalProperties": false
|
|
205
305
|
}
|
|
206
306
|
]
|
|
207
307
|
}
|