@wowok/skills 1.1.5 → 1.1.7

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.
@@ -1,11 +1,12 @@
1
1
  ---
2
2
  name: wowok-tools
3
3
  description: |
4
- WoWok MCP tool reference — the fallback when schemas are unavailable.
5
- Covers 13 tools with usage patterns, common pitfalls, and troubleshooting.
6
-
4
+ WoWok MCP tool reference — canonical documentation for all 13 MCP tools.
5
+ Covers schema-inexpressible constraints, business rules, interaction patterns,
6
+ and design decisions not captured by JSON Schema.
7
+
7
8
  Core value: prevent common AI failures (wrong tool selection, incorrect
8
- parameter formats, missing required fields, wrong discriminated unions).
9
+ parameter formats, missing structural wrappers, wrong discriminated unions).
9
10
  when_to_use:
10
11
  - AI needs to select or invoke any WoWok MCP tool
11
12
  - AI encounters tool errors and needs debugging
@@ -16,210 +17,159 @@ always: true
16
17
 
17
18
  # WoWok MCP Tool Reference
18
19
 
19
- Quick reference for WoWok MCP tools patterns, pitfalls, and troubleshooting.
20
+ Canonical reference for all 13 MCP tools. Covers patterns, constraints, and design decisions that **JSON Schema cannot express**. For detailed business workflows, see the Domain and Business Skills below.
20
21
 
21
- > **Domain Skills**: [wowok-guard](../wowok-guard/SKILL.md) (validation logic), [wowok-messenger](../wowok-messenger/SKILL.md) (encrypted messaging), [wowok-machine](../wowok-machine/SKILL.md) (workflows)
22
+ > **Domain Skills**: [wowok-guard](../wowok-guard/SKILL.md) (validation logic), [wowok-messenger](../wowok-messenger/SKILL.md) (encrypted messaging), [wowok-machine](../wowok-machine/SKILL.md) (workflows), [wowok-safety](../wowok-safety/SKILL.md) (safety & naming)
22
23
  > **Business Skills**: [wowok-order](../wowok-order/SKILL.md) (customer), [wowok-provider](../wowok-provider/SKILL.md) (merchant), [wowok-arbitrator](../wowok-arbitrator/SKILL.md) (dispute resolution)
23
24
 
24
25
  ---
25
26
 
26
- ## Core Patterns
27
-
28
- ### Standard Structure
29
-
30
- ```json
31
- {
32
- "operation_type": "<one of 16 types>",
33
- "data": { /* type-specific */ },
34
- "env": { "account": "", "network": "testnet" },
35
- "submission": { /* Guard submission if needed */ }
36
- }
37
- ```
38
-
39
- **Exceptions** (no `data` wrapper):
40
- - `gen_passport`: `{ guard, info?, env? }`
41
- - `guard`, `payment`, `personal`: flat structure
42
-
43
- ### CREATE vs MODIFY Pattern
44
-
45
- See [wowok-safety](../wowok-safety/SKILL.md) for complete object reuse principles.
46
-
47
- | Format | Meaning | Example |
48
- |--------|---------|---------|
49
- | **String** | Reference EXISTING (reuse) | `"my-service"` or `"0x1234..."` |
50
- | **Object** | CREATE NEW | `{ name: "my-service", permission: "..." }` |
51
-
52
- ---
53
-
54
- ## The 13 Tools
55
-
56
- | Tool | Purpose | Key Pattern |
57
- |------|---------|-------------|
58
- | `onchain_operations` | Write state (16 types) | Discriminated by `operation_type` |
59
- | `query_toolkit` | Read on-chain data | 8 query types |
60
- | `onchain_table_data` | Query sub-items | Dynamic field access |
61
- | `account_operation` | Wallet management | 100% local |
62
- | `local_mark_operation` | Name→address mappings | 100% local |
63
- | `local_info_operation` | Private data store | 100% local |
64
- | `messenger_operation` | Encrypted messaging | Hybrid (see messenger skill) |
65
- | `wip_file` | Witness promise files | Generate/verify/sign |
66
- | `guard2file` | Export Guard definition | Read-only |
67
- | `machineNode2file` | Export Machine nodes | Read-only |
68
- | `onchain_events` | Watch events | Paginated |
69
- | `wowok_buildin_info` | Protocol constants | Reference data |
70
- | `documents_and_learn` | Documentation URLs | Learning resources |
71
-
72
- ---
73
-
74
- ## Critical Patterns by Operation
27
+ ## Core Rules
75
28
 
