@wowok/agent-mcp 2.2.11 → 2.2.13

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 (93) hide show
  1. package/dist/docs/index.d.ts +3 -0
  2. package/dist/docs/index.js +2 -0
  3. package/dist/docs/loader.d.ts +12 -0
  4. package/dist/docs/loader.js +177 -0
  5. package/dist/docs/search.d.ts +17 -0
  6. package/dist/docs/search.js +325 -0
  7. package/dist/docs/types.d.ts +55 -0
  8. package/dist/docs/types.js +1 -0
  9. package/dist/index.d.ts +12 -0
  10. package/dist/index.js +146 -39
  11. package/docs/README.md +249 -0
  12. package/docs/WIP.md +388 -0
  13. package/docs/WTS.md +536 -0
  14. package/docs/docs/account.md +914 -0
  15. package/docs/docs/allocation.md +635 -0
  16. package/docs/docs/arbitration.md +1804 -0
  17. package/docs/docs/arbitration_state_machine.md +270 -0
  18. package/docs/docs/contact.md +709 -0
  19. package/docs/docs/demand.md +948 -0
  20. package/docs/docs/guard.md +1465 -0
  21. package/docs/docs/localinfo.md +432 -0
  22. package/docs/docs/localmark.md +583 -0
  23. package/docs/docs/machine.md +2490 -0
  24. package/docs/docs/messenger.md +2098 -0
  25. package/docs/docs/onchain_events.md +267 -0
  26. package/docs/docs/order.md +1001 -0
  27. package/docs/docs/payment.md +512 -0
  28. package/docs/docs/permission.md +1438 -0
  29. package/docs/docs/personal.md +742 -0
  30. package/docs/docs/progress.md +1748 -0
  31. package/docs/docs/query.md +467 -0
  32. package/docs/docs/repository.md +1043 -0
  33. package/docs/docs/reward.md +833 -0
  34. package/docs/docs/service.md +2130 -0
  35. package/docs/docs/stage-01-introduction.md +243 -0
  36. package/docs/docs/stage-02-trust.md +302 -0
  37. package/docs/docs/stage-03-collaboration.md +337 -0
  38. package/docs/docs/stage-04-transaction.md +277 -0
  39. package/docs/docs/stage-05-business.md +151 -0
  40. package/docs/docs/stage-06-personal.md +203 -0
  41. package/docs/docs/stage-07-query.md +572 -0
  42. package/docs/docs/stage-08-examples.md +184 -0
  43. package/docs/docs/treasury.md +1149 -0
  44. package/docs/docs/wowok_buildin_info.md +740 -0
  45. package/docs/examples/Insurance/Insurance.md +594 -0
  46. package/docs/examples/Insurance/Insurance_TestResults.md +481 -0
  47. package/docs/examples/Insurance/insurance_complete_guard_v1.json +50 -0
  48. package/docs/examples/MyShop/MyShop.md +1353 -0
  49. package/docs/examples/MyShop/MyShop_TestResults.md +1003 -0
  50. package/docs/examples/MyShop_Advanced/MyShop_Advanced.md +1898 -0
  51. package/docs/examples/MyShop_Advanced/MyShop_Advanced_MerchantSystem_TestResults.md +1297 -0
  52. package/docs/examples/MyShop_Advanced/MyShop_Advanced_OrderFlow_TestResults.md +743 -0
  53. package/docs/examples/MyShop_Advanced/machine_nodes.json +222 -0
  54. package/docs/examples/ThreeBody_Signature/ThreeBody_Signature.md +776 -0
  55. package/docs/examples/ThreeBody_Signature/ThreeBody_Signature_TestResults.md +599 -0
  56. package/docs/examples/Travel/Travel.md +1157 -0
  57. package/docs/examples/Travel/Travel_TestResults.md +743 -0
  58. package/docs/examples/Travel/calc-weather-timestamps.js +8 -0
  59. package/docs/examples/Travel/travel_machine_v2_export.json +104 -0
  60. package/docs/examples/Travel/weather_check_guard_v1.json +51 -0
  61. package/docs/skills/WOWOK.md +650 -0
  62. package/docs/skills/onchain_operations/_common.md +406 -0
  63. package/docs/skills/onchain_operations/_index.md +196 -0
  64. package/docs/skills/onchain_operations/allocation.md +28 -0
  65. package/docs/skills/onchain_operations/arbitration.md +106 -0
  66. package/docs/skills/onchain_operations/contact.md +40 -0
  67. package/docs/skills/onchain_operations/demand.md +53 -0
  68. package/docs/skills/onchain_operations/gen_passport.md +23 -0
  69. package/docs/skills/onchain_operations/guard.md +56 -0
  70. package/docs/skills/onchain_operations/machine.md +89 -0
  71. package/docs/skills/onchain_operations/order.md +56 -0
  72. package/docs/skills/onchain_operations/payment.md +24 -0
  73. package/docs/skills/onchain_operations/permission.md +68 -0
  74. package/docs/skills/onchain_operations/personal.md +58 -0
  75. package/docs/skills/onchain_operations/progress.md +38 -0
  76. package/docs/skills/onchain_operations/repository.md +70 -0
  77. package/docs/skills/onchain_operations/reward.md +38 -0
  78. package/docs/skills/onchain_operations/service.md +78 -0
  79. package/docs/skills/onchain_operations/treasury.md +68 -0
  80. package/docs/skills/schema-account_operation.md +402 -0
  81. package/docs/skills/schema-guard2file.md +153 -0
  82. package/docs/skills/schema-local_info_operation.md +160 -0
  83. package/docs/skills/schema-local_mark_operation.md +148 -0
  84. package/docs/skills/schema-machineNode2file.md +155 -0
  85. package/docs/skills/schema-messenger_operation.md +547 -0
  86. package/docs/skills/schema-onchain_events.md +201 -0
  87. package/docs/skills/schema-onchain_table_data.md +334 -0
  88. package/docs/skills/schema-query_toolkit.md +395 -0
  89. package/docs/skills/schema-wip_file.md +240 -0
  90. package/docs/skills/schema-wowok_buildin_info.md +296 -0
  91. package/docs/wip-examples/three_body.html +57 -0
  92. package/docs/wip-examples/three_body.wip +30 -0
  93. package/package.json +3 -2
