@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
@@ -1,533 +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
- ## Runtime Objects Overview
21
+ Complete guide for buyers on WoWok — from service discovery to order completion.
22
22
 
23
- After a Service is published (see [wowok-build](../wowok-build/SKILL.md)), users interact with it creating runtime objects:
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)
24
28
 
25
- | Object | Created By | Purpose |
26
- |--------|-----------|---------|
27
- | **Order** | User purchase | Order management and escrow |
28
- | **Progress** | Order creation | Workflow state tracking |
29
- | **Allocation** | Order completion | Fund distribution per consensus |
30
- | **Arb(s)** | Dispute request | Arbitration for compensation |
29
+ ---
31
30
 
32
- ```
33
- User Purchase
34
-
35
- Service ──→ Order ──→ Progress ──→ Allocation
36
- ↓ ↓
37
- Payment Node Transitions
38
- (escrow) (Guard validated)
39
-
40
- Completion
41
-
42
- Fund Distribution
43
- ```
31
+ ## Core Concepts
44
32
 
45
- ## Order Lifecycle Overview
33
+ ### Order Lifecycle Objects
46
34
 
47
- ```
48
- Demand → Order → Payment → Progress → Completion
49
-
50
- Arbitration (disputes)
51
- ```
35
+ When you purchase from a Service, three runtime objects are created:
52
36
 
53
- ## Component Relationships
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. |
54
42
 
55
- ```
56
- Service (marketplace)
57
- ├── Machine (workflow template)
58
- ├── Allocation (order splitting rules)
59
- ├── Reward (incentive pool)
60
- └── Treasury (team fund)
61
-
62
- Order (instance)
63
- ├── references Service
64
- ├── references Machine (for workflow)
65
- ├── Payment (funds transfer)
66
- └── Progress (workflow tracking)
67
- ```
43
+ ### Allocators vs Allocation
68
44
 
