@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,499 +1,385 @@
1
- ---
1
+ ---
2
2
  name: wowok-order
3
3
  description: |
4
- WoWok order lifecycle management covers the complete order flow from
5
- creation through payment, progress tracking, completion, and dispute
6
- resolution. Includes order splitting (Allocation), incentive distribution
7
- (Reward), and arbitration patterns.
4
+ WoWok Customer Guide — complete order lifecycle for buyers: service evaluation,
5
+ consensus building, order creation, progress tracking, and dispute resolution.
8
6
 
9
- Use this skill when managing orders, setting up payment flows, configuring
10
- order splitting, or handling disputes.
7
+ Covers the full buyer journey: pre-purchase due diligence based on on-chain objects, consensus establishment with Messenger as off-chain
8
+ but self-verifiable evidence supplement, order operations, progress advancement
9
+ with game theory, and arbitration when needed.
11
10
  when_to_use:
12
- - User wants to create or manage orders
13
- - User asks about order lifecycle, payment, or progress
14
- - User needs to set up order splitting (allocation) or incentives (reward)
15
- - User mentions "order", "payment", "allocation", "reward", "arbitration", "dispute"
16
- - User wants to understand how money flows in WoWok
11
+ - User is a customer/buyer placing or managing orders
12
+ - User wants to evaluate services before purchasing
13
+ - User needs to communicate with sellers via Messenger
14
+ - User asks about order progress, payments, or refunds
15
+ - User wants to file disputes or arbitration claims
16
+ - User mentions "buy", "order", "purchase", "refund", "dispute", "arbitration"
17
17
  ---
18
18
 
19
- # WoWok Order Lifecycle Management
19
+ # WoWok Customer Guide
20
20
 
21
- ## Order Lifecycle Overview
21
+ Complete guide for buyers on WoWok — from service discovery to order completion.
22
22
 
23
- ```
24
- Demand Order Payment → Progress → Completion
25
-
26
- Arbitration (disputes)
27
- ```
23
+ > **Role**: Customer (Buyer/Order Holder)
24
+ > **Provider Guide**: See [wowok-provider](../wowok-provider/SKILL.md)
25
+ > **Arbitration Guide**: See [wowok-arbitrator](../wowok-arbitrator/SKILL.md)
26
+ > **Messenger**: See [wowok-messenger](../wowok-messenger/SKILL.md) for encrypted communication
27
+ > **Tools**: See [wowok-tools](../wowok-tools/SKILL.md)
28
28
 
29
- ## Component Relationships
29
+ ---
30
30
 
31
- ```
32
- Service (marketplace)
33
- ├── Machine (workflow template)
34
- ├── Allocation (order splitting rules)
35
- ├── Reward (incentive pool)
36
- └── Treasury (team fund)
37
-
38
- Order (instance)
39
- ├── references Service
40
- ├── references Machine (for workflow)
41
- ├── Payment (funds transfer)
42
- └── Progress (workflow tracking)
43
- ```
31
+ ## Core Concepts
44
32
 
45
- ## Order Creation
33
+ ### Order Lifecycle Objects
46
34
 
47
- ```
48
- onchain_operations({
49
- operation_type: "order",
50
- data: {
51
- op: "create",
52
- service: "<service_name_or_id>",
53
- machine: "<machine_name_or_id>",
54
- buyer: "<buyer_address>",
55
- seller: "<seller_address>",
56
- price: "<amount>",
57
- token_type: "<token_type>",
58
- ...
59
- }
60
- })
61
- ```
35
+ When you purchase from a Service, three runtime objects are created:
62
36
 
63
- ## Payment Flow
37
+ | Object | Purpose | Key Points |
38
+ |--------|---------|------------|
39
+ | **Order** | Fund escrow & ownership | You are the `builder` (owner). Agents can help operate but **only you can withdraw funds**. |
40
+ | **Progress** | Workflow state tracking | Tracks which Machine node you're at. Advanced via Order operations. |
41
+ | **Allocation** | Fund distribution engine | Executes the winning allocator strategy when reaching exit nodes. |
64
42
 
65
- ### Direct Payment
66
- ```
67
- onchain_operations({
68
- operation_type: "payment",
69
- data: {
70
- op: "send",
71
- from: "<sender_account>",
72
- to: "<recipient_address>",
73
- amount: "<amount>",
74
- token_type: "<token_type>"
75
- }
76
- })
77
- ```
43
+ ### Allocators vs Allocation
78
44
 
