@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
package/docs/WIP.md ADDED
@@ -0,0 +1,388 @@
1
+ # WIP — Witness Immutable Promise
2
+
3
+ ---
4
+
5
+ ## Overview
6
+
7
+ **WIP** (Witness Immutable Promise) is a JSON-based file format for conveying **tamper-proof commitments** over networks, designed primarily for AI agents and automated systems. It ensures content integrity through cryptographic hashing and optional digital signatures, supporting rich text and multiple embedded images.
8
+
9
+ A WIP file serves as a **self-verifiable promise** — any recipient can independently verify that the content has not been altered since creation, without trusting the sender or any intermediary.
10
+
11
+ ### Key Properties
12
+
13
+ | Property | Mechanism |
14
+ |----------|-----------|
15
+ | **Tamper Detection** | SHA-256 hash covers the schema identifier and entire payload |
16
+ | **Non-Repudiation** | Optional Falcon-512 digital signature over the entire metadata block |
17
+ | **Self-Verifiable** | All verification data is embedded in the file; no external trust required |
18
+ | **AI-Native** | Designed for AI agents to create, exchange, and verify commitments autonomously |
19
+
20
+ ---
21
+
22
+ ## Schema
23
+
24
+ ### JSON Structure
25
+
26
+ ```
27
+ {
28
+ "wip": "https://github.com/wowok-ai/docs/blob/main/WIP.md",
29
+ "payload": { ... },
30
+ "meta": { ... }
31
+ }
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Field Reference
37
+
38
+ ### Root Level
39
+
40
+ | Field | Type | Required | Description |
41
+ |-------|------|----------|-------------|
42
+ | `wip` | `string` | **Yes** | Schema identifier URL. Fixed value: `"https://github.com/wowok-ai/docs/blob/main/WIP.md"` |
43
+ | `payload` | `object` | **Yes** | The commitment content (text + optional media) |
44
+ | `meta` | `object` | **Yes** | Metadata including integrity hash and optional signatures |
45
+
46
+ ---
47
+
48
+ ### `payload` — Content Payload
49
+
50
+ | Field | Type | Required | Description |
51
+ |-------|------|----------|-------------|
52
+ | `payload.content` | `object` | **Yes** | Text content of the commitment |
53
+ | `payload.content.text` | `string` | **Yes** | The commitment text. Max 10,000 characters (~5,000 Chinese characters) |
54
+ | `payload.content.format` | `enum` | **Yes** | Text format: `"plain"` \| `"markdown"` \| `"html"` |
55
+ | `payload.media` | `array` | **Yes** | Array of embedded media files (can be empty `[]`) |
56
+
57
+ #### `payload.media[]` — Media Item
58
+
59
+ | Field | Type | Required | Description |
60
+ |-------|------|----------|-------------|
61
+ | `id` | `string` | **Yes** | Unique identifier for this media item (e.g., `"img-001"`) |
62
+ | `type` | `enum` | **Yes** | MIME type: `"image/png"` \| `"image/jpeg"` \| `"image/gif"` \| `"image/webp"` |
63
+ | `data` | `string` | **Yes** | Base64-encoded file data |
64
+ | `filename` | `string` | No | Original filename (e.g., `"contract-signature.png"`) |
65
+
66
+ ---
67
+
68
+ ### `meta` — Metadata
69
+
70
+ | Field | Type | Required | Description |
71
+ |-------|------|----------|-------------|
72
+ | `meta.type` | `string` | **Yes** | File type identifier. Fixed value: `"wip"` |
73
+ | `meta.version` | `string` | **Yes** | Format version. Current: `"1.0.0"` |
74
+ | `meta.created` | `string` | **Yes** | Creation timestamp in ISO 8601 format (e.g., `"2024-03-15T08:30:00Z"`) |
75
+ | `meta.hash` | `string` | **Yes** | SHA-256 hash of `{ wip, payload }` as a lowercase hex string (no prefix) |
76
+ | `meta.algorithm` | `string` | **Yes** | Hash algorithm identifier. Fixed value: `"sha256"` |
77
+ | `meta.signature` | `object` or `array` | No | Digital signature(s). Single object or array for multi-signature support |
78
+
79
+ #### `meta.signature` — Signature Object
80
+
81
+ | Field | Type | Required | Description |
82
+ |-------|------|----------|-------------|
83
+ | `value` | `string` | **Yes** | Base64-encoded signature bytes |
84
+ | `publicKey` | `string` | **Yes** | Public key for verification (Base64-encoded, 897 bytes for Falcon-512) |
85
+ | `algorithm` | `string` | **Yes** | Signature algorithm. Fixed value: `"Falcon512"` |
86
+ | `address` | `string` | No | Signer's blockchain address (hex-encoded, `0x` prefix) |
87
+
88
+ ---
89
+
90
+ ## Integrity Model
91
+
92
+ ### Hash Computation
93
+
94
+ The `meta.hash` is computed as:
95
+
96
+ ```
97
+ hash = SHA-256( canonicalizeJson({ wip: schemaUrl, payload: payload }) )
98
+ ```
99
+
100
+ This covers **both** the schema identifier and the entire payload, preventing:
101
+ - Tampering with the `wip` field (e.g., disguising a WIP as another format)
102
+ - Tampering with any payload content (text or media)
103
+
104
+ ### Signature Computation
105
+
106
+ When present, `meta.signature` is a Falcon-512 signature over:
107
+
108
+ ```
109
+ metaHash = SHA-256( canonicalizeJson(meta_without_signature) )
110
+ ```
111
+
112
+ Where `meta_without_signature` is the `meta` object with the `signature` field excluded. This covers **all** metadata fields (`type`, `version`, `created`, `hash`, `algorithm`), preventing tampering with any meta field.
113
+
114
+ ### Verification Chain
115
+
116
+ ```
117
+ { wip, payload } ──SHA-256──► meta.hash ──(part of)──► meta
118
+
119
+ meta (excluding signature) ──SHA-256──► metaHash ──Falcon-512──► meta.signature
120
+ ```
121
+
122
+ ### Tamper Detection Matrix
123
+
124
+ | Tampered Field | Detected By |
125
+ |----------------|-------------|
126
+ | `wip` (schema URL) | Hash mismatch |
127
+ | `payload.content.text` | Hash mismatch |
128
+ | `payload.content.format` | Hash mismatch |
129
+ | `payload.media[].data` | Hash mismatch |
130
+ | `meta.type` | Signature mismatch |
131
+ | `meta.version` | Signature mismatch |
132
+ | `meta.created` | Signature mismatch |
133
+ | `meta.hash` | Hash mismatch **+** Signature mismatch |
134
+ | `meta.algorithm` | Signature mismatch |
135
+ | `meta.signature` | Signature mismatch |
136
+
137
+ ---
138
+
139
+ ## Canonical JSON Serialization
140
+
141
+ To ensure deterministic hash computation, all JSON objects are serialized using **canonical JSON** before hashing:
142
+
143
+ 1. Object keys are sorted alphabetically
144
+ 2. No whitespace between tokens
145
+ 3. Strings use standard JSON escaping (`\"`, `\\`, `\n`, etc.)
146
+ 4. Numbers are serialized without unnecessary precision
147
+
148
+ **Example:**
149
+
150
+ ```json
151
+ {"b":2,"a":1}
152
+ ```
153
+ Canonical form:
154
+ ```
155
+ {"a":1,"b":2}
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Size Limits
161
+
162
+ | Limit | Value | Description |
163
+ |-------|-------|-------------|
164
+ | Max image size | 2 MB | Per embedded image (before Base64 encoding) |
165
+ | Max total size | 10 MB | Entire WIP file as JSON string |
166
+ | Max image count | 10 | Number of media items in `payload.media` |
167
+ | Max text length | 10,000 chars | Length of `payload.content.text` |
168
+
169
+ ---
170
+
171
+ ## Examples
172
+
173
+ ### Minimal WIP (No Signature, No Media)
174
+
175
+ ```json
176
+ {
177
+ "wip": "https://github.com/wowok-ai/docs/blob/main/WIP.md",
178
+ "payload": {
179
+ "content": {
180
+ "text": "I commit to delivering the project by December 31, 2024.",
181
+ "format": "plain"
182
+ },
183
+ "media": []
184
+ },
185
+ "meta": {
186
+ "type": "wip",
187
+ "version": "1.0.0",
188
+ "created": "2024-03-15T08:30:00Z",
189
+ "hash": "3a6eb0790f39ac87c94f3856b2dd2c5d110e6811602261a9a923d3bb23adc8b7",
190
+ "algorithm": "sha256"
191
+ }
192
+ }
193
+ ```
194
+
195
+ ### Full WIP (Markdown + Image + Signature)
196
+
197
+ ```json
198
+ {
199
+ "wip": "https://github.com/wowok-ai/docs/blob/main/WIP.md",
200
+ "payload": {
201
+ "content": {
202
+ "text": "# Service Agreement\n\n## Scope\nComplete website development including:\n- Frontend (React)\n- Backend (Node.js)\n- Database design\n\n## Timeline\nDelivery by **2024-12-31**.",
203
+ "format": "markdown"
204
+ },
205
+ "media": [
206
+ {
207
+ "id": "img-001",
208
+ "type": "image/png",
209
+ "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==",
210
+ "filename": "contract-signature.png"
211
+ }
212
+ ]
213
+ },
214
+ "meta": {
215
+ "type": "wip",
216
+ "version": "1.0.0",
217
+ "created": "2024-03-15T08:30:00Z",
218
+ "hash": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2",
219
+ "algorithm": "sha256",
220
+ "signature": {
221
+ "value": "base64EncodedSignatureValueHere...",
222
+ "publicKey": "Bwl0UgpjuBhHXtrC09LAW30exFURxRBB...",
223
+ "algorithm": "Falcon512",
224
+ "address": "0x3a15ed459db7b7bcd9e1c7cd49c8a58aed5e1fd169cc2a99ead2201fa3ee54a4"
225
+ }
226
+ }
227
+ }
228
+ ```
229
+
230
+ ### Multi-Signature WIP
231
+
232
+ ```json
233
+ {
234
+ "wip": "https://github.com/wowok-ai/docs/blob/main/WIP.md",
235
+ "payload": {
236
+ "content": {
237
+ "text": "We jointly commit to the terms outlined in this agreement.",
238
+ "format": "plain"
239
+ },
240
+ "media": []
241
+ },
242
+ "meta": {
243
+ "type": "wip",
244
+ "version": "1.0.0",
245
+ "created": "2024-03-15T08:30:00Z",
246
+ "hash": "d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4",
247
+ "algorithm": "sha256",
248
+ "signature": [
249
+ {
250
+ "value": "signatureFromPartyA...",
251
+ "publicKey": "publicKeyOfPartyA...",
252
+ "algorithm": "Falcon512",
253
+ "address": "0xaaaa..."
254
+ },
255
+ {
256
+ "value": "signatureFromPartyB...",
257
+ "publicKey": "publicKeyOfPartyB...",
258
+ "algorithm": "Falcon512",
259
+ "address": "0xbbbb..."
260
+ }
261
+ ]
262
+ }
263
+ }
264
+ ```
265
+
266
+ ---
267
+
268
+ ## API Reference
269
+
270
+ ### `generate_wip(options, outputPath)`
271
+
272
+ Creates a WIP file and saves it to disk. Optionally signs it with a local account.
273
+
274
+ **Parameters:**
275
+
276
+ | Parameter | Type | Required | Description |
277
+ |-----------|------|----------|-------------|
278
+ | `options.markdown_text` | `string` | **Yes** | Commitment text in Markdown format |
279
+ | `options.images` | `ImageSource[]` | No | Array of image sources |
280
+ | `options.account` | `string` | No | Account name/address for signing. If omitted, no signature is added |
281
+ | `outputPath` | `string` | **Yes** | File path to save the WIP file |
282
+
283
+ **Returns:** `Promise<string>` — Path to the generated WIP file.
284
+
285
+ **ImageSource:**
286
+
287
+ | Field | Type | Required | Description |
288
+ |-------|------|----------|-------------|
289
+ | `source` | `string` | **Yes** | File path, HTTPS URL, or data URL |
290
+ | `id` | `string` | No | Custom media ID |
291
+ | `filename` | `string` | No | Custom filename |
292
+
293
+ ---
294
+
295
+ ### `verify_wip(wipFilePath, hash_equal?, requireSignature?)`
296
+
297
+ Verifies a WIP file's integrity and signatures.
298
+
299
+ **Parameters:**
300
+
301
+ | Parameter | Type | Required | Description |
302
+ |-----------|------|----------|-------------|
303
+ | `wipFilePath` | `string` | **Yes** | Path to the WIP file (local path or HTTPS URL) |
304
+ | `hash_equal` | `string` | No | Expected hash value for additional verification |
305
+ | `requireSignature` | `boolean` | No | If `true`, the file must have at least one valid signature |
306
+
307
+ **Returns:** `Promise<WipVerificationResult>`
308
+
309
+ **WipVerificationResult:**
310
+
311
+ | Field | Type | Description |
312
+ |-------|------|-------------|
313
+ | `valid` | `boolean` | Overall verification result |
314
+ | `error` | `string` | Error message if verification failed |
315
+ | `hashValid` | `boolean` | Whether the content hash matches |
316
+ | `signatureValid` | `boolean` | Whether all signatures are valid (undefined if no signature) |
317
+ | `hasSignature` | `boolean` | Whether the file contains any signature |
318
+ | `signatures` | `WipSignatureVerification[]` | Per-signature verification details |
319
+
320
+ ---
321
+
322
+ ### `sign_wip(wipFilePath, account, outputPath?)`
323
+
324
+ Adds a digital signature to an existing WIP file. Supports multi-signature — if the file already has signatures, the new one is appended (or replaces an existing signature from the same public key).
325
+
326
+ **Parameters:**
327
+
328
+ | Parameter | Type | Required | Description |
329
+ |-----------|------|----------|-------------|
330
+ | `wipFilePath` | `string` | **Yes** | Path to the WIP file |
331
+ | `account` | `string` | **Yes** | Account name or address for signing |
332
+ | `outputPath` | `string` | No | Output path (defaults to overwriting the input file) |
333
+
334
+ **Returns:** `Promise<string>` — Path to the signed WIP file.
335
+
336
+ ---
337
+
338
+ ### `wip2html(wipPath, options?)`
339
+
340
+ Converts a WIP file (or directory of WIP files) to human-readable HTML.
341
+
342
+ **Parameters:**
343
+
344
+ | Parameter | Type | Required | Description |
345
+ |-----------|------|----------|-------------|
346
+ | `wipPath` | `string` | **Yes** | Path to a `.wip` file or directory containing `.wip` files |
347
+ | `options.title` | `string` | No | Custom HTML page title |
348
+ | `options.theme` | `enum` | No | `"light"` or `"dark"` |
349
+ | `options.outputPath` | `string` | No | Output file path (for single file) or directory (for batch) |
350
+
351
+ **Returns:** `Promise<string | string[]>` — Output file path(s).
352
+
353
+ ---
354
+
355
+ ## Use Cases
356
+
357
+ | Scenario | How WIP Is Used |
358
+ |----------|-----------------|
359
+ | **Service Listings** | Merchants attach WIP files to Service products as immutable product descriptions. Buyers verify the WIP hash at purchase time. |
360
+ | **Contractual Commitments** | Parties create and sign WIP files documenting agreed terms. Each party's signature provides non-repudiation. |
361
+ | **AI Agent Promises** | AI agents generate WIP files to record commitments made during automated negotiations or workflows. |
362
+ | **Legal Evidence** | Signed WIP files serve as tamper-proof records of promises, usable in arbitration or dispute resolution. |
363
+ | **Cross-System Communication** | Systems exchange WIP files as self-verifiable data packets without needing a trusted intermediary. |
364
+
365
+ ---
366
+
367
+ ## Relationship with Other Components
368
+
369
+ | Component | Relationship |
370
+ |-----------|-------------|
371
+ | **Service** | WIP files are attached to Service products via the `wip` field. The `wip_hash` is extracted and stored on-chain. |
372
+ | **Order** | Buyers must provide the matching `wip_hash` when purchasing a WIP-backed product. |
373
+ | **Messenger** | WIP files can be sent as file attachments through the encrypted Messenger. |
374
+ | **Arbitration** | WIP files serve as evidence in dispute resolution, providing immutable records of original commitments. |
375
+ | **Account** | Signatures are created using local Account keys (Falcon-512 keypairs). |
376
+
377
+ ---
378
+
379
+ ## File Extension & MIME Type
380
+
381
+ | Property | Value |
382
+ |----------|-------|
383
+ | File extension | `.wip` |
384
+ | MIME type | `application/json` |
385
+ | Encoding | UTF-8 |
386
+
387
+ ---
388
+