69
- ## Order Creation
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`
70
47
 
71
- ```
72
- onchain_operations({
73
- operation_type: "order",
74
- data: {
75
- op: "create",
76
- service: "<service_name_or_id>",
77
- machine: "<machine_name_or_id>",
78
- buyer: "<buyer_address>",
79
- seller: "<seller_address>",
80
- price: "<amount>",
81
- token_type: "<token_type>",
82
- ...
83
- }
84
- })
85
- ```
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
86
53
 
87
- ## Payment Flow
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.
88
55
 
89
- ### Direct Payment
90
- ```
91
- onchain_operations({
92
- operation_type: "payment",
93
- data: {
94
- op: "send",
95
- from: "<sender_account>",
96
- to: "<recipient_address>",
97
- amount: "<amount>",
98
- token_type: "<token_type>"
99
- }
100
- })
101
- ```
56
+ ---
102
57
 
103
- ### Payment via Order
104
- Orders can hold funds in escrow. Payment is released when order progresses through the Machine workflow.
58
+ ## Phase 1: Service Evaluation (Pre-Purchase)
105
59
 
106
- ## Order Splitting (Allocation)
60
+ Thoroughly investigate before committing funds.
107
61
 
108
- Allocation defines how order payments are automatically split among multiple recipients.
62
+ ### 1.1 Query Service Configuration
109
63
 
110
- ### Create Allocation
111
- ```
112
- onchain_operations({
113
- operation_type: "allocation",
114
- data: {
115
- op: "create",
116
- name: "<allocation_name>",
117
- service: "<service_id>",
118
- rules: [
119
- {
120
- recipient: "<address_or_guard>",
121
- share: <percentage_or_fixed>,
122
- discount_type: "RATES" // or "FIXED"
123
- }
124
- ]
125
- }
126
- })
127
- ```
64
+ **Tool**: Use `query_toolkit` with `onchain_objects` query type to retrieve Service configuration.
128
65
 
129
- ### Discount Types
130
- | Type | Description |
131
- |------|-------------|
132
- | `RATES` | Percentage-based split (e.g., 30% = 30/100) |
133
- | `FIXED` | Fixed amount split |
66
+ **Schema Reference**: `schema_query({ action: "get", name: "query_toolkit" })`
134
67
 
135
- ### Common Allocation Patterns
68
+ **Key Fields to Analyze**:
136
69
 
137
- **Pattern 1: Platform Fee**
138
- ```
139
- rules: [
140
- { recipient: "<platform_address>", share: 5, discount_type: "RATES" },
141
- { recipient: "<seller_address>", share: 95, discount_type: "RATES" }
142
- ]
143
- ```
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 |
144
77
 
145
- **Pattern 2: Multi-Party Split**
146
- ```
147
- rules: [
148
- { recipient: "<platform>", share: 3, discount_type: "RATES" },
149
- { recipient: "<seller>", share: 70, discount_type: "RATES" },
150
- { recipient: "<affiliate>", share: 27, discount_type: "RATES" }
151
- ]
152
- ```
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
153
82
 
154
- ## Incentive Distribution (Reward)
83
+ ### 1.2 Evaluate Service Reputation
155
84
 
156
- Reward defines incentive pools that distribute tokens based on Guard-validated conditions.
85
+ Query the Service's EntityLinker for community endorsement data.
157
86
 
158
- ### Create Reward
159
- ```
160
- onchain_operations({
161
- operation_type: "reward",
162
- data: {
163
- op: "create",
164
- name: "<reward_name>",
165
- service: "<service_id>",
166
- ...
167
- }
168
- })
169
- ```
87
+ **Tool**: `query_toolkit` with `onchain_table_item_entity_linker` query type.
170
88
 
171
- ### Reward Claim Flow
172
- 1. User meets Reward conditions (validated by Guard)
173
- 2. User claims reward → `onchain_table_data` query `onchain_table_item_reward_record`
174
- 3. Tokens are distributed from the Reward pool
89
+ **Key Metrics to Calculate**:
175
90
 
176
- ## Treasury Management
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 |
177
98
 
178
- Treasury is a team fund for a Service.
99
+ ---
179
100
 
180
- ### Deposit to Treasury
181
- ```
182
- onchain_operations({
183
- operation_type: "treasury",
184
- data: {
185
- op: "deposit",
186
- service: "<service_id>",
187
- amount: "<amount>",
188
- token_type: "<token_type>"
189
- }
190
- })
191
- ```
101
+ ## Phase 2: Consensus Building (CRITICAL)
192
102
 
193
- ### Withdraw from Treasury
194
- ```
195
- onchain_operations({
196
- operation_type: "treasury",
197
- data: {
198
- op: "withdraw",
199
- service: "<service_id>",
200
- amount: "<amount>",
201
- token_type: "<token_type>",
202
- recipient: "<address>"
203
- }
204
- })
205
- ```
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**.
206
104
 
207
- ### Query Treasury History
208
- ```
209
- onchain_table_data({
210
- query_type: "onchain_table_item_treasury_history",
211
- parent: "<treasury_id>",
212
- address: "<payment_id>"
213
- })
214
- ```
105
+ ### Consensus Layers
215
106
 
216
- ## Arbitration (Dispute Resolution)
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 |
217
111
 
218
- When orders have disputes, Arbitration provides resolution.
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.
219
113
 
220
- ### Create Arbitration
221
- ```
222
- onchain_operations({
223
- operation_type: "arbitration",
224
- data: {
225
- op: "create",
226
- name: "<arbitration_name>",
227
- ...
228
- }
229
- })
230
- ```
114
+ > **Full Messenger Guide**: See [wowok-messenger](../wowok-messenger/SKILL.md) for complete messaging operations, WTS evidence generation, and list management.
231
115
 
232
- ### Watch Arbitration Events
233
- ```
234
- onchain_events({
235
- type: "arbitration",
236
- cursor: null,
237
- limit: 20
238
- })
239
- ```
116
+ ### 2.1 Verify On-Chain Consensus First
240
117
 
241
- ## Demand (Service Requests)
118
+ Before contacting seller, thoroughly understand the immutable rules:
242
119
 
243
- Demand allows users to request services.
120
+ **Tool**: `query_toolkit` with `onchain_objects` query type to retrieve Service data.
244
121
 
245
- ### Create Demand
246
- ```
247
- onchain_operations({
248
- operation_type: "demand",
249
- data: {
250
- op: "create",
251
- service: "<service_id>",
252
- description: "<request_description>",
253
- ...
254
- }
255
- })
256
- ```
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
257
127
 
258
- ### Query Demand Presenters
259
- ```
260
- onchain_table_data({
261
- query_type: "onchain_table_item_demand_presenter",
262
- parent: "<demand_id>",
263
- address: "<presenter_address>"
264
- })
265
- ```
128
+ ### 2.2 Get Service Contact
266
129
 
267
- ## Complete Order Flow Example
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)
268
133
 
269
- ### 1. Service Setup (done once)
270
- ```
271
- Permission → Guard → Service → Machine → Allocation → Reward
272
- ```
134
+ **Tool**: `query_toolkit` with `onchain_objects` query type.
273
135
 
274
- ### 2. Order Creation (per transaction)
275
- ```
276
- 1. Buyer creates Order referencing Service + Machine
277
- 2. Buyer sends Payment to Order (escrow)
278
- 3. Seller advances Progress through Machine nodes
279
- 4. On completion, Allocation splits payment automatically
280
- 5. Reward distributes incentives if conditions met
281
- ```
136
+ ### 2.3 Send Encrypted Messages
282
137
 
283
- ### 3. Dispute Resolution (if needed)
284
- ```
285
- 1. Either party initiates Arbitration
286
- 2. Arbiter reviews evidence
287
- 3. Arbiter resolves → funds released per resolution
288
- ```
138
+ Use Messenger to clarify on-chain rules and negotiate specifics.
289
139
 
290
- ## Querying Order State
140
+ **Tool**: `messenger_operation` with `send_message` operation.
291
141
 
292
- ### Check Order Object
293
- ```
294
- query_toolkit({
295
- query_type: "onchain_objects",
296
- objects: ["<order_name_or_id>"]
297
- })
298
- ```
142
+ **Schema Reference**: `schema_query({ action: "get", name: "messenger_operation" })`
299
143
 
300
- ### Check Order Progress
301
- ```
302
- onchain_table_data({
303
- query_type: "onchain_table",
304
- parent: "<progress_id>"
305
- })
306
- ```
144
+ **Evidence Closure Principle**: Messages only become valid evidence when the recipient **explicitly confirms** (ARK signature). One-sided claims are not evidence.
307
145
 
308
- ### Check Received Payments
309
- ```
310
- query_toolkit({
311
- query_type: "onchain_received",
312
- name_or_address: "<object_id>"
313
- })
314
- ```
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
315
151
 
316
- ## Common Order Errors
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
317
159
 
318
- | Error | Cause | Fix |
319
- |-------|-------|-----|
320
- | "service not found" | Service doesn't exist | Create Service first |
321
- | "machine not found" | Machine doesn't exist | Create Machine first |
322
- | "insufficient balance" | Not enough tokens | Check balance with account_balance |
323
- | "allocation failed" | Invalid split rules | Check total shares = 100% |
324
- | "progress blocked" | Guard condition not met | Check forward Guard logic |
325
- | "arbitration not found" | No Arbiter configured | Create Arbitration object |
160
+ **Request Explicit Confirmation**: Ensure the seller responds and confirms understanding before proceeding. Unconfirmed messages have limited evidentiary value.
326
161
 
327
- ## Real-World Order Flows (from tested examples)
162
+ ---
328
163
 
329
- ### Allocation Patterns
164
+ ## Phase 3: Order Creation
330
165
 
331
- **From [Insurance](../examples/Insurance/Insurance.md) Single-Recipient Allocation**
166
+ Once consensus is reached, create the order through Service operation.
332
167
 
333
- The Insurance service uses a single allocator with 100% going to the signer who completes the claim:
168
+ ### 3.1 Key Parameters
334
169
 
335
- ```
336
- order_allocators: {
337
- description: "Insurance order revenue allocation",
338
- threshold: 0,
339
- allocators: [{
340
- guard: "insurance_withdraw_guard_v1",
341
- sharing: [{ who: { Signer: "signer" }, sharing: 10000, mode: "Rate" }]
342
- }]
343
- }
344
- ```
170
+ **Operation**: `onchain_operations` with `operation_type: "service"`
345
171
 
346
- `sharing: 10000` in `mode: "Rate"` = 100% (basis points: 10000 = 100%).
172
+ **Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_service" })`
347
173
 