79
- ### Payment via Order
80
- Orders can hold funds in escrow. Payment is released when order progresses through the Machine workflow.
45
+ - **Allocators** (Service level): Multiple distribution strategies defined by seller, each with a Guard condition
46
+ - **Allocation** (Order level): Auto-created execution engine that evaluates all allocator Guards and runs the strategy whose Guard returns `true`
81
47
 
82
- ## Order Splitting (Allocation)
48
+ **When Allocation Executes**:
49
+ - Allocation evaluates **whenever the Progress reaches a node** that triggers fund distribution
50
+ - **Any node** (not just exit nodes) can be configured to trigger Allocation evaluation
51
+ - The winning allocator is the one whose Guard validates `true` for the current state
52
+ - Guards can check: Progress node, time elapsed, signatures, or any on-chain data
83
53
 
84
- Allocation defines how order payments are automatically split among multiple recipients.
54
+ **Consensus Principle**: Allocators and their Guard conditions are immutable and transparent. Both parties see the same rules, but choose different paths based on their interests.
85
55
 
86
- ### Create Allocation
87
- ```
88
- onchain_operations({
89
- operation_type: "allocation",
90
- data: {
91
- op: "create",
92
- name: "<allocation_name>",
93
- service: "<service_id>",
94
- rules: [
95
- {
96
- recipient: "<address_or_guard>",
97
- share: <percentage_or_fixed>,
98
- discount_type: "RATES" // or "FIXED"
99
- }
100
- ]
101
- }
102
- })
103
- ```
56
+ ---
104
57
 
105
- ### Discount Types
106
- | Type | Description |
107
- |------|-------------|
108
- | `RATES` | Percentage-based split (e.g., 30% = 30/100) |
109
- | `FIXED` | Fixed amount split |
58
+ ## Phase 1: Service Evaluation (Pre-Purchase)
110
59
 
111
- ### Common Allocation Patterns
60
+ Thoroughly investigate before committing funds.
112
61
 
113
- **Pattern 1: Platform Fee**
114
- ```
115
- rules: [
116
- { recipient: "<platform_address>", share: 5, discount_type: "RATES" },
117
- { recipient: "<seller_address>", share: 95, discount_type: "RATES" }
118
- ]
119
- ```
62
+ ### 1.1 Query Service Configuration
120
63
 
121
- **Pattern 2: Multi-Party Split**
122
- ```
123
- rules: [
124
- { recipient: "<platform>", share: 3, discount_type: "RATES" },
125
- { recipient: "<seller>", share: 70, discount_type: "RATES" },
126
- { recipient: "<affiliate>", share: 27, discount_type: "RATES" }
127
- ]
128
- ```
64
+ **Tool**: Use `query_toolkit` with `onchain_objects` query type to retrieve Service configuration.
129
65
 
130
- ## Incentive Distribution (Reward)
66
+ **Schema Reference**: `schema_query({ action: "get", name: "query_toolkit" })`
131
67
 
132
- Reward defines incentive pools that distribute tokens based on Guard-validated conditions.
68
+ **Key Fields to Analyze**:
133
69
 
134
- ### Create Reward
135
- ```
136
- onchain_operations({
137
- operation_type: "reward",
138
- data: {
139
- op: "create",
140
- name: "<reward_name>",
141
- service: "<service_id>",
142
- ...
143
- }
144
- })
145
- ```
70
+ | Field | What to Check | Risk Signals |
71
+ |-------|---------------|--------------|
72
+ | `sales` | Pricing, stock, WIP files | No `wip_hash` = unverified product claims |
73
+ | `machine` | Workflow complexity | Overly complex = higher dispute risk |
74
+ | `allocators` | Fund distribution rules | Unfair splits = reconsider purchase |
75
+ | `arbitrations` | Available dispute resolution | None available = higher risk |
76
+ | `compensation_fund` | Arbitration payout capacity | Low balance = limited recourse |
146
77
 
147
- ### Reward Claim Flow
148
- 1. User meets Reward conditions (validated by Guard)
149
- 2. User claims reward `onchain_table_data` query `onchain_table_item_reward_record`
150
- 3. Tokens are distributed from the Reward pool
78
+ **WIP File Verification**:
79
+ - `wip`: URL to product description/images
80
+ - `wip_hash`: Integrity hash (if empty, auto-verified; if provided, must match)
81
+ - **This is the seller's immutable commitment on-chain** — serves as arbitration evidence
151
82
 
