@wowok/skills 1.1.0 → 1.1.1

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 (52) hide show
  1. package/README.md +16 -20
  2. package/dist/cli.js +114 -19
  3. package/dist/cli.js.map +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +11 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/skills.d.ts +46 -1
  9. package/dist/skills.d.ts.map +1 -1
  10. package/dist/skills.js +154 -16
  11. package/dist/skills.js.map +1 -1
  12. package/dist/types.d.ts +31 -0
  13. package/dist/types.d.ts.map +1 -1
  14. package/package.json +3 -4
  15. package/scripts/install.js +5 -3
  16. package/wowok-arbitrator/SKILL.md +279 -0
  17. package/wowok-guard/SKILL.md +143 -167
  18. package/wowok-machine/SKILL.md +167 -279
  19. package/wowok-order/SKILL.md +281 -429
  20. package/wowok-provider/SKILL.md +453 -0
  21. package/wowok-safety/SKILL.md +42 -20
  22. package/wowok-tools/SKILL.md +328 -343
  23. package/schemas/onchain_operations/_common.md +0 -406
  24. package/schemas/onchain_operations/_index.md +0 -196
  25. package/schemas/onchain_operations/allocation.md +0 -28
  26. package/schemas/onchain_operations/arbitration.md +0 -106
  27. package/schemas/onchain_operations/contact.md +0 -40
  28. package/schemas/onchain_operations/demand.md +0 -53
  29. package/schemas/onchain_operations/gen_passport.md +0 -23
  30. package/schemas/onchain_operations/guard.md +0 -56
  31. package/schemas/onchain_operations/machine.md +0 -89
  32. package/schemas/onchain_operations/order.md +0 -56
  33. package/schemas/onchain_operations/payment.md +0 -24
  34. package/schemas/onchain_operations/permission.md +0 -68
  35. package/schemas/onchain_operations/personal.md +0 -58
  36. package/schemas/onchain_operations/progress.md +0 -38
  37. package/schemas/onchain_operations/repository.md +0 -70
  38. package/schemas/onchain_operations/reward.md +0 -38
  39. package/schemas/onchain_operations/service.md +0 -78
  40. package/schemas/onchain_operations/treasury.md +0 -68
  41. package/schemas/schema-account_operation.md +0 -402
  42. package/schemas/schema-guard2file.md +0 -153
  43. package/schemas/schema-local_info_operation.md +0 -160
  44. package/schemas/schema-local_mark_operation.md +0 -148
  45. package/schemas/schema-machineNode2file.md +0 -155
  46. package/schemas/schema-messenger_operation.md +0 -547
  47. package/schemas/schema-onchain_events.md +0 -201
  48. package/schemas/schema-onchain_table_data.md +0 -334
  49. package/schemas/schema-query_toolkit.md +0 -395
  50. package/schemas/schema-wip_file.md +0 -240
  51. package/schemas/schema-wowok_buildin_info.md +0 -296
  52. package/wowok-build/SKILL.md +0 -139
@@ -26,34 +26,25 @@ A Guard is a **recursive computational tree** that evaluates to a boolean result
26
26
 
27
27
  ## Guard Structure
28
28
 