348
- **From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md) — Multi-Recipient Allocation**
174
+ **Key Parameters**:
349
175
 
350
- Dual-allocation pattern: one allocator for merchant-winning scenarios, one for customer-winning scenarios:
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** |
351
182
 
352
- ```
353
- order_allocators: {
354
- description: "Order fund allocation",
355
- threshold: 0,
356
- allocators: [
357
- {
358
- guard: "service_merchant_win_v2",
359
- sharing: [{ who: { Signer: "signer" }, sharing: 10000, mode: "Rate" }]
360
- },
361
- {
362
- guard: "service_customer_win_v2",
363
- sharing: [{ who: { Signer: "signer" }, sharing: 10000, mode: "Rate" }]
364
- }
365
- ]
366
- }
367
- ```
183
+ #### 3.1.1 Using Discount Coupons
368
184
 
369
- 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.
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.
370
186
 
371
- ### Order Creation Patterns
187
+ | `namedNewOrder` | Local name for Order | Recommended for easy reference |
188
+ | `namedNewProgress` | Local name for Progress | Recommended |
189
+ | `namedNewAllocation` | Local name for Allocation | Recommended |
372
190
 
373
- **From [Insurance](../examples/Insurance/Insurance.md) Order via Service**
191
+ ### 3.2 Private Information Handling
374
192
 