152
- ## Treasury Management
83
+ ### 1.2 Evaluate Service Reputation
153
84
 
154
- Treasury is a team fund for a Service.
85
+ Query the Service's EntityLinker for community endorsement data.
155
86
 
156
- ### Deposit to Treasury
157
- ```
158
- onchain_operations({
159
- operation_type: "treasury",
160
- data: {
161
- op: "deposit",
162
- service: "<service_id>",
163
- amount: "<amount>",
164
- token_type: "<token_type>"
165
- }
166
- })
167
- ```
87
+ **Tool**: `query_toolkit` with `onchain_table_item_entity_linker` query type.
168
88
 
169
- ### Withdraw from Treasury
170
- ```
171
- onchain_operations({
172
- operation_type: "treasury",
173
- data: {
174
- op: "withdraw",
175
- service: "<service_id>",
176
- amount: "<amount>",
177
- token_type: "<token_type>",
178
- recipient: "<address>"
179
- }
180
- })
181
- ```
89
+ **Key Metrics to Calculate**:
182
90
 
183
- ### Query Treasury History
184
- ```
185
- onchain_table_data({
186
- query_type: "onchain_table_item_treasury_history",
187
- parent: "<treasury_id>",
188
- address: "<payment_id>"
189
- })
190
- ```
91
+ | Metric | How to Calculate | Good Sign |
92
+ |--------|------------------|-----------|
93
+ | **Completion Rate** | % orders reaching terminal nodes | >90% |
94
+ | **Arbitration Rate** | % orders with non-empty `dispute` | <5% |
95
+ | **Avg Resolution Time** | Time from creation to completion | Short |
96
+ | **Repeat Customer Rate** | % builders appearing multiple times | High |
97
+ | **Community Sentiment** | likes vs dislikes in EntityLinker | Positive |
191
98
 
192
- ## Arbitration (Dispute Resolution)
99
+ ---
193
100
 
194
- When orders have disputes, Arbitration provides resolution.
101
+ ## Phase 2: Consensus Building (CRITICAL)
195
102
 
196
- ### Create Arbitration
197
- ```
198
- onchain_operations({
199
- operation_type: "arbitration",
200
- data: {
201
- op: "create",
202
- name: "<arbitration_name>",
203
- ...
204
- }
205
- })
206
- ```
103
+ Establish mutual understanding with seller BEFORE purchasing. Consensus is built on **immutable on-chain data** (Guard, Machine, Allocators), with Messenger serving as **off-chain but self-verifiable evidence supplement**.
207
104
 
208
- ### Watch Arbitration Events
209
- ```
210
- onchain_events({
211
- type: "arbitration",
212
- cursor: null,
213
- limit: 20
214
- })
215
- ```
105
+ ### Consensus Layers
216
106
 
217
- ## Demand (Service Requests)
107
+ | Layer | Source | Immutability | Purpose |
108
+ |-------|--------|--------------|---------|
109
+ | **On-Chain Foundation** | Service.machine, order_allocators, Guards | Immutable after publish | Transparent rules both parties agree to |
110
+ | **Off-Chain Supplement** | Messenger WTS files | Self-verifiable via signatures | Clarification, negotiation, evidence |
218
111
 
219
- Demand allows users to request services.
112
+ > **Core Principle**: On-chain data (Machine workflow, Allocator rules, Guard conditions) forms the **immutable consensus foundation**. Messenger communication provides **clarification and evidence** but cannot override on-chain rules.
220
113
 
221
- ### Create Demand
222
- ```
223
- onchain_operations({
224
- operation_type: "demand",
225
- data: {
226
- op: "create",
227
- service: "<service_id>",
228
- description: "<request_description>",
229
- ...
230
- }
231
- })
232
- ```
114
+ > **Full Messenger Guide**: See [wowok-messenger](../wowok-messenger/SKILL.md) for complete messaging operations, WTS evidence generation, and list management.
233
115
 
