@wowok/agent-mcp 2.2.13 → 2.2.14

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/dist/index.js +42 -98
  2. package/dist/schema-query/index.d.ts +29 -0
  3. package/dist/schema-query/index.js +149 -0
  4. package/dist/schemas/account_operation.schema.json +255 -0
  5. package/dist/schemas/guard2file.schema.json +71 -0
  6. package/dist/schemas/index.json +139 -0
  7. package/dist/schemas/local_info_operation.schema.json +142 -0
  8. package/dist/schemas/local_mark_operation.schema.json +119 -0
  9. package/dist/schemas/machineNode2file.schema.json +71 -0
  10. package/dist/schemas/messenger_operation.schema.json +1393 -0
  11. package/dist/schemas/onchain_events.schema.json +113 -0
  12. package/dist/schemas/onchain_operations.schema.json +376 -0
  13. package/dist/schemas/onchain_operations_allocation.schema.json +914 -0
  14. package/dist/schemas/onchain_operations_arbitration.schema.json +1166 -0
  15. package/dist/schemas/onchain_operations_contact.schema.json +853 -0
  16. package/dist/schemas/onchain_operations_demand.schema.json +984 -0
  17. package/dist/schemas/onchain_operations_gen_passport.schema.json +1141 -0
  18. package/dist/schemas/onchain_operations_guard.schema.json +713 -0
  19. package/dist/schemas/onchain_operations_machine.schema.json +1347 -0
  20. package/dist/schemas/onchain_operations_order.schema.json +830 -0
  21. package/dist/schemas/onchain_operations_payment.schema.json +717 -0
  22. package/dist/schemas/onchain_operations_permission.schema.json +1088 -0
  23. package/dist/schemas/onchain_operations_personal.schema.json +1282 -0
  24. package/dist/schemas/onchain_operations_progress.schema.json +751 -0
  25. package/dist/schemas/onchain_operations_repository.schema.json +1572 -0
  26. package/dist/schemas/onchain_operations_reward.schema.json +955 -0
  27. package/dist/schemas/onchain_operations_service.schema.json +1411 -0
  28. package/dist/schemas/onchain_operations_treasury.schema.json +1155 -0
  29. package/dist/schemas/onchain_table_data.schema.json +35 -0
  30. package/dist/schemas/operations/guard.json +163 -0
  31. package/dist/schemas/operations/permission.json +22 -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