29
- ```typescript
30
- Guard {
31
- namedNew?: { name: string; tags?: string[]; onChain?: boolean; replaceExistName?: boolean };
32
- description?: string;
33
-
34
- table: { // Data table what the Guard validates
35
- identifier: number; // 0-255, unique within this Guard
36
- b_submission: boolean; // Must user submit this value?
37
- value_type: ValueType; // Expected type (0-18)
38
- value?: SupportedValue; // Default value (if b_submission = false)
39
- name?: string; // Human-readable field name
40
- }[];
41
-
42
- root: {
43
- type: "node";
44
- node: GuardNode; // The recursive validation tree
45
- } | {
46
- type: "file";
47
- file_path: string; // Load from JSON/Markdown file
48
- format?: "json" | "markdown";
49
- };
50
-
51
- rely?: { // Depend on other Guards
52
- guards: string[]; // Guard IDs or names
53
- logic_or?: boolean; // OR (true) vs AND (false/default)
54
- };
55
- }
56
- ```
29
+ **Operation**: `onchain_operations` with `operation_type: "guard"`.
30
+
31
+ **Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_guard" })`
32
+
33
+ **Key Fields**:
34
+ - `namedNew`: Object creation options (name, tags, onChain, replaceExistName)
35
+ - `description`: Guard description
36
+ - `table`: Data table defining what the Guard validates
37
+ - `identifier`: 0-255, unique within this Guard
38
+ - `b_submission`: Must user submit this value?
39
+ - `value_type`: Expected type (0-18, see ValueType enum)
40
+ - `value`: Default value (if b_submission = false)
41
+ - `name`: Human-readable field name
42
+ - `root`: The computational tree
43
+ - `type: "node"`: Inline node definition
44
+ - `type: "file"`: Load from JSON/Markdown file
45
+ - `rely`: Dependencies on other Guards
46
+ - `guards`: Array of Guard IDs or names
47
+ - `logic_or`: OR (true) vs AND (false/default)
57
48
 
58
49
  **CRITICAL**: The Guard's `table` defines ALL data the Guard uses — both submitted values and values passed from the calling object. Every `identifier` node in the tree references a table entry.
59
50
 