234
- ### Query Demand Presenters
235
- ```
236
- onchain_table_data({
237
- query_type: "onchain_table_item_demand_presenter",
238
- parent: "<demand_id>",
239
- address: "<presenter_address>"
240
- })
241
- ```
116
+ ### 2.1 Verify On-Chain Consensus First
242
117
 
243
- ## Complete Order Flow Example
118
+ Before contacting seller, thoroughly understand the immutable rules:
244
119
 
245
- ### 1. Service Setup (done once)
246
- ```
247
- Permission → Guard → Service → Machine → Allocation → Reward
248
- ```
120
+ **Tool**: `query_toolkit` with `onchain_objects` query type to retrieve Service data.
249
121
 
250
- ### 2. Order Creation (per transaction)
251
- ```
252
- 1. Buyer creates Order referencing Service + Machine
253
- 2. Buyer sends Payment to Order (escrow)
254
- 3. Seller advances Progress through Machine nodes
255
- 4. On completion, Allocation splits payment automatically
256
- 5. Reward distributes incentives if conditions met
257
- ```
122
+ **Key On-Chain Consensus Elements**:
123
+ - **Machine**: Workflow nodes and transitions — defines how order progresses
124
+ - **Allocators**: Fund distribution strategies defines who gets what under which conditions
125
+ - **Guards**: Validation logic determines which allocator executes
126
+ - **Arbitrations**: Available dispute resolution services
258
127
 
259
- ### 3. Dispute Resolution (if needed)
260
- ```
261
- 1. Either party initiates Arbitration
262
- 2. Arbiter reviews evidence
263
- 3. Arbiter resolves → funds released per resolution
264
- ```
128
+ ### 2.2 Get Service Contact
265
129
 
266
- ## Querying Order State
130
+ **Steps**:
131
+ 1. Query Service object to extract `um` field (Contact object ID)
132
+ 2. Query Contact object to retrieve `ims[]` array (Messenger addresses)
267
133
 
268
- ### Check Order Object
269
- ```
270
- query_toolkit({
271
- query_type: "onchain_objects",
272
- objects: ["<order_name_or_id>"]
273
- })
274
- ```
134
+ **Tool**: `query_toolkit` with `onchain_objects` query type.
275
135
 
276
- ### Check Order Progress
277
- ```
278
- onchain_table_data({
279
- query_type: "onchain_table",
280
- parent: "<progress_id>"
281
- })
282
- ```
136
+ ### 2.3 Send Encrypted Messages
283
137
 
284
- ### Check Received Payments
285
- ```
286
- query_toolkit({
287
- query_type: "onchain_received",
288
- name_or_address: "<object_id>"
289
- })
290
- ```
138
+ Use Messenger to clarify on-chain rules and negotiate specifics.
291
139
 
292
- ## Common Order Errors
140
+ **Tool**: `messenger_operation` with `send_message` operation.
293
141
 
294
- | Error | Cause | Fix |
295
- |-------|-------|-----|
296
- | "service not found" | Service doesn't exist | Create Service first |
297
- | "machine not found" | Machine doesn't exist | Create Machine first |
298
- | "insufficient balance" | Not enough tokens | Check balance with account_balance |
299
- | "allocation failed" | Invalid split rules | Check total shares = 100% |
300
- | "progress blocked" | Guard condition not met | Check forward Guard logic |
301
- | "arbitration not found" | No Arbiter configured | Create Arbitration object |
142
+ **Schema Reference**: `schema_query({ action: "get", name: "messenger_operation" })`
302
143
 
303
- ## Real-World Order Flows (from tested examples)
144
+ **Evidence Closure Principle**: Messages only become valid evidence when the recipient **explicitly confirms** (ARK signature). One-sided claims are not evidence.
304
145
 
305
- ### Allocation Patterns
146
+ **Why Messenger Matters** (as consensus supplement):
147
+ - ✅ End-to-end encrypted (NOT on-chain) — privacy for negotiations
148
+ - ✅ Creates tamper-proof audit trail (WTS files) — see [wowok-messenger](../wowok-messenger/SKILL.md) for WTS generation
149
+ - ✅ Clarifies on-chain rules without modifying them
150
+ - ✅ Generates arbitration evidence for off-chain commitments
306
151
 
307
- **From [Insurance](../examples/Insurance/Insurance.md) Single-Recipient Allocation**
152
+ **AI Should Proactively Suggest Clarifying**:
153
+ - Exact deliverables and acceptance criteria
154
+ - Timeline and milestones
155
+ - Edge case handling
156
+ - Refund/cancellation terms
157
+ - Delivery logistics (address, phone)
158
+ - Custom requirements
308
159
 