package/docs/README.md DELETED
@@ -1,249 +0,0 @@
1
- # WoWok: Next-Generation Trust Network Fusing AI and Blockchain
2
-
3
- ---
4
-
5
- ### 💡 Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.
6
-
7
- ---
8
-
9
- ## 🌟 Welcome to WoWok
10
-
11
- In this Skill Book, we will take you step by step to explore the complete WoWok ecosystem. Starting from the most basic account management, gradually diving into complex commercial transactions, allowing you to fully master the powerful features of WoWok.
12
-
13
- ### 📖 What is WoWok?
14
-
15
- WoWok is not a centralized network, but a distributed trust network built on cryptography. It ensures that collaborative data, commitments, and trust are used and verified securely and reliably in a distributed network, while ensuring privacy and messages are not passively exposed to third parties.
16
-
17
- ### 🚀 WoWok Builds Brand-New Network Infrastructure
18
-
19
- | Component | Description | Key Features |
20
- |-----------|-------------|--------------|
21
- | **⛓️ Quantum-Safe Blockchain** | Blockchain L1 & L2(soon) | Immutable data, transparent execution, secure trust |
22
- | **🔒 Messenger** | Commercial end-to-end encrypted IM | WTS self-proving messages, privacy-first |
23
- | **🤖 Wowok-Agent** | User-AI-Blockchain interface | MCP integration, prompt-driven workflows |
24
-
25
- ### 🌐 A Trust Network for Everyone
26
-
27
- WoWok balances privacy and open collaboration through innovative mechanisms:
28
-
29
- | Feature | Benefit |
30
- |---------|---------|
31
- | **Transparent and Trusted Infrastructure** | Based on WoWok public chain, collaborative data, conditions, and methods are publicly transparent and immutable |
32
- | **User Data Sovereignty** | Data ownership and usage rights belong to users, who have complete control over their data |
33
- | **Customizable Trust Rules** | Create custom trust verification rules using Guards based on on-chain data |
34
- | **WTS Self-Proving Messages** | Witness Timestamped Signature ensures message authenticity, integrity, and self-provability |
35
- | **WIP Immutable Commitments** | Witness Immutable Promise ensures commitments are visible and immutable to all participants |
36
- | **Arbitration Dispute Protection** | Complete evidence chain for broken commitments, with on-chain data and provable messages |
37
- | **Quantum-Safe Network** | On-chain wallets (Falcon), smart contracts, and Messenger(Kyber) secured by post-quantum cryptography, ensuring network-wide quantum resistance |
38
-
39
- ### 🤖 AI-Native Transaction Mechanism
40
-
41
- | Feature | How It Works |
42
- |---------|--------------|
43
- | **Deterministic Execution** | Smart contracts ensure commitments, workflows, and compensation are visible and executable |
44
- | **Disintermediation** | No third-party review, recommendation, or fees - just on-chain open data and events |
45
- | **AI Empowerment** | Every AI Agent can independently express demands, evaluate trust, collaborate, and transact |
46
- ---
47
-
48
- ### How to Use? Just One Step!
49
- Configure "@wowok/agent-mcp" in your AI client (such as Claude Desktop, Cursor, etc.) (You can ask the AI how to configure MCP Server):
50
-
51
- ```json
52
- {
53
- "mcpServers": {
54
- "wowok": {
55
- "command": "npx",
56
- "args": [
57
- "-y",
58
- "@wowok/agent-mcp"
59
- ]
60
- }
61
- }
62
- }
63
- ```
64
- After restarting the AI client, you can try a conversation like this to verify:
65
-
66
- **💬 You**: Please provide all tools and detailed usage of @wowok/agent-mcp.
67
-
68
- **🤖 AI**: *(If a detailed list of tools is returned, it means it has been configured and enabled successfully!)*
69
-
70
- ---
71
-
72
- > 🚀 **Enhanced AI Experience**: For an even better AI experience, install both:
73
- > - **WoWok Agent (MCP Server)**: [`https://github.com/wowok-ai/agent/`](https://github.com/wowok-ai/agent/)
74
- > - **WoWok Skills**: [`https://github.com/wowok-ai/skills/`](https://github.com/wowok-ai/skills/) - `npm install -g @wowok/skills`
75
- >
76
- > Skills help AI assistants use WoWok tools correctly, solving common challenges: complex system building, tool usage failures, and safety protocols.
77
-
78
- ### 📦 Using Skills in Your Project
79
-
80
- After installing `@wowok/skills` globally, you can use the following commands in your project:
81
-
82
- ```bash
83
- # List all available skills
84
- wowok-skills list
85
-
86
- # Show details of a specific skill
87
- wowok-skills get wowok-build
88
-
89
- # Install skills to current project (creates .claude/skills/)
90
- wowok-skills init
91
-
92
- # Remove skills from current project
93
- wowok-skills uninit
94
- ```
95
-
96
- **Quick Start in Project:**
97
- ```bash
98
- # Navigate to your project directory
99
- cd your-project
100
-
101
- # Install skills for this project
102
- wowok-skills init
103
-
104
- # Now Claude Code will automatically use these skills when working with WoWok
105
- ```
106
-
107
- ---
108
-
109
- > 💡 We believe AI and WoWok together can accomplish everything. If you have more good ideas for services more suited to human usage habits, you can build your website and APP based on WoWok's open infrastructure without our authorization.
110
-
111
- ## 📚 Learning Path
112
-
113
- We have designed 8 learning stages and a large number of Prompt examples for you, with each stage building on the previous one:
114
-
115
- ```
116
- ┌─────────────────────────────────────────────────────────────────┐
117
- │ Stage 1: Getting Started ⭐ │
118
- │ ├─ Account - Local Wallet Management │
119
- │ └─ LocalMark - User/Object Naming and Categorization │
120
- ├─────────────────────────────────────────────────────────────────┤
121
- │ Stage 2: Trust Management 🔐 │
122
- │ ├─ Permission - Who Can Do What │
123
- │ └─ Guard - Programmable Trust Rules │
124
- ├─────────────────────────────────────────────────────────────────┤
125
- │ Stage 3: Open Collaboration 🤝 │
126
- │ ├─ Machine + Progress - Automated Workflows │
127
- │ ├─ Messenger - Private Communication │
128
- │ └─ Contact - Public Contact Information │
129
- ├─────────────────────────────────────────────────────────────────┤
130
- │ Stage 4: Transaction Execution 💼 │
131
- │ ├─ Allocation - Automatic Fund Distribution │
132
- │ ├─ Service + Order - WYSIWYG Product Trading │
133
- │ └─ Arbitration - Dispute Resolution │
134
- ├─────────────────────────────────────────────────────────────────┤
135
- │ Stage 5: Business Components 🏪 │
136
- │ ├─ Repository - Data Management │
137
- │ ├─ Treasury - Team Fund Management │
138
- │ └─ Reward - Marketing Incentives │
139
- ├─────────────────────────────────────────────────────────────────┤
140
- │ Stage 6: Personal Services 👤 │
141
- │ ├─ LocalInfo - Private Information Management │
142
- │ ├─ Demand - Seeking Assistance │
143
- │ └─ Personal - Personal On-Chain Portal │
144
- ├─────────────────────────────────────────────────────────────────┤
145
- │ Stage 7: Data Query 🔍 │
146
- │ ├─ query_toolkit — Query on-chain objects, balances, profiles │
147
- │ ├─ onchain_table_data — Query dynamic table data & items │
148
- │ ├─ On-chain Events - Watch real-time on-chain events │
149
- │ └─ WoWok Build-in Info - Query protocol constants & info │
150
- ├─────────────────────────────────────────────────────────────────┤
151
- │ Stage 8: Practical Examples 🚀 │
152
- │ ├─ MyShop - Basic E-Commerce Example │
153
- │ ├─ ThreeBody_Signature - Signed Book Service Example │
154
- │ ├─ MyShop_Advanced - Advanced E-Commerce Example │
155
- │ ├─ Insurance - Time-Lock Insurance Claim Processing │
156
- │ └─ Travel - Weather-Dependent Travel with Sub-Orders │
157
- └─────────────────────────────────────────────────────────────────┘
158
- ```
159
-
160
- ---
161
-
162
- ## 🚀 Start Your Journey
163
-
164
- Choose a stage to begin your WoWok journey:
165
-
166
- ### [📖 Stage 1: Getting Started →](docs/stage-01-introduction.md)
167
- **For Beginners** - Set up your local wallet (Account) and learn to name blockchain addresses with LocalMark.
168
-
169
- ### [🔐 Stage 2: Trust Management →](docs/stage-02-trust.md)
170
- **Understanding Permissions** - Learn how to manage permissions and establish trust rules.
171
-
172
- ### [🤝 Stage 3: Open Collaboration →](docs/stage-03-collaboration.md)
173
- **Start Collaborating** - Master workflows, communication, and contact information management.
174
-
175
- ### [💼 Stage 4: Transaction Execution →](docs/stage-04-transaction.md)
176
- **Conduct Transactions** - Learn how to use Service, Order, and Arbitration for commercial transactions with WIP-backed product descriptions.
177
-
178
- ### [🏪 Stage 5: Business Components →](docs/stage-05-business.md)
179
- **Business Operations** - Use Repository for structured data, Treasury for team funds, and Reward for marketing incentives.
180
-
181
- ### [👤 Stage 6: Personal Services →](docs/stage-06-personal.md)
182
- **Personal Services** - Manage private info locally with LocalInfo, post bounty requests with Demand, and build your on-chain identity with Personal.
183
-
184
- ### [🔍 Stage 7: Data Query →](docs/stage-07-query.md)
185
- **Explore Data** - Query objects, events, and protocol info; access documentation and learning resources.
186
-
187
- ### [🚀 Stage 8: Practical Examples →](examples/)
188
- **Real-World Applications** - Explore complete business examples demonstrating various WoWok protocol features:
189
-
190
- | Example | Core Feature | Description |
191
- |---------|--------------|-------------|
192
- | [MyShop](examples/MyShop/) | Basic E-Commerce | Simple online store with product listings and orders |
193
- | [ThreeBody_Signature](examples/ThreeBody_Signature/) | Signed Book Service | Limited edition signed book sales with WIP verification |
194
- | [MyShop_Advanced](examples/MyShop_Advanced/) | Advanced E-Commerce | Full merchant system with arbitration and rewards |
195
- | [Insurance](examples/Insurance/) | Time-Lock Guards | Insurance claims with time-lock verification using convert_witness |
196
- | [Travel](examples/Travel/) | Multi-Node Workflow | Iceland travel service with weather-dependent activities and sub-orders |
197
-
198
- ---
199
-
200
- ## 📋 Quick Reference
201
-
202
- | Component | Type | Stage | Description |
203
- |-----------|------|-------|-------------|
204
- | [Account](docs/account.md) | Local | 1 | Local wallet management |
205
- | [LocalMark](docs/localmark.md) | Local | 1 | User/Object naming and categorization |
206
- | [LocalInfo](docs/localinfo.md) | Local | 6 | Private information management |
207
- | [Permission](docs/permission.md) | On-Chain | 2 | Permission management |
208
- | [Guard](docs/guard.md) | On-Chain | 2 | Trust verification engine |
209
- | [Machine](docs/machine.md) | On-Chain | 3 | Workflow template |
210
- | [Progress](docs/progress.md) | On-Chain | 3 | Order progress |
211
- | [Messenger](docs/messenger.md) | Local+On-Chain | 3 | Secure end-to-end encrypted chat |
212
- | [Contact](docs/contact.md) | On-Chain | 3 | Public contact information |
213
- | [Allocation](docs/allocation.md) | On-Chain | 4 | Automatic fund distribution |
214
- | [Service](docs/service.md) | On-Chain | 4 | WYSIWYG product trading |
215
- | [Order](docs/order.md) | On-Chain | 4 | Order management |
216
- | [Arbitration](docs/arbitration.md) | On-Chain | 4 | Dispute resolution |
217
- | [Repository](docs/repository.md) | On-Chain | 5 | Data ownership and usage rights |
218
- | [Treasury](docs/treasury.md) | On-Chain | 5 | Team fund management |
219
- | [Reward](docs/reward.md) | On-Chain | 5 | Marketing incentives |
220
- | [Demand](docs/demand.md) | On-Chain | 6 | Seeking assistance |
221
- | [Personal](docs/personal.md) | On-Chain | 6 | Personal on-chain portal |
222
- | [Query](docs/query.md) | Query | 7 | Data query (query_toolkit + onchain_table_data) |
223
- | [On-chain Events](docs/onchain_events.md) | Query | 7 | Watch and query on-chain events |
224
- | [WoWok Build-in Info](docs/wowok_buildin_info.md) | Query | 7 | Query protocol constants and info |
225
- | [MyShop Example](examples/MyShop/) | Example | 8 | Basic e-commerce store with product listings |
226
- | [ThreeBody_Signature Example](examples/ThreeBody_Signature/) | Example | 8 | Signed book service with WIP verification |
227
- | [MyShop_Advanced Example](examples/MyShop_Advanced/) | Example | 8 | Advanced merchant system with arbitration |
228
- | [Insurance Example](examples/Insurance/) | Example | 8 | Time-lock insurance claims with convert_witness |
229
- | [Travel Example](examples/Travel/) | Example | 8 | Multi-node workflow with weather checks and sub-orders |
230
-
231
- ---
232
-
233
- ## ⚠️ Important Notes
234
-
235
- - **Local vs On-Chain** - Distinguish between local operations and on-chain operations
236
- - **Test Network** - It is recommended to practice on the test network first
237
- - **Public Transparency** - On-chain data is permanently public, please be cautious when publishing sensitive information
238
-
239
- ---
240
-
241
- ## 🌟 Ready to Get Started?
242
-
243
- Click the link below to begin your Stage 1 learning:
244
-
245
- **[📖 Go to Stage 1: Getting Started →](docs/stage-01-introduction.md)**
246
-
247
- ---
248
-
249
- *WoWok - Making It Easy for AI Agents to Communicate, Collaborate, Trade and Trust.* 💎
package/docs/WIP.md DELETED
@@ -1,388 +0,0 @@
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
-