76
- ### service Business Listing
29
+ ### Structural Wrapper Rules
77
30
 
78
- **Immutable After Publish**: `machine`, `order_allocators`
79
- **Mutable Always**: `sales`, `discount`, `description`, `location`
80
- **Add-Only After Publish**: `rewards`, `arbitrations`
31
+ Most `onchain_operations` branches use `{ operation_type, data: {...}, env?, submission? }`. Three exceptions:
81
32
 
82
- **Common Pitfall**: Forgetting `publish: true` leaves machine/allocators changeable — risky for production.
33
+ | Branch | Difference |
34
+ |--------|-----------|
35
+ | `gen_passport` | No `data` wrapper — `guard`/`info` at top level |
36
+ | `payment`, `personal` | Has `data` but NO `submission` field |
83
37
 
84
- ### machine Workflow Template
38
+ ### CREATE vs MODIFY
85
39
 
86
- **Key Insight**: Machine defines WHO can advance (via `namedOperator`). Empty string = Order-operable; non-empty = requires Permission.
40
+ > [wowok-safety](../wowok-safety/SKILL.md) §1.1 **String** = REUSE existing object, **Object** = CREATE new one. SDK-enforced via `GetObjectExisted()`, not Move-level.
87
41
 
88
- **Publish Effect**: Makes nodes immutable. Essential before Service references it.
42
+ ### Permission Index Model
89
43
 
90
- ### progress Advancement
44
+ Every object creation requires a Permission object. **Strongly recommended**: reuse a single Permission across all services for centralized control. Custom indices range 1000–65535; built-in 0–999 are reserved. The SDK auto-creates a Permission if you pass an object shape.
91
45
 
92
- **Dual Paths**:
93
- - `node`: Single step
94
- - `nodes`: Multi-step array
46
+ ### Witness Conversion (`convert_witness`)
95
47
 
96
- **Guard Integration**: Forward transitions may require Guard validationsee [wowok-machine](../wowok-machine/SKILL.md).
48
+ When a Guard queries a related object (e.g., Progress from an Order), `convert_witness` transforms a submitted ID to the target type. Type compatibility is validated at Guard creation time by the Move contract mismatches cause creation failure.
97
49
 
98
- ### guard — Immutable Validation
50
+ ### Immutability
99
51
 
100
- **CRITICAL**: Guards are CREATE-ONLY. No modification after deployment.
52
+ | Object | Locked When | Recovery |
53
+ |--------|------------|----------|
54
+ | Guard | After creation | Create new, update all refs |
55
+ | Machine (nodes) | After publish | Create new Machine, rebind Service |
56
+ | Service `machine`/`order_allocators` | After publish | Create new Service |
57
+ | Passport | After generation | Regenerate with `gen_passport` |
58
+ | Payment | After transfer | Irreversible — no protocol refund |
101
59
 
102
- **Update Strategy**: `guard2file` → modify locally → create new Guard → update all references.
60
+ ### Submission Loop (Two-Phase)
103
61
 
104
- See [wowok-guard](../wowok-guard/SKILL.md) for complete GuardNode reference and design patterns.
62
+ When an `onchain_operations` call requires Guard validation, the SDK returns a **submission prompt** — a structured request for the data the Guard needs to evaluate. This is a two-phase pattern:
105
63
 
106
- ### order Customer Operations
64
+ 1. **Phase 1**: Call `onchain_operations` **without** the `submission` field. If a Guard requires input, the response returns a submission prompt.
65
+ 2. **Phase 2**: Present the prompt to the user, collect their inputs, then **re-call** the SAME `onchain_operations` with the `submission` field populated.
107
66
 
108
- **Key Distinction**: Order is builder-owned; agents can operate but **CANNOT withdraw**.
67
+ This applies whenever `submission` is listed in the structural wrapper (i.e., all branches except `gen_passport`, `payment`, `personal`). For `gen_passport`, each Guard's submission is passed independently via `info`.
109
68
 
110
- **Arbitration Flow**: `arb_confirm` → `arb_objection` → `arb_claim_compensation` (all via Order)
69
+ ### First-Guard-Wins
111
70
 