309
- The Insurance service uses a single allocator with 100% going to the signer who completes the claim:
160
+ **Request Explicit Confirmation**: Ensure the seller responds and confirms understanding before proceeding. Unconfirmed messages have limited evidentiary value.
310
161
 
311
- ```
312
- order_allocators: {
313
- description: "Insurance order revenue allocation",
314
- threshold: 0,
315
- allocators: [{
316
- guard: "insurance_withdraw_guard_v1",
317
- sharing: [{ who: { Signer: "signer" }, sharing: 10000, mode: "Rate" }]
318
- }]
319
- }
320
- ```
162
+ ---
321
163
 
322
- `sharing: 10000` in `mode: "Rate"` = 100% (basis points: 10000 = 100%).
164
+ ## Phase 3: Order Creation
323
165
 
324
- **From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md) Multi-Recipient Allocation**
166
+ Once consensus is reached, create the order through Service operation.
325
167
 
326
- Dual-allocation pattern: one allocator for merchant-winning scenarios, one for customer-winning scenarios:
168
+ ### 3.1 Key Parameters
327
169
 
328
- ```
329
- order_allocators: {
330
- description: "Order fund allocation",
331
- threshold: 0,
332
- allocators: [
333
- {
334
- guard: "service_merchant_win_v2",
335
- sharing: [{ who: { Signer: "signer" }, sharing: 10000, mode: "Rate" }]
336
- },
337
- {
338
- guard: "service_customer_win_v2",
339
- sharing: [{ who: { Signer: "signer" }, sharing: 10000, mode: "Rate" }]
340
- }
341
- ]
342
- }
343
- ```
170
+ **Operation**: `onchain_operations` with `operation_type: "service"`
344
171
 
345
- Each allocator's Guard validates the order's current node — if the node is "Order Complete", "Wonderful", or "Return Fail", the merchant's allocator fires. If "Lost" or "Return Complete", the customer's allocator fires.
172
+ **Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_service" })`
346
173
 
347
- ### Order Creation Patterns
174
+ **Key Parameters**:
348
175
 
349
- **From [Insurance](../examples/Insurance/Insurance.md) Order via Service**
176
+ | Parameter | Purpose | Notes |
177
+ |-----------|---------|-------|
178
+ | `buy.items` | Products to purchase | Reference `Service.sales` |
179
+ | `buy.total_pay` | Payment budget | **Excess automatically refunded** |
180
+ | `buy.discount` | Coupon object ID | Optional — see 3.1.1 below |
181
+ | `agents` | Delegated operators | Can operate order but **CANNOT withdraw funds** |
350
182
 
351
- Orders can be created directly through the Service's `order_new` field:
183
+ #### 3.1.1 Using Discount Coupons
352
184
 
353
- ```
354
- onchain_operations({
355
- operation_type: "service",
356
- data: {
357
- object: "insurance_service_v1",
358
- order_new: {
359
- buy: {
360
- items: [{ name: "Outdoor Accident Insurance", stock: 1, wip_hash: "" }],
361
- total_pay: { balance: 100000000 }
362
- },
363
- namedNewOrder: { name: "test_insurance_order_v1", replaceExistName: true }
364
- }
365
- }
366
- })
367
- ```
185
+ When creating an order via the `buy` operation, you can apply a discount coupon by including the `discount` field with the coupon name/ID.
368
186
 
369
- **From [Travel](../examples/Travel/Travel.md) Order via Service with Discount**
187
+ | `namedNewOrder` | Local name for Order | Recommended for easy reference |
188
+ | `namedNewProgress` | Local name for Progress | Recommended |
189
+ | `namedNewAllocation` | Local name for Allocation | Recommended |
370
190
 
371
- Orders can include discounts for time-limited promotions:
191
+ ### 3.2 Private Information Handling
372
192
 
373
- ```
374
- order_new: {
375
- buy: {
376
- items: [{ name: "Iceland Adventure", stock: 1 }],
377
- total_pay: { balance: 200000000 }
378
- },
379
- namedNewOrder: { name: "alice_travel_order_v1" }
380
- }
381
- ```
193
+ If Service requires private info (`customer_required`):
382
194
 
