@wowok/skills 1.0.6 → 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 +26 -30
  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 +166 -139
  18. package/wowok-machine/SKILL.md +215 -280
  19. package/wowok-order/SKILL.md +290 -404
  20. package/wowok-provider/SKILL.md +453 -0
  21. package/wowok-safety/SKILL.md +176 -279
  22. package/wowok-tools/SKILL.md +329 -344
  23. package/schemas/onchain_operations/_common.md +0 -236
  24. package/schemas/onchain_operations/_index.md +0 -22
  25. package/schemas/onchain_operations/allocation.md +0 -50
  26. package/schemas/onchain_operations/arbitration.md +0 -95
  27. package/schemas/onchain_operations/contact.md +0 -36
  28. package/schemas/onchain_operations/demand.md +0 -52
  29. package/schemas/onchain_operations/gen_passport.md +0 -43
  30. package/schemas/onchain_operations/guard.md +0 -136
  31. package/schemas/onchain_operations/machine.md +0 -70
  32. package/schemas/onchain_operations/order.md +0 -57
  33. package/schemas/onchain_operations/payment.md +0 -32
  34. package/schemas/onchain_operations/permission.md +0 -57
  35. package/schemas/onchain_operations/personal.md +0 -59
  36. package/schemas/onchain_operations/progress.md +0 -35
  37. package/schemas/onchain_operations/repository.md +0 -81
  38. package/schemas/onchain_operations/reward.md +0 -40
  39. package/schemas/onchain_operations/service.md +0 -104
  40. package/schemas/onchain_operations/treasury.md +0 -74
  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 -375
  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 -606
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: wowok-guard
3
3
  description: |
4
4
  WoWok Guard design mastery — comprehensive reference for the recursive,
@@ -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,111 +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
- ### Step 5: Create Guard (Dry-Run First)
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
- // NO submission dry run
278
- })
279
- ```
280
+ ### Step 5: Create Guard
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
289
+
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).
280
291
 
281
292
  ### Step 6: Export for Review
282
- ```
283
- guard2file({ guard: "my_guard", file_path: "./my_guard.json", format: "json" })
284
- ```
285
293
 
286
- ### Step 7: Execute
287
- Add `submission` after confirming the dry-run result.
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")
300
+
301
+ ### Step 7: Use Guard in Operations
302
+
303
+ The Guard is now ready to be referenced by other operations (service, machine, progress, etc.) via their `submission` field.
288
304
 
289
305
  ---
290
306
 
291
307
  ## Common Guard Patterns
292
308
 
293
309
  ### Pattern 1: Identity Check (is sender == expected address?)
294
- ```typescript
295
- {
296
- type: "logic_equal",
297
- nodes: [
298
- { type: "identifier", identifier: 0 }, // submitted address
299
- { type: "identifier", identifier: 1 } // stored address
300
- ]
301
- }
302
- ```
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)
303
316
 
304
317
  ### Pattern 2: Minimum Balance
305
- ```typescript
306
- {
307
- type: "logic_as_u256_greater_or_equal",
308
- nodes: [
309
- {
310
- type: "query",
311
- query: "balance", // check wowok_buildin_info for correct ID
312
- object: { identifier: 0 }, // account from table[0]
313
- parameters: [
314
- { type: "identifier", identifier: 1 } // coin_type from table[1]
315
- ]
316
- },
317
- { type: "identifier", identifier: 2 } // minimum balance from table[2]
318
- ]
319
- }
320
- ```
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])
321
327
 
322
328
  ### Pattern 3: Entity Registration Count
323
- ```typescript
324
- {
325
- type: "logic_as_u256_greater",
326
- nodes: [
327
- {
328
- type: "query",
329
- query: "entity_registrar_records_length",
330
- object: { identifier: 0 }, // ENTITY_REGISTRAR_ADDRESS (0xaab)
331
- parameters: []
332
- },
333
- { type: "identifier", identifier: 1 } // 0 (check count > 0)
334
- ]
335
- }
336
- ```
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)
337
338
 
338
339
  ### Pattern 4: Rate Limiting (record check)
339
- ```typescript
340
- {
341
- type: "logic_not",
342
- node: {
343
- type: "record_check_recipient_order",
344
- receipt_type: "specific_value",
345
- recipient: { type: "identifier", identifier: 0 }
346
- }
347
- }
348
- // Inverts: "has records" → false (blocked)
349
- ```
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)
350
349
 
351
350
  ---
352
351
 
@@ -371,4 +370,32 @@ Add `submission` after confirming the dry-run result.
371
370
  | "type mismatch" | Wrong ValueType in table | Match table type to actual value type |
372
371
  | "table field required" | Missing table array | Guards MUST have `table[]` |
373
372
  | "guard validation failed" | Logic error | Export with `guard2file`, review logic |
374
- | "object not found" | Wrong query object | Verify object addresses/identifiers |
373
+ | "object not found" | Wrong query object | Verify object addresses/identifiers |
374
+
375
+ ---
376
+
377
+ ## Query Witness Conversion Types
378
+
379
+ When using a `query` node's `convert_witness` field, the following numeric IDs allow cross-object type conversion — accessing a related object from the current context:
380
+
381
+ | Conversion | ID | Description |
382
+ |-----------|-----|-------------|
383
+ | TypeOrderProgress | 100 | From Order, get its Progress |
384
+ | TypeOrderMachine | 101 | From Order, get its Machine |
385
+ | TypeOrderService | 102 | From Order, get its Service |
386
+ | TypeProgressMachine | 103 | From Progress, get its Machine |
387
+ | TypeArbOrder | 104 | From Arb, get its Order |
388
+
389
+ ---
390
+
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)