@wowok/skills 1.1.4 → 1.1.5
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/package.json +1 -1
- package/wowok-provider/SKILL.md +185 -353
- package/wowok-safety/SKILL.md +24 -1
- package/wowok-tools/SKILL.md +3 -1
package/package.json
CHANGED
package/wowok-provider/SKILL.md
CHANGED
|
@@ -25,417 +25,242 @@ Build and operate commercial services on WoWok as a service provider.
|
|
|
25
25
|
|
|
26
26
|
> **Role**: Service Provider (Merchant/Seller)
|
|
27
27
|
> **Prerequisites**: Understand CREATE vs MODIFY pattern — use `schema_query({ action: "get", name: "onchain_operations" })`
|
|
28
|
-
> **
|
|
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)
|
|
28
|
+
> **Related Skills**: [wowok-order](../wowok-order/SKILL.md) (customer), [wowok-machine](../wowok-machine/SKILL.md) (workflow), [wowok-messenger](../wowok-messenger/SKILL.md) (communication)
|
|
33
29
|
|
|
34
30
|
---
|
|
35
31
|
|
|
36
|
-
##
|
|
32
|
+
## AI Decision Framework
|
|
37
33
|
|
|
38
|
-
|
|
34
|
+
When user wants to create/publish a service, follow this **strict dependency order**:
|
|
39
35
|
|
|
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
36
|
```
|
|
44
|
-
|
|
37
|
+
STEP 1: Foundation (CREATE or REUSE)
|
|
38
|
+
├── Permission — REUSE existing if available (strongly recommended)
|
|
39
|
+
├── Service (unpublished) — CREATE new
|
|
40
|
+
└── Machine (unpublished) — CREATE new or REUSE template
|
|
41
|
+
|
|
42
|
+
STEP 2: Trust Layer (CREATE or REUSE)
|
|
43
|
+
└── Guards — CREATE new or REUSE existing
|
|
44
|
+
|
|
45
|
+
STEP 3: Business Logic (MODIFY)
|
|
46
|
+
├── Machine — bind Guards to nodes
|
|
47
|
+
├── Service — set Allocators
|
|
48
|
+
├── Service — add Arbitrations (optional, REUSE existing Arb services)
|
|
49
|
+
├── Service — add Compensation Fund (optional)
|
|
50
|
+
└── Reward — incentive pools (optional)
|
|
51
|
+
|
|
52
|
+
STEP 4: Publication
|
|
53
|
+
├── Publish Machine → IMMUTABLE
|
|
54
|
+
├── Bind Machine to Service
|
|
55
|
+
└── Publish Service → machine/allocators LOCKED
|
|
56
|
+
|
|
57
|
+
STEP 5: Post-Publish (MODIFY Service)
|
|
58
|
+
├── description, location
|
|
59
|
+
├── sales (products with WIP)
|
|
60
|
+
├── customer_required
|
|
61
|
+
└── um (REUSE existing Contact or CREATE new)
|
|
45
62
|
```
|
|
46
63
|
|
|
47
|
-
|
|
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
|
|
64
|
+
### Object Reuse (See [wowok-safety](../wowok-safety/SKILL.md))
|
|
55
65
|
|
|
56
|
-
|
|
57
|
-
- **Object shape** (`{ name?, ... }`) = **CREATE** new object
|
|
58
|
-
- **String value** (`"<name>"`) = **MODIFY** existing object
|
|
66
|
+
**General Rule**: Reuse existing objects when available. See wowok-safety for detailed reuse principles and CREATE vs MODIFY patterns.
|
|
59
67
|
|
|
60
|
-
**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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)
|
|
68
|
+
**Provider-Specific Reuse Notes**:
|
|
69
|
+
| Object | Reuse Strategy |
|
|
70
|
+
|--------|----------------|
|
|
71
|
+
| **Permission** | **Strongly recommended** — enables centralized permission control across all your services |
|
|
72
|
+
| Machine | Reuse via `machineNode2file` export/import for similar workflows |
|
|
73
|
+
| Contact (um) | Reuse existing customer service Contact |
|
|
74
|
+
| Arbitration | Always reuse existing Arbitration services (customers choose from your approved list) |
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
**Immutability Rules**:
|
|
77
|
+
| Object | When Locked | Impact |
|
|
78
|
+
|--------|-------------|--------|
|
|
79
|
+
| Guard | After creation | Cannot modify |
|
|
80
|
+
| Machine | After publish | Nodes frozen |
|
|
81
|
+
| Service | After publish | machine, order_allocators frozen |
|
|
80
82
|
|
|
81
83
|
---
|
|
82
84
|
|
|
83
|
-
##
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
**
|
|
105
|
-
|
|
106
|
-
**
|
|
107
|
-
|
|
108
|
-
|
|
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
|
|
85
|
+
## Service Build Checklist
|
|
86
|
+
|
|
87
|
+
Use this checklist when guiding users through service creation:
|
|
88
|
+
|
|
89
|
+
| Phase | Step | Required | Tool/Operation | Key Fields |
|
|
90
|
+
|-------|------|----------|----------------|------------|
|
|
91
|
+
| 1 | Permission | ✅ | `onchain_operations` (permission) | name, type_parameter |
|
|
92
|
+
| 1 | Service (unpublished) | ✅ | `onchain_operations` (service) | object: {name, type_parameter, permission} |
|
|
93
|
+
| 1 | Machine (unpublished) | ✅ | `onchain_operations` (machine) | nodes, pairs, forwards |
|
|
94
|
+
| 2 | Guards | ✅ | `onchain_operations` (guard) | logic, instructions |
|
|
95
|
+
| 3 | Machine + Guards | ✅ | `onchain_operations` (machine) | bind guards to forwards |
|
|
96
|
+
| 3 | Allocators | ✅ | `onchain_operations` (service) | order_allocators |
|
|
97
|
+
| 3 | Arbitrations | ❌ | `onchain_operations` (service) | arbitrations.list |
|
|
98
|
+
| 3 | Compensation Fund | ❌ | `onchain_operations` (service) | compensation_fund_add, setting_locked_time_add |
|
|
99
|
+
| 4 | Publish Machine | ✅ | `onchain_operations` (machine) | publish: true |
|
|
100
|
+
| 4 | Bind Machine | ✅ | `onchain_operations` (service) | machine: "<machine_id>" |
|
|
101
|
+
| 4 | Publish Service | ✅ | `onchain_operations` (service) | publish: true |
|
|
102
|
+
| 5 | Description/Location | ❌ | `onchain_operations` (service) | description, location |
|
|
103
|
+
| 5 | Sales Products | ❌ | `onchain_operations` (service) | sales.sales[] |
|
|
104
|
+
| 5 | Customer Required | ❌ | `onchain_operations` (service) | customer_required[], um |
|
|
105
|
+
|
|
106
|
+
**Critical Rules**:
|
|
107
|
+
1. **Reuse First**: Always ask if user has existing Permission/Machine/Guard/Contact to reuse
|
|
108
|
+
2. If `customer_required` is set → `um` (Contact) **MUST** be set
|
|
109
|
+
3. Physical goods **MUST** have WIP files
|
|
110
|
+
4. `wip_hash` default `""` (uses embedded hash)
|
|
168
111
|
|
|
169
112
|
---
|
|
170
113
|
|
|
171
|
-
##
|
|
172
|
-
|
|
173
|
-
Configure mechanisms that assure customers they can trust your service.
|
|
114
|
+
## Key Concepts
|
|
174
115
|
|
|
175
|
-
###
|
|
116
|
+
### Service Object Relationships
|
|
176
117
|
|
|
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
118
|
```
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
119
|
+
Service (merchant storefront)
|
|
120
|
+
├── machine → Machine (workflow)
|
|
121
|
+
├── order_allocators → Fund distribution rules
|
|
122
|
+
├── arbitrations → Dispute resolution (optional)
|
|
123
|
+
├── compensation_fund → Customer protection (optional)
|
|
124
|
+
├── sales → Products with WIP files
|
|
125
|
+
├── rewards → Incentive pools (optional)
|
|
126
|
+
└── um → Contact (customer service)
|
|
193
127
|
|
|
194
|
-
|
|
128
|
+
Order (per purchase)
|
|
129
|
+
├── builder → Customer
|
|
130
|
+
├── progress → Workflow state
|
|
131
|
+
└── allocation → Fund distribution engine
|
|
195
132
|
```
|
|
196
133
|
|
|
197
|
-
|
|
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)
|
|
134
|
+
### WIP Files (Witness Immutable Promise)
|
|
216
135
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
## Phase 3: Build & Publish
|
|
220
|
-
|
|
221
|
-
Execute the dependency-first build process.
|
|
222
|
-
|
|
223
|
-
### 3.1 4-Phase Build Process
|
|
136
|
+
**Purpose**: Immutable product commitment for arbitration evidence.
|
|
224
137
|
|
|
138
|
+
**Creating WIP**:
|
|
225
139
|
```
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|
|
140
|
+
Tool: wip_file
|
|
141
|
+
type: "generate"
|
|
142
|
+
options.markdown_text: Product description
|
|
143
|
+
options.images: Product visuals
|
|
144
|
+
outputPath: Output file path
|
|
245
145
|
```
|
|
246
146
|
|
|
247
|
-
|
|
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**:
|
|
147
|
+
**Attaching to Service**:
|
|
284
148
|
```
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
149
|
+
Operation: onchain_operations (service)
|
|
150
|
+
sales.op: "add"
|
|
151
|
+
sales.sales: [{
|
|
152
|
+
name: Product name
|
|
153
|
+
price: Token amount
|
|
154
|
+
stock: Quantity
|
|
155
|
+
wip: URL to WIP file
|
|
156
|
+
wip_hash: "" (default, uses embedded hash)
|
|
157
|
+
}]
|
|
291
158
|
```
|
|
292
159
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
**Operation**: `onchain_operations` with `operation_type: "reward"`.
|
|
296
|
-
|
|
297
|
-
**Example Configuration**:
|
|
160
|
+
### Allocators + Machine Integration
|
|
298
161
|
|
|
299
|
-
|
|
162
|
+
Design together for coherent fund flow:
|
|
300
163
|
|
|
301
164
|
```
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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.
|
|
165
|
+
Example: Delivery workflow
|
|
166
|
+
"delivered" → "order_complete" (threshold: 1)
|
|
167
|
+
└── Forward: "customer_signed"
|
|
168
|
+
└── Allocator: 95% merchant, 5% platform
|
|
321
169
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
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
|
|
170
|
+
"delivered" → "package_lost" (threshold: 2)
|
|
171
|
+
├── Forward: "customer_reports_lost"
|
|
172
|
+
├── Forward: "merchant_confirms_lost"
|
|
173
|
+
└── Allocator: 100% to order (buyer withdraws)
|
|
336
174
|
```
|
|
337
175
|
|
|
338
|
-
**
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
**Prerequisites**:
|
|
343
|
-
- Supplier Service must be published first
|
|
344
|
-
- Your Machine references their Service ID
|
|
176
|
+
**Allocation Modes** (execute in order):
|
|
177
|
+
1. **Amount**: Fixed U64 per recipient
|
|
178
|
+
2. **Rate**: Basis points (10000 = 100%)
|
|
179
|
+
3. **Surplus**: Receives remainder (max 1 per allocator)
|
|
345
180
|
|
|
346
181
|
---
|
|
347
182
|
|
|
348
|
-
## Phase
|
|
183
|
+
## Phase Details
|
|
349
184
|
|
|
350
|
-
|
|
185
|
+
### Phase 1: Foundation
|
|
351
186
|
|
|
352
|
-
|
|
187
|
+
Create base objects. Service starts unpublished.
|
|
353
188
|
|
|
354
|
-
|
|
189
|
+
**Pre-Build Discovery**:
|
|
190
|
+
- `query_toolkit` (account_list) — list accounts
|
|
191
|
+
- `query_toolkit` (local_mark_list) — list marks
|
|
192
|
+
- `query_toolkit` (onchain_objects) — query existing
|
|
355
193
|
|
|
356
|
-
**
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
| **Order** | Fund escrow, ownership | Read-only for workflow |
|
|
360
|
-
| **Progress** | Workflow state, node execution | **Operate via this** |
|
|
194
|
+
**Reuse Templates**:
|
|
195
|
+
- `machineNode2file` — export Machine for editing
|
|
196
|
+
- `guard2file` — export Guard for editing
|
|
361
197
|
|
|
362
|
-
|
|
198
|
+
### Phase 2: Trust Layer
|
|
363
199
|
|
|
364
|
-
|
|
200
|
+
Create all Guards needed for workflow validation.
|
|
365
201
|
|
|
366
|
-
|
|
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
|
|
202
|
+
### Phase 3: Business Logic
|
|
370
203
|
|
|
371
|
-
**
|
|
372
|
-
-
|
|
204
|
+
**Compensation Fund** (optional but recommended):
|
|
205
|
+
- `compensation_fund_add`: Add funds
|
|
206
|
+
- `setting_locked_time_add`: Lock duration (min 30 days = 2592000000ms)
|
|
373
207
|
|
|
374
|
-
**
|
|
208
|
+
**Merchant Withdrawal Constraints**:
|
|
209
|
+
1. Pause Service
|
|
210
|
+
2. Wait lock duration
|
|
211
|
+
3. Withdraw via `compensation_fund_receive`
|
|
375
212
|
|
|
376
|
-
|
|
213
|
+
**Arbitration** (optional):
|
|
214
|
+
- Without it: Lower setup, but customers bear full dispute risk
|
|
215
|
+
- With it: Customer trust ↑, dispute resolution available
|
|
377
216
|
|
|
378
|
-
|
|
217
|
+
### Phase 4: Publication
|
|
379
218
|
|
|
380
|
-
**
|
|
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
|
-
```
|
|
219
|
+
**Order Matters**: Publish Machine → Bind → Publish Service
|
|
392
220
|
|
|
393
|
-
**
|
|
394
|
-
```
|
|
395
|
-
Merchant or Participant Wallet
|
|
396
|
-
├──→ Payment (penalty) ──→ Customer's Order
|
|
397
|
-
│ └──→ Customer extracts via receive()
|
|
398
|
-
└──→ Guard validates before workflow continues
|
|
399
|
-
```
|
|
221
|
+
After publish: machine, order_allocators are **LOCKED**
|
|
400
222
|
|
|
401
|
-
|
|
402
|
-
- Retains customers through proactive accountability
|
|
403
|
-
- Avoids escalation to arbitration
|
|
404
|
-
- Differentiates your service with guarantees
|
|
223
|
+
### Phase 5: Post-Publish Configuration
|
|
405
224
|
|
|
406
|
-
|
|
225
|
+
These can be updated after publication:
|
|
407
226
|
|
|
408
|
-
|
|
227
|
+
| Field | Purpose | Required |
|
|
228
|
+
|-------|---------|----------|
|
|
229
|
+
| description | Service description | ❌ |
|
|
230
|
+
| location | Service area | ❌ |
|
|
231
|
+
| sales | Products with WIP | ❌ (but needed to sell) |
|
|
232
|
+
| customer_required | Required customer info | ❌ |
|
|
233
|
+
| um | Contact for customer service | ❌ (REQUIRED if customer_required set) |
|
|
409
234
|
|
|
410
|
-
**
|
|
235
|
+
**Customer Required + Contact Rule**:
|
|
411
236
|
```
|
|
412
|
-
|
|
413
|
-
|
|
237
|
+
If customer_required: ["phone", "address"]
|
|
238
|
+
Then um: "<contact_id>" ← MUST be set
|
|
414
239
|
```
|
|
415
240
|
|
|
416
|
-
**
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
- Proactively communicate delays
|
|
241
|
+
**Contact Setup**:
|
|
242
|
+
1. Create Contact object
|
|
243
|
+
2. Set `um` to Contact ID
|
|
244
|
+
3. Customers use Messenger to provide info securely
|
|
421
245
|
|
|
422
|
-
|
|
246
|
+
---
|
|
423
247
|
|
|
424
|
-
|
|
248
|
+
## Order Fulfillment
|
|
425
249
|
|
|
426
|
-
|
|
250
|
+
### Progress Operations
|
|
251
|
+
|
|
252
|
+
| Object | Purpose | Target |
|
|
253
|
+
|--------|---------|--------|
|
|
254
|
+
| Order | Fund escrow | Read-only |
|
|
255
|
+
| Progress | Workflow state | **Operate this** |
|
|
427
256
|
|
|
428
|
-
|
|
257
|
+
**Two-Phase Pattern**:
|
|
258
|
+
1. Lock: `hold: true` (prevents race conditions)
|
|
259
|
+
2. Submit: `hold: false` (after off-chain work)
|
|
429
260
|
|
|
430
|
-
###
|
|
261
|
+
### Customer Service
|
|
431
262
|
|
|
432
|
-
|
|
433
|
-
|----|-------|
|
|
434
|
-
| Design Machine + Allocators together | Design workflow without considering fund flow |
|
|
435
|
-
| Provide generous compensation_fund | Skip compensation fund for high-value services |
|
|
436
|
-
| Use clear, verifiable Guard conditions | Create ambiguous validation logic |
|
|
437
|
-
| Test on testnet first, then mainnet | Publish to mainnet without testing |
|
|
438
|
-
| Document WIP thoroughly | Make vague product promises |
|
|
263
|
+
**AI Reminder**: When fulfilling orders, check if `customer_required` fields are provided. If missing, prompt provider to request via Messenger.
|
|
439
264
|
|
|
440
265
|
---
|
|
441
266
|
|
|
@@ -443,13 +268,20 @@ Contact.ims[] → Your customer service addresses
|
|
|
443
268
|
|
|
444
269
|
### Essential Schemas
|
|
445
270
|
|
|
446
|
-
| Purpose | Schema
|
|
447
|
-
|
|
448
|
-
| Service
|
|
449
|
-
| Machine
|
|
450
|
-
| Guard
|
|
451
|
-
|
|
|
452
|
-
|
|
|
453
|
-
|
|
|
271
|
+
| Purpose | Schema |
|
|
272
|
+
|---------|--------|
|
|
273
|
+
| Service ops | `onchain_operations_service` |
|
|
274
|
+
| Machine ops | `onchain_operations_machine` |
|
|
275
|
+
| Guard ops | `onchain_operations_guard` |
|
|
276
|
+
| Progress ops | `onchain_operations_progress` |
|
|
277
|
+
| WIP generation | `wip_file` |
|
|
278
|
+
| Messenger | `messenger_operation` |
|
|
279
|
+
| Query | `query_toolkit` |
|
|
280
|
+
|
|
281
|
+
### Common Operations
|
|
454
282
|
|
|
455
283
|
**Query Schema**: `schema_query({ action: "get", name: "<schema_name>" })`
|
|
284
|
+
|
|
285
|
+
**Export Templates**:
|
|
286
|
+
- `machineNode2file` — Machine → JSON
|
|
287
|
+
- `guard2file` — Guard → JSON
|
package/wowok-safety/SKILL.md
CHANGED
|
@@ -19,7 +19,30 @@ always: true
|
|
|
19
19
|
|
|
20
20
|
## 1. Core Principles
|
|
21
21
|
|
|
22
|
-
### 1.1
|
|
22
|
+
### 1.1 Object Reuse Principle (General Best Practice)
|
|
23
|
+
|
|
24
|
+
**ALWAYS prefer reusing existing objects over creating new ones** — this enables centralized permission control and reduces management overhead.
|
|
25
|
+
|
|
26
|
+
| Object Type | Reuse Strategy | Why |
|
|
27
|
+
|-------------|----------------|-----|
|
|
28
|
+
| **Permission** | **Strongly recommended** — ask user for existing Permission name/ID | Centralized permission control across all services |
|
|
29
|
+
| Machine | Reuse if workflow fits | Save design time for similar processes |
|
|
30
|
+
| Guards | Reuse if validation logic matches | Avoid redundant rules |
|
|
31
|
+
| Contact | Reuse existing customer service Contact | Single point of management |
|
|
32
|
+
| Arbitration | Always reuse existing Arbitration services | Customers choose from established arbiters |
|
|
33
|
+
|
|
34
|
+
**How to Reuse**:
|
|
35
|
+
- Ask user: *"Do you have an existing object you'd like to reuse? Provide the name or ID."*
|
|
36
|
+
- Use string value `"<name_or_id>"` to reference existing objects
|
|
37
|
+
- Use object shape `{ name?, ... }` only when creating new
|
|
38
|
+
|
|
39
|
+
**CREATE vs MODIFY Pattern**:
|
|
40
|
+
| Format | Meaning | Use When |
|
|
41
|
+
|--------|---------|----------|
|
|
42
|
+
| String `"<name>"` or `"<0x...>"` | **REUSE** existing | Object already exists |
|
|
43
|
+
| Object `{ name?, ... }` | **CREATE** new | Need new object |
|
|
44
|
+
|
|
45
|
+
### 1.2 Security & Safety
|
|
23
46
|
|
|
24
47
|
- **Hot Wallet Usage**: WoWok never exposes private keys. Treat it as a spending account for transfers, receipts, and commerce. Flag large transactions for explicit user confirmation.
|
|
25
48
|
- **Amount-Sensitive Operations**: Any token transfer, payment, or reward distribution MUST be verbally confirmed with the user before execution. Use `Payment` objects for commercial transfers when possible (they offer Guard validation and purpose tracking).
|
package/wowok-tools/SKILL.md
CHANGED
|
@@ -42,9 +42,11 @@ Quick reference for WoWok MCP tools — patterns, pitfalls, and troubleshooting.
|
|
|
42
42
|
|
|
43
43
|
### CREATE vs MODIFY Pattern
|
|
44
44
|
|
|
45
|
+
See [wowok-safety](../wowok-safety/SKILL.md) for complete object reuse principles.
|
|
46
|
+
|
|
45
47
|
| Format | Meaning | Example |
|
|
46
48
|
|--------|---------|---------|
|
|
47
|
-
| **String** | Reference EXISTING | `"my-service"` or `"0x1234..."` |
|
|
49
|
+
| **String** | Reference EXISTING (reuse) | `"my-service"` or `"0x1234..."` |
|
|
48
50
|
| **Object** | CREATE NEW | `{ name: "my-service", permission: "..." }` |
|
|
49
51
|
|
|
50
52
|
---
|