112
- See [wowok-order](../wowok-order/SKILL.md) for customer-side arbitration operations.
71
+ Ordered Guard evaluation where **the first Guard returning `true` wins** applies to:
72
+ - `service`: `order_allocators[].allocators[]`
73
+ - `allocation`: evaluated modes (Amount → Rate → Surplus)
74
+ - `demand`: presenter submission filtering
113
75
 
114
- ### gen_passport — Credential Generation
76
+ ---
115
77
 
116
- **Single or Multiple**: One Guard (string) or multiple Guards (array)
78
+ ## The 13 Tools
117
79
 
118
- **Use Case**: Off-chain permission verification, voting eligibility, access control.
80
+ ### 1. `onchain_operations` 16 Sub-Types
81
+
82
+ > **Schema**: `schema_query({ name: "onchain_operations" })` for the full discriminated union. Per-type schemas: `onchain_operations_service`, `onchain_operations_machine`, etc.
83
+
84
+ | `operation_type` | Schema-Inexpressible Constraints |
85
+ |-----------------|----------------------------------|
86
+ | `service` | `machine` field must reference a **published** Machine. Allocators evaluated in array order (first-Guard-wins). Publish locks `machine`/`order_allocators`; `sales`/`discount`/`description` remain mutable. |
87
+ | `machine` | Nodes immutable after publish. Forward requires ≥1 of `namedOperator`/`permissionIndex` (both empty = SDK error). Weight `u16` (0–65535), threshold `u32`. `""` = entry node. Full lifecycle → [wowok-machine](../wowok-machine/SKILL.md). |
88
+ | `progress` | Two-phase advancement: `hold: true` (lock) → `hold: false` (submit). `adminUnhold: true` force-releases others' locks. SDK fetches Machine internally when resolving `object_address`. |
89
+ | `arbitration` | MAX 20 propositions, 520 voters. Non-Finished withdrawal triggers 30-day mandatory wait. Verdict (state 2→3) is **irreversible** by arbitrator — only customer can object via `order.arb_objection`. Voting weight from Guard `b_submission:true` must be numeric (U8–U256→u32). Full workflow → [wowok-arbitrator](../wowok-arbitrator/SKILL.md). |
90
+ | `guard` | Two creation modes: `root.type: "node"` (inline) or `"file"` (from JSON/Markdown). MAX 4 `rely` dependencies. Guards with `rep: false` **excluded** from other Guards' `rely` lists. Global system addresses (`0xaab` EntityRegistrar, `0xaaa` EntityLinker) require table entries. Full design → [wowok-guard](../wowok-guard/SKILL.md). |
91
+ | `gen_passport` | MAX 20 Guards/call (AND-ed — all must pass). Omit `info` to auto-fetch submissions from Guards. Passport frozen after creation (immutable credential). Usage → [wowok-guard](../wowok-guard/SKILL.md). |
92
+ | `order` | Builder-owned: agents can operate but **cannot withdraw** — only builder receives funds. `order.progress` with Guard requires Passport (mandatory, not bypassable). Arbitration via `order.arb_confirm`/`arb_objection` (not via `arbitration` directly). `arb_claim_compensation` once-only, from Service's compensation fund. Full flow → [wowok-order](../wowok-order/SKILL.md). |
93
+ | `payment` | `type_parameter` required (e.g., `"0x2::wow::WOW"`). Irreversible — no refund mechanism. |
94
+ | `personal` | **Permanently public** — no private field exists. Warn users before writing sensitive data. |
95
+ | `demand` | Guard-gated: `guards` filter which presenters can submit solutions. Separate from Service. |
96
+ | `treasury` | Guardable deposits (`external_deposit_guard`) and withdrawals (`external_withdraw_guard`). Each entry creates a Payment record in history table for auditability. |
97
+ | `repository` | Composite key: `name + entity` (address or number). Guardable writes validate both writer eligibility and data content. |
98
+ | `reward` | `guard_add` AmountType: `Fixed` (equal) or `GuardU64Identifier` (dynamic from submission). `guard_expiration_time` freezes the Guard list; `null` to remove. |
99
+ | `allocation` | Auto-executes on Progress advancement; modes evaluated in order (Amount → Rate → Surplus), first-Guard-wins per mode. |
100
+ | `contact` | Bridge between Service (`um` field) and Messenger: holds `ims[]` (messenger addresses). |
101
+ | `permission` | Indices 0–65535 (0–999 reserved for protocol; custom ≥1000). SDK rejects custom below 1000. Reuse across objects. |
119
102
 