383
- ### Reward Patterns
195
+ 1. **NEVER put on-chain** — send via Messenger
196
+ 2. Include order ID in the message
197
+ 3. Confirm receipt with seller
384
198
 
385
- **From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md) Multi-Condition Rewards**
199
+ **Tool**: `messenger_operation` with `send_message` operation.
386
200
 
387
- Rewards can be added AFTER Service publish. Each reward uses a Guard to verify claim conditions:
201
+ ### 3.3 Post-Creation Notification
388
202
 
389
- ```
390
- onchain_operations({
391
- operation_type: "reward",
392
- data: {
393
- object: { name: "myshop_reward_v2", permission: "myshop_permission_v2", replaceExistName: true },
394
- description: "Reward pool for MyShop Advanced",
395
- coin_add: { balance: 100000000 },
396
- guard_add: [
397
- {
398
- guard: "reward_wonderful_v2",
399
- recipient: { Signer: "signer" },
400
- amount: { type: "Fixed", value: 10000 },
401
- expiration_time: null
402
- },
403
- {
404
- guard: "reward_lost_v2",
405
- recipient: { Signer: "signer" },
406
- amount: { type: "Fixed", value: 20000 },
407
- expiration_time: null
408
- },
409
- {
410
- guard: "reward_shipping_timeout_v2",
411
- recipient: { Signer: "signer" },
412
- amount: { type: "Fixed", value: 30000 },
413
- expiration_time: null
414
- }
415
- ]
416
- }
417
- })
418
- ```
203
+ **Mandatory**: Notify Service customer service via Messenger with order ID and submitted info reference.
204
+
205
+ ---
206
+
207
+ ## Phase 4: Order Operations
419
208
 
420
- Each guard checks the order's current node:
421
- - `reward_wonderful_v2`: order at "Wonderful" node → 10000 reward
422
- - `reward_lost_v2`: order at "Lost" node → 20000 compensation
423
- - `reward_shipping_timeout_v2`: order at "Shipping" node > 2 days → 30000 compensation
209
+ All operations use `operation_type: "order"`.
424
210
 
425
- ### Progress Advancement Patterns
211
+ **Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_order" })`
426
212
 
427
- **From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md) Progress with Submitted Data**
213
+ ### 4.1 Permission Hierarchy
428
214
 
429
- When advancing through a node that requires Guard validation with submitted data:
215
+ | Role | Can Do | Cannot Do |
216
+ |------|--------|-----------|
217
+ | **Builder** (You) | Everything + withdraw funds | — |
218
+ | **Agents** | Operate progress, arbitration, cancel | **Withdraw funds** |
219
+
220
+ > **Critical**: You maintain ultimate financial control. Agents assist but cannot access funds.
221
+
222
+ ### 4.2 Progress Advancement
223
+
224
+ **Key Rule**: As the order holder (builder), you advance progress **through the Order object**.
225
+
226
+ The Machine workflow defines who can operate each forward transition:
227
+ - **Order-operable forwards**: `namedOperator === ""` — you can execute via `order.progress`
228
+ - **Permission-operable forwards**: Require specific namespace permission — typically for Service Provider or collaborators
229
+
230
+ **Steps**:
231
+ 1. Query Order object to get `progress` (Progress ID) and `machine` (Machine ID)
232
+ 2. Query Progress object to get `current_node`
233
+ 3. Query Machine table to find valid transitions from current node
234
+
235
+ **Tools**:
236
+ - `query_toolkit` with `onchain_objects` query type
237
+ - `query_toolkit` with `onchain_table` query type
238
+
239
+ > **Note**: Service Providers or their collaborators may operate other forwards directly via Progress if the Machine design grants them permission. The Machine consensus is immutable — both parties operate within the same transparent rules.
240
+
241
+ ### 4.3 Path Selection & Game Theory
242
+
243
+ **Core Principle**: Same transparent rules, different optimal paths based on interests.
244
+
245
+ **Example Scenario**:
430
246
 
