@wowok/skills 1.1.0 → 1.1.2
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.
- package/README.md +16 -20
- package/dist/cli.js +114 -19
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/skills.d.ts +46 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +154 -16
- package/dist/skills.js.map +1 -1
- package/dist/types.d.ts +31 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -8
- package/scripts/install.js +5 -3
- package/wowok-arbitrator/SKILL.md +279 -0
- package/wowok-guard/SKILL.md +143 -167
- package/wowok-machine/SKILL.md +167 -279
- package/wowok-order/SKILL.md +336 -424
- package/wowok-provider/SKILL.md +453 -0
- package/wowok-safety/SKILL.md +42 -20
- package/wowok-tools/SKILL.md +328 -343
- package/schemas/onchain_operations/_common.md +0 -406
- package/schemas/onchain_operations/_index.md +0 -196
- package/schemas/onchain_operations/allocation.md +0 -28
- package/schemas/onchain_operations/arbitration.md +0 -106
- package/schemas/onchain_operations/contact.md +0 -40
- package/schemas/onchain_operations/demand.md +0 -53
- package/schemas/onchain_operations/gen_passport.md +0 -23
- package/schemas/onchain_operations/guard.md +0 -56
- package/schemas/onchain_operations/machine.md +0 -89
- package/schemas/onchain_operations/order.md +0 -56
- package/schemas/onchain_operations/payment.md +0 -24
- package/schemas/onchain_operations/permission.md +0 -68
- package/schemas/onchain_operations/personal.md +0 -58
- package/schemas/onchain_operations/progress.md +0 -38
- package/schemas/onchain_operations/repository.md +0 -70
- package/schemas/onchain_operations/reward.md +0 -38
- package/schemas/onchain_operations/service.md +0 -78
- package/schemas/onchain_operations/treasury.md +0 -68
- package/schemas/schema-account_operation.md +0 -402
- package/schemas/schema-guard2file.md +0 -153
- package/schemas/schema-local_info_operation.md +0 -160
- package/schemas/schema-local_mark_operation.md +0 -148
- package/schemas/schema-machineNode2file.md +0 -155
- package/schemas/schema-messenger_operation.md +0 -547
- package/schemas/schema-onchain_events.md +0 -201
- package/schemas/schema-onchain_table_data.md +0 -334
- package/schemas/schema-query_toolkit.md +0 -395
- package/schemas/schema-wip_file.md +0 -240
- package/schemas/schema-wowok_buildin_info.md +0 -296
- package/wowok-build/SKILL.md +0 -139
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wowok-provider
|
|
3
|
+
description: |
|
|
4
|
+
WoWok Service Provider — the canonical skill for service providers (merchants, sellers)
|
|
5
|
+
to build, operate, and manage commercial services on WoWok.
|
|
6
|
+
|
|
7
|
+
Covers service design (WIP products, Machine workflows, Allocator strategies),
|
|
8
|
+
trust mechanisms (compensation funds, arbitration), customer attraction
|
|
9
|
+
(discounts, rewards, supply chain promises), and order fulfillment.
|
|
10
|
+
|
|
11
|
+
For customers placing orders, see wowok-order. For arbitrators, see wowok-arbitrator.
|
|
12
|
+
when_to_use:
|
|
13
|
+
- User is a service provider/merchant/seller on WoWok
|
|
14
|
+
- User wants to create a commercial service/marketplace
|
|
15
|
+
- User wants to design workflow (Machine) for order processing
|
|
16
|
+
- User wants to set up fund distribution strategies (Allocators)
|
|
17
|
+
- User wants to configure trust mechanisms (compensation, arbitration)
|
|
18
|
+
- User wants to handle order fulfillment and customer service
|
|
19
|
+
- User mentions "create service", "merchant", "seller", "provider", "workflow design", "compensation", "arbitration"
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# WoWok Service Provider Guide
|
|
23
|
+
|
|
24
|
+
Build and operate commercial services on WoWok as a service provider.
|
|
25
|
+
|
|
26
|
+
> **Role**: Service Provider (Merchant/Seller)
|
|
27
|
+
> **Prerequisites**: Understand CREATE vs MODIFY pattern — use `schema_query({ action: "get", name: "onchain_operations" })`
|
|
28
|
+
> **Customer Perspective**: See [wowok-order](../wowok-order/SKILL.md)
|
|
29
|
+
> **Arbitration**: See [wowok-arbitrator](../wowok-arbitrator/SKILL.md)
|
|
30
|
+
> **Machine Design**: See [wowok-machine](../wowok-machine/SKILL.md) for workflow details
|
|
31
|
+
> **Messenger**: See [wowok-messenger](../wowok-messenger/SKILL.md) for customer communication
|
|
32
|
+
> **Tools**: See [wowok-tools](../wowok-tools/SKILL.md)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Core Concepts
|
|
37
|
+
|
|
38
|
+
### Dependency-First Construction
|
|
39
|
+
|
|
40
|
+
Commercial services MUST be built in strict dependency order. An object cannot reference another that does not yet exist.
|
|
41
|
+
|
|
42
|
+
**Build Sequence**:
|
|
43
|
+
```
|
|
44
|
+
Permission → Service (unpublished) → Machine (Nodes but unpublished) → Guards → Allocators → Reward/Arbitration → Publish Machine → Bind to Service → Publish Service
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Immutability Rules**:
|
|
48
|
+
| Object | When Immutable | Impact |
|
|
49
|
+
|--------|---------------|--------|
|
|
50
|
+
| **Guard** | After creation | CREATE-only, cannot modify |
|
|
51
|
+
| **Machine** | After `publish: true` | Nodes locked, workflow frozen |
|
|
52
|
+
| **Service** | After `publish: true` | `machine` and `order_allocators` locked |
|
|
53
|
+
|
|
54
|
+
### CREATE vs MODIFY Pattern
|
|
55
|
+
|
|
56
|
+
The unified pattern across all operations:
|
|
57
|
+
- **Object shape** (`{ name?, ... }`) = **CREATE** new object
|
|
58
|
+
- **String value** (`"<name>"`) = **MODIFY** existing object
|
|
59
|
+
|
|
60
|
+
**Schema Reference**: `schema_query({ action: "get", name: "onchain_operations" })`
|
|
61
|
+
|
|
62
|
+
### Key Object Relationships
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
Service (merchant storefront)
|
|
66
|
+
├── machine → Machine (workflow definition)
|
|
67
|
+
├── order_allocators → Allocators (fund distribution rules)
|
|
68
|
+
├── arbitrations → Arbitration[] (dispute resolution options)
|
|
69
|
+
├── compensation_fund → Customer protection pool
|
|
70
|
+
├── sales → SalesItem[] (products with WIP files)
|
|
71
|
+
├── discount → Discount[] (coupons)
|
|
72
|
+
├── rewards → Reward[] (order/user behavior incentives)
|
|
73
|
+
└── um → Contact (customer service)
|
|
74
|
+
|
|
75
|
+
Order (created per purchase)
|
|
76
|
+
├── builder → Customer (order owner)
|
|
77
|
+
├── progress → Progress (workflow state)
|
|
78
|
+
└── allocation → Allocation (fund distribution engine)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Phase 1: Service Design (Commercial Intent)
|
|
84
|
+
|
|
85
|
+
Design your service offering before building. This phase defines what customers see and how orders flow.
|
|
86
|
+
|
|
87
|
+
### 1.1 Product Promise (WIP Files)
|
|
88
|
+
|
|
89
|
+
WIP (Witness Information Promise) files are **immutable product commitments** — your on-chain promise to customers.
|
|
90
|
+
|
|
91
|
+
**Creating WIP Files**:
|
|
92
|
+
|
|
93
|
+
**Tool**: `wip_file` with `type: "generate"` operation.
|
|
94
|
+
|
|
95
|
+
**Schema Reference**: `schema_query({ action: "get", name: "wip_file" })`
|
|
96
|
+
|
|
97
|
+
**Key Parameters**:
|
|
98
|
+
- `options.markdown_text`: Product description in markdown format
|
|
99
|
+
- `options.images`: Array of image sources for product visuals
|
|
100
|
+
- `outputPath`: Output file path for generated WIP file
|
|
101
|
+
|
|
102
|
+
**Attaching to Service**:
|
|
103
|
+
|
|
104
|
+
**Operation**: `onchain_operations` with `operation_type: "service"`.
|
|
105
|
+
|
|
106
|
+
**Key Fields**:
|
|
107
|
+
- `sales.op`: Operation type ("add", "set", "remove")
|
|
108
|
+
- `sales.sales`: Array of sales items, each with:
|
|
109
|
+
- `name`: Product name
|
|
110
|
+
- `price`: Price in token units
|
|
111
|
+
- `stock`: Available quantity
|
|
112
|
+
- `wip`: URL to WIP file (your official site, GitHub, etc.)
|
|
113
|
+
- `wip_hash`: SHA256 hash of WIP file for verification (default: `""`, uses hash embedded in WIP file unless explicitly set for verification)
|
|
114
|
+
|
|
115
|
+
**Why WIP Matters**:
|
|
116
|
+
- **Immutable commitment**: Hashed and signed on-chain
|
|
117
|
+
- **Arbitration evidence**: Disputes resolved against your WIP claims
|
|
118
|
+
- **Customer trust**: Transparent specifications reduce uncertainty
|
|
119
|
+
- **Legal protection**: Tamper-proof record of promises
|
|
120
|
+
|
|
121
|
+
### 1.2 Service Workflow (Machine Design)
|
|
122
|
+
|
|
123
|
+
Machine defines your **service process** — from order creation to completion. Design from a **commercial intent** perspective, not technical implementation.
|
|
124
|
+
|
|
125
|
+
**Key Design Questions**:
|
|
126
|
+
1. **Service stages**: What are the key milestones? (e.g., confirmed → processing → shipped → delivered)
|
|
127
|
+
2. **Validation points**: Where do you need customer confirmation or external verification?
|
|
128
|
+
3. **Branching paths**: What happens on success vs. failure? (e.g., on-time vs. late delivery)
|
|
129
|
+
4. **Fund release triggers**: At which nodes and how to allocate order funds?
|
|
130
|
+
|
|
131
|
+
**Integration with Allocators**:
|
|
132
|
+
- Each terminal node should map to an allocator strategy
|
|
133
|
+
- Guards determine which allocator executes
|
|
134
|
+
- Design Machine and Allocators together for coherent fund flow
|
|
135
|
+
|
|
136
|
+
> **Implementation**: See [wowok-machine](../wowok-machine/SKILL.md) for node definition syntax, Guard conditions, and Forward configurations.
|
|
137
|
+
|
|
138
|
+
### 1.3 Fund Distribution Strategy (Allocators)
|
|
139
|
+
|
|
140
|
+
Allocators define **who gets what** under different outcomes. Design these alongside your Machine workflow.
|
|
141
|
+
|
|
142
|
+
**Allocator + Machine Integration**:
|
|
143
|
+
```
|
|
144
|
+
"delivered" → "order_complete" (threshold: 1)
|
|
145
|
+
└── Forward: "customer_signed" (weight: 1)
|
|
146
|
+
└── Allocator: "completed" → 95% merchant, 5% platform
|
|
147
|
+
|
|
148
|
+
"delivered" → "package_lost" (threshold: 2)
|
|
149
|
+
├── Forward: "customer_reports_lost" (weight: 1)
|
|
150
|
+
├── Forward: "merchant_confirms_lost" (weight: 1)
|
|
151
|
+
└── Allocator: "package_lost" → 100% to order (buyer can withdraw)
|
|
152
|
+
|
|
153
|
+
Note: Arbitration is an independent action that can be triggered at any time.
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Allocation Modes** (3 types, executed in order):
|
|
157
|
+
1. **Amount**: Fixed allocation amount (U64) for each recipient
|
|
158
|
+
2. **Rate**: Percentage in basis points (10000 = 100%, 500 = 5%)
|
|
159
|
+
- If no Surplus defined, sum of all Rates must equal 10000 (100%)
|
|
160
|
+
3. **Surplus**: Receives remaining funds (maximum one per allocator)
|
|
161
|
+
|
|
162
|
+
**How Allocation Executes**:
|
|
163
|
+
- When an allocator Guard returns `true`, funds are distributed immediately per that allocator's `sharing` rules. If multiple Guards may evaluate to `true`, query and compare their validation logic and `sharing` rules to determine the most favorable outcome for your interests.
|
|
164
|
+
|
|
165
|
+
**Query Guard Logic**: Use `query_toolkit` with `query_type: "onchain_objects"` to query Guard objects by ID or name. Retrieve detailed validation logic including required node conditions, evidence submissions, and permission checks.
|
|
166
|
+
|
|
167
|
+
**Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_service" })` — look for `order_allocators` field
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Phase 2: Trust Mechanisms (Customer Confidence)
|
|
172
|
+
|
|
173
|
+
Configure mechanisms that assure customers they can trust your service.
|
|
174
|
+
|
|
175
|
+
### 2.1 Compensation Fund (compensation_fund)
|
|
176
|
+
|
|
177
|
+
A **dedicated pool** that pays customers if arbitration rules in their favor. Demonstrates your commitment to fair resolution.
|
|
178
|
+
|
|
179
|
+
**Setting Up Compensation Fund**:
|
|
180
|
+
|
|
181
|
+
**Operation**: `onchain_operations` with `operation_type: "service"`.
|
|
182
|
+
|
|
183
|
+
**Key Fields**:
|
|
184
|
+
- `compensation_fund_add`: Add funds to compensation pool (BalanceType)
|
|
185
|
+
- `setting_locked_time_add`: Lock duration in milliseconds (minimum 30 days = 2592000000ms)
|
|
186
|
+
|
|
187
|
+
**Merchant Commitment (Constraint)**:
|
|
188
|
+
```
|
|
189
|
+
Merchant withdrawal constraints from compensation_fund:
|
|
190
|
+
1. Pause Service (stop accepting new orders)
|
|
191
|
+
2. Wait compensation_lock_duration (≥30 days)
|
|
192
|
+
3. Then can withdraw remaining funds via compensation_fund_receive
|
|
193
|
+
|
|
194
|
+
This commitment ensures existing orders can still claim compensation during the lock period.
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Customer-Facing Benefits**:
|
|
198
|
+
- Display `compensation_fund` balance in service listing
|
|
199
|
+
- Higher balance + longer lock = more confidence for high-value orders
|
|
200
|
+
- Shows merchant has "skin in the game" for fair resolution
|
|
201
|
+
- Customers can claim compensation via arbitration — see [wowok-order](../wowok-order/SKILL.md) for customer arbitration process
|
|
202
|
+
|
|
203
|
+
### 2.2 Arbitration Configuration
|
|
204
|
+
|
|
205
|
+
Configure which arbitration services can resolve disputes for your orders.
|
|
206
|
+
|
|
207
|
+
**Operation**: `onchain_operations` with `operation_type: "service"`.
|
|
208
|
+
|
|
209
|
+
**Key Fields**:
|
|
210
|
+
- `arbitrations.op`: Operation type ("add", "set", "remove")
|
|
211
|
+
- `arbitrations.list`: Array of Arbitration object IDs/names
|
|
212
|
+
|
|
213
|
+
**Why Multiple Arbitrations**:
|
|
214
|
+
- Customers evaluate on-chain data to choose the most trusted Arbitration from your approved list
|
|
215
|
+
- Different arbitrations may specialize (e.g., product quality vs. service delivery)
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Phase 3: Build & Publish
|
|
220
|
+
|
|
221
|
+
Execute the dependency-first build process.
|
|
222
|
+
|
|
223
|
+
### 3.1 4-Phase Build Process
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
PHASE 1 — Foundation
|
|
227
|
+
├── 1. Permission (CREATE)
|
|
228
|
+
├── 2. Service (CREATE, unpublished) — define basic info
|
|
229
|
+
└── 3. Machine (CREATE, unpublished) — define ALL nodes and transitions
|
|
230
|
+
|
|
231
|
+
PHASE 2 — Trust Layer
|
|
232
|
+
└── 4. Guards (CREATE) — schema_query({ action: "get", name: "onchain_operations_guard" }) — validate Reward claims, Allocator conditions, Machine node transitions, etc. Create all Guards needed for your workflow.
|
|
233
|
+
|
|
234
|
+
PHASE 3 — Business Logic
|
|
235
|
+
├── 5. Machine Node Guards (MODIFY Machine) — bind Guards to Machine node forwards for workflow validation at each operation
|
|
236
|
+
├── 6. Allocators (MODIFY Service) — fund distribution rules
|
|
237
|
+
├── 7. Rewards (CREATE/MODIFY Service) — optional incentive pools
|
|
238
|
+
├── 8. Arbitrations (MODIFY Service) — dispute resolution options
|
|
239
|
+
└── 9. Compensation Fund (MODIFY Service) — add funds
|
|
240
|
+
|
|
241
|
+
PHASE 4 — Publication
|
|
242
|
+
├── 10. Publish Machine — nodes become IMMUTABLE
|
|
243
|
+
├── 11. Bind Machine to Service — MODIFY Service.machine
|
|
244
|
+
└── 12. Publish Service — everything LOCKED
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### 3.2 Pre-Build Discovery
|
|
248
|
+
|
|
249
|
+
Query existing resources to avoid collisions:
|
|
250
|
+
|
|
251
|
+
**Tools**:
|
|
252
|
+
- `query_toolkit` with `query_type: "account_list"` — list account objects
|
|
253
|
+
- `query_toolkit` with `query_type: "local_mark_list"` — list local marks
|
|
254
|
+
- `query_toolkit` with `query_type: "onchain_objects"` — query specific objects
|
|
255
|
+
|
|
256
|
+
### 3.3 Reuse Existing Templates
|
|
257
|
+
|
|
258
|
+
Export from proven services instead of building from scratch:
|
|
259
|
+
|
|
260
|
+
**Tools**:
|
|
261
|
+
- `machineNode2file` — export Machine nodes to JSON file for editing
|
|
262
|
+
- `guard2file` — export Guard rules to JSON file for editing
|
|
263
|
+
|
|
264
|
+
**Schema References**:
|
|
265
|
+
- `schema_query({ action: "get", name: "machineNode2file" })`
|
|
266
|
+
- `schema_query({ action: "get", name: "guard2file" })`
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Phase 4: Customer Attraction & Incentives
|
|
271
|
+
|
|
272
|
+
Optional mechanisms to attract and retain customers.
|
|
273
|
+
|
|
274
|
+
### 4.1 Discount Coupons
|
|
275
|
+
|
|
276
|
+
Issue promotional discounts to attract new customers or reward loyal ones (AI: query `schema_query` for `onchain_operations_service` to view `discount` field definitions).
|
|
277
|
+
**Operation**: `onchain_operations` with `operation_type: "service"`.
|
|
278
|
+
|
|
279
|
+
### 4.2 Review & Reward Incentives
|
|
280
|
+
|
|
281
|
+
Encourage post-order feedback and engagement.
|
|
282
|
+
|
|
283
|
+
**Design Pattern — Review Incentive**:
|
|
284
|
+
```
|
|
285
|
+
Machine Workflow:
|
|
286
|
+
"order_completed" → "like" (threshold: 1)
|
|
287
|
+
└── Forward: "positive_feedback" (weight: 1)
|
|
288
|
+
|
|
289
|
+
"order_completed" → "suggest" (threshold: 1)
|
|
290
|
+
└── Forward: "negative_feedback" (weight: 1)
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**Creating Reward Pool**:
|
|
294
|
+
|
|
295
|
+
**Operation**: `onchain_operations` with `operation_type: "reward"`.
|
|
296
|
+
|
|
297
|
+
**Example Configuration**:
|
|
298
|
+
|
|
299
|
+
Create 2 Guards that check if Progress reached "like" node, then bind to Reward with different amounts:
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
Guard 1: "reward_like_200k"
|
|
303
|
+
└── Condition: progress.current_node == "like"
|
|
304
|
+
|
|
305
|
+
Guard 2: "reward_suggest_100k"
|
|
306
|
+
└── Condition: progress.current_node == "suggest"
|
|
307
|
+
|
|
308
|
+
Reward Configuration:
|
|
309
|
+
├── Guard: "reward_like_200k"
|
|
310
|
+
│ └── Amount: 200000
|
|
311
|
+
│
|
|
312
|
+
└── Guard: "reward_suggest_100k"
|
|
313
|
+
└── Amount: 100000
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
> **Note**: Reward is an optional advanced feature. See `schema_query({ action: "get", name: "onchain_operations_reward" })` for full configuration.
|
|
317
|
+
|
|
318
|
+
### 4.3 Supply Chain Promises (Sub-Orders)
|
|
319
|
+
|
|
320
|
+
Demonstrate quality by committing to purchase from trusted suppliers.
|
|
321
|
+
|
|
322
|
+
**Use Case — Travel Service**:
|
|
323
|
+
```
|
|
324
|
+
Travel Service promises:
|
|
325
|
+
"We only book 5-star hotels from trusted hotel groups"
|
|
326
|
+
|
|
327
|
+
Machine Implementation:
|
|
328
|
+
├── "Book Hotel" Node
|
|
329
|
+
│ └── forward_to_order_create: {
|
|
330
|
+
│ service: "trusted-hotel-group-service",
|
|
331
|
+
│ // Creates sub-order on hotel service
|
|
332
|
+
│ }
|
|
333
|
+
│
|
|
334
|
+
└── Guard: "hotel_booking_confirmed"
|
|
335
|
+
└── Validates sub-order created and confirmed
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
**Benefits**:
|
|
339
|
+
- **Transparency & Quality assurance**: Commits you to vetted suppliers
|
|
340
|
+
- **Trust building**: "We use X brand" becomes verifiable on-chain
|
|
341
|
+
|
|
342
|
+
**Prerequisites**:
|
|
343
|
+
- Supplier Service must be published first
|
|
344
|
+
- Your Machine references their Service ID
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Phase 5: Order Fulfillment
|
|
349
|
+
|
|
350
|
+
Handle active orders through workflow progression.
|
|
351
|
+
|
|
352
|
+
### 5.1 Progress Operations
|
|
353
|
+
|
|
354
|
+
Advance orders through your Machine workflow via the Progress object.
|
|
355
|
+
|
|
356
|
+
**Key Principle**:
|
|
357
|
+
| Object | Purpose | Operation Target |
|
|
358
|
+
|--------|---------|------------------|
|
|
359
|
+
| **Order** | Fund escrow, ownership | Read-only for workflow |
|
|
360
|
+
| **Progress** | Workflow state, node execution | **Operate via this** |
|
|
361
|
+
|
|
362
|
+
**Two-Phase Operation** (recommended):
|
|
363
|
+
|
|
364
|
+
**Operation**: `onchain_operations` with `operation_type: "progress"`.
|
|
365
|
+
|
|
366
|
+
**Step 1: Lock permission** (Prevents race conditions):
|
|
367
|
+
- `object`: Progress object ID (from Order.progress)
|
|
368
|
+
- `operate.operation`: Target node operation (e.g., `{ Next: "shipped" }`)
|
|
369
|
+
- `operate.hold`: `true` to lock permission
|
|
370
|
+
|
|
371
|
+
**Step 2: Complete off-chain work, then submit**:
|
|
372
|
+
- Same operation with `hold: false` to release lock and submit
|
|
373
|
+
|
|
374
|
+
**Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_progress" })`
|
|
375
|
+
|
|
376
|
+
### 5.2 Voluntary Compensation
|
|
377
|
+
|
|
378
|
+
Proactively compensate for service failures to maintain relationships.
|
|
379
|
+
|
|
380
|
+
**Scenario — Late Delivery**:
|
|
381
|
+
```
|
|
382
|
+
Machine Design:
|
|
383
|
+
├── "Shipping" Node
|
|
384
|
+
│ ├── Forward: "On Time" (normal)
|
|
385
|
+
│ └── Forward: "Late" (penalty trigger)
|
|
386
|
+
│
|
|
387
|
+
└── Guard "late_penalty"
|
|
388
|
+
├── IF delivery_time > promised + grace_period
|
|
389
|
+
├── THEN require Payment from merchant to Order
|
|
390
|
+
└── Validate: Payment ≥ configured_penalty
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
**Payment Flow**:
|
|
394
|
+
```
|
|
395
|
+
Merchant or Participant Wallet
|
|
396
|
+
├──→ Payment (penalty) ──→ Customer's Order
|
|
397
|
+
│ └──→ Customer extracts via receive()
|
|
398
|
+
└──→ Guard validates before workflow continues
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
**Benefits**:
|
|
402
|
+
- Retains customers through proactive accountability
|
|
403
|
+
- Avoids escalation to arbitration
|
|
404
|
+
- Differentiates your service with guarantees
|
|
405
|
+
|
|
406
|
+
### 5.3 Customer Service
|
|
407
|
+
|
|
408
|
+
Handle inquiries and issues via Messenger.
|
|
409
|
+
|
|
410
|
+
**Setup**:
|
|
411
|
+
```
|
|
412
|
+
Service.um → Contact.object_id
|
|
413
|
+
Contact.ims[] → Your customer service addresses
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**Best Practices**:
|
|
417
|
+
- Respond promptly to build trust
|
|
418
|
+
- Document all agreements (generates WTS evidence)
|
|
419
|
+
- Confirm understanding explicitly (ARK signature required for evidence)
|
|
420
|
+
- Proactively communicate delays
|
|
421
|
+
|
|
422
|
+
> **Full Guide**: See [wowok-messenger](../wowok-messenger/SKILL.md) for messaging, WTS generation, and evidence management.
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## Best Practices & Common Pitfalls
|
|
427
|
+
|
|
428
|
+
### Design Principles
|
|
429
|
+
|
|
430
|
+
| Do | Don't |
|
|
431
|
+
|----|-------|
|
|
432
|
+
| Design Machine + Allocators together | Design workflow without considering fund flow |
|
|
433
|
+
| Provide generous compensation_fund | Skip compensation fund for high-value services |
|
|
434
|
+
| Use clear, verifiable Guard conditions | Create ambiguous validation logic |
|
|
435
|
+
| Test on testnet first, then mainnet | Publish to mainnet without testing |
|
|
436
|
+
| Document WIP thoroughly | Make vague product promises |
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
## Quick Reference
|
|
441
|
+
|
|
442
|
+
### Essential Schemas
|
|
443
|
+
|
|
444
|
+
| Purpose | Schema Name |
|
|
445
|
+
|---------|-------------|
|
|
446
|
+
| Service operations | `onchain_operations_service` |
|
|
447
|
+
| Machine operations | `onchain_operations_machine` |
|
|
448
|
+
| Guard operations | `onchain_operations_guard` |
|
|
449
|
+
| WIP file generation | `wip_file` |
|
|
450
|
+
| Messenger operations | `messenger_operation` |
|
|
451
|
+
| Query toolkit | `query_toolkit` |
|
|
452
|
+
|
|
453
|
+
**Query Schema**: `schema_query({ action: "get", name: "<schema_name>" })`
|
package/wowok-safety/SKILL.md
CHANGED
|
@@ -63,18 +63,24 @@ Proceed with execution?
|
|
|
63
63
|
### 2.2 Amount Verification
|
|
64
64
|
|
|
65
65
|
- Always display amounts with token symbol (e.g., "10 WOW" not "10000000000").
|
|
66
|
-
- Query token decimals first if unsure
|
|
66
|
+
- Query token decimals first if unsure.
|
|
67
|
+
|
|
68
|
+
**Tool**: `query_toolkit` with `query_type: "token_list"`.
|
|
69
|
+
|
|
67
70
|
- **Amounts in operations are ALWAYS submitted as U64 integers**. If the user specifies "2 WOW", do NOT submit the string "2 WOW". Instead, calculate and submit `2000000000` (2 × 10^9, where 9 is WOW's decimals).
|
|
68
71
|
- **Never assume token decimals**. If the token's decimals cannot be queried, HALT the amount submission and alert the user. Do not proceed with hardcoded or guessed precision.
|
|
69
72
|
- Show both raw and human-readable amounts when clarifying with users.
|
|
70
73
|
|
|
71
|
-
|
|
72
74
|
### 2.3 Publish Confirmation
|
|
73
75
|
|
|
74
76
|
Before publishing a Service or Machine:
|
|
75
77
|
|
|
76
|
-
1. **Export and review**:
|
|
78
|
+
1. **Export and review**:
|
|
79
|
+
- Use `guard2file` to export Guard definitions
|
|
80
|
+
- Use `machineNode2file` to export Machine nodes
|
|
81
|
+
|
|
77
82
|
2. **Verify logic**: Confirm Guards and Machine nodes match user intent
|
|
83
|
+
|
|
78
84
|
3. **Warn about immutability**: Once published, many fields become locked
|
|
79
85
|
|
|
80
86
|
```
|
|
@@ -135,12 +141,8 @@ Controls name collision behavior:
|
|
|
135
141
|
When displaying an address (0x prefix + 64 hex characters) to the user:
|
|
136
142
|
|
|
137
143
|
1. **Query local mark first**:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
query_type: "local_mark_list",
|
|
141
|
-
filter: { address: "0x<64_hex_chars>" }
|
|
142
|
-
})
|
|
143
|
-
```
|
|
144
|
+
|
|
145
|
+
**Tool**: `query_toolkit` with `query_type: "local_mark_list"` and filter by address.
|
|
144
146
|
|
|
145
147
|
2. **Display format**:
|
|
146
148
|
- If local mark exists: `{name} ({short_address})`
|
|
@@ -159,7 +161,7 @@ When displaying an address (0x prefix + 64 hex characters) to the user:
|
|
|
159
161
|
|
|
160
162
|
### 5.1 Multi-Token Support & Amount Formats
|
|
161
163
|
|
|
162
|
-
- **Multi-Token**: All operations support custom `token_type`. ALWAYS query precision via `query_toolkit
|
|
164
|
+
- **Multi-Token**: All operations support custom `token_type`. ALWAYS query precision via `query_toolkit` with `query_type: "token_list"` first. Never assume decimals.
|
|
163
165
|
- **Amount Formats**:
|
|
164
166
|
- With unit: `"2WOW"`, `"10.5USDT"` — auto-converted using token precision.
|
|
165
167
|
- Plain number: internal unit (e.g., `1000000000` = 1 WOW). Always clarify with users when displaying plain numbers.
|
|
@@ -174,7 +176,10 @@ Use `Payment` objects for commercial transfers when possible — they offer Guar
|
|
|
174
176
|
|
|
175
177
|
## 6. Query-First Pattern
|
|
176
178
|
|
|
177
|
-
- **Query before mutate**: Always query current state before modifications.
|
|
179
|
+
- **Query before mutate**: Always query current state before modifications.
|
|
180
|
+
|
|
181
|
+
**Tool**: `query_toolkit` with appropriate filters.
|
|
182
|
+
|
|
178
183
|
- **Pagination**: All on-chain list queries (events, tables, received) support `cursor`/`limit`. Loop for large datasets.
|
|
179
184
|
- **Cache control**: Use `no_cache: true` for time-sensitive reads.
|
|
180
185
|
|
|
@@ -192,17 +197,12 @@ Use `Payment` objects for commercial transfers when possible — they offer Guar
|
|
|
192
197
|
|
|
193
198
|
### 7.2 Address Resolution & Display Format
|
|
194
199
|
|
|
195
|
-
**Resolve addresses to names** via `query_toolkit
|
|
200
|
+
**Resolve addresses to names** via `query_toolkit`:
|
|
196
201
|
|
|
197
|
-
|
|
198
|
-
{
|
|
199
|
-
"query_type": "local_names",
|
|
200
|
-
"addresses": ["0x{64_hex_chars}", ...]
|
|
201
|
-
}
|
|
202
|
-
```
|
|
202
|
+
**Tool**: `query_toolkit` with `query_type: "local_names"` and `addresses` array parameter.
|
|
203
203
|
|
|
204
204
|
- Each address must be a valid WOW ID: `0x` prefix + **64 hex characters**.
|
|
205
|
-
- Returns
|
|
205
|
+
- Returns resolved account name and/or local mark name for each address.
|
|
206
206
|
- Name priority follows [7.1](#71-name-resolution-priority): `local_mark` > `account`.
|
|
207
207
|
|
|
208
208
|
**Address truncation** (for display):
|
|
@@ -239,9 +239,15 @@ Use `Payment` objects for commercial transfers when possible — they offer Guar
|
|
|
239
239
|
## 9. Testing & Validation Workflow
|
|
240
240
|
|
|
241
241
|
1. **Design Phase**: Use `wowok_buildin_info` to discover available permissions and Guard instructions
|
|
242
|
+
|
|
243
|
+
**Tool**: `wowok_buildin_info` with `info_type: "permissions"` or `info_type: "guard_instructions"`.
|
|
244
|
+
|
|
242
245
|
2. **Export & Review**: Before publishing, use `guard2file` and `machineNode2file` to export and review definitions
|
|
246
|
+
|
|
243
247
|
3. **Incremental Testing**: Build objects step-by-step, verifying each step
|
|
248
|
+
|
|
244
249
|
4. **Final Validation**: Test all Guard conditions and Machine transitions before publishing
|
|
250
|
+
|
|
245
251
|
5. **Publish**: Only after thorough testing, publish Service and Machine
|
|
246
252
|
|
|
247
253
|
---
|
|
@@ -253,4 +259,20 @@ For complex objects with many fields (Service, Machine), use **incremental build
|
|
|
253
259
|
- Each step can be verified before proceeding
|
|
254
260
|
- Errors are isolated to specific fields
|
|
255
261
|
- Easier to retry failed steps without re-executing successful ones
|
|
256
|
-
- Better user feedback at each stage
|
|
262
|
+
- Better user feedback at each stage
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Schema Reference
|
|
267
|
+
|
|
268
|
+
| Purpose | Schema Name |
|
|
269
|
+
|---------|-------------|
|
|
270
|
+
| Query toolkit | `query_toolkit` |
|
|
271
|
+
| Token list | `query_toolkit` with `query_type: "token_list"` |
|
|
272
|
+
| Guard export | `guard2file` |
|
|
273
|
+
| Machine export | `machineNode2file` |
|
|
274
|
+
| Build-in info | `wowok_buildin_info` |
|
|
275
|
+
|
|
276
|
+
**Query Schema**: `schema_query({ action: "get", name: "<schema_name>" })`
|
|
277
|
+
|
|
278
|
+
**Related Skills**: [wowok-tools](../wowok-tools/SKILL.md) | [wowok-guard](../wowok-guard/SKILL.md) | [wowok-machine](../wowok-machine/SKILL.md)
|