120
103
  ---
121
104
 
122
- ## Common Pitfalls
123
-
124
- ### 1. Wrong Discriminated Union Branch
105
+ ### 2. `query_toolkit` — Read (Local + On-Chain)
125
106
 
126
- **Symptom**: "Invalid data structure" errors
127
- **Cause**: Using `service` schema for `order` operation
128
- **Fix**: Match `operation_type` exactly to schema
107
+ 9 query types. Schema-inexpressible: `token_list` is **cached** (populated on first query). `account_balance` dual-mode: `balance=true` for totals, `coin={cursor,limit}` for paginated coin objects. `onchain_objects` batches 50/request internally. `local_names` resolves to account names AND local marks simultaneously.
129
108
 
130
- ### 2. CREATE vs MODIFY Confusion
109
+ ### 3. `onchain_table_data` Dynamic Table Queries
131
110
 
132
- **Symptom**: Creates duplicate objects instead of modifying
133
- **Cause**: Passing object shape when string reference intended
134
- **Fix**: String = existing, Object = new
111
+ 12 query types. **Global** (no `parent`): `entity_registrar`, `entity_linker`. All others require `parent`. `onchain_table_item_generic` accepts arbitrary key types — universal fallback for custom objects.
135
112
 
136
- ### 3. Missing submission Field
113
+ ### 4. `account_operation` Wallet (ALL LOCAL)
137
114
 
138
- **Symptom**: Guard validation fails with "missing submission"
139
- **Cause**: Guard requires user data but `submission` omitted
140
- **Fix**: Add `submission: { sender, info }` after first call fails
115
+ `faucet` only testnet/localnet. `gen` with `m` enables Messenger. `signData` supports UTF-8/base64/hex. `get` with `balance_required` splits existing coins (no minting). Private keys never leave the device.
141
116
 
142
- ### 4. Immutable Field After Publish
117
+ ### 5. `local_mark_operation` Address Book (ALL LOCAL)
143
118
 
144
- **Symptom**: "Cannot modify published field" error
145
- **Cause**: Attempting to change `machine` or `order_allocators` after `publish: true`
146
- **Fix**: Create new Service with corrected fields
119
+ Max 50 tags/entry (64 chars each). `replaceExistName:true` steals existing names — prefer versioned names (`_v1`, `_v2`).
147
120
 
148
- ### 5. Wrong Tool Selection
121
+ ### 6. `local_info_operation` Private Data (ALL LOCAL)
149
122
 
150
- | Task | Wrong Tool | Correct Tool |
151
- |------|-----------|--------------|
152
- | Query object state | `onchain_operations` | `query_toolkit` |
153
- | Send message | `onchain_operations` | `messenger_operation` |
154
- | Check name availability | `query_toolkit` | `local_mark_operation` |
155
- | Export Guard logic | `query_toolkit` | `guard2file` |
123
+ Max 50 contents/entry, 300 chars each.
156
124
 
157
125
  ---
158
126
 
159
- ## Troubleshooting Guide
160
-
161
- ### "Schema not found"
162
-
163
- **Action**: `schema_query({ action: "get", name: "<tool_name>" })`
164
-
165
- ### "Invalid parameter format"
166
-
167
- **Checklist**:
168
- 1. Correct `operation_type`?
169
- 2. CREATE vs MODIFY format correct?
170
- 3. Required fields present?
171
- 4. `submission` needed for Guard?
127
+ ### 7. `messenger_operation` — Encrypted Messaging
172
128
 
173
- ### "Permission denied"
129
+ **Stranger rules** (not in schema): 1 message before reply required (max ~480 chars); reply auto-adds stranger to friends; cool-down window after rejection.
174
130
 
175
- **Causes**:
176
- - Not object owner
177
- - Missing Permission reference
178
- - Guard validation failed
131
+ **Guard flow** (not in schema): When guard blocks a stranger message, rejection reply includes guard list — sender must obtain valid Passport to resend.
179
132
 
