@wowok/skills 1.0.6
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 +156 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +177 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/skills.d.ts +5 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +46 -0
- package/dist/skills.js.map +1 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/examples/Insurance/Insurance.md +594 -0
- package/examples/Insurance/Insurance_TestResults.md +481 -0
- package/examples/Insurance/insurance_complete_guard_v1.json +50 -0
- package/examples/MyShop/MyShop.md +1353 -0
- package/examples/MyShop/MyShop_TestResults.md +1003 -0
- package/examples/MyShop_Advanced/MyShop_Advanced.md +1898 -0
- package/examples/MyShop_Advanced/MyShop_Advanced_MerchantSystem_TestResults.md +1297 -0
- package/examples/MyShop_Advanced/MyShop_Advanced_OrderFlow_TestResults.md +743 -0
- package/examples/MyShop_Advanced/machine_nodes.json +222 -0
- package/examples/ThreeBody_Signature/ThreeBody_Signature.md +776 -0
- package/examples/ThreeBody_Signature/ThreeBody_Signature_TestResults.md +599 -0
- package/examples/Travel/Travel.md +1157 -0
- package/examples/Travel/Travel_TestResults.md +743 -0
- package/examples/Travel/calc-weather-timestamps.js +8 -0
- package/examples/Travel/travel_machine_v2_export.json +104 -0
- package/examples/Travel/weather_check_guard_v1.json +51 -0
- package/package.json +56 -0
- package/schemas/onchain_operations/_common.md +236 -0
- package/schemas/onchain_operations/_index.md +22 -0
- package/schemas/onchain_operations/allocation.md +50 -0
- package/schemas/onchain_operations/arbitration.md +95 -0
- package/schemas/onchain_operations/contact.md +36 -0
- package/schemas/onchain_operations/demand.md +52 -0
- package/schemas/onchain_operations/gen_passport.md +43 -0
- package/schemas/onchain_operations/guard.md +136 -0
- package/schemas/onchain_operations/machine.md +70 -0
- package/schemas/onchain_operations/order.md +57 -0
- package/schemas/onchain_operations/payment.md +32 -0
- package/schemas/onchain_operations/permission.md +57 -0
- package/schemas/onchain_operations/personal.md +59 -0
- package/schemas/onchain_operations/progress.md +35 -0
- package/schemas/onchain_operations/repository.md +81 -0
- package/schemas/onchain_operations/reward.md +40 -0
- package/schemas/onchain_operations/service.md +104 -0
- package/schemas/onchain_operations/treasury.md +74 -0
- package/schemas/schema-account_operation.md +402 -0
- package/schemas/schema-guard2file.md +153 -0
- package/schemas/schema-local_info_operation.md +160 -0
- package/schemas/schema-local_mark_operation.md +148 -0
- package/schemas/schema-machineNode2file.md +155 -0
- package/schemas/schema-messenger_operation.md +547 -0
- package/schemas/schema-onchain_events.md +201 -0
- package/schemas/schema-onchain_table_data.md +334 -0
- package/schemas/schema-query_toolkit.md +375 -0
- package/schemas/schema-wip_file.md +240 -0
- package/schemas/schema-wowok_buildin_info.md +296 -0
- package/scripts/install.js +113 -0
- package/wowok-build/SKILL.md +606 -0
- package/wowok-guard/SKILL.md +374 -0
- package/wowok-machine/SKILL.md +512 -0
- package/wowok-order/SKILL.md +499 -0
- package/wowok-safety/SKILL.md +381 -0
- package/wowok-tools/SKILL.md +635 -0
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wowok-safety
|
|
3
|
+
description: |
|
|
4
|
+
WoWok safety and authorization protocol — ensures AI always obtains user
|
|
5
|
+
confirmation before executing irreversible on-chain operations. Covers
|
|
6
|
+
amount verification, publish confirmation, critical operation warnings,
|
|
7
|
+
and the mandatory two-phase submission pattern.
|
|
8
|
+
|
|
9
|
+
This skill is AUTOMATICALLY triggered before any on-chain write operation.
|
|
10
|
+
It ensures the AI never executes transactions without explicit user approval.
|
|
11
|
+
when_to_use:
|
|
12
|
+
- AI is about to execute an onchain_operations call with submission
|
|
13
|
+
- AI is about to publish a Service or Machine
|
|
14
|
+
- AI is about to transfer funds or modify financial parameters
|
|
15
|
+
- AI is about to delete or irreversibly modify on-chain objects
|
|
16
|
+
- User mentions "confirm", "approve", "safe", "warning"
|
|
17
|
+
always: true
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# WoWok Safety & Authorization Protocol
|
|
21
|
+
|
|
22
|
+
## Core Safety Principle
|
|
23
|
+
|
|
24
|
+
**NEVER execute an on-chain write without explicit user confirmation.**
|
|
25
|
+
|
|
26
|
+
WoWok operations involve real blockchain transactions with real economic consequences. The AI MUST always:
|
|
27
|
+
1. Preview what will happen (dry run)
|
|
28
|
+
2. Present the preview clearly to the user
|
|
29
|
+
3. Wait for explicit confirmation
|
|
30
|
+
4. Only then execute
|
|
31
|
+
|
|
32
|
+
## Mandatory Two-Phase Pattern
|
|
33
|
+
|
|
34
|
+
### Phase 1: Dry Run (ALWAYS first)
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
onchain_operations({
|
|
38
|
+
operation_type: "<type>",
|
|
39
|
+
data: { op: "<action>", ... }
|
|
40
|
+
// NO submission field → dry run only
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The dry run validates parameters, checks permissions, and returns a preview of what will happen. **No state is changed.**
|
|
45
|
+
|
|
46
|
+
### Phase 2: Execute (ONLY after user confirms)
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
onchain_operations({
|
|
50
|
+
operation_type: "<type>",
|
|
51
|
+
data: { op: "<action>", ... },
|
|
52
|
+
submission: {
|
|
53
|
+
sender: "<account_name>",
|
|
54
|
+
gas_budget: "<amount>"
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Critical Operations Requiring Extra Confirmation
|
|
60
|
+
|
|
61
|
+
### 🔴 HIGH RISK: Financial Operations
|
|
62
|
+
|
|
63
|
+
These operations involve real token transfers and MUST be double-confirmed:
|
|
64
|
+
|
|
65
|
+
| Operation | Risk | Extra Confirmation Required |
|
|
66
|
+
|-----------|------|---------------------------|
|
|
67
|
+
| `payment` (send coins) | Direct fund transfer | ✅ Show amount, recipient, token type |
|
|
68
|
+
| `treasury` (deposit/withdraw) | Team fund changes | ✅ Show amount, operation type |
|
|
69
|
+
| `reward` (create/modify) | Incentive pool changes | ✅ Show reward rules, amounts |
|
|
70
|
+
| `allocation` (create/modify) | Auto-distribution rules | ✅ Show split percentages, recipients |
|
|
71
|
+
| `order` (create/confirm) | Order with payment | ✅ Show price, service, parties |
|
|
72
|
+
|
|
73
|
+
### 🟡 MEDIUM RISK: Structural Operations
|
|
74
|
+
|
|
75
|
+
These modify system structure and should be confirmed:
|
|
76
|
+
|
|
77
|
+
| Operation | Risk | Confirmation Required |
|
|
78
|
+
|-----------|------|----------------------|
|
|
79
|
+
| `service` (publish) | Makes service public | ✅ Confirm publish intent |
|
|
80
|
+
| `machine` (publish) | Makes workflow public | ✅ Confirm publish intent |
|
|
81
|
+
| `guard` (create/modify) | Changes validation rules | ✅ Show Guard logic summary |
|
|
82
|
+
| `permission` (modify) | Changes access control | ✅ Show permission changes |
|
|
83
|
+
|
|
84
|
+
### 🟢 LOW RISK: Read-Only Operations
|
|
85
|
+
|
|
86
|
+
These are always safe and need no confirmation:
|
|
87
|
+
- All `query_toolkit` operations
|
|
88
|
+
- All `onchain_table_data` operations
|
|
89
|
+
- `wowok_buildin_info`
|
|
90
|
+
- `documents_and_learn`
|
|
91
|
+
- `guard2file`, `machineNode2file` (export only)
|
|
92
|
+
|
|
93
|
+
## Confirmation Template
|
|
94
|
+
|
|
95
|
+
When presenting a dry-run result for confirmation, ALWAYS use this format:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
📋 **Operation Preview**
|
|
99
|
+
|
|
100
|
+
| Field | Value |
|
|
101
|
+
|-------|-------|
|
|
102
|
+
| Operation | {operation_type} — {op} |
|
|
103
|
+
| Object | {object_name} |
|
|
104
|
+
| Network | {network} |
|
|
105
|
+
| Gas Budget | {estimated_gas} |
|
|
106
|
+
|
|
107
|
+
⚠️ **This will {describe_what_will_happen}**
|
|
108
|
+
|
|
109
|
+
Proceed with execution?
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Amount Verification Rules
|
|
113
|
+
|
|
114
|
+
When an operation involves token amounts:
|
|
115
|
+
|
|
116
|
+
1. **Always display the amount with token symbol** (not just raw number)
|
|
117
|
+
2. **Query token decimals first** if unsure about precision
|
|
118
|
+
```
|
|
119
|
+
query_toolkit({ query_type: "token_list" })
|
|
120
|
+
```
|
|
121
|
+
3. **Show both the raw amount and the human-readable amount**
|
|
122
|
+
4. **For allocations**: Show each recipient's percentage and estimated amount
|
|
123
|
+
5. **For rewards**: Show total pool size and distribution rules
|
|
124
|
+
|
|
125
|
+
## Publish Confirmation
|
|
126
|
+
|
|
127
|
+
Publishing a Service or Machine makes it publicly accessible. Before publishing:
|
|
128
|
+
|
|
129
|
+
1. **Verify all Guards are correct** — export with `guard2file` and review
|
|
130
|
+
2. **Verify all Machine nodes** — export with `machineNode2file` and review
|
|
131
|
+
3. **Test with dry runs** — simulate operations against the unpublished objects
|
|
132
|
+
4. **Confirm the publish intent** — publishing is irreversible in practice
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
⚠️ PUBLISH CONFIRMATION REQUIRED
|
|
136
|
+
|
|
137
|
+
You are about to publish:
|
|
138
|
+
- Service: {name} ({id})
|
|
139
|
+
- This will make it publicly accessible on-chain
|
|
140
|
+
- Guard rules: {summary}
|
|
141
|
+
- Machine workflow: {summary} (if applicable)
|
|
142
|
+
|
|
143
|
+
This action cannot be easily undone. Proceed?
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Account Safety
|
|
147
|
+
|
|
148
|
+
- **Never create accounts without user request** — `account_operation` with `op: "generate"`
|
|
149
|
+
- **Never share private keys or sensitive data** — these are local-only
|
|
150
|
+
- **Always confirm which account is being used** as the sender for transactions
|
|
151
|
+
- **Check account balance** before operations that require gas
|
|
152
|
+
|
|
153
|
+
## What the AI MUST Do
|
|
154
|
+
|
|
155
|
+
1. ✅ Always dry-run first, show preview
|
|
156
|
+
2. ✅ Always get explicit confirmation before executing
|
|
157
|
+
3. ✅ Always show amounts with token symbols
|
|
158
|
+
4. ✅ Always warn before publishing
|
|
159
|
+
5. ✅ Always confirm the sender account
|
|
160
|
+
6. ✅ Always check for sufficient gas balance
|
|
161
|
+
|
|
162
|
+
## What the AI MUST NOT Do
|
|
163
|
+
|
|
164
|
+
1. ❌ Never execute on-chain writes without user confirmation
|
|
165
|
+
2. ❌ Never skip the dry-run phase
|
|
166
|
+
3. ❌ Never hide or obscure financial amounts
|
|
167
|
+
4. ❌ Never publish without explicit user request
|
|
168
|
+
5. ❌ Never use a different account than what the user specified
|
|
169
|
+
6. ❌ Never proceed if the dry run shows errors
|
|
170
|
+
|
|
171
|
+
## Real-World Safety Patterns (from tested examples)
|
|
172
|
+
|
|
173
|
+
### Pattern 1: Dry-Run Before Every Structural Change
|
|
174
|
+
|
|
175
|
+
**From [Insurance](../examples/Insurance/Insurance.md), [Travel](../examples/Travel/Travel.md), [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md)**
|
|
176
|
+
|
|
177
|
+
Every structural operation in the tested examples follows this exact two-phase pattern:
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
// Phase 1: Validate (no submission → no state change)
|
|
181
|
+
onchain_operations({
|
|
182
|
+
operation_type: "<type>",
|
|
183
|
+
data: { ... },
|
|
184
|
+
env: { account: "<name>", network: "testnet" }
|
|
185
|
+
})
|
|
186
|
+
→ Review the returned preview. Check: object IDs, guard logic, amounts.
|
|
187
|
+
|
|
188
|
+
// Phase 2: Execute (only after user confirms)
|
|
189
|
+
onchain_operations({
|
|
190
|
+
operation_type: "<type>",
|
|
191
|
+
data: { ... },
|
|
192
|
+
env: { account: "<name>", network: "testnet" },
|
|
193
|
+
submission: { sender: "<name>", gas_budget: "10000000" }
|
|
194
|
+
})
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Pattern 2: Guard Logic Verification Before Deployment
|
|
198
|
+
|
|
199
|
+
**From [Insurance](../examples/Insurance/Insurance.md) — Time-Lock Guard**
|
|
200
|
+
|
|
201
|
+
Before deploying a Guard that controls fund release (Payment, Allocation, Reward), ALWAYS:
|
|
202
|
+
|
|
203
|
+
1. Export the Guard for human review:
|
|
204
|
+
```
|
|
205
|
+
guard2file({ guard: "insurance_complete_guard_v1", file_path: "./guard_review.json", format: "json" })
|
|
206
|
+
```
|
|
207
|
+
2. Test the Guard logic with `gen_passport`:
|
|
208
|
+
```
|
|
209
|
+
onchain_operations({
|
|
210
|
+
operation_type: "gen_passport",
|
|
211
|
+
data: { guard: "insurance_complete_guard_v1" },
|
|
212
|
+
info: { name: "guard_test", b_submission: true }
|
|
213
|
+
})
|
|
214
|
+
```
|
|
215
|
+
This submits runtime values to the Guard and returns pass/fail — without any state change.
|
|
216
|
+
|
|
217
|
+
**From [Travel](../examples/Travel/Travel.md) — Weather Check Guard**
|
|
218
|
+
|
|
219
|
+
The Travel example demonstrates guard testing with specific runtime values:
|
|
220
|
+
- The Guard queries `weather_repo_v2` for a given date
|
|
221
|
+
- Test with `gen_passport`, submitting a timestamp that maps to "sunny" → should pass
|
|
222
|
+
- Test with a timestamp that maps to "rainy" → should fail
|
|
223
|
+
- This validates the Guard BEFORE it protects real funds in an Allocation
|
|
224
|
+
|
|
225
|
+
**From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md) — Service Guard Testing**
|
|
226
|
+
|
|
227
|
+
Service-level Guards (`service_merchant_win_v2`, `service_customer_win_v2`) control fund allocation. Before binding these to `order_allocators`:
|
|
228
|
+
1. Export each Guard with `guard2file`
|
|
229
|
+
2. Test with `gen_passport`, submitting mock order progress data
|
|
230
|
+
3. Verify: correct node → pass, wrong node → fail
|
|
231
|
+
4. Only then bind to Service's `order_allocators`
|
|
232
|
+
|
|
233
|
+
### Pattern 3: Publish-Immutability Checklist
|
|
234
|
+
|
|
235
|
+
**From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md) — Build Order Rationale**
|
|
236
|
+
|
|
237
|
+
Before any publish operation, verify this checklist:
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
PUBLISH CHECKLIST
|
|
241
|
+
├─ Machine publish:
|
|
242
|
+
│ ├─ ✅ All nodes defined and reviewed (machineNode2file)
|
|
243
|
+
│ ├─ ✅ All forward guards created and tested (gen_passport)
|
|
244
|
+
│ ├─ ✅ Permission indexes assigned to correct accounts
|
|
245
|
+
│ └─ ⚠️ After publish: nodes become IMMUTABLE
|
|
246
|
+
│
|
|
247
|
+
├─ Service publish:
|
|
248
|
+
│ ├─ ✅ Machine bound to Service (machine field set)
|
|
249
|
+
│ ├─ ✅ Allocation rules finalized (order_allocators)
|
|
250
|
+
│ ├─ ✅ Sales/products defined (sales)
|
|
251
|
+
│ ├─ ✅ Guards tested (buy_guard, sell_guard)
|
|
252
|
+
│ └─ ⚠️ After publish: machine + allocation LOCKED
|
|
253
|
+
│
|
|
254
|
+
└─ Reward (post-publish):
|
|
255
|
+
└─ ✅ Can be added after Service publish (not locked)
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Pattern 4: Multi-Provider Coordination Safety
|
|
259
|
+
|
|
260
|
+
**From [Travel](../examples/Travel/Travel.md) — Two-Provider System**
|
|
261
|
+
|
|
262
|
+
When building a system that spans multiple accounts/providers:
|
|
263
|
+
|
|
264
|
+
1. **Each provider uses their own account** for operations on their own objects
|
|
265
|
+
- `weather_provider_v1` creates and manages `weather_repo_v2`
|
|
266
|
+
- `travel_provider_v1` creates and manages `travel_service_v1`
|
|
267
|
+
|
|
268
|
+
2. **Cross-provider references use names, not raw addresses**
|
|
269
|
+
- The weather check Guard references `"weather_repo_v2"` by name
|
|
270
|
+
- The MCP server resolves names to addresses automatically
|
|
271
|
+
|
|
272
|
+
3. **Data providers build their objects BEFORE consumers**
|
|
273
|
+
- Weather Repository + data exists before the Guard that queries it
|
|
274
|
+
- Insurance Service exists before Travel creates sub-orders on it
|
|
275
|
+
|
|
276
|
+
### Pattern 5: Amount Verification for Financial Operations
|
|
277
|
+
|
|
278
|
+
**From all examples — Payment, Order, Allocation operations**
|
|
279
|
+
|
|
280
|
+
All financial operations in the tested examples follow these conventions:
|
|
281
|
+
|
|
282
|
+
| Operation | Amount Format | Verification |
|
|
283
|
+
|-----------|--------------|-------------|
|
|
284
|
+
| `service.sales[].price` | Raw integer (smallest unit) | Verify with: `wowok_buildin_info({ info_type: "token_list" })` |
|
|
285
|
+
| `order.buy.total_pay.balance` | Raw integer | Confirm matches sales price × quantity |
|
|
286
|
+
| `reward.coin_add` | Raw integer | Confirm pool size against expected payouts |
|
|
287
|
+
| `allocation.sharing[].sharing` | Integer (Rate mode: basis points) | 10000 = 100%, 500 = 5% |
|
|
288
|
+
|
|
289
|
+
**From [Insurance](../examples/Insurance/Insurance.md):**
|
|
290
|
+
```
|
|
291
|
+
sales: [{ name: "Outdoor Accident Insurance", price: 100000000, stock: 1000 }]
|
|
292
|
+
// 100000000 = 1 WOW (if 1 WOW = 10^8 smallest units)
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**From [MyShop Advanced](../examples/MyShop_Advanced/MyShop_Advanced.md):**
|
|
296
|
+
```
|
|
297
|
+
order_allocators.allocators[].sharing: { sharing: 10000, mode: "Rate" }
|
|
298
|
+
// 10000 in Rate mode = 100% allocation
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Pattern 6: no_cache After Creation
|
|
302
|
+
|
|
303
|
+
**From [MyShop Advanced Test Results](../examples/MyShop_Advanced/MyShop_Advanced_MerchantSystem_TestResults.md)**
|
|
304
|
+
|
|
305
|
+
When querying an object immediately after creating it, always use `no_cache: true`:
|
|
306
|
+
|
|
307
|
+
```
|
|
308
|
+
// After creating a Permission:
|
|
309
|
+
onchain_operations({ operation_type: "permission", data: { object: { name: "myshop_permission_v2", ... } }, env: { ... } })
|
|
310
|
+
|
|
311
|
+
// Query it — must bypass cache:
|
|
312
|
+
query_toolkit({ query_type: "onchain_objects", objects: ["myshop_permission_v2"], no_cache: true })
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Without `no_cache: true`, the query may return stale data (object not found), causing the AI to incorrectly conclude the creation failed.
|
|
316
|
+
|
|
317
|
+
### Pattern 7: replaceExistName for Development Iterations
|
|
318
|
+
|
|
319
|
+
**From all examples — object naming convention**
|
|
320
|
+
|
|
321
|
+
During development, when iterating on object designs, use `replaceExistName: true` to overwrite previous versions:
|
|
322
|
+
|
|
323
|
+
```
|
|
324
|
+
data: {
|
|
325
|
+
object: { name: "myshop_permission_v2", replaceExistName: true, ... }
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
⚠️ **Safety note**: `replaceExistName: true` destroys the previous object with that name. Only use during development. In production, use versioned names (`_v1`, `_v2`, `_v3`).
|
|
330
|
+
|
|
331
|
+
### Pattern 8: Machine Creation Order — Nodes First, Then Publish
|
|
332
|
+
|
|
333
|
+
**From [Insurance](../examples/Insurance/Insurance.md) — Key Discovery**
|
|
334
|
+
|
|
335
|
+
The Insurance example documents a critical finding: Machine nodes must be added during creation (same transaction) before publishing. Adding nodes in separate transactions after creation may not persist correctly.
|
|
336
|
+
|
|
337
|
+
✅ **Correct** (single transaction):
|
|
338
|
+
```
|
|
339
|
+
onchain_operations({
|
|
340
|
+
operation_type: "machine",
|
|
341
|
+
data: {
|
|
342
|
+
object: { name: "insurance_machine_v1", permission: "..." },
|
|
343
|
+
node: { op: "add", nodes: [...] }, // nodes in same call
|
|
344
|
+
publish: true // publish in same call
|
|
345
|
+
}
|
|
346
|
+
})
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
❌ **Incorrect** (separate transactions):
|
|
350
|
+
```
|
|
351
|
+
// Step 1: Create machine (no nodes)
|
|
352
|
+
onchain_operations({ operation_type: "machine", data: { object: {...} } })
|
|
353
|
+
// Step 2: Add nodes (may not persist)
|
|
354
|
+
onchain_operations({ operation_type: "machine", data: { object: "...", node: { op: "add", nodes: [...] } } })
|
|
355
|
+
// Step 3: Publish
|
|
356
|
+
onchain_operations({ operation_type: "machine", data: { object: "...", publish: true } })
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
## Safety Decision Tree for On-Chain Operations
|
|
360
|
+
|
|
361
|
+
```
|
|
362
|
+
About to execute onchain_operations?
|
|
363
|
+
├─ Is this a READ operation? (query_toolkit, onchain_table_data, etc.)
|
|
364
|
+
│ └─ ✅ SAFE — proceed without confirmation
|
|
365
|
+
│
|
|
366
|
+
├─ Is this a WRITE operation? (onchain_operations with submission)
|
|
367
|
+
│ ├─ Does it involve money? (payment, reward, treasury, allocation)
|
|
368
|
+
│ │ └─ 🔴 HIGH RISK — must show amounts + token type + recipient + get double confirmation
|
|
369
|
+
│ │
|
|
370
|
+
│ ├─ Does it publish something? (service.publish, machine.publish)
|
|
371
|
+
│ │ └─ 🟡 MEDIUM RISK — must show what will be locked + get confirmation
|
|
372
|
+
│ │
|
|
373
|
+
│ ├─ Does it modify guards/permissions? (guard, permission)
|
|
374
|
+
│ │ └─ 🟡 MEDIUM RISK — must explain what access changes + get confirmation
|
|
375
|
+
│ │
|
|
376
|
+
│ └─ Is it a structural change? (service.update, machine.node)
|
|
377
|
+
│ └─ 🟢 LOW-MEDIUM — show what changes + get confirmation
|
|
378
|
+
│
|
|
379
|
+
└─ Is this a DRY RUN? (no submission field)
|
|
380
|
+
└─ ✅ SAFE — no state change, but still review the preview for errors
|
|
381
|
+
```
|