@wowok/agent-mcp 2.2.13 → 2.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +19 -11
  2. package/dist/index.js +44 -100
  3. package/dist/schema/query/index.js +1 -1
  4. package/dist/schema-query/index.d.ts +29 -0
  5. package/dist/schema-query/index.js +149 -0
  6. package/dist/schemas/account_operation.schema.json +255 -0
  7. package/dist/schemas/guard2file.schema.json +71 -0
  8. package/dist/schemas/index.json +139 -0
  9. package/dist/schemas/local_info_operation.schema.json +142 -0
  10. package/dist/schemas/local_mark_operation.schema.json +119 -0
  11. package/dist/schemas/machineNode2file.schema.json +71 -0
  12. package/dist/schemas/messenger_operation.schema.json +1393 -0
  13. package/dist/schemas/onchain_events.schema.json +113 -0
  14. package/dist/schemas/onchain_operations.schema.json +376 -0
  15. package/dist/schemas/onchain_operations_allocation.schema.json +914 -0
  16. package/dist/schemas/onchain_operations_arbitration.schema.json +1166 -0
  17. package/dist/schemas/onchain_operations_contact.schema.json +853 -0
  18. package/dist/schemas/onchain_operations_demand.schema.json +984 -0
  19. package/dist/schemas/onchain_operations_gen_passport.schema.json +1141 -0
  20. package/dist/schemas/onchain_operations_guard.schema.json +713 -0
  21. package/dist/schemas/onchain_operations_machine.schema.json +1347 -0
  22. package/dist/schemas/onchain_operations_order.schema.json +830 -0
  23. package/dist/schemas/onchain_operations_payment.schema.json +717 -0
  24. package/dist/schemas/onchain_operations_permission.schema.json +1088 -0
  25. package/dist/schemas/onchain_operations_personal.schema.json +1282 -0
  26. package/dist/schemas/onchain_operations_progress.schema.json +751 -0
  27. package/dist/schemas/onchain_operations_repository.schema.json +1572 -0
  28. package/dist/schemas/onchain_operations_reward.schema.json +955 -0
  29. package/dist/schemas/onchain_operations_service.schema.json +1411 -0
  30. package/dist/schemas/onchain_operations_treasury.schema.json +1155 -0
  31. package/dist/schemas/onchain_table_data.schema.json +35 -0
  32. package/dist/schemas/query_toolkit.schema.json +32 -0
  33. package/dist/schemas/schema_query.schema.json +33 -0
  34. package/dist/schemas/wip_file.schema.json +27 -0
  35. package/dist/schemas/wowok_buildin_info.schema.json +487 -0
  36. package/package.json +7 -5
  37. package/dist/docs/index.d.ts +0 -3
  38. package/dist/docs/index.js +0 -2
  39. package/dist/docs/loader.d.ts +0 -12
  40. package/dist/docs/loader.js +0 -177
  41. package/dist/docs/search.d.ts +0 -17
  42. package/dist/docs/search.js +0 -325
  43. package/dist/docs/types.d.ts +0 -55
  44. package/dist/docs/types.js +0 -1
  45. package/docs/README.md +0 -249
  46. package/docs/WIP.md +0 -388
  47. package/docs/WTS.md +0 -536
  48. package/docs/docs/account.md +0 -914
  49. package/docs/docs/allocation.md +0 -635
  50. package/docs/docs/arbitration.md +0 -1804
  51. package/docs/docs/arbitration_state_machine.md +0 -270
  52. package/docs/docs/contact.md +0 -709
  53. package/docs/docs/demand.md +0 -948
  54. package/docs/docs/guard.md +0 -1465
  55. package/docs/docs/localinfo.md +0 -432
  56. package/docs/docs/localmark.md +0 -583
  57. package/docs/docs/machine.md +0 -2490
  58. package/docs/docs/messenger.md +0 -2098
  59. package/docs/docs/onchain_events.md +0 -267
  60. package/docs/docs/order.md +0 -1001
  61. package/docs/docs/payment.md +0 -512
  62. package/docs/docs/permission.md +0 -1438
  63. package/docs/docs/personal.md +0 -742
  64. package/docs/docs/progress.md +0 -1748
  65. package/docs/docs/query.md +0 -467
  66. package/docs/docs/repository.md +0 -1043
  67. package/docs/docs/reward.md +0 -833
  68. package/docs/docs/service.md +0 -2130
  69. package/docs/docs/stage-01-introduction.md +0 -243
  70. package/docs/docs/stage-02-trust.md +0 -302
  71. package/docs/docs/stage-03-collaboration.md +0 -337
  72. package/docs/docs/stage-04-transaction.md +0 -277
  73. package/docs/docs/stage-05-business.md +0 -151
  74. package/docs/docs/stage-06-personal.md +0 -203
  75. package/docs/docs/stage-07-query.md +0 -572
  76. package/docs/docs/stage-08-examples.md +0 -184
  77. package/docs/docs/treasury.md +0 -1149
  78. package/docs/docs/wowok_buildin_info.md +0 -740
  79. package/docs/examples/Insurance/Insurance.md +0 -594
  80. package/docs/examples/Insurance/Insurance_TestResults.md +0 -481
  81. package/docs/examples/Insurance/insurance_complete_guard_v1.json +0 -50
  82. package/docs/examples/MyShop/MyShop.md +0 -1353
  83. package/docs/examples/MyShop/MyShop_TestResults.md +0 -1003
  84. package/docs/examples/MyShop_Advanced/MyShop_Advanced.md +0 -1898
  85. package/docs/examples/MyShop_Advanced/MyShop_Advanced_MerchantSystem_TestResults.md +0 -1297
  86. package/docs/examples/MyShop_Advanced/MyShop_Advanced_OrderFlow_TestResults.md +0 -743
  87. package/docs/examples/MyShop_Advanced/machine_nodes.json +0 -222
  88. package/docs/examples/ThreeBody_Signature/ThreeBody_Signature.md +0 -776
  89. package/docs/examples/ThreeBody_Signature/ThreeBody_Signature_TestResults.md +0 -599
  90. package/docs/examples/Travel/Travel.md +0 -1157
  91. package/docs/examples/Travel/Travel_TestResults.md +0 -743
  92. package/docs/examples/Travel/calc-weather-timestamps.js +0 -8
  93. package/docs/examples/Travel/travel_machine_v2_export.json +0 -104
  94. package/docs/examples/Travel/weather_check_guard_v1.json +0 -51
  95. package/docs/skills/WOWOK.md +0 -650
  96. package/docs/skills/onchain_operations/_common.md +0 -406
  97. package/docs/skills/onchain_operations/_index.md +0 -196
  98. package/docs/skills/onchain_operations/allocation.md +0 -28
  99. package/docs/skills/onchain_operations/arbitration.md +0 -106
  100. package/docs/skills/onchain_operations/contact.md +0 -40
  101. package/docs/skills/onchain_operations/demand.md +0 -53
  102. package/docs/skills/onchain_operations/gen_passport.md +0 -23
  103. package/docs/skills/onchain_operations/guard.md +0 -56
  104. package/docs/skills/onchain_operations/machine.md +0 -89
  105. package/docs/skills/onchain_operations/order.md +0 -56
  106. package/docs/skills/onchain_operations/payment.md +0 -24
  107. package/docs/skills/onchain_operations/permission.md +0 -68
  108. package/docs/skills/onchain_operations/personal.md +0 -58
  109. package/docs/skills/onchain_operations/progress.md +0 -38
  110. package/docs/skills/onchain_operations/repository.md +0 -70
  111. package/docs/skills/onchain_operations/reward.md +0 -38
  112. package/docs/skills/onchain_operations/service.md +0 -78
  113. package/docs/skills/onchain_operations/treasury.md +0 -68
  114. package/docs/skills/schema-account_operation.md +0 -402
  115. package/docs/skills/schema-guard2file.md +0 -153
  116. package/docs/skills/schema-local_info_operation.md +0 -160
  117. package/docs/skills/schema-local_mark_operation.md +0 -148
  118. package/docs/skills/schema-machineNode2file.md +0 -155
  119. package/docs/skills/schema-messenger_operation.md +0 -547
  120. package/docs/skills/schema-onchain_events.md +0 -201
  121. package/docs/skills/schema-onchain_table_data.md +0 -334
  122. package/docs/skills/schema-query_toolkit.md +0 -395
  123. package/docs/skills/schema-wip_file.md +0 -240
  124. package/docs/skills/schema-wowok_buildin_info.md +0 -296
  125. package/docs/wip-examples/three_body.html +0 -57
  126. package/docs/wip-examples/three_body.wip +0 -30
