@wowok/skills 1.1.6 → 1.1.7
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/dist/skills.js +1 -1
- package/dist/skills.js.map +1 -1
- package/package.json +1 -1
- package/wowok-guard/SKILL.md +12 -12
- package/wowok-machine/SKILL.md +136 -150
- package/wowok-messenger/SKILL.md +148 -177
- package/wowok-order/SKILL.md +1 -1
- package/wowok-provider/SKILL.md +3 -3
- package/wowok-safety/SKILL.md +6 -4
- package/wowok-tools/SKILL.md +106 -156
package/dist/skills.js
CHANGED
|
@@ -77,7 +77,7 @@ exports.wowokSkills = {
|
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
name: 'wowok-tools',
|
|
80
|
-
description: 'MCP tool usage mastery — query_toolkit, onchain_operations, messenger_operation, schema_query, and all 13
|
|
80
|
+
description: 'MCP tool usage mastery — query_toolkit, onchain_operations, messenger_operation, schema_query, and all 13 tools with correct parameter formats. ALWAYS loaded for all roles.',
|
|
81
81
|
version: '1.0.0',
|
|
82
82
|
role: 'shared',
|
|
83
83
|
loading: 'always',
|
package/dist/skills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":";;;AAgHA,8BAEC;AAKD,wCAEC;AAKD,0CAEC;AAKD,gDAEC;AAKD,sCA4BC;AAMD,0CAyBC;AArMD;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEU,QAAA,WAAW,GAAgB;IACtC,MAAM,EAAE;QACN,wBAAwB;QACxB;YACE,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,sKAAsK;YACnL,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,WAAW;YACpB,OAAO,EAAE,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,CAAC;SAClF;QAED,wBAAwB;QACxB;YACE,IAA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E,6DAA6D;SAC3E;QACD;YACE,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,YAAY;YACtB,WAAW,EAAE,mDAAmD;SACjE;QACD;YACE,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,cAAc;YACxB,WAAW,EAAE,0CAA0C;SACxD;KACF,CAAC;IAEF,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,GAAG,CAAC;QACJ,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC;KAChC,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,SAAgB,eAAe,CAAC,MAAc;IAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IAEnC,oBAAoB;IACpB,IAAI,wFAAwF,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACzG,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAED,oBAAoB;IACpB,IAAI,0FAA0F,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3G,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAED,sBAAsB;IACtB,IAAI,4EAA4E,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7F,OAAO,eAAe,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;IAED,iBAAiB;IACjB,IAAI,yEAAyE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1F,OAAO,CAAC,cAAc,CAAC,aAAa,CAAE,CAAC,CAAC;IAC1C,CAAC;IAED,uCAAuC;IACvC,OAAO,kBAAkB,CAAC,WAAW,CAAC,CAAC;AACzC,CAAC"}
|
package/package.json
CHANGED
package/wowok-guard/SKILL.md
CHANGED
|
@@ -6,7 +6,7 @@ description: |
|
|
|
6
6
|
the trust layer for Services (buy_guard), Arbitration (voting_guard weight,
|
|
7
7
|
usage_guard), Machines (forward validation), Demands (recommendation filtering),
|
|
8
8
|
Rewards (claim eligibility), and Repositories (write validation with data extraction).
|
|
9
|
-
Guards also enable off-chain use cases: generate a Passport via `gen_passport` to
|
|
9
|
+
Guards also enable off-chain use cases: generate a Passport via `onchain_operations` (`operation_type: "gen_passport"`) to
|
|
10
10
|
obtain a signed, time-bound credential for off-chain permission verification.
|
|
11
11
|
when_to_use:
|
|
12
12
|
- User wants to create or modify a Guard
|
|
@@ -120,7 +120,7 @@ Entity reputation? → query + table entry declaring ENTITY_REGISTRAR_ADDRESS(
|
|
|
120
120
|
|
|
121
121
|
**Design thoroughly before calling the create operation** — there is no edit phase after creation (see The Immutability Contract above).
|
|
122
122
|
|
|
123
|
-
1. **Query available query instructions first**: Before designing any Guard that queries on-chain data, use `wowok_buildin_info` with
|
|
123
|
+
1. **Query available query instructions first**: Before designing any Guard that queries on-chain data, use `wowok_buildin_info` with info `"guard instructions"` to retrieve the complete list of available query instructions. Each query has a specific ID, name, parameters, and return type — you MUST verify these details before constructing your Guard. Never guess query instruction names or parameter types.
|
|
124
124
|
2. List every data dependency — what must the caller provide? What constants are baked in?
|
|
125
125
|
3. Sketch the logic tree — what comparisons, arithmetic, and logical combinations produce the final boolean?
|
|
126
126
|
4. Verify types — does every comparison receive compatible operands? Are all conversions explicit?
|
|
@@ -138,7 +138,7 @@ The Guard table is the **complete declaration of information** the Guard consume
|
|
|
138
138
|
|-------|---------|---------------|
|
|
139
139
|
| `identifier` | Unique index (0–255). The computation tree uses this number to reference the entry. | Always |
|
|
140
140
|
| `b_submission` | Whether the **caller** must provide this value at runtime. `true` = runtime submission; `false` = pre-set constant. | Always |
|
|
141
|
-
| `value_type` | The type of the value: Bool, Address, String, U8–U256, or vector types. Uses numeric type codes (use `wowok_buildin_info` with
|
|
141
|
+
| `value_type` | The type of the value: Bool, Address, String, U8–U256, or vector types. Uses numeric type codes (use `wowok_buildin_info` with info `"value types"` for the complete mapping). | Always |
|
|
142
142
|
| `value` | The constant value when `b_submission` is false; a placeholder when `b_submission` is true. | When `b_submission` is false |
|
|
143
143
|
| `name` | Human-readable label describing what this entry represents. | Always |
|
|
144
144
|
|
|
@@ -165,7 +165,7 @@ The Guard table is the **complete declaration of information** the Guard consume
|
|
|
165
165
|
- Query instruction's object type must match witness target type
|
|
166
166
|
- Type mismatches cause Guard creation to fail
|
|
167
167
|
|
|
168
|
-
**Available witness types** are defined in the schema — query `wowok_buildin_info` with `"guard instructions"` for the complete list with use cases.
|
|
168
|
+
**Available witness types** are defined in the schema — query `wowok_buildin_info` with info `"guard instructions"` for the complete list with use cases.
|
|
169
169
|
|
|
170
170
|
**Notable**: `TypeArbArbitration (105)`: Arb and Arbitration are **different on-chain objects**. The witness queries the Arbitration (parent service) from an Arb (case) address — the binding is set when Arbitration creates the Arb. Schema describes this as "access arbitration configuration or fee settings."
|
|
171
171
|
|
|
@@ -196,7 +196,7 @@ This returns the complete `GuardNodeSchema` definition — every node type, its
|
|
|
196
196
|
|
|
197
197
|
**Key principle**: Every node declares its return type and the types it expects from children. The schema enforces these constraints at Guard creation time — type mismatches cause creation to fail. All numeric comparisons normalize to U256, enabling cross-type comparisons without explicit conversion.
|
|
198
198
|
|
|
199
|
-
**Query instructions**: For the `query` node, discover available instructions via `wowok_buildin_info` with
|
|
199
|
+
**Query instructions**: For the `query` node, discover available instructions via `wowok_buildin_info` with info `"guard instructions"`. Use the `filter` parameter to narrow results by name, return type, parameter count, or object type — more effective than browsing raw ID ranges.
|
|
200
200
|
|
|
201
201
|
---
|
|
202
202
|
|
|
@@ -222,9 +222,9 @@ Use `onchain_operations` with `operation_type: "guard"`.
|
|
|
222
222
|
|
|
223
223
|
Before embedding a Guard into a live Machine, Service, or Arbitration, test it in isolation.
|
|
224
224
|
|
|
225
|
-
**Tool**: `gen_passport`
|
|
225
|
+
**Tool**: `onchain_operations` with `operation_type: "gen_passport"`
|
|
226
226
|
|
|
227
|
-
**Schema Reference**: `schema_query({ action: "get", name: "
|
|
227
|
+
**Schema Reference**: `schema_query({ action: "get", name: "onchain_operations_gen_passport" })`
|
|
228
228
|
|
|
229
229
|
This tool verifies one or more Guards and, on success, generates an immutable Passport — a verified credential stored on-chain. Use it to:
|
|
230
230
|
|
|
@@ -307,7 +307,7 @@ Each object extracts Guard data with precise type expectations. Mismatches cause
|
|
|
307
307
|
|
|
308
308
|
2. **Type mismatches in comparison nodes**: A `logic_equal` comparing a String to a U64 fails validation. Use explicit conversion nodes (`convert_string_number`, `convert_number_string`) when types differ. Numeric comparisons use `logic_as_u256_*` variants which auto-widen to U256.
|
|
309
309
|
|
|
310
|
-
3. **Wrong query instruction IDs or parameter counts**: Query instructions are system-defined. Always discover them through `wowok_buildin_info` with `"guard instructions"`. The parameter count and types in your query node must match the instruction exactly — off-by-one parameter counts are a common failure.
|
|
310
|
+
3. **Wrong query instruction IDs or parameter counts**: Query instructions are system-defined. Always discover them through `wowok_buildin_info` with info `"guard instructions"`. The parameter count and types in your query node must match the instruction exactly — off-by-one parameter counts are a common failure.
|
|
311
311
|
|
|
312
312
|
4. **Missing convert_witness**: When accessing Progress data from an Order ID in the table, the query node needs `convert_witness` with the appropriate witness type. Without it, the runtime looks for a Progress at the Order's address — which does not exist as a Progress object. The creation-time validation catches this mismatch.
|
|
313
313
|
|
|
@@ -329,10 +329,10 @@ Each object extracts Guard data with precise type expectations. Mismatches cause
|
|
|
329
329
|
|
|
330
330
|
| Tool | Purpose |
|
|
331
331
|
|------|---------|
|
|
332
|
-
| `wowok_buildin_info` (`
|
|
333
|
-
| `wowok_buildin_info` (`
|
|
334
|
-
| `wowok_buildin_info` (`
|
|
335
|
-
| `gen_passport` | Test Guard validation with runtime submissions and generate a verified on-chain credential on success |
|
|
332
|
+
| `wowok_buildin_info` (`info: "guard instructions"`) | Discover all available query instructions — their IDs, parameter types, return types, and target object types |
|
|
333
|
+
| `wowok_buildin_info` (`info: "value types"`) | Discover the numeric codes for all supported value types used in table entries |
|
|
334
|
+
| `wowok_buildin_info` (`info: "built-in permissions"`) | Discover all built-in permission index codes for use with `permission.entity.perm has` queries |
|
|
335
|
+
| `onchain_operations` (`operation_type: "gen_passport"`) | Test Guard validation with runtime submissions and generate a verified on-chain credential on success |
|
|
336
336
|
| `guard2file` | Export an existing Guard's complete definition (description, table, root tree, dependencies) to a local JSON or Markdown file |
|
|
337
337
|
| `query_toolkit` (`query_type: "onchain_objects"`) | Query any Guard object on-chain by name or address to inspect its full definition |
|
|
338
338
|
| `schema_query` (`name: "onchain_operations_guard"`) | Retrieve the complete Guard operation schema with all parameter definitions |
|
package/wowok-machine/SKILL.md
CHANGED
|
@@ -9,7 +9,7 @@ description: |
|
|
|
9
9
|
Covers Machine architecture (Nodes, Pairs, Forwards, Guards, Thresholds),
|
|
10
10
|
lifecycle management (create, configure, publish, pause), node operations
|
|
11
11
|
(add, exchange, rename, granular forward/prior-node manipulation),
|
|
12
|
-
Progress integration, cross-
|
|
12
|
+
Progress integration, cross-Machine supply chain composition via Guard verification, privacy-preserving
|
|
13
13
|
consensus patterns, and export/import workflows via machineNode2file.
|
|
14
14
|
when_to_use:
|
|
15
15
|
- User wants to create or modify a Machine workflow
|
|
@@ -24,108 +24,69 @@ when_to_use:
|
|
|
24
24
|
|
|
25
25
|
Design, build, and operate automated workflow templates.
|
|
26
26
|
|
|
27
|
-
> **Role**: Service Provider or Workflow Designer
|
|
28
|
-
> **Key Tools**: `onchain_operations` with `operation_type: "machine"`
|
|
27
|
+
> **Role**: Service Provider or Workflow Designer
|
|
28
|
+
> **Key Tools**: `onchain_operations` with `operation_type: "machine"`
|
|
29
29
|
> **Related Skills**: [wowok-guard](../wowok-guard/SKILL.md) (Guards), [wowok-provider](../wowok-provider/SKILL.md) (Service binding), [wowok-order](../wowok-order/SKILL.md) (customer perspective), [wowok-messenger](../wowok-messenger/SKILL.md) (privacy), [wowok-safety](../wowok-safety/SKILL.md) (safety), [wowok-tools](../wowok-tools/SKILL.md) (schema reference)
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
33
|
## Core Concepts
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
**Machine** = workflow blueprint (directed graph of Nodes → Pairs → Forwards). **Progress** = live workflow instance, one per order.
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
**Key Analogy**: Machine = workflow blueprint, Progress = live workflow instance.
|
|
40
|
-
|
|
41
|
-
### Immutability Rules
|
|
42
|
-
|
|
43
|
-
| Object | When Immutable | Impact |
|
|
44
|
-
|--------|---------------|--------|
|
|
45
|
-
| **Machine** | After `publish: true` | All nodes are locked; workflow topology frozen |
|
|
46
|
-
| **Guard** | After creation | CREATE-only, cannot modify |
|
|
47
|
-
|
|
48
|
-
Because published Machines are immutable, you must design the complete workflow before publishing. However, before publishing, nodes can be freely added, removed, renamed, and reorganized.
|
|
49
|
-
|
|
50
|
-
---
|
|
37
|
+
Machines are **immutable after `publish: true`**; Guards are **CREATE-only**. Design the complete workflow before publishing.
|
|
51
38
|
|
|
52
39
|
## Machine Architecture
|
|
53
40
|
|
|
54
|
-
### The Building Blocks
|
|
55
|
-
|
|
56
|
-
A Machine is composed of three structural layers:
|
|
57
|
-
|
|
58
41
|
```
|
|
59
42
|
Machine
|
|
60
|
-
└── Nodes
|
|
61
|
-
└── Pairs
|
|
62
|
-
├── prev_node: which prior node
|
|
43
|
+
└── Nodes
|
|
44
|
+
└── Pairs
|
|
45
|
+
├── prev_node: which prior node ("" = entry point, multiple allowed)
|
|
63
46
|
├── threshold: required total forward weight to advance
|
|
64
|
-
└── Forwards (
|
|
65
|
-
├── name
|
|
66
|
-
├── weight: contribution toward threshold
|
|
47
|
+
└── Forwards (MachineForward)
|
|
48
|
+
├── name, weight
|
|
67
49
|
├── permissionIndex | namedOperator: who can execute
|
|
68
50
|
└── guard (optional): condition that must pass
|
|
69
51
|
```
|
|
70
52
|
|
|
71
|
-
**Schema
|
|
72
|
-
|
|
73
|
-
### Node
|
|
74
|
-
|
|
75
|
-
A Node represents a **stage or state** in the workflow. Each node has a unique name and contains one or more Pairs defining how to reach it and what Forwards are available from it.
|
|
76
|
-
|
|
77
|
-
Node names must be unique within a Machine. The empty string (`""`) represents the initial state — any Pair with `prev_node: ""` is an entry point. A Machine can have multiple entry nodes, each with its own threshold configuration.
|
|
78
|
-
|
|
79
|
-
### Pair (NodePair)
|
|
53
|
+
> **Schema**: `schema_query({ action: "get", name: "onchain_operations_machine" })` — all field types, limits, valid values. This document focuses on design decisions **not captured** by the schema.
|
|
80
54
|
|
|
81
|
-
|
|
82
|
-
- **`prev_node`**: Source node name (`""` for entry point)
|
|
83
|
-
- **`threshold`**: Total weight required to trigger advancement
|
|
84
|
-
- **`forwards`**: Available operations from this Pair
|
|
55
|
+
### Forward Permission Model
|
|
85
56
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
### Forward
|
|
89
|
-
|
|
90
|
-
A Forward is a **named operation** that users execute to advance the workflow. Each Forward has:
|
|
91
|
-
|
|
92
|
-
- **`name`**: A descriptive operation identifier (e.g., "Confirm Order", "Ship Goods", "Complete Signature").
|
|
93
|
-
- **`weight`**: A 16-bit unsigned integer (0-65535) representing this Forward's contribution toward the threshold. When the sum of completed Forward weights in the current session meets or exceeds the Pair's threshold, the node transition triggers.
|
|
94
|
-
- **`permissionIndex`** and/or **`namedOperator`**: At least one must be specified — both can be set simultaneously, in which case the executor needs EITHER permission to execute the Forward.
|
|
95
|
-
|
|
96
|
-
**Permission Model**:
|
|
97
|
-
|
|
98
|
-
| Field | Scope | Typical Use |
|
|
57
|
+
| Field | Scope | When to Use |
|
|
99
58
|
|-------|-------|-------------|
|
|
100
|
-
| `permissionIndex` | Shared across ALL Progress instances
|
|
101
|
-
| `namedOperator` | Per-Progress namespace |
|
|
102
|
-
|
|
103
|
-
- Use `namedOperator: ""` (empty string) to grant order owner and their agents the right to execute the Forward. This is the standard way to let customers operate on their own orders.
|
|
104
|
-
- Use `namedOperator: "<role_name>"` for role-based operators managed per Progress instance — ideal when different orders have different delivery personnel or reviewers.
|
|
105
|
-
- **Both set**: When `permissionIndex` AND `namedOperator` are both specified, the executor needs EITHER permission to execute the Forward — the permissions act as alternatives. This is useful when the same operation should be executable by either internal staff (via `permissionIndex`) or external roles (via `namedOperator`).
|
|
59
|
+
| `permissionIndex` | Shared across ALL Progress instances | Internal staff (warehouse, admin, platform) — same for every order |
|
|
60
|
+
| `namedOperator` | Per-Progress namespace | Roles that differ per order (delivery person, reviewer, agent) |
|
|
106
61
|
|
|
107
|
-
|
|
62
|
+
- `namedOperator: ""` (empty string): grants **order owner and agents** the right to execute. Standard way to let customers operate.
|
|
63
|
+
- `namedOperator: "<role_name>"`: role-based operators managed per Progress instance. Each Progress independently assigns addresses to role names.
|
|
64
|
+
- **Both fields set**: executor needs EITHER permission — internal staff OR external roles.
|
|
65
|
+
- **Design principle**: Use custom permissions (dedicated Permission object with custom indices), not built-in indices. Define workflow-specific roles, reference those indices in Forwards.
|
|
108
66
|
|
|
109
67
|
### Guard on Forwards
|
|
110
68
|
|
|
111
|
-
A Forward
|
|
69
|
+
A Guard validates the Forward's execution condition. **Retained submissions**: when `retained_submission` is set on a Guard, submitted values are stored in Progress history, uniquely located by `(current_node, next_node, forward_name)`. Later nodes query these values from history.
|
|
112
70
|
|
|
113
|
-
**
|
|
71
|
+
> **Guard construction**: See [wowok-guard](../wowok-guard/SKILL.md) for table design, computation trees, and query instructions.
|
|
114
72
|
|
|
115
|
-
|
|
73
|
+
### Threshold Mechanics
|
|
116
74
|
|
|
117
|
-
|
|
75
|
+
Users execute Forwards from the current node, accumulating weight within a **session**. When the sum of completed Forward weights meets or exceeds the Pair's threshold, the session finalizes and the workflow advances.
|
|
118
76
|
|
|
119
|
-
|
|
77
|
+
**Session behavior**: Each Forward is counted once per session. Repeated execution of the same Forward within one session adds no extra weight. A completed Forward cannot be re-executed until session reset (on node transition).
|
|
120
78
|
|
|
121
|
-
|
|
79
|
+
**Competing Transitions**: If a node has multiple Pairs to different targets, the **first Pair to meet its threshold wins** — remaining incomplete Forwards in other Pairs are **abandoned**. Competing paths are mutually exclusive by design. A Pair whose threshold can never be met because users always prefer another path creates a **dead branch**.
|
|
122
80
|
|
|
123
|
-
**
|
|
81
|
+
**Execution Patterns**:
|
|
124
82
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
83
|
+
| Pattern | Mechanism | Use Case |
|
|
84
|
+
|---------|-----------|----------|
|
|
85
|
+
| Sequential | `threshold=1`, single Forward `weight=1` | Single actor each step |
|
|
86
|
+
| Parallel AND | `threshold=N`, N Forwards `weight=1` | All parties must contribute |
|
|
87
|
+
| Parallel OR | Multiple Pairs, each `threshold=1` | Mutually exclusive branches |
|
|
88
|
+
| Weighted Voting | `threshold=100`, varied weights (e.g., 60+40) | Unequal stakeholder power |
|
|
89
|
+
| Hybrid | `threshold=5`, mixed weights (3+1+1) | Key party required, others optional |
|
|
129
90
|
|
|
130
91
|
---
|
|
131
92
|
|
|
@@ -133,56 +94,82 @@ The threshold is the **trigger value** for node advancement. Users execute Forwa
|
|
|
133
94
|
|
|
134
95
|
### Dependency-First Construction
|
|
135
96
|
|
|
136
|
-
|
|
97
|
+
Build in this exact order:
|
|
137
98
|
|
|
138
99
|
```
|
|
139
|
-
1. Permission (CREATE
|
|
140
|
-
2. Machine (CREATE, unpublished) → define
|
|
141
|
-
3. Guards (CREATE) → build conditions
|
|
142
|
-
4. Bind Guards to Forwards (MODIFY Machine) →
|
|
143
|
-
5. Publish Machine → nodes
|
|
144
|
-
6. Bind Machine to Service
|
|
100
|
+
1. Permission (CREATE/MODIFY) → access control foundation
|
|
101
|
+
2. Machine (CREATE, unpublished) → define all nodes
|
|
102
|
+
3. Guards (CREATE) → build validation conditions
|
|
103
|
+
4. Bind Guards to Forwards (MODIFY Machine) → set `guard` on each Forward; all operations (`add`, `set`, `add forward`) accept full `MachineForward` including `guard` + `retained_submission`
|
|
104
|
+
5. Publish Machine → nodes IMMUTABLE
|
|
105
|
+
6. Bind Machine to Service → workflow goes live
|
|
145
106
|
```
|
|
146
107
|
|
|
147
|
-
**
|
|
108
|
+
**Why this order matters**: Publishing locks the Machine. Guards are immutable. Publishing before Guards are ready means Guards can never be added — the Machine is frozen without validation rules. **Create Guards, test them, then publish.**
|
|
148
109
|
|
|
149
110
|
### Node Operations (Pre-Publish Only)
|
|
150
111
|
|
|
151
|
-
|
|
112
|
+
Nine operations are available via the `node` field. Query schema for full parameters. Key design notes not captured by schema:
|
|
113
|
+
|
|
114
|
+
- `add` / `set` with `bReplace: false` (default) **merges** into existing nodes; `true` replaces all.
|
|
115
|
+
- `clear` is **irreversible** — instant wipe with no undo. Export via `machineNode2file` first.
|
|
116
|
+
- `exchange` swaps two node positions without delete/recreate. `rename` auto-updates all Pair references.
|
|
117
|
+
- `add forward` supports the full `MachineForward` structure including `guard` with `retained_submission`.
|
|
152
118
|
|
|
153
|
-
**
|
|
119
|
+
> **Schema**: `schema_query({ action: "get", name: "onchain_operations_machine" })` for full operation parameters.
|
|
120
|
+
|
|
121
|
+
### File-Based Workflow
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
1. machineNode2file → export nodes to JSON/Markdown
|
|
125
|
+
2. Edit locally
|
|
126
|
+
3. node.json_or_markdown_file → COMPLETE REPLACEMENT of all nodes
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Always start from an on-chain export when available — exact current state beats rebuilding from scratch.
|
|
154
130
|
|
|
155
131
|
---
|
|
156
132
|
|
|
157
133
|
## Progress: The Live Workflow Instance
|
|
158
134
|
|
|
135
|
+
### Machine vs Progress
|
|
136
|
+
|
|
137
|
+
- **Machine**: Workflow blueprint — defines the topology, permissions, thresholds, and Guards. Shared across all orders.
|
|
138
|
+
- **Progress**: Live instance — tracks current node, session state, history. One per order (when Service-bound) or standalone.
|
|
139
|
+
|
|
159
140
|
### Progress Creation
|
|
160
141
|
|
|
161
|
-
|
|
162
|
-
- **Service Order**: When an Order is created on a Service with a bound Machine, Progress is automatically instantiated
|
|
163
|
-
- **Direct Creation**: Via `progress_new` operation with appropriate permissions
|
|
142
|
+
Two paths: **Service Order** (automatic when Order created on Service with bound Machine) or **Direct Creation** (via `progress_new`). For direct creation, pre-configure via `progress_new` fields on the Machine operation — this sets initial named operators, task binding, and repository list before the first Progress is spawned.
|
|
164
143
|
|
|
165
|
-
###
|
|
144
|
+
### Execution Paths
|
|
166
145
|
|
|
167
|
-
**Order-associated Progress
|
|
146
|
+
- **Order-associated Progress**: When a Forward uses `namedOperator: ""`, the order owner/agents execute via `order` operations.
|
|
147
|
+
- **Standalone Progress**: All other cases — advance via direct `progress` operations.
|
|
168
148
|
|
|
169
|
-
|
|
149
|
+
Two-phase operations (`hold`/`unhold`) allow locking resources during multi-step operations; `adminUnhold` force-releases stale locks.
|
|
170
150
|
|
|
171
|
-
**
|
|
151
|
+
> **Querying**: Progress state via `onchain_objects`, history via `onchain_table` / `onchain_table_item_progress_history`. Schema: `schema_query({ action: "get", name: "onchain_table_data" })`.
|
|
172
152
|
|
|
173
|
-
|
|
153
|
+
### Runtime: Advancing the Workflow
|
|
174
154
|
|
|
175
|
-
|
|
155
|
+
The runtime loop (schema: `onchain_operations` with `operation_type: "progress"` or `"order"`):
|
|
176
156
|
|
|
177
|
-
|
|
157
|
+
```
|
|
158
|
+
1. Query active Forwards → onchain_objects reveals current node name and available Pairs/Forwards
|
|
159
|
+
2. Execute Forward → weight accumulates in session; Guard validates (pass/fail);
|
|
160
|
+
retained_submission stores values indexed by (current_node, next_node, forward_name)
|
|
161
|
+
3. Threshold met → session commits to history (all completed Forwards recorded);
|
|
162
|
+
node transitions; session resets; new Forwards unlocked
|
|
163
|
+
4. OR threshold NOT met → session stays open; more Forwards can execute in same session;
|
|
164
|
+
weight from repeated same Forwards ignored
|
|
165
|
+
5. OR competing Pair wins first → other incomplete Pairs abandoned; next session starts on winner node
|
|
166
|
+
```
|
|
178
167
|
|
|
179
|
-
**
|
|
168
|
+
**What the user sees**: At any node, callers can discover which Forwards are available (by querying the Machine definition and cross-referencing with their permissions). Executing a Forward that requires a Guard triggers Guard verification — the caller must submit required data. Successful Forward execution is recorded on-chain; failed Guard rejections are visible as transaction errors.
|
|
180
169
|
|
|
181
|
-
|
|
182
|
-
- `query_toolkit` with `query_type: "onchain_table"` — query all history records from Progress table (paginated)
|
|
183
|
-
- `query_toolkit` with `query_type: "onchain_table_item_progress_history"` — query single history record by sequence number
|
|
170
|
+
**Session lifecycle**: A session begins when the first Forward executes from a new node. It stays open until threshold is met (closing the session and advancing) or the order completes/aborts. No session timeout — sessions persist until resolved. `hold`/`unhold` lock the session during multi-step external operations; `adminUnhold` force-releases stale locks.
|
|
184
171
|
|
|
185
|
-
**
|
|
172
|
+
> **Order-associated execution**: Forwards with `namedOperator: ""` are executable via `order` operations by the order owner/agents. All other Forwards use `progress` operations. See [wowok-order](../wowok-order/SKILL.md) for the customer execution flow.
|
|
186
173
|
|
|
187
174
|
---
|
|
188
175
|
|
|
@@ -202,85 +189,84 @@ Shipping → Delivery Complete → Order Complete
|
|
|
202
189
|
└──→ Return Complete
|
|
203
190
|
```
|
|
204
191
|
|
|
205
|
-
###
|
|
192
|
+
### Cross-Machine Supply Chain Composition
|
|
206
193
|
|
|
207
|
-
|
|
194
|
+
Decompose complex workflows into multiple Machines connected by Guard-based validation — avoiding monolithic bloat.
|
|
208
195
|
|
|
209
|
-
|
|
210
|
-
Start → Buy Insurance (creates sub-order on Insurance Service) → Main Activity → Complete
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
**Key Characteristics**:
|
|
214
|
-
- The Forward uses `forward_to_order_create` to specify the target Service for the sub-order
|
|
215
|
-
- The Guard on the Forward validates that the sub-order was successfully created
|
|
216
|
-
- Useful for supply chain transparency: "We use X supplier" becomes verifiable on-chain
|
|
196
|
+
**Sub-Progress Dependency**: Machine A's Forward Guards query Machine B's Progress to verify it has reached a target node before advancing.
|
|
217
197
|
|
|
218
|
-
**
|
|
219
|
-
- Forward "Buy Insurance" on the "Start" node creates a sub-order on the Insurance Service
|
|
220
|
-
- The Insurance sub-order follows its own Machine workflow independently
|
|
221
|
-
- Both workflows (Travel and Insurance) progress in parallel
|
|
198
|
+
**Sub-Order Verification**: Machine A's Forward Guard validates an Order exists on another Service with its Progress at the required state. The sub-order is created independently — the Guard only verifies.
|
|
222
199
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
Require both parties (customer and merchant) to confirm before advancing — used for sensitive operations like returns, lost packages, and completion.
|
|
200
|
+
**Multi-Party Chain**: Supplier → Manufacturer → Retailer, each Machine's entry condition verifies upstream completion via Guards querying `retained_submission` values.
|
|
226
201
|
|
|
227
|
-
|
|
228
|
-
-
|
|
229
|
-
-
|
|
202
|
+
**When to decompose** into multiple Machines:
|
|
203
|
+
- A sub-process is independently valuable as a standalone Service
|
|
204
|
+
- Different participant sets operate in different phases
|
|
205
|
+
- The sub-process is reusable across multiple parent workflows
|
|
230
206
|
|
|
231
|
-
|
|
207
|
+
**When to keep in one**:
|
|
208
|
+
- Same participants and permission model throughout
|
|
209
|
+
- Dense sequential data flow with no clear boundary
|
|
232
210
|
|
|
233
|
-
|
|
211
|
+
**Questions to ask the user**:
|
|
212
|
+
1. "Are there phases handled by different teams or services?"
|
|
213
|
+
2. "Could any part be offered as a standalone service?"
|
|
214
|
+
3. "Does any step depend on an external process completing first?"
|
|
215
|
+
4. "Which party creates the sub-order, and which party verifies it?"
|
|
234
216
|
|
|
235
|
-
|
|
217
|
+
> **Guard construction**: Cross-Machine Guards use `convert_witness` with Progress query instructions. See [wowok-guard](../wowok-guard/SKILL.md). Query available Guard instructions via `wowok_buildin_info`.
|
|
236
218
|
|
|
237
|
-
|
|
219
|
+
### Dual-Signature Consensus
|
|
238
220
|
|
|
239
|
-
|
|
221
|
+
Require both customer and merchant to confirm: `threshold=2` with two Forwards (`namedOperator: ""` for customer, `permissionIndex` for merchant), each `weight=1`. Both must execute to advance.
|
|
240
222
|
|
|
241
|
-
|
|
242
|
-
|----------|-----------------|----------------|
|
|
243
|
-
| Merchant ships order | Receives address via Messenger, replies with tracking number | Merchant submits Merkle Root to Guard on Forward |
|
|
244
|
-
| Customer returns item | Sends return tracking number via Messenger | Customer submits Merkle Root to Guard on Forward |
|
|
245
|
-
| Mutual confirmation | Both parties sign via Messenger | Both submit confirmation proofs |
|
|
223
|
+
### Privacy (Messenger)
|
|
246
224
|
|
|
247
|
-
|
|
225
|
+
Sensitive data flows through Messenger's end-to-end encryption; only Merkle Root proofs go on-chain. The principle: **who performs the action submits the proof**.
|
|
248
226
|
|
|
249
227
|
> **Full Guide**: See [wowok-messenger](../wowok-messenger/SKILL.md) for WTS evidence generation.
|
|
250
228
|
|
|
251
229
|
---
|
|
252
230
|
|
|
253
|
-
##
|
|
254
|
-
|
|
255
|
-
Handle service failures through automated compensation workflows. Guards validate penalty payments before allowing continuation.
|
|
256
|
-
|
|
257
|
-
### Late Delivery Penalty Pattern
|
|
231
|
+
## Common Pitfalls
|
|
258
232
|
|
|
259
|
-
|
|
233
|
+
### Mutability Traps
|
|
260
234
|
|
|
261
|
-
**
|
|
262
|
-
-
|
|
263
|
-
-
|
|
264
|
-
- Customer protection guarantee
|
|
265
|
-
- Service accountability
|
|
235
|
+
All stem from the same root: **every on-chain object has a publish/create freeze point**. See [Guard + Machine Immutability Deadlock](#guard--machine-immutability-deadlock). Key rules:
|
|
236
|
+
- Never publish before all Guards are created, tested, and bound.
|
|
237
|
+
- `clear` is irreversible — export via `machineNode2file` first.
|
|
266
238
|
|
|
267
|
-
|
|
239
|
+
### Pre-Publish Validation Checklist
|
|
268
240
|
|
|
269
|
-
|
|
241
|
+
Before `publish: true`, verify:
|
|
270
242
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
- **
|
|
274
|
-
-
|
|
275
|
-
-
|
|
276
|
-
-
|
|
277
|
-
-
|
|
243
|
+
- [ ] **Entry point exists**: at least one Pair with `prev_node: ""` — workflow cannot start otherwise
|
|
244
|
+
- [ ] **Every node has outgoing Forwards** (except terminals): no dead-end nodes
|
|
245
|
+
- [ ] **Every node has incoming Pair** (except entry): no orphaned nodes
|
|
246
|
+
- [ ] **All thresholds independently achievable**: no dead branches (competing Pair always wins first)
|
|
247
|
+
- [ ] All Guards exist on-chain and tested (use `gen_passport`)
|
|
248
|
+
- [ ] `namedOperator` vs `permissionIndex` correct per Forward
|
|
249
|
+
- [ ] Every Forward has at least one of `namedOperator` or `permissionIndex`
|
|
250
|
+
- [ ] Terminal nodes mapped to Allocator entries for fund distribution
|
|
251
|
+
- [ ] Tested end-to-end on testnet via a test Progress
|
|
252
|
+
- [ ] Current state exported via `machineNode2file` as backup
|
|
278
253
|
|
|
279
254
|
**Always test on testnet before mainnet** — Machines are immutable after publish.
|
|
280
255
|
|
|
281
256
|
---
|
|
282
257
|
|
|
283
|
-
##
|
|
258
|
+
## Guard + Machine Immutability Deadlock
|
|
259
|
+
|
|
260
|
+
Both Guards and published Machines are **immutable**:
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
Guard created with bug → Cannot fix (immutable)
|
|
264
|
+
→ Must create new Guard
|
|
265
|
+
→ Must rebind to Machine
|
|
266
|
+
→ Machine already published? Cannot modify (immutable)
|
|
267
|
+
→ DEADLOCK: new Guard exists but cannot be attached
|
|
268
|
+
```
|
|
284
269
|
|
|
285
|
-
**
|
|
270
|
+
**Prevention**: Test every Guard via `gen_passport` before binding. Verify computation tree, submission types, and query instructions against all scenarios.
|
|
286
271
|
|
|
272
|
+
**If deadlocked**: Only recovery is a completely new Machine with new nodes and Guard bindings, then rebind to Service. Keep Machines unpublished until all Guards are verified.
|