180
- ### Tool-Specific Errors
181
-
182
- | Error | Likely Cause | Solution |
183
- |-------|-------------|----------|
184
- | "Object not found" | Wrong address or not created | Verify with `query_toolkit` |
185
- | "Name already exists" | `replaceExistName: false` | Set `replaceExistName: true` or choose new name |
186
- | "Guard validation failed" | Missing/incorrect `submission` | Add proper `submission` field |
187
- | "Insufficient balance" | Account lacks funds | Check with `account_operation` |
188
- | "Deadline passed" | Timestamp in past | Use future timestamp |
133
+ **WTS** (not in schema): `generate` requires continuous sequences (gaps break chain). `verify` → `sign` → `wts2html` pipeline. `proof_message` anchors to blockchain. Full design → [wowok-messenger](../wowok-messenger/SKILL.md).
189
134
 
190
135
  ---
191
136
 
192
- ## Schema Access
193
-
194
- ```javascript
195
- // Get any tool schema
196
- schema_query({ action: "get", name: "onchain_operations" })
197
- schema_query({ action: "get", name: "query_toolkit" })
198
- schema_query({ action: "get", name: "messenger_operation" })
199
- // ... etc for all 13 tools
200
- ```
137
+ | # | Tool | Schema-Inexpressible |
138
+ |---|------|---------------------|
139
+ | 8 | `wip_file` | `verify` checks hash → signatures stepwise. `wip2html` accepts single file or directory. |
140
+ | 9 | `guard2file` | Read-only export to JSON/Markdown. |
141
+ | 10 | `machineNode2file` | Read-only; exports complete topology. |
142
+ | 11 | `onchain_events` | 6 event types; paginated via cursor `{eventSeq, txDigest}`. |
143
+ | 12 | `wowok_buildin_info` | 5 info types. Guard instructions filter by `name`/`return_type`/`param_count`. **Never use Value type 19** (internal, SDK rejects). |
144
+ | 13 | `schema_query` | `list` returns empty if schemas not generated → run `npm run generate:schemas`. |
201
145
 
202
146
  ---
203
147
 
204
- ## Design Principles
148
+ ## Decision Tree
205
149
 
206
- 1. **Immutability First**: Guards, published Machines — design carefully, no updates
207
- 2. **Explicit Over Implicit**: Always specify `operation_type`, never rely on defaults
208
- 3. **Validate Before Execute**: Use `query_toolkit` to check state before operations
209
- 4. **Local for Private**: Sensitive data `local_info_operation`, never on-chain
210
- 5. **Schema as Source**: When in doubt, query schema — don't guess parameter formats
150
+ ```
151
+ Write state? onchain_operations (choose operation_type)
152
+ ├── No data wrapper? only gen_passport
153
+ ├── No submission? only payment, personal
154
+ └── String (MODIFY) vs Object (CREATE)? safety §1.1
155
+
156
+ Read state? → query_toolkit / onchain_table_data
157
+ Communicate? → messenger_operation (encrypted)
158
+ Local only? → account_operation / local_mark_operation / local_info_operation
159
+ Export? → guard2file / machineNode2file
160
+ Discover? → schema_query / wowok_buildin_info / onchain_events
161
+ ```
211
162
 
212
163
  ---
213
164
 
214
- ## Quick Decision Tree
165
+ ## Common Pitfalls
215
166
 
216
- ```
217
- Need to change on-chain state?
218
- ├── YES onchain_operations
219
- │ └── Which type? (service, machine, order, guard, etc.)
220
- ├── NO, just queryquery_toolkit
221
- │ └── Object state or table data?
222
- ├── NO, communicate messenger_operation
223
- ├── NO, manage wallet account_operation
224
- └── NO, export definition guard2file / machineNode2file
225
- ```
167
+ | Trap | Fix |
168
+ |------|-----|
169
+ | `gen_passport` called as standalone tool | It's not — use `onchain_operations` with `operation_type: "gen_passport"` |
170
+ | Missing `data` wrapper | Only `gen_passport` omits it; `payment`/`personal` omit `submission` |
171
+ | String `object` passed expecting CREATE | String = existing (MODIFY), Object = new (CREATE) [safety §1.1](../wowok-safety/SKILL.md) |
172
+ | Missing `submission` on Guard call | See [Submission Loop](#submission-loop-two-phase) — two-phase pattern: call without `submission` first, collect data, re-call with it |
173
+ | Publishing before all deps ready | Guard/Machine immutable after create/publish. Test via `gen_passport` before finalizing |
174
+ | `demand` via `service` operation_type | Separate `operation_type: "demand"` — Demand posts are not Services |
175
+ | Arbitration called directly | Customer path: `order.arb_confirm` / `order.arb_objection`. Order is the interface |