@wowok/agent-mcp 2.4.1 → 2.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.
Files changed (74) hide show
  1. package/dist/index.d.ts +2 -2
  2. package/dist/index.js +11 -1624
  3. package/dist/knowledge/guard-ledger.js +14 -0
  4. package/dist/knowledge/guard-lint.d.ts +1 -0
  5. package/dist/knowledge/guard-lint.js +83 -3
  6. package/dist/knowledge/guard-migration.d.ts +48 -0
  7. package/dist/knowledge/guard-migration.js +228 -0
  8. package/dist/knowledge/guard-risk.d.ts +2 -0
  9. package/dist/knowledge/guard-risk.js +827 -57
  10. package/dist/knowledge/guard-templates.d.ts +1 -0
  11. package/dist/knowledge/guard-templates.js +278 -2
  12. package/dist/project/graph.d.ts +1 -0
  13. package/dist/project/graph.js +27 -1
  14. package/dist/project/index.d.ts +1 -0
  15. package/dist/project/index.js +39 -2
  16. package/dist/project/namespace.d.ts +11 -1
  17. package/dist/project/namespace.js +27 -2
  18. package/dist/project/query.d.ts +2 -0
  19. package/dist/project/query.js +56 -15
  20. package/dist/rules.d.ts +12 -0
  21. package/dist/rules.js +9 -0
  22. package/dist/schema/call/allocation.d.ts +10 -10
  23. package/dist/schema/call/base.js +3 -3
  24. package/dist/schema/call/machine.d.ts +38 -38
  25. package/dist/schema/call/semantic.js +1 -1
  26. package/dist/schema/call/service.d.ts +7 -7
  27. package/dist/schema/operations.d.ts +48 -48
  28. package/dist/schema/query/index.d.ts +146 -146
  29. package/dist/schema/query/index.js +15 -9
  30. package/dist/schema/utils/guard-query-utils.d.ts +7 -0
  31. package/dist/schema/utils/guard-query-utils.js +14 -1
  32. package/dist/schemas/bridge_operation.output.json +1 -1
  33. package/dist/schemas/index.json +1 -1
  34. package/dist/schemas/messenger_operation.output.json +1 -1
  35. package/dist/schemas/onchain_events.output.json +1 -1
  36. package/dist/schemas/onchain_operations.output.json +2 -2
  37. package/dist/schemas/onchain_operations.schema.json +11 -20
  38. package/dist/schemas/onchain_operations_allocation.schema.json +7 -10
  39. package/dist/schemas/onchain_operations_machine.schema.json +2 -5
  40. package/dist/schemas/onchain_operations_service.schema.json +2 -5
  41. package/dist/schemas/onchain_table_data.output.json +6 -12
  42. package/dist/tools/handlers/bridge.d.ts +1 -0
  43. package/dist/tools/handlers/bridge.js +1 -0
  44. package/dist/tools/handlers/config.d.ts +2 -0
  45. package/dist/tools/handlers/config.js +71 -0
  46. package/dist/tools/handlers/file-export.d.ts +3 -0
  47. package/dist/tools/handlers/file-export.js +90 -0
  48. package/dist/tools/handlers/local.d.ts +30 -0
  49. package/dist/tools/handlers/local.js +27 -0
  50. package/dist/tools/handlers/messenger.d.ts +16 -0
  51. package/dist/tools/handlers/messenger.js +187 -0
  52. package/dist/tools/handlers/onchain.d.ts +2 -0
  53. package/dist/tools/handlers/onchain.js +246 -0
  54. package/dist/tools/handlers/project.d.ts +2 -0
  55. package/dist/tools/handlers/project.js +53 -0
  56. package/dist/tools/handlers/query.d.ts +5 -0
  57. package/dist/tools/handlers/query.js +256 -0
  58. package/dist/tools/handlers/schema-query.d.ts +2 -0
  59. package/dist/tools/handlers/schema-query.js +92 -0
  60. package/dist/tools/handlers/trust.d.ts +2 -0
  61. package/dist/tools/handlers/trust.js +194 -0
  62. package/dist/tools/handlers/wip.d.ts +2 -0
  63. package/dist/tools/handlers/wip.js +44 -0
  64. package/dist/tools/index.d.ts +13 -0
  65. package/dist/tools/index.js +479 -0
  66. package/dist/tools/rules-hook.d.ts +2 -0
  67. package/dist/tools/rules-hook.js +22 -0
  68. package/dist/tools/shared.d.ts +29 -0
  69. package/dist/tools/shared.js +130 -0
  70. package/dist/tools/types.d.ts +35 -0
  71. package/dist/tools/types.js +1 -0
  72. package/dist/tools/wrap.d.ts +6 -0
  73. package/dist/tools/wrap.js +55 -0
  74. package/package.json +19 -5