@@ -1,2490 +0,0 @@
1
- # Machine Component (⚙️ Workflow Templates)
2
-
3
- ---
4
-
5
- ## Component Overview
6
-
7
- The Machine component is WoWok's workflow automation engine, used to design and deploy automated workflow templates that define how services are delivered. Machines consist of nodes (workflow states) and forwards (operations that move the workflow forward), with permission checks and optional Guard validations.
8
-
9
- > **Note**: Use the `machineNode2file` tool (see [Sub-feature 19](#sub-feature-19-export-node-definitions-with-machinenode2file)) to export existing Machine node definitions from the blockchain to a JSON or Markdown file for editing and reuse. Pair with [Sub-feature 11](#sub-feature-11-complete-node-replacement-via-file) to quickly build new workflows from existing ones.
10
-
11
- ## Function List
12
-
13
- | Function Name | Purpose | Usage Scenario | Significance |
14
- |---------------|---------|----------------|-------------|
15
- | **Object Management** | Reference or create Machine objects | Initialize workflow templates, reference existing workflows | Foundation for all Machine operations - defines which workflow to modify |
16
- | **Set Description** | Add or update Machine description | Document workflow purpose, business rules | Improves workflow discoverability and maintainability |
17
- | **Repository Management** | Attach or detach Repository objects | Store workflow-related data, configuration | Enables data persistence and sharing across workflow instances |
18
- | **Node Operations** | Add/modify/remove/clear workflow nodes | Design workflow state transitions | Core of workflow design - defines the states and connections |
19
- | **Node File Replacement** | Complete node replacement from file | Bulk updates, template reuse | Efficient way to manage complex workflows |
20
- | **Export Node Definitions** | Export node definitions to JSON/Markdown file | Reuse workflows, backup, documentation | Extract node definitions from any on-chain Machine to quickly build new workflows |
21
- | **Progress Generation** | Create new Progress instances | Start workflow execution | Converts templates into active running workflows |
22
- | **Pause/Resume** | Control new Progress generation | Temporarily stop workflow creation | Manages workflow availability during updates |
23
- | **Publish Machine** | Lock nodes for production use | Finalize workflow before deployment | Prevents accidental modifications to active workflows |
24
- | **Owner Receive** | Unwrap and send received objects | Distribute assets, deliverables | Ensures proper asset flow to workflow owners |
25
- | **Contact Object** | Set or remove contact reference | Link communication channels | Enables messaging and coordination |
26
-
27
- ---
28
-
29
- ## Schema Tree (4-Level Structure)
30
-
31
- ```
32
- machine
33
- ├── operation_type: "machine"
34
- ├── data
35
- │ ├── object
36
- │ │ ├── Option 1: Name or Address (string)
37
- │ │ │ └── [machine_name or machine_id]
38
- │ │ └── Option 2: Named Object with Permission
39
- │ │ ├── name (string, optional)
40
- │ │ ├── tags (array of strings, optional)
41
- │ │ ├── onChain (boolean, optional)
42
- │ │ ├── replaceExistName (boolean, optional)
43
- │ │ └── permission
44
- │ │ ├── Option 1: Name or Address (string)
45
- │ │ │ └── [permission_name or permission_id]
46
- │ │ └── Option 2: Named Object with Description
47
- │ │ ├── name (string, optional)
48
- │ │ ├── tags (array of strings, optional)
49
- │ │ ├── onChain (boolean, optional)
50
- │ │ ├── replaceExistName (boolean, optional)
51
- │ │ └── description (string, optional)
52
- │ ├── description (string, optional)
53
- │ ├── repository (object, optional)
54
- │ │ ├── Option 1: op: "add" or "set"
55
- │ │ │ └── objects (array of strings)
56
- │ │ ├── Option 2: op: "remove"
57
- │ │ │ └── objects (array of strings)
58
- │ │ └── Option 3: op: "clear"
59
- │ ├── node (object, optional)
60
- │ │ ├── Option 1: Node Operations
61
- │ │ │ ├── op: "add"
62
- │ │ │ │ └── nodes (array)
63
- │ │ │ │ └── [machine_node]
64
- │ │ │ │ ├── name (string)
65
- │ │ │ │ └── pairs (array)
66
- │ │ │ ├── op: "set"
67
- │ │ │ │ └── nodes (array)
68
- │ │ │ │ └── [machine_node]
69
- │ │ │ │ ├── name (string)
70
- │ │ │ │ └── pairs (array)
71
- │ │ │ ├── op: "remove"
72
- │ │ │ │ └── nodes (array of strings)
73
- │ │ │ ├── op: "clear"
74
- │ │ │ ├── op: "exchange"
75
- │ │ │ │ ├── node_one (string)
76
- │ │ │ │ └── node_other (string)
77
- │ │ │ ├── op: "rename"
78
- │ │ │ │ ├── node_name_old (string)
79
- │ │ │ │ └── node_name_new (string)
80
- │ │ │ ├── op: "remove prior node"
81
- │ │ │ │ └── pairs (array)
82
- │ │ │ ├── op: "add forward"
83
- │ │ │ │ └── data (array)
84
- │ │ │ └── op: "remove forward"
85
- │ │ │ └── data (array)
86
- │ │ └── Option 2: json_or_markdown_file (string)
87
- │ ├── progress_new (object, optional)
88
- │ │ ├── task (string, optional)
89
- │ │ ├── repository (object, optional)
90
- │ │ ├── progress_namedOperator (object, optional)
91
- │ │ │ ├── op: "add" | "set" | "remove"
92
- │ │ │ ├── name (string)
93
- │ │ │ └── operators (object)
94
- │ │ └── namedNew (object, optional)
95
- │ │ ├── name (string, optional)
96
- │ │ ├── tags (array of strings, optional)
97
- │ │ ├── onChain (boolean, optional)
98
- │ │ └── replaceExistName (boolean, optional)
99
- │ ├── pause (boolean, optional)
100
- │ ├── publish (boolean, optional)
101
- │ ├── owner_receive (transfer received coins or NFT objects to owner, optional)
102
- │ │ ├── Option 1: "recently" (string) - receive all recent objects
103
- │ │ ├── Option 2: Array of received objects
104
- │ │ │ └── [{ id: "object_id", type: "object_type" }]
105
- │ │ └── Option 3: Received balance object
106
- │ │ ├── balance (number or string)
107
- │ │ ├── token_type (string)
108
- │ │ └── received (array of received items)
109
- │ └── um (Contact object, optional)
110
- │ ├── Option 1: Contact object name or ID (string)
111
- │ └── Option 2: null (to unbind contact)
112
- ├── env (optional, execution environment)
113
- │ ├── account (string, optional) - account name or address, empty string for default
114
- │ ├── network (string, optional) - "testnet" or "localnet"
115
- │ ├── permission_guard (array, optional) - list of permission guard IDs
116
- │ ├── no_cache (boolean, optional) - disable caching
117
- │ └── referrer (string, optional) - referrer ID
118
- └── submission (optional, submission data)
119
- ├── type (string) - fixed value "submission"
120
- ├── guard (array) - list of guards to verify
121
- │ └── [{ object: "guard_id", impack: boolean }]
122
- └── submission (array) - submission data for guards
123
- └── [{ guard: "guard_id", submission: [guard_submission_items] }]
124
- └── guard_submission_items
125
- ├── identifier (number, 0-255) - Guard table item identifier
126
- ├── b_submission (boolean) - whether this item requires submission
127
- ├── value_type (number | string) - value type (e.g., 6 or "U64" for U64 type)
128
- ├── **value (any) - submitted value**
129
- └── name (string, optional) - item name
130
- ```
131
-
132
- ---
133
-
134
- ### ⚠️ Important Note About Submission
135
-
136
- If the execution returns a `submission` field in the response, it indicates that additional Guard verification data is required. You must:
137
-
138
- 1. Complete all required submission data within the `submission` structure
139
- 2. Resubmit the operation with the completed submission data
140
- 3. **Do not modify any other parts of the structure** - only fill in the required submission values
141
-
142
- The submission structure will specify which Guard objects need verification and what data needs to be provided for each Guard table item.
143
-
144
- **Query Value Types**: Use the `wowok_buildin_info` tool with `{ "info": "value types" }` to query all supported value types with their numeric and string representations. This helps you understand what `value_type` values are valid for submission data.
145
-
146
- ---
147
-
148
- ## Complete Tool Call Structure
149
-
150
- Machine operations use the following top-level structure:
151
-
152
- ```json
153
- {
154
- "operation_type": "machine",
155
- "data": { ... },
156
- "env": { ... },
157
- "submission": { ... }
158
- }
159
- ```
160
-
161
- **Important**: To replace all nodes from a file, use `data.node.json_or_markdown_file` field (see Sub-feature 11).
162
-
163
- ---
164
-
165
- ## Constraint Constants
166
-
167
- | Constant Name | Value | Description |
168
- |---------------|-------|-------------|
169
- | `nameMaxLength` | 64 | Maximum name length (BCS characters) |
170
- | `weightMin` | 0 | Minimum forward weight |
171
- | `weightMax` | 65535 | Maximum forward weight |
172
- | `thresholdMax` | 4294967295 | Maximum threshold value (U32) |
173
- | `permissionIndexMin` | 1000 | Minimum custom permission index |
174
- | `permissionIndexMax` | 65535 | Maximum custom permission index |
175
-
176
- ---
177
-
178
- ## Machine Node Structure
179
-
180
- A Machine consists of nodes and their connections:
181
-
182
- ### Node Structure
183
-
184
- ```json
185
- {
186
- "name": "node_name",
187
- "pairs": [
188
- {
189
- "prev_node": "previous_node_name",
190
- "threshold": 1,
191
- "forwards": [
192
- {
193
- "name": "forward_name",
194
- "namedOperator": "namespace_name",
195
- "permissionIndex": 300,
196
- "weight": 1,
197
- "guard": {
198
- "guard": "guard_object_id"
199
- }
200
- }
201
- ]
202
- }
203
- ]
204
- }
205
- ```
206
-
207
- **Forward Permissions (MUST specify ONE):**
208
- - `namedOperator`: Namespace (for Progress-specific operators)
209
- - Use empty string `""` for **order permission** - allows order owner and agents to operate through Order object
210
- - Use other names for custom operator namespaces
211
- - `permissionIndex`: Permission index (shared across all Progress objects)
212
-
213
- ### Permission Index Guide for Forward Operations
214
-
215
- When defining forward operations in Machine nodes, the `permissionIndex` field specifies who can execute that forward. **Important**: The permission index for forward operations is NOT the same as Machine management permissions (200-208).
216
-
217
- **Valid permissionIndex values for forward operations:**
218
-
219
- 1. **User-defined permissions (1000-65535)** - Recommended for business-specific workflow operations
220
- - Must be granted to operators via the Permission component before use
221
- - Each Progress instance shares the same operators
222
- - Example: Use 1000 for "confirm_order", 1001 for "deliver_goods"
223
-
224
- 2. **Built-in permissions (100-450+)** - Use appropriate built-in permissions for common operations
225
- - Repository: 100-105 (repository.new, repository.description, etc.)
226
- - Reward: 150-157 (reward.new, reward.description, etc.)
227
- - Service: 300-320 (service.new, service.description, etc.)
228
- - And more...
229
-
230
- **NOT for forward operations:**
231
- - Machine management permissions (200-208): These control Machine object operations (create, modify nodes, publish), NOT workflow transitions
232
- - Progress management permissions (220-225): These control Progress object operations, NOT workflow transitions
233
-
234
- **Alternative to permissionIndex:**
235
- - Use `namedOperator` instead of `permissionIndex` for Progress-specific operator assignments
236
- - Each Progress instance can have different operators for the same namedOperator namespace
237
-
238
- ---
239
-
240
- ## Sub-feature 1: Create Machine Object
241
-
242
- ### Feature Description
243
-
244
- Create a new Machine object. You can set the name, tags, description, and optionally specify or create a Permission object for access control.
245
-
246
- ### Parameter Description
247
-
248
- | Parameter Path | Type | Required | Description | Constraints |
249
- |----------------|------|----------|-------------|-------------|
250
- | `operation_type` | string | Yes | Operation type | Fixed value "machine" |
251
- | `data.object` | object/string | Yes | Object reference | For new object, provide { name, permission, ... } |
252
- | `data.object.name` | string | No | Machine name | Max 64 BCS characters, cannot start with '0x' |
253
- | `data.object.tags` | array | No | Tag list | String array |
254
- | `data.object.onChain` | boolean | No | Whether to publish on-chain | true=public; false/undefined=local only (default) |
255
- | `data.object.replaceExistName` | boolean | No | Whether to replace existing name | true=force replace; false=error if name exists (default) |
256
- | `data.object.permission` | object/string | No | Permission object | Existing Permission ID/name OR new Permission config |
257
- | `data.description` | string | No | Machine description | Explain the purpose and workflow |
258
- | `env.account` | string | No | Use specified account | Empty string '' uses default account |
259
- | `env.network` | enum | No | Network selection | "localnet" or "testnet" |
260
-
261
- ### Important Notes
262
-
263
- ⚠️ **Machine can create Progress objects only after publishing!** Make sure your workflow is complete before publishing.
264
-
265
- ⚠️ **After publishing, nodes cannot be modified!** Double-check your node definitions before publishing.
266
-
267
- ⚠️ **Permission object is optional but recommended!** Use Permission to control who can operate the Machine.
268
-
269
- ### Return Result
270
-
271
- Returns transaction block information.
272
-
273
- ---
274
-
275
- ### Examples
276
-
277
- #### Example 1.1: Create Minimal Machine (no name, auto Permission)
278
-
279
- **Prompt**: Create a basic Machine without a name, using an automatically created Permission object. Don't add any nodes yet.
280
-
281
- ```json
282
- {
283
- "operation_type": "machine",
284
- "data": {
285
- "object": {}
286
- }
287
- }
288
- ```
289
-
290
- #### Example 1.2: Create Named Machine with Tags
291
-
292
- **Prompt**: Create a Machine named "design_workflow" with tags ["design", "service", "workflow"], add a description explaining this is a design service workflow, and store the name locally (not on-chain).
293
-
294
- ```json
295
- {
296
- "operation_type": "machine",
297
- "data": {
298
- "object": {
299
- "name": "design_workflow",
300
- "tags": ["design", "service", "workflow"],
301
- "onChain": false
302
- },
303
- "description": "Design service workflow - manages the complete lifecycle from order creation to delivery"
304
- }
305
- }
306
- ```
307
-
308
- **Execution Result**:
309
- ```json
310
- {
311
- "message": "Transaction completed successfully",
312
- "result": {
313
- "type": "transaction",
314
- "digest": "...",
315
- "objectChanges": [
316
- {
317
- "type": "Machine",
318
- "object": "0xec7a...0d51",
319
- "version": "301932",
320
- "change": "created"
321
- },
322
- {
323
- "type": "Permission",
324
- "object": "0x4203...1097",
325
- "version": "301932",
326
- "change": "created"
327
- }
328
- ]
329
- }
330
- }
331
- ```
332
-
333
- #### Example 1.3: Create Machine with Existing Permission
334
-
335
- **Prompt**: Create a Machine named "service_workflow", and use the existing Permission object "team_permission" for access control.
336
-
337
- ```json
338
- {
339
- "operation_type": "machine",
340
- "data": {
341
- "object": {
342
- "name": "service_workflow",
343
- "permission": "team_permission"
344
- }
345
- }
346
- }
347
- ```
348
-
349
- #### Example 1.4: Create Machine and New Permission Together
350
-
351
- **Prompt**: Create a Machine named "marketing_workflow" and a new Permission object named "marketing_perm" at the same time. The Permission should have tags ["marketing", "team"].
352
-
353
- ```json
354
- {
355
- "operation_type": "machine",
356
- "data": {
357
- "object": {
358
- "name": "marketing_workflow",
359
- "permission": {
360
- "name": "marketing_perm",
361
- "tags": ["marketing", "team"]
362
- }
363
- }
364
- }
365
- }
366
- ```
367
-
368
- #### Example 1.5: Create Public Machine (on-chain name)
369
-
370
- **Prompt**: Create a Machine named "public_design_flow", publish its name on-chain so everyone can reference it, and add a clear description.
371
-
372
- ```json
373
- {
374
- "operation_type": "machine",
375
- "data": {
376
- "object": {
377
- "name": "public_design_flow",
378
- "onChain": true
379
- },
380
- "description": "Public design workflow template - can be referenced by any service"
381
- }
382
- }
383
- ```
384
-
385
- #### Example 1.6: Create Machine with Nodes from File
386
-
387
- **Prompt**: Create a Machine named "file_based_workflow" and load all node definitions from a JSON file. The file should contain a complete workflow with multiple nodes.
388
-
389
- ```json
390
- {
391
- "operation_type": "machine",
392
- "data": {
393
- "object": {
394
- "name": "file_based_workflow",
395
- "permission": {
396
- "name": "file_workflow_perm"
397
- }
398
- },
399
- "node": {
400
- "json_or_markdown_file": "/path/to/workflow_nodes.json"
401
- }
402
- }
403
- }
404
- ```
405
-
406
- **File Content** (`workflow_nodes.json`):
407
- ```json
408
- [
409
- {
410
- "name": "created",
411
- "pairs": [
412
- {
413
- "prev_node": "",
414
- "threshold": 1,
415
- "forwards": [
416
- {
417
- "name": "start",
418
- "permissionIndex": 1000,
419
- "weight": 1
420
- }
421
- ]
422
- }
423
- ]
424
- },
425
- {
426
- "name": "in_progress",
427
- "pairs": [
428
- {
429
- "prev_node": "created",
430
- "threshold": 1,
431
- "forwards": [
432
- {
433
- "name": "complete",
434
- "permissionIndex": 1000,
435
- "weight": 1
436
- }
437
- ]
438
- }
439
- ]
440
- },
441
- {
442
- "name": "completed",
443
- "pairs": [
444
- {
445
- "prev_node": "in_progress",
446
- "threshold": 1,
447
- "forwards": []
448
- }
449
- ]
450
- }
451
- ]
452
- ```
453
-
454
- **Execution Result**:
455
- ```json
456
- {
457
- "message": "Transaction completed successfully",
458
- "result": [
459
- {
460
- "type": "Permission",
461
- "type_raw": "0x2::permission::Permission",
462
- "object": "0x8fd49ffe18acb15d8aa5501e93cbfb24ced6b914dc57c759c13f7b0674017671",
463
- "version": "1172268",
464
- "owner": {
465
- "Shared": {
466
- "initial_shared_version": 1172268
467
- }
468
- },
469
- "change": "created"
470
- },
471
- {
472
- "type": "Machine",
473
- "type_raw": "0x2::machine::Machine",
474
- "object": "0xd45bb45481fcb2aa13884acf55bf6f4f52fd94625cae8dcd808c748eefb535ff",
475
- "version": "1172268",
476
- "owner": {
477
- "Shared": {
478
- "initial_shared_version": 1172268
479
- }
480
- },
481
- "change": "created"
482
- }
483
- ]
484
- }
485
- ```
486
-
487
- ---
488
-
489
- ## Sub-feature 2: Add Nodes (op: "add")
490
-
491
- ### Feature Description
492
-
493
- Add nodes to a Machine. Each node represents a state in the workflow, with connections (pairs) to previous nodes and forward operations.
494
-
495
- ### Parameter Description
496
-
497
- | Parameter Path | Type | Required | Description | Constraints |
498
- |----------------|------|----------|-------------|-------------|
499
- | `data.object` | string/object | Yes | Machine name or ID | - |
500
- | `data.node.op` | string | Yes | Operation type | Fixed value "add" |
501
- | `data.node.nodes` | array | Yes | Node array | MachineNode array |
502
- | `data.node.nodes[].name` | string | Yes | Node name | Unique identifier |
503
- | `data.node.nodes[].pairs` | array | Yes | Node connections | Array of {prev_node, threshold, forwards} |
504
- | `data.node.nodes[].pairs[].prev_node` | string | Yes | Previous node name | - |
505
- | `data.node.nodes[].pairs[].threshold` | number | Yes | Threshold | Min 0, max 4294967295 |
506
- | `data.node.nodes[].pairs[].forwards` | array | Yes | Forward operations | Array of {name, permission, weight} |
507
- | `data.node.bReplace` | boolean | No | Replace existing | true=replace; false=merge (default) |
508
-
509
- ### Important Notes
510
-
511
- ⚠️ **Node names must be unique!** Duplicate node names will cause errors.
512
-
513
- ⚠️ **Use bReplace=true only when intended!** This will completely replace existing nodes with the same name.
514
-
515
- ⚠️ **Threshold is the total weight required!** When the sum of forward weights meets or exceeds threshold, the workflow advances.
516
-
517
- ⚠️ **Two Permission Modes for Forwards:**
518
- - **`permissionIndex`**: Uses Permission object's permission indexes. All Progress instances share the same operators (recommended for fixed workflows). First define the permissionIndex in the Permission object.
519
- - **`namedOperator`**: Uses named operator spaces. Each Progress instance can set different operators independently (recommended for flexible workflows). Use `progress_namedOperator` to manage operators for specific Progress instances.
520
- - **Special value `""` (empty string)**: Represents **order permission**. When a forward uses `namedOperator: ""`, the order owner and agents can execute this forward through the Order object without needing additional permissions.
521
-
522
- #### Understanding the Init Node (Empty String "")
523
-
524
- When designing workflow nodes, you need to understand how the **init node** (empty string `""`) works:
525
-
526
- - **What is the init node?** The empty string `""` represents the initial/starting state of a workflow. It does not need to be defined as a separate node in the nodes table.
527
- - **How to use it?** When defining the first node of your workflow, set `prev_node: ""` to indicate that this node can be reached from the initial state.
528
- - **How does Progress start?** When a Progress object is created, its `current` field is set to `""` (init node). To advance to the first actual node, you need a forward defined with `prev_node: ""`.
529
-
530
- **Example**: If your first node is "requirement", define it like this:
531
- ```json
532
- {
533
- "name": "requirement",
534
- "pairs": [
535
- {
536
- "prev_node": "", // Connects from init node
537
- "threshold": 1,
538
- "forwards": [
539
- {
540
- "name": "start_project",
541
- "permissionIndex": 1000,
542
- "weight": 1
543
- }
544
- ]
545
- }
546
- ]
547
- }
548
- ```
549
-
550
- **Common Mistake**: Defining a node with `"pairs": []` means no node can transition to it, making it unreachable from the init state. Always ensure your starting node has at least one pair with `prev_node: ""`.
551
-
552
- ### Return Result
553
-
554
- Returns transaction block information.
555
-
556
- ---
557
-
558
- ### Examples
559
-
560
- #### Example 2.1: Add Starting Node with Init Connection
561
-
562
- **Prompt**: Add a starting node named "created" to "design_workflow". Connect it from the init node (empty string) so Progress can reach it when starting.
563
-
564
- ```json
565
- {
566
- "operation_type": "machine",
567
- "data": {
568
- "object": "design_workflow",
569
- "node": {
570
- "op": "add",
571
- "nodes": [
572
- {
573
- "name": "created",
574
- "pairs": [
575
- {
576
- "prev_node": "",
577
- "threshold": 1,
578
- "forwards": [
579
- {
580
- "name": "start",
581
- "permissionIndex": 1000,
582
- "weight": 1
583
- }
584
- ]
585
- }
586
- ]
587
- }
588
- ]
589
- }
590
- }
591
- }
592
- ```
593
-
594
- > **Note**: The `prev_node: ""` indicates this node can be reached from the init node. Without this, the node would be unreachable when Progress starts.
595
-
596
- #### Example 2.2: Add Node with Single Forward
597
-
598
- **Prompt**: Add a node named "confirmed" to "design_workflow". Connect it from "created" with a forward called "confirm_order" using permission index 1000 (user-defined permission), weight 1, threshold 1.
599
-
600
- > **Note**: Permission index for forward operations can be:
601
- > - **User-defined permissions**: 1000-65535 (recommended for business-specific operations)
602
- > - **Built-in permissions**: Any valid `BuiltinPermissionIndex` value (100-450+)
603
- >
604
- > **Important**: Built-in permission index 200-208 are for **Machine management operations** (like creating machines, modifying nodes), NOT for forward operations within a workflow. For forward operations, use user-defined permissions (1000+) or other appropriate built-in permissions.
605
- >
606
- > **Common Built-in Permission Indexes**:
607
- > - Repository: 100-105
608
- > - Reward: 150-157
609
- > - Machine (management): 200-208
610
- > - Progress (management): 220-225
611
- > - Service: 300-320
612
- > - Arbitration: 350-368
613
- > - Demand: 400-408
614
-
615
- ```json
616
- {
617
- "operation_type": "machine",
618
- "data": {
619
- "object": "design_workflow",
620
- "node": {
621
- "op": "add",
622
- "nodes": [
623
- {
624
- "name": "confirmed",
625
- "pairs": [
626
- {
627
- "prev_node": "created",
628
- "threshold": 1,
629
- "forwards": [
630
- {
631
- "name": "confirm_order",
632
- "permissionIndex": 1000,
633
- "weight": 1
634
- }
635
- ]
636
- }
637
- ]
638
- }
639
- ]
640
- }
641
- }
642
- }
643
- ```
644
-
645
- #### Example 2.3: Add Node with Guard Validation
646
-
647
- **Prompt**: Add a "delivered" node with a forward that requires Guard validation. Use the "delivery_guard" Guard object.
648
-
649
- ```json
650
- {
651
- "operation_type": "machine",
652
- "data": {
653
- "object": "design_workflow",
654
- "node": {
655
- "op": "add",
656
- "nodes": [
657
- {
658
- "name": "delivered",
659
- "pairs": [
660
- {
661
- "prev_node": "confirmed",
662
- "threshold": 1,
663
- "forwards": [
664
- {
665
- "name": "confirm_delivery",
666
- "permissionIndex": 1001,
667
- "weight": 1,
668
- "guard": {
669
- "guard": "delivery_guard"
670
- }
671
- }
672
- ]
673
- }
674
- ]
675
- }
676
- ]
677
- }
678
- }
679
- }
680
- ```
681
-
682
- #### Example 2.4: Add Node with Named Operator
683
-
684
- **Prompt**: Add a "processing" node using namedOperator "operator" instead of permissionIndex. This allows each Progress instance to have different operators.
685
-
686
- ```json
687
- {
688
- "operation_type": "machine",
689
- "data": {
690
- "object": "design_workflow",
691
- "node": {
692
- "op": "add",
693
- "nodes": [
694
- {
695
- "name": "processing",
696
- "pairs": [
697
- {
698
- "prev_node": "confirmed",
699
- "threshold": 1,
700
- "forwards": [
701
- {
702
- "name": "start_processing",
703
- "namedOperator": "operator",
704
- "weight": 1
705
- }
706
- ]
707
- }
708
- ]
709
- }
710
- ]
711
- }
712
- }
713
- }
714
- ```
715
-
716
- #### Example 2.5: Add Multiple Nodes at Once
717
-
718
- **Prompt**: Add three nodes ("preparing", "shipping", "completed") in a single operation to create a complete delivery workflow.
719
-
720
- ```json
721
- {
722
- "operation_type": "machine",
723
- "data": {
724
- "object": "design_workflow",
725
- "node": {
726
- "op": "add",
727
- "nodes": [
728
- {
729
- "name": "preparing",
730
- "pairs": [
731
- {
732
- "prev_node": "confirmed",
733
- "threshold": 1,
734
- "forwards": [
735
- {
736
- "name": "start_preparing",
737
- "permissionIndex": 1002,
738
- "weight": 1
739
- }
740
- ]
741
- }
742
- ]
743
- },
744
- {
745
- "name": "shipping",
746
- "pairs": [
747
- {
748
- "prev_node": "preparing",
749
- "threshold": 1,
750
- "forwards": [
751
- {
752
- "name": "start_shipping",
753
- "permissionIndex": 1003,
754
- "weight": 1
755
- }
756
- ]
757
- }
758
- ]
759
- },
760
- {
761
- "name": "completed",
762
- "pairs": [
763
- {
764
- "prev_node": "shipping",
765
- "threshold": 1,
766
- "forwards": [
767
- {
768
- "name": "complete_order",
769
- "permissionIndex": 1004,
770
- "weight": 1
771
- }
772
- ]
773
- }
774
- ]
775
- }
776
- ]
777
- }
778
- }
779
- }
780
- ```
781
-
782
- ---
783
-
784
- ## Sub-feature 3: Set Nodes (op: "set")
785
-
786
- ### Feature Description
787
-
788
- Set (replace) existing nodes in a Machine. Use `bReplace` flag to control whether to replace or merge.
789
-
790
- ### Parameter Description
791
-
792
- | Parameter Path | Type | Required | Description | Constraints |
793
- |----------------|------|----------|-------------|-------------|
794
- | `data.node.op` | string | Yes | Operation type | Fixed value "set" |
795
- | `data.node.nodes` | array | Yes | Node array | MachineNode array |
796
- | `data.node.bReplace` | boolean | No | Replace mode | true=replace existing; false=merge (default) |
797
-
798
- ### Examples
799
-
800
- #### Example 3.1: Replace Existing Node
801
-
802
- **Prompt**: Replace the "confirmed" node with updated forward configuration. Set bReplace to true.
803
-
804
- ```json
805
- {
806
- "operation_type": "machine",
807
- "data": {
808
- "object": "design_workflow",
809
- "node": {
810
- "op": "set",
811
- "nodes": [
812
- {
813
- "name": "confirmed",
814
- "pairs": [
815
- {
816
- "prev_node": "created",
817
- "threshold": 2,
818
- "forwards": [
819
- {
820
- "name": "confirm_order",
821
- "permissionIndex": 1000,
822
- "weight": 1
823
- },
824
- {
825
- "name": "admin_confirm",
826
- "permissionIndex": 1005,
827
- "weight": 1
828
- }
829
- ]
830
- }
831
- ]
832
- }
833
- ],
834
- "bReplace": true
835
- }
836
- }
837
- }
838
- ```
839
-
840
- ---
841
-
842
- ## Sub-feature 4: Remove Nodes (op: "remove")
843
-
844
- ### Feature Description
845
-
846
- Remove one or more nodes from a Machine by their names.
847
-
848
- ### Parameter Description
849
-
850
- | Parameter Path | Type | Required | Description | Constraints |
851
- |----------------|------|----------|-------------|-------------|
852
- | `data.node.op` | string | Yes | Operation type | Fixed value "remove" |
853
- | `data.node.nodes` | array | Yes | Node names to remove | Array of strings |
854
-
855
- ### Examples
856
-
857
- #### Example 4.1: Remove Single Node
858
-
859
- **Prompt**: Remove the "temp_node" node from "design_workflow".
860
-
861
- ```json
862
- {
863
- "operation_type": "machine",
864
- "data": {
865
- "object": "design_workflow",
866
- "node": {
867
- "op": "remove",
868
- "nodes": ["temp_node"]
869
- }
870
- }
871
- }
872
- ```
873
-
874
- #### Example 4.2: Remove Multiple Nodes
875
-
876
- **Prompt**: Remove "temp_node1" and "temp_node2" from "design_workflow".
877
-
878
- ```json
879
- {
880
- "operation_type": "machine",
881
- "data": {
882
- "object": "design_workflow",
883
- "node": {
884
- "op": "remove",
885
- "nodes": ["temp_node1", "temp_node2"]
886
- }
887
- }
888
- }
889
- ```
890
-
891
- ---
892
-
893
- ## Sub-feature 5: Clear All Nodes (op: "clear")
894
-
895
- ### Feature Description
896
-
897
- Remove all nodes from a Machine. Use with caution!
898
-
899
- ### Parameter Description
900
-
901
- | Parameter Path | Type | Required | Description | Constraints |
902
- |----------------|------|----------|-------------|-------------|
903
- | `data.node.op` | string | Yes | Operation type | Fixed value "clear" |
904
-
905
- ### Examples
906
-
907
- #### Example 5.1: Clear All Nodes
908
-
909
- **Prompt**: Clear all nodes from "design_workflow". This will remove the entire workflow structure.
910
-
911
- ```json
912
- {
913
- "operation_type": "machine",
914
- "data": {
915
- "object": "design_workflow",
916
- "node": {
917
- "op": "clear"
918
- }
919
- }
920
- }
921
- ```
922
-
923
- ---
924
-
925
- ## Sub-feature 6: Exchange Nodes (op: "exchange")
926
-
927
- ### Feature Description
928
-
929
- Swap the positions of two nodes in the workflow. This exchanges all their connections and forwards.
930
-
931
- ### Parameter Description
932
-
933
- | Parameter Path | Type | Required | Description | Constraints |
934
- |----------------|------|----------|-------------|-------------|
935
- | `data.node.op` | string | Yes | Operation type | Fixed value "exchange" |
936
- | `data.node.node_one` | string | Yes | First node name | - |
937
- | `data.node.node_other` | string | Yes | Second node name | - |
938
-
939
- ### Examples
940
-
941
- #### Example 6.1: Exchange Two Nodes
942
-
943
- **Prompt**: Exchange the positions of "preparing" and "shipping" nodes in "design_workflow".
944
-
945
- ```json
946
- {
947
- "operation_type": "machine",
948
- "data": {
949
- "object": "design_workflow",
950
- "node": {
951
- "op": "exchange",
952
- "node_one": "preparing",
953
- "node_other": "shipping"
954
- }
955
- }
956
- }
957
- ```
958
-
959
- ---
960
-
961
- ## Sub-feature 7: Rename Node (op: "rename")
962
-
963
- ### Feature Description
964
-
965
- Rename a node while preserving all its connections and forwards.
966
-
967
- ### Parameter Description
968
-
969
- | Parameter Path | Type | Required | Description | Constraints |
970
- |----------------|------|----------|-------------|-------------|
971
- | `data.node.op` | string | Yes | Operation type | Fixed value "rename" |
972
- | `data.node.node_name_old` | string | Yes | Current node name | - |
973
- | `data.node.node_name_new` | string | Yes | New node name | Max 64 BCS characters |
974
-
975
- ### Examples
976
-
977
- #### Example 7.1: Rename Node
978
-
979
- **Prompt**: Rename "confirmed" node to "validated" in "design_workflow".
980
-
981
- ```json
982
- {
983
- "operation_type": "machine",
984
- "data": {
985
- "object": "design_workflow",
986
- "node": {
987
- "op": "rename",
988
- "node_name_old": "confirmed",
989
- "node_name_new": "validated"
990
- }
991
- }
992
- }
993
- ```
994
-
995
- ---
996
-
997
- ## Sub-feature 8: Remove Prior Node (op: "remove prior node")
998
-
999
- ### Feature Description
1000
-
1001
- Remove specific previous node connections from a node. This removes the edge between two nodes without deleting the nodes themselves.
1002
-
1003
- ### Parameter Description
1004
-
1005
- | Parameter Path | Type | Required | Description | Constraints |
1006
- |----------------|------|----------|-------------|-------------|
1007
- | `data.node.op` | string | Yes | Operation type | Fixed value "remove prior node" |
1008
- | `data.node.pairs` | array | Yes | Pairs to remove | Array of {prior_node_name, node_name} |
1009
-
1010
- ### Examples
1011
-
1012
- #### Example 8.1: Remove Single Prior Connection
1013
-
1014
- **Prompt**: Remove the connection from "created" to "confirmed" in "design_workflow".
1015
-
1016
- ```json
1017
- {
1018
- "operation_type": "machine",
1019
- "data": {
1020
- "object": "design_workflow",
1021
- "node": {
1022
- "op": "remove prior node",
1023
- "pairs": [
1024
- {
1025
- "prior_node_name": ["created"],
1026
- "node_name": "confirmed"
1027
- }
1028
- ]
1029
- }
1030
- }
1031
- }
1032
- ```
1033
-
1034
- ---
1035
-
1036
- ## Sub-feature 9: Add Forward (op: "add forward")
1037
-
1038
- ### Feature Description
1039
-
1040
- Add forward operations to existing node connections. This adds new transition options without removing existing ones.
1041
-
1042
- ### Parameter Description
1043
-
1044
- | Parameter Path | Type | Required | Description | Constraints |
1045
- |----------------|------|----------|-------------|-------------|
1046
- | `data.node.op` | string | Yes | Operation type | Fixed value "add forward" |
1047
- | `data.node.data` | array | Yes | Forward data | Array of {prior_node_name, node_name, forward, threshold} |
1048
-
1049
- ### Examples
1050
-
1051
- #### Example 9.1: Add Single Forward
1052
-
1053
- **Prompt**: Add a new forward "urgent_confirm" from "created" to "confirmed" with permission index 1006.
1054
-
1055
- ```json
1056
- {
1057
- "operation_type": "machine",
1058
- "data": {
1059
- "object": "design_workflow",
1060
- "node": {
1061
- "op": "add forward",
1062
- "data": [
1063
- {
1064
- "prior_node_name": "created",
1065
- "node_name": "confirmed",
1066
- "forward": [
1067
- {
1068
- "name": "urgent_confirm",
1069
- "permissionIndex": 1006,
1070
- "weight": 1
1071
- }
1072
- ],
1073
- "threshold": 1
1074
- }
1075
- ]
1076
- }
1077
- }
1078
- }
1079
- ```
1080
-
1081
- #### Example 9.2: Add Multiple Forwards
1082
-
1083
- **Prompt**: Add forwards to multiple node connections at once.
1084
-
1085
- ```json
1086
- {
1087
- "operation_type": "machine",
1088
- "data": {
1089
- "object": "design_workflow",
1090
- "node": {
1091
- "op": "add forward",
1092
- "data": [
1093
- {
1094
- "prior_node_name": "created",
1095
- "node_name": "confirmed",
1096
- "forward": [
1097
- {
1098
- "name": "standard_confirm",
1099
- "permissionIndex": 1000,
1100
- "weight": 1
1101
- }
1102
- ],
1103
- "threshold": 1
1104
- },
1105
- {
1106
- "prior_node_name": "confirmed",
1107
- "node_name": "processing",
1108
- "forward": [
1109
- {
1110
- "name": "auto_process",
1111
- "permissionIndex": 1007,
1112
- "weight": 1
1113
- }
1114
- ],
1115
- "threshold": 1
1116
- }
1117
- ]
1118
- }
1119
- }
1120
- }
1121
- ```
1122
-
1123
- ---
1124
-
1125
- ## Sub-feature 10: Remove Forward (op: "remove forward")
1126
-
1127
- ### Feature Description
1128
-
1129
- Remove specific forward operations from node connections.
1130
-
1131
- ### Parameter Description
1132
-
1133
- | Parameter Path | Type | Required | Description | Constraints |
1134
- |----------------|------|----------|-------------|-------------|
1135
- | `data.node.op` | string | Yes | Operation type | Fixed value "remove forward" |
1136
- | `data.node.data` | array | Yes | Forward data to remove | Array of {prior_node_name, node_name, forward_name} |
1137
-
1138
- ### Examples
1139
-
1140
- #### Example 10.1: Remove Single Forward
1141
-
1142
- **Prompt**: Remove the "urgent_confirm" forward from the connection between "created" and "confirmed".
1143
-
1144
- ```json
1145
- {
1146
- "operation_type": "machine",
1147
- "data": {
1148
- "object": "design_workflow",
1149
- "node": {
1150
- "op": "remove forward",
1151
- "data": [
1152
- {
1153
- "prior_node_name": "created",
1154
- "node_name": "confirmed",
1155
- "forward_name": ["urgent_confirm"]
1156
- }
1157
- ]
1158
- }
1159
- }
1160
- }
1161
- ```
1162
-
1163
- ---
1164
-
1165
- ## Sub-feature 11: Complete Node Replacement via File
1166
-
1167
- ### Feature Description
1168
-
1169
- Replace all nodes in a Machine by loading node definitions from a JSON or Markdown file. This is useful for bulk updates and template reuse.
1170
-
1171
- ### Parameter Description
1172
-
1173
- | Parameter Path | Type | Required | Description | Constraints |
1174
- |----------------|------|----------|-------------|-------------|
1175
- | `data.node.json_or_markdown_file` | string | Yes | File path | Path to JSON or Markdown file containing node array |
1176
-
1177
- ### File Format
1178
-
1179
- The file must contain a JSON array of node objects:
1180
-
1181
- ```json
1182
- [
1183
- {
1184
- "name": "node1",
1185
- "pairs": [...]
1186
- },
1187
- {
1188
- "name": "node2",
1189
- "pairs": [...]
1190
- }
1191
- ]
1192
- ```
1193
-
1194
- ### Examples
1195
-
1196
- #### Example 11.1: Replace Nodes from JSON File
1197
-
1198
- **Prompt**: Replace all nodes in "design_workflow" with nodes defined in "workflow_v2.json".
1199
-
1200
- ```json
1201
- {
1202
- "operation_type": "machine",
1203
- "data": {
1204
- "object": "design_workflow",
1205
- "node": {
1206
- "json_or_markdown_file": "/path/to/workflow_v2.json"
1207
- }
1208
- }
1209
- }
1210
- ```
1211
-
1212
- **Execution Result**:
1213
- ```json
1214
- {
1215
- "message": "Transaction completed successfully",
1216
- "result": []
1217
- }
1218
- ```
1219
-
1220
- #### Example 11.2: Replace Nodes from Markdown File
1221
-
1222
- **Prompt**: Replace all nodes using a Markdown file that contains the node definitions in a JSON code block.
1223
-
1224
- ```json
1225
- {
1226
- "operation_type": "machine",
1227
- "data": {
1228
- "object": "design_workflow",
1229
- "node": {
1230
- "json_or_markdown_file": "/path/to/workflow_doc.md"
1231
- }
1232
- }
1233
- }
1234
- ```
1235
-
1236
- **Execution Result**:
1237
- ```json
1238
- {
1239
- "message": "Transaction completed successfully",
1240
- "result": []
1241
- }
1242
- ```
1243
-
1244
- ---
1245
-
1246
- ## Sub-feature 12: Set Description
1247
-
1248
- ### Feature Description
1249
-
1250
- Add or update the description of a Machine object.
1251
-
1252
- ### Parameter Description
1253
-
1254
- | Parameter Path | Type | Required | Description | Constraints |
1255
- |----------------|------|----------|-------------|-------------|
1256
- | `data.description` | string | Yes | Description text | Max description length |
1257
-
1258
- ### Examples
1259
-
1260
- #### Example 12.1: Set Description
1261
-
1262
- **Prompt**: Update the description of "design_workflow" to explain its purpose.
1263
-
1264
- ```json
1265
- {
1266
- "operation_type": "machine",
1267
- "data": {
1268
- "object": "design_workflow",
1269
- "description": "Design service workflow - manages the complete lifecycle from order creation to delivery, including confirmation, preparation, shipping, and completion stages."
1270
- }
1271
- }
1272
- ```
1273
-
1274
- ---
1275
-
1276
- ## Sub-feature 13: Manage Repository
1277
-
1278
- ### Feature Description
1279
-
1280
- Attach or detach Repository objects to a Machine for consensus data management.
1281
-
1282
- ### Parameter Description
1283
-
1284
- | Parameter Path | Type | Required | Description | Constraints |
1285
- |----------------|------|----------|-------------|-------------|
1286
- | `data.repository.op` | string | Yes | Operation type | "add", "set", "remove", "clear" |
1287
- | `data.repository.objects` | array | Conditional | Repository IDs | Required for add/set/remove |
1288
-
1289
- ### Examples
1290
-
1291
- #### Example 13.1: Add Repositories
1292
-
1293
- **Prompt**: Add "config_repo" and "data_repo" to "design_workflow" for consensus data storage.
1294
-
1295
- ```json
1296
- {
1297
- "operation_type": "machine",
1298
- "data": {
1299
- "object": "design_workflow",
1300
- "repository": {
1301
- "op": "add",
1302
- "objects": ["config_repo", "data_repo"]
1303
- }
1304
- }
1305
- }
1306
- ```
1307
-
1308
- #### Example 13.2: Set Repositories (Replace All)
1309
-
1310
- **Prompt**: Replace all repositories with just "new_config_repo".
1311
-
1312
- ```json
1313
- {
1314
- "operation_type": "machine",
1315
- "data": {
1316
- "object": "design_workflow",
1317
- "repository": {
1318
- "op": "set",
1319
- "objects": ["new_config_repo"]
1320
- }
1321
- }
1322
- }
1323
- ```
1324
-
1325
- #### Example 13.3: Remove Repositories
1326
-
1327
- **Prompt**: Remove "config_repo" from "design_workflow".
1328
-
1329
- ```json
1330
- {
1331
- "operation_type": "machine",
1332
- "data": {
1333
- "object": "design_workflow",
1334
- "repository": {
1335
- "op": "remove",
1336
- "objects": ["config_repo"]
1337
- }
1338
- }
1339
- }
1340
- ```
1341
-
1342
- #### Example 13.4: Clear All Repositories
1343
-
1344
- **Prompt**: Remove all repositories from "design_workflow".
1345
-
1346
- ```json
1347
- {
1348
- "operation_type": "machine",
1349
- "data": {
1350
- "object": "design_workflow",
1351
- "repository": {
1352
- "op": "clear"
1353
- }
1354
- }
1355
- }
1356
- ```
1357
-
1358
- ---
1359
-
1360
- ## Sub-feature 14: Create Progress
1361
-
1362
- ### Feature Description
1363
-
1364
- Create a new Progress instance from a published Machine. Progress represents an active execution of the workflow template.
1365
-
1366
- ### Parameter Description
1367
-
1368
- | Parameter Path | Type | Required | Description | Constraints |
1369
- |----------------|------|----------|-------------|-------------|
1370
- | `data.progress_new` | object | Yes | Progress creation config | - |
1371
- | `data.progress_new.task` | string/null | No | Task object to bind | Optional task binding |
1372
- | `data.progress_new.repository` | object | No | Context repositories | Repository configuration |
1373
- | `data.progress_new.progress_namedOperator` | object | No | Named operators | Operator assignment |
1374
- | `data.progress_new.namedNew` | object | No | Name for new Progress | Naming configuration |
1375
-
1376
- ### Important Notes
1377
-
1378
- ⚠️ **Machine must be published!** Only published Machines can create Progress objects.
1379
-
1380
- ⚠️ **Named operators are Progress-specific!** Each Progress can have different operators for the same namedOperator namespace.
1381
-
1382
- ### Examples
1383
-
1384
- #### Example 14.1: Create Simple Progress
1385
-
1386
- **Prompt**: Create a new Progress from "design_workflow" without any special configuration.
1387
-
1388
- ```json
1389
- {
1390
- "operation_type": "machine",
1391
- "data": {
1392
- "object": "design_workflow",
1393
- "progress_new": {}
1394
- }
1395
- }
1396
- ```
1397
-
1398
- #### Example 14.2: Create Named Progress
1399
-
1400
- **Prompt**: Create a Progress named "order_12345" with tags ["urgent", "vip"].
1401
-
1402
- ```json
1403
- {
1404
- "operation_type": "machine",
1405
- "data": {
1406
- "object": "design_workflow",
1407
- "progress_new": {
1408
- "namedNew": {
1409
- "name": "order_12345",
1410
- "tags": ["urgent", "vip"]
1411
- }
1412
- }
1413
- }
1414
- }
1415
- ```
1416
-
1417
- #### Example 14.3: Create Progress with Named Operators
1418
-
1419
- **Prompt**: Create a Progress and assign "alice" and "bob" as operators for the "operator" namespace.
1420
-
1421
- ```json
1422
- {
1423
- "operation_type": "machine",
1424
- "data": {
1425
- "object": "design_workflow",
1426
- "progress_new": {
1427
- "namedNew": {
1428
- "name": "order_12346"
1429
- },
1430
- "progress_namedOperator": {
1431
- "op": "set",
1432
- "name": "operator",
1433
- "operators": {
1434
- "entities": [
1435
- {"name_or_address": "alice"},
1436
- {"name_or_address": "bob"}
1437
- ]
1438
- }
1439
- }
1440
- }
1441
- }
1442
- }
1443
- ```
1444
-
1445
- #### Example 14.4: Create Progress with Context Repositories
1446
-
1447
- **Prompt**: Create a Progress and attach "order_data_repo" as context repository.
1448
-
1449
- ```json
1450
- {
1451
- "operation_type": "machine",
1452
- "data": {
1453
- "object": "design_workflow",
1454
- "progress_new": {
1455
- "namedNew": {
1456
- "name": "order_12347"
1457
- },
1458
- "repository": {
1459
- "op": "add",
1460
- "objects": ["order_data_repo"]
1461
- }
1462
- }
1463
- }
1464
- }
1465
- ```
1466
-
1467
- ---
1468
-
1469
- ## Sub-feature 15: Pause Machine
1470
-
1471
- ### Feature Description
1472
-
1473
- Pause or resume a Machine to control whether new Progress instances can be created.
1474
-
1475
- ### Parameter Description
1476
-
1477
- | Parameter Path | Type | Required | Description | Constraints |
1478
- |----------------|------|----------|-------------|-------------|
1479
- | `data.pause` | boolean | Yes | Pause state | true=pause; false=resume |
1480
-
1481
- ### Examples
1482
-
1483
- #### Example 15.1: Pause Machine
1484
-
1485
- **Prompt**: Pause "design_workflow" to temporarily stop new Progress creation.
1486
-
1487
- ```json
1488
- {
1489
- "operation_type": "machine",
1490
- "data": {
1491
- "object": "design_workflow",
1492
- "pause": true
1493
- }
1494
- }
1495
- ```
1496
-
1497
- #### Example 15.2: Resume Machine
1498
-
1499
- **Prompt**: Resume "design_workflow" to allow new Progress creation again.
1500
-
1501
- ```json
1502
- {
1503
- "operation_type": "machine",
1504
- "data": {
1505
- "object": "design_workflow",
1506
- "pause": false
1507
- }
1508
- }
1509
- ```
1510
-
1511
- ---
1512
-
1513
- ## Sub-feature 16: Publish Machine
1514
-
1515
- ### Feature Description
1516
-
1517
- Publish a Machine to lock its nodes and enable Progress creation. **Warning**: After publishing, nodes cannot be modified!
1518
-
1519
- ### Parameter Description
1520
-
1521
- | Parameter Path | Type | Required | Description | Constraints |
1522
- |----------------|------|----------|-------------|-------------|
1523
- | `data.publish` | boolean | Yes | Publish state | Must be true to publish |
1524
-
1525
- ### Important Notes
1526
-
1527
- ⚠️ **IRREVERSIBLE OPERATION!** Once published, nodes cannot be modified. Make sure your workflow is complete.
1528
-
1529
- ⚠️ **Required for Progress creation!** Only published Machines can create Progress objects.
1530
-
1531
- ### Examples
1532
-
1533
- #### Example 16.1: Publish Machine
1534
-
1535
- **Prompt**: Publish "design_workflow" to finalize the workflow and enable Progress creation.
1536
-
1537
- ```json
1538
- {
1539
- "operation_type": "machine",
1540
- "data": {
1541
- "object": "design_workflow",
1542
- "publish": true
1543
- }
1544
- }
1545
- ```
1546
-
1547
- ---
1548
-
1549
- ## Sub-feature 17: Owner Receive
1550
-
1551
- ### Feature Description
1552
-
1553
- Receive and unwrap objects (coins, NFTs) that have been sent to the Machine object.
1554
-
1555
- ### Parameter Description
1556
-
1557
- | Parameter Path | Type | Required | Description | Constraints |
1558
- |----------------|------|----------|-------------|-------------|
1559
- | `data.owner_receive` | string/array/object | Yes | Receive configuration | "recently" or object list |
1560
-
1561
- ### Examples
1562
-
1563
- #### Example 17.1: Receive All Recent Objects
1564
-
1565
- **Prompt**: Receive all recently sent objects to "design_workflow".
1566
-
1567
- ```json
1568
- {
1569
- "operation_type": "machine",
1570
- "data": {
1571
- "object": "design_workflow",
1572
- "owner_receive": "recently"
1573
- }
1574
- }
1575
- ```
1576
-
1577
- #### Example 17.2: Receive Specific Objects
1578
-
1579
- **Prompt**: Receive specific objects by their IDs.
1580
-
1581
- ```json
1582
- {
1583
- "operation_type": "machine",
1584
- "data": {
1585
- "object": "design_workflow",
1586
- "owner_receive": [
1587
- {"id": "0x1234...", "type": "0x2::coin::Coin<0x2::wow::WOW>"},
1588
- {"id": "0x5678...", "type": "0x2::nft::NFT"}
1589
- ]
1590
- }
1591
- }
1592
- ```
1593
-
1594
- ---
1595
-
1596
- ## Sub-feature 18: Manage Contact (UM)
1597
-
1598
- ### Feature Description
1599
-
1600
- Set or remove a Contact object reference for the Machine. Contact objects enable messaging and coordination for the workflow.
1601
-
1602
- ### Parameter Description
1603
-
1604
- | Parameter Path | Type | Required | Description | Constraints |
1605
- |----------------|------|----------|-------------|-------------|
1606
- | `data.um` | string/null | Yes | Contact object reference | Contact object name/ID, or null to remove |
1607
-
1608
- ### Examples
1609
-
1610
- #### Example 18.1: Set Contact Object
1611
-
1612
- **Prompt**: Set "dev_team_contact" as the contact object for "design_workflow".
1613
-
1614
- ```json
1615
- {
1616
- "operation_type": "machine",
1617
- "data": {
1618
- "object": "design_workflow",
1619
- "um": "dev_team_contact"
1620
- }
1621
- }
1622
- ```
1623
-
1624
- #### Example 18.2: Remove Contact Object
1625
-
1626
- **Prompt**: Remove the contact object reference from "design_workflow".
1627
-
1628
- ```json
1629
- {
1630
- "operation_type": "machine",
1631
- "data": {
1632
- "object": "design_workflow",
1633
- "um": null
1634
- }
1635
- }
1636
- ```
1637
-
1638
- ---
1639
-
1640
- ## Sub-feature 19: Export Node Definitions with machineNode2file
1641
-
1642
- ### Feature Description
1643
-
1644
- Export a Machine object's node definitions from the blockchain to a local JSON or Markdown file. This allows you to backup, document, or reuse workflow definitions.
1645
-
1646
- ### Parameter Description
1647
-
1648
- | Parameter Path | Type | Required | Description | Constraints |
1649
- |----------------|------|----------|-------------|-------------|
1650
- | `operation_type` | string | Yes | Operation type | Fixed value "machineNode2file" |
1651
- | `machine` | string | Yes | Machine name or ID | - |
1652
- | `file_path` | string | Yes | Output file path | Absolute or relative path |
1653
- | `format` | string | No | Output format | "json" (default) or "markdown" |
1654
- | `env.account` | string | No | Account to use | Empty string for default |
1655
- | `env.network` | string | No | Network | "localnet" or "testnet" |
1656
-
1657
- ### Examples
1658
-
1659
- #### Example 19.1: Export to JSON File
1660
-
1661
- **Prompt**: Export node definitions from "software_dev_workflow" to a JSON file.
1662
-
1663
- ```json
1664
- {
1665
- "operation_type": "machineNode2file",
1666
- "machine": "software_dev_workflow",
1667
- "file_path": "d:\\wowok\\docs\\exported_nodes.json",
1668
- "format": "json",
1669
- "env": {
1670
- "account": "pm_alice",
1671
- "network": "testnet"
1672
- }
1673
- }
1674
- ```
1675
-
1676
- **Execution Result**:
1677
- ```json
1678
- {
1679
- "status": "success",
1680
- "file_path": "d:\\wowok\\docs\\exported_nodes.json",
1681
- "format": "json",
1682
- "machine_object": "software_dev_workflow",
1683
- "node_count": 8
1684
- }
1685
- ```
1686
-
1687
- #### Example 19.2: Export to Markdown File
1688
-
1689
- **Prompt**: Export node definitions to a Markdown file for documentation.
1690
-
1691
- ```json
1692
- {
1693
- "operation_type": "machineNode2file",
1694
- "machine": "software_dev_workflow",
1695
- "file_path": "d:\\wowok\\docs\\workflow_nodes.md",
1696
- "format": "markdown",
1697
- "env": {
1698
- "account": "pm_alice",
1699
- "network": "testnet"
1700
- }
1701
- }
1702
-
1703
- ### Important Notes
1704
-
1705
- ⚠️ **File format**: JSON files contain the raw node array. Markdown files wrap the JSON in a code block for documentation purposes.
1706
-
1707
- ⚠️ **Reuse**: Exported files can be used with `json_or_markdown_file` (Sub-feature 11) to quickly create new workflows based on existing ones.
1708
-
1709
- ---
1710
-
1711
- ## Real-World Example: Software Development Lifecycle (SDLC) Workflow
1712
-
1713
- This section demonstrates a complete, real-world implementation of a software development workflow using the Machine component. All examples have been tested and executed on the WoWok testnet.
1714
-
1715
- ### Project Overview
1716
-
1717
- **Project Name**: Software Development Lifecycle Workflow
1718
- **Use Case**: Managing the complete process from requirements gathering to production deployment
1719
- **Team Structure**:
1720
- - Product Manager (pm_alice) - Requirements approval
1721
- - Architect (arch_bob) - Design approval
1722
- - Development Lead (dev_lead_carol) - Code review and deployment
1723
- - Test Lead (test_lead_dave) - Testing approval
1724
- - Customer (customer_eve) - UAT approval
1725
-
1726
- ### Workflow Design
1727
-
1728
- ```
1729
- requirement → design → development → code_review → testing → uat → deployment → completed
1730
- ```
1731
-
1732
- **8 Nodes, 7 Transitions**:
1733
- 1. **requirement** - Starting state, connects from init node (empty string `prev_node: ""`)
1734
- 2. **design** - Architecture design phase (requires PM approval)
1735
- 3. **development** - Implementation phase (requires Architect approval)
1736
- 4. **code_review** - Code review phase (uses namedOperator for flexible developer assignment)
1737
- 5. **testing** - QA testing phase (requires Dev Lead approval)
1738
- 6. **uat** - User Acceptance Testing (requires Test Lead approval)
1739
- 7. **deployment** - Production deployment (requires Customer approval)
1740
- 8. **completed** - Final state (requires Dev Lead approval)
1741
-
1742
- > **Note on Init Node**: The empty string `""` represents the initial node in a workflow. When creating the first node in your workflow, use `prev_node: ""` to indicate it can be reached from the initial state. Progress objects start at the init node (`current: ""`) when created.
1743
-
1744
- ### Prerequisites
1745
-
1746
- Before creating the Machine workflow, you need to:
1747
-
1748
- 1. **Create Team Accounts** (see [Account Operations](account.md))
1749
- 2. **Create Permission Object** with custom permission indexes (see [Permission Component](permission.md))
1750
- 3. **Create Guard Objects** for validation (see [Guard Component](guard.md))
1751
-
1752
- ---
1753
-
1754
- ## Step-by-Step Implementation
1755
-
1756
- ### Step 1: Create Team Accounts
1757
-
1758
- Create accounts for each team member:
1759
-
1760
- ```json
1761
- {
1762
- "operation_type": "account",
1763
- "data": {
1764
- "gen": {
1765
- "name": "pm_alice"
1766
- }
1767
- }
1768
- }
1769
- ```
1770
-
1771
- **Execution Result**:
1772
- ```json
1773
- {
1774
- "gen": {
1775
- "address": "0xd3a1e00fb2401dadf0f5c229f8993b5a8934552b1dc2b1cd719f5d9e2aeff33d",
1776
- "name": "pm_alice"
1777
- }
1778
- }
1779
- ```
1780
-
1781
- Repeat for other team members:
1782
- - `arch_bob` → `0xf6f8...ed15`
1783
- - `dev_lead_carol` → `0xad42...7220`
1784
- - `test_lead_dave` → `0x3102...0b09`
1785
- - `customer_eve` → `0xfa01...dbcd`
1786
-
1787
- > **Note**: Get test coins from the faucet for each account using the `faucet` operation.
1788
-
1789
- ---
1790
-
1791
- ### Step 2: Create Permission Object
1792
-
1793
- Create a Permission object to manage workflow access control:
1794
-
1795
- ```json
1796
- {
1797
- "operation_type": "permission",
1798
- "data": {
1799
- "object": {
1800
- "name": "dev_team_permission",
1801
- "tags": ["development", "team", "workflow"]
1802
- },
1803
- "description": "Permission object for software development team workflow"
1804
- },
1805
- "env": {
1806
- "account": "pm_alice",
1807
- "network": "testnet"
1808
- }
1809
- }
1810
- ```
1811
-
1812
- **Execution Result**:
1813
- ```json
1814
- {
1815
- "type": "Permission",
1816
- "object": "0x24828d09b0e5f9ca8ce899420952399ad40b722185a57669cb6792012d68174c",
1817
- "version": "5",
1818
- "change": "created"
1819
- }
1820
- ```
1821
-
1822
- ---
1823
-
1824
- ### Step 3: Assign Custom Permission Indexes
1825
-
1826
- Assign user-defined permission indexes (1000-1004) to team members:
1827
-
1828
- **Permission 1000 - Product Manager (Requirement Approval)**:
1829
- ```json
1830
- {
1831
- "operation_type": "permission",
1832
- "data": {
1833
- "object": "dev_team_permission",
1834
- "table": {
1835
- "op": "add perm by index",
1836
- "index": 1000,
1837
- "entity": {
1838
- "entities": [{"name_or_address": "pm_alice"}]
1839
- }
1840
- },
1841
- "remark": {
1842
- "op": "set",
1843
- "index": 1000,
1844
- "remark": "Product Manager - Requirement approval permission"
1845
- }
1846
- },
1847
- "env": {
1848
- "account": "pm_alice",
1849
- "network": "testnet"
1850
- }
1851
- }
1852
- ```
1853
-
1854
- **Permission 1001 - Architect (Design Approval)**:
1855
- ```json
1856
- {
1857
- "operation_type": "permission",
1858
- "data": {
1859
- "object": "dev_team_permission",
1860
- "table": {
1861
- "op": "add perm by index",
1862
- "index": 1001,
1863
- "entity": {
1864
- "entities": [{"name_or_address": "arch_bob"}]
1865
- }
1866
- }
1867
- },
1868
- "env": {
1869
- "account": "pm_alice",
1870
- "network": "testnet"
1871
- }
1872
- }
1873
- ```
1874
-
1875
- **Permission 1002 - Development Lead (Code Review & Deployment)**:
1876
- ```json
1877
- {
1878
- "operation_type": "permission",
1879
- "data": {
1880
- "object": "dev_team_permission",
1881
- "table": {
1882
- "op": "add perm by index",
1883
- "index": 1002,
1884
- "entity": {
1885
- "entities": [{"name_or_address": "dev_lead_carol"}]
1886
- }
1887
- }
1888
- },
1889
- "env": {
1890
- "account": "pm_alice",
1891
- "network": "testnet"
1892
- }
1893
- }
1894
- ```
1895
-
1896
- **Permission 1003 - Test Lead (Testing Approval)**:
1897
- ```json
1898
- {
1899
- "operation_type": "permission",
1900
- "data": {
1901
- "object": "dev_team_permission",
1902
- "table": {
1903
- "op": "add perm by index",
1904
- "index": 1003,
1905
- "entity": {
1906
- "entities": [{"name_or_address": "test_lead_dave"}]
1907
- }
1908
- }
1909
- },
1910
- "env": {
1911
- "account": "pm_alice",
1912
- "network": "testnet"
1913
- }
1914
- }
1915
- ```
1916
-
1917
- **Permission 1004 - Customer (UAT Approval)**:
1918
- ```json
1919
- {
1920
- "operation_type": "permission",
1921
- "data": {
1922
- "object": "dev_team_permission",
1923
- "table": {
1924
- "op": "add perm by index",
1925
- "index": 1004,
1926
- "entity": {
1927
- "entities": [{"name_or_address": "customer_eve"}]
1928
- }
1929
- }
1930
- },
1931
- "env": {
1932
- "account": "pm_alice",
1933
- "network": "testnet"
1934
- }
1935
- }
1936
- ```
1937
-
1938
- ---
1939
-
1940
- ### Step 4: Create Guard Object
1941
-
1942
- Create an always-true Guard for workflow transitions:
1943
-
1944
- ```json
1945
- {
1946
- "operation_type": "guard",
1947
- "data": {
1948
- "namedNew": {
1949
- "name": "dev_workflow_guard",
1950
- "tags": ["guard", "workflow", "development"]
1951
- },
1952
- "description": "Always true guard for development workflow transitions",
1953
- "table": [
1954
- {
1955
- "identifier": 0,
1956
- "value_type": "Bool",
1957
- "b_submission": false,
1958
- "value": true
1959
- }
1960
- ],
1961
- "root": {
1962
- "type": "node",
1963
- "node": {
1964
- "type": "logic_equal",
1965
- "nodes": [
1966
- {"type": "identifier", "identifier": 0},
1967
- {"type": "identifier", "identifier": 0}
1968
- ]
1969
- }
1970
- }
1971
- },
1972
- "env": {
1973
- "account": "pm_alice",
1974
- "network": "testnet"
1975
- }
1976
- }
1977
- ```
1978
-
1979
- **Execution Result**:
1980
- ```json
1981
- {
1982
- "type": "Guard",
1983
- "object": "0x6ee9163dd90aaf44402674100d136d86eeea0e42e68036db2ed41d61a27ce48a",
1984
- "version": "519377",
1985
- "change": "created"
1986
- }
1987
- ```
1988
-
1989
- ---
1990
-
1991
- ### Step 5: Create Machine Object
1992
-
1993
- Create the Machine with the Permission object:
1994
-
1995
- ```json
1996
- {
1997
- "operation_type": "machine",
1998
- "data": {
1999
- "object": {
2000
- "name": "software_dev_workflow",
2001
- "permission": "dev_team_permission",
2002
- "tags": ["development", "workflow", "sdlc"],
2003
- "onChain": true
2004
- },
2005
- "description": "Software Development Lifecycle Workflow - manages the complete process from requirements to deployment"
2006
- },
2007
- "env": {
2008
- "account": "pm_alice",
2009
- "network": "testnet"
2010
- }
2011
- }
2012
- ```
2013
-
2014
- **Execution Result**:
2015
- ```json
2016
- {
2017
- "type": "Machine",
2018
- "object": "0xb494336e61f4de62bc646fdb9612ec200d268f4e9407dc71127983ee0cff4324",
2019
- "version": "519690",
2020
- "change": "created"
2021
- }
2022
- ```
2023
-
2024
- ---
2025
-
2026
- ### Step 6: Add Workflow Nodes
2027
-
2028
- Add all 8 nodes with their connections:
2029
-
2030
- ```json
2031
- {
2032
- "operation_type": "machine",
2033
- "data": {
2034
- "object": "software_dev_workflow",
2035
- "node": {
2036
- "op": "add",
2037
- "nodes": [
2038
- {
2039
- "name": "requirement",
2040
- "pairs": [
2041
- {
2042
- "prev_node": "",
2043
- "threshold": 1,
2044
- "forwards": [
2045
- {
2046
- "name": "start_project",
2047
- "permissionIndex": 1000,
2048
- "weight": 1,
2049
- "guard": {
2050
- "guard": "dev_workflow_guard"
2051
- }
2052
- }
2053
- ]
2054
- }
2055
- ]
2056
- },
2057
- {
2058
- "name": "design",
2059
- "pairs": [
2060
- {
2061
- "prev_node": "requirement",
2062
- "threshold": 1,
2063
- "forwards": [
2064
- {
2065
- "name": "submit_design",
2066
- "permissionIndex": 1000,
2067
- "weight": 1,
2068
- "guard": {
2069
- "guard": "dev_workflow_guard"
2070
- }
2071
- }
2072
- ]
2073
- }
2074
- ]
2075
- },
2076
- {
2077
- "name": "development",
2078
- "pairs": [
2079
- {
2080
- "prev_node": "design",
2081
- "threshold": 1,
2082
- "forwards": [
2083
- {
2084
- "name": "start_development",
2085
- "permissionIndex": 1001,
2086
- "weight": 1,
2087
- "guard": {
2088
- "guard": "dev_workflow_guard"
2089
- }
2090
- }
2091
- ]
2092
- }
2093
- ]
2094
- },
2095
- {
2096
- "name": "code_review",
2097
- "pairs": [
2098
- {
2099
- "prev_node": "development",
2100
- "threshold": 1,
2101
- "forwards": [
2102
- {
2103
- "name": "submit_code",
2104
- "namedOperator": "developer",
2105
- "weight": 1,
2106
- "guard": {
2107
- "guard": "dev_workflow_guard"
2108
- }
2109
- }
2110
- ]
2111
- }
2112
- ]
2113
- },
2114
- {
2115
- "name": "testing",
2116
- "pairs": [
2117
- {
2118
- "prev_node": "code_review",
2119
- "threshold": 1,
2120
- "forwards": [
2121
- {
2122
- "name": "approve_code",
2123
- "permissionIndex": 1002,
2124
- "weight": 1,
2125
- "guard": {
2126
- "guard": "dev_workflow_guard"
2127
- }
2128
- }
2129
- ]
2130
- }
2131
- ]
2132
- },
2133
- {
2134
- "name": "uat",
2135
- "pairs": [
2136
- {
2137
- "prev_node": "testing",
2138
- "threshold": 1,
2139
- "forwards": [
2140
- {
2141
- "name": "pass_testing",
2142
- "permissionIndex": 1003,
2143
- "weight": 1,
2144
- "guard": {
2145
- "guard": "dev_workflow_guard"
2146
- }
2147
- }
2148
- ]
2149
- }
2150
- ]
2151
- },
2152
- {
2153
- "name": "deployment",
2154
- "pairs": [
2155
- {
2156
- "prev_node": "uat",
2157
- "threshold": 1,
2158
- "forwards": [
2159
- {
2160
- "name": "approve_uat",
2161
- "permissionIndex": 1004,
2162
- "weight": 1,
2163
- "guard": {
2164
- "guard": "dev_workflow_guard"
2165
- }
2166
- }
2167
- ]
2168
- }
2169
- ]
2170
- },
2171
- {
2172
- "name": "completed",
2173
- "pairs": [
2174
- {
2175
- "prev_node": "deployment",
2176
- "threshold": 1,
2177
- "forwards": [
2178
- {
2179
- "name": "deploy_production",
2180
- "permissionIndex": 1002,
2181
- "weight": 1,
2182
- "guard": {
2183
- "guard": "dev_workflow_guard"
2184
- }
2185
- }
2186
- ]
2187
- }
2188
- ]
2189
- }
2190
- ]
2191
- }
2192
- },
2193
- "env": {
2194
- "account": "pm_alice",
2195
- "network": "testnet"
2196
- }
2197
- }
2198
- ```
2199
-
2200
- **Execution Result**:
2201
- ```json
2202
- {
2203
- "type": "Machine",
2204
- "object": "0xb494336e61f4de62bc646fdb9612ec200d268f4e9407dc71127983ee0cff4324",
2205
- "version": "519691",
2206
- "change": "mutated",
2207
- "nodes_created": 8
2208
- }
2209
- ```
2210
-
2211
- ---
2212
-
2213
- ### Step 7: Export Node Definitions to File
2214
-
2215
- Export the node definitions for reuse:
2216
-
2217
- ```json
2218
- {
2219
- "operation_type": "machineNode2file",
2220
- "machine": "software_dev_workflow",
2221
- "file_path": "d:\\wowok\\docs\\exported_nodes.json",
2222
- "format": "json",
2223
- "env": {
2224
- "account": "pm_alice",
2225
- "network": "testnet"
2226
- }
2227
- }
2228
- ```
2229
-
2230
- **Execution Result**:
2231
- ```json
2232
- {
2233
- "status": "success",
2234
- "file_path": "d:\\wowok\\docs\\exported_nodes.json",
2235
- "format": "json",
2236
- "machine_object": "software_dev_workflow",
2237
- "node_count": 8
2238
- }
2239
- ```
2240
-
2241
- The exported file contains the complete node array:
2242
- ```json
2243
- [
2244
- {
2245
- "name": "requirement",
2246
- "pairs": [
2247
- {
2248
- "prev_node": "",
2249
- "threshold": 1,
2250
- "forwards": [
2251
- {
2252
- "name": "start_project",
2253
- "permissionIndex": 1000,
2254
- "weight": 1,
2255
- "guard": {
2256
- "guard": "0x6ee9...e48a",
2257
- "retained_submission": []
2258
- }
2259
- }
2260
- ]
2261
- }
2262
- ]
2263
- },
2264
- {
2265
- "name": "design",
2266
- "pairs": [
2267
- {
2268
- "prev_node": "requirement",
2269
- "threshold": 1,
2270
- "forwards": [
2271
- {
2272
- "name": "submit_design",
2273
- "permissionIndex": 1000,
2274
- "weight": 1,
2275
- "guard": {
2276
- "guard": "0x6ee9...e48a",
2277
- "retained_submission": []
2278
- }
2279
- }
2280
- ]
2281
- }
2282
- ]
2283
- }
2284
- // ... more nodes
2285
- ]
2286
- ```
2287
-
2288
- ---
2289
-
2290
- ### Step 8: Create New Machine from Exported File
2291
-
2292
- Create a modified workflow by editing the exported file and creating a new Machine:
2293
-
2294
- **Modified File** (`modified_nodes.json`):
2295
- Add a `security_audit` node between `code_review` and `testing`:
2296
-
2297
- ```json
2298
- {
2299
- "name": "security_audit",
2300
- "pairs": [
2301
- {
2302
- "prev_node": "code_review",
2303
- "threshold": 1,
2304
- "forwards": [
2305
- {
2306
- "name": "pass_code_review",
2307
- "permissionIndex": 1002,
2308
- "weight": 1,
2309
- "guard": {
2310
- "guard": "0x6ee9...e48a",
2311
- "retained_submission": []
2312
- }
2313
- }
2314
- ]
2315
- }
2316
- ]
2317
- }
2318
- ```
2319
-
2320
- Create new Machine with file-based node setup:
2321
-
2322
- ```json
2323
- {
2324
- "operation_type": "machine",
2325
- "data": {
2326
- "object": {
2327
- "name": "secure_dev_workflow",
2328
- "permission": "dev_team_permission",
2329
- "tags": ["security", "development", "workflow"],
2330
- "onChain": true
2331
- },
2332
- "description": "Secure Software Development Workflow with Security Audit - enhanced version with security review phase",
2333
- "node": {
2334
- "json_or_markdown_file": "d:\\wowok\\docs\\modified_nodes.json"
2335
- }
2336
- },
2337
- "env": {
2338
- "account": "pm_alice",
2339
- "network": "testnet"
2340
- }
2341
- }
2342
- ```
2343
-
2344
- **Execution Result**:
2345
- ```json
2346
- {
2347
- "type": "Machine",
2348
- "object": "0x0588cfaad10957a7da3c27c2d59c4dddeead333bbc495d37f35051655e282b9f",
2349
- "version": "522600",
2350
- "change": "created"
2351
- }
2352
- ```
2353
-
2354
- ---
2355
-
2356
- ### Step 9: Publish Machine
2357
-
2358
- Publish the Machine to enable Progress creation:
2359
-
2360
- ```json
2361
- {
2362
- "operation_type": "machine",
2363
- "data": {
2364
- "object": "software_dev_workflow",
2365
- "publish": true
2366
- },
2367
- "env": {
2368
- "account": "pm_alice",
2369
- "network": "testnet"
2370
- }
2371
- }
2372
- ```
2373
-
2374
- **Execution Result**:
2375
- ```json
2376
- {
2377
- "type": "Machine",
2378
- "object": "0xb494336e61f4de62bc646fdb9612ec200d268f4e9407dc71127983ee0cff4324",
2379
- "version": "522602",
2380
- "change": "mutated",
2381
- "published": true
2382
- }
2383
- ```
2384
-
2385
- ---
2386
-
2387
- ### Step 10: Create Progress Instances
2388
-
2389
- Create a Progress instance for Project Alpha:
2390
-
2391
- ```json
2392
- {
2393
- "operation_type": "machine",
2394
- "data": {
2395
- "object": "software_dev_workflow",
2396
- "progress_new": {
2397
- "namedNew": {
2398
- "name": "project_alpha",
2399
- "tags": ["project", "alpha", "mobile_app"]
2400
- },
2401
- "progress_namedOperator": {
2402
- "op": "set",
2403
- "name": "developer",
2404
- "operators": {
2405
- "entities": [{"name_or_address": "dev_lead_carol"}]
2406
- }
2407
- }
2408
- }
2409
- },
2410
- "env": {
2411
- "account": "pm_alice",
2412
- "network": "testnet"
2413
- }
2414
- }
2415
- ```
2416
-
2417
- **Execution Result**:
2418
- ```json
2419
- {
2420
- "type": "Progress",
2421
- "object": "0x5255787477424a2d17b8b9902957aaaf1f196d0c8a382ef52876153895dd9cb4",
2422
- "version": "523546",
2423
- "change": "created"
2424
- }
2425
- ```
2426
-
2427
- Create another Progress with a different developer:
2428
-
2429
- ```json
2430
- {
2431
- "operation_type": "machine",
2432
- "data": {
2433
- "object": "secure_dev_workflow",
2434
- "progress_new": {
2435
- "namedNew": {
2436
- "name": "project_beta",
2437
- "tags": ["project", "beta", "web_app"]
2438
- },
2439
- "progress_namedOperator": {
2440
- "op": "set",
2441
- "name": "developer",
2442
- "operators": {
2443
- "entities": [{"name_or_address": "arch_bob"}]
2444
- }
2445
- }
2446
- }
2447
- },
2448
- "env": {
2449
- "account": "pm_alice",
2450
- "network": "testnet"
2451
- }
2452
- }
2453
- ```
2454
-
2455
- **Execution Result**:
2456
- ```json
2457
- {
2458
- "type": "Progress",
2459
- "object": "0x732b6a680f1824df4ef8d54d0ecf1c194bfdd1cee7a683dece2768f56fe59100",
2460
- "version": "523848",
2461
- "change": "created"
2462
- }
2463
- ```
2464
-
2465
- ---
2466
-
2467
- ## Summary of Created Objects
2468
-
2469
- | Object Type | Name | Address | Purpose |
2470
- |-------------|------|---------|---------|
2471
- | **Permission** | dev_team_permission | 0x2482...174c | Access control for workflow |
2472
- | **Guard** | dev_workflow_guard | 0x6ee9...e48a | Validation for transitions |
2473
- | **Machine** | software_dev_workflow | 0xb494...4324 | Standard SDLC workflow (8 nodes) |
2474
- | **Machine** | secure_dev_workflow | 0x0588...2b9f | Enhanced workflow with security audit (9 nodes) |
2475
- | **Progress** | project_alpha | 0x5255...9cb4 | Mobile app project instance |
2476
- | **Progress** | project_beta | 0x732b...9100 | Web app project instance |
2477
-
2478
- ---
2479
-
2480
- ## Related Components
2481
-
2482
- | Component | Description |
2483
- |-----------|-------------|
2484
- | **[Service](service.md)** | WYSIWYG product trading - can bind Machines for workflow templates |
2485
- | **[Progress](progress.md)** | Workflow instance - created from Machine templates via `progress_new` |
2486
- | **[Repository](repository.md)** | Data ownership - can bind Repositories for workflow data storage |
2487
- | **[Guard](guard.md)** | Trust verification engine - used in forwards for workflow validation |
2488
- | **[Permission](permission.md)** | Permission management - controls access to Machine operations |
2489
- | **[Order](order.md)** | Order management - uses Machine workflows for order progress |
2490
- | **[Arbitration](arbitration.md)** | Dispute resolution - can involve Machine workflow states |