375
- Orders can be created directly through the Service's `order_new` field:
193
+ If Service requires private info (`customer_required`):
376
194
 
377
- ```
378
- onchain_operations({
379
- operation_type: "service",
380
- data: {
381
- object: "insurance_service_v1",
382
- order_new: {
383
- buy: {
384
- items: [{ name: "Outdoor Accident Insurance", stock: 1, wip_hash: "" }],
385
- total_pay: { balance: 100000000 }
386
- },
387
- namedNewOrder: { name: "test_insurance_order_v1", replaceExistName: true }
388
- }
389
- }
390
- })
391
- ```
195
+ 1. **NEVER put on-chain** — send via Messenger
196
+ 2. Include order ID in the message
197
+ 3. Confirm receipt with seller
392
198
 
393
- **From [Travel](../examples/Travel/Travel.md) Order via Service with Discount**
199
+ **Tool**: `messenger_operation` with `send_message` operation.
394
200
 
395
- Orders can include discounts for time-limited promotions:
201
+ ### 3.3 Post-Creation Notification
396
202
 
397
- ```
398
- order_new: {
399
- buy: {
400
- items: [{ name: "Iceland Adventure", stock: 1 }],
401
- total_pay: { balance: 200000000 }
402
- },
403
- namedNewOrder: { name: "alice_travel_order_v1" }
404
- }
405
- ```
203
+ **Mandatory**: Notify Service customer service via Messenger with order ID and submitted info reference.
406
204
 
407
- ### Reward Patterns
205
+ ---
408
206
 
409
- **From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md) Multi-Condition Rewards**
207
+ ## Phase 4: Order Operations
410
208
 
411
- Rewards can be added AFTER Service publish. Each reward uses a Guard to verify claim conditions:
209
+ All operations use `operation_type: "order"`.
412
210
 
413
- ```
414
- onchain_operations({
415
- operation_type: "reward",
416
- data: {
417
- object: { name: "myshop_reward_v2", permission: "myshop_permission_v2", replaceExistName: true },
418
- description: "Reward pool for MyShop Advanced",
419
- coin_add: { balance: 100000000 },
420
- guard_add: [
421
- {
422
- guard: "reward_wonderful_v2",
423
- recipient: { Signer: "signer" },
424
- amount: { type: "Fixed", value: 10000 },
425
- expiration_time: null
426
- },
427
- {
428
- guard: "reward_lost_v2",
429
- recipient: { Signer: "signer" },
430
- amount: { type: "Fixed", value: 20000 },
431
- expiration_time: null
432
- },
433
- {
434
- guard: "reward_shipping_timeout_v2",
435
- recipient: { Signer: "signer" },
436
- amount: { type: "Fixed", value: 30000 },
437
- expiration_time: null
438
- }
439
- ]
440
- }
441
- })
442
- ```
211
+ **Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_order" })`
212
+
213
+ ### 4.1 Permission Hierarchy
214
+
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
443
234
 
444
- Each guard checks the order's current node:
445
- - `reward_wonderful_v2`: order at "Wonderful" node → 10000 reward
446
- - `reward_lost_v2`: order at "Lost" node → 20000 compensation
447
- - `reward_shipping_timeout_v2`: order at "Shipping" node > 2 days → 30000 compensation
235
+ **Tools**:
236
+ - `query_toolkit` with `onchain_objects` query type
237
+ - `query_toolkit` with `onchain_table` query type
448
238
 
449
- ### Progress Advancement Patterns
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.
450
240
 
451
- **From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md) Progress with Submitted Data**
241
+ ### 4.3 Path Selection & Game Theory
452
242
 
453
- When advancing through a node that requires Guard validation with submitted data:
243
+ **Core Principle**: Same transparent rules, different optimal paths based on interests.
244
+
245
+ **Example Scenario**:
454
246
 