431
247
  ```
432
- onchain_operations({
433
- operation_type: "progress",
434
- data: {
435
- object: "<progress_id>",
436
- order: "<order_name>",
437
- node: { name: "Shipping", forward: 0 },
438
- pairs: [{ name: "prev_node", value: "Order Confirmed" }]
439
- }
440
- })
248
+ Current Node: "delivery_pending"
249
+ ├── Path A → "delivery_confirmed"
250
+ │ ├── Guard: buyer signs receipt
251
+ │ └── Allocation: 95% seller, 5% platform
252
+
253
+ ├── Path B "dispute_filed"
254
+ │ ├── Guard: arbitration requested
255
+ │ └── Allocation: funds frozen
256
+
257
+ └── Path C → "return_initiated"
258
+ ├── Guard: within return window
259
+ └── Allocation: 90% refund, 10% fee
441
260
  ```
442
261
 
443
- For the Shipping node (which requires a Merkle root Guard), the Guard's `table` expects a submitted Merkle root string. The `pairs` field carries the runtime data the Guard validates.
262
+ **AI Decision Framework**:
263
+
264
+ 1. **Query all valid paths** from current node
265
+ 2. **Evaluate Guard conditions** for each path
266
+ 3. **Assess Allocation impact** (query `service.order_allocators`)
267
+ 4. **Present options** with consequences:
444
268
 
445
- ### Arbitration Patterns
269
+ | Path | Guard Required | Financial Outcome | Best For |
270
+ |------|----------------|-------------------|----------|
271
+ | A | Sign receipt | Pay seller 95% | Satisfied customer |
272
+ | B | Request arbitration | Frozen | Disputed order |
273
+ | C | Return in window | 90% refund | Unsatisfied customer |
446
274
 
447
- **From [Travel](../examples/Travel/Travel.md) — Pre-Service Arbitration**
275
+ **AI Guidance**:
276
+ - Always present ALL available paths
277
+ - Explain Guard requirements
278
+ - Map to Allocation consequences
279
+ - Recommend based on user's goals and evidence
448
280
 
449
- Arbitration can be created before the Service and bound during Service creation/update:
281
+ ---
282
+
283
+ ## Phase 5: Arbitration (When Needed)
284
+
285
+ When disputes cannot be resolved directly, use third-party Arbitration.
286
+
287
+ ### 5.1 Arbitration Process
288
+
289
+ | Step | Operation | Key Points |
290
+ |------|-----------|------------|
291
+ | 1 | `arbitration.dispute` | Create Arb object, **pay fee separately** (NOT from Order) |
292
+ | 2 | Generate WTS | Export Messenger history as tamper-proof evidence |
293
+ | 3 | Send evidence | Via Messenger to Arbitration's contact (encrypted) |
294
+ | 4 | `order.arb_confirm` | Signal "all evidence submitted" |
295
+ | 5 | Wait for voting | Arbitration organizes voters |
296
+ | 6 | `order.arb_objection` | (Optional) Object to unfavorable result |
297
+ | 7 | `order.arb_claim_compensation` | Claim payout from `service.compensation_fund` |
298
+
299
+ **Schema References**:
300
+ - `schema_query({ action: "get", name: "onchain_operations_arbitration" })`
301
+ - `schema_query({ action: "get", name: "onchain_operations_order" })`
302
+ - `schema_query({ action: "get", name: "messenger_operation" })`
303
+
304
+ ### 5.2 Key Rules
305
+
306
+ - **Multiple Arb Objects**: Can arbitrate on multiple services simultaneously
307
+ - **One Compensation**: Only ONE claim per Order (choose best result)
308
+ - **Time Sensitivity**: Long arbitration may exceed order deadlines — discuss timelines pre-purchase
309
+ - **Evidence Privacy**: WTS files verify authenticity via `messenger_operation` with `verify_wts` operation
310
+
311
+ ### 5.3 Arb Object Lifecycle
450
312
 
451
313
  ```
452
- // Create Arbitration independently:
453
- onchain_operations({
454
- operation_type: "arbitration",
455
- data: {
456
- object: { name: "travel_arbitration_v1", permission: "travel_permission_v1" },
457
- description: "Arbitration for Iceland travel service disputes"
458
- }
459
- })
460
-
461
- // Bind during Service update:
462
- onchain_operations({
463
- operation_type: "service",
464
- data: {
465
- object: "travel_service_v1",
466
- arbitrations: { op: "add", objects: ["travel_arbitration_v1"] }
467
- }
468
- })
314
+ Principal_confirming Arbitrator_confirming → Voting → Arbitrated → Objectionable → Finished/Withdrawn
469
315
  ```
470
316
 