@@ -0,0 +1,1043 @@
1
+ # Repository Component (📦 Data Repository)
2
+
3
+ ***
4
+
5
+ ## Component Overview
6
+
7
+ Repository is WoWok's on-chain data repository component, used to store structured data. Repository can be bound to Machine, Service, and other components to provide data storage and query capabilities.
8
+
9
+ ***
10
+
11
+ ## Function List
12
+
13
+ | Function Name | Purpose | Usage Scenario | Significance |
14
+ | --------------------- | ---------------------------------------------------- | ------------------------------------------------- | --------------------------------------------------------------- |
15
+ | **Create Repository** | Establish data repository with access controls | Set up service data storage, user data records | Creates secure on-chain database with permission management |
16
+ | **Manage Policies** | Define data write/read rules with Guard verification | Configure data permissions, set up access control | Defines who can write/read which data and under what conditions |
17
+ | **Add Data** | Write data items to repository | Store user records, save workflow states | Persists structured data on-chain with policy validation |
18
+ | **Remove Data** | Delete data items from repository | Clean up outdated records, remove invalid entries | Manages data lifecycle with permission checks |
19
+ | **Bind Rewards** | Link reward objects for data incentives | Encourage data contributions, reward active users | Incentivizes data quality and participation |
20
+ | **Owner Receive** | Unwrap and send received assets to owner | Forward received tokens, process payments | Delivers received assets to permission owner |
21
+
22
+ ***
23
+
24
+ ## Complete Tool Call Structure
25
+
26
+ Repository operations use the following top-level structure:
27
+
28
+ ```json
29
+ {
30
+ "operation_type": "repository",
31
+ "data": { ... }, // Repository data definition
32
+ "env": { ... }, // Execution environment (optional)
33
+ "submission": { ... } // Submission data (optional)
34
+ }
35
+ ```
36
+
37
+ ***
38
+
39
+ ## Schema Tree
40
+
41
+ ```
42
+ repository (Repository Object)
43
+ ├── operation_type: "repository" (fixed value)
44
+ ├── data (Repository data definition)
45
+ │ ├── object (object definition, required)
46
+ │ │ ├── name|id (reference existing object)
47
+ │ │ └── name|tags|type_parameter|permission (create new object)
48
+ │ ├── description (description, optional)
49
+ │ ├── policies (policy rules, optional)
50
+ │ │ ├── op (operation: "add" | "set" | "remove" | "clear")
51
+ │ │ └── policy (array of PolicyRule for add/set, array of strings for remove)
52
+ │ │ └── PolicyRule structure (when op is "add" or "set"):
53
+ │ │ ├── name (string) - policy rule name
54
+ │ │ ├── description (string) - policy rule description
55
+ │ │ ├── write_guard (array of PolicyWriteGuard) - guards for write verification
56
+ │ │ │ └── PolicyWriteGuard structure:
57
+ │ │ │ ├── guard (string) - Guard object ID or name
58
+ │ │ │ ├── id_from_submission (number, 0-255, optional) - Guard table index for data ID
59
+ │ │ │ └── data_from_submission (number, 0-255, optional) - Guard table index for data value
60
+ │ │ ├── quote_guard (string or null, optional) - Guard for on-chain quote verification
61
+ │ │ ├── id_from (number 0-2 or string) - source of data ID
62
+ │ │ │ ├── 0 / "None" / "none" - user must specify ID
63
+ │ │ │ ├── 1 / "Clock" / "clock" - use current timestamp as ID
64
+ │ │ │ └── 2 / "Signer" / "signer" - use signer ID as data ID
65
+ │ │ └── value_type (number or string) - data value type
66
+ │ │ ├── 0 / "Bool" / "bool" - boolean type
67
+ │ │ ├── 1 / "Address" / "address" - address type
68
+ │ │ ├── 2 / "String" / "string" - string type
69
+ │ │ ├── 3 / "U8" / "u8" - unsigned 8-bit integer
70
+ │ │ ├── 4 / "U16" / "u16" - unsigned 16-bit integer
71
+ │ │ ├── 5 / "U32" / "u32" - unsigned 32-bit integer
72
+ │ │ ├── 6 / "U64" / "u64" - unsigned 64-bit integer
73
+ │ │ ├── 7 / "U128" / "u128" - unsigned 128-bit integer
74
+ │ │ ├── 8 / "U256" / "u256" - unsigned 256-bit integer
75
+ │ │ └── ... (see ValueType for complete list)
76
+ │ ├── data_add (add data items, optional)
77
+ │ │ ├── Option 1: SignerOrClock structure (when id_from is Clock or Signer)
78
+ │ │ │ ├── name (string) - data item name (must match PolicyRule name)
79
+ │ │ │ ├── write_guard (string, optional) - Guard ID for write permission
80
+ │ │ │ └── data (any) - data value (must match PolicyRule value_type)
81
+ │ │ └── Option 2: DataAddWithItems structure (when id_from is None)
82
+ │ │ ├── name (string) - data item name (must match PolicyRule name)
83
+ │ │ └── items (array of RepDataItem) - list of data items to add
84
+ │ │ └── RepDataItem structure:
85
+ │ │ ├── data (array of KeyData) - data key-value pairs
86
+ │ │ │ └── KeyData structure:
87
+ │ │ │ ├── id (number or string) - data item ID
88
+ │ │ │ └── data (any) - data value
89
+ │ │ └── write_guard (string, optional) - Guard ID for this data item
90
+ │ ├── data_remove (remove data items, optional)
91
+ │ │ ├── Option 1: SignerOrClockBase structure (when id_from is Clock or Signer)
92
+ │ │ │ ├── name (string) - data item name
93
+ │ │ │ └── write_guard (string, optional) - Guard ID for delete permission
94
+ │ │ └── Option 2: DataRemoveWithItems structure (when id_from is None)
95
+ │ │ ├── name (string) - data item name
96
+ │ │ └── items (array of DataRemoveItem) - list of data items to remove
97
+ │ │ └── DataRemoveItem structure:
98
+ │ │ ├── id (array of number|string) - data item IDs to remove
99
+ │ │ └── write_guard (string, optional) - Guard ID for delete permission
100
+ │ ├── rewards (reward objects, optional)
101
+ │ │ └── array of strings - Reward object names or IDs to bind
102
+ │ ├── owner_receive (transfer received coins or NFT objects to owner, optional)
103
+ │ │ ├── Option 1: "recently" (string) - receive all recent objects
104
+ │ │ ├── Option 2: Array of received objects
105
+ │ │ │ └── [{ id: "object_id", type: "object_type" }]
106
+ │ │ └── Option 3: Received balance object
107
+ │ │ ├── balance (number or string)
108
+ │ │ ├── token_type (string)
109
+ │ │ └── received (array of received items)
110
+ │ └── um (Contact object, optional)
111
+ │ ├── Option 1: Contact object name or ID (string)
112
+ │ └── Option 2: null (to unbind contact)
113
+ ├── env (optional, execution environment)
114
+ │ ├── account (string, optional) - account name or address, empty string for default
115
+ │ ├── network (string, optional) - "testnet" or "localnet"
116
+ │ ├── permission_guard (array, optional) - list of permission guard IDs
117
+ │ ├── no_cache (boolean, optional) - disable caching
118
+ │ └── referrer (string, optional) - referrer ID
119
+ └── submission (optional, submission data)
120
+ ├── type (string) - fixed value "submission"
121
+ ├── guard (array) - list of guards to verify
122
+ │ └── [{ object: "guard_id", impack: boolean }]
123
+ └── submission (array) - submission data for guards
124
+ └── [{ guard: "guard_id", submission: [guard_submission_items] }]
125
+ └── guard_submission_items
126
+ ├── identifier (number, 0-255) - Guard table item identifier
127
+ ├── b_submission (boolean) - whether this item requires submission
128
+ ├── value_type (number | string) - value type (e.g., 6 or "U64" for U64 type)
129
+ ├── value (any) - submitted value
130
+ └── name (string, optional) - item name
131
+ ```
132
+
133
+ ***
134
+
135
+ ### Complete Value Type Reference
136
+
137
+ The following table lists all supported `value_type` values for policy definitions:
138
+
139
+ | Numeric Value | String Value | Description |
140
+ |--------------|--------------|-------------|
141
+ | 0 | "Bool" / "bool" | Boolean type |
142
+ | 1 | "Address" / "address" | Address type |
143
+ | 2 | "String" / "string" | String type |
144
+ | 3 | "U8" / "u8" | Unsigned 8-bit integer |
145
+ | 4 | "U16" / "u16" | Unsigned 16-bit integer |
146
+ | 5 | "U32" / "u32" | Unsigned 32-bit integer |
147
+ | 6 | "U64" / "u64" | Unsigned 64-bit integer |
148
+ | 7 | "U128" / "u128" | Unsigned 128-bit integer |
149
+ | 8 | "U256" / "u256" | Unsigned 256-bit integer |
150
+ | 9 | "VecBool" / "vecbool" | Vector of booleans |
151
+ | 10 | "VecAddress" / "vecaddress" | Vector of addresses |
152
+ | 11 | "VecString" / "vecstring" | Vector of strings |
153
+ | 12 | "VecU8" / "vecu8" | Vector of unsigned 8-bit integers |
154
+ | 13 | "VecU16" / "vecu16" | Vector of unsigned 16-bit integers |
155
+ | 14 | "VecU32" / "vecu32" | Vector of unsigned 32-bit integers |
156
+ | 15 | "VecU64" / "vecu64" | Vector of unsigned 64-bit integers |
157
+ | 16 | "VecU128" / "vecu128" | Vector of unsigned 128-bit integers |
158
+ | 17 | "VecU256" / "vecu256" | Vector of unsigned 256-bit integers |
159
+ | 18 | "VecVecU8" / "vecvecu8" | Vector of vectors of unsigned 8-bit integers |
160
+
161
+ **Query via Tool**: You can also query all value types dynamically using the `wowok_buildin_info` tool with `info: "value types"`.
162
+
163
+ ***
164
+
165
+ ### ⚠️ Important Note About Submission
166
+
167
+ If the execution returns a `submission` field in the response, it indicates that additional Guard verification data is required. You must:
168
+
169
+ 1. Complete all required submission data within the `submission` structure
170
+ 2. Resubmit the operation with the completed submission data
171
+ 3. **Do not modify any other parts of the structure** - only fill in the required submission values
172
+
173
+ The submission structure will specify which Guard objects need verification and what data needs to be provided for each Guard table item.
174
+
175
+ **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.
176
+
177
+ ***
178
+
179
+ ## Sub-feature 1: Create New Repository
180
+
181
+ ### Feature Description
182
+
183
+ Create a new Repository object for storing structured data.
184
+
185
+ ### Parameter Description
186
+
187
+ | Parameter Path | Type | Required | Description | Constraints |
188
+ | ------------------ | ---------------- | -------- | ---------------------- | ------------------------------------ |
189
+ | `operation_type` | string | Yes | Operation type | Fixed value "repository" |
190
+ | `data.object` | object or string | Yes | Object definition | WithPermissionObject |
191
+ | `data.description` | string | No | Repository description | Max 4000 BCS characters |
192
+ | `env.account` | string | No | Use specified account | Empty string '' uses default account |
193
+ | `env.network` | enum | No | Network selection | "localnet" or "testnet" |
194
+
195
+ ### Important Notes
196
+
197
+ ⚠️ **Policy Rules**: Policies define data write/read permissions using PolicyRule objects, which include write\_guard, id\_from, and value\_type.
198
+
199
+ ***
200
+
201
+ ### Examples
202
+
203
+ #### Example 1.1: Create Minimal Repository
204
+
205
+ **Prompt**: Create a Repository named "repo\_test\_1", use default account and network, no other configuration specified.
206
+
207
+ ```json
208
+ {
209
+ "operation_type": "repository",
210
+ "data": {
211
+ "object": {
212
+ "name": "repo_test_1"
213
+ }
214
+ },
215
+ "env": {
216
+ "network": "testnet"
217
+ }
218
+ }
219
+ ```
220
+
221
+ **Execution Result**:
222
+
223
+ ```json
224
+ {
225
+ "status": "success",
226
+ "objects": [
227
+ {
228
+ "type": "Permission",
229
+ "object": "0x875e...0192",
230
+ "version": "190089",
231
+ "change": "created"
232
+ },
233
+ {
234
+ "type": "Repository",
235
+ "object": "0xa588...78f7",
236
+ "version": "190089",
237
+ "change": "created"
238
+ }
239
+ ]
240
+ }
241
+ ```
242
+
243
+ ***
244
+
245
+ #### Example 1.2: Create Repository with Tags
246
+
247
+ **Prompt**: Create a Repository named "repo\_test\_2", add tags "users", "storage", description "User data storage repository".
248
+
249
+ ```json
250
+ {
251
+ "operation_type": "repository",
252
+ "data": {
253
+ "object": {
254
+ "name": "repo_test_2",
255
+ "tags": ["users", "storage"]
256
+ },
257
+ "description": "User data storage repository"
258
+ },
259
+ "env": {
260
+ "network": "testnet"
261
+ }
262
+ }
263
+ ```
264
+
265
+ **Execution Result**:
266
+
267
+ ```json
268
+ {
269
+ "status": "success",
270
+ "objects": [
271
+ {
272
+ "type": "Permission",
273
+ "object": "0xe391...d3ca",
274
+ "version": "190619",
275
+ "change": "created"
276
+ },
277
+ {
278
+ "type": "Repository",
279
+ "object": "0x2e14...d800",
280
+ "version": "190619",
281
+ "change": "created"
282
+ }
283
+ ]
284
+ }
285
+ ```
286
+
287
+ ***
288
+
289
+ #### Example 1.3: Create Complete Repository with Policies
290
+
291
+ **Prompt**: Create a Repository named "complete\_repo": 1) Add tags "service", "database", 2) Add description "Complete repository example", 3) Add a policy named "user\_notes" with write guard "repo\_guard\_1", id from clock, value type string.
292
+
293
+ > **Prerequisite**: Need to create Guard object first
294
+ >
295
+ > ```json
296
+ > {
297
+ > "operation_type": "guard",
298
+ > "data": {
299
+ > "namedNew": {"name": "repo_guard_1"},
300
+ > "description": "Always true guard for repository testing",
301
+ > "table": [{"identifier": 0, "value_type": "bool", "b_submission": false, "value": true}],
302
+ > "root": {
303
+ > "type": "node",
304
+ > "node": {
305
+ > "type": "logic_equal",
306
+ > "nodes": [{"type": "identifier", "identifier": 0}, {"type": "identifier", "identifier": 0}]
307
+ > }
308
+ > }
309
+ > },
310
+ > "env": {"network": "testnet"}
311
+ > }
312
+ > ```
313
+
314
+ ```json
315
+ {
316
+ "operation_type": "repository",
317
+ "data": {
318
+ "object": {
319
+ "name": "complete_repo",
320
+ "tags": ["service", "database"]
321
+ },
322
+ "description": "Complete repository example",
323
+ "policies": {
324
+ "op": "add",
325
+ "policy": [
326
+ {
327
+ "name": "user_notes",
328
+ "description": "User notes storage",
329
+ "write_guard": [{"guard": "repo_guard_1"}],
330
+ "id_from": "Clock",
331
+ "value_type": "string"
332
+ }
333
+ ]
334
+ }
335
+ },
336
+ "env": {
337
+ "network": "testnet"
338
+ }
339
+ }
340
+ ```
341
+
342
+ **Execution Result**:
343
+
344
+ ```json
345
+ {
346
+ "status": "success",
347
+ "objects": [
348
+ {
349
+ "type": "Permission",
350
+ "object": "0x2de2...8571",
351
+ "version": "191543",
352
+ "change": "created"
353
+ },
354
+ {
355
+ "type": "Repository",
356
+ "object": "0x5e97...4970",
357
+ "version": "191543",
358
+ "change": "created"
359
+ }
360
+ ]
361
+ }
362
+ ```
363
+
364
+ ***
365
+
366
+ ## Sub-feature 2: Manage Policies
367
+
368
+ ### Feature Description
369
+
370
+ Add, set, remove, or clear policy rules that define data write permissions and ID sources.
371
+
372
+ ### Parameter Description
373
+
374
+ | Parameter Path | Type | Required | Description | Constraints |
375
+ | ---------------- | ------ | -------- | --------------------- | -------------------------------------- |
376
+ | `operation_type` | string | Yes | Operation type | Fixed value "repository" |
377
+ | `data.object` | string | Yes | Repository name or ID | <br /> |
378
+ | `data.policies` | object | Yes | Policy operations | { op: "add\|set\|remove\|clear", ... } |
379
+
380
+ ### PolicyRule Structure
381
+
382
+ | Field | Type | Required | Description |
383
+ | ------------- | -------------- | -------- | ------------------------------------------------------------------------------------------------------------ |
384
+ | `name` | string | Yes | Policy rule name |
385
+ | `description` | string | Yes | Policy rule description |
386
+ | `write_guard` | array | Yes | Guard object list for write verification |
387
+ | `quote_guard` | string or null | No | Guard for on-chain reference verification |
388
+ | `id_from` | enum or number | Yes | ID source: can be string ("None", "Clock", "Signer", case-insensitive) or number (0=None, 1=Clock, 2=Signer) |
389
+ | `value_type` | enum | Yes | Value type: "string", "number", "boolean", etc. |
390
+
391
+ ### Operation Types
392
+
393
+ - **add**: Add new policies to existing list
394
+ - **set**: Replace entire policy list
395
+ - **remove**: Remove specified policies (by name)
396
+ - **clear**: Clear all policies
397
+
398
+ ***
399
+
400
+ ### Examples
401
+
402
+ #### Example 2.1: Add Single Policy
403
+
404
+ **Prompt**: Add a policy to "repo\_test\_2": 1) Policy name "user\_profile", 2) Write guard "profile\_guard", 3) ID from signer, 4) Value type Address.
405
+
406
+ > **Prerequisite**: Need to create Guard object first
407
+ >
408
+ > ```json
409
+ > {
410
+ > "operation_type": "guard",
411
+ > "data": {
412
+ > "namedNew": {"name": "profile_guard"},
413
+ > "description": "Guard for profile policy",
414
+ > "table": [{"identifier": 0, "value_type": "bool", "b_submission": false, "value": true}],
415
+ > "root": {
416
+ > "type": "node",
417
+ > "node": {
418
+ > "type": "logic_equal",
419
+ > "nodes": [{"type": "identifier", "identifier": 0}, {"type": "identifier", "identifier": 0}]
420
+ > }
421
+ > }
422
+ > },
423
+ > "env": {"network": "testnet"}
424
+ > }
425
+ > ```
426
+
427
+ ```json
428
+ {
429
+ "operation_type": "repository",
430
+ "data": {
431
+ "object": "repo_test_2",
432
+ "policies": {
433
+ "op": "add",
434
+ "policy": [
435
+ {
436
+ "name": "user_profile",
437
+ "description": "User profile data",
438
+ "write_guard": [{"guard": "profile_guard"}],
439
+ "id_from": "Signer",
440
+ "value_type": "Address"
441
+ }
442
+ ]
443
+ }
444
+ },
445
+ "env": {
446
+ "network": "testnet"
447
+ }
448
+ }
449
+ ```
450
+
451
+ **Execution Result**:
452
+
453
+ ```json
454
+ {
455
+ "status": "success",
456
+ "objects": [
457
+ {
458
+ "type": "Repository",
459
+ "object": "0x2e14...d800",
460
+ "version": "192431",
461
+ "change": "modified"
462
+ }
463
+ ]
464
+ }
465
+ ```
466
+
467
+ ***
468
+
469
+ #### Example 2.2: Add Multiple Policies
470
+
471
+ **Prompt**: Add two policies to "repo\_test\_1": 1) First policy "order\_info" with clock ID and U64 type, 2) Second policy "feedback" with signer ID and String type.
472
+
473
+ > **Prerequisite**: Need to create Guard object first
474
+ >
475
+ > ```json
476
+ > {
477
+ > "operation_type": "guard",
478
+ > "data": {
479
+ > "namedNew": {"name": "order_guard"},
480
+ > "description": "Guard for order policy",
481
+ > "table": [{"identifier": 0, "value_type": "bool", "b_submission": false, "value": true}],
482
+ > "root": {
483
+ > "type": "node",
484
+ > "node": {
485
+ > "type": "logic_equal",
486
+ > "nodes": [{"type": "identifier", "identifier": 0}, {"type": "identifier", "identifier": 0}]
487
+ > }
488
+ > }
489
+ > },
490
+ > "env": {"network": "testnet"}
491
+ > }
492
+ > ```
493
+ >
494
+ > ```json
495
+ > {
496
+ > "operation_type": "guard",
497
+ > "data": {
498
+ > "namedNew": {"name": "feedback_guard"},
499
+ > "description": "Guard for feedback policy",
500
+ > "table": [{"identifier": 0, "value_type": "bool", "b_submission": false, "value": true}],
501
+ > "root": {
502
+ > "type": "node",
503
+ > "node": {
504
+ > "type": "logic_equal",
505
+ > "nodes": [{"type": "identifier", "identifier": 0}, {"type": "identifier", "identifier": 0}]
506
+ > }
507
+ > }
508
+ > },
509
+ > "env": {"network": "testnet"}
510
+ > }
511
+ > ```
512
+
513
+ ```json
514
+ {
515
+ "operation_type": "repository",
516
+ "data": {
517
+ "object": "repo_test_1",
518
+ "policies": {
519
+ "op": "add",
520
+ "policy": [
521
+ {
522
+ "name": "order_info",
523
+ "description": "Order information records",
524
+ "write_guard": [{"guard": "order_guard"}],
525
+ "id_from": "Clock",
526
+ "value_type": "U64"
527
+ },
528
+ {
529
+ "name": "feedback",
530
+ "description": "User feedback records",
531
+ "write_guard": [{"guard": "feedback_guard"}],
532
+ "id_from": "Signer",
533
+ "value_type": "String"
534
+ }
535
+ ]
536
+ }
537
+ },
538
+ "env": {
539
+ "network": "testnet"
540
+ }
541
+ }
542
+ ```
543
+
544
+ **Execution Result**:
545
+
546
+ ```json
547
+ {
548
+ "status": "success",
549
+ "objects": [
550
+ {
551
+ "type": "Repository",
552
+ "object": "0xa588...78f7",
553
+ "version": "193331",
554
+ "change": "modified"
555
+ }
556
+ ]
557
+ }
558
+ ```
559
+
560
+ ***
561
+
562
+ #### Example 2.3: Remove Policies
563
+
564
+ **Prompt**: Remove policy "order\_info" from "repo\_test\_1".
565
+
566
+ ```json
567
+ {
568
+ "operation_type": "repository",
569
+ "data": {
570
+ "object": "repo_test_1",
571
+ "policies": {
572
+ "op": "remove",
573
+ "policy": ["order_info"]
574
+ }
575
+ },
576
+ "env": {
577
+ "network": "testnet"
578
+ }
579
+ }
580
+ ```
581
+
582
+ **Execution Result**:
583
+
584
+ ```json
585
+ {
586
+ "status": "success",
587
+ "objects": [
588
+ {
589
+ "type": "Repository",
590
+ "object": "0xa588...78f7",
591
+ "version": "193332",
592
+ "change": "modified"
593
+ }
594
+ ]
595
+ }
596
+ ```
597
+
598
+ ***
599
+
600
+ #### Example 2.4: Clear All Policies
601
+
602
+ **Prompt**: Clear all policies from "repo\_test\_1".
603
+
604
+ ```json
605
+ {
606
+ "operation_type": "repository",
607
+ "data": {
608
+ "object": "repo_test_1",
609
+ "policies": {
610
+ "op": "clear"
611
+ }
612
+ },
613
+ "env": {
614
+ "network": "testnet"
615
+ }
616
+ }
617
+ ```
618
+
619
+ **Execution Result**:
620
+
621
+ ```json
622
+ {
623
+ "status": "success",
624
+ "objects": [
625
+ {
626
+ "type": "Repository",
627
+ "object": "0xa588...78f7",
628
+ "version": "196947",
629
+ "change": "modified"
630
+ }
631
+ ]
632
+ }
633
+ ```
634
+
635
+ ***
636
+
637
+ ## Sub-feature 3: Add Data
638
+
639
+ ### Feature Description
640
+
641
+ Add data items to the repository, following policy rules for ID source and value type.
642
+
643
+ ### Parameter Description
644
+
645
+ | Parameter Path | Type | Required | Description | Constraints |
646
+ | ---------------- | ------ | -------- | --------------------- | ------------------------------- |
647
+ | `operation_type` | string | Yes | Operation type | Fixed value "repository" |
648
+ | `data.object` | string | Yes | Repository name or ID | <br /> |
649
+ | `data.data_add` | object | Yes | Data to add | Must match policy name and type |
650
+
651
+ ### DataAdd Types
652
+
653
+ 1. **SignerOrClock**: `{ name: "...", write_guard: "...", data: value }`
654
+ 2. **DataAddWithItems**: `{ name: "...", items: [{ data: [{ id, data }], write_guard: "..." }] }`
655
+
656
+ ***
657
+
658
+ ### Examples
659
+
660
+ #### Example 3.1: Add Data with Signer/Clock ID
661
+
662
+ **Prompt**: Add data to "simple\_repo": 1) Policy name "simple\_data", 2) Data value "Test data without guard".
663
+
664
+ > **Prerequisite**: Need to create Repository with policy first
665
+ >
666
+ > ```json
667
+ > {
668
+ > "operation_type": "repository",
669
+ > "data": {
670
+ > "object": {"name": "simple_repo"},
671
+ > "policies": {
672
+ > "op": "add",
673
+ > "policy": [
674
+ > {
675
+ > "name": "simple_data",
676
+ > "description": "Simple data storage",
677
+ > "write_guard": [],
678
+ > "id_from": "Clock",
679
+ > "value_type": "String"
680
+ > }
681
+ > ]
682
+ > }
683
+ > },
684
+ > "env": {"network": "testnet"}
685
+ > }
686
+ > ```
687
+
688
+ ```json
689
+ {
690
+ "operation_type": "repository",
691
+ "data": {
692
+ "object": "simple_repo",
693
+ "data_add": {
694
+ "name": "simple_data",
695
+ "data": "Test data without guard"
696
+ }
697
+ },
698
+ "env": {
699
+ "network": "testnet"
700
+ }
701
+ }
702
+ ```
703
+
704
+ **Execution Result**:
705
+
706
+ ```json
707
+ {
708
+ "status": "success"
709
+ }
710
+ ```
711
+
712
+ ***
713
+
714
+ #### Example 3.2: Add Multiple Data Items
715
+
716
+ **Prompt**: Add multiple data items to "simple\_repo" for policy "simple\_data": 1) First item with id 100 and value "First data item", 2) Second item with id 200 and value "Second data item".
717
+
718
+ ```json
719
+ {
720
+ "operation_type": "repository",
721
+ "data": {
722
+ "object": "simple_repo",
723
+ "data_add": {
724
+ "name": "simple_data",
725
+ "items": [
726
+ {
727
+ "data": [
728
+ {
729
+ "id": 100,
730
+ "data": "First data item"
731
+ },
732
+ {
733
+ "id": 200,
734
+ "data": "Second data item"
735
+ }
736
+ ]
737
+ }
738
+ ]
739
+ }
740
+ },
741
+ "env": {
742
+ "network": "testnet"
743
+ }
744
+ }
745
+ ```
746
+
747
+ **Execution Result**:
748
+
749
+ ```json
750
+ {
751
+ "status": "success"
752
+ }
753
+ ```
754
+
755
+ ***
756
+
757
+ ## Sub-feature 4: Remove Data
758
+
759
+ ### Feature Description
760
+
761
+ Remove data items from the repository.
762
+
763
+ ### Parameter Description
764
+
765
+ | Parameter Path | Type | Required | Description | Constraints |
766
+ | ------------------ | ------ | -------- | --------------------- | ------------------------ |
767
+ | `operation_type` | string | Yes | Operation type | Fixed value "repository" |
768
+ | `data.object` | string | Yes | Repository name or ID | <br /> |
769
+ | `data.data_remove` | object | Yes | Data to remove | Must match policy name |
770
+
771
+ ### DataRemove Types
772
+
773
+ 1. **SignerOrClockBase**: `{ name: "...", write_guard: "..." }`
774
+ 2. **By IDs**: `{ name: "...", items: [{ id: [...], write_guard: "..." }] }`
775
+
776
+ ***
777
+
778
+ ### Examples
779
+
780
+ #### Example 4.1: Remove Data by Signer/Clock
781
+
782
+ **Prompt**: Remove data from "simple\_repo" for policy "simple\_data".
783
+
784
+ ```json
785
+ {
786
+ "operation_type": "repository",
787
+ "data": {
788
+ "object": "simple_repo",
789
+ "data_remove": {
790
+ "name": "simple_data"
791
+ }
792
+ },
793
+ "env": {
794
+ "network": "testnet"
795
+ }
796
+ }
797
+ ```
798
+
799
+ **Execution Result**:
800
+
801
+ ```json
802
+ {
803
+ "status": "success"
804
+ }
805
+ ```
806
+
807
+ ***
808
+
809
+ #### Example 4.2: Remove Data by Specific IDs
810
+
811
+ **Prompt**: Remove data items with ids 100 and 200 from "simple\_repo" for policy "simple\_data".
812
+
813
+ ```json
814
+ {
815
+ "operation_type": "repository",
816
+ "data": {
817
+ "object": "simple_repo",
818
+ "data_remove": {
819
+ "name": "simple_data",
820
+ "items": [
821
+ {
822
+ "id": [100, 200]
823
+ }
824
+ ]
825
+ }
826
+ },
827
+ "env": {
828
+ "network": "testnet"
829
+ }
830
+ }
831
+ ```
832
+
833
+ **Execution Result**:
834
+
835
+ ```json
836
+ {
837
+ "status": "success"
838
+ }
839
+ ```
840
+
841
+ ***
842
+
843
+ ## Sub-feature 5: Bind Rewards and Receive Assets
844
+
845
+ ### Feature Description
846
+
847
+ Bind reward objects for data contribution incentives, and process received assets.
848
+
849
+ ### Parameter Description
850
+
851
+ | Parameter Path | Type | Required | Description | Constraints |
852
+ | -------------------- | ---------------- | -------- | ------------------------------- | ----------------------------- |
853
+ | `operation_type` | string | Yes | Operation type | Fixed value "repository" |
854
+ | `data.object` | string | Yes | Repository name or ID | <br /> |
855
+ | `data.rewards` | array | No | Reward object names/IDs to bind | <br /> |
856
+ | `data.owner_receive` | string or object | No | Unwrap and send to owner | "recently" or ReceivedObjects |
857
+
858
+ ***
859
+
860
+ ### Examples
861
+
862
+ #### Example 5.1: Bind Reward Objects
863
+
864
+ **Prompt**: Bind reward object "test\_reward" to "repo\_test\_1".
865
+
866
+ > **Prerequisite**: Need to create Reward object first
867
+ >
868
+ > ```json
869
+ > {
870
+ > "operation_type": "reward",
871
+ > "data": {
872
+ > "object": {"name": "test_reward"},
873
+ > "description": "Test reward for repository",
874
+ > "time": {"op": "add", "time": [3600]}
875
+ > },
876
+ > "env": {"network": "testnet"}
877
+ > }
878
+ > ```
879
+
880
+ ```json
881
+ {
882
+ "operation_type": "repository",
883
+ "data": {
884
+ "object": "repo_test_1",
885
+ "rewards": ["test_reward"]
886
+ },
887
+ "env": {
888
+ "network": "testnet"
889
+ }
890
+ }
891
+ ```
892
+
893
+ **Execution Result**:
894
+
895
+ ```json
896
+ {
897
+ "status": "success",
898
+ "objects": [
899
+ {
900
+ "type": "Repository",
901
+ "object": "0xa588...78f7",
902
+ "version": "198001",
903
+ "change": "modified"
904
+ }
905
+ ]
906
+ }
907
+ ```
908
+
909
+ ***
910
+
911
+ #### Example 5.2: Unwrap and Send to Owner
912
+
913
+ **Prompt**: Unwrap recently received objects of "repo\_test\_1", send to permission owner.
914
+
915
+ > **Prerequisite**: Need to send some objects to Repository first (e.g., via Payment)
916
+ >
917
+ > ```json
918
+ > {
919
+ > "operation_type": "payment",
920
+ > "data": {
921
+ > "for_object": "repo_test_1",
922
+ > "remark": "Test payment to repository"
923
+ > },
924
+ > "env": {"network": "testnet"}
925
+ > }
926
+ > ```
927
+
928
+ ```json
929
+ {
930
+ "operation_type": "repository",
931
+ "data": {
932
+ "object": "repo_test_1",
933
+ "owner_receive": "recently"
934
+ },
935
+ "env": {
936
+ "network": "testnet"
937
+ }
938
+ }
939
+ ```
940
+
941
+ **Execution Result**:
942
+
943
+ ```json
944
+ {
945
+ "status": "success",
946
+ "objects": [
947
+ {
948
+ "type": "Repository",
949
+ "object": "0xa588...78f7",
950
+ "version": "198002",
951
+ "change": "modified"
952
+ }
953
+ ]
954
+ }
955
+ ```
956
+
957
+ ***
958
+
959
+ ## Sub-feature 6: Combined Operations
960
+
961
+ ### Feature Description
962
+
963
+ Perform multiple operations on existing Repository in a single transaction.
964
+
965
+ ***
966
+
967
+ ### Example
968
+
969
+ #### Example 6.1: Complete Repository Setup
970
+
971
+ **Prompt**: For "repo\_test\_2": 1) Set description "Updated repository description", 2) Add a policy without write\_guard, 3) Add data.
972
+
973
+ ```json
974
+ {
975
+ "operation_type": "repository",
976
+ "data": {
977
+ "object": "repo_test_2",
978
+ "description": "Updated repository description",
979
+ "policies": {
980
+ "op": "add",
981
+ "policy": [
982
+ {
983
+ "name": "logs",
984
+ "description": "Log records",
985
+ "write_guard": [],
986
+ "id_from": "Clock",
987
+ "value_type": "String"
988
+ }
989
+ ]
990
+ },
991
+ "data_add": {
992
+ "name": "logs",
993
+ "data": "System started"
994
+ }
995
+ },
996
+ "env": {
997
+ "network": "testnet"
998
+ }
999
+ }
1000
+ ```
1001
+
1002
+ **Execution Result**:
1003
+
1004
+ ```json
1005
+ {
1006
+ "status": "success",
1007
+ "objects": [
1008
+ {
1009
+ "type": "Repository",
1010
+ "object": "0x2e14...d800",
1011
+ "version": "198500",
1012
+ "change": "modified"
1013
+ }
1014
+ ]
1015
+ }
1016
+ ```
1017
+
1018
+ ***
1019
+
1020
+ ## Important Notes
1021
+
1022
+ ⚠️ **Policies define data structure and permissions**, always define policies before adding data.
1023
+
1024
+ ⚠️ **All data must conform to policy-defined value types and ID sources.**
1025
+
1026
+ ⚠️ **Use names instead of addresses in prompts for better readability.**
1027
+
1028
+ ⚠️ **Write guards must verify successfully before data can be written.**
1029
+
1030
+ ⚠️ **Repository can bind multiple Reward objects for data contribution incentives.**
1031
+
1032
+ ***
1033
+
1034
+ ## Related Components
1035
+
1036
+ | Component | Description |
1037
+ | ------------------------------- | --------------------------------------------------------------- |
1038
+ | **[Service](service.md)** | WYSIWYG product trading - can bind Repository to Service |
1039
+ | **[Machine](machine.md)** | Workflow template - can bind Repository to Machine |
1040
+ | **[Guard](guard.md)** | Trust verification engine - required for data write permissions |
1041
+ | **[Permission](permission.md)** | Permission management |
1042
+ | **[Reward](reward.md)** | Marketing incentives - can bind for data incentives |
1043
+