@@ -61,39 +52,46 @@ Guard {
61
52
 
62
53
  ## GuardNode — The Computational Tree
63
54
 
64
- The GuardNode is a `z.discriminatedUnion("type", [...])` 70+ type variants. Every node has a `type` field. Below are all categories.
55
+ The GuardNode is a discriminated union with 70+ type variants. Every node has a `type` field.
65
56
 
66
57
  ### Leaf Nodes (No Children)
67
58
 
68
59
  #### identifier — Read from Guard Table
69
- ```typescript
70
- { type: "identifier"; identifier: number }
71
- ```
72
- Returns the value at the specified Guard table index (0-255). This is how data enters the computation tree.
60
+
61
+ **Type**: `identifier`
62
+
63
+ **Key Field**:
64
+ - `identifier`: Guard table index (0-255)
65
+
66
+ Returns the value at the specified Guard table index.
73
67
 
74
68
  #### value_type — Get ValueType of Child
75
- ```typescript
76
- { type: "value_type"; node: GuardNode }
77
- ```
69
+
70
+ **Type**: `value_type`
71
+
72
+ **Key Field**:
73
+ - `node`: Child GuardNode
74
+
78
75
  Returns U8: the ValueType identifier of the child node's result.
79
76
 
80
77
  ---
81
78
 
82
79
  ### Query Node — Fetch On-Chain Data
83
80
 
84
- ```typescript
85
- {
86
- type: "query";
87
- query: number | string; // Query instruction ID or name
88
- object: {
89
- identifier: number; // Guard table index for target object
90
- convert_witness?: number; // Optional witness conversion
91
- };
92
- parameters: GuardNode[]; // Parameters for the query
93
- }
94
- ```
81
+ **Type**: `query`
82
+
83
+ **Key Fields**:
84
+ - `query`: Query instruction ID (number) or name (string)
85
+ - `object`: Target object specification
86
+ - `identifier`: Guard table index for target object
87
+ - `convert_witness`: Optional witness conversion ID
88
+ - `parameters`: Array of GuardNode parameters for the query
89
+
90
+ Fetches data from on-chain WoWok objects. The `query` field references a built-in query instruction.
95
91
 
96
- Fetches data from on-chain WoWok objects. The `query` field references a built-in query instruction (e.g., `1001` for permission description, or name `"permission.description"`). Use `wowok_buildin_info` with `info_type: "guard_instructions"` to discover available queries.
92
+ **Discover Available Queries**:
93
+
94
+ **Tool**: `wowok_buildin_info` with `info_type: "guard_instructions"`.
97
95
 
98
96
  **System Addresses for Entity Queries**:
99
97
  | Constant | Value | Use For |
@@ -108,26 +106,30 @@ Fetches data from on-chain WoWok objects. The `query` field references a built-i
108
106
  All return **Bool**. Each takes 2-8 children unless noted.
109
107
 
110
108
  #### Core Logic
111
- | type | Children | Description |
109
+
110
+ | Type | Children | Description |
112
111
  |------|----------|-------------|
113
112
  | `logic_and` | `nodes[]` | ALL children must be true |
114
113
  | `logic_or` | `nodes[]` | ANY child must be true |
115
114
  | `logic_not` | `node` (1) | Inverts boolean result |
116
115
 
117
116
  #### Equality
118
- | type | Children | Description |
117
+
118
+ | Type | Children | Description |
119
119
  |------|----------|-------------|
120
120
  | `logic_equal` | `nodes[]` | Type+value equality; all must match first |
121
121
  | `logic_string_nocase_equal` | `nodes[]` | Case-insensitive string equality |
122
122
 
123
123
  #### String Comparison
124
- | type | Children | Description |
124
+
125
+ | Type | Children | Description |
125
126
  |------|----------|-------------|
126
127
  | `logic_string_contains` | `nodes[]` | First contains all others (case-sensitive) |
127
128
  | `logic_string_nocase_contains` | `nodes[]` | First contains all others (case-insensitive) |
128
129
 
129
130
  #### Numeric Comparison (U256)
130
- | type | Children | Description |
131
+
132
+ | Type | Children | Description |
131
133
  |------|----------|-------------|
132
134
  | `logic_as_u256_equal` | `nodes[]` | First == all others |
133
135
  | `logic_as_u256_greater` | `nodes[]` | First > all others |
@@ -140,7 +142,8 @@ All return **Bool**. Each takes 2-8 children unless noted.
140
142
  ### Arithmetic Nodes (calc_*)
141
143
 
142
144
  #### Numeric (all return U256, 2-8 children)
143
- | type | Operation |
145
+
146
+ | Type | Operation |
144
147
  |------|-----------|
145
148
  | `calc_number_add` | first + second + third + ... |
146
149
  | `calc_number_subtract` | first - second - third - ... |
@@ -149,7 +152,8 @@ All return **Bool**. Each takes 2-8 children unless noted.
149
152
  | `calc_number_mod` | (first % second) % third % ... (throws on zero) |
150
153
 
151
154
  #### String (return U64 or Bool)
152
- | type | Children | Returns | Description |
155
+
156
+ | Type | Children | Returns | Description |
153
157
  |------|----------|---------|-------------|
154
158
  | `calc_string_length` | `node` (1) | U64 | UTF-8 byte length |
155
159
  | `calc_string_contains` | `nodes[]` (2-8) | Bool | cs substring check |
@@ -157,9 +161,10 @@ All return **Bool**. Each takes 2-8 children unless noted.
157
161
  | `calc_string_nocase_equal` | `nodes[]` (2-8) | Bool | ci equality |
158
162
 
159
163
  #### String Index (return U64)
160
- | type | Children | Description |
164
+
165
+ | Type | Children | Description |
161
166
  |------|----------|-------------|
162
- | `calc_string_indexof` | `nodeLeft` + `nodeRight` + `order` | Find substring index (cs). `order`: "forward" \| "backward". Not found → u64::MAX |
167
+ | `calc_string_indexof` | `nodeLeft` + `nodeRight` + `order` | Find substring index (cs). `order`: "forward" or "backward". Not found → u64::MAX |
163
168
  | `calc_string_nocase_indexof` | `nodeLeft` + `nodeRight` + `order` | Find substring index (ci) |
164
169
 
165
170
  ---
@@ -168,7 +173,7 @@ All return **Bool**. Each takes 2-8 children unless noted.
168
173
 
169
174
  All take single `node` child.
170
175
 
171
- | type | Input → Output | Description |
176
+ | Type | Input → Output | Description |
172
177
  |------|---------------|-------------|
173
178
  | `convert_number_address` | Number → Address | Numeric to Address type |
174
179
  | `convert_address_number` | Address → U256 | Address to numeric |
@@ -186,7 +191,8 @@ All take single `node` child.
186
191
  ### Vector Operations (vec_*)
187
192
 
188
193
  #### Vector Properties
189
- | type | Children | Returns | Description |
194
+
195
+ | Type | Children | Returns | Description |
190
196
  |------|----------|---------|-------------|
191
197
  | `vec_length` | `node` (1) | U64 | Number of elements |
192
198
 
@@ -194,7 +200,7 @@ All take single `node` child.
194
200
 
195
201
  First node = vector, remaining nodes = values to check.
196
202
 
197
- | type | Vector Type | Element Type |
203
+ | Type | Vector Type | Element Type |
198
204
  |------|------------|--------------|
199
205
  | `vec_contains_bool` | VecBool (9) or Value (19) | Bool (0) or Value (19) |
200
206
  | `vec_contains_address` | VecAddress (10) or Value (19) | Address (1) or Value (19) |
@@ -204,7 +210,7 @@ First node = vector, remaining nodes = values to check.
204
210
 
205
211
  #### Vector Index (return U64)
206
212
 
207
- | type | Children | Description |
213
+ | Type | Children | Description |
208
214
  |------|----------|-------------|
209
215
  | `vec_indexof_bool` | `nodeLeft` + `nodeRight` + `order` | Find bool index |
210
216
  | `vec_indexof_address` | `nodeLeft` + `nodeRight` + `order` | Find address index |
@@ -212,7 +218,7 @@ First node = vector, remaining nodes = values to check.
212
218
  | `vec_indexof_string_nocase` | `nodeLeft` + `nodeRight` + `order` | Find string index (ci) |
213
219
  | `vec_indexof_number` | `nodeLeft` + `nodeRight` + `order` | Find number index |
214
220
 
215
- `order`: "forward" \| "backward". Not found → u64::MAX.
221
+ `order`: "forward" or "backward". Not found → u64::MAX.
216
222
 
217
223
  ---
218
224
 
@@ -222,7 +228,7 @@ Query on-chain records to validate operations. All return **Bool**.
222
228
 
223
229
  These nodes check historical records (orders, progress steps, rewards, treasury operations) to enforce limits.
224
230
 
225
- | type | Key Parameters | Description |
231
+ | Type | Key Parameters | Description |
226
232
  |------|---------------|-------------|
227
233
  | `record_check_recipient_order` | `receipt_type` + `recipient` | Check order count/status by recipient |
228
234
  | `record_check_recipient_progress` | `recipient` | Check progress count by recipient |
@@ -242,112 +248,104 @@ Each uses `GuardNode` sub-nodes for its parameters (e.g., `recipient` is a Guard
242
248
  ## Guard Design Workflow
243
249
 
244
250
  ### Step 1: Query Available Instructions
245
- ```
246
- wowok_buildin_info({ info_type: "guard_instructions" })
247
- ```
251
+
252
+ **Tool**: `wowok_buildin_info` with `info_type: "guard_instructions"`.
253
+
248
254
  Discover what queries are available and their expected parameter types.
249
255
 
250
256
  ### Step 2: Query Value Types
251
- ```
252
- wowok_buildin_info({ info_type: "value_types" })
253
- ```
254
- Understand the ValueType enum (Bool=0, Address=1, String=2, U8=3, ..., U256=8, VecBool=9, ..., VecVecU8=18).
257
+
258
+ **Tool**: `wowok_buildin_info` with `info_type: "value_types"`.
259
+
260
+ Understand the ValueType enum:
261
+ - Bool=0, Address=1, String=2
262
+ - U8=3, U16=4, U32=5, U64=6, U128=7, U256=8
263
+ - VecBool=9, VecAddress=10, VecString=11
264
+ - VecU8=12, VecU16=13, VecU32=14, VecU64=15, VecU128=16, VecU256=17
265
+ - VecVecU8=18
255
266
 
256
267
  ### Step 3: Design the Table
268
+
257
269
  Decide what data the Guard needs:
258
270
  - **Submitted data** (b_submission = true): User provides at operation time
259
271
  - **Passed data** (b_submission = false): Object provides automatically
260
272
 
261
273
  ### Step 4: Build the Root Tree
274
+
262
275
  - Start with `logic_and` as the root
263
276
  - Add child nodes for each condition
264
277
  - Use `query` + `identifier` patterns for data fetching
265
278
  - Use comparison nodes for validation
266
279
 
267
280
  ### Step 5: Create Guard
268
- ```
269
- onchain_operations({
270
- operation_type: "guard",
271
- data: {
272
- namedNew: { name: "my_guard" },
273
- description: "Validates X, Y, Z",
274
- table: [...],
275
- root: { type: "node", node: { type: "logic_and", nodes: [...] } }
276
- }
277
- })
278
- ```
281
+
282
+ **Operation**: `onchain_operations` with `operation_type: "guard"`.
283
+
284
+ **Key Fields**:
285
+ - `namedNew`: Guard creation options with name
286
+ - `description`: Guard purpose
287
+ - `table`: Data table array
288
+ - `root`: Computational tree with `type: "node"` and `node` containing the tree
279
289
 
280
290
  Guard creation is a **one-step** operation — the `guard` operation type has no `submission` field. It either succeeds (returns transaction) or fails (returns error).
281
291
 
282
292
  ### Step 6: Export for Review
283
- ```
284
- guard2file({ guard: "my_guard", file_path: "./my_guard.json", format: "json" })
285
- ```
293
+
294
+ **Tool**: `guard2file`.
295
+
296
+ **Key Fields**:
297
+ - `guard`: Guard ID or name
298
+ - `file_path`: Output file path
299
+ - `format`: Output format ("json" or "markdown")
286
300
 
287
301
  ### Step 7: Use Guard in Operations
288
- The Guard is now ready to be referenced by other operations (service, machine, progress, etc.) via their `submission` field. See [Guard Submission Mechanism](../schemas/onchain_operations/_index.md) for how Guards participate in the two-step submission flow.
302
+
303
+ The Guard is now ready to be referenced by other operations (service, machine, progress, etc.) via their `submission` field.
289
304
 
290
305
  ---
291
306
 
292
307
  ## Common Guard Patterns
293
308
 
294
309
  ### Pattern 1: Identity Check (is sender == expected address?)
295
- ```typescript
296
- {
297
- type: "logic_equal",
298
- nodes: [
299
- { type: "identifier", identifier: 0 }, // submitted address
300
- { type: "identifier", identifier: 1 } // stored address
301
- ]
302
- }
303
- ```
310
+
311
+ **Node Structure**:
312
+ - Type: `logic_equal`
313
+ - Nodes: Two `identifier` nodes
314
+ - First: identifier 0 (submitted address)
315
+ - Second: identifier 1 (stored address)
304
316
 
305
317
  ### Pattern 2: Minimum Balance
306
- ```typescript
307
- {
308
- type: "logic_as_u256_greater_or_equal",
309
- nodes: [
310
- {
311
- type: "query",
312
- query: "balance", // check wowok_buildin_info for correct ID
313
- object: { identifier: 0 }, // account from table[0]
314
- parameters: [
315
- { type: "identifier", identifier: 1 } // coin_type from table[1]
316
- ]
317
- },
318
- { type: "identifier", identifier: 2 } // minimum balance from table[2]
319
- ]
320
- }
321
- ```
318
+
319
+ **Node Structure**:
320
+ - Type: `logic_as_u256_greater_or_equal`
321
+ - Nodes:
322
+ - First: `query` node
323
+ - query: "balance" (check wowok_buildin_info for correct ID)
324
+ - object: { identifier: 0 } (account from table[0])
325
+ - parameters: [ { type: "identifier", identifier: 1 } ] (coin_type from table[1])
326
+ - Second: `identifier` node with identifier 2 (minimum balance from table[2])
322
327
 
323
328
  ### Pattern 3: Entity Registration Count
324
- ```typescript
325
- {
326
- type: "logic_as_u256_greater",
327
- nodes: [
328
- {
329
- type: "query",
330
- query: "entity_registrar_records_length",
331
- object: { identifier: 0 }, // ENTITY_REGISTRAR_ADDRESS (0xaab)
332
- parameters: []
333
- },
334
- { type: "identifier", identifier: 1 } // 0 (check count > 0)
335
- ]
336
- }
337
- ```
329
+
330
+ **Node Structure**:
331
+ - Type: `logic_as_u256_greater`
332
+ - Nodes:
333
+ - First: `query` node
334
+ - query: "entity_registrar_records_length"
335
+ - object: { identifier: 0 } (ENTITY_REGISTRAR_ADDRESS 0xaab)
336
+ - parameters: []
337
+ - Second: `identifier` node with identifier 1 (0 to check count > 0)
338
338
 
339
339
  ### Pattern 4: Rate Limiting (record check)
340
- ```typescript
341
- {
342
- type: "logic_not",
343
- node: {
344
- type: "record_check_recipient_order",
345
- receipt_type: "specific_value",
346
- recipient: { type: "identifier", identifier: 0 }
347
- }
348
- }
349
- // Inverts: "has records" → false (blocked)
350
- ```
340
+
341
+ **Node Structure**:
342
+ - Type: `logic_not`
343
+ - Node:
344
+ - Type: `record_check_recipient_order`
345
+ - receipt_type: "specific_value"
346
+ - recipient: { type: "identifier", identifier: 0 }
347
+
348
+ Inverts: "has records" → false (blocked)
351
349
 
352
350
  ---
353
351
 
@@ -387,39 +385,17 @@ When using a `query` node's `convert_witness` field, the following numeric IDs a
387
385
  | TypeOrderService | 102 | From Order, get its Service |
388
386
  | TypeProgressMachine | 103 | From Progress, get its Machine |
389
387
  | TypeArbOrder | 104 | From Arb, get its Order |
390
- | TypeArbArbitration | 105 | From Arb, get its Arbitration |
391
- | TypeArbProgress | 106 | From Arb, get its Progress |
392
- | TypeArbMachine | 107 | From Arb, get its Machine |
393
- | TypeArbService | 108 | From Arb, get its Service |
394
-
395
- **Example**: To verify that an Order's Progress is at a specific node, query the Order with `convert_witness: 100` (TypeOrderProgress) to fetch the Progress object, then query the Progress's current node name.
396
388
 
397
389
  ---
398
390
 
399
- ## Discovering Query Instructions via `wowok_buildin_info`
400
-
401
- Before using `query` nodes, discover available query instructions and their signatures:
402
-
403
- ```typescript
404
- // Query all Guard instructions and object queries
405
- {
406
- info: "guard instructions",
407
- filter: {
408
- scope: "all", // "instruct" | "object query" | "all"
409
- objectType?: string, // Filter by object type (for object queries)
410
- returnType?: string, // Filter by return type
411
- paramCount?: number, // Filter by parameter count
412
- name?: string // Case-insensitive name filter
413
- }
414
- }
415
- ```
416
-
417
- This returns a list of all available operations with:
418
- - `id`: Numeric operation ID
419
- - `name`: Human-readable name (e.g., "machine.description")
420
- - `objectType`: Target object type
421
- - `parameters`: Array of expected parameter types
422
- - `return`: Return value type
423
- - `description`: Detailed usage description
424
-
425
- Always query `guard instructions` before designing complex Guards to ensure correct IDs, parameter types, and return types.
391
+ ## Schema Reference
392
+
393
+ | Purpose | Schema Name |
394
+ |---------|-------------|
395
+ | Guard operations | `onchain_operations_guard` |
396
+ | General on-chain operations | `onchain_operations` |
397
+ | Build-in info | `wowok_buildin_info` |
398
+
399
+ **Query Schema**: `schema_query({ action: "get", name: "<schema_name>" })`
400
+
401
+ **Related Skills**: [wowok-machine](../wowok-machine/SKILL.md) | [wowok-order](../wowok-order/SKILL.md) | [wowok-provider](../wowok-provider/SKILL.md)