471
- ### Sub-Order (Supply Chain) Patterns
317
+ ---
318
+
319
+ ## Fund Management
472
320
 
473
- **From [Travel](../examples/Travel/Travel.md) — Insurance Sub-Order**
321
+ ### Receiving Funds (`order.receive`)
474
322
 
475
- The Travel workflow creates a sub-order on the Insurance Service as part of its Machine progression. The "Buy Insurance" node's forward includes `forward_to_order_create` which automatically creates an order on the insurance service when the travel order reaches that node.
323
+ Extract funds sent to Order (compensation, penalties, rewards) to your wallet.
476
324
 
477
- The Insurance Service must already be deployed and published before the Travel Service creates sub-orders on it. See [wowok-build](../wowok-build/SKILL.md) Pattern C: Repository-Linked for the build order.
325
+ **Operation**: `onchain_operations` with `operation_type: "order"` and `receive` field.
478
326
 
479
- ### Order Lifecycle Summary (from tested examples)
327
+ **Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_order" })`
480
328
 
481
- ```
482
- 1. SERVICE SETUP (one-time)
483
- Permission Guard(s) Machine → Service (with allocation) → Publish
329
+ **Sources**:
330
+ - Arbitration compensation (from `service.compensation_fund`)
331
+ - Service penalties (late delivery, quality issues)
332
+ - Collaboration payments
333
+ - Direct transfers
484
334
 
485
- 2. ORDER CREATION (per transaction)
486
- onchain_operations(operation_type: "service", data: { object, order_new: { buy: { items, total_pay } } })
335
+ **Who Can Execute**: Builder and agents (but only builder receives).
487
336
 
488
- 3. PROGRESS ADVANCEMENT (multi-step)
489
- onchain_operations(operation_type: "progress", data: { object, order, node: { name, forward } })
337
+ ### Ownership Transfer (`order.transfer_to`)
490
338
 
491
- 4. FUND DISTRIBUTION (automatic on completion)
492
- Allocation fires → Payment split per allocator Guards
339
+ Transfer order ownership to new address. Requires builder permission.
493
340
 
494
- 5. REWARD CLAIMS (on trigger nodes)
495
- Reward Guard validates → tokens distributed to claimant
341
+ **Operation**: `onchain_operations` with `operation_type: "order"` and `transfer_to` field.
496
342
 
497
- 6. DISPUTE RESOLUTION (if needed)
498
- Arbitration → arb_confirm/arb_objection → resolution
499
- ```
343
+ ---
344
+
345
+ ## Quick Reference
346
+
347
+ ### Essential Schemas
348
+
349
+ | Purpose | Schema Name |
350
+ |---------|-------------|
351
+ | Service operations (purchase) | `onchain_operations_service` |
352
+ | Order operations (progress, arbitration, receive) | `onchain_operations_order` |
353
+ | Arbitration operations (dispute) | `onchain_operations_arbitration` |
354
+ | Messenger (encrypted communication) | `messenger_operation` |
355
+ | Query toolkit (object data, tables) | `query_toolkit` |
356
+
357
+ **Query Schema**: `schema_query({ action: "get", name: "<schema_name>" })`
358
+
359
+ ### Common Workflows
360
+
361
+ **Evaluate → Communicate → Purchase → Track → Complete/Dispute**
362
+
363
+ 1. Query Service → Check sales, machine, allocators, arbitrations
364
+ 2. Messenger contact → Clarify terms, save WTS
365
+ 3. Service operation → Create order with named objects
366
+ 4. Order operations → Advance progress, choose paths
367
+ 5. Receive funds or arbitration → Extract to wallet
368
+
369
+ ---
370
+
371
+ ## Safety Checklist
372
+
373
+ Before purchasing:
374
+ - [ ] Verified WIP file and product claims
375
+ - [ ] Reviewed allocators (fair distribution?)
376
+ - [ ] Checked available arbitrations
377
+ - [ ] Established Messenger contact with seller
378
+ - [ ] Clarified deliverables, timeline, refund policy
379
+ - [ ] Saved conversation as WTS evidence
380
+
381
+ Before advancing progress:
382
+ - [ ] Understand ALL available paths
383
+ - [ ] Know Guard requirements for chosen path
384
+ - [ ] Aware of Allocation consequences
385
+ - [ ] Have required evidence/proof ready