455
247
  ```
456
- onchain_operations({
457
- operation_type: "progress",
458
- data: {
459
- object: "<progress_id>",
460
- order: "<order_name>",
461
- node: { name: "Shipping", forward: 0 },
462
- pairs: [{ name: "prev_node", value: "Order Confirmed" }]
463
- }
464
- })
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
465
260
  ```
466
261
 
467
- 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:
268
+
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 |
274
+
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
280
+
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" })`
468
303
 
469
- ### Arbitration Patterns
304
+ ### 5.2 Key Rules
470
305
 
471
- **From [Travel](../examples/Travel/Travel.md) Pre-Service Arbitration**
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
472
310
 
473
- Arbitration can be created before the Service and bound during Service creation/update:
311
+ ### 5.3 Arb Object Lifecycle
474
312
 
475
313
  ```
476
- // Create Arbitration independently:
477
- onchain_operations({
478
- operation_type: "arbitration",
479
- data: {
480
- object: { name: "travel_arbitration_v1", permission: "travel_permission_v1" },
481
- description: "Arbitration for Iceland travel service disputes"
482
- }
483
- })
484
-
485
- // Bind during Service update:
486
- onchain_operations({
487
- operation_type: "service",
488
- data: {
489
- object: "travel_service_v1",
490
- arbitrations: { op: "add", objects: ["travel_arbitration_v1"] }
491
- }
492
- })
314
+ Principal_confirming Arbitrator_confirming → Voting → Arbitrated → Objectionable → Finished/Withdrawn
493
315
  ```
494
316
 
495
- ### Sub-Order (Supply Chain) Patterns
317
+ ---
496
318
 
497
- **From [Travel](../examples/Travel/Travel.md) — Insurance Sub-Order**
319
+ ## Fund Management
498
320
 
499
- 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.
321
+ ### Receiving Funds (`order.receive`)
500
322
 
501
- 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.
323
+ Extract funds sent to Order (compensation, penalties, rewards) to your wallet.
502
324
 
503
- ### Order Lifecycle Summary (from tested examples)
325
+ **Operation**: `onchain_operations` with `operation_type: "order"` and `receive` field.
504
326
 
505
- ```
506
- 1. SERVICE SETUP (one-time)
507
- Permission → Guard(s) → Machine → Service (with allocation) → Publish
327
+ **Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_order" })`
508
328
 
509
- 2. ORDER CREATION (per transaction)
510
- onchain_operations(operation_type: "service", data: { object, order_new: { buy: { items, total_pay } } })
329
+ **Sources**:
330
+ - Arbitration compensation (from `service.compensation_fund`)
331
+ - Service penalties (late delivery, quality issues)
332
+ - Collaboration payments
333
+ - Direct transfers
511
334
 
512
- 3. PROGRESS ADVANCEMENT (multi-step)
513
- onchain_operations(operation_type: "progress", data: { object, order, node: { name, forward } })
335
+ **Who Can Execute**: Builder and agents (but only builder receives).
514
336
 
515
- 4. FUND DISTRIBUTION (automatic on completion)
516
- Allocation fires → Payment split per allocator Guards
337
+ ### Ownership Transfer (`order.transfer_to`)
517
338
 
518
- 5. REWARD CLAIMS (on trigger nodes)
519
- Reward Guard validates → tokens distributed to claimant
339
+ Transfer order ownership to new address. Requires builder permission.
520
340
 
521
- 6. DISPUTE RESOLUTION (if needed)
522
- Arbitration → arb_confirm/arb_objection → resolution
523
- ```
341
+ **Operation**: `onchain_operations` with `operation_type: "order"` and `transfer_to` field.
524
342
 
525
343
  ---
526
344
 
527
- ## Payments & Refunds Rules
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
+ ---
528
370
 
529
- - **Service purchase**: Always pay through `Service`. Name the generated `Order`, `Progress`, and `Allocation` via `namedNew*` fields for easy management.
530
- - **Order operations**: All order user operations MUST go through the `Order` object — do not operate on `Progress` directly for order-related actions.
531
- - **Refunds/withdrawals**: Users satisfy `Allocation` Guard conditions to withdraw instantly.
532
- - **Arbitration claims**: Compensation payouts go through `Order`.
533
- - **Alternative payments**: `account_operation (transfer)` for direct wallet-to-wallet, or `onchain_operations (payment)` for commercial features (purpose tracking, Guard validation).
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