@@ -3,7 +3,7 @@ import { TokenTypeInfoSchema, QueryLocalMarkListResultSchema, QueryAccountListRe
3
3
  import { AccountOrMark_AddressSchema, BalanceTypeSchema, CacheExpireTypeSchema, EntrypointSchema, GuardIdentifierSchema, GuardTableItemSchema, NameOrAddressSchema, ObjectBaseSchema, ObjectTypeSchema, QueryIdSchema, SupportedValueSchema, ValueTypeSchema, QueryReceivedResultSchema, LongNameSchema, DescriptionSchema } from "../common/index.js";
4
4
  import { SemanticSummarySchema } from "../call/index.js";
5
5
  import { isValidPermissionIndex } from '../utils/permission-index-utils.js';
6
- import { isValidGuardQueryId, isValidGuardQueryIdOrName } from '../utils/guard-query-utils.js';
6
+ import { isValidGuardQueryId, isValidGuardQueryIdOrName, isValidWitnessType } from '../utils/guard-query-utils.js';
7
7
  import { ENTITY_LINKER_ADDRESS, ENTITY_REGISTRAR_ADDRESS, isWitnessType, } from "@wowok/wowok";
8
8
  import { DiscountType as WDiscountType } from "@wowok/wowok";
9
9
  import { QueryEnvSchema } from "../common/index.js";
@@ -144,7 +144,7 @@ export const ProgressSessionSchema = z.object({
144
144
  next_node: z.string().describe("Next node ID"),
145
145
  forwards: z.array(ProgressSessionHolderSchema).describe("Operation list in Progress session"),
146
146
  weights: tolerantNumber.describe("Total operation weight"),
147
- threshold: tolerantNumber.describe("Operation threshold. When total operation weight exceeds threshold, session is considered completed and Progress moves from current node to next node."),
147
+ threshold: tolerantNumber.default(0).describe("Operation threshold. When total operation weight exceeds threshold, session is considered completed and Progress moves from current node to next node."),
148
148
  }).describe("Progress session");
149
149
  export const ObjectProgressSchema = ObjectBaseSchema.extend({
150
150
  machine: z.string().describe("Machine ID that Progress object belongs to"),
@@ -196,7 +196,7 @@ export const AllocatorSchema = z.object({
196
196
  }).describe("Fund allocator");
197
197
  export const AllocatorsSchema = z.object({
198
198
  description: DescriptionSchema.describe("Description of fund allocator list"),
199
- threshold: BalanceTypeSchema.describe("Threshold. If defined, fund allocation will be triggered when amount in Allocation object reaches this threshold."),
199
+ threshold: BalanceTypeSchema.default(0).describe("Threshold. If defined, fund allocation will be triggered when amount in Allocation object reaches this threshold."),
200
200
  allocators: z.array(AllocatorSchema).describe("Fund allocator list. Each fund allocator represents a fund allocation strategy."),
201
201
  }).describe("Fund allocator list");
202
202
  export const ObjectServiceSchema = ObjectBaseSchema.extend({
@@ -402,11 +402,17 @@ export const ObjectPermissionSchema = ObjectBaseSchema.extend({
402
402
  })).describe("Permission item remark list"),
403
403
  um: z.union([z.string(), z.null()]).describe("Contact object"),
404
404
  }).describe("Permission object");
405
- export const WitnessTypeSchema = z.number()
406
- .int()
407
- .refine(isWitnessType, {
408
- message: 'Invalid WitnessType value',
409
- }).describe("When specified, the query retrieves data from the associated (witness) object instead of the queried object itself. This enables cross-object queries within Guard validation logic. Available WitnessTypes and their use cases:\n\n- TypeOrderProgress (100): Query an Order's associated Progress object. Use case: Check if order has reached a specific workflow node (e.g., 'complete') before allowing reward claims.\n- TypeOrderMachine (101): Query an Order's associated Machine (workflow definition). Use case: Verify the workflow structure or check node configurations.\n- TypeOrderService (102): Query an Order's parent Service object. Use case: Validate the service offering details or check service-level configurations.\n- TypeProgressMachine (103): Query a Progress's associated Machine. Use case: Access workflow definition from a Progress context.\n- TypeArbOrder (104): Query an Arb's associated Order. Use case: In arbitration voting guards, verify order details like payment amount or service ID.\n- TypeArbArbitration (105): Query an Arb's parent Arbitration service. Use case: Access arbitration configuration or fee settings from within an Arb case.\n- TypeArbProgress (106): Query an Arb's associated Progress. Use case: Check order workflow state during arbitration validation.\n- TypeArbMachine (107): Query an Arb's associated Machine. Use case: Access workflow definition for dispute context analysis.\n- TypeArbService (108): Query an Arb's associated Service. Use case: Verify service terms or compensation fund status during arbitration.\n\nExample: To validate that an order has reached the 'complete' node, query the Order with convert_witness=TypeOrderProgress and check the Progress's current_node field.");
405
+ export const WitnessTypeSchema = z.union([
406
+ z.number()
407
+ .int()
408
+ .refine(isWitnessType, {
409
+ message: 'Invalid WitnessType numeric value. Valid range: 100-108.',
410
+ }),
411
+ z.string()
412
+ .refine((name) => isValidWitnessType(name), {
413
+ message: 'Invalid WitnessType string name. Valid names: OrderProgress (100), OrderMachine (101), OrderService (102), ProgressMachine (103), ArbOrder (104), ArbArbitration (105), ArbProgress (106), ArbMachine (107), ArbService (108). Case-insensitive; "Type" prefix is optional.',
414
+ })
415
+ ]).describe("When specified, the query retrieves data from the associated (witness) object instead of the queried object itself. This enables cross-object queries within Guard validation logic. Can be a numeric ID (100-108) or a string name (case-insensitive, with or without the 'Type' prefix). String format is recommended for readability.\n\nAvailable WitnessTypes:\n- OrderProgress / TypeOrderProgress (100): Query an Order's associated Progress object. Use case: Check if order has reached a specific workflow node (e.g., 'complete') before allowing reward claims.\n- OrderMachine / TypeOrderMachine (101): Query an Order's associated Machine (workflow definition). Use case: Verify the workflow structure or check node configurations.\n- OrderService / TypeOrderService (102): Query an Order's parent Service object. Use case: Validate the service offering details or check service-level configurations.\n- ProgressMachine / TypeProgressMachine (103): Query a Progress's associated Machine. Use case: Access workflow definition from a Progress context.\n- ArbOrder / TypeArbOrder (104): Query an Arb's associated Order. Use case: In arbitration voting guards, verify order details like payment amount or service ID.\n- ArbArbitration / TypeArbArbitration (105): Query an Arb's parent Arbitration service. Use case: Access arbitration configuration or fee settings from within an Arb case.\n- ArbProgress / TypeArbProgress (106): Query an Arb's associated Progress. Use case: Check order workflow state during arbitration validation.\n- ArbMachine / TypeArbMachine (107): Query an Arb's associated Machine. Use case: Access workflow definition for dispute context analysis.\n- ArbService / TypeArbService (108): Query an Arb's associated Service. Use case: Verify service terms or compensation fund status during arbitration.\n\nExample: To validate that an order has reached the 'complete' node, query the Order with convert_witness='OrderProgress' and check the Progress's current_node field.");
410
416
  export const GuardQueryIdSchema = z.number().int().min(0).refine((id) => isValidGuardQueryId(id), { message: "Invalid guard query ID. ID not found in GUARDQUERY array." }).describe("ID of the data query instruction for the Object.");
411
417
  export const GuardNodeSchema = z.lazy(() => z.discriminatedUnion('type', [
412
418
  z.object({
@@ -848,7 +854,7 @@ export const MachineForwardSchema = z.object({
848
854
  }).strict().describe("Forward in Machine object");
849
855
  export const MachineNodePairSchema = z.object({
850
856
  prev_node: z.string().describe("Previous node name"),
851
- threshold: tolerantNumber.describe("Threshold to trigger node advancement. If total Forward weight is greater than or equal to threshold, node advancement is triggered."),
857
+ threshold: tolerantNumber.default(0).describe("Threshold to trigger node advancement. If total Forward weight is greater than or equal to threshold, node advancement is triggered."),
852
858
  forwards: z.array(MachineForwardSchema).describe("Forward list"),
853
859
  }).strict().describe("Node pair in Machine object");
854
860
  export const MachineNodeSchema = z.object({
@@ -1,3 +1,4 @@
1
+ import { WitnessType } from "@wowok/wowok";
1
2
  export declare const isValidGuardQueryId: (id: number) => boolean;
2
3
  export declare const isValidGuardQueryName: (name: string) => boolean;
3
4
  export declare const isValidGuardQueryIdOrName: (input: number | string) => boolean;
@@ -9,3 +10,9 @@ export declare const BOOL_RETURNING_QUERIES: {
9
10
  name: string;
10
11
  description: string;
11
12
  }[];
13
+ export declare const isValidWitnessType: (input: number | string) => boolean;
14
+ export declare const WITNESS_TYPE_ENTRIES: {
15
+ id: WitnessType;
16
+ name: string;
17
+ fullName: string;
18
+ }[];
@@ -1,4 +1,4 @@
1
- import { GUARDQUERY, ValueType } from "@wowok/wowok";
1
+ import { GUARDQUERY, ValueType, WitnessType, isValidWitnessTypeInput, witnessTypeToString } from "@wowok/wowok";
2
2
  const validGuardQueryIds = new Set(GUARDQUERY.map(item => item.id));
3
3
  const validGuardQueryNames = new Set(GUARDQUERY.map(item => item.name.toLowerCase()));
4
4
  const boolReturningQueryIds = new Set(GUARDQUERY.filter(item => item.return === ValueType.Bool).map(item => item.id));
@@ -31,3 +31,16 @@ export const isBoolReturningQuery = (input) => {
31
31
  export const BOOL_RETURNING_QUERIES = GUARDQUERY
32
32
  .filter(item => item.return === ValueType.Bool)
33
33
  .map(item => ({ id: item.id, name: item.name, description: item.description }));
34
+ export const isValidWitnessType = (input) => {
35
+ return isValidWitnessTypeInput(input);
36
+ };
37
+ export const WITNESS_TYPE_ENTRIES = Object.keys(WitnessType)
38
+ .filter(k => isNaN(Number(k)))
39
+ .map(k => {
40
+ const enumValue = WitnessType[k];
41
+ return {
42
+ id: enumValue,
43
+ name: witnessTypeToString(enumValue),
44
+ fullName: k,
45
+ };
46
+ });
@@ -655,7 +655,7 @@
655
655
  },
656
656
  "name": {
657
657
  "type": "string",
658
- "description": "Query instruction name. Example: 'progress.current_node_name'"
658
+ "description": "Query instruction name. Example: 'progress.current'"
659
659
  },
660
660
  "objectType": {
661
661
  "type": "string",
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "title": "WoWok MCP Schema Index",
4
4
  "description": "Index of all available JSON schemas for WoWok MCP tools",
5
- "generatedAt": "2026-07-17T00:22:14.123Z",
5
+ "generatedAt": "2026-07-18T11:29:05.935Z",
6
6
  "tools": [
7
7
  {
8
8
  "name": "onchain_operations",
@@ -1690,7 +1690,7 @@
1690
1690
  },
1691
1691
  "name": {
1692
1692
  "type": "string",
1693
- "description": "Query instruction name. Example: 'progress.current_node_name'"
1693
+ "description": "Query instruction name. Example: 'progress.current'"
1694
1694
  },
1695
1695
  "objectType": {
1696
1696
  "type": "string",
@@ -1081,7 +1081,7 @@
1081
1081
  },
1082
1082
  "name": {
1083
1083
  "type": "string",
1084
- "description": "Query instruction name. Example: 'progress.current_node_name'"
1084
+ "description": "Query instruction name. Example: 'progress.current'"
1085
1085
  },
1086
1086
  "objectType": {
1087
1087
  "type": "string",
@@ -2475,7 +2475,7 @@
2475
2475
  },
2476
2476
  "name": {
2477
2477
  "type": "string",
2478
- "description": "Query instruction name. Example: 'progress.current_node_name'"
2478
+ "description": "Query instruction name. Example: 'progress.current'"
2479
2479
  },
2480
2480
  "objectType": {
2481
2481
  "type": "string",
@@ -2812,7 +2812,7 @@
2812
2812
  "result"
2813
2813
  ],
2814
2814
  "additionalProperties": false,
2815
- "description": "Unified MCP tool output. result.type discriminates 5 outcomes: 'transaction' (raw Sui response), 'submission' (needs Guard data), 'error' (failed with error_code), 'data' (query result), 'null' (no-op). When semantic is present, prefer it over raw result parsing. When harness_report is present, check verify.status first and follow recovery.strategy if status is 'fail'."
2815
+ "description": "Unified MCP tool output. result.type discriminates 5 outcomes: 'transaction' (raw Wow response), 'submission' (needs Guard data), 'error' (failed with error_code), 'data' (query result), 'null' (no-op). When semantic is present, prefer it over raw result parsing. When harness_report is present, check verify.status first and follow recovery.strategy if status is 'fail'."
2816
2816
  }
2817
2817
  }
2818
2818
  }
@@ -1676,10 +1676,8 @@
1676
1676
  "description": "Description of fund allocator list"
1677
1677
  },
1678
1678
  "threshold": {
1679
- "type": [
1680
- "number",
1681
- "string"
1682
- ],
1679
+ "$ref": "#/definitions/data_service/properties/order_new/properties/buy/properties/total_pay/anyOf/0/properties/balance",
1680
+ "default": 0,
1683
1681
  "description": "Threshold. If defined, fund allocation will be triggered when amount in Allocation object reaches this threshold."
1684
1682
  },
1685
1683
  "allocators": {
@@ -1799,7 +1797,6 @@
1799
1797
  },
1800
1798
  "required": [
1801
1799
  "description",
1802
- "threshold",
1803
1800
  "allocators"
1804
1801
  ],
1805
1802
  "additionalProperties": false,
@@ -2226,6 +2223,7 @@
2226
2223
  "number",
2227
2224
  "string"
2228
2225
  ],
2226
+ "default": 0,
2229
2227
  "description": "Threshold to trigger node advancement. If total Forward weight is greater than or equal to threshold, node advancement is triggered."
2230
2228
  },
2231
2229
  "forwards": {
@@ -2289,10 +2287,7 @@
2289
2287
  {
2290
2288
  "type": "array",
2291
2289
  "items": {
2292
- "type": [
2293
- "number",
2294
- "string"
2295
- ]
2290
+ "$ref": "#/definitions/data_machine/properties/node/anyOf/0/anyOf/0/properties/nodes/items/properties/pairs/items/properties/threshold"
2296
2291
  }
2297
2292
  },
2298
2293
  {
@@ -2327,7 +2322,6 @@
2327
2322
  },
2328
2323
  "required": [
2329
2324
  "prev_node",
2330
- "threshold",
2331
2325
  "forwards"
2332
2326
  ],
2333
2327
  "additionalProperties": false,
@@ -5804,7 +5798,8 @@
5804
5798
  "number",
5805
5799
  "string"
5806
5800
  ],
5807
- "description": "Threshold. If defined, fund allocation will be triggered when amount in Allocation object reaches this threshold."
5801
+ "description": "Threshold. If defined, fund allocation will be triggered when amount in Allocation object reaches this threshold.",
5802
+ "default": 0
5808
5803
  },
5809
5804
  "allocators": {
5810
5805
  "type": "array",
@@ -5908,16 +5903,13 @@
5908
5903
  "description": "Fund allocation item list. Each item represents a recipient and their corresponding reward allocation value."
5909
5904
  },
5910
5905
  "fix": {
5911
- "type": [
5912
- "number",
5913
- "string"
5914
- ],
5906
+ "$ref": "#/definitions/data_allocation/anyOf/0/properties/allocators/properties/threshold",
5915
5907
  "description": "Fixed allocation amount. If specified, all recipients will receive the fixed allocation amount."
5916
5908
  },
5917
5909
  "max": {
5918
5910
  "anyOf": [
5919
5911
  {
5920
- "$ref": "#/definitions/data_allocation/anyOf/0/properties/allocators/properties/allocators/items/properties/fix"
5912
+ "$ref": "#/definitions/data_allocation/anyOf/0/properties/allocators/properties/threshold"
5921
5913
  },
5922
5914
  {
5923
5915
  "type": "null"
@@ -5938,7 +5930,6 @@
5938
5930
  },
5939
5931
  "required": [
5940
5932
  "description",
5941
- "threshold",
5942
5933
  "allocators"
5943
5934
  ],
5944
5935
  "additionalProperties": false,
@@ -5950,7 +5941,7 @@
5950
5941
  "type": "object",
5951
5942
  "properties": {
5952
5943
  "balance": {
5953
- "$ref": "#/definitions/data_allocation/anyOf/0/properties/allocators/properties/allocators/items/properties/fix"
5944
+ "$ref": "#/definitions/data_allocation/anyOf/0/properties/allocators/properties/threshold"
5954
5945
  }
5955
5946
  },
5956
5947
  "required": [
@@ -6034,7 +6025,7 @@
6034
6025
  "type": "object",
6035
6026
  "properties": {
6036
6027
  "balance": {
6037
- "$ref": "#/definitions/data_allocation/anyOf/0/properties/allocators/properties/allocators/items/properties/fix"
6028
+ "$ref": "#/definitions/data_allocation/anyOf/0/properties/allocators/properties/threshold"
6038
6029
  },
6039
6030
  "token_type": {
6040
6031
  "type": "string",
@@ -6050,7 +6041,7 @@
6050
6041
  "description": "Received CoinWrapper object ID"
6051
6042
  },
6052
6043
  "balance": {
6053
- "$ref": "#/definitions/data_allocation/anyOf/0/properties/allocators/properties/allocators/items/properties/fix"
6044
+ "$ref": "#/definitions/data_allocation/anyOf/0/properties/allocators/properties/threshold"
6054
6045
  },
6055
6046
  "payment": {
6056
6047
  "type": "string",
@@ -74,7 +74,8 @@
74
74
  "number",
75
75
  "string"
76
76
  ],
77
- "description": "Threshold. If defined, fund allocation will be triggered when amount in Allocation object reaches this threshold."
77
+ "description": "Threshold. If defined, fund allocation will be triggered when amount in Allocation object reaches this threshold.",
78
+ "default": 0
78
79
  },
79
80
  "allocators": {
80
81
  "type": "array",
@@ -178,16 +179,13 @@
178
179
  "description": "Fund allocation item list. Each item represents a recipient and their corresponding reward allocation value."
179
180
  },
180
181
  "fix": {
181
- "type": [
182
- "number",
183
- "string"
184
- ],
182
+ "$ref": "#/definitions/data/anyOf/0/properties/allocators/properties/threshold",
185
183
  "description": "Fixed allocation amount. If specified, all recipients will receive the fixed allocation amount."
186
184
  },
187
185
  "max": {
188
186
  "anyOf": [
189
187
  {
190
- "$ref": "#/definitions/data/anyOf/0/properties/allocators/properties/allocators/items/properties/fix"
188
+ "$ref": "#/definitions/data/anyOf/0/properties/allocators/properties/threshold"
191
189
  },
192
190
  {
193
191
  "type": "null"
@@ -208,7 +206,6 @@
208
206
  },
209
207
  "required": [
210
208
  "description",
211
- "threshold",
212
209
  "allocators"
213
210
  ],
214
211
  "additionalProperties": false,
@@ -220,7 +217,7 @@
220
217
  "type": "object",
221
218
  "properties": {
222
219
  "balance": {
223
- "$ref": "#/definitions/data/anyOf/0/properties/allocators/properties/allocators/items/properties/fix"
220
+ "$ref": "#/definitions/data/anyOf/0/properties/allocators/properties/threshold"
224
221
  }
225
222
  },
226
223
  "required": [
@@ -304,7 +301,7 @@
304
301
  "type": "object",
305
302
  "properties": {
306
303
  "balance": {
307
- "$ref": "#/definitions/data/anyOf/0/properties/allocators/properties/allocators/items/properties/fix"
304
+ "$ref": "#/definitions/data/anyOf/0/properties/allocators/properties/threshold"
308
305
  },
309
306
  "token_type": {
310
307
  "type": "string",
@@ -320,7 +317,7 @@
320
317
  "description": "Received CoinWrapper object ID"
321
318
  },
322
319
  "balance": {
323
- "$ref": "#/definitions/data/anyOf/0/properties/allocators/properties/allocators/items/properties/fix"
320
+ "$ref": "#/definitions/data/anyOf/0/properties/allocators/properties/threshold"
324
321
  },
325
322
  "payment": {
326
323
  "type": "string",
@@ -295,6 +295,7 @@
295
295
  "number",
296
296
  "string"
297
297
  ],
298
+ "default": 0,
298
299
  "description": "Threshold to trigger node advancement. If total Forward weight is greater than or equal to threshold, node advancement is triggered."
299
300
  },
300
301
  "forwards": {
@@ -358,10 +359,7 @@
358
359
  {
359
360
  "type": "array",
360
361
  "items": {
361
- "type": [
362
- "number",
363
- "string"
364
- ]
362
+ "$ref": "#/definitions/data/properties/node/anyOf/0/anyOf/0/properties/nodes/items/properties/pairs/items/properties/threshold"
365
363
  }
366
364
  },
367
365
  {
@@ -396,7 +394,6 @@
396
394
  },
397
395
  "required": [
398
396
  "prev_node",
399
- "threshold",
400
397
  "forwards"
401
398
  ],
402
399
  "additionalProperties": false,
@@ -586,10 +586,8 @@
586
586
  "description": "Description of fund allocator list"
587
587
  },
588
588
  "threshold": {
589
- "type": [
590
- "number",
591
- "string"
592
- ],
589
+ "$ref": "#/definitions/data/properties/order_new/properties/buy/properties/total_pay/anyOf/0/properties/balance",
590
+ "default": 0,
593
591
  "description": "Threshold. If defined, fund allocation will be triggered when amount in Allocation object reaches this threshold."
594
592
  },
595
593
  "allocators": {
@@ -709,7 +707,6 @@
709
707
  },
710
708
  "required": [
711
709
  "description",
712
- "threshold",
713
710
  "allocators"
714
711
  ],
715
712
  "additionalProperties": false,
@@ -1589,6 +1589,7 @@
1589
1589
  "number",
1590
1590
  "string"
1591
1591
  ],
1592
+ "default": 0,
1592
1593
  "description": "Threshold to trigger node advancement. If total Forward weight is greater than or equal to threshold, node advancement is triggered."
1593
1594
  },
1594
1595
  "forwards": {
@@ -1652,10 +1653,7 @@
1652
1653
  {
1653
1654
  "type": "array",
1654
1655
  "items": {
1655
- "type": [
1656
- "number",
1657
- "string"
1658
- ]
1656
+ "$ref": "#/definitions/onchain_table_data/properties/result/anyOf/8/properties/result/anyOf/0/properties/value/items/properties/threshold"
1659
1657
  }
1660
1658
  },
1661
1659
  {
@@ -1690,7 +1688,6 @@
1690
1688
  },
1691
1689
  "required": [
1692
1690
  "prev_node",
1693
- "threshold",
1694
1691
  "forwards"
1695
1692
  ],
1696
1693
  "additionalProperties": false,
@@ -1881,18 +1878,15 @@
1881
1878
  "description": "Total operation weight"
1882
1879
  },
1883
1880
  "threshold": {
1884
- "type": [
1885
- "number",
1886
- "string"
1887
- ],
1881
+ "$ref": "#/definitions/onchain_table_data/properties/result/anyOf/8/properties/result/anyOf/0/properties/value/items/properties/threshold",
1882
+ "default": 0,
1888
1883
  "description": "Operation threshold. When total operation weight exceeds threshold, session is considered completed and Progress moves from current node to next node."
1889
1884
  }
1890
1885
  },
1891
1886
  "required": [
1892
1887
  "next_node",
1893
1888
  "forwards",
1894
- "weights",
1895
- "threshold"
1889
+ "weights"
1896
1890
  ],
1897
1891
  "additionalProperties": false,
1898
1892
  "description": "Progress session"
@@ -2657,7 +2651,7 @@
2657
2651
  },
2658
2652
  "name": {
2659
2653
  "type": "string",
2660
- "description": "Query instruction name. Example: 'progress.current_node_name'"
2654
+ "description": "Query instruction name. Example: 'progress.current'"
2661
2655
  },
2662
2656
  "objectType": {
2663
2657
  "type": "string",
@@ -0,0 +1 @@
1
+ export { handleBridgeOperations } from "../../schema/call/bridge-handler.js";
@@ -0,0 +1 @@
1
+ export { handleBridgeOperations } from "../../schema/call/bridge-handler.js";
@@ -0,0 +1,2 @@
1
+ import type { ToolDispatchResult } from "../types.js";
2
+ export declare function handleConfigOperation(args: any): Promise<ToolDispatchResult>;
@@ -0,0 +1,71 @@
1
+ import { listServices, getServiceInfo, toggle as toggleService, setEnabled as setServiceEnabled, reset as resetService, } from "../../config/index.js";
2
+ export async function handleConfigOperation(args) {
3
+ const action = args.action;
4
+ let result;
5
+ switch (action) {
6
+ case "list":
7
+ result = { services: listServices() };
8
+ break;
9
+ case "toggle": {
10
+ const service = args.service;
11
+ if (!service)
12
+ throw new Error("'service' param is required for toggle");
13
+ const existing = getServiceInfo(service);
14
+ if (!existing) {
15
+ throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
16
+ }
17
+ const newState = toggleService(service);
18
+ result = { service, enabled: newState, reminder: existing.reminder };
19
+ break;
20
+ }
21
+ case "enable": {
22
+ const service = args.service;
23
+ if (!service)
24
+ throw new Error("'service' param is required for enable");
25
+ const existing = getServiceInfo(service);
26
+ if (!existing)
27
+ throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
28
+ setServiceEnabled(service, true);
29
+ result = { service, enabled: true, reminder: existing.reminder };
30
+ break;
31
+ }
32
+ case "disable": {
33
+ const service = args.service;
34
+ if (!service)
35
+ throw new Error("'service' param is required for disable");
36
+ const existing = getServiceInfo(service);
37
+ if (!existing)
38
+ throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
39
+ setServiceEnabled(service, false);
40
+ result = { service, enabled: false, reminder: existing.reminder };
41
+ break;
42
+ }
43
+ case "reset": {
44
+ const service = args.service;
45
+ if (!service)
46
+ throw new Error("'service' param is required for reset");
47
+ const existing = getServiceInfo(service);
48
+ if (!existing)
49
+ throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
50
+ resetService(service);
51
+ result = { service, enabled: getServiceInfo(service)?.enabled, reminder: existing.reminder, reset: true };
52
+ break;
53
+ }
54
+ case "info": {
55
+ const service = args.service;
56
+ if (!service)
57
+ throw new Error("'service' param is required for info");
58
+ const info = getServiceInfo(service);
59
+ if (!info)
60
+ throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
61
+ result = info;
62
+ break;
63
+ }
64
+ default:
65
+ throw new Error(`Unknown config_operation action: ${action}`);
66
+ }
67
+ return {
68
+ content: [{ type: "text", text: JSON.stringify({ result }) }],
69
+ structuredContent: { result },
70
+ };
71
+ }
@@ -0,0 +1,3 @@
1
+ import type { ToolDispatchResult } from "../types.js";
2
+ export declare function handleGuard2File(args: any): Promise<ToolDispatchResult>;
3
+ export declare function handleMachineNode2File(args: any): Promise<ToolDispatchResult>;
@@ -0,0 +1,90 @@
1
+ import { resolve } from "path";
2
+ import { strictParse, getEnvConfig, Guard2File_InputSchema, MachineNode2File_InputSchema, } from "../../schema/index.js";
3
+ import { guard2file, machineNode2file, } from "@wowok/wowok";
4
+ export async function handleGuard2File(args) {
5
+ const validated = strictParse(Guard2File_InputSchema, args, "guard2file input");
6
+ const env = getEnvConfig(validated.env);
7
+ try {
8
+ await guard2file(validated.guard, validated.file_path, validated.format || "json", env.network);
9
+ const result = {
10
+ result: {
11
+ status: "success",
12
+ data: {
13
+ file_path: resolve(validated.file_path),
14
+ format: validated.format || "json",
15
+ guard_object: validated.guard,
16
+ },
17
+ },
18
+ };
19
+ return {
20
+ content: [{ type: "text", text: JSON.stringify(result) }],
21
+ structuredContent: result,
22
+ };
23
+ }
24
+ catch (error) {
25
+ const result = {
26
+ result: {
27
+ status: "error",
28
+ error: error.message,
29
+ },
30
+ };
31
+ return {
32
+ content: [{ type: "text", text: JSON.stringify(result) }],
33
+ structuredContent: result,
34
+ };
35
+ }
36
+ }
37
+ export async function handleMachineNode2File(args) {
38
+ const validated = strictParse(MachineNode2File_InputSchema, args, "machineNode2file input");
39
+ const env = getEnvConfig(validated.env);
40
+ try {
41
+ await machineNode2file(validated.machine, validated.file_path, validated.format || "json", env.network);
42
+ let node_count = undefined;
43
+ try {
44
+ const filePath = resolve(validated.file_path);
45
+ const fileContent = await import('fs/promises').then(fs => fs.readFile(filePath, 'utf-8'));
46
+ if ((validated.format || "json") === "json") {
47
+ const parsed = JSON.parse(fileContent);
48
+ if (Array.isArray(parsed)) {
49
+ node_count = parsed.length;
50
+ }
51
+ }
52
+ else {
53
+ const nodeMatches = fileContent.match(/^##\s+Node:/gm);
54
+ node_count = nodeMatches ? nodeMatches.length : 0;
55
+ }
56
+ }
57
+ catch {
58
+ node_count = undefined;
59
+ }
60
+ const result = {
61
+ result: {
62
+ status: "success",
63
+ data: {
64
+ file_path: resolve(validated.file_path),
65
+ format: validated.format || "json",
66
+ machine_object: validated.machine,
67
+ },
68
+ },
69
+ };
70
+ if (node_count !== undefined) {
71
+ result.result.data.node_count = node_count;
72
+ }
73
+ return {
74
+ content: [{ type: "text", text: JSON.stringify(result) }],
75
+ structuredContent: result,
76
+ };
77
+ }
78
+ catch (error) {
79
+ const result = {
80
+ result: {
81
+ status: "error",
82
+ error: error.message,
83
+ },
84
+ };
85
+ return {
86
+ content: [{ type: "text", text: JSON.stringify(result) }],
87
+ structuredContent: result,
88
+ };
89
+ }
90
+ }