@wowok/agent-mcp 3.4.1 → 3.4.3
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/.build-stamp.json +5 -0
- package/dist/chain-semantics/composition-truth.js +1 -1
- package/dist/chain-semantics/eval-order.js +1 -1
- package/dist/chain-semantics/field-capability.js +1 -1
- package/dist/chain-semantics/freeze-map.js +1 -1
- package/dist/chain-semantics/fund-flow.js +1 -1
- package/dist/chain-semantics/guard-verbs.js +1 -1
- package/dist/chain-semantics/object-graph.js +1 -1
- package/dist/composition/audit.js +1 -1
- package/dist/composition/compile.d.ts +10 -3
- package/dist/composition/compile.js +1 -1
- package/dist/composition/emit-phases.d.ts +30 -2
- package/dist/composition/emit-phases.js +1 -1
- package/dist/composition/guard-fill.d.ts +8 -0
- package/dist/composition/guard-fill.js +1 -1
- package/dist/composition/inflight.js +1 -1
- package/dist/composition/input-normalize.js +1 -1
- package/dist/composition/materialize.d.ts +2 -0
- package/dist/composition/materialize.js +1 -1
- package/dist/composition/mode-gates.js +1 -1
- package/dist/composition/param-disclosure.js +1 -1
- package/dist/composition/plan-retry-ledger.d.ts +16 -0
- package/dist/composition/plan-retry-ledger.js +1 -1
- package/dist/composition/plan.d.ts +15 -1
- package/dist/composition/plan.js +1 -1
- package/dist/config/config-audit.spec.js +1 -1
- package/dist/config/judgment.d.ts +5 -0
- package/dist/config/judgment.js +1 -1
- package/dist/evaluation/builtins/arbitration-score.d.ts +1 -0
- package/dist/evaluation/builtins/arbitration-score.js +1 -1
- package/dist/evaluation/builtins/demand-match.js +1 -1
- package/dist/evaluation/builtins/graph-service.d.ts +8 -0
- package/dist/evaluation/builtins/graph-service.js +1 -1
- package/dist/evaluation/capability.d.ts +9 -0
- package/dist/evaluation/engine.js +1 -1
- package/dist/evaluation/extract.d.ts +9 -1
- package/dist/evaluation/extract.js +1 -1
- package/dist/evaluation/match-operation.js +1 -1
- package/dist/evaluation/match-policy.d.ts +5 -3
- package/dist/evaluation/match-policy.js +1 -1
- package/dist/evaluation/standards.d.ts +1 -0
- package/dist/evaluation/standards.js +1 -1
- package/dist/evaluation/structured-lines.js +1 -1
- package/dist/evaluation/types.d.ts +1 -0
- package/dist/extensions/capability.js +1 -1
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/harness/recover.js +1 -1
- package/dist/index.js +1 -1
- package/dist/intent/types.d.ts +1 -1
- package/dist/intent/types.js +1 -1
- package/dist/knowledge/allocation-ledger.js +1 -1
- package/dist/knowledge/allocator-rail-verifier.d.ts +17 -1
- package/dist/knowledge/allocator-rail-verifier.js +1 -1
- package/dist/knowledge/arb-fund-facts.d.ts +7 -0
- package/dist/knowledge/arb-fund-facts.js +1 -1
- package/dist/knowledge/arbitration-rail-verifier.d.ts +35 -0
- package/dist/knowledge/arbitration-rail-verifier.js +1 -0
- package/dist/knowledge/arbitration-templates.js +1 -1
- package/dist/knowledge/audit-rules.d.ts +13 -1
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/judgment-baselines.json +1 -0
- package/dist/knowledge/baselines/rules/guard.json +7 -6
- package/dist/knowledge/baselines/rules/progress.json +4 -4
- package/dist/knowledge/baselines/rules/reward.json +118 -3
- package/dist/knowledge/builtin-templates.d.ts +19 -2
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/chain-query-registry.d.ts +14 -0
- package/dist/knowledge/chain-query-registry.js +1 -0
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/fee-param-bindings.d.ts +2 -0
- package/dist/knowledge/fee-param-bindings.js +1 -1
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-binding-table.js +1 -1
- package/dist/knowledge/guard-binding-verifier.d.ts +7 -0
- package/dist/knowledge/guard-binding-verifier.js +1 -1
- package/dist/knowledge/guard-bindings.js +1 -1
- package/dist/knowledge/guard-design-patterns.d.ts +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-field-cognition.js +1 -1
- package/dist/knowledge/guard-host-context.js +1 -1
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-node-gates.d.ts +3 -1
- package/dist/knowledge/guard-node-gates.js +1 -1
- package/dist/knowledge/guard-puzzle.js +1 -1
- package/dist/knowledge/guard-render.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +2 -1
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/guard-translation.js +1 -1
- package/dist/knowledge/index.d.ts +2 -0
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/knob-docs.js +1 -1
- package/dist/knowledge/param-schema.d.ts +1 -1
- package/dist/knowledge/param-schema.js +1 -1
- package/dist/knowledge/param-tiers.d.ts +2 -0
- package/dist/knowledge/param-tiers.js +1 -1
- package/dist/knowledge/path-oracle/products/food-delivery.js +1 -1
- package/dist/knowledge/pattern-resolutions.d.ts +2 -0
- package/dist/knowledge/pattern-resolutions.js +1 -1
- package/dist/knowledge/product-detail-source.d.ts +37 -0
- package/dist/knowledge/product-detail-source.js +1 -0
- package/dist/knowledge/product-doc-b5.d.ts +16 -0
- package/dist/knowledge/product-doc-b5.js +1 -0
- package/dist/knowledge/progress-ledger.js +1 -1
- package/dist/knowledge/projection.spec.js +1 -1
- package/dist/knowledge/publish-gate.d.ts +20 -0
- package/dist/knowledge/publish-gate.js +1 -0
- package/dist/knowledge/publish-readiness.d.ts +25 -0
- package/dist/knowledge/publish-readiness.js +1 -0
- package/dist/knowledge/publish-surface-contract.d.ts +16 -0
- package/dist/knowledge/publish-surface-contract.js +1 -0
- package/dist/knowledge/rail-exit-satisfiability.d.ts +25 -0
- package/dist/knowledge/rail-exit-satisfiability.js +1 -0
- package/dist/knowledge/reward-ledger.d.ts +1 -1
- package/dist/knowledge/reward-ledger.js +1 -1
- package/dist/knowledge/reward-risk.d.ts +1 -1
- package/dist/knowledge/reward-risk.js +1 -1
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/service-ledger.d.ts +3 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/template-loader.d.ts +41 -2
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +17 -0
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/template-test-profiles.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +4 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/monitor/normalize.d.ts +1 -1
- package/dist/monitor/normalize.js +1 -1
- package/dist/monitor/types.js +1 -1
- package/dist/participation/customer-interest.d.ts +4 -0
- package/dist/participation/customer-interest.js +1 -1
- package/dist/participation/game-context.js +1 -1
- package/dist/participation/node-action-advisor.d.ts +4 -0
- package/dist/participation/node-action-advisor.js +1 -1
- package/dist/participation/radar-core.js +1 -1
- package/dist/participation/time-window.d.ts +11 -0
- package/dist/participation/time-window.js +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +28 -3
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/object-panorama.d.ts +4 -0
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/service-quote.js +1 -1
- package/dist/review/index.js +1 -1
- package/dist/review/order.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +24 -0
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/allocation.d.ts +11 -7
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/arbitration.d.ts +4 -0
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +28 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +21 -0
- package/dist/schema/call/contact.d.ts +4 -0
- package/dist/schema/call/demand.d.ts +4 -0
- package/dist/schema/call/guard.d.ts +12 -0
- package/dist/schema/call/handler.d.ts +1 -0
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +16 -8
- package/dist/schema/call/normalize-error.d.ts +1 -0
- package/dist/schema/call/normalize-error.js +1 -0
- package/dist/schema/call/order.d.ts +7 -3
- package/dist/schema/call/order.js +1 -1
- package/dist/schema/call/payment.d.ts +7 -3
- package/dist/schema/call/permission.d.ts +4 -0
- package/dist/schema/call/personal.d.ts +4 -0
- package/dist/schema/call/progress.d.ts +4 -0
- package/dist/schema/call/progress.js +1 -1
- package/dist/schema/call/proof.d.ts +8 -0
- package/dist/schema/call/proof.js +1 -1
- package/dist/schema/call/receipt.js +1 -1
- package/dist/schema/call/repository.d.ts +4 -0
- package/dist/schema/call/reward.d.ts +6 -2
- package/dist/schema/call/reward.js +1 -1
- package/dist/schema/call/semantic.d.ts +2 -2
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +21 -7
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/call/treasury.d.ts +10 -6
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/envelope-unify.d.ts +1 -0
- package/dist/schema/envelope-unify.js +1 -1
- package/dist/schema/evaluation/index.d.ts +43 -0
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +14 -2
- package/dist/schema/goal/planning.d.ts +18 -0
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/intent-radar/index.d.ts +12 -0
- package/dist/schema/intent-radar/index.js +1 -1
- package/dist/schema/keeper/index.d.ts +1 -0
- package/dist/schema/local/index.d.ts +10 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/local/wip.js +1 -1
- package/dist/schema/messenger/index.d.ts +1 -0
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +98 -13
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +22 -0
- package/dist/schema/query/bi.d.ts +28 -2
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +67 -61
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/workflow/index.js +1 -1
- package/dist/schema-query-impl/index.d.ts +1 -0
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +2 -1
- package/dist/schemas/benchmark_migration_operation.output.json +74 -0
- package/dist/schemas/benchmark_migration_operation.schema.json +33 -1
- package/dist/schemas/bridge_operation.output.json +2 -1
- package/dist/schemas/bridge_operation.schema.json +40 -0
- package/dist/schemas/evaluation_operation.output.json +96 -0
- package/dist/schemas/evaluation_operation.schema.json +39 -0
- package/dist/schemas/goal_operation.schema.json +32 -0
- package/dist/schemas/guard2file.schema.json +8 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/intent_radar.output.json +10 -2
- package/dist/schemas/intent_radar.schema.json +5 -1
- package/dist/schemas/keeper_operation.output.json +2 -1
- package/dist/schemas/local_cache_operation.output.json +2 -1
- package/dist/schemas/local_history_operation.output.json +2 -1
- package/dist/schemas/local_info_operation.output.json +2 -1
- package/dist/schemas/local_mark_operation.output.json +2 -1
- package/dist/schemas/local_mark_operation.schema.json +10 -1
- package/dist/schemas/machineNode2file.schema.json +8 -0
- package/dist/schemas/messenger_operation.output.json +2 -1
- package/dist/schemas/messenger_operation.schema.json +2 -1
- package/dist/schemas/monitor_events.output.json +2 -1
- package/dist/schemas/monitor_subscription.output.json +2 -1
- package/dist/schemas/onchain_events.output.json +206 -13
- package/dist/schemas/onchain_events.schema.json +16 -0
- package/dist/schemas/onchain_operations.output.json +22 -3
- package/dist/schemas/onchain_operations.schema.json +982 -327
- package/dist/schemas/onchain_operations_allocation.schema.json +20 -13
- package/dist/schemas/onchain_operations_arbitration.schema.json +9 -1
- package/dist/schemas/onchain_operations_contact.schema.json +8 -0
- package/dist/schemas/onchain_operations_demand.schema.json +8 -0
- package/dist/schemas/onchain_operations_gen_passport.schema.json +8 -0
- package/dist/schemas/onchain_operations_gen_proof.schema.json +8 -0
- package/dist/schemas/onchain_operations_guard.schema.json +655 -115
- package/dist/schemas/onchain_operations_machine.schema.json +11 -3
- package/dist/schemas/onchain_operations_order.schema.json +14 -11
- package/dist/schemas/onchain_operations_payment.schema.json +12 -9
- package/dist/schemas/onchain_operations_permission.schema.json +8 -0
- package/dist/schemas/onchain_operations_personal.schema.json +8 -0
- package/dist/schemas/onchain_operations_progress.schema.json +9 -1
- package/dist/schemas/onchain_operations_proof.schema.json +9 -1
- package/dist/schemas/onchain_operations_repository.schema.json +8 -0
- package/dist/schemas/onchain_operations_reward.schema.json +14 -11
- package/dist/schemas/onchain_operations_service.schema.json +25 -12
- package/dist/schemas/onchain_operations_treasury.schema.json +17 -19
- package/dist/schemas/onchain_table_data.output.json +52 -10
- package/dist/schemas/persona_operation.output.json +57 -0
- package/dist/schemas/persona_operation.schema.json +9 -0
- package/dist/schemas/query_toolkit.output.json +326 -23
- package/dist/schemas/query_toolkit.schema.json +18 -5
- package/dist/schemas/wip_file.output.json +2 -2
- package/dist/schemas/wip_file.schema.json +2 -2
- package/dist/schemas/workflow_operation.schema.json +1 -1
- package/dist/tools/error-catalog.d.ts +17 -0
- package/dist/tools/error-catalog.js +1 -0
- package/dist/tools/handlers/benchmark-migration.d.ts +29 -8
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/entry-edge-recipe.d.ts +101 -0
- package/dist/tools/handlers/entry-edge-recipe.js +1 -0
- package/dist/tools/handlers/escrow-deficit.d.ts +10 -0
- package/dist/tools/handlers/escrow-deficit.js +1 -0
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/fund-rail-recipe.d.ts +10 -0
- package/dist/tools/handlers/fund-rail-recipe.js +1 -0
- package/dist/tools/handlers/intent-radar.js +1 -1
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/mark-namespace.d.ts +30 -0
- package/dist/tools/handlers/mark-namespace.js +1 -0
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain-name-registration.d.ts +1 -0
- package/dist/tools/handlers/onchain-name-registration.js +1 -1
- package/dist/tools/handlers/onchain-name-registration.spec.js +1 -1
- package/dist/tools/handlers/onchain.d.ts +40 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/publish-binding-echo.d.ts +22 -0
- package/dist/tools/handlers/publish-binding-echo.js +1 -0
- package/dist/tools/handlers/query.d.ts +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/review-chain.d.ts +1 -0
- package/dist/tools/handlers/review-chain.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/handlers/stale-build-check.d.ts +9 -0
- package/dist/tools/handlers/stale-build-check.js +1 -0
- package/dist/tools/handlers/submission-assembly.d.ts +55 -0
- package/dist/tools/handlers/submission-assembly.js +1 -0
- package/dist/tools/handlers/wip.js +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +1 -1
- package/dist/tools/move-fn-index.gen.js +1 -1
- package/dist/tools/publish-gate-state.d.ts +5 -0
- package/dist/tools/publish-gate-state.js +1 -0
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/onchain.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/retry.js +1 -1
- package/dist/tools/runtime-health.js +1 -1
- package/dist/tools/shared.js +1 -1
- package/dist/tools/upgrade-check.d.ts +1 -0
- package/dist/tools/upgrade-check.js +1 -1
- package/dist/tools/wip-verify-ledger.d.ts +2 -0
- package/dist/tools/wip-verify-ledger.js +1 -1
- package/dist/tools/wrap.d.ts +15 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ToolDispatchResult } from "../types.js";
|
|
2
|
+
export interface AssemblyRequiredSlot {
|
|
3
|
+
identifier: number;
|
|
4
|
+
value_type: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AssemblySlotGap {
|
|
8
|
+
identifier: number;
|
|
9
|
+
value_type: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
suggestion: string;
|
|
12
|
+
autofillable: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type SubmissionGapDecision = {
|
|
15
|
+
status: "pass";
|
|
16
|
+
} | {
|
|
17
|
+
status: "autofill";
|
|
18
|
+
identifier: number;
|
|
19
|
+
value: string;
|
|
20
|
+
} | {
|
|
21
|
+
status: "block";
|
|
22
|
+
missing: AssemblySlotGap[];
|
|
23
|
+
};
|
|
24
|
+
export interface AssembleAllocByGuardInput {
|
|
25
|
+
allocByGuard: unknown;
|
|
26
|
+
allocationRef: unknown;
|
|
27
|
+
submission: unknown;
|
|
28
|
+
network?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface AssembleAllocByGuardResult {
|
|
31
|
+
block?: ToolDispatchResult;
|
|
32
|
+
submission?: unknown;
|
|
33
|
+
warnings: string[];
|
|
34
|
+
audit?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function providedSlotIdentifiers(submission: unknown, guardAddr: string): number[];
|
|
37
|
+
export declare function slotSuggestion(slot: AssemblyRequiredSlot, orderAddress: string | undefined, allocationRef: unknown): string;
|
|
38
|
+
export declare function decideSubmissionGaps(required: AssemblyRequiredSlot[], providedIdentifiers: number[], orderAddress: string | undefined, allocationRef?: unknown): SubmissionGapDecision;
|
|
39
|
+
export declare function buildMissingSlotsBlock(opts: {
|
|
40
|
+
guardAddress: string;
|
|
41
|
+
missing: AssemblySlotGap[];
|
|
42
|
+
requiredCount: number;
|
|
43
|
+
}): ToolDispatchResult;
|
|
44
|
+
export declare function mergeAutofillIntoSubmission(submission: unknown, guardAddr: string, slot: {
|
|
45
|
+
identifier: number;
|
|
46
|
+
value: string;
|
|
47
|
+
value_type?: string;
|
|
48
|
+
}): unknown;
|
|
49
|
+
export declare function buildSubmissionAuditEcho(submission: unknown, opts?: {
|
|
50
|
+
autofilled?: {
|
|
51
|
+
identifier: number;
|
|
52
|
+
value: string;
|
|
53
|
+
};
|
|
54
|
+
}): string;
|
|
55
|
+
export declare function assembleAllocByGuardSubmission(input: AssembleAllocByGuardInput): Promise<AssembleAllocByGuardResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LocalMark}from'@wowok/wowok';import{batchQueryObjectsByIds}from'../../graph/onchain/sdk-batch.js';import{TASK_BINDING_SLOT}from'../../knowledge/onchain-constants.js';const ADDR_RE=/^0x[0-9a-fA-F]{64}$/;async function resolveRef(b){if(typeof b!=='string'||b['length']===0x0)return undefined;if(ADDR_RE['test'](b))return b;const c=await LocalMark['Instance']()['get_address'](b)['catch'](()=>undefined)??undefined;return typeof c==='string'&&c['startsWith']('0x')?c:undefined;}function groupBelongsToGuard(a,b){const c=a?.['guard'];if(typeof c!=='string'||c['length']===0x0)return!![];if(ADDR_RE['test'](c))return c['toLowerCase']()===b['toLowerCase']();return!![];}export function providedSlotIdentifiers(a,b){const c=[],d=Array['isArray'](a?.['submission'])?a['submission']:[];for(const e of d){if(!groupBelongsToGuard(e,b))continue;const f=Array['isArray'](e?.['submission'])?e['submission']:[];for(const g of f){const h=Number(g?.['identifier']);if(Number['isFinite'](h))c['push'](h);}}return c;}export function slotSuggestion(a,b,c){const d=Number(a['identifier']),e=String(a['value_type']??''),f=typeof a['name']==='string'&&a['name']?'\x20(\x22'+a['name']+'\x22)':'';if(d===TASK_BINDING_SLOT)return b?'the\x20Order\x20address\x20this\x20Allocation\x20is\x20anchored\x20to\x20—\x20resolved\x20from\x20payment_info.for_object:\x20'+b:'the\x20Order\x20address\x20this\x20Allocation\x20is\x20anchored\x20to\x20(payment_info.for_object)\x20—\x20could\x20NOT\x20be\x20resolved'+((c!==undefined?'\x20from\x20\x22'+String(c)+'\x22':'')+'\x20(allocation\x20unanchored\x20or\x20unread);\x20')+'query\x20the\x20Allocation\x20and\x20pass\x20that\x20Order\x20address';if(d===0xff)return'the\x20protocol\x20once-key\x20bytes\x20(vector<u8>)\x20—\x20order-anchored\x20rails\x20pass\x20[1]+bcs(order);\x20'+'period-keyed\x20rails\x20pass\x20the\x20guard-pinned\x20key\x20(e.g.\x20\x22period-<N>\x22)\x20as\x20bytes';if(e['includes']('Address'))return'the\x20address\x20this\x20rail\x20pays\x20or\x20constrains'+f+'\x20—\x20the\x20escrow\x20anchor\x20(the\x20Order\x20object\x20address;\x20'+'an\x20order-anchored\x20recipient\x20must\x20equal\x20payment_info.for_object)\x20or\x20the\x20Entity\x20address\x20the\x20guard\x20expression\x20pins';if(e['includes']('u64')||e['includes']('u32')||e['includes']('u128')||e['includes']('u8'))return'the\x20human\x20quantity\x20this\x20slot\x20constrains'+f+',\x20in\x20base\x20units\x20(e.g.\x20the\x20claimed\x20amount\x20/\x20'+'threshold\x20/\x20period\x20number\x20the\x20guard\x20expression\x20compares\x20against)';return'the\x20'+(e||'typed')+'\x20value'+f+'\x20the\x20guard\x20expression\x20consumes\x20—\x20read\x20the\x20guard\x27s\x20root\x20expression\x20'+'to\x20derive\x20it\x20(analyze_guard_semantics)';}export function decideSubmissionGaps(a,b,c,d){const e=new Set(b['map'](Number)),f=a['filter'](i=>!e['has'](Number(i['identifier'])));if(f['length']===0x0)return{'status':'pass'};const g=f['filter'](i=>Number(i['identifier'])!==TASK_BINDING_SLOT),h=f['find'](i=>Number(i['identifier'])===TASK_BINDING_SLOT);if(g['length']===0x0&&h&&c)return{'status':'autofill','identifier':TASK_BINDING_SLOT,'value':c};return{'status':'block','missing':f['map'](i=>({'identifier':Number(i['identifier']),'value_type':String(i['value_type']??''),...typeof i['name']==='string'&&i['name']?{'name':i['name']}:{},'suggestion':slotSuggestion(i,c,d),'autofillable':Number(i['identifier'])===TASK_BINDING_SLOT&&!!c}))};}const SUBMISSION_PLACEMENT='Re-issue\x20the\x20SAME\x20operation\x20(data\x20UNCHANGED)\x20adding\x20the\x20envelope\x20below\x20as\x20the\x20TOP-LEVEL\x20'+'`submission`\x20field\x20of\x20the\x20tool\x20call\x20—\x20a\x20SIBLING\x20of\x20`data`\x20and\x20`env`,\x20NEVER\x20inside\x20`data`.\x20'+'Include\x20the\x20slots\x20this\x20call\x20already\x20carries\x20plus\x20EVERY\x20missing\x20slot\x20listed\x20here.';export function buildMissingSlotsBlock(a){const {guardAddress:b,missing:c,requiredCount:d}=a,e=c['map'](h=>'\x20\x20•\x20slot\x20'+h['identifier']+':\x20value_type='+(h['value_type']||'?')+((h['name']?'\x20(name:\x20\x22'+h['name']+'\x22)':'')+'\x20—\x20'+h['suggestion'])+(''+(h['autofillable']?'\x20[auto-fillable\x20—\x20the\x20layer\x20would\x20have\x20injected\x20it,\x20but\x20other\x20slots\x20are\x20still\x20missing]':''))),f=JSON['stringify']({'type':'submission','guard':[{'object':b,'impack':!![]}],'submission':c['map'](h=>({'identifier':h['identifier'],'value':'<'+(h['value_type']||'value')+'\x20—\x20see\x20the\x20suggestion>','value_type':h['value_type']||undefined}))}),g='ALLOC\x20SUBMISSION\x20REFUSED\x20—\x20no\x20transaction\x20was\x20sent.\x20Guard\x20'+b+'\x20(alloc_by_guard)\x20declares\x20'+(d+'\x20submission\x20slot(s)\x20(b_submission=true)\x20and\x20the\x20call\x27s\x20submission\x20envelope\x20is\x20missing\x20')+(c['length']+'\x20of\x20them\x20(identifier'+(c['length']>0x1?'s':'')+'\x20')+(c['map'](h=>h['identifier'])['join'](',\x20')+').\x20Dispatching\x20as-is\x20would\x20abort\x20on-chain\x20with\x20')+'\x22Submission\x20ID\x20not\x20found\x22\x20(abort\x2011).\x0a\x0a'+('Missing\x20slots\x20—\x20fill\x20EVERY\x20one\x20and\x20re-issue:\x0a'+e['join']('\x0a')+'\x0a\x0a')+(SUBMISSION_PLACEMENT+'\x0aFill\x20example\x20(merge\x20into\x20the\x20envelope,\x20keep\x20existing\x20slots):\x0a'+f);return{'content':[{'type':'text','text':g}],'structuredContent':{'result':{'type':'error','error':'alloc_by_guard\x20submission\x20envelope\x20is\x20missing\x20'+c['length']+'\x20required\x20slot(s)\x20'+('(identifiers:\x20'+c['map'](h=>h['identifier'])['join'](',\x20')+')\x20declared\x20by\x20guard\x20'+b+'\x20—\x20')+'the\x20transaction\x20was\x20NOT\x20dispatched\x20(it\x20would\x20abort\x2011,\x20Submission\x20ID\x20not\x20found).','error_code':'submission_slots_missing','refused':!![],'tx_submitted':![],'retryable':!![],'guard':b,'missing_submissions':c,'recovery_hint':'Fill\x20every\x20listed\x20slot\x20(use\x20each\x20slot\x27s\x20suggestion)\x20and\x20re-issue\x20the\x20SAME\x20call\x20with\x20the\x20'+'top-level\x20submission\x20envelope.\x20Address\x20slots\x20take\x20the\x20escrow\x20anchor\x20/\x20entity\x20address\x20the\x20'+'guard\x20expression\x20pins;\x20u64\x20slots\x20take\x20the\x20base-unit\x20quantity;\x20slot\x20254\x20takes\x20the\x20Order\x20'+'address\x20bound\x20to\x20the\x20Allocation\x20(payment_info.for_object).'},'message':'Refused\x20before\x20dispatch:\x20the\x20guard\x20requires\x20'+d+'\x20submission\x20slot(s)\x20and\x20'+(c['length']+'\x20are\x20missing\x20(identifiers:\x20'+c['map'](h=>h['identifier'])['join'](',\x20')+').\x20')+'Fill\x20them\x20per\x20the\x20per-slot\x20suggestions\x20and\x20retry\x20—\x20no\x20funds\x20moved,\x20no\x20gas\x20spent.'}};}export function mergeAutofillIntoSubmission(a,b,c){const d=a&&typeof a==='object'?a:{},e=Array['isArray'](d['submission'])?d['submission']:[],f={'identifier':c['identifier'],'name':'','b_submission':!![],'value_type':c['value_type']??'Address','value':c['value']};let g=![];const h=e['map'](i=>{if(!groupBelongsToGuard(i,b))return i;g=!![];const j=Array['isArray'](i?.['submission'])?i['submission']:[],k=j['some'](l=>Number(l?.['identifier'])===c['identifier']);return{...i,'submission':k?j['map'](l=>Number(l?.['identifier'])===c['identifier']?{...l,'value':c['value']}:l):[...j,f]};});if(!g)return{...d,'submission':[...e,{'guard':b,'submission':[f]}]};return{...d,'submission':h};}function truncate(a,b=0x42){const c=typeof a==='string'?a:String(a??'');return c['length']<=b?c:c['slice'](0x0,b-0x3)+'...';}export function buildSubmissionAuditEcho(a,b){const c=Array['isArray'](a?.['submission'])?a['submission']:[],d=['SUBMISSION\x20AUDIT\x20(alloc_by_guard)\x20—\x20slots\x20actually\x20carried\x20by\x20the\x20dispatched\x20envelope:'];for(const e of c){const f=typeof e?.['guard']==='string'?e['guard']:'(unresolved\x20guard)',g=Array['isArray'](e?.['submission'])?e['submission']:[];if(g['length']===0x0){d['push']('\x20\x20•\x20guard\x20'+f+':\x20(no\x20slots)');continue;}for(const h of g){const i=b?.['autofilled']&&Number(h?.['identifier'])===b['autofilled']['identifier']&&h?.['value']===b['autofilled']['value'];d['push']('\x20\x20•\x20guard\x20'+f+':\x20identifier='+h?.['identifier']+'\x20'+('(value_type='+(h?.['value_type']??'?')+')\x20=\x20'+truncate(h?.['value']))+(''+(i?'\x20\x20[254\x20AUTO-FILLED\x20from\x20the\x20Allocation\x27s\x20payment_info.for_object]':'')));}}return d['join']('\x0a');}export async function assembleAllocByGuardSubmission(b){const c={'warnings':[]};try{const d=await resolveRef(b['allocByGuard']);if(!d)return c;const e=await resolveRef(b['allocationRef']),f=e&&e['toLowerCase']()!==d['toLowerCase']()?[d,e]:[d],g=await batchQueryObjectsByIds(f,b['network'],!![]),h=new Map();for(const q of g??[]){const r=typeof q?.['object']==='string'?q['object']['toLowerCase']():'';if(r)h['set'](r,q);}const i=h['get'](d['toLowerCase']());if(!i||i['type']!=='Guard')return c;const j=i['data']??i,k=Array['isArray'](j?.['table'])?j['table']:[],l=k['filter'](s=>s?.['b_submission']===!![])['map'](s=>({'identifier':Number(s['identifier']),'value_type':typeof s['value_type']==='string'?s['value_type']:String(s['value_type']??''),...typeof s['name']==='string'&&s['name']?{'name':s['name']}:{}}));if(l['length']===0x0)return c;let m;if(e){const s=h['get'](e['toLowerCase']()),t=s?s['data']??s:undefined,u=t?.['payment_info']?.['for_object'];if(typeof u==='string'&&ADDR_RE['test'](u))m=u;}const n=providedSlotIdentifiers(b['submission'],d),p=decideSubmissionGaps(l,n,m,b['allocationRef']);if(p['status']==='pass')return{'warnings':[],'audit':buildSubmissionAuditEcho(b['submission'])};if(p['status']==='autofill'){const v=mergeAutofillIntoSubmission(b['submission'],d,{'identifier':p['identifier'],'value':p['value'],'value_type':'Address'});return{'submission':v,'warnings':['SUBMISSION\x20AUTO-FILL\x20(alloc_by_guard):\x20guard\x20'+d+'\x20requires\x20the\x20protocol\x20task-binding\x20slot\x20'+(p['identifier']+'\x20and\x20the\x20envelope\x20did\x20not\x20carry\x20it\x20—\x20injected\x20the\x20Order\x20address\x20this\x20')+('Allocation\x20is\x20anchored\x20to\x20(payment_info.for_object\x20=\x20'+p['value']+')\x20and\x20dispatching.\x20')+'This\x20is\x20the\x20only\x20deterministic\x20auto-fill;\x20every\x20other\x20slot\x20must\x20come\x20from\x20the\x20caller.'],'audit':buildSubmissionAuditEcho(v,{'autofilled':{'identifier':p['identifier'],'value':p['value']}})};}return{'warnings':[],'block':buildMissingSlotsBlock({'guardAddress':d,'missing':p['missing'],'requiredCount':l['length']})};}catch{return c;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{strictParse,WipOperationsSchema}from'../../schema/index.js';import{generate_wip,verify_wip,sign_wip,wip2html}from'@wowok/wowok';import{analyzeWipDeployment,formatDeployHints}from'../wip-deploy-assist.js';import{wipStorageUpload,wipStorageList,wipStorageDelete}from'./wip-upload.js';import{recordWipUploadAccount,recordWipVerify}from'../wip-verify-ledger.js';export async function handleWipOperations(a){if(typeof a==='object'&&a!==null&&a['type']==='deploy_assist'){const d=a['wipFilePath'];if(typeof d!=='string')return{'content':[{'type':'text','text':'Error:\x20\x27wipFilePath\x27\x20is\x20required\x20for\x20deploy_assist\x20action'}],'structuredContent':{'result':{'type':'error','error':'\x27wipFilePath\x27\x20is\x20required\x20for\x20deploy_assist\x20action'}}};const e=analyzeWipDeployment(d),f=formatDeployHints(e);return{'content':[{'type':'text','text':f||'No\x20deployment\x20needed.'}],'structuredContent':{'result':{'type':'deploy_assist',...e}}};}const b=strictParse(WipOperationsSchema,a,'wip_file\x20input');let c;switch(b['type']){case'generate':{const g=await generate_wip(b['options'],b['outputPath']);c={'result':{'type':'generate','filePath':g}};break;}case'verify':{const h=analyzeWipDeployment(b['wipFilePath']),i=await verify_wip(b['wipFilePath'],b['hash_equal'],b['requireSignature']);i['valid']&&recordWipVerify(b['wipFilePath'],{'hash_equal':b['hash_equal'],'signature_verified':b['requireSignature']===!![]&&i['signatureValid']===!![]});const j=h['needs_deployment']||!i['valid']&&h['classification']['type']!=='data_url';if(j){const k=formatDeployHints(h);c={'result':{'type':'verify',...i,'deployment_assistance':h},'deployment_hints':k};}else c={'result':{'type':'verify',...i}};break;}case'sign':{const l=await sign_wip(b['wipFilePath'],b['account'],b['outputPath']);c={'result':{'type':'sign','filePath':l}};break;}case'wip2html':{const m=await wip2html(b['wipPath'],b['options']),n={'type':'wip2html'};Array['isArray'](m)?n['files']=m:n['filePath']=m;c={'result':n};break;}case'upload':{const o=await wipStorageUpload(b),p=o['url'];typeof p==='string'&&typeof b['account']==='string'&&b['account']['trim']()!==''&&recordWipUploadAccount(p,b['account']);c={'result':o};break;}case'storage_list':{c={'result':await wipStorageList(b)};break;}case'storage_delete':{c={'result':await wipStorageDelete(b)};break;}default:throw new Error('Unknown\x20WIP\x20operation\x20type');}return{'content':[{'type':'text','text':JSON['stringify'](c)}],'structuredContent':c};}
|
|
1
|
+
import{strictParse,WipOperationsSchema}from'../../schema/index.js';import{generate_wip,verify_wip,sign_wip,wip2html}from'@wowok/wowok';import{analyzeWipDeployment,formatDeployHints}from'../wip-deploy-assist.js';import{wipStorageUpload,wipStorageList,wipStorageDelete}from'./wip-upload.js';import{recordWipUploadAccount,recordWipUploadHash,recordWipVerify}from'../wip-verify-ledger.js';export async function handleWipOperations(a){if(typeof a==='object'&&a!==null&&a['type']==='deploy_assist'){const d=a['wipFilePath'];if(typeof d!=='string')return{'content':[{'type':'text','text':'Error:\x20\x27wipFilePath\x27\x20is\x20required\x20for\x20deploy_assist\x20action'}],'structuredContent':{'result':{'type':'error','error':'\x27wipFilePath\x27\x20is\x20required\x20for\x20deploy_assist\x20action'}}};const e=analyzeWipDeployment(d),f=formatDeployHints(e);return{'content':[{'type':'text','text':f||'No\x20deployment\x20needed.'}],'structuredContent':{'result':{'type':'deploy_assist',...e}}};}const b=strictParse(WipOperationsSchema,a,'wip_file\x20input');let c;switch(b['type']){case'generate':{const g=await generate_wip(b['options'],b['outputPath']);c={'result':{'type':'generate','filePath':g}};break;}case'verify':{const h=analyzeWipDeployment(b['wipFilePath']),i=await verify_wip(b['wipFilePath'],b['hash_equal'],b['requireSignature']);i['valid']&&recordWipVerify(b['wipFilePath'],{'hash_equal':b['hash_equal'],'signature_verified':b['requireSignature']===!![]&&i['signatureValid']===!![]});const j=h['needs_deployment']||!i['valid']&&h['classification']['type']!=='data_url';if(j){const k=formatDeployHints(h);c={'result':{'type':'verify',...i,'deployment_assistance':h},'deployment_hints':k};}else c={'result':{'type':'verify',...i}};break;}case'sign':{const l=await sign_wip(b['wipFilePath'],b['account'],b['outputPath']);c={'result':{'type':'sign','filePath':l}};break;}case'wip2html':{const m=await wip2html(b['wipPath'],b['options']),n={'type':'wip2html'};Array['isArray'](m)?n['files']=m:n['filePath']=m;c={'result':n};break;}case'upload':{const o=await wipStorageUpload(b),p=o['url'];typeof p==='string'&&typeof b['account']==='string'&&b['account']['trim']()!==''&&recordWipUploadAccount(p,b['account']);const q=o['hash'];typeof p==='string'&&typeof q==='string'&&recordWipUploadHash(p,q,typeof b['account']==='string'?b['account']:undefined);c={'result':o};break;}case'storage_list':{c={'result':await wipStorageList(b)};break;}case'storage_delete':{c={'result':await wipStorageDelete(b)};break;}default:throw new Error('Unknown\x20WIP\x20operation\x20type');}return{'content':[{'type':'text','text':JSON['stringify'](c)}],'structuredContent':c};}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface StructuredSchemaError {
|
|
|
19
19
|
received_value?: unknown;
|
|
20
20
|
suggestion: string;
|
|
21
21
|
}
|
|
22
|
+
export declare function buildSchemaPreview(schema: Record<string, unknown>, toolName: string, data: unknown): string;
|
|
22
23
|
export declare function dispatchToolCall(name: string, args: unknown, options?: DispatchOptions, req?: ToolRequestContext): Promise<ToolDispatchResult>;
|
|
23
24
|
export interface ToolListEntry {
|
|
24
25
|
name: string;
|
package/dist/tools/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from'zod';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{fromJsonSchema}from'@modelcontextprotocol/server';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),SCHEMA_DIR_CANDIDATES=[join(__dirname,'..','schemas'),join(__dirname,'..','..','dist','schemas')],preGeneratedSchemaCache=new Map();import{wrapHandlerWithErrorShape,dispatchWithHarness,withTimeout}from'./wrap.js';import{sanitizeToolDispatchResult}from'./sanitize-output.js';import{getStartupUpgradeNotice,upgradePolicyPath}from'./upgrade-check.js';import{classifyError}from'../schema/call/semantic.js';import{findLatin1Mojibake,mojibakeBlockResult}from'./transport-integrity.js';import{ONCHAIN_TOOLS}from'./registry/onchain.js';import{LOCAL_TOOLS}from'./registry/local.js';import{FILE_TOOLS}from'./registry/files.js';import{MESSENGER_TOOLS}from'./registry/messenger.js';import{QUERY_TOOLS}from'./registry/query.js';import{BRIDGE_TOOLS}from'./registry/bridge.js';import{CONFIG_TOOLS}from'./registry/config.js';import{EVALUATION_TOOLS}from'./registry/evaluation.js';import{IDENTITY_TOOLS}from'./registry/identity.js';import{BUSINESS_TOOLS}from'./registry/business.js';import{AGENT_TOOLS}from'./registry/agent.js';import{MONITOR_TOOLS}from'./registry/monitor.js';import{INTERACTION_TOOLS}from'./registry/interaction.js';export{monitorEventStore,MonitorEventStore,monitorEventId}from'../monitor/EventStore.js';export{monitorLoop,MonitorLoop}from'../monitor/MonitorLoop.js';export{MONITOR_CAPTURE_TYPES}from'../monitor/normalize.js';export{NETWORK_FIELD_BY_QUERY}from'./handlers/query.js';export{resolveGateControls,resolveEffectiveOverrides}from'../persona/index.js';export{SYSTEM_OVERRIDE_SETTINGS}from'../persona/index.js';export const TOOL_REGISTRY=[...ONCHAIN_TOOLS,...LOCAL_TOOLS,...FILE_TOOLS['slice'](0x0,0x1),...MESSENGER_TOOLS,...FILE_TOOLS['slice'](0x1),...QUERY_TOOLS,...BRIDGE_TOOLS,...CONFIG_TOOLS,...EVALUATION_TOOLS,...IDENTITY_TOOLS,...BUSINESS_TOOLS,...AGENT_TOOLS,...MONITOR_TOOLS,...INTERACTION_TOOLS];export const TOOL_REGISTRY_MAP=new Map(TOOL_REGISTRY['map'](a=>[a['name'],a]));export const SUB_TOOL_COUNT=TOOL_REGISTRY['length'];const SUB_TOOL_NAMES=TOOL_REGISTRY['map'](a=>a['name']),WowokToolRuntimeSchema=fromJsonSchema({'type':'object'}),WowokToolDisplaySchema=z['object']({'tool':z['enum'](SUB_TOOL_NAMES)['optional']()['describe']('The\x20sub-tool\x20to\x20execute.\x20Each\x20sub-tool\x20has\x20its\x20own\x20parameter\x20schema.'),'data':z['record'](z['string'](),z['unknown']())['optional']()['describe']('Sub-tool\x20specific\x20parameters.\x20If\x20validation\x20fails,\x20the\x20response\x20includes\x20the\x20correct\x20schema\x20for\x20this\x20sub-tool\x20—\x20read\x20it,\x20fix\x20your\x20params,\x20and\x20retry.'),'submission':z['record'](z['string'](),z['unknown']())['optional']()['describe']('Guard\x20submission\x20slots\x20(top-level\x20placement,\x20sibling\x20of\x20data/env).\x20Alternative:\x20place\x20inside\x20data.'),'env':z['record'](z['string'](),z['unknown']())['optional']()['describe']('Environment\x20(account/network/confirmed/...).\x20Top-level\x20placement\x20is\x20folded\x20into\x20data.env.'),'tool_name':z['enum'](SUB_TOOL_NAMES)['optional']()['describe']('DEPRECATED\x20alias\x20for\x20\x27tool\x27.\x20Use\x20\x27tool\x27\x20instead.'),'args':z['record'](z['string'](),z['unknown']())['optional']()['describe']('DEPRECATED\x20alias\x20for\x20\x27data\x27.\x20Use\x20\x27data\x27\x20instead.'),'name':z['enum'](SUB_TOOL_NAMES)['optional']()['describe']('DEPRECATED\x20alias\x20for\x20\x27tool\x27.\x20Use\x20\x27tool\x27\x20instead.'),'params':z['record'](z['string'](),z['unknown']())['optional']()['describe']('DEPRECATED\x20alias\x20for\x20\x27data\x27.\x20Use\x20\x27data\x27\x20instead.')})['describe']('WoWok\x20unified\x20tool\x20input.\x20Call\x20with\x20{\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{<params>}\x20}.\x20'+'Aliases:\x20tool_name/name→tool,\x20args/params→data.'),SUB_TOOL_LIST=TOOL_REGISTRY['map'](a=>'\x20\x20'+a['name']+'\x20—\x20'+a['config']['summary'])['join']('\x0a'),SKILLS_MISMATCH_POINTER='Structured\x20role-based\x20guidance\x20(WHEN\x20and\x20in\x20what\x20ORDER\x20to\x20use\x20WoWok\x20sub-tools)\x20is\x20available\x20via\x20the\x20WoWok\x20Skills:\x20install\x20with\x20\x22npm\x20install\x20-g\x20@wowok'+'/skills\x22\x20(verify\x20with\x20\x22wowok-skills\x20doctor\x22),\x20or\x20fetch\x20orientation\x20now\x20via\x20wowok_buildin_info\x20info=\x22getting\x20started\x22.';function schemaMismatchHint(a){return'Fix\x20your\x20parameters\x20based\x20on\x20the\x20schema\x20below\x20and\x20retry.\x20CACHE\x20THIS\x20SCHEMA\x20for\x20future\x20'+a+'\x20calls\x20—\x20you\x20don\x27t\x20need\x20to\x20query\x20it\x20again.\x0a'+SKILLS_MISMATCH_POINTER;}const WOWOK_TOOL_DESCRIPTION=['WoWok\x20MCP\x20unified\x20interface.\x20Call\x20with\x20{\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{<params>}\x20}.','','\x20\x20▶\x20START\x20HERE\x20—\x20WoWok\x20Skills\x20(recommended):','\x20\x20\x20\x20Role-based\x20playbooks\x20(onboarding,\x20building,\x20buying,\x20fulfillment,\x20arbitration,\x20governance)','\x20\x20\x20\x20sit\x20ON\x20TOP\x20of\x20this\x20MCP\x20and\x20materially\x20reduce\x20failed\x20calls\x20by\x20telling\x20you\x20WHEN\x20and\x20in\x20what','\x20\x20\x20\x20ORDER\x20to\x20use\x20the\x2030+\x20sub-tools\x20below.\x20One\x20command\x20installs\x20them\x20into\x20every\x20detected\x20AI','\x20\x20\x20\x20client\x20AND\x20registers\x20this\x20MCP\x20server\x20(idempotent\x20postinstall):','\x20\x20\x20\x20\x20\x20npm\x20install\x20-g\x20@wowok'+'/skills','\x20\x20\x20\x20Verify:\x20wowok-skills\x20doctor\x20\x20\x20Repair\x20an\x20old\x20install:\x20wowok-skills\x20init\x20--force','\x20\x20\x20\x20Machine-readable\x20orientation\x20+\x20best-effort\x20detection\x20of\x20whether\x20skills\x20are\x20installed\x20here:','\x20\x20\x20\x20\x20\x20wowok({\x20tool:\x20\x22wowok_buildin_info\x22,\x20data:\x20{\x20info:\x20\x22getting\x20started\x22\x20}\x20})','\x20\x20▶\x20COLD\x20START:\x20the\x20FIRST\x20call\x20after\x20server\x20boot\x20can\x20take\x20~20\x20seconds\x20(server\x20bootstraps\x20via\x20npx).','\x20\x20\x20\x20Wait\x20for\x20it\x20—\x20a\x20timed-out\x20first\x20response\x20is\x20startup\x20latency,\x20not\x20a\x20broken\x20server,\x20and\x20never\x20a','\x20\x20\x20\x20reason\x20to\x20retry\x20a\x20write\x20transaction.\x20Later\x20calls\x20are\x20fast.','','\x20\x20tool:\x20name\x20of\x20the\x20sub-tool\x20(string)','\x20\x20data:\x20sub-tool\x20parameters\x20(object)','','\x20\x20Aliases\x20accepted\x20(deprecated):\x20tool_name/name\x20for\x20tool,\x20args/params\x20for\x20data.','\x20\x20Inline\x20params\x20also\x20accepted:\x20{\x20tool:\x20\x22<sub-tool>\x22,\x20<param1>:\x20...,\x20<param2>:\x20...\x20}','\x20\x20⚠️\x20RESERVED\x20KEYS\x20cannot\x20be\x20passed\x20inline:\x20name\x20/\x20tool_name\x20/\x20args\x20/\x20params\x20are\x20the','\x20\x20deprecated\x20aliases\x20themselves\x20—\x20an\x20inline\x20\x27name\x27\x20is\x20consumed\x20as\x20the\x20tool\x20alias\x20and','\x20\x20never\x20reaches\x20the\x20sub-tool.\x20Pass\x20such\x20fields\x20inside\x20data\x20instead.','','\x20\x20EXAMPLE:\x20wowok({\x20tool:\x20\x22schema_query\x22,\x20data:\x20{\x20action:\x20\x22get\x22,\x20name:\x20\x22onchain_operations\x22\x20}\x20})','\x20\x20EXAMPLE:\x20wowok({\x20tool:\x20\x22wowok_buildin_info\x22,\x20data:\x20{\x20info:\x20\x22mainnet\x20bridge\x20tokens\x22\x20}\x20})','\x20\x20EXAMPLE\x20(inline\x20params):\x20wowok({\x20tool:\x20\x22query_toolkit\x22,\x20query_type:\x20\x22account_list\x22\x20})','','Available\x20sub-tools\x20('+SUB_TOOL_COUNT+'):',SUB_TOOL_LIST,'','SCHEMA-GATED\x20EXECUTION:','\x20\x20If\x20your\x20parameters\x20don\x27t\x20match\x20the\x20sub-tool\x27s\x20schema,\x20the\x20response\x20will\x20include:','\x20\x20\x20\x20result.status\x20=\x20\x22schema_mismatch\x22','\x20\x20\x20\x20result.errors\x20=\x20specific\x20validation\x20errors\x20(field\x20path\x20+\x20expected\x20type)','\x20\x20\x20\x20result.hint\x20=\x20instructions\x20to\x20fix\x20and\x20retry','\x20\x20\x20\x20schema.input\x20=\x20the\x20correct\x20JSON\x20schema\x20for\x20the\x20sub-tool','\x20\x20\x20\x20schema.tool\x20=\x20which\x20sub-tool\x20this\x20schema\x20belongs\x20to','\x20\x20Read\x20the\x20schema,\x20fix\x20your\x20params,\x20and\x20retry.\x20This\x20is\x20normal\x20—\x20no\x20need\x20to\x20call\x20schema_query\x20separately.','','SCHEMA\x20CACHING:','\x20\x20Each\x20sub-tool\x20has\x20a\x20DIFFERENT\x20schema.\x20When\x20you\x20receive\x20a\x20schema\x20in\x20a\x20mismatch\x20response:','\x20\x20\x20\x201.\x20Read\x20the\x20schema\x20carefully','\x20\x20\x20\x202.\x20Fix\x20your\x20parameters','\x20\x20\x20\x203.\x20Retry\x20the\x20call','\x20\x20\x20\x204.\x20CACHE\x20the\x20schema\x20in\x20your\x20context\x20for\x20future\x20calls\x20to\x20the\x20SAME\x20sub-tool','\x20\x20You\x20should\x20only\x20need\x20to\x20see\x20each\x20sub-tool\x27s\x20schema\x20once\x20per\x20conversation.','','ON-CHAIN\x20BUSINESS\x20INTELLIGENCE\x20(query_toolkit,\x20READ-ONLY\x20—\x20no\x20local\x20project\x20entity):','\x20\x20query_toolkit\x20query_type=\x27service_panorama\x27\x20→\x20ONE-CALL\x20full\x20Service\x20context\x20(workflow\x20graph,\x20guards,\x20supply\x20chain,\x20orders)','\x20\x20query_toolkit\x20query_type=\x27machine_panorama\x27\x20→\x20Machine\x20context\x20(head\x20+\x20fields\x20+\x20workflow\x20graph\x20+\x20Progress\x20list)','\x20\x20query_toolkit\x20query_type=\x27object_panorama\x27\x20→\x20detail\x20panorama\x20for\x20Progress/Demand/Order/Arb/Repository','\x20\x20query_toolkit\x20query_type=\x27review_pack\x27\x20→\x20typed\x20ReviewPack\x20for\x20the\x20client\x27s\x20generic\x20ReviewPackRenderer','\x20\x20query_toolkit\x20query_type=\x27assemble_context\x27\x20→\x20semantic\x20context\x20assembly\x20from\x20on-chain\x20objects','\x20\x20query_toolkit\x20query_type=\x27reverse_map\x27\x20→\x20deterministic\x20L4→L1\x20business\x20report\x20(merchant\x20profile\x20/\x20user\x20risk\x20/\x20game\x20theory)','\x20\x20query_toolkit\x20query_type=\x27participation_radar\x27\x20→\x20in-flight\x20order\x20participation\x20analysis\x20for\x20ONE\x20account','\x20\x20query_toolkit\x20query_type=\x27order_aggregate\x27\x20→\x20CROSS-ORDER\x20aggregate\x20(count\x20+\x20exact\x20amount\x20sums\x20per\x20service/machine/owner,\x20funding-target\x20checks\x20like\x20\x273\x20x\x206\x20>=\x2018\x27)','\x20\x20query_toolkit\x20query_type=\x27relationship_profile\x27\x20→\x20business\x20relationship\x20graph\x20for\x20ONE\x20account\x20(power/interest/value-flow\x20edges,\x20K3/19)','\x20\x20industry_pack_operation\x20action=\x27recommend_industry\x27/\x27list_modes\x27\x20→\x20industry\x20mode\x20registry\x20(GLM6/92\x20§E)','\x20\x20strategy_review_operation\x20action=\x27collect\x27/\x27review\x27/\x27list_snapshots\x27\x20→\x20posture-weighted\x20scorecard\x20+\x20periodic\x20review\x20(current-layer\x20proposals\x20only)','\x20\x20goal_operation\x20action=\x27merchant_guide\x27\x20→\x2010-step\x20merchant\x20onboarding\x20wizard\x20(never\x20executes\x20on-chain\x20ops)','\x20\x20benchmark_migration_operation\x20→\x20industry\x20archetype\x20templates\x20+\x20one-click\x20competitor\x20migration:','\x20\x20\x20\x20template_list\x20/\x20template_get\x20/\x20template_scan\x20(pre-deploy\x20risk\x20scan)\x20/\x20template_generate\x20(creation\x20plan)','\x20\x20\x20\x20migration_import\x20(store\x20URL/description\x20→\x20MigrationLog)\x20→\x20migration_review\x20(user\x20confirmation)\x20→\x20migration_apply\x20(scan-first\x20creation\x20plan;\x20testnet\x20default)','','═══════════════════════════════════════════════════════════════','BUILD/BUY\x20POLICY\x20(no\x20local\x20projects\x20—\x20chain\x20state\x20is\x20the\x20source\x20of\x20truth):','═══════════════════════════════════════════════════════════════','','CASE\x201\x20—\x20COMPLEX\x20REQUIREMENT\x20(user\x20wants\x20to\x20build/deploy\x20a\x20full\x20service):','\x20\x20→\x20Plan\x20with\x20goal_operation\x20action=\x27analyze_intent\x27\x20(C1:\x20intent\x20→\x20per-object\x20puzzle\x20snapshots\x20+\x20creation\x20order),','\x20\x20\x20\x20then\x20\x27aggregate_risks\x27\x20(C2:\x20cross-object\x20risk\x20calibration)\x20and\x20\x27trace_substeps\x27\x20(C3:\x20substep\x20DAG\x20coherence).','\x20\x20→\x20Alternatively\x20run\x20goal_operation\x20action=\x27merchant_guide\x27\x20for\x20a\x20guided\x2010-step\x20onboarding\x20plan.','\x20\x20→\x20If\x20the\x20user\x20wants\x20to\x20build\x20LIKE\x20an\x20industry\x20archetype\x20(\x27build\x20like\x20the\x20retail\x20leader\x20model\x27)\x20or','\x20\x20\x20\x20MIGRATE\x20an\x20existing\x20store\x20(hands\x20over\x20a\x20store\x20URL/description),\x20use\x20benchmark_migration_operation','\x20\x20\x20\x20(template_list\x20→\x20template_scan\x20→\x20template_generate,\x20or\x20migration_import\x20→\x20migration_review\x20→\x20migration_apply).','\x20\x20→\x20Create\x20objects\x20via\x20onchain_operations,\x20then\x20publish\x20the\x20Service.','','CASE\x202\x20—\x20SINGLE\x20OBJECT\x20CREATION\x20(user\x20wants\x20one\x20specific\x20object):','\x20\x20→\x20Create\x20directly\x20via\x20onchain_operations.\x20No\x20project\x20bookkeeping\x20needed.','','CASE\x203\x20—\x20CONSUMER\x20FLOW\x20(user\x20wants\x20to\x20buy/evaluate\x20a\x20service):','\x20\x20→\x20query_toolkit\x20query_type=\x27service_panorama\x27\x20or\x20\x27review_pack\x27\x20for\x20the\x20detail\x20page,','\x20\x20\x20\x20\x27reverse_map\x27\x20for\x20the\x20deterministic\x20buy\x20report\x20(add\x20Machine/Allocation\x20for\x20refund-path\x20detection),','\x20\x20\x20\x20then\x20onchain_operations\x20service_buy.','','CASE\x204\x20—\x20SIMPLE\x20QUERY\x20(user\x20wants\x20to\x20check\x20object\x20info,\x20balance,\x20etc.):','\x20\x20→\x20Proceed\x20directly\x20with\x20the\x20query.','═══════════════════════════════════════════════════════════════']['join']('\x0a');function joinIssuePath(a){return a['length']>0x0?a['map'](b=>typeof b==='number'?'['+b+']':String(b))['join']('.')['replace']('.[','['):'(root)';}function unionVariantErrors(a){const b=a,d=b['errors']??b['unionErrors']??b['issues'];if(!Array['isArray'](d))return[];const e=[];for(const f of d){if(!f)continue;if(Array['isArray'](f))f['every'](g=>!!g&&typeof g==='object'&&'code'in g)&&e['push']({'issues':f});else typeof f==='object'&&Array['isArray'](f['issues'])&&e['push']({'issues':f['issues']});}return e;}function variantScore(a){let b=0x0;for(const c of a['issues']){b+=0xa;const d=c;if(c['code']==='invalid_type')d['received']==='undefined'?b+=0x14:b-=0x5;else{if(c['code']==='unrecognized_keys'){const e=Array['isArray'](d['keys'])?d['keys']['length']:0x1;b+=0xf+e*0x5;}else{if(c['code']==='invalid_union'){const f=unionVariantErrors(c);if(f['length']>0x0)b+=Math['min'](...f['map'](variantScore));}}}}return b;}function variantSummary(a,b=0x3){const c=[];for(const e of a['issues']){const f=e;if(e['code']==='unrecognized_keys'){const g=Array['isArray'](f['keys'])?f['keys']['join'](',\x20'):'?';c['push']('unknown\x20field(s):\x20'+g);}else e['code']==='invalid_type'&&f['received']==='undefined'?c['push']('missing:\x20'+joinIssuePath([...e['path']])):c['push'](e['code']+'\x20at\x20'+joinIssuePath([...e['path']]));if(c['length']>=b)break;}const d=a['issues']['length']>b?'\x20(+'+(a['issues']['length']-b)+'\x20more)':'';return c['length']>0x0?c['join'](';\x20')+d:'shape\x20mismatch';}function resolveIssuePath(a,b){if(a['length']===0x0)return joinIssuePath(b);const c=b['length']>=a['length']&&a['every']((d,e)=>b[e]===d);return joinIssuePath(c?b:[...a,...b]);}function subToolRoutingHint(a,b){if(a!=='query_type')return'';const c=b['toLowerCase']();if(c['startsWith']('onchain_table'))return'\x20—\x20ROUTING:\x20table\x20/\x20table-item\x20queries\x20belong\x20to\x20the\x20SEPARATE\x20\x27onchain_table_data\x27\x20tool\x20—\x20call\x20onchain_table_data\x20with\x20this\x20query_type\x20(and\x20its\x20parent/address\x20params)\x20instead\x20of\x20query_toolkit';return'';}function matchedVariantLegalKeys(a){if(!a||typeof a!=='object')return[];const b=a['properties'];if(!b||typeof b!=='object'||Array['isArray'](b))return[];return Object['keys'](b)['sort']();}function absoluteIssuePath(a,b){const c=a['length']>0x0&&b['length']>=a['length']&&a['every']((d,e)=>b[e]===d);return c?b:[...a,...b];}function pushFlattened(a,b,c,d,e=[]){for(const f of a['issues']){if(f['code']==='invalid_union'){const g=f,h=[...f['path']],i=Array['isArray'](g['errors'])?g['errors']['length']:Array['isArray'](g['unionErrors'])?g['unionErrors']['length']:0x0,j=unionVariantErrors(f);if(j['length']===0x0){const o=resolveIssuePath(e,h),p=c!==undefined?extractValueAtPath(c,absoluteIssuePath(e,h)):undefined,q=p!==undefined;let r;if(i>0x0)r=(q?'value\x20does\x20not\x20match\x20any\x20of\x20the\x20union\x27s':'missing\x20required\x20union\x20field\x20—\x20no\x20value\x20provided;\x20union\x20accepts')+'\x20'+i+'\x20shape(s);\x20see\x20the\x20schema\x20preview\x20for\x20the\x20accepted\x20fields';else{if(q&&p&&typeof p==='object'&&!Array['isArray'](p)){const s=p,t=['operation_type','query_type','type','action','op']['find'](u=>typeof s[u]==='string');r=t?'discriminator\x20\x27'+t+'\x27=\x22'+String(s[t])+'\x22\x20does\x20not\x20match\x20any\x20variant;\x20check\x20the\x20\x22Valid\x20\x27'+t+'\x27\x20values\x22\x20line\x20in\x20the\x20schema\x20preview\x20below'+subToolRoutingHint(t,String(s[t])):'value\x20does\x20not\x20match\x20any\x20union\x20variant\x20(no\x20per-variant\x20details\x20available);\x20see\x20the\x20schema\x20preview';}else{if(q&&typeof p==='string'&&h['length']>0x0){const u=String(h[h['length']-0x1]);r='discriminator\x20\x27'+u+'\x27=\x22'+p+'\x22\x20does\x20not\x20match\x20any\x20variant;\x20check\x20the\x20\x22Valid\x20\x27'+u+'\x27\x20values\x22\x20line\x20in\x20the\x20schema\x20preview\x20below'+subToolRoutingHint(u,p);}else r='value\x20does\x20not\x20match\x20any\x20union\x20variant\x20(no\x20per-variant\x20details\x20available);\x20see\x20the\x20schema\x20preview';}}b['push']({'kind':'header','path':o,'code':'invalid_union','message':r});d&&(b[b['length']-0x1]={'kind':'header','path':o+'\x20['+d+']','code':'invalid_union','message':r});continue;}const k=j['map']((v,w)=>({'idx':w,'err':v,'score':variantScore(v)}))['sort']((v,w)=>v['score']-w['score']),l=k[0x0],m=k['slice'](0x1)['map'](v=>'variant\x20'+(v['idx']+0x1)+':\x20'+variantSummary(v['err']))['join']('\x20|\x20');b['push']({'kind':'header','path':resolveIssuePath(e,h),'code':'invalid_union','message':'no\x20union\x20variant\x20matched\x20('+j['length']+'\x20checked);\x20closest\x20=\x20variant\x20'+(l['idx']+0x1)+'\x20—\x20it\x20fails\x20on:\x20'+variantSummary(l['err'])+(m?'\x20—\x20others:\x20'+m:'')});const n=h['length']>0x0&&h['every']((v,w)=>e[w]===v)?h:[...e,...h];pushFlattened(l['err'],b,c,'variant\x20'+(l['idx']+0x1),n);}else b['push']({'kind':'issue','issue':f,'variantTag':d,'pathPrefix':e});}}function flattenZodIssues(a,b){const c=[];pushFlattened(a,c,b);const d=(f,g)=>{if(f['kind']!=='issue'||g['kind']!=='issue')return![];const h=absoluteIssuePath(f['pathPrefix']??[],f['issue']['path']),i=absoluteIssuePath(g['pathPrefix']??[],g['issue']['path']);return i['length']>h['length']&&h['every']((j,l)=>i[l]===j);},e=c['filter'](f=>{if(f['kind']!=='issue'||f['issue']['code']!=='unrecognized_keys')return!![];return!c['some'](g=>g!==f&&g['kind']==='issue'&&g['issue']['code']!=='unrecognized_keys'&&d(f,g));});return e;}const RECEIVED_VALUE_MAX=0x1f4;function truncateEcho(a){return a['length']>RECEIVED_VALUE_MAX?a['slice'](0x0,RECEIVED_VALUE_MAX)+'...(truncated,\x20'+(a['length']-RECEIVED_VALUE_MAX)+'\x20more\x20chars)':a;}function formatZodErrors(a,b){return flattenZodIssues(a,b)['map'](c=>{if(c['kind']==='header')return c['path']+'\x20['+c['code']+']:\x20'+c['message'];const d=c['issue'],e=resolveIssuePath(c['pathPrefix']??[],d['path']),f=d['code'],g=d['message'];let h='';const i=d;if(f==='invalid_type'){const l=i['expected'],m=i['received'];typeof l==='string'&&typeof m==='string'&&(h='\x20(expected:\x20'+l+';\x20received:\x20'+m+')');}else{if(f==='invalid_value'){const n=i['expected'];if(n!==undefined){const o=typeof n==='string'?n:JSON['stringify'](n);h='\x20(expected:\x20'+o['slice'](0x0,0x3c)+')';}}else{if(f==='too_big'||f==='too_small'){const p=i['maximum']??i['minimum'],q=i['origin'];p!==undefined&&q!==undefined&&(h='\x20('+q+':\x20'+p+')');}}}const j=extractValueAtPath(b,absoluteIssuePath(c['pathPrefix']??[],d['path']));if(j!==undefined){const r=typeof j==='string'?'\x22'+truncateEcho(j)+'\x22':typeof j==='object'?truncateEcho(JSON['stringify'](j)):String(j);!h['includes']('received:')&&(h+='\x20(received\x20value:\x20'+r+')');}const k=c['variantTag']?'\x20['+c['variantTag']+']':'';return''+e+k+'\x20['+f+']:\x20'+g+h;});}function generateSuggestion(a,b,c){const d=b;switch(a){case'invalid_type':{const e=d['expected'];if(e==='number'&&typeof c==='string')return'Convert\x20to\x20number:\x20'+Number(c);if(e==='string')return'Wrap\x20in\x20quotes\x20or\x20call\x20String(...)';if(e==='array')return'Wrap\x20in\x20array:\x20['+JSON['stringify'](c)+']';if(e==='object')return'Provide\x20an\x20object,\x20not\x20a\x20primitive';return'Convert\x20value\x20to\x20'+(e??'the\x20expected\x20type');}case'invalid_enum_value':{const f=d['options'],g=Array['isArray'](f)?f['map'](h=>JSON['stringify'](h))['join']('\x20|\x20'):String(f);return'Use\x20one\x20of:\x20'+g;}case'invalid_literal':{const h=d['expected'];return'Use\x20the\x20exact\x20value:\x20'+JSON['stringify'](h);}case'too_small':{const i=d['minimum'],j=d['type'];if(j==='array')return'Add\x20at\x20least\x20'+i+'\x20element(s)\x20to\x20the\x20array';if(j==='string')return'String\x20must\x20be\x20at\x20least\x20'+i+'\x20character(s)\x20long';if(j==='number')return'Use\x20a\x20value\x20>=\x20'+i;return'Value\x20must\x20be\x20>=\x20'+i;}case'too_big':{const k=d['maximum'],l=d['type'];if(l==='array')return'Reduce\x20array\x20to\x20at\x20most\x20'+k+'\x20element(s)';if(l==='string')return'Shorten\x20string\x20to\x20at\x20most\x20'+k+'\x20character(s)';if(l==='number')return'Use\x20a\x20value\x20<=\x20'+k;return'Value\x20must\x20be\x20<=\x20'+k;}case'unrecognized_keys':{const m=d['keys'];return'Remove\x20unknown\x20field(s):\x20'+(m??[])['join'](',\x20')+'.\x20Check\x20the\x20schema\x20for\x20valid\x20field\x20names.';}case'invalid_union':{return'Value\x20does\x20not\x20match\x20any\x20of\x20the\x20union\x20variants\x20—\x20see\x20the\x20\x22closest\x20variant\x22\x20line\x20above\x20for\x20the\x20concrete\x20field\x20error(s).';}case'invalid_string':{const n=d['validation'];if(n==='url')return'Provide\x20a\x20valid\x20URL\x20string';if(n==='email')return'Provide\x20a\x20valid\x20email\x20string';if(n==='uuid')return'Provide\x20a\x20valid\x20UUID\x20string';if(n==='regex')return'String\x20does\x20not\x20match\x20the\x20required\x20pattern';return'Provide\x20a\x20valid\x20string\x20matching\x20the\x20validation:\x20'+(n??'unknown');}case'invalid_date':{return'Provide\x20a\x20valid\x20Date\x20object\x20or\x20ISO\x20date\x20string';}case'not_finite':{return'Use\x20a\x20finite\x20number\x20(not\x20Infinity\x20or\x20NaN)';}case'invalid_arguments':{return'Arguments\x20do\x20not\x20match\x20the\x20expected\x20schema';}case'invalid_return_type':{return'Return\x20type\x20does\x20not\x20match\x20the\x20expected\x20schema';}case'custom':{return'Custom\x20validation\x20failed\x20—\x20see\x20the\x20field\x27s\x20description\x20in\x20the\x20schema';}default:{return'Fix\x20the\x20value\x20at\x20\x27'+b['path']['join']('.')+'\x27\x20based\x20on\x20the\x20schema';}}}function formatZodErrorsStructured(a,b){return flattenZodIssues(a,b)['flatMap'](c=>{if(c['kind']==='header'){const l=c['message']['match'](/closest = variant (\d+)/),m=c['message']['includes']('missing\x20required\x20union\x20field'),n=c['message']['includes']('does\x20not\x20match\x20any\x20variant'),o=l?'Fix\x20the\x20field\x20error(s)\x20listed\x20for\x20variant\x20'+l[0x1]+'\x20below.':m?'Provide\x20this\x20required\x20field\x20with\x20one\x20of\x20the\x20accepted\x20shapes,\x20and\x20check\x20field-name\x20spelling\x20against\x20the\x20schema\x20preview.':n?'No\x20union\x20variant\x20accepts\x20this\x20discriminator\x20—\x20pick\x20a\x20value\x20from\x20the\x20\x27Valid\x20...\x20values\x27\x20line\x20in\x20the\x20schema\x20preview\x20below.\x20If\x20the\x20value\x20belongs\x20to\x20a\x20sub-tool\x20(e.g.\x20onchain_table*\x20→\x20onchain_table_data),\x20resend\x20it\x20to\x20that\x20tool.':'No\x20union\x20variant\x20matched\x20—\x20check\x20the\x20schema\x20preview\x20below\x20for\x20the\x20accepted\x20shapes.';return[{'path':c['path'],'code':c['code'],'message':c['message'],'suggestion':o}];}const d=c['issue'],e=resolveIssuePath(c['pathPrefix']??[],d['path']),f=d['code'],g=c['variantTag']?d['message']+'\x20(closest\x20union\x20variant:\x20'+c['variantTag']+')':d['message'],h=d;let i;if(f==='invalid_type'){const p=h['expected'],q=h['received'];typeof p==='string'&&typeof q==='string'&&(i=p);}else{if(f==='invalid_value'){const r=h['expected'],s=h['options'];if(Array['isArray'](s))i=s['map'](t=>JSON['stringify'](t))['join']('\x20|\x20');else r!==undefined&&(i=typeof r==='string'?r:JSON['stringify'](r));}else{if(f==='too_big'||f==='too_small'){const t=h['maximum']??h['minimum'];t!==undefined&&(i=String(t));}}}const j=extractValueAtPath(b,absoluteIssuePath(c['pathPrefix']??[],d['path'])),k=generateSuggestion(f,d,j);return[{'path':e,'code':f,'message':g,'expected':i,'received_value':j,'suggestion':k}];});}function extractValueAtPath(a,b){if(a===undefined||a===null||b['length']===0x0)return undefined;let c=a;for(const d of b){if(c===undefined||c===null)return undefined;if(typeof d==='number'){if(!Array['isArray'](c))return undefined;c=c[d];}else{if(typeof c!=='object')return undefined;c=c[d];}}return c;}function zodTopLevelShape(a){let b=a;while(!![]){const e=b['_def'];if(!e)break;const f=e['typeName']==='ZodEffects'?e['schema']:e['out']??e['innerType'];if(!f||f===b)break;b=f;}const c=b['_def'],d=typeof c?.['shape']==='function'?c['shape']():c?.['shape'];return d&&typeof d==='object'?d:undefined;}function checkUnknownFields(a,b){const c=zodTopLevelShape(a);if(!c||typeof b!=='object'||b===null)return[];const d=Object['keys'](c),e=Object['keys'](b);return e['filter'](g=>!d['includes'](g));}function zodUnionAwareKeyCheck(a,b){let c=a;while(!![]){const g=c['_def'];if(!g)break;const h=g['typeName']==='ZodEffects'?g['schema']:g['out']??g['innerType'];if(!h||h===c)break;c=h;}const d=c['_def']?.['options']??[c];let e=![],f=![];for(const i of d){const j=zodTopLevelShape(i);if(!j)continue;if(b in j)e=!![];if('env'in j)f=!![];}return{'declared':e,'hasEnvSlot':f};}function extractRelevantSchema(a,b,c){if(b==='onchain_operations'&&typeof c==='object'&&c!==null){const d=c['operation_type'];if(typeof d==='string'){const e='onchain_operations_'+d,f=loadPreGeneratedSchema(e);if(f)return f;}}return a;}function isSchemaValidationError(a){return a['startsWith']('Unknown\x20')&&a['includes']('field')||a['includes']('expected')&&a['includes']('received')||a['includes']('Invalid\x20input')||a['includes']('Required');}function variantConstValue(a,b){const c=a['properties'];if(!c||typeof c!=='object')return undefined;const d=c[b];if(!d)return undefined;if(typeof d['const']==='string')return d['const'];if(Array['isArray'](d['enum'])&&d['enum']['length']===0x1&&typeof d['enum'][0x0]==='string')return d['enum'][0x0];return undefined;}function pickUnionVariant(a,b){const c=['query_type','operation_type','type'],d=b&&typeof b==='object'&&!Array['isArray'](b)?Object['keys'](b):[],e=[...c,...d['filter'](f=>!c['includes'](f))];for(const f of e){const g=b?.[f];if(typeof g!=='string')continue;for(let h=0x0;h<a['length'];h++){const j=a[h];if(j&&typeof j==='object'&&variantConstValue(j,f)===g)return{'variant':j,'index':h,'discriminator':f,'matched':!![]};}}for(let k=0x0;k<a['length'];k++){const l=a[k];if(l&&typeof l==='object'){const m=l;if(m['properties']&&typeof m['properties']==='object')return{'variant':m,'index':k,'matched':![]};}}return{'index':-0x1,'matched':![]};}function unionDiscriminatorValues(a,b){const c=[];for(const d of a){if(d&&typeof d==='object'){const e=variantConstValue(d,b);if(e!==undefined&&!c['includes'](e))c['push'](e);}}return c;}function inferDiscriminatorKey(a){if(!Array['isArray'](a)||a['length']===0x0)return undefined;const b=a['filter'](d=>!!d&&typeof d==='object'&&!!d['properties']);if(b['length']!==a['length']||b['length']===0x0)return undefined;const c=b[0x0]['properties'];for(const d of Object['keys'](c)){let e=!![];for(const f of b){if(variantConstValue(f,d)===undefined){e=![];break;}}if(e)return d;}return undefined;}function buildSchemaPreview(a,b,c){try{const d=['Schema\x20preview\x20for\x20'+b+':'];let e,g=[],h='',i,j=-0x1,k,l=![];if(a['properties']&&typeof a['properties']==='object')e=a['properties'],g=Array['isArray'](a['required'])?a['required']:[],h=typeof a['description']==='string'?a['description']:'';else{if(Array['isArray'](a['oneOf'])||Array['isArray'](a['anyOf'])){i=a['oneOf']??a['anyOf'];const p=pickUnionVariant(i,c);j=p['index'],k=p['discriminator'],l=p['matched'];p['variant']&&(e=p['variant']['properties'],g=Array['isArray'](p['variant']['required'])?p['variant']['required']:[],h=typeof p['variant']['description']==='string'?p['variant']['description']:'');if(!e)return d['push']('\x20\x20(discriminated\x20union\x20with\x20'+i['length']+'\x20variants\x20—\x20see\x20structuredContent\x20for\x20full\x20schema)'),d['join']('\x0a');}}h&&h['length']>0x0&&h['length']<0xc8&&d['push']('\x20\x20'+h);if(!e)return d['push']('\x20\x20(no\x20properties\x20available\x20—\x20see\x20structuredContent\x20for\x20full\x20schema)'),d['join']('\x0a');const m=new Set(g),n=g['length']>0x0?g['join'](',\x20'):'(none)',o=Object['keys'](e)['filter'](q=>!m['has'](q))['join'](',\x20');d['push']('Required:\x20'+n);o&&d['push']('Optional:\x20'+o);d['push']('Fields:');for(const [q,r]of Object['entries'](e)){if(r&&typeof r==='object'){const s=r,t=describeSchemaType(s),u=m['has'](q)?'required':'optional';let v=typeof s['description']==='string'?s['description']:'';if(v['length']>0x78)v=v['slice'](0x0,0x75)+'...';let w='';if(s['properties']&&typeof s['properties']==='object'){const x=Object['keys'](s['properties']);x['length']>0x0&&(w='\x20{\x20'+x['slice'](0x0,0x8)['join'](',\x20')+(x['length']>0x8?',\x20...':'')+'\x20}');}if(s['items']&&typeof s['items']==='object'){const y=s['items'],A=describeSchemaType(y);w='\x20(array\x20of\x20'+A+')';}Array['isArray'](s['enum'])&&(w='\x20(enum:\x20'+s['enum']['slice'](0x0,0x6)['map'](B=>JSON['stringify'](B))['join'](',\x20')+(s['enum']['length']>0x6?',\x20...':'')+')'),d['push']('\x20\x20-\x20'+q+'\x20('+t+',\x20'+u+')'+w+(v?'\x20—\x20'+v:''));}}if(i&&i['length']>0x0){d['push']('');if(l&&k){const B=c&&typeof c==='object'?c:{},C=String(B[k]);d['push']('Matched\x20variant:\x20'+k+'=\x22'+C+'\x22\x20(variant\x20'+(j+0x1)+'\x20of\x20'+i['length']+').');}else{d['push']('Discriminated\x20union\x20with\x20'+i['length']+'\x20variants;\x20showing\x20variant\x20'+(j+0x1)+'\x20(no\x20matching\x20discriminator\x20value\x20in\x20input).');const D=k??inferDiscriminatorKey(i)??(b==='query_toolkit'?'query_type':'operation_type'),E=unionDiscriminatorValues(i,D);E['length']>0x0&&d['push']('Valid\x20\x27'+D+'\x27\x20values:\x20'+E['join'](',\x20'));}}if(b==='onchain_operations'&&typeof c==='object'&&c!==null){const F=c['operation_type'];typeof F==='string'&&(d['push'](''),d['push']('operation_type-specific\x20schema:\x20onchain_operations_'+F),d['push']('(Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27onchain_operations_'+F+'\x27\x20for\x20the\x20full\x20sub-schema.)'));}return d['join']('\x0a');}catch{return'Schema\x20preview\x20for\x20'+b+':\x20(unable\x20to\x20build\x20preview\x20—\x20see\x20structuredContent\x20for\x20full\x20schema)';}}function compactMismatchSchemaInput(a,b){const c=Array['isArray'](a['oneOf'])?a['oneOf']:Array['isArray'](a['anyOf'])?a['anyOf']:undefined;if(!c)return a;const d=pickUnionVariant(c,b);if(!d['matched']||!d['variant'])return fallbackUnionSchema(a,c,b);const e=d['variant'],{oneOf:f,anyOf:g,...h}=a,i=h['properties']&&typeof h['properties']==='object'?h['properties']:{},j=e['properties']&&typeof e['properties']==='object'?e['properties']:{},k=Array['isArray'](h['required'])?h['required']:[],l=Array['isArray'](e['required'])?e['required']:[];return{...h,...e['type']!==undefined?{'type':e['type']}:{},...e['additionalProperties']!==undefined?{'additionalProperties':e['additionalProperties']}:{},...e['description']!==undefined?{'description':e['description']}:{},'properties':{...i,...j},'required':[...new Set([...k,...l])]};}function fallbackUnionSchema(a,b,c){const d=inferDiscriminatorKey(b);if(!d)return a;const e=unionDiscriminatorValues(b,d);if(e['length']===0x0)return a;const {oneOf:f,anyOf:g,...h}=a,i=h['properties']&&typeof h['properties']==='object'?h['properties']:{},j=Array['isArray'](h['required'])?h['required']:[],k=c&&typeof c==='object'&&!Array['isArray'](c)?Object['keys'](c):[];return{...h,'properties':{...i,[d]:{'type':'string','enum':e,'description':k['includes'](d)?'Unknown\x20\x22'+d+'\x22\x20value\x20—\x20must\x20be\x20one\x20of\x20the\x20listed\x20values.\x20Per-variant\x20parameters:\x20schema_query\x20(action=\x27get\x27)':'Missing\x20\x22'+d+'\x22\x20—\x20set\x20it\x20to\x20one\x20of\x20the\x20listed\x20values.\x20Per-variant\x20parameters:\x20schema_query\x20(action=\x27get\x27)'}},'required':j['includes'](d)?j:[...j,d]};}function describeSchemaType(a){if(typeof a['type']==='string')return a['type'];if(Array['isArray'](a['type']))return a['type']['join']('|');if(a['$ref'])return'$ref';if(Array['isArray'](a['oneOf']))return'oneOf';if(Array['isArray'](a['anyOf']))return'anyOf';if(Array['isArray'](a['allOf']))return'allOf';if(a['enum'])return'enum';if(a['const'])return'const('+JSON['stringify'](a['const'])+')';return'object';}const MISMATCH_SCHEMA_MAX_DEPTH=0x18;function capSchemaDepth(a,b){if(b>=MISMATCH_SCHEMA_MAX_DEPTH){if(Array['isArray'](a))return'(depth-capped\x20—\x20use\x20schema_query\x20action=\x27get\x27\x20for\x20the\x20full\x20sub-schema)';if(a!==null&&typeof a==='object')return{'type':'object','description':'(depth-capped\x20—\x20use\x20schema_query\x20action=\x27get\x27\x20for\x20the\x20full\x20sub-schema)'};return a;}if(Array['isArray'](a))return a['map'](c=>capSchemaDepth(c,b+0x1));if(a!==null&&typeof a==='object'){const c={};for(const [d,e]of Object['entries'](a)){c[d]=capSchemaDepth(e,b+0x1);}return c;}return a;}export async function dispatchToolCall(a,b,c,d){return sanitizeToolDispatchResult(await dispatchToolCallRaw(a,b,c,d));}async function dispatchToolCallRaw(a,b,c,d){{const i=findLatin1Mojibake(b);if(i)return mojibakeBlockResult(i['path'],i['sample']);}if(a==='wowok')return handleWowok(b,c,d);const e=TOOL_REGISTRY_MAP['get'](a);if(!e)throw new Error('Unknown\x20tool:\x20'+a+'.\x20Available:\x20'+TOOL_REGISTRY['map'](j=>j['name'])['join'](',\x20'));if(e['applyRules']&&!c?.['skipRules']){const j=await withTimeout(Promise['resolve'](e['applyRules'](b)),e['timeoutMs']??0xea60,a);if(j)return j;}const f=dispatchWithHarness(e['handler'],a),g=e['timeoutMs']??0xea60,h=wrapHandlerWithErrorShape(f,g,a,e['errorShapeBuilder'],e['onTimeoutVerify']);return h(b,d);}const TOOL_FIELD_ALIASES=['tool','tool_name','name'],DATA_FIELD_ALIASES=['data','args','params','parameters'],RESERVED_FIELD_NAMES=new Set([...TOOL_FIELD_ALIASES,...DATA_FIELD_ALIASES]);function normalizeInput(a){const b=[];if(!a||typeof a!=='object'||Array['isArray'](a))return{'tool':undefined,'data':{},'normalizationNotes':['input\x20is\x20not\x20an\x20object']};const c=a;let d;for(const f of TOOL_FIELD_ALIASES){if(typeof c[f]==='string'&&c[f]){d=c[f];f!=='tool'&&b['push']('normalized\x20\x27'+f+'\x27\x20→\x20\x27tool\x27');break;}}let e;for(const g of DATA_FIELD_ALIASES){const h=c[g];if(h!==undefined&&h!==null&&typeof h==='object'&&!Array['isArray'](h)){e=h;g!=='data'&&b['push']('normalized\x20\x27'+g+'\x27\x20→\x20\x27data\x27');break;}}if(!e){const i={};let j=![];for(const k of Object['keys'](c)){!RESERVED_FIELD_NAMES['has'](k)&&(i[k]=c[k],j=!![]);}j?(e=i,b['push']('extracted\x20inline\x20params\x20→\x20\x27data\x27\x20(no\x20data\x20wrapper\x20was\x20provided)')):e={};}return{'tool':d,'data':e,'normalizationNotes':b};}const QUERY_ACCOUNT_FIELD_ALIASES={'account_balance':{'canonical':'name_or_address','aliases':['account','address']},'onchain_personal_profile':{'canonical':'account','aliases':['name_or_address','address']},'address_profile':{'canonical':'address','aliases':['name_or_address','account']}};function normalizeQueryToolkitAliases(a,b){if(typeof a['query_type']!=='string')return;const c=QUERY_ACCOUNT_FIELD_ALIASES[a['query_type']];if(!c)return;if(a[c['canonical']]!==undefined)return;for(const d of c['aliases']){if(a[d]!==undefined){a[c['canonical']]=a[d],delete a[d],b['push']('query_toolkit\x20'+a['query_type']+':\x20normalized\x20\x27'+d+'\x27\x20→\x20\x27'+c['canonical']+'\x27');return;}}}const QUERY_NETWORK_CANONICAL={'testnet':'testnet','mainnet':'mainnet','localnet':'localnet'};function normalizeQueryNetworkSpellings(a,b){for(const c of['network','context_network']){const d=a[c];if(typeof d!=='string')continue;const e=QUERY_NETWORK_CANONICAL[d['trim']()['toLowerCase']()['replace'](/[-_]/g,'')];e&&d!==e&&(a[c]=e,b['push']('query_toolkit:\x20normalized\x20'+c+'\x20\x27'+d+'\x27\x20→\x20\x27'+e+'\x27'));}}async function handleWowok(a,b,c){const {tool:d,data:g,normalizationNotes:h}=normalizeInput(a);(d==='query_toolkit'||d==='onchain_table_data')&&normalizeQueryToolkitAliases(g,h);d==='query_toolkit'&&normalizeQueryNetworkSpellings(g,h);if(a&&typeof a==='object'&&!Array['isArray'](a)){const n=a;n['passport']!==undefined&&n['submission']===undefined&&(n['submission']=n['passport'],h['push']('accepted\x20top-level\x20\x27passport\x27\x20as\x20alias\x20for\x20\x27submission\x27'));if(n['submission']!==undefined){const o=g['submission'];if(o!==undefined)return{'content':[{'type':'text','text':'Schema\x20mismatch\x20for\x20'+d+'.\x201\x20error(s).\x20\x27submission\x27\x20was\x20provided\x20in\x20BOTH\x20the\x20top\x20level\x20and\x20inside\x20\x27data\x27\x20—\x20provide\x20it\x20in\x20only\x20ONE\x20place\x20(top\x20level\x20OR\x20data),\x20not\x20both.'}],'structuredContent':{'result':{'status':'schema_mismatch','errors':['\x27submission\x27\x20provided\x20twice:\x20top\x20level\x20AND\x20inside\x20data.\x20Provide\x20it\x20in\x20only\x20ONE\x20place.'],'structured_errors':[{'path':'submission','code':'duplicate_field','message':'\x27submission\x27\x20provided\x20both\x20at\x20the\x20top\x20level\x20and\x20inside\x20data.','suggestion':'Keep\x20the\x20submission\x20in\x20exactly\x20one\x20place:\x20either\x20wowok({tool,\x20data,\x20submission})\x20or\x20wowok({tool,\x20data:\x20{operation_type,\x20data:\x20{...},\x20env,\x20submission}}).'}],'hint':'Move\x20\x27submission\x27\x20to\x20a\x20single\x20location\x20and\x20retry.'},'schema':null}};g['submission']=n['submission'],h['push']('merged\x20top-level\x20\x27submission\x27\x20into\x20data');}}let j=![];{const p=a,q=p['data']!==undefined||p['args']!==undefined||p['params']!==undefined,r=p['env'],s=p['confirmed'];if(q&&(r!==undefined||s!==undefined)){const t=g,u=t['env']!==undefined&&typeof t['env']==='object'&&!Array['isArray'](t['env'])?{...t['env']}:{},v=r!==undefined&&typeof r==='object'&&!Array['isArray'](r)?r:{},w={...v,...u};s!==undefined&&w['confirmed']===undefined&&(w['confirmed']=s),Object['keys'](w)['length']>0x0&&(t['env']=w,j=!![],h['push']('merged\x20top-level\x20env/confirmed\x20into\x20data.env\x20(env\x20belongs\x20INSIDE\x20data)'));}}if(!d){const x=a&&typeof a==='object'&&!Array['isArray'](a)?Object['keys'](a)['join'](',\x20')||'(none)':'(non-object\x20input:\x20'+typeof a+')',y=['Missing\x20\x27tool\x27\x20field.\x20Received\x20keys:\x20'+x,'Expected\x20one\x20of:\x20'+SUB_TOOL_NAMES['join'](',\x20')];return{'content':[{'type':'text','text':'Missing\x20\x27tool\x27\x20field.\x20Call\x20format:\x20wowok({\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{<params>}\x20}).\x20Received\x20keys:\x20'+x+'.\x20Available\x20sub-tools:\x20'+SUB_TOOL_NAMES['join'](',\x20')}],'structuredContent':{'result':{'status':'schema_mismatch','errors':y,'hint':'Provide\x20\x27tool\x27\x20(one\x20of:\x20'+SUB_TOOL_NAMES['join'](',\x20')+')\x20and\x20\x27data\x27\x20(sub-tool\x20parameters).\x20Aliases\x20accepted:\x20tool_name/name→tool,\x20args/params→data.','received':a},'schema':{'input':zodToJsonSchemaSafe(WowokToolDisplaySchema,'wowok'),'tool':'wowok'}}};}const k=TOOL_REGISTRY_MAP['get'](d);if(!k){const A=d['toLowerCase'](),B=A==='wowok',C=A['split']('_')['filter'](Boolean),D=B?[]:TOOL_REGISTRY['map'](G=>G['name'])['map'](G=>{const H=G['toLowerCase']()['split']('_');let I=0x0;if(H[0x0]===C[0x0])I+=0x2;I+=H['filter'](J=>C['includes'](J))['length'];if(H['some'](J=>J['startsWith'](C[C['length']-0x1]??'')))I+=0x1;return{'name':G,'score':I};})['filter'](G=>G['score']>0x0)['sort']((G,H)=>H['score']-G['score'])['slice'](0x0,0x5)['map'](G=>G['name']),E=B?'\x20NOTE:\x20\x27wowok\x27\x20is\x20the\x20DISPATCHER\x20tool\x20itself,\x20not\x20a\x20sub-tool.\x20Call\x20format:\x20wowok({\x20tool:\x20\x22<sub-tool-name>\x22,\x20data:\x20{<params>}\x20}).':'',F=D['length']>0x0?'.\x20Did\x20you\x20mean:\x20'+D['join'](',\x20')+'?':'';return{'content':[{'type':'text','text':'Unknown\x20sub-tool:\x20\x27'+d+'\x27.\x20Available:\x20'+TOOL_REGISTRY['map'](G=>G['name'])['join'](',\x20')+E+F}],'structuredContent':{'result':{'status':'error','errors':['Unknown\x20sub-tool:\x20'+d],'hint':'Available\x20sub-tools:\x20'+TOOL_REGISTRY['map'](G=>G['name'])['join'](',\x20')+E+F,'suggestions':D},'schema':null}};}h['length']>0x0&&console['warn']('[wowok]\x20input\x20normalization\x20for\x20\x27'+d+'\x27:\x20'+h['join'](';\x20'));{const G=g,H=G['env']&&typeof G['env']==='object'&&!Array['isArray'](G['env'])?G['env']:undefined;if(H?.['confirmed']!==undefined&&G['confirmed']===undefined){const I=zodUnionAwareKeyCheck(k['config']['inputSchema'],'confirmed');if(I['declared']&&!I['hasEnvSlot']){G['confirmed']=H['confirmed'],delete H['confirmed'];if(Object['keys'](H)['length']===0x0)delete G['env'];h['push']('routed\x20rescued\x20top-level\x20confirmed\x20to\x20the\x20tool\x27s\x20own\x20confirmed\x20slot'),console['warn']('[wowok]\x20input\x20normalization\x20for\x20\x27'+d+'\x27:\x20confirmed\x20slot\x20re-routed\x20(F-10)');}}}const l=k['config']['inputSchema']['safeParse'](g),m=checkUnknownFields(k['config']['inputSchema'],g);if(!l['success']||m['length']>0x0){const J=[];!l['success']&&J['push'](...formatZodErrors(l['error'],g));m['length']>0x0&&J['push']('Unknown\x20field(s):\x20'+m['join'](',\x20'));const K=[];!l['success']&&K['push'](...formatZodErrorsStructured(l['error'],g));if(m['length']>0x0)for(const X of m){K['push']({'path':X,'code':'unrecognized_keys','message':'Unknown\x20field\x20\x27'+X+'\x27\x20is\x20not\x20allowed','suggestion':'Remove\x20field\x20\x27'+X+'\x27\x20or\x20check\x20the\x20schema\x20for\x20valid\x20field\x20names'});}if(j){const Y='A\x20top-level\x20env/confirmed\x20was\x20merged\x20into\x20data.env\x20automatically\x20(contra\x20F-01\x20rescue),\x20but\x20THIS\x20sub-tool\x20does\x20not\x20accept\x20env\x20in\x20data.\x20Operation\x20tools\x20(onchain_operations\x20etc.)\x20take\x20env\x20inside\x20data;\x20query\x20tools\x20take\x20plain\x20data\x20fields\x20(e.g.\x20network)\x20instead\x20—\x20drop\x20the\x20env\x20key\x20for\x20this\x20call.';J['push'](Y),K['push']({'path':'env','code':'unrecognized_keys','message':'env\x20rescued\x20from\x20the\x20top\x20level,\x20but\x20this\x20sub-tool\x27s\x20data\x20schema\x20has\x20no\x20env\x20slot','suggestion':Y});}const L=g??undefined,M=L!==undefined&&typeof L['operation_type']==='string'&&L['data']===undefined,N=K['some'](Z=>String(Z['path'])==='data'&&Z['code']==='invalid_type'&&/received undefined/i['test'](Z['message']));let O;if(N&&M)O='SHAPE\x20FIX\x20(rndb58d8d\x2004-ROOTCAUSE-A\x20A1):\x20operation\x20parameters\x20must\x20be\x20nested\x20INSIDE\x20a\x20\x27data\x27\x20object.\x20'+'The\x20envelope\x20is\x20{\x20operation_type:\x20\x27...\x27,\x20data:\x20{\x20<the\x20operation\x27s\x20parameters>\x20},\x20env?:\x20{...},\x20submission?:\x20{...}\x20}\x20'+'—\x20your\x20call\x20put\x20the\x20parameters\x20at\x20the\x20SAME\x20level\x20as\x20operation_type\x20(or\x20omitted\x20them),\x20so\x20\x27data\x27\x20arrived\x20undefined.\x20'+'Resend\x20with\x20the\x20parameters\x20wrapped\x20in\x20data.\x20This\x20is\x20a\x20static\x20shape\x20error,\x20NOT\x20session\x20state\x20—\x20no\x20restart\x20is\x20needed\x20'+'(this\x20server\x20is\x20stateless).\x20Also\x20discard\x20any\x20schema\x20slice\x20you\x20cached\x20from\x20an\x20earlier\x20call\x20for\x20a\x20DIFFERENT\x20'+'operation_type\x20—\x20slices\x20are\x20union-variant\x20specific\x20and\x20reusing\x20one\x20across\x20variants\x20mangles\x20the\x20payload.',J['push'](O),K['push']({'path':'data','code':'invalid_type','message':'parameters\x20must\x20be\x20nested\x20inside\x20data\x20(flat\x20envelope:\x20parameters\x20found\x20as\x20siblings\x20of\x20operation_type)','suggestion':O});else N&&(O='DIAGNOSTIC:\x20\x27data\x27\x20arrived\x20at\x20validation\x20as\x20undefined.\x20Send\x20the\x20tool\x27s\x20parameters\x20inside\x20the\x20\x27data\x27\x20object\x20'+'(for\x20onchain_operations:\x20{\x20operation_type:\x20\x27...\x27,\x20data:\x20{\x20<parameters>\x20},\x20env?,\x20submission?\x20}).\x20If\x20you\x20are\x20CERTAIN\x20'+'your\x20client\x20transmitted\x20a\x20well-formed\x20payload,\x20inspect\x20what\x20the\x20wrapper\x20actually\x20sent\x20before\x20retrying\x20—\x20identical\x20'+'retries\x20cannot\x20recover\x20from\x20a\x20construction\x20error.\x20(C-11\x27s\x20old\x20\x27wrapper\x20state\x20corruption\x20/\x20restart\x20the\x20session\x27\x20'+'conclusion\x20was\x20retired\x20by\x20rndb58d8d\x2004-ROOTCAUSE-A:\x20a\x20stateless\x20server\x20cannot\x20diagnose\x20caller-side\x20runtime\x20state.)',J['push'](O),K['push']({'path':'data','code':'invalid_type','message':'data\x20is\x20required\x20—\x20the\x20tool\x27s\x20parameters\x20belong\x20inside\x20the\x20data\x20object','suggestion':O}));const P=loadPreGeneratedSchema(d)??zodToJsonSchemaSafe(k['config']['inputSchema'],d),Q=extractRelevantSchema(P,d,g),R=capSchemaDepth(compactMismatchSchemaInput(Q,g),0x0),S=matchedVariantLegalKeys(R)['filter'](Z=>Z!=='env');if(S['length']>0x0){const Z='Legal\x20keys\x20for\x20this\x20input:\x20'+S['join'](',\x20')+'.';for(const a0 of K){a0['code']==='unrecognized_keys'&&!String(a0['suggestion'])['includes']('Legal\x20keys')&&(a0['suggestion']=a0['suggestion']+'\x20'+Z);}for(let a1=0x0;a1<J['length'];a1++){/^(Unknown field\(s\):|.*(Unrecognized key|unexpected key))/i['test'](J[a1])&&!J[a1]['includes']('Legal\x20keys')&&(J[a1]=J[a1]+'\x20'+Z);}}const T=K[0x0]?.['suggestion']?'\x20FIRST\x20ERROR\x20SUGGESTION:\x20'+K[0x0]['suggestion']:'',U=J['slice'](0x0,0x5)['map']((a2,a3)=>'\x20\x20'+(a3+0x1)+'.\x20'+a2)['join']('\x0a'),V=buildSchemaPreview(Q,d,g),W=['Schema\x20mismatch\x20for\x20'+d+'.\x20'+J['length']+'\x20error(s).'+T,U,...O?['','⚠\x20'+O]:[],'',V,'','Fix\x20the\x20parameters\x20based\x20on\x20the\x20errors\x20above\x20and\x20the\x20schema\x20summary,\x20then\x20retry.','Full\x20JSON\x20Schema\x20is\x20in\x20the\x20structuredContent.schema.input\x20field\x20(cache\x20it\x20ONLY\x20for\x20future\x20'+d+'\x20calls\x20with\x20the\x20SAME\x20operation_type/variant\x20—\x20slices\x20are\x20branch-specific;\x20a\x20different\x20operation_type\x20needs\x20a\x20fresh\x20schema).','Structured\x20errors\x20with\x20fix\x20suggestions\x20are\x20in\x20structuredContent.result.structured_errors\x20(ARCH-02).',SKILLS_MISMATCH_POINTER]['filter'](Boolean)['join']('\x0a');return{'content':[{'type':'text','text':W}],'structuredContent':{'result':{'status':'schema_mismatch','errors':J,'structured_errors':K,'hint':schemaMismatchHint(d)},'schema':{'input':R,'tool':d}}};}try{const a2=await dispatchToolCall(d,g,b,c);if(a2['resultType']==='input_required')return a2;const a3=a2['structuredContent'],a4=a3?.['result'],a5=a4?.['status']==='error'||a4?.['status']==='schema_mismatch'||a4?.['operation']==='error'||a4?.['type']==='error';if(a5){const aa={'status':'error','data':a2['structuredContent'],'errors':[a2['content'][0x0]?.['text']??'Sub-tool\x20returned\x20an\x20error']};if(typeof a4?.['error_code']==='string')aa['error_code']=a4['error_code'];if(typeof a4?.['retryable']==='boolean')aa['retryable']=a4['retryable'];if(typeof a4?.['recovery_hint']==='string')aa['recovery_hint']=a4['recovery_hint'];if(a4?.['refused']===!![])aa['refused']=!![];if(a4?.['tx_submitted']===![])aa['tx_submitted']=![];return{'content':a2['content'],'structuredContent':{'result':aa,'schema':null}};}const a6=typeof a3?.['outcome']==='string'?a3['outcome']:undefined,a7=a3?.['verdict'],a8=a7!==undefined&&typeof a7==='object'&&a7['buildable']===![],a9=a8?'error':a6===undefined||a6==='executed'?'success':a6==='failed'?'error':'pending';return{'content':a2['content'],'structuredContent':{'result':{'status':a9,...a6!==undefined?{'outcome':a6}:{},...a8?{'errors':['Plan\x20audit\x20BLOCKED\x20(verdict.buildable=false)\x20—\x20see\x20data.verdict.blockers\x20and\x20data.next_action.\x20Do\x20NOT\x20materialize\x20this\x20plan.']}:{},'data':a2['structuredContent']},'schema':null}};}catch(ab){const ac=ab instanceof Error?ab['message']:String(ab);if(isSchemaValidationError(ac)){const ag=loadPreGeneratedSchema(d)??zodToJsonSchemaSafe(k['config']['inputSchema'],d),ah=extractRelevantSchema(ag,d,g),ai=buildSchemaPreview(ah,d,g),aj=[{'path':'(runtime)','code':'schema_validation_error','message':ac,'suggestion':'Check\x20the\x20error\x20message\x20and\x20the\x20schema\x20below\x20for\x20the\x20correct\x20field\x20format'}],ak=['Schema\x20mismatch\x20for\x20'+d+':\x20'+ac,'',ai,'','Fix\x20the\x20parameters\x20and\x20retry.\x20Full\x20JSON\x20Schema\x20is\x20in\x20structuredContent.schema.input.','Structured\x20errors\x20with\x20fix\x20suggestions\x20are\x20in\x20structuredContent.result.structured_errors\x20(ARCH-02).',SKILLS_MISMATCH_POINTER]['join']('\x0a');return{'content':[{'type':'text','text':ak}],'structuredContent':{'result':{'status':'schema_mismatch','errors':[ac],'structured_errors':aj,'hint':schemaMismatchHint(d)},'schema':{'input':compactMismatchSchemaInput(ah,g),'tool':d}}};}const ad=/Unexpected token.*?\((\d+):(\d+)\)/['exec'](ac)??(/^(Unexpected end of JSON input|JSON\.parse)/['test'](ac)?[ac,'','']:null);if(ad){const al=ad[0x1]?Number(ad[0x1]):undefined,am=ad[0x2]?Number(ad[0x2]):undefined,an=al!==undefined?'\x20at\x20line\x20'+al+',\x20column\x20'+am:'',ao=loadPreGeneratedSchema(d)??zodToJsonSchemaSafe(k['config']['inputSchema'],d),ap=extractRelevantSchema(ao,d,g),aq=[{'path':'(root)','code':'malformed_json','message':'A\x20JSON\x20string\x20in\x20the\x20arguments\x20could\x20not\x20be\x20parsed'+an+':\x20'+ac+'.\x20'+'Any\x20argument\x20passed\x20as\x20a\x20STRING\x20must\x20itself\x20be\x20valid\x20JSON.','suggestion':'Send\x20objects/arrays\x20as\x20real\x20JSON\x20values,\x20not\x20as\x20stringified\x20JSON.\x20'+'If\x20a\x20string\x20field\x20is\x20genuinely\x20textual\x20(description,\x20message,\x20remark),\x20it\x20must\x20NOT\x20be\x20quoted-and-escaped\x20JSON.\x20'+'If\x20the\x20argument\x20shape\x20is\x20confirmed\x20valid,\x20the\x20payload\x20may\x20have\x20been\x20TRUNCATED\x20before\x20parsing\x20—\x20arguments\x20past\x20a\x20'+'transport\x20size\x20limit\x20fail\x20with\x20this\x20same\x20envelope;\x20shrink\x20the\x20payload\x20(fewer\x20or\x20smaller\x20items)\x20and\x20retry.'}];return{'content':[{'type':'text','text':['Malformed\x20JSON\x20in\x20the\x20arguments\x20to\x20'+d+an+':\x20'+ac,'',buildSchemaPreview(ap,d,g),'','Fix\x20the\x20parameters\x20and\x20retry.\x20Full\x20JSON\x20Schema\x20is\x20in\x20structuredContent.schema.input.']['join']('\x0a')}],'structuredContent':{'result':{'status':'schema_mismatch','errors':[ac],'structured_errors':aq,'hint':schemaMismatchHint(d)},'schema':{'input':compactMismatchSchemaInput(ap,g),'tool':d}}};}const ae=classifyError(ac),af={'status':'error','errors':[ac]};if(ae['error_code']!==undefined)af['error_code']=ae['error_code'];if(ae['retryable']!==undefined)af['retryable']=ae['retryable'];if(ae['recovery_hint']!==undefined)af['recovery_hint']=ae['recovery_hint'];return{'content':[{'type':'text','text':'Error:\x20'+ac}],'structuredContent':{'result':af,'schema':null}};}}function zodToJsonSchemaSafe(a,b){try{const c=z['toJSONSchema'](a,{'unrepresentable':'any','target':'draft-07'});if(c&&typeof c==='object'&&!Array['isArray'](c)){const {$schema:d,...e}=c;return e;}return{'type':'object'};}catch{return{'type':'object','additionalProperties':!![]};}}function resolveSchemaRefs(a){const b=new Set(['definitions','$schema','$id']);function c(e){if(!e['startsWith']('#/'))return null;const f=e['slice'](0x2)['split']('/');let g=a;for(const h of f){if(g==null||typeof g!=='object')return null;g=g[h];}return g;}function d(e,f){if(!e||typeof e!=='object')return e;if(Array['isArray'](e))return e['map'](i=>d(i,f));const g=e;if(typeof g['$ref']==='string'){const i=g['$ref'];if(f['has'](i))return{'type':'object','additionalProperties':!![]};const j=c(i);if(j&&typeof j==='object'&&!Array['isArray'](j)){const l=new Set(f);l['add'](i);const m=d(j,l),n={};for(const [o,p]of Object['entries'](g)){if(o!=='$ref'&&!b['has'](o))n[o]=p;}return{...m,...n};}return{'type':'object','additionalProperties':!![]};}const h={};for(const [q,r]of Object['entries'](g)){if(b['has'](q))continue;h[q]=d(r,f);}return h;}return d(a,new Set());}function loadPreGeneratedSchema(a){const b=preGeneratedSchemaCache['get'](a);if(b)return b;for(const c of SCHEMA_DIR_CANDIDATES){try{const d=join(c,a+'.schema.json'),e=readFileSync(d,'utf-8'),f=JSON['parse'](e),g=resolveSchemaRefs(f);return preGeneratedSchemaCache['set'](a,g),g;}catch{}}return null;}export function listTools(){return[{'name':'wowok','title':'WoWok\x20MCP','description':WOWOK_TOOL_DESCRIPTION,'inputSchema':resolveSchemaRefs(zodToJsonSchemaSafe(WowokToolDisplaySchema,'wowok'))}];}let startupUpgradeNoticeAttached=![],startupNoticePromise=null,upgradeEnforcementDecided=![];function startupNotice(){return startupNoticePromise??=getStartupUpgradeNotice(),startupNoticePromise;}async function upgradeRequiredResult(){if(upgradeEnforcementDecided)return null;let a=null;try{a=await startupNotice();}catch{a=null;}if(!a)return null;upgradeEnforcementDecided=!![];if(!a['enforced'])return null;const b='WoWok\x20upgrade\x20REQUIRED\x20—\x20tool\x20calls\x20are\x20blocked\x20until\x20the\x20local\x20package\x20is\x20current.\x0a'+(a['message']+'\x0a')+('To\x20stay\x20on\x20the\x20current\x20version\x20anyway,\x20write\x20{\x22enforce\x22:\x20false}\x20to\x20'+upgradePolicyPath()+'\x20and\x20restart.');return{'content':[{'type':'text','text':b}],'structuredContent':{'result':{'status':'error','error_code':'UPGRADE_REQUIRED','retryable':![],'recovery_hint':b,'data':{'upgrade_notice':a}},'schema':null}};}async function attachStartupUpgradeNotice(a){if(startupUpgradeNoticeAttached)return a;try{const b=await startupNotice();if(!b)return a;startupUpgradeNoticeAttached=!![];if(b['enforced'])return a;const c={...a};return Array['isArray'](a['content'])&&(c['content']=[...a['content'],{'type':'text','text':'\x0a⚠\x20'+b['message']+'\x0a'+'Surface\x20this\x20upgrade\x20notice\x20to\x20the\x20user\x20once\x20in\x20this\x20conversation\x20(do\x20not\x20wait\x20for\x20them\x20to\x20ask).'}]),a['structuredContent']&&typeof a['structuredContent']==='object'&&(c['structuredContent']={...a['structuredContent'],'upgrade_notice':b}),c;}catch{return startupUpgradeNoticeAttached=!![],a;}}export function registerAllTools(a){const b=0x2bf20,c=async(e,f)=>handleWowok(e,undefined,f),d=wrapHandlerWithErrorShape(c,b,'wowok',undefined);a['registerTool']('wowok',{'title':'WoWok\x20MCP','description':WOWOK_TOOL_DESCRIPTION,'inputSchema':WowokToolRuntimeSchema,'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':!![]}},async(e,f)=>{const g=await upgradeRequiredResult();if(g)return g;return attachStartupUpgradeNotice(sanitizeToolDispatchResult(await d(e,f?.['mcpReq']?.['inputResponses']?{'inputResponses':f['mcpReq']['inputResponses']}:undefined)));}),overrideToolsListHandler(a);}function overrideToolsListHandler(a){a['server']['setRequestHandler']('tools/list',()=>({'tools':[{'name':'wowok','title':'WoWok\x20MCP','description':WOWOK_TOOL_DESCRIPTION,'inputSchema':ensureObjectType(zodToJsonSchemaSafe(WowokToolDisplaySchema,'wowok')),'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':!![]}}]}));}function ensureObjectType(a){if(a['type']==='object')return a;return{...a,'type':'object'};}
|
|
1
|
+
import{z}from'zod';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{fromJsonSchema}from'@modelcontextprotocol/server';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),SCHEMA_DIR_CANDIDATES=[join(__dirname,'..','schemas'),join(__dirname,'..','..','dist','schemas')],preGeneratedSchemaCache=new Map();import{wrapHandlerWithErrorShape,dispatchWithHarness,withTimeout}from'./wrap.js';import{sanitizeToolDispatchResult}from'./sanitize-output.js';import{getStartupUpgradeNotice,upgradePolicyPath}from'./upgrade-check.js';import{classifyError,normalizeErrorMessage}from'../schema/call/semantic.js';import{catalogFieldsFor}from'./error-catalog.js';import{findLatin1Mojibake,mojibakeBlockResult}from'./transport-integrity.js';import{ONCHAIN_TOOLS}from'./registry/onchain.js';import{LOCAL_TOOLS}from'./registry/local.js';import{FILE_TOOLS}from'./registry/files.js';import{MESSENGER_TOOLS}from'./registry/messenger.js';import{QUERY_TOOLS}from'./registry/query.js';import{BRIDGE_TOOLS}from'./registry/bridge.js';import{CONFIG_TOOLS}from'./registry/config.js';import{EVALUATION_TOOLS}from'./registry/evaluation.js';import{IDENTITY_TOOLS}from'./registry/identity.js';import{BUSINESS_TOOLS}from'./registry/business.js';import{AGENT_TOOLS}from'./registry/agent.js';import{MONITOR_TOOLS}from'./registry/monitor.js';import{INTERACTION_TOOLS}from'./registry/interaction.js';export{monitorEventStore,MonitorEventStore,monitorEventId}from'../monitor/EventStore.js';export{monitorLoop,MonitorLoop}from'../monitor/MonitorLoop.js';export{MONITOR_CAPTURE_TYPES}from'../monitor/normalize.js';export{NETWORK_FIELD_BY_QUERY}from'./handlers/query.js';export{resolveGateControls,resolveEffectiveOverrides}from'../persona/index.js';export{SYSTEM_OVERRIDE_SETTINGS}from'../persona/index.js';export const TOOL_REGISTRY=[...ONCHAIN_TOOLS,...LOCAL_TOOLS,...FILE_TOOLS['slice'](0x0,0x1),...MESSENGER_TOOLS,...FILE_TOOLS['slice'](0x1),...QUERY_TOOLS,...BRIDGE_TOOLS,...CONFIG_TOOLS,...EVALUATION_TOOLS,...IDENTITY_TOOLS,...BUSINESS_TOOLS,...AGENT_TOOLS,...MONITOR_TOOLS,...INTERACTION_TOOLS];export const TOOL_REGISTRY_MAP=new Map(TOOL_REGISTRY['map'](a=>[a['name'],a]));export const SUB_TOOL_COUNT=TOOL_REGISTRY['length'];const SUB_TOOL_NAMES=TOOL_REGISTRY['map'](a=>a['name']),WowokToolRuntimeSchema=fromJsonSchema({'type':'object'}),WowokToolDisplaySchema=z['object']({'tool':z['enum'](SUB_TOOL_NAMES)['optional']()['describe']('The\x20sub-tool\x20to\x20execute.\x20Each\x20sub-tool\x20has\x20its\x20own\x20parameter\x20schema.'),'data':z['record'](z['string'](),z['unknown']())['optional']()['describe']('Sub-tool\x20specific\x20parameters.\x20If\x20validation\x20fails,\x20the\x20response\x20includes\x20the\x20correct\x20schema\x20for\x20this\x20sub-tool\x20—\x20read\x20it,\x20fix\x20your\x20params,\x20and\x20retry.'),'submission':z['record'](z['string'](),z['unknown']())['optional']()['describe']('Guard\x20submission\x20slots\x20(top-level\x20placement,\x20sibling\x20of\x20data/env).\x20Alternative:\x20place\x20inside\x20data.'),'env':z['record'](z['string'](),z['unknown']())['optional']()['describe']('Environment\x20(account/network/confirmed/...).\x20Top-level\x20placement\x20is\x20folded\x20into\x20data.env.'),'tool_name':z['enum'](SUB_TOOL_NAMES)['optional']()['describe']('DEPRECATED\x20alias\x20for\x20\x27tool\x27.\x20Use\x20\x27tool\x27\x20instead.'),'args':z['record'](z['string'](),z['unknown']())['optional']()['describe']('DEPRECATED\x20alias\x20for\x20\x27data\x27.\x20Use\x20\x27data\x27\x20instead.'),'name':z['enum'](SUB_TOOL_NAMES)['optional']()['describe']('DEPRECATED\x20alias\x20for\x20\x27tool\x27.\x20Use\x20\x27tool\x27\x20instead.'),'params':z['record'](z['string'](),z['unknown']())['optional']()['describe']('DEPRECATED\x20alias\x20for\x20\x27data\x27.\x20Use\x20\x27data\x27\x20instead.')})['describe']('WoWok\x20unified\x20tool\x20input.\x20Call\x20with\x20{\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{<params>}\x20}.\x20'+'Aliases:\x20tool_name/name→tool,\x20args/params→data.'),SUB_TOOL_LIST=TOOL_REGISTRY['map'](a=>'\x20\x20'+a['name']+'\x20—\x20'+a['config']['summary'])['join']('\x0a'),SKILLS_MISMATCH_POINTER='Structured\x20role-based\x20guidance\x20(WHEN\x20and\x20in\x20what\x20ORDER\x20to\x20use\x20WoWok\x20sub-tools)\x20is\x20available\x20via\x20the\x20WoWok\x20Skills:\x20install\x20with\x20\x22npm\x20install\x20-g\x20@wowok'+'/skills\x22\x20(verify\x20with\x20\x22wowok-skills\x20doctor\x22),\x20or\x20fetch\x20orientation\x20now\x20via\x20wowok_buildin_info\x20info=\x22getting\x20started\x22.';function schemaMismatchHint(a){return'Fix\x20your\x20parameters\x20based\x20on\x20the\x20schema\x20below\x20and\x20retry.\x20CACHE\x20THIS\x20SCHEMA\x20for\x20future\x20'+a+'\x20calls\x20—\x20you\x20don\x27t\x20need\x20to\x20query\x20it\x20again.\x0a'+SKILLS_MISMATCH_POINTER;}const WOWOK_TOOL_DESCRIPTION=['WoWok\x20MCP\x20unified\x20interface.\x20Call\x20with\x20{\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{<params>}\x20}.','','\x20\x20▶\x20START\x20HERE\x20—\x20WoWok\x20Skills\x20(recommended):','\x20\x20\x20\x20Role-based\x20playbooks\x20(onboarding,\x20building,\x20buying,\x20fulfillment,\x20arbitration,\x20governance)','\x20\x20\x20\x20sit\x20ON\x20TOP\x20of\x20this\x20MCP\x20and\x20materially\x20reduce\x20failed\x20calls\x20by\x20telling\x20you\x20WHEN\x20and\x20in\x20what','\x20\x20\x20\x20ORDER\x20to\x20use\x20the\x2030+\x20sub-tools\x20below.\x20One\x20command\x20installs\x20them\x20into\x20every\x20detected\x20AI','\x20\x20\x20\x20client\x20AND\x20registers\x20this\x20MCP\x20server\x20(idempotent\x20postinstall):','\x20\x20\x20\x20\x20\x20npm\x20install\x20-g\x20@wowok'+'/skills','\x20\x20\x20\x20Verify:\x20wowok-skills\x20doctor\x20\x20\x20Repair\x20an\x20old\x20install:\x20wowok-skills\x20init\x20--force','\x20\x20\x20\x20Machine-readable\x20orientation\x20+\x20best-effort\x20detection\x20of\x20whether\x20skills\x20are\x20installed\x20here:','\x20\x20\x20\x20\x20\x20wowok({\x20tool:\x20\x22wowok_buildin_info\x22,\x20data:\x20{\x20info:\x20\x22getting\x20started\x22\x20}\x20})','\x20\x20▶\x20COLD\x20START:\x20the\x20FIRST\x20call\x20after\x20server\x20boot\x20can\x20take\x20~20\x20seconds\x20(server\x20bootstraps\x20via\x20npx).','\x20\x20\x20\x20Wait\x20for\x20it\x20—\x20a\x20timed-out\x20first\x20response\x20is\x20startup\x20latency,\x20not\x20a\x20broken\x20server,\x20and\x20never\x20a','\x20\x20\x20\x20reason\x20to\x20retry\x20a\x20write\x20transaction.\x20Later\x20calls\x20are\x20fast.','','\x20\x20tool:\x20name\x20of\x20the\x20sub-tool\x20(string)','\x20\x20data:\x20sub-tool\x20parameters\x20(object)','','\x20\x20Aliases\x20accepted\x20(deprecated):\x20tool_name/name\x20for\x20tool,\x20args/params\x20for\x20data.','\x20\x20Inline\x20params\x20also\x20accepted:\x20{\x20tool:\x20\x22<sub-tool>\x22,\x20<param1>:\x20...,\x20<param2>:\x20...\x20}','\x20\x20⚠️\x20RESERVED\x20KEYS\x20cannot\x20be\x20passed\x20inline:\x20name\x20/\x20tool_name\x20/\x20args\x20/\x20params\x20are\x20the','\x20\x20deprecated\x20aliases\x20themselves\x20—\x20an\x20inline\x20\x27name\x27\x20is\x20consumed\x20as\x20the\x20tool\x20alias\x20and','\x20\x20never\x20reaches\x20the\x20sub-tool.\x20Pass\x20such\x20fields\x20inside\x20data\x20instead.','','\x20\x20EXAMPLE:\x20wowok({\x20tool:\x20\x22schema_query\x22,\x20data:\x20{\x20action:\x20\x22get\x22,\x20name:\x20\x22onchain_operations\x22\x20}\x20})','\x20\x20EXAMPLE:\x20wowok({\x20tool:\x20\x22wowok_buildin_info\x22,\x20data:\x20{\x20info:\x20\x22mainnet\x20bridge\x20tokens\x22\x20}\x20})','\x20\x20EXAMPLE\x20(inline\x20params):\x20wowok({\x20tool:\x20\x22query_toolkit\x22,\x20query_type:\x20\x22account_list\x22\x20})','','Available\x20sub-tools\x20('+SUB_TOOL_COUNT+'):',SUB_TOOL_LIST,'','SCHEMA-GATED\x20EXECUTION:','\x20\x20If\x20your\x20parameters\x20don\x27t\x20match\x20the\x20sub-tool\x27s\x20schema,\x20the\x20response\x20will\x20include:','\x20\x20\x20\x20result.status\x20=\x20\x22schema_mismatch\x22','\x20\x20\x20\x20result.errors\x20=\x20specific\x20validation\x20errors\x20(field\x20path\x20+\x20expected\x20type)','\x20\x20\x20\x20result.hint\x20=\x20instructions\x20to\x20fix\x20and\x20retry','\x20\x20\x20\x20schema.input\x20=\x20the\x20correct\x20JSON\x20schema\x20for\x20the\x20sub-tool','\x20\x20\x20\x20schema.tool\x20=\x20which\x20sub-tool\x20this\x20schema\x20belongs\x20to','\x20\x20Read\x20the\x20schema,\x20fix\x20your\x20params,\x20and\x20retry.\x20This\x20is\x20normal\x20—\x20no\x20need\x20to\x20call\x20schema_query\x20separately.','','SCHEMA\x20CACHING:','\x20\x20Each\x20sub-tool\x20has\x20a\x20DIFFERENT\x20schema.\x20When\x20you\x20receive\x20a\x20schema\x20in\x20a\x20mismatch\x20response:','\x20\x20\x20\x201.\x20Read\x20the\x20schema\x20carefully','\x20\x20\x20\x202.\x20Fix\x20your\x20parameters','\x20\x20\x20\x203.\x20Retry\x20the\x20call','\x20\x20\x20\x204.\x20CACHE\x20the\x20schema\x20in\x20your\x20context\x20for\x20future\x20calls\x20to\x20the\x20SAME\x20sub-tool','\x20\x20You\x20should\x20only\x20need\x20to\x20see\x20each\x20sub-tool\x27s\x20schema\x20once\x20per\x20conversation.','','ON-CHAIN\x20BUSINESS\x20INTELLIGENCE\x20(query_toolkit,\x20READ-ONLY\x20—\x20no\x20local\x20project\x20entity):','\x20\x20query_toolkit\x20query_type=\x27service_panorama\x27\x20→\x20ONE-CALL\x20full\x20Service\x20context\x20(workflow\x20graph,\x20guards,\x20supply\x20chain,\x20orders)','\x20\x20query_toolkit\x20query_type=\x27machine_panorama\x27\x20→\x20Machine\x20context\x20(head\x20+\x20fields\x20+\x20workflow\x20graph\x20+\x20Progress\x20list)','\x20\x20query_toolkit\x20query_type=\x27object_panorama\x27\x20→\x20detail\x20panorama\x20for\x20Progress/Demand/Order/Arb/Repository','\x20\x20query_toolkit\x20query_type=\x27review_pack\x27\x20→\x20typed\x20ReviewPack\x20for\x20the\x20client\x27s\x20generic\x20ReviewPackRenderer','\x20\x20query_toolkit\x20query_type=\x27assemble_context\x27\x20→\x20semantic\x20context\x20assembly\x20from\x20on-chain\x20objects','\x20\x20query_toolkit\x20query_type=\x27reverse_map\x27\x20→\x20deterministic\x20L4→L1\x20business\x20report\x20(merchant\x20profile\x20/\x20user\x20risk\x20/\x20game\x20theory)','\x20\x20query_toolkit\x20query_type=\x27participation_radar\x27\x20→\x20in-flight\x20order\x20participation\x20analysis\x20for\x20ONE\x20account','\x20\x20query_toolkit\x20query_type=\x27order_aggregate\x27\x20→\x20CROSS-ORDER\x20aggregate\x20(count\x20+\x20exact\x20amount\x20sums\x20per\x20service/machine/owner,\x20funding-target\x20checks\x20like\x20\x273\x20x\x206\x20>=\x2018\x27)','\x20\x20query_toolkit\x20query_type=\x27relationship_profile\x27\x20→\x20business\x20relationship\x20graph\x20for\x20ONE\x20account\x20(power/interest/value-flow\x20edges,\x20K3/19)','\x20\x20industry_pack_operation\x20action=\x27recommend_industry\x27/\x27list_modes\x27\x20→\x20industry\x20mode\x20registry\x20(GLM6/92\x20§E)','\x20\x20strategy_review_operation\x20action=\x27collect\x27/\x27review\x27/\x27list_snapshots\x27\x20→\x20posture-weighted\x20scorecard\x20+\x20periodic\x20review\x20(current-layer\x20proposals\x20only)','\x20\x20goal_operation\x20action=\x27merchant_guide\x27\x20→\x2010-step\x20merchant\x20onboarding\x20wizard\x20(never\x20executes\x20on-chain\x20ops)','\x20\x20benchmark_migration_operation\x20→\x20industry\x20archetype\x20templates\x20+\x20one-click\x20competitor\x20migration:','\x20\x20\x20\x20template_list\x20/\x20template_get\x20/\x20template_scan\x20(pre-deploy\x20risk\x20scan)\x20/\x20template_generate\x20(creation\x20plan)','\x20\x20\x20\x20migration_import\x20(store\x20URL/description\x20→\x20MigrationLog)\x20→\x20migration_review\x20(user\x20confirmation)\x20→\x20migration_apply\x20(scan-first\x20creation\x20plan;\x20testnet\x20default)','','═══════════════════════════════════════════════════════════════','BUILD/BUY\x20POLICY\x20(no\x20local\x20projects\x20—\x20chain\x20state\x20is\x20the\x20source\x20of\x20truth):','═══════════════════════════════════════════════════════════════','','CASE\x201\x20—\x20COMPLEX\x20REQUIREMENT\x20(user\x20wants\x20to\x20build/deploy\x20a\x20full\x20service):','\x20\x20→\x20Plan\x20with\x20goal_operation\x20action=\x27analyze_intent\x27\x20(C1:\x20intent\x20→\x20per-object\x20puzzle\x20snapshots\x20+\x20creation\x20order),','\x20\x20\x20\x20then\x20\x27aggregate_risks\x27\x20(C2:\x20cross-object\x20risk\x20calibration)\x20and\x20\x27trace_substeps\x27\x20(C3:\x20substep\x20DAG\x20coherence).','\x20\x20→\x20Alternatively\x20run\x20goal_operation\x20action=\x27merchant_guide\x27\x20for\x20a\x20guided\x2010-step\x20onboarding\x20plan.','\x20\x20→\x20If\x20the\x20user\x20wants\x20to\x20build\x20LIKE\x20an\x20industry\x20archetype\x20(\x27build\x20like\x20the\x20retail\x20leader\x20model\x27)\x20or','\x20\x20\x20\x20MIGRATE\x20an\x20existing\x20store\x20(hands\x20over\x20a\x20store\x20URL/description),\x20use\x20benchmark_migration_operation','\x20\x20\x20\x20(template_list\x20→\x20template_scan\x20→\x20template_generate,\x20or\x20migration_import\x20→\x20migration_review\x20→\x20migration_apply).','\x20\x20→\x20Create\x20objects\x20via\x20onchain_operations,\x20then\x20publish\x20the\x20Service.','','CASE\x202\x20—\x20SINGLE\x20OBJECT\x20CREATION\x20(user\x20wants\x20one\x20specific\x20object):','\x20\x20→\x20Create\x20directly\x20via\x20onchain_operations.\x20No\x20project\x20bookkeeping\x20needed.','','CASE\x203\x20—\x20CONSUMER\x20FLOW\x20(user\x20wants\x20to\x20buy/evaluate\x20a\x20service):','\x20\x20→\x20query_toolkit\x20query_type=\x27service_panorama\x27\x20or\x20\x27review_pack\x27\x20for\x20the\x20detail\x20page,','\x20\x20\x20\x20\x27reverse_map\x27\x20for\x20the\x20deterministic\x20buy\x20report\x20(add\x20Machine/Allocation\x20for\x20refund-path\x20detection),','\x20\x20\x20\x20then\x20onchain_operations\x20service_buy.','','CASE\x204\x20—\x20SIMPLE\x20QUERY\x20(user\x20wants\x20to\x20check\x20object\x20info,\x20balance,\x20etc.):','\x20\x20→\x20Proceed\x20directly\x20with\x20the\x20query.','═══════════════════════════════════════════════════════════════']['join']('\x0a');function joinIssuePath(a){return a['length']>0x0?a['map'](b=>typeof b==='number'?'['+b+']':String(b))['join']('.')['replace']('.[','['):'(root)';}function unionVariantErrors(a){const b=a,d=b['errors']??b['unionErrors']??b['issues'];if(!Array['isArray'](d))return[];const e=[];for(const f of d){if(!f)continue;if(Array['isArray'](f))f['every'](g=>!!g&&typeof g==='object'&&'code'in g)&&e['push']({'issues':f});else typeof f==='object'&&Array['isArray'](f['issues'])&&e['push']({'issues':f['issues']});}return e;}function variantScore(a){let b=0x0;for(const c of a['issues']){b+=0xa;const d=c;if(c['code']==='invalid_type')d['received']==='undefined'?b+=0x14:b-=0x5;else{if(c['code']==='unrecognized_keys'){const e=Array['isArray'](d['keys'])?d['keys']['length']:0x1;b+=0xf+e*0x5;}else{if(c['code']==='invalid_union'){const f=unionVariantErrors(c);if(f['length']>0x0)b+=Math['min'](...f['map'](variantScore));}}}}return b;}function variantSummary(a,b=0x3){const c=[];for(const e of a['issues']){const f=e;if(e['code']==='unrecognized_keys'){const g=Array['isArray'](f['keys'])?f['keys']['join'](',\x20'):'?';c['push']('unknown\x20field(s):\x20'+g);}else e['code']==='invalid_type'&&f['received']==='undefined'?c['push']('missing:\x20'+joinIssuePath([...e['path']])):c['push'](e['code']+'\x20at\x20'+joinIssuePath([...e['path']]));if(c['length']>=b)break;}const d=a['issues']['length']>b?'\x20(+'+(a['issues']['length']-b)+'\x20more)':'';return c['length']>0x0?c['join'](';\x20')+d:'shape\x20mismatch';}function resolveIssuePath(a,b){if(a['length']===0x0)return joinIssuePath(b);const c=b['length']>=a['length']&&a['every']((d,e)=>b[e]===d);return joinIssuePath(c?b:[...a,...b]);}function subToolRoutingHint(a,b){if(a!=='query_type')return'';const c=b['toLowerCase']();if(c['startsWith']('onchain_table'))return'\x20—\x20ROUTING:\x20table\x20/\x20table-item\x20queries\x20belong\x20to\x20the\x20SEPARATE\x20\x27onchain_table_data\x27\x20tool\x20—\x20call\x20onchain_table_data\x20with\x20this\x20query_type\x20(and\x20its\x20parent/address\x20params)\x20instead\x20of\x20query_toolkit';return'';}function matchedVariantLegalKeys(a){if(!a||typeof a!=='object')return[];const b=a['properties'];if(!b||typeof b!=='object'||Array['isArray'](b))return[];return Object['keys'](b)['sort']();}function absoluteIssuePath(a,b){const c=a['length']>0x0&&b['length']>=a['length']&&a['every']((d,e)=>b[e]===d);return c?b:[...a,...b];}function pushFlattened(a,b,c,d,e=[]){for(const f of a['issues']){if(f['code']==='invalid_union'){const g=f,h=[...f['path']],i=Array['isArray'](g['errors'])?g['errors']['length']:Array['isArray'](g['unionErrors'])?g['unionErrors']['length']:0x0,j=unionVariantErrors(f);if(j['length']===0x0){const o=resolveIssuePath(e,h),p=c!==undefined?extractValueAtPath(c,absoluteIssuePath(e,h)):undefined,q=p!==undefined;let r;if(i>0x0)r=(q?'value\x20does\x20not\x20match\x20any\x20of\x20the\x20union\x27s':'missing\x20required\x20union\x20field\x20—\x20no\x20value\x20provided;\x20union\x20accepts')+'\x20'+i+'\x20shape(s);\x20see\x20the\x20schema\x20preview\x20for\x20the\x20accepted\x20fields';else{if(q&&p&&typeof p==='object'&&!Array['isArray'](p)){const s=p,t=['operation_type','query_type','type','action','op']['find'](u=>typeof s[u]==='string');r=t?'discriminator\x20\x27'+t+'\x27=\x22'+String(s[t])+'\x22\x20does\x20not\x20match\x20any\x20variant;\x20check\x20the\x20\x22Valid\x20\x27'+t+'\x27\x20values\x22\x20line\x20in\x20the\x20schema\x20preview\x20below'+subToolRoutingHint(t,String(s[t])):'value\x20does\x20not\x20match\x20any\x20union\x20variant\x20(no\x20per-variant\x20details\x20available);\x20see\x20the\x20schema\x20preview';}else{if(q&&typeof p==='string'&&h['length']>0x0){const u=String(h[h['length']-0x1]);r='discriminator\x20\x27'+u+'\x27=\x22'+p+'\x22\x20does\x20not\x20match\x20any\x20variant;\x20check\x20the\x20\x22Valid\x20\x27'+u+'\x27\x20values\x22\x20line\x20in\x20the\x20schema\x20preview\x20below'+subToolRoutingHint(u,p);}else r='value\x20does\x20not\x20match\x20any\x20union\x20variant\x20(no\x20per-variant\x20details\x20available);\x20see\x20the\x20schema\x20preview';}}b['push']({'kind':'header','path':o,'code':'invalid_union','message':r});d&&(b[b['length']-0x1]={'kind':'header','path':o+'\x20['+d+']','code':'invalid_union','message':r});continue;}const k=j['map']((v,w)=>({'idx':w,'err':v,'score':variantScore(v)}))['sort']((v,w)=>v['score']-w['score']),l=k[0x0],m=k['slice'](0x1)['map'](v=>'variant\x20'+(v['idx']+0x1)+':\x20'+variantSummary(v['err']))['join']('\x20|\x20');b['push']({'kind':'header','path':resolveIssuePath(e,h),'code':'invalid_union','message':'no\x20union\x20variant\x20matched\x20('+j['length']+'\x20checked);\x20closest\x20=\x20variant\x20'+(l['idx']+0x1)+'\x20—\x20it\x20fails\x20on:\x20'+variantSummary(l['err'])+(m?'\x20—\x20others:\x20'+m:'')});const n=h['length']>0x0&&h['every']((v,w)=>e[w]===v)?h:[...e,...h];pushFlattened(l['err'],b,c,'variant\x20'+(l['idx']+0x1),n);}else b['push']({'kind':'issue','issue':f,'variantTag':d,'pathPrefix':e});}}function flattenZodIssues(a,b){const c=[];pushFlattened(a,c,b);const d=(f,g)=>{if(f['kind']!=='issue'||g['kind']!=='issue')return![];const h=absoluteIssuePath(f['pathPrefix']??[],f['issue']['path']),i=absoluteIssuePath(g['pathPrefix']??[],g['issue']['path']);return i['length']>h['length']&&h['every']((j,l)=>i[l]===j);},e=c['filter'](f=>{if(f['kind']!=='issue'||f['issue']['code']!=='unrecognized_keys')return!![];return!c['some'](g=>g!==f&&g['kind']==='issue'&&g['issue']['code']!=='unrecognized_keys'&&d(f,g));});return e;}const RECEIVED_VALUE_MAX=0x1f4;function truncateEcho(a){return a['length']>RECEIVED_VALUE_MAX?a['slice'](0x0,RECEIVED_VALUE_MAX)+'...(truncated,\x20'+(a['length']-RECEIVED_VALUE_MAX)+'\x20more\x20chars)':a;}function formatZodErrors(a,b){return flattenZodIssues(a,b)['map'](c=>{if(c['kind']==='header')return c['path']+'\x20['+c['code']+']:\x20'+c['message'];const d=c['issue'],e=resolveIssuePath(c['pathPrefix']??[],d['path']),f=d['code'],g=d['message'];let h='';const i=d;if(f==='invalid_type'){const l=i['expected'],m=i['received'];typeof l==='string'&&typeof m==='string'&&(h='\x20(expected:\x20'+l+';\x20received:\x20'+m+')');}else{if(f==='invalid_value'){const n=i['expected'];if(n!==undefined){const o=typeof n==='string'?n:JSON['stringify'](n);h='\x20(expected:\x20'+o['slice'](0x0,0x3c)+')';}}else{if(f==='too_big'||f==='too_small'){const p=i['maximum']??i['minimum'],q=i['origin'];p!==undefined&&q!==undefined&&(h='\x20('+q+':\x20'+p+')');}}}const j=extractValueAtPath(b,absoluteIssuePath(c['pathPrefix']??[],d['path']));if(j!==undefined){const r=typeof j==='string'?'\x22'+truncateEcho(j)+'\x22':typeof j==='object'?truncateEcho(JSON['stringify'](j)):String(j);!h['includes']('received:')&&(h+='\x20(received\x20value:\x20'+r+')');}const k=c['variantTag']?'\x20['+c['variantTag']+']':'';return''+e+k+'\x20['+f+']:\x20'+g+h;});}function generateSuggestion(a,b,c){const d=b;switch(a){case'invalid_type':{const e=d['expected'];if(e==='number'&&typeof c==='string')return'Convert\x20to\x20number:\x20'+Number(c);if(e==='string')return'Wrap\x20in\x20quotes\x20or\x20call\x20String(...)';if(e==='array')return'Wrap\x20in\x20array:\x20['+JSON['stringify'](c)+']';if(e==='object')return'Provide\x20an\x20object,\x20not\x20a\x20primitive';return'Convert\x20value\x20to\x20'+(e??'the\x20expected\x20type');}case'invalid_enum_value':{const f=d['options'],g=Array['isArray'](f)?f['map'](h=>JSON['stringify'](h))['join']('\x20|\x20'):String(f);return'Use\x20one\x20of:\x20'+g;}case'invalid_literal':{const h=d['expected'];return'Use\x20the\x20exact\x20value:\x20'+JSON['stringify'](h);}case'too_small':{const i=d['minimum'],j=d['type'];if(j==='array')return'Add\x20at\x20least\x20'+i+'\x20element(s)\x20to\x20the\x20array';if(j==='string')return'String\x20must\x20be\x20at\x20least\x20'+i+'\x20character(s)\x20long';if(j==='number')return'Use\x20a\x20value\x20>=\x20'+i;return'Value\x20must\x20be\x20>=\x20'+i;}case'too_big':{const k=d['maximum'],l=d['type'];if(l==='array')return'Reduce\x20array\x20to\x20at\x20most\x20'+k+'\x20element(s)';if(l==='string')return'Shorten\x20string\x20to\x20at\x20most\x20'+k+'\x20character(s)';if(l==='number')return'Use\x20a\x20value\x20<=\x20'+k;return'Value\x20must\x20be\x20<=\x20'+k;}case'unrecognized_keys':{const m=d['keys'];return'Remove\x20unknown\x20field(s):\x20'+(m??[])['join'](',\x20')+'.\x20Check\x20the\x20schema\x20for\x20valid\x20field\x20names.';}case'invalid_union':{return'Value\x20does\x20not\x20match\x20any\x20of\x20the\x20union\x20variants\x20—\x20see\x20the\x20\x22closest\x20variant\x22\x20line\x20above\x20for\x20the\x20concrete\x20field\x20error(s).';}case'invalid_string':{const n=d['validation'];if(n==='url')return'Provide\x20a\x20valid\x20URL\x20string';if(n==='email')return'Provide\x20a\x20valid\x20email\x20string';if(n==='uuid')return'Provide\x20a\x20valid\x20UUID\x20string';if(n==='regex')return'String\x20does\x20not\x20match\x20the\x20required\x20pattern';return'Provide\x20a\x20valid\x20string\x20matching\x20the\x20validation:\x20'+(n??'unknown');}case'invalid_date':{return'Provide\x20a\x20valid\x20Date\x20object\x20or\x20ISO\x20date\x20string';}case'not_finite':{return'Use\x20a\x20finite\x20number\x20(not\x20Infinity\x20or\x20NaN)';}case'invalid_arguments':{return'Arguments\x20do\x20not\x20match\x20the\x20expected\x20schema';}case'invalid_return_type':{return'Return\x20type\x20does\x20not\x20match\x20the\x20expected\x20schema';}case'custom':{return'Custom\x20validation\x20failed\x20—\x20see\x20the\x20field\x27s\x20description\x20in\x20the\x20schema';}default:{return'Fix\x20the\x20value\x20at\x20\x27'+b['path']['join']('.')+'\x27\x20based\x20on\x20the\x20schema';}}}function formatZodErrorsStructured(a,b){return flattenZodIssues(a,b)['flatMap'](c=>{if(c['kind']==='header'){const l=c['message']['match'](/closest = variant (\d+)/),m=c['message']['includes']('missing\x20required\x20union\x20field'),n=c['message']['includes']('does\x20not\x20match\x20any\x20variant'),o=l?'Fix\x20the\x20field\x20error(s)\x20listed\x20for\x20variant\x20'+l[0x1]+'\x20below.':m?'Provide\x20this\x20required\x20field\x20with\x20one\x20of\x20the\x20accepted\x20shapes,\x20and\x20check\x20field-name\x20spelling\x20against\x20the\x20schema\x20preview.':n?'No\x20union\x20variant\x20accepts\x20this\x20discriminator\x20—\x20pick\x20a\x20value\x20from\x20the\x20\x27Valid\x20...\x20values\x27\x20line\x20in\x20the\x20schema\x20preview\x20below.\x20If\x20the\x20value\x20belongs\x20to\x20a\x20sub-tool\x20(e.g.\x20onchain_table*\x20→\x20onchain_table_data),\x20resend\x20it\x20to\x20that\x20tool.':'No\x20union\x20variant\x20matched\x20—\x20check\x20the\x20schema\x20preview\x20below\x20for\x20the\x20accepted\x20shapes.';return[{'path':c['path'],'code':c['code'],'message':c['message'],'suggestion':o}];}const d=c['issue'],e=resolveIssuePath(c['pathPrefix']??[],d['path']),f=d['code'],g=c['variantTag']?d['message']+'\x20(closest\x20union\x20variant:\x20'+c['variantTag']+')':d['message'],h=d;let i;if(f==='invalid_type'){const p=h['expected'],q=h['received'];typeof p==='string'&&typeof q==='string'&&(i=p);}else{if(f==='invalid_value'){const r=h['expected'],s=h['options'];if(Array['isArray'](s))i=s['map'](t=>JSON['stringify'](t))['join']('\x20|\x20');else r!==undefined&&(i=typeof r==='string'?r:JSON['stringify'](r));}else{if(f==='too_big'||f==='too_small'){const t=h['maximum']??h['minimum'];t!==undefined&&(i=String(t));}}}const j=extractValueAtPath(b,absoluteIssuePath(c['pathPrefix']??[],d['path'])),k=generateSuggestion(f,d,j);return[{'path':e,'code':f,'message':g,'expected':i,'received_value':truncateReceivedValue(j),'suggestion':k}];});}function extractValueAtPath(a,b){if(a===undefined||a===null||b['length']===0x0)return undefined;let c=a;for(const d of b){if(c===undefined||c===null)return undefined;if(typeof d==='number'){if(!Array['isArray'](c))return undefined;c=c[d];}else{if(typeof c!=='object')return undefined;c=c[d];}}return c;}const RECEIVED_VALUE_MAX_CHARS=0xc8;function truncateReceivedValue(a){if(a===undefined)return undefined;if(typeof a==='string')return a['length']<=RECEIVED_VALUE_MAX_CHARS?a:a['slice'](0x0,RECEIVED_VALUE_MAX_CHARS)+'…(truncated,\x20'+a['length']+'\x20chars)';let b;try{b=JSON['stringify'](a)??String(a);}catch{b=String(a);}if(b['length']<=RECEIVED_VALUE_MAX_CHARS)return a;return b['slice'](0x0,RECEIVED_VALUE_MAX_CHARS)+'…(truncated,\x20'+b['length']+'\x20chars)';}const MAX_MISMATCH_ERRORS=0xa;function capMismatchErrors(a,b){if(a['length']>MAX_MISMATCH_ERRORS){const c=a['length']-MAX_MISMATCH_ERRORS;a['length']=MAX_MISMATCH_ERRORS,a['push']('…and\x20'+c+'\x20more\x20error(s)\x20truncated\x20(fix\x20the\x20listed\x20ones\x20first).');}if(b['length']>MAX_MISMATCH_ERRORS){const d=b['length']-MAX_MISMATCH_ERRORS;b['length']=MAX_MISMATCH_ERRORS,b['push']({'path':'(root)','code':'errors_truncated','message':d+'\x20additional\x20error(s)\x20truncated.','suggestion':'Fix\x20the\x20listed\x20errors\x20first\x20—\x20remaining\x20errors\x20frequently\x20disappear\x20once\x20the\x20first\x20ones\x20are\x20corrected.'});}}function zodTopLevelShape(a){let b=a;while(!![]){const e=b['_def'];if(!e)break;const f=e['typeName']==='ZodEffects'?e['schema']:e['out']??e['innerType'];if(!f||f===b)break;b=f;}const c=b['_def'],d=typeof c?.['shape']==='function'?c['shape']():c?.['shape'];return d&&typeof d==='object'?d:undefined;}function checkUnknownFields(a,b){const c=zodTopLevelShape(a);if(!c||typeof b!=='object'||b===null)return[];const d=Object['keys'](c),e=Object['keys'](b);return e['filter'](g=>!d['includes'](g));}function zodUnionAwareKeyCheck(a,b){let c=a;while(!![]){const g=c['_def'];if(!g)break;const h=g['typeName']==='ZodEffects'?g['schema']:g['out']??g['innerType'];if(!h||h===c)break;c=h;}const d=c['_def']?.['options']??[c];let e=![],f=![];for(const i of d){const j=zodTopLevelShape(i);if(!j)continue;if(b in j)e=!![];if('env'in j)f=!![];}return{'declared':e,'hasEnvSlot':f};}function zodBranchAwareDeclared(a,b,c){let d=a;while(!![]){const h=d['_def'];if(!h)break;const i=h['typeName']==='ZodEffects'?h['schema']:h['out']??h['innerType'];if(!i||i===d)break;d=i;}const e=d['_def'],f=e?.['options'];if(!f){const j=zodTopLevelShape(d);return j!==undefined&&b in j;}const g=e?.['discriminator'];if(typeof g==='string'&&c[g]!==undefined)for(const k of f){const l=zodTopLevelShape(k);if(!l)continue;const m=l[g]?.['_def']?.['value'];if(m===c[g])return b in l;}return f['some'](n=>{const p=zodTopLevelShape(n);return p!==undefined&&b in p;});}function extractRelevantSchema(a,b,c){if(b==='onchain_operations'&&typeof c==='object'&&c!==null){const d=c['operation_type'];if(typeof d==='string'){const e='onchain_operations_'+d,f=loadPreGeneratedSchema(e);if(f)return f;}}return a;}function isSchemaValidationError(a){return a['startsWith']('Unknown\x20')&&a['includes']('field')||a['includes']('expected')&&a['includes']('received')||a['includes']('Invalid\x20input')||a['includes']('Required')||a['includes']('validation\x20failed\x20with');}function variantConstValue(a,b){const c=a['properties'];if(!c||typeof c!=='object')return undefined;const d=c[b];if(!d)return undefined;if(typeof d['const']==='string')return d['const'];if(Array['isArray'](d['enum'])&&d['enum']['length']===0x1&&typeof d['enum'][0x0]==='string')return d['enum'][0x0];return undefined;}function pickUnionVariant(a,b){const c=['query_type','operation_type','type'],d=b&&typeof b==='object'&&!Array['isArray'](b)?Object['keys'](b):[],e=[...c,...d['filter'](f=>!c['includes'](f))];for(const f of e){const g=b?.[f];if(typeof g!=='string')continue;for(let h=0x0;h<a['length'];h++){const j=a[h];if(j&&typeof j==='object'&&variantConstValue(j,f)===g)return{'variant':j,'index':h,'discriminator':f,'matched':!![]};}}for(let k=0x0;k<a['length'];k++){const l=a[k];if(l&&typeof l==='object'){const m=l;if(m['properties']&&typeof m['properties']==='object')return{'variant':m,'index':k,'matched':![]};}}return{'index':-0x1,'matched':![]};}function unionDiscriminatorValues(a,b){const c=[];for(const d of a){if(d&&typeof d==='object'){const e=variantConstValue(d,b);if(e!==undefined&&!c['includes'](e))c['push'](e);}}return c;}function inferDiscriminatorKey(a){if(!Array['isArray'](a)||a['length']===0x0)return undefined;const b=a['filter'](d=>!!d&&typeof d==='object'&&!!d['properties']);if(b['length']!==a['length']||b['length']===0x0)return undefined;const c=b[0x0]['properties'];for(const d of Object['keys'](c)){let e=!![];for(const f of b){if(variantConstValue(f,d)===undefined){e=![];break;}}if(e)return d;}return undefined;}const NESTED_REQUIRED_MAX_LINES=0x10;function nestedRequiredLines(a,b,c){if(c>0x2)return[];const d=[],e=Array['isArray'](b['required'])?b['required']['filter'](g=>typeof g==='string'):[];e['length']>0x0&&d['push']('\x20\x20\x20\x20\x20\x20Required\x20within\x20'+a+':\x20'+e['join'](',\x20'));const f=b['properties'];if(!f||typeof f!=='object'||c>=0x2)return d;for(const [g,h]of Object['entries'](f)){if(d['length']>=NESTED_REQUIRED_MAX_LINES){d['push']('\x20\x20\x20\x20\x20\x20(more\x20nested\x20required\x20fields\x20under\x20'+a+'\x20—\x20see\x20structuredContent\x20for\x20the\x20full\x20schema)');break;}if(!h||typeof h!=='object')continue;const i=h;if(!i['properties']||typeof i['properties']!=='object')continue;d['push'](...nestedRequiredLines(a+'.'+g,i,c+0x1));}return d;}export function buildSchemaPreview(a,b,c){try{const d=['Schema\x20preview\x20for\x20'+b+':'];let e,g=[],h='',i,j=-0x1,k,l=![];if(a['properties']&&typeof a['properties']==='object')e=a['properties'],g=Array['isArray'](a['required'])?a['required']:[],h=typeof a['description']==='string'?a['description']:'';else{if(Array['isArray'](a['oneOf'])||Array['isArray'](a['anyOf'])){i=a['oneOf']??a['anyOf'];const p=pickUnionVariant(i,c);j=p['index'],k=p['discriminator'],l=p['matched'];p['variant']&&(e=p['variant']['properties'],g=Array['isArray'](p['variant']['required'])?p['variant']['required']:[],h=typeof p['variant']['description']==='string'?p['variant']['description']:'');if(!e)return d['push']('\x20\x20(discriminated\x20union\x20with\x20'+i['length']+'\x20variants\x20—\x20see\x20structuredContent\x20for\x20full\x20schema)'),d['join']('\x0a');}}h&&h['length']>0x0&&h['length']<0xc8&&d['push']('\x20\x20'+h);if(!e)return d['push']('\x20\x20(no\x20properties\x20available\x20—\x20see\x20structuredContent\x20for\x20full\x20schema)'),d['join']('\x0a');const m=new Set(g),n=g['length']>0x0?g['join'](',\x20'):'(none)',o=Object['keys'](e)['filter'](q=>!m['has'](q))['join'](',\x20');d['push']('Required:\x20'+n);o&&d['push']('Optional:\x20'+o);d['push']('Fields:');for(const [q,r]of Object['entries'](e)){if(r&&typeof r==='object'){const s=r,t=describeSchemaType(s),u=m['has'](q)?'required':'optional';let v=typeof s['description']==='string'?s['description']:'';if(v['length']>0x78)v=v['slice'](0x0,0x75)+'...';let w='';if(s['properties']&&typeof s['properties']==='object'){const y=Object['keys'](s['properties']);y['length']>0x0&&(w='\x20{\x20'+y['slice'](0x0,0x8)['join'](',\x20')+(y['length']>0x8?',\x20...':'')+'\x20}');}if(s['items']&&typeof s['items']==='object'){const A=s['items'],B=describeSchemaType(A);w='\x20(array\x20of\x20'+B+')';}Array['isArray'](s['enum'])&&(w='\x20(enum:\x20'+s['enum']['slice'](0x0,0x6)['map'](C=>JSON['stringify'](C))['join'](',\x20')+(s['enum']['length']>0x6?',\x20...':'')+')');d['push']('\x20\x20-\x20'+q+'\x20('+t+',\x20'+u+')'+w+(v?'\x20—\x20'+v:''));const x=nestedRequiredLines(q,s,0x0);d['push'](...x);}}if(i&&i['length']>0x0){d['push']('');if(l&&k){const C=c&&typeof c==='object'?c:{},D=String(C[k]);d['push']('Matched\x20variant:\x20'+k+'=\x22'+D+'\x22\x20(variant\x20'+(j+0x1)+'\x20of\x20'+i['length']+').');}else{d['push']('Discriminated\x20union\x20with\x20'+i['length']+'\x20variants;\x20showing\x20variant\x20'+(j+0x1)+'\x20(no\x20matching\x20discriminator\x20value\x20in\x20input).');const E=k??inferDiscriminatorKey(i)??(b==='query_toolkit'?'query_type':'operation_type'),F=unionDiscriminatorValues(i,E);F['length']>0x0&&d['push']('Valid\x20\x27'+E+'\x27\x20values:\x20'+F['join'](',\x20'));}}if(b==='onchain_operations'&&typeof c==='object'&&c!==null){const G=c['operation_type'];typeof G==='string'&&(d['push'](''),d['push']('operation_type-specific\x20schema:\x20onchain_operations_'+G),d['push']('(Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27onchain_operations_'+G+'\x27\x20for\x20the\x20full\x20sub-schema.)'));}return d['join']('\x0a');}catch{return'Schema\x20preview\x20for\x20'+b+':\x20(unable\x20to\x20build\x20preview\x20—\x20see\x20structuredContent\x20for\x20full\x20schema)';}}function compactMismatchSchemaInput(a,b){const c=Array['isArray'](a['oneOf'])?a['oneOf']:Array['isArray'](a['anyOf'])?a['anyOf']:undefined;if(!c)return a;const d=pickUnionVariant(c,b);if(!d['matched']||!d['variant'])return fallbackUnionSchema(a,c,b);const e=d['variant'],{oneOf:f,anyOf:g,...h}=a,i=h['properties']&&typeof h['properties']==='object'?h['properties']:{},j=e['properties']&&typeof e['properties']==='object'?e['properties']:{},k=Array['isArray'](h['required'])?h['required']:[],l=Array['isArray'](e['required'])?e['required']:[];return{...h,...e['type']!==undefined?{'type':e['type']}:{},...e['additionalProperties']!==undefined?{'additionalProperties':e['additionalProperties']}:{},...e['description']!==undefined?{'description':e['description']}:{},'properties':{...i,...j},'required':[...new Set([...k,...l])]};}function fallbackUnionSchema(a,b,c){const d=inferDiscriminatorKey(b);if(!d)return a;const e=unionDiscriminatorValues(b,d);if(e['length']===0x0)return a;const {oneOf:f,anyOf:g,...h}=a,i=h['properties']&&typeof h['properties']==='object'?h['properties']:{},j=Array['isArray'](h['required'])?h['required']:[],k=c&&typeof c==='object'&&!Array['isArray'](c)?Object['keys'](c):[];return{...h,'properties':{...i,[d]:{'type':'string','enum':e,'description':k['includes'](d)?'Unknown\x20\x22'+d+'\x22\x20value\x20—\x20must\x20be\x20one\x20of\x20the\x20listed\x20values.\x20Per-variant\x20parameters:\x20schema_query\x20(action=\x27get\x27)':'Missing\x20\x22'+d+'\x22\x20—\x20set\x20it\x20to\x20one\x20of\x20the\x20listed\x20values.\x20Per-variant\x20parameters:\x20schema_query\x20(action=\x27get\x27)'}},'required':j['includes'](d)?j:[...j,d]};}function describeSchemaType(a){if(typeof a['type']==='string')return a['type'];if(Array['isArray'](a['type']))return a['type']['join']('|');if(a['$ref'])return'$ref';if(Array['isArray'](a['oneOf']))return'oneOf';if(Array['isArray'](a['anyOf']))return'anyOf';if(Array['isArray'](a['allOf']))return'allOf';if(a['enum'])return'enum';if(a['const'])return'const('+JSON['stringify'](a['const'])+')';return'object';}const MISMATCH_SCHEMA_MAX_DEPTH=0x18;function capSchemaDepth(a,b){if(b>=MISMATCH_SCHEMA_MAX_DEPTH){if(Array['isArray'](a))return'(depth-capped\x20—\x20use\x20schema_query\x20action=\x27get\x27\x20for\x20the\x20full\x20sub-schema)';if(a!==null&&typeof a==='object')return{'type':'object','description':'(depth-capped\x20—\x20use\x20schema_query\x20action=\x27get\x27\x20for\x20the\x20full\x20sub-schema)'};return a;}if(Array['isArray'](a))return a['map'](c=>capSchemaDepth(c,b+0x1));if(a!==null&&typeof a==='object'){const c={};for(const [d,e]of Object['entries'](a)){c[d]=capSchemaDepth(e,b+0x1);}return c;}return a;}export async function dispatchToolCall(a,b,c,d){return sanitizeToolDispatchResult(await dispatchToolCallRaw(a,b,c,d));}async function dispatchToolCallRaw(a,b,c,d){{const i=findLatin1Mojibake(b);if(i)return mojibakeBlockResult(i['path'],i['sample']);}if(a==='wowok')return handleWowok(b,c,d);const e=TOOL_REGISTRY_MAP['get'](a);if(!e)throw new Error('Unknown\x20tool:\x20'+a+'.\x20Available:\x20'+TOOL_REGISTRY['map'](j=>j['name'])['join'](',\x20'));if(e['applyRules']&&!c?.['skipRules']){const j=await withTimeout(Promise['resolve'](e['applyRules'](b)),e['timeoutMs']??0xea60,a);if(j)return j;}const f=dispatchWithHarness(e['handler'],a),g=e['timeoutMs']??0xea60,h=wrapHandlerWithErrorShape(f,g,a,e['errorShapeBuilder'],e['onTimeoutVerify']);return h(b,d);}const TOOL_FIELD_ALIASES=['tool','tool_name','name'],DATA_FIELD_ALIASES=['data','args','params','parameters'],RESERVED_FIELD_NAMES=new Set([...TOOL_FIELD_ALIASES,...DATA_FIELD_ALIASES]);function normalizeInput(a){const b=[];if(!a||typeof a!=='object'||Array['isArray'](a))return{'tool':undefined,'data':{},'normalizationNotes':['input\x20is\x20not\x20an\x20object']};const c=a;let d;for(const f of TOOL_FIELD_ALIASES){if(typeof c[f]==='string'&&c[f]){d=c[f];f!=='tool'&&b['push']('normalized\x20\x27'+f+'\x27\x20→\x20\x27tool\x27');break;}}let e;for(const g of DATA_FIELD_ALIASES){const h=c[g];if(h!==undefined&&h!==null&&typeof h==='object'&&!Array['isArray'](h)){e=h;g!=='data'&&b['push']('normalized\x20\x27'+g+'\x27\x20→\x20\x27data\x27');break;}}if(!e){const i={};let j=![];for(const k of Object['keys'](c)){!RESERVED_FIELD_NAMES['has'](k)&&(i[k]=c[k],j=!![]);}j?(e=i,b['push']('extracted\x20inline\x20params\x20→\x20\x27data\x27\x20(no\x20data\x20wrapper\x20was\x20provided)')):e={};}return{'tool':d,'data':e,'normalizationNotes':b};}const QUERY_ACCOUNT_FIELD_ALIASES={'account_balance':{'canonical':'name_or_address','aliases':['account','address']},'onchain_personal_profile':{'canonical':'account','aliases':['name_or_address','address']},'address_profile':{'canonical':'address','aliases':['name_or_address','account']}};function normalizeQueryToolkitAliases(a,b){if(typeof a['query_type']!=='string')return;const c=QUERY_ACCOUNT_FIELD_ALIASES[a['query_type']];if(!c)return;if(a[c['canonical']]!==undefined)return;for(const d of c['aliases']){if(a[d]!==undefined){a[c['canonical']]=a[d],delete a[d],b['push']('query_toolkit\x20'+a['query_type']+':\x20normalized\x20\x27'+d+'\x27\x20→\x20\x27'+c['canonical']+'\x27');return;}}}const QUERY_NETWORK_CANONICAL={'testnet':'testnet','mainnet':'mainnet','localnet':'localnet'},QUERY_NETWORK_ACCEPTED=Object['keys'](QUERY_NETWORK_CANONICAL)['join'](',\x20'),QUERY_NETWORK_KEY_VARIANTS=['context_network','network','net','chain'];function queryNetworkCanonicalValue(a){return QUERY_NETWORK_CANONICAL[a['trim']()['toLowerCase']()['replace'](/[-_]/g,'')];}function queryNetworkKeyFor(a,b){if(typeof b!=='string'||b==='')return undefined;let c=a;while(!![]){const g=c['_def'];if(!g)break;const h=g['typeName']==='ZodEffects'?g['schema']:g['out']??g['innerType'];if(!h||h===c)break;c=h;}const d=c['_def']?.['options'];if(!Array['isArray'](d))return undefined;const e=[],f=i=>{for(const j of i){const k=j['_def']?.['options'];if(Array['isArray'](k)){f(k);continue;}e['push'](j);}};f(d);for(const i of e){const j=zodTopLevelShape(i);if(!j)continue;const k=j['query_type']?.['value'];if(k!==b)continue;if('context_network'in j)return'context_network';if('network'in j)return'network';return undefined;}return undefined;}function normalizeQueryNetworkSpellings(a,b,c){for(const e of QUERY_NETWORK_KEY_VARIANTS){const f=a[e];if(typeof f!=='string')continue;const g=queryNetworkCanonicalValue(f);g&&f!==g&&(a[e]=g,b['push']('query_toolkit:\x20normalized\x20'+e+'\x20\x27'+f+'\x27\x20→\x20\x27'+g+'\x27'));}const d=queryNetworkKeyFor(c,a['query_type']);if(d!==undefined)for(const h of QUERY_NETWORK_KEY_VARIANTS){if(h===d)continue;const i=a[h];if(typeof i!=='string'||i==='')continue;if(a[d]===undefined){a[d]=i;const j=d==='context_network'?'BI\x20family\x20key':'on-chain\x20query\x20family\x20key';b['push']('normalized\x20\x27'+h+'\x27\x20→\x20\x27'+d+'\x27\x20('+j+')');}else b['push']('ignored\x20redundant\x20\x27'+h+'\x27\x20—\x20\x27'+d+'\x27\x20already\x20set');delete a[h];}if(d!==undefined){const k=a[d];if(typeof k==='string'&&k!==''&&queryNetworkCanonicalValue(k)===undefined)return{'field':d,'message':'Unknown\x20network\x20\x27'+k+'\x27\x20for\x20\x27'+d+'\x27.\x20Accepted\x20values:\x20'+QUERY_NETWORK_ACCEPTED+'.\x20'+'An\x20unknown\x20network\x20is\x20rejected\x20here\x20instead\x20of\x20silently\x20querying\x20the\x20default\x20network\x20'+'(that\x20mismatch\x20reads\x20as\x20\x22no\x20data\x22\x20—\x20F-NND-07).'};}return undefined;}async function handleWowok(a,b,c){const {tool:d,data:g,normalizationNotes:h}=normalizeInput(a);let j;{const q=a&&typeof a==='object'&&!Array['isArray'](a)?a:undefined,r=g,s=typeof q?.['harness_override_note']==='string'?q['harness_override_note']:typeof r?.['harness_override_note']==='string'?r['harness_override_note']:undefined;if(typeof s==='string'&&s['trim']()){if(q&&q['harness_override_note']!==undefined)delete q['harness_override_note'];if(r&&r['harness_override_note']!==undefined)delete r['harness_override_note'];j=s['trim'](),h['push']('rescued\x20top-level\x20\x27harness_override_note\x27\x20(per-purchase\x20pre-buy\x20gate\x20appeal)\x20—\x20forwarded\x20to\x20the\x20handler');}}(d==='query_toolkit'||d==='onchain_table_data')&&normalizeQueryToolkitAliases(g,h);if(d==='query_toolkit'||d==='onchain_table_data'){const t=TOOL_REGISTRY_MAP['get'](d),u=t?normalizeQueryNetworkSpellings(g,h,t['config']['inputSchema']):undefined;if(u!==undefined)return{'content':[{'type':'text','text':'Schema\x20mismatch\x20for\x20'+d+'.\x201\x20error(s).\x20'+u['message']}],'structuredContent':{'result':{'status':'schema_mismatch','errors':[u['message']],'structured_errors':[{'path':u['field'],'code':'unrecognized_enum_value','message':u['message'],'suggestion':'Use\x20one\x20of:\x20'+QUERY_NETWORK_ACCEPTED+'\x20(spellings\x20like\x20\x27TestNet\x27/\x27test-net\x27\x20are\x20normalized\x20automatically).\x20Omit\x20the\x20key\x20to\x20use\x20the\x20current\x20default\x20network.'}],'hint':'Fix\x20the\x20network\x20value\x20and\x20retry.'},'schema':null}};}let l=![];{const w=a&&typeof a==='object'&&!Array['isArray'](a)?a:undefined,x=g;w?.['want_schema']===!![]&&(l=!![],delete w['want_schema']),x&&typeof x==='object'&&x['want_schema']===!![]&&(l=!![],delete x['want_schema']);}if(a&&typeof a==='object'&&!Array['isArray'](a)){const y=a;y['passport']!==undefined&&y['submission']===undefined&&(y['submission']=y['passport'],h['push']('accepted\x20top-level\x20\x27passport\x27\x20as\x20alias\x20for\x20\x27submission\x27'));if(y['submission']!==undefined){const A=g['submission'];if(A!==undefined)return{'content':[{'type':'text','text':'Schema\x20mismatch\x20for\x20'+d+'.\x201\x20error(s).\x20\x27submission\x27\x20was\x20provided\x20in\x20BOTH\x20the\x20top\x20level\x20and\x20inside\x20\x27data\x27\x20—\x20provide\x20it\x20in\x20only\x20ONE\x20place\x20(top\x20level\x20OR\x20data),\x20not\x20both.'}],'structuredContent':{'result':{'status':'schema_mismatch','errors':['\x27submission\x27\x20provided\x20twice:\x20top\x20level\x20AND\x20inside\x20data.\x20Provide\x20it\x20in\x20only\x20ONE\x20place.'],'structured_errors':[{'path':'submission','code':'duplicate_field','message':'\x27submission\x27\x20provided\x20both\x20at\x20the\x20top\x20level\x20and\x20inside\x20data.','suggestion':'Keep\x20the\x20submission\x20in\x20exactly\x20one\x20place:\x20either\x20wowok({tool,\x20data,\x20submission})\x20or\x20wowok({tool,\x20data:\x20{operation_type,\x20data:\x20{...},\x20env,\x20submission}}).'}],'hint':'Move\x20\x27submission\x27\x20to\x20a\x20single\x20location\x20and\x20retry.'},'schema':null}};g['submission']=y['submission'],h['push']('merged\x20top-level\x20\x27submission\x27\x20into\x20data');}}let m=![];{const B=a,C=B['data']!==undefined||B['args']!==undefined||B['params']!==undefined,D=B['env'],E=B['confirmed'];if(C&&(D!==undefined||E!==undefined)){const F=g,G=TOOL_REGISTRY['find'](I=>I['name']===d),H=G!==undefined?zodUnionAwareKeyCheck(G['config']['inputSchema'],'env')['hasEnvSlot']:!![];if(H){const I=F['env']!==undefined&&typeof F['env']==='object'&&!Array['isArray'](F['env'])?{...F['env']}:{},J=D!==undefined&&typeof D==='object'&&!Array['isArray'](D)?D:{},K={...J,...I};E!==undefined&&K['confirmed']===undefined&&(K['confirmed']=E),Object['keys'](K)['length']>0x0&&(F['env']=K,m=!![],h['push']('merged\x20top-level\x20env/confirmed\x20into\x20data.env\x20(env\x20belongs\x20INSIDE\x20data)'));}else{const L=D!==undefined&&typeof D==='object'&&!Array['isArray'](D)?D:{},M=[];for(const [N,O]of Object['entries'](L)){if(N==='confirmed')continue;if(F[N]!==undefined)continue;if(zodBranchAwareDeclared(G['config']['inputSchema'],N,F)){F[N]=O,M['push'](N);continue;}N==='network'&&F['context_network']===undefined&&zodBranchAwareDeclared(G['config']['inputSchema'],'context_network',F)&&(F['context_network']=O,M['push']('context_network'));}E!==undefined&&F['confirmed']===undefined&&zodBranchAwareDeclared(G['config']['inputSchema'],'confirmed',F)&&(F['confirmed']=E,M['push']('confirmed')),M['length']>0x0&&h['push']('top-level\x20env\x20skipped\x20(this\x20sub-tool\x20has\x20no\x20env\x20slot);\x20routed\x20'+M['join'](',\x20')+'\x20to\x20plain\x20data\x20fields\x20(F-22)');}}}if(!d){const P=a&&typeof a==='object'&&!Array['isArray'](a)?Object['keys'](a)['join'](',\x20')||'(none)':'(non-object\x20input:\x20'+typeof a+')',Q=['Missing\x20\x27tool\x27\x20field.\x20Received\x20keys:\x20'+P,'Expected\x20one\x20of:\x20'+SUB_TOOL_NAMES['join'](',\x20')];return{'content':[{'type':'text','text':'Missing\x20\x27tool\x27\x20field.\x20Call\x20format:\x20wowok({\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{<params>}\x20}).\x20Received\x20keys:\x20'+P+'.\x20Available\x20sub-tools:\x20'+SUB_TOOL_NAMES['join'](',\x20')}],'structuredContent':{'result':{'status':'schema_mismatch','errors':Q,'hint':'Provide\x20\x27tool\x27\x20(one\x20of:\x20'+SUB_TOOL_NAMES['join'](',\x20')+')\x20and\x20\x27data\x27\x20(sub-tool\x20parameters).\x20Aliases\x20accepted:\x20tool_name/name→tool,\x20args/params→data.','received':truncateReceivedValue(a)},'schema':{'input':zodToJsonSchemaSafe(WowokToolDisplaySchema,'wowok'),'tool':'wowok'}}};}const n=TOOL_REGISTRY_MAP['get'](d);if(!n){const R=d['toLowerCase'](),S=R==='wowok',T=R['split']('_')['filter'](Boolean),U=S?[]:TOOL_REGISTRY['map'](X=>X['name'])['map'](X=>{const Y=X['toLowerCase']()['split']('_');let Z=0x0;if(Y[0x0]===T[0x0])Z+=0x2;Z+=Y['filter'](a0=>T['includes'](a0))['length'];if(Y['some'](a0=>a0['startsWith'](T[T['length']-0x1]??'')))Z+=0x1;return{'name':X,'score':Z};})['filter'](X=>X['score']>0x0)['sort']((X,Y)=>Y['score']-X['score'])['slice'](0x0,0x5)['map'](X=>X['name']),V=S?'\x20NOTE:\x20\x27wowok\x27\x20is\x20the\x20DISPATCHER\x20tool\x20itself,\x20not\x20a\x20sub-tool.\x20Call\x20format:\x20wowok({\x20tool:\x20\x22<sub-tool-name>\x22,\x20data:\x20{<params>}\x20}).':'',W=U['length']>0x0?'.\x20Did\x20you\x20mean:\x20'+U['join'](',\x20')+'?':'';return{'content':[{'type':'text','text':'Unknown\x20sub-tool:\x20\x27'+d+'\x27.\x20Available:\x20'+TOOL_REGISTRY['map'](X=>X['name'])['join'](',\x20')+V+W}],'structuredContent':{'result':{'status':'error','errors':['Unknown\x20sub-tool:\x20'+d],'hint':'Available\x20sub-tools:\x20'+TOOL_REGISTRY['map'](X=>X['name'])['join'](',\x20')+V+W,'suggestions':U},'schema':null}};}h['length']>0x0&&console['warn']('[wowok]\x20input\x20normalization\x20for\x20\x27'+d+'\x27:\x20'+h['join'](';\x20'));{const X=g,Y=X['env']&&typeof X['env']==='object'&&!Array['isArray'](X['env'])?X['env']:undefined;if(Y?.['confirmed']!==undefined&&X['confirmed']===undefined){const Z=zodUnionAwareKeyCheck(n['config']['inputSchema'],'confirmed');if(Z['declared']&&!Z['hasEnvSlot']){X['confirmed']=Y['confirmed'],delete Y['confirmed'];if(Object['keys'](Y)['length']===0x0)delete X['env'];h['push']('routed\x20rescued\x20top-level\x20confirmed\x20to\x20the\x20tool\x27s\x20own\x20confirmed\x20slot'),console['warn']('[wowok]\x20input\x20normalization\x20for\x20\x27'+d+'\x27:\x20confirmed\x20slot\x20re-routed\x20(F-10)');}}}const o=n['config']['inputSchema']['safeParse'](g),p=checkUnknownFields(n['config']['inputSchema'],g);if(!o['success']||p['length']>0x0){const a0=[];!o['success']&&a0['push'](...formatZodErrors(o['error'],g));p['length']>0x0&&a0['push']('Unknown\x20field(s):\x20'+p['join'](',\x20'));const a1=[];!o['success']&&a1['push'](...formatZodErrorsStructured(o['error'],g));if(p['length']>0x0)for(const af of p){a1['push']({'path':af,'code':'unrecognized_keys','message':'Unknown\x20field\x20\x27'+af+'\x27\x20is\x20not\x20allowed','suggestion':'Remove\x20field\x20\x27'+af+'\x27\x20or\x20check\x20the\x20schema\x20for\x20valid\x20field\x20names'});}if(m){const ag='A\x20top-level\x20env/confirmed\x20was\x20merged\x20into\x20data.env\x20automatically\x20(contra\x20F-01\x20rescue),\x20but\x20THIS\x20sub-tool\x20does\x20not\x20accept\x20env\x20in\x20data.\x20Operation\x20tools\x20(onchain_operations\x20etc.)\x20take\x20env\x20inside\x20data;\x20query\x20tools\x20take\x20plain\x20data\x20fields\x20(e.g.\x20network)\x20instead\x20—\x20drop\x20the\x20env\x20key\x20for\x20this\x20call.';a0['push'](ag),a1['push']({'path':'env','code':'unrecognized_keys','message':'env\x20rescued\x20from\x20the\x20top\x20level,\x20but\x20this\x20sub-tool\x27s\x20data\x20schema\x20has\x20no\x20env\x20slot','suggestion':ag});}const a2=g??undefined,a3=a2!==undefined&&typeof a2['operation_type']==='string'&&a2['data']===undefined,a4=a1['some'](ah=>String(ah['path'])==='data'&&ah['code']==='invalid_type'&&/received undefined/i['test'](ah['message']));let a5;if(a4&&a3)a5='SHAPE\x20FIX\x20(rndb58d8d\x2004-ROOTCAUSE-A\x20A1):\x20operation\x20parameters\x20must\x20be\x20nested\x20INSIDE\x20a\x20\x27data\x27\x20object.\x20'+'The\x20envelope\x20is\x20{\x20operation_type:\x20\x27...\x27,\x20data:\x20{\x20<the\x20operation\x27s\x20parameters>\x20},\x20env?:\x20{...},\x20submission?:\x20{...}\x20}\x20'+'—\x20your\x20call\x20put\x20the\x20parameters\x20at\x20the\x20SAME\x20level\x20as\x20operation_type\x20(or\x20omitted\x20them),\x20so\x20\x27data\x27\x20arrived\x20undefined.\x20'+'Resend\x20with\x20the\x20parameters\x20wrapped\x20in\x20data.\x20This\x20is\x20a\x20static\x20shape\x20error,\x20NOT\x20session\x20state\x20—\x20no\x20restart\x20is\x20needed\x20'+'(this\x20server\x20is\x20stateless).\x20Also\x20discard\x20any\x20schema\x20slice\x20you\x20cached\x20from\x20an\x20earlier\x20call\x20for\x20a\x20DIFFERENT\x20'+'operation_type\x20—\x20slices\x20are\x20union-variant\x20specific\x20and\x20reusing\x20one\x20across\x20variants\x20mangles\x20the\x20payload.',a0['push'](a5),a1['push']({'path':'data','code':'invalid_type','message':'parameters\x20must\x20be\x20nested\x20inside\x20data\x20(flat\x20envelope:\x20parameters\x20found\x20as\x20siblings\x20of\x20operation_type)','suggestion':a5});else a4&&(a5='DIAGNOSTIC:\x20\x27data\x27\x20arrived\x20at\x20validation\x20as\x20undefined.\x20Send\x20the\x20tool\x27s\x20parameters\x20inside\x20the\x20\x27data\x27\x20object\x20'+'(for\x20onchain_operations:\x20{\x20operation_type:\x20\x27...\x27,\x20data:\x20{\x20<parameters>\x20},\x20env?,\x20submission?\x20}).\x20If\x20you\x20are\x20CERTAIN\x20'+'your\x20client\x20transmitted\x20a\x20well-formed\x20payload,\x20inspect\x20what\x20the\x20wrapper\x20actually\x20sent\x20before\x20retrying\x20—\x20identical\x20'+'retries\x20cannot\x20recover\x20from\x20a\x20construction\x20error.\x20(C-11\x27s\x20old\x20\x27wrapper\x20state\x20corruption\x20/\x20restart\x20the\x20session\x27\x20'+'conclusion\x20was\x20retired\x20by\x20rndb58d8d\x2004-ROOTCAUSE-A:\x20a\x20stateless\x20server\x20cannot\x20diagnose\x20caller-side\x20runtime\x20state.)',a0['push'](a5),a1['push']({'path':'data','code':'invalid_type','message':'data\x20is\x20required\x20—\x20the\x20tool\x27s\x20parameters\x20belong\x20inside\x20the\x20data\x20object','suggestion':a5}));const a6=loadPreGeneratedSchema(d)??zodToJsonSchemaSafe(n['config']['inputSchema'],d),a7=extractRelevantSchema(a6,d,g),a8=capSchemaDepth(compactMismatchSchemaInput(a7,g),0x0),a9=matchedVariantLegalKeys(a8)['filter'](ah=>ah!=='env');if(a9['length']>0x0){const ah='Legal\x20keys\x20for\x20this\x20input:\x20'+a9['join'](',\x20')+'.';for(const ai of a1){ai['code']==='unrecognized_keys'&&!String(ai['suggestion'])['includes']('Legal\x20keys')&&(ai['suggestion']=ai['suggestion']+'\x20'+ah);}for(let aj=0x0;aj<a0['length'];aj++){/^(Unknown field\(s\):|.*(Unrecognized key|unexpected key))/i['test'](a0[aj])&&!a0[aj]['includes']('Legal\x20keys')&&(a0[aj]=a0[aj]+'\x20'+ah);}}capMismatchErrors(a0,a1);const aa=a1[0x0]?.['suggestion']?'\x20FIRST\x20ERROR\x20SUGGESTION:\x20'+a1[0x0]['suggestion']:'',ab=a0['slice'](0x0,0x5)['map']((ak,al)=>'\x20\x20'+(al+0x1)+'.\x20'+ak)['join']('\x0a'),ac=buildSchemaPreview(a7,d,g),ad=l?'Full\x20JSON\x20Schema\x20is\x20in\x20the\x20structuredContent.schema.input\x20field\x20(cache\x20it\x20ONLY\x20for\x20future\x20'+d+'\x20calls\x20with\x20the\x20SAME\x20operation_type/variant\x20—\x20slices\x20are\x20branch-specific;\x20a\x20different\x20operation_type\x20needs\x20a\x20fresh\x20schema).':'Full\x20JSON\x20Schema\x20was\x20omitted\x20(compact\x20default):\x20re-send\x20with\x20want_schema:true\x20to\x20receive\x20it\x20in\x20structuredContent.schema.input,\x20or\x20use\x20schema_query\x20(action=\x27get\x27)\x20for\x20a\x20specific\x20sub-schema.',ae=['Schema\x20mismatch\x20for\x20'+d+'.\x20'+a0['length']+'\x20error(s).'+aa,ab,...a5?['','⚠\x20'+a5]:[],'',ac,'','Fix\x20the\x20parameters\x20based\x20on\x20the\x20errors\x20above\x20and\x20the\x20schema\x20summary,\x20then\x20retry.',ad,'Structured\x20errors\x20with\x20fix\x20suggestions\x20are\x20in\x20structuredContent.result.structured_errors\x20(ARCH-02).',SKILLS_MISMATCH_POINTER]['filter'](Boolean)['join']('\x0a');return{'content':[{'type':'text','text':ae}],'structuredContent':{'result':{'status':'schema_mismatch','errors':a0,'structured_errors':a1,'hint':schemaMismatchHint(d)},...l?{'schema':{'input':a8,'tool':d}}:{'schema':null}}};}try{j!==undefined&&(g['harness_override_note']=j);const ak=await dispatchToolCall(d,g,b,c);if(ak['resultType']==='input_required')return ak;const al=ak['structuredContent'],am=al?.['result'],an=am?.['status']==='error'||am?.['status']==='schema_mismatch'||am?.['operation']==='error'||am?.['type']==='error';if(an){const as={'status':'error','data':ak['structuredContent'],'errors':[ak['content'][0x0]?.['text']??'Sub-tool\x20returned\x20an\x20error']};if(typeof am?.['error_code']==='string')as['error_code']=am['error_code'];if(typeof am?.['retryable']==='boolean')as['retryable']=am['retryable'];if(typeof am?.['recovery_hint']==='string')as['recovery_hint']=am['recovery_hint'];if(am?.['refused']===!![])as['refused']=!![];if(am?.['tx_submitted']===![])as['tx_submitted']=![];return{'content':ak['content'],'structuredContent':{'result':as,'schema':null}};}const ao=typeof al?.['outcome']==='string'?al['outcome']:undefined,ap=al?.['verdict'],aq=ap!==undefined&&typeof ap==='object'&&ap['buildable']===![],ar=aq?'error':ao===undefined||ao==='executed'?'success':ao==='failed'?'error':'pending';return{'content':ak['content'],'structuredContent':{'result':{'status':ar,...ao!==undefined?{'outcome':ao}:{},...aq?{'errors':['Plan\x20audit\x20BLOCKED\x20(verdict.buildable=false)\x20—\x20see\x20data.verdict.blockers\x20and\x20data.next_action.\x20Do\x20NOT\x20materialize\x20this\x20plan.']}:{},'data':ak['structuredContent']},'schema':null}};}catch(at){const au=normalizeErrorMessage(at);if(isSchemaValidationError(au)){const ay=loadPreGeneratedSchema(d)??zodToJsonSchemaSafe(n['config']['inputSchema'],d),az=extractRelevantSchema(ay,d,g),aA=buildSchemaPreview(az,d,g),aB=[{'path':'(runtime)','code':'schema_validation_error','message':au,'suggestion':'Check\x20the\x20error\x20message\x20and\x20the\x20schema\x20below\x20for\x20the\x20correct\x20field\x20format'}],aC=['Schema\x20mismatch\x20for\x20'+d+':\x20'+au,'',aA,'','Fix\x20the\x20parameters\x20and\x20retry.',l?'Full\x20JSON\x20Schema\x20is\x20in\x20structuredContent.schema.input.':'Full\x20JSON\x20Schema\x20was\x20omitted\x20(compact\x20default):\x20re-send\x20with\x20want_schema:true\x20to\x20receive\x20it\x20in\x20structuredContent.schema.input.','Structured\x20errors\x20with\x20fix\x20suggestions\x20are\x20in\x20structuredContent.result.structured_errors\x20(ARCH-02).',SKILLS_MISMATCH_POINTER]['join']('\x0a');return{'content':[{'type':'text','text':aC}],'structuredContent':{'result':{'status':'schema_mismatch','errors':[au],'structured_errors':aB,'hint':schemaMismatchHint(d)},...l?{'schema':{'input':compactMismatchSchemaInput(az,g),'tool':d}}:{'schema':null}}};}const av=/Unexpected token.*?\((\d+):(\d+)\)/['exec'](au)??(/^(Unexpected end of JSON input|JSON\.parse)/['test'](au)?[au,'','']:null);if(av){const aD=av[0x1]?Number(av[0x1]):undefined,aE=av[0x2]?Number(av[0x2]):undefined,aF=aD!==undefined?'\x20at\x20line\x20'+aD+',\x20column\x20'+aE:'',aG=loadPreGeneratedSchema(d)??zodToJsonSchemaSafe(n['config']['inputSchema'],d),aH=extractRelevantSchema(aG,d,g),aI=[{'path':'(root)','code':'malformed_json','message':'A\x20JSON\x20string\x20in\x20the\x20arguments\x20could\x20not\x20be\x20parsed'+aF+':\x20'+au+'.\x20'+'Any\x20argument\x20passed\x20as\x20a\x20STRING\x20must\x20itself\x20be\x20valid\x20JSON.','suggestion':'Send\x20objects/arrays\x20as\x20real\x20JSON\x20values,\x20not\x20as\x20stringified\x20JSON.\x20'+'If\x20a\x20string\x20field\x20is\x20genuinely\x20textual\x20(description,\x20message,\x20remark),\x20it\x20must\x20NOT\x20be\x20quoted-and-escaped\x20JSON.\x20'+'If\x20the\x20argument\x20shape\x20is\x20confirmed\x20valid,\x20the\x20payload\x20may\x20have\x20been\x20TRUNCATED\x20before\x20parsing\x20—\x20arguments\x20past\x20a\x20'+'transport\x20size\x20limit\x20fail\x20with\x20this\x20same\x20envelope;\x20shrink\x20the\x20payload\x20(fewer\x20or\x20smaller\x20items)\x20and\x20retry.'}];return{'content':[{'type':'text','text':['Malformed\x20JSON\x20in\x20the\x20arguments\x20to\x20'+d+aF+':\x20'+au,'',buildSchemaPreview(aH,d,g),'','Fix\x20the\x20parameters\x20and\x20retry.',l?'Full\x20JSON\x20Schema\x20is\x20in\x20structuredContent.schema.input.':'Full\x20JSON\x20Schema\x20was\x20omitted\x20(compact\x20default):\x20re-send\x20with\x20want_schema:true\x20to\x20receive\x20it\x20in\x20structuredContent.schema.input.']['join']('\x0a')}],'structuredContent':{'result':{'status':'schema_mismatch','errors':[au],'structured_errors':aI,'hint':schemaMismatchHint(d)},...l?{'schema':{'input':compactMismatchSchemaInput(aH,g),'tool':d}}:{'schema':null}}};}const aw=classifyError(au),ax={'status':'error','errors':[au]};if(aw['error_code']!==undefined)ax['error_code']=aw['error_code'];if(aw['retryable']!==undefined)ax['retryable']=aw['retryable'];if(aw['recovery_hint']!==undefined)ax['recovery_hint']=aw['recovery_hint'];return Object['assign'](ax,catalogFieldsFor(aw,au)??{}),{'content':[{'type':'text','text':'Error:\x20'+au}],'structuredContent':{'result':ax,'schema':null}};}}function zodToJsonSchemaSafe(a,b){try{const c=z['toJSONSchema'](a,{'unrepresentable':'any','target':'draft-07'});if(c&&typeof c==='object'&&!Array['isArray'](c)){const {$schema:d,...e}=c;return e;}return{'type':'object'};}catch{return{'type':'object','additionalProperties':!![]};}}function resolveSchemaRefs(a){const b=new Set(['definitions','$schema','$id']);function c(e){if(!e['startsWith']('#/'))return null;const f=e['slice'](0x2)['split']('/');let g=a;for(const h of f){if(g==null||typeof g!=='object')return null;g=g[h];}return g;}function d(e,f){if(!e||typeof e!=='object')return e;if(Array['isArray'](e))return e['map'](i=>d(i,f));const g=e;if(typeof g['$ref']==='string'){const i=g['$ref'];if(f['has'](i))return{'type':'object','additionalProperties':!![]};const j=c(i);if(j&&typeof j==='object'&&!Array['isArray'](j)){const l=new Set(f);l['add'](i);const m=d(j,l),n={};for(const [o,p]of Object['entries'](g)){if(o!=='$ref'&&!b['has'](o))n[o]=p;}return{...m,...n};}return{'type':'object','additionalProperties':!![]};}const h={};for(const [q,r]of Object['entries'](g)){if(b['has'](q))continue;h[q]=d(r,f);}return h;}return d(a,new Set());}function loadPreGeneratedSchema(a){const b=preGeneratedSchemaCache['get'](a);if(b)return b;for(const c of SCHEMA_DIR_CANDIDATES){try{const d=join(c,a+'.schema.json'),e=readFileSync(d,'utf-8'),f=JSON['parse'](e),g=resolveSchemaRefs(f);return preGeneratedSchemaCache['set'](a,g),g;}catch{}}return null;}export function listTools(){return[{'name':'wowok','title':'WoWok\x20MCP','description':WOWOK_TOOL_DESCRIPTION,'inputSchema':resolveSchemaRefs(zodToJsonSchemaSafe(WowokToolDisplaySchema,'wowok'))}];}let startupUpgradeNoticeAttached=![],startupNoticePromise=null,upgradeEnforcementDecided=![];function startupNotice(){return startupNoticePromise??=getStartupUpgradeNotice(),startupNoticePromise;}async function upgradeRequiredResult(){if(upgradeEnforcementDecided)return null;let a=null;try{a=await startupNotice();}catch{a=null;}if(!a)return null;upgradeEnforcementDecided=!![];if(!a['enforced'])return null;const b='WoWok\x20upgrade\x20REQUIRED\x20—\x20tool\x20calls\x20are\x20blocked\x20until\x20the\x20local\x20package\x20is\x20current.\x0a'+(a['message']+'\x0a')+('To\x20stay\x20on\x20the\x20current\x20version\x20anyway,\x20write\x20{\x22enforce\x22:\x20false}\x20to\x20'+upgradePolicyPath()+'\x20and\x20restart.');return{'content':[{'type':'text','text':b}],'structuredContent':{'result':{'status':'error','error_code':'UPGRADE_REQUIRED','retryable':![],'recovery_hint':b,'data':{'upgrade_notice':a}},'schema':null}};}async function attachStartupUpgradeNotice(a){if(startupUpgradeNoticeAttached)return a;try{const b=await startupNotice();if(!b)return a;startupUpgradeNoticeAttached=!![];if(b['enforced'])return a;const c={...a};return Array['isArray'](a['content'])&&(c['content']=[...a['content'],{'type':'text','text':'\x0a⚠\x20'+b['message']+'\x0a'+'Surface\x20this\x20upgrade\x20notice\x20to\x20the\x20user\x20once\x20in\x20this\x20conversation\x20(do\x20not\x20wait\x20for\x20them\x20to\x20ask).'}]),a['structuredContent']&&typeof a['structuredContent']==='object'&&(c['structuredContent']={...a['structuredContent'],'upgrade_notice':b}),c;}catch{return startupUpgradeNoticeAttached=!![],a;}}export function registerAllTools(a){const b=0x2bf20,c=async(e,f)=>handleWowok(e,undefined,f),d=wrapHandlerWithErrorShape(c,b,'wowok',undefined);a['registerTool']('wowok',{'title':'WoWok\x20MCP','description':WOWOK_TOOL_DESCRIPTION,'inputSchema':WowokToolRuntimeSchema,'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':!![]}},async(e,f)=>{const g=await upgradeRequiredResult();if(g)return g;return attachStartupUpgradeNotice(sanitizeToolDispatchResult(await d(e,f?.['mcpReq']?.['inputResponses']?{'inputResponses':f['mcpReq']['inputResponses']}:undefined)));}),overrideToolsListHandler(a);}function overrideToolsListHandler(a){a['server']['setRequestHandler']('tools/list',()=>({'tools':[{'name':'wowok','title':'WoWok\x20MCP','description':WOWOK_TOOL_DESCRIPTION,'inputSchema':ensureObjectType(zodToJsonSchemaSafe(WowokToolDisplaySchema,'wowok')),'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':!![]}}]}));}function ensureObjectType(a){if(a['type']==='object')return a;return{...a,'type':'object'};}
|