clawpowers 1.1.4 → 2.2.0

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 (131) hide show
  1. package/CHANGELOG.md +126 -0
  2. package/COMPATIBILITY.md +13 -0
  3. package/KNOWN_LIMITATIONS.md +19 -0
  4. package/LICENSE +44 -0
  5. package/LICENSING.md +10 -0
  6. package/README.md +378 -210
  7. package/SECURITY.md +52 -0
  8. package/dist/index.d.ts +1477 -0
  9. package/dist/index.js +3464 -0
  10. package/dist/index.js.map +1 -0
  11. package/native/Cargo.lock +4863 -0
  12. package/native/Cargo.toml +73 -0
  13. package/native/crates/canonical/Cargo.toml +24 -0
  14. package/native/crates/canonical/src/lib.rs +673 -0
  15. package/native/crates/compression/Cargo.toml +20 -0
  16. package/native/crates/compression/benches/compression_bench.rs +42 -0
  17. package/native/crates/compression/src/lib.rs +393 -0
  18. package/native/crates/evm-eth/Cargo.toml +13 -0
  19. package/native/crates/evm-eth/src/lib.rs +105 -0
  20. package/native/crates/fee/Cargo.toml +15 -0
  21. package/native/crates/fee/src/lib.rs +281 -0
  22. package/native/crates/index/Cargo.toml +16 -0
  23. package/native/crates/index/src/lib.rs +277 -0
  24. package/native/crates/policy/Cargo.toml +17 -0
  25. package/native/crates/policy/src/lib.rs +614 -0
  26. package/native/crates/security/Cargo.toml +22 -0
  27. package/native/crates/security/src/lib.rs +478 -0
  28. package/native/crates/tokens/Cargo.toml +13 -0
  29. package/native/crates/tokens/src/lib.rs +534 -0
  30. package/native/crates/verification/Cargo.toml +23 -0
  31. package/native/crates/verification/src/lib.rs +333 -0
  32. package/native/crates/wallet/Cargo.toml +20 -0
  33. package/native/crates/wallet/src/lib.rs +261 -0
  34. package/native/crates/x402/Cargo.toml +30 -0
  35. package/native/crates/x402/src/lib.rs +423 -0
  36. package/native/ffi/Cargo.toml +34 -0
  37. package/native/ffi/build.rs +4 -0
  38. package/native/ffi/index.node +0 -0
  39. package/native/ffi/src/lib.rs +352 -0
  40. package/native/ffi/tests/integration.rs +354 -0
  41. package/native/pyo3/Cargo.toml +26 -0
  42. package/native/pyo3/pyproject.toml +16 -0
  43. package/native/pyo3/src/lib.rs +407 -0
  44. package/native/pyo3/tests/test_smoke.py +180 -0
  45. package/native/wasm/Cargo.toml +44 -0
  46. package/native/wasm/pkg/.gitignore +6 -0
  47. package/native/wasm/pkg/clawpowers_wasm.d.ts +208 -0
  48. package/native/wasm/pkg/clawpowers_wasm.js +872 -0
  49. package/native/wasm/pkg/clawpowers_wasm_bg.wasm +0 -0
  50. package/native/wasm/pkg/clawpowers_wasm_bg.wasm.d.ts +40 -0
  51. package/native/wasm/pkg/package.json +17 -0
  52. package/native/wasm/pkg-node/.gitignore +6 -0
  53. package/native/wasm/pkg-node/clawpowers_wasm.d.ts +143 -0
  54. package/native/wasm/pkg-node/clawpowers_wasm.js +798 -0
  55. package/native/wasm/pkg-node/clawpowers_wasm_bg.wasm +0 -0
  56. package/native/wasm/pkg-node/clawpowers_wasm_bg.wasm.d.ts +40 -0
  57. package/native/wasm/pkg-node/package.json +13 -0
  58. package/native/wasm/src/lib.rs +433 -0
  59. package/package.json +71 -44
  60. package/src/skills/catalog.ts +435 -0
  61. package/src/skills/executor.ts +56 -0
  62. package/src/skills/index.ts +3 -0
  63. package/src/skills/itp/SKILL.md +112 -0
  64. package/src/skills/loader.ts +193 -0
  65. package/.claude-plugin/manifest.json +0 -19
  66. package/.codex/INSTALL.md +0 -36
  67. package/.cursor-plugin/manifest.json +0 -21
  68. package/.opencode/INSTALL.md +0 -52
  69. package/ARCHITECTURE.md +0 -69
  70. package/bin/clawpowers.js +0 -625
  71. package/bin/clawpowers.sh +0 -91
  72. package/docs/demo/clawpowers-demo.cast +0 -197
  73. package/docs/demo/clawpowers-demo.gif +0 -0
  74. package/docs/launch-images/25-skills-breakdown.jpg +0 -0
  75. package/docs/launch-images/clawpowers-vs-superpowers.jpg +0 -0
  76. package/docs/launch-images/economic-code-optimization.jpg +0 -0
  77. package/docs/launch-images/native-vs-bridge-2.jpg +0 -0
  78. package/docs/launch-images/native-vs-bridge.jpg +0 -0
  79. package/docs/launch-images/post1-hero-lobster.jpg +0 -0
  80. package/docs/launch-images/post2-dashboard.jpg +0 -0
  81. package/docs/launch-images/post3-superpowers.jpg +0 -0
  82. package/docs/launch-images/post4-before-after.jpg +0 -0
  83. package/docs/launch-images/post5-install-now.jpg +0 -0
  84. package/docs/launch-images/ultimate-stack.jpg +0 -0
  85. package/docs/launch-posts.md +0 -76
  86. package/docs/quickstart-first-transaction.md +0 -204
  87. package/gemini-extension.json +0 -32
  88. package/hooks/session-start +0 -205
  89. package/hooks/session-start.cmd +0 -43
  90. package/hooks/session-start.js +0 -163
  91. package/runtime/demo/README.md +0 -78
  92. package/runtime/demo/x402-mock-server.js +0 -230
  93. package/runtime/feedback/analyze.js +0 -621
  94. package/runtime/feedback/analyze.sh +0 -546
  95. package/runtime/init.js +0 -210
  96. package/runtime/init.sh +0 -178
  97. package/runtime/metrics/collector.js +0 -361
  98. package/runtime/metrics/collector.sh +0 -308
  99. package/runtime/payments/ledger.js +0 -305
  100. package/runtime/payments/ledger.sh +0 -262
  101. package/runtime/payments/pipeline.js +0 -455
  102. package/runtime/persistence/store.js +0 -433
  103. package/runtime/persistence/store.sh +0 -303
  104. package/skill.json +0 -106
  105. package/skills/agent-bounties/SKILL.md +0 -553
  106. package/skills/agent-payments/SKILL.md +0 -479
  107. package/skills/brainstorming/SKILL.md +0 -233
  108. package/skills/content-pipeline/SKILL.md +0 -282
  109. package/skills/cross-project-knowledge/SKILL.md +0 -345
  110. package/skills/dispatching-parallel-agents/SKILL.md +0 -305
  111. package/skills/economic-code-optimization/SKILL.md +0 -265
  112. package/skills/executing-plans/SKILL.md +0 -255
  113. package/skills/finishing-a-development-branch/SKILL.md +0 -260
  114. package/skills/formal-verification-lite/SKILL.md +0 -441
  115. package/skills/learn-how-to-learn/SKILL.md +0 -235
  116. package/skills/market-intelligence/SKILL.md +0 -323
  117. package/skills/meta-skill-evolution/SKILL.md +0 -325
  118. package/skills/prospecting/SKILL.md +0 -454
  119. package/skills/receiving-code-review/SKILL.md +0 -225
  120. package/skills/requesting-code-review/SKILL.md +0 -206
  121. package/skills/security-audit/SKILL.md +0 -353
  122. package/skills/self-healing-code/SKILL.md +0 -369
  123. package/skills/subagent-driven-development/SKILL.md +0 -244
  124. package/skills/systematic-debugging/SKILL.md +0 -355
  125. package/skills/test-driven-development/SKILL.md +0 -416
  126. package/skills/using-clawpowers/SKILL.md +0 -160
  127. package/skills/using-git-worktrees/SKILL.md +0 -261
  128. package/skills/validator/SKILL.md +0 -281
  129. package/skills/verification-before-completion/SKILL.md +0 -254
  130. package/skills/writing-plans/SKILL.md +0 -276
  131. package/skills/writing-skills/SKILL.md +0 -260
@@ -0,0 +1,798 @@
1
+ /* @ts-self-types="./clawpowers_wasm.d.ts" */
2
+
3
+ /**
4
+ * Opaque handle to an in-memory CanonicalStore.
5
+ */
6
+ class WasmCanonicalStore {
7
+ __destroy_into_raw() {
8
+ const ptr = this.__wbg_ptr;
9
+ this.__wbg_ptr = 0;
10
+ WasmCanonicalStoreFinalization.unregister(this);
11
+ return ptr;
12
+ }
13
+ free() {
14
+ const ptr = this.__destroy_into_raw();
15
+ wasm.__wbg_wasmcanonicalstore_free(ptr, 0);
16
+ }
17
+ /**
18
+ * Export all records as JSON for IndexedDB persistence.
19
+ * @returns {string}
20
+ */
21
+ exportJson() {
22
+ let deferred2_0;
23
+ let deferred2_1;
24
+ try {
25
+ const ret = wasm.wasmcanonicalstore_exportJson(this.__wbg_ptr);
26
+ var ptr1 = ret[0];
27
+ var len1 = ret[1];
28
+ if (ret[3]) {
29
+ ptr1 = 0; len1 = 0;
30
+ throw takeFromExternrefTable0(ret[2]);
31
+ }
32
+ deferred2_0 = ptr1;
33
+ deferred2_1 = len1;
34
+ return getStringFromWasm0(ptr1, len1);
35
+ } finally {
36
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
37
+ }
38
+ }
39
+ /**
40
+ * Get a record by UUID. Returns JSON or null.
41
+ * @param {string} id
42
+ * @returns {string | undefined}
43
+ */
44
+ get(id) {
45
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
46
+ const len0 = WASM_VECTOR_LEN;
47
+ const ret = wasm.wasmcanonicalstore_get(this.__wbg_ptr, ptr0, len0);
48
+ if (ret[3]) {
49
+ throw takeFromExternrefTable0(ret[2]);
50
+ }
51
+ let v2;
52
+ if (ret[0] !== 0) {
53
+ v2 = getStringFromWasm0(ret[0], ret[1]).slice();
54
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
55
+ }
56
+ return v2;
57
+ }
58
+ /**
59
+ * Get a record by content hash. Returns JSON or null.
60
+ * @param {string} hash
61
+ * @returns {string | undefined}
62
+ */
63
+ getByHash(hash) {
64
+ const ptr0 = passStringToWasm0(hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
65
+ const len0 = WASM_VECTOR_LEN;
66
+ const ret = wasm.wasmcanonicalstore_getByHash(this.__wbg_ptr, ptr0, len0);
67
+ if (ret[3]) {
68
+ throw takeFromExternrefTable0(ret[2]);
69
+ }
70
+ let v2;
71
+ if (ret[0] !== 0) {
72
+ v2 = getStringFromWasm0(ret[0], ret[1]).slice();
73
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
74
+ }
75
+ return v2;
76
+ }
77
+ /**
78
+ * Import records from JSON (e.g., loaded from IndexedDB).
79
+ * @param {string} json
80
+ * @returns {number}
81
+ */
82
+ importJson(json) {
83
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
84
+ const len0 = WASM_VECTOR_LEN;
85
+ const ret = wasm.wasmcanonicalstore_importJson(this.__wbg_ptr, ptr0, len0);
86
+ if (ret[2]) {
87
+ throw takeFromExternrefTable0(ret[1]);
88
+ }
89
+ return ret[0] >>> 0;
90
+ }
91
+ /**
92
+ * Insert a record. Input: JSON with {namespace, content, metadata, provenance}.
93
+ * Returns the record UUID as a string.
94
+ * @param {string} json
95
+ * @returns {string}
96
+ */
97
+ insert(json) {
98
+ let deferred3_0;
99
+ let deferred3_1;
100
+ try {
101
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
102
+ const len0 = WASM_VECTOR_LEN;
103
+ const ret = wasm.wasmcanonicalstore_insert(this.__wbg_ptr, ptr0, len0);
104
+ var ptr2 = ret[0];
105
+ var len2 = ret[1];
106
+ if (ret[3]) {
107
+ ptr2 = 0; len2 = 0;
108
+ throw takeFromExternrefTable0(ret[2]);
109
+ }
110
+ deferred3_0 = ptr2;
111
+ deferred3_1 = len2;
112
+ return getStringFromWasm0(ptr2, len2);
113
+ } finally {
114
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
115
+ }
116
+ }
117
+ /**
118
+ * Create a new in-memory canonical store.
119
+ */
120
+ constructor() {
121
+ const ret = wasm.wasmcanonicalstore_new();
122
+ if (ret[2]) {
123
+ throw takeFromExternrefTable0(ret[1]);
124
+ }
125
+ this.__wbg_ptr = ret[0] >>> 0;
126
+ WasmCanonicalStoreFinalization.register(this, this.__wbg_ptr, this);
127
+ return this;
128
+ }
129
+ /**
130
+ * Query records by namespace. Returns JSON array.
131
+ * @param {string} namespace
132
+ * @param {number} limit
133
+ * @returns {string}
134
+ */
135
+ queryNamespace(namespace, limit) {
136
+ let deferred3_0;
137
+ let deferred3_1;
138
+ try {
139
+ const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
140
+ const len0 = WASM_VECTOR_LEN;
141
+ const ret = wasm.wasmcanonicalstore_queryNamespace(this.__wbg_ptr, ptr0, len0, limit);
142
+ var ptr2 = ret[0];
143
+ var len2 = ret[1];
144
+ if (ret[3]) {
145
+ ptr2 = 0; len2 = 0;
146
+ throw takeFromExternrefTable0(ret[2]);
147
+ }
148
+ deferred3_0 = ptr2;
149
+ deferred3_1 = len2;
150
+ return getStringFromWasm0(ptr2, len2);
151
+ } finally {
152
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
153
+ }
154
+ }
155
+ /**
156
+ * Soft-delete a record. Returns true if the record existed.
157
+ * @param {string} id
158
+ * @returns {boolean}
159
+ */
160
+ softDelete(id) {
161
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
162
+ const len0 = WASM_VECTOR_LEN;
163
+ const ret = wasm.wasmcanonicalstore_softDelete(this.__wbg_ptr, ptr0, len0);
164
+ if (ret[2]) {
165
+ throw takeFromExternrefTable0(ret[1]);
166
+ }
167
+ return ret[0] !== 0;
168
+ }
169
+ /**
170
+ * Verify record integrity. Returns true if hash matches.
171
+ * @param {string} id
172
+ * @returns {boolean}
173
+ */
174
+ verifyIntegrity(id) {
175
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
176
+ const len0 = WASM_VECTOR_LEN;
177
+ const ret = wasm.wasmcanonicalstore_verifyIntegrity(this.__wbg_ptr, ptr0, len0);
178
+ if (ret[2]) {
179
+ throw takeFromExternrefTable0(ret[1]);
180
+ }
181
+ return ret[0] !== 0;
182
+ }
183
+ }
184
+ if (Symbol.dispose) WasmCanonicalStore.prototype[Symbol.dispose] = WasmCanonicalStore.prototype.free;
185
+ exports.WasmCanonicalStore = WasmCanonicalStore;
186
+
187
+ /**
188
+ * Compute approximate distance between two CompressedVector JSONs.
189
+ * @param {string} a_json
190
+ * @param {string} b_json
191
+ * @param {number} dimensions
192
+ * @returns {number}
193
+ */
194
+ function approximateDistance(a_json, b_json, dimensions) {
195
+ const ptr0 = passStringToWasm0(a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
196
+ const len0 = WASM_VECTOR_LEN;
197
+ const ptr1 = passStringToWasm0(b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
198
+ const len1 = WASM_VECTOR_LEN;
199
+ const ret = wasm.approximateDistance(ptr0, len0, ptr1, len1, dimensions);
200
+ if (ret[2]) {
201
+ throw takeFromExternrefTable0(ret[1]);
202
+ }
203
+ return ret[0];
204
+ }
205
+ exports.approximateDistance = approximateDistance;
206
+
207
+ /**
208
+ * Calculate a transaction fee.
209
+ * Returns JSON: `{"gross_amount": ..., "fee_amount": ..., "net_amount": ...}`
210
+ * @param {string} amount_json
211
+ * @param {string} fee_type
212
+ * @param {bigint | null} [tx_fee_bps]
213
+ * @param {bigint | null} [swap_fee_bps]
214
+ * @returns {string}
215
+ */
216
+ function calculateFee(amount_json, fee_type, tx_fee_bps, swap_fee_bps) {
217
+ let deferred4_0;
218
+ let deferred4_1;
219
+ try {
220
+ const ptr0 = passStringToWasm0(amount_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
221
+ const len0 = WASM_VECTOR_LEN;
222
+ const ptr1 = passStringToWasm0(fee_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
223
+ const len1 = WASM_VECTOR_LEN;
224
+ const ret = wasm.calculateFee(ptr0, len0, ptr1, len1, !isLikeNone(tx_fee_bps), isLikeNone(tx_fee_bps) ? BigInt(0) : tx_fee_bps, !isLikeNone(swap_fee_bps), isLikeNone(swap_fee_bps) ? BigInt(0) : swap_fee_bps);
225
+ var ptr3 = ret[0];
226
+ var len3 = ret[1];
227
+ if (ret[3]) {
228
+ ptr3 = 0; len3 = 0;
229
+ throw takeFromExternrefTable0(ret[2]);
230
+ }
231
+ deferred4_0 = ptr3;
232
+ deferred4_1 = len3;
233
+ return getStringFromWasm0(ptr3, len3);
234
+ } finally {
235
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
236
+ }
237
+ }
238
+ exports.calculateFee = calculateFee;
239
+
240
+ /**
241
+ * Compress a float32 vector. Input: JSON array of f32. Output: CompressedVector JSON.
242
+ * @param {string} vector_json
243
+ * @param {number} dimensions
244
+ * @returns {string}
245
+ */
246
+ function compressVector(vector_json, dimensions) {
247
+ let deferred3_0;
248
+ let deferred3_1;
249
+ try {
250
+ const ptr0 = passStringToWasm0(vector_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
251
+ const len0 = WASM_VECTOR_LEN;
252
+ const ret = wasm.compressVector(ptr0, len0, dimensions);
253
+ var ptr2 = ret[0];
254
+ var len2 = ret[1];
255
+ if (ret[3]) {
256
+ ptr2 = 0; len2 = 0;
257
+ throw takeFromExternrefTable0(ret[2]);
258
+ }
259
+ deferred3_0 = ptr2;
260
+ deferred3_1 = len2;
261
+ return getStringFromWasm0(ptr2, len2);
262
+ } finally {
263
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
264
+ }
265
+ }
266
+ exports.compressVector = compressVector;
267
+
268
+ /**
269
+ * Compute Keccak-256 hash of raw bytes (EVM-compatible). Returns `0x` + 64 hex chars.
270
+ * @param {Uint8Array} bytes
271
+ * @returns {string}
272
+ */
273
+ function computeKeccak256(bytes) {
274
+ let deferred2_0;
275
+ let deferred2_1;
276
+ try {
277
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
278
+ const len0 = WASM_VECTOR_LEN;
279
+ const ret = wasm.computeKeccak256(ptr0, len0);
280
+ deferred2_0 = ret[0];
281
+ deferred2_1 = ret[1];
282
+ return getStringFromWasm0(ret[0], ret[1]);
283
+ } finally {
284
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
285
+ }
286
+ }
287
+ exports.computeKeccak256 = computeKeccak256;
288
+
289
+ /**
290
+ * Compute SHA-256 hash of content string.
291
+ * @param {string} content
292
+ * @returns {string}
293
+ */
294
+ function computeSha256(content) {
295
+ let deferred2_0;
296
+ let deferred2_1;
297
+ try {
298
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
299
+ const len0 = WASM_VECTOR_LEN;
300
+ const ret = wasm.computeSha256(ptr0, len0);
301
+ deferred2_0 = ret[0];
302
+ deferred2_1 = ret[1];
303
+ return getStringFromWasm0(ret[0], ret[1]);
304
+ } finally {
305
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
306
+ }
307
+ }
308
+ exports.computeSha256 = computeSha256;
309
+
310
+ /**
311
+ * Decompress a CompressedVector JSON back to a float32 array JSON.
312
+ * @param {string} compressed_json
313
+ * @param {number} dimensions
314
+ * @returns {string}
315
+ */
316
+ function decompressVector(compressed_json, dimensions) {
317
+ let deferred3_0;
318
+ let deferred3_1;
319
+ try {
320
+ const ptr0 = passStringToWasm0(compressed_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
321
+ const len0 = WASM_VECTOR_LEN;
322
+ const ret = wasm.decompressVector(ptr0, len0, dimensions);
323
+ var ptr2 = ret[0];
324
+ var len2 = ret[1];
325
+ if (ret[3]) {
326
+ ptr2 = 0; len2 = 0;
327
+ throw takeFromExternrefTable0(ret[2]);
328
+ }
329
+ deferred3_0 = ptr2;
330
+ deferred3_1 = len2;
331
+ return getStringFromWasm0(ptr2, len2);
332
+ } finally {
333
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
334
+ }
335
+ }
336
+ exports.decompressVector = decompressVector;
337
+
338
+ /**
339
+ * Ethereum address from 32-byte secp256k1 private key (`0x` + 20 bytes, EIP-55 checksum).
340
+ * @param {Uint8Array} private_key
341
+ * @returns {string}
342
+ */
343
+ function deriveEthereumAddress(private_key) {
344
+ let deferred3_0;
345
+ let deferred3_1;
346
+ try {
347
+ const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
348
+ const len0 = WASM_VECTOR_LEN;
349
+ const ret = wasm.deriveEthereumAddress(ptr0, len0);
350
+ var ptr2 = ret[0];
351
+ var len2 = ret[1];
352
+ if (ret[3]) {
353
+ ptr2 = 0; len2 = 0;
354
+ throw takeFromExternrefTable0(ret[2]);
355
+ }
356
+ deferred3_0 = ptr2;
357
+ deferred3_1 = len2;
358
+ return getStringFromWasm0(ptr2, len2);
359
+ } finally {
360
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
361
+ }
362
+ }
363
+ exports.deriveEthereumAddress = deriveEthereumAddress;
364
+
365
+ /**
366
+ * Uncompressed public key: 64 bytes (x || y), no `0x04` prefix.
367
+ * @param {Uint8Array} private_key
368
+ * @returns {Uint8Array}
369
+ */
370
+ function derivePublicKey(private_key) {
371
+ const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
372
+ const len0 = WASM_VECTOR_LEN;
373
+ const ret = wasm.derivePublicKey(ptr0, len0);
374
+ if (ret[3]) {
375
+ throw takeFromExternrefTable0(ret[2]);
376
+ }
377
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
378
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
379
+ return v2;
380
+ }
381
+ exports.derivePublicKey = derivePublicKey;
382
+
383
+ /**
384
+ * Evaluate a write request against a firewall.
385
+ * Input JSON: {namespace, content, trust_level, source, allowed_namespaces?, blocked_patterns?, max_content_length?}
386
+ * Returns JSON: {"decision": "allow"|"deny"|"sanitize", "reason"?: ..., "sanitized"?: ...}
387
+ * @param {string} json
388
+ * @returns {string}
389
+ */
390
+ function evaluateWriteFirewall(json) {
391
+ let deferred3_0;
392
+ let deferred3_1;
393
+ try {
394
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
395
+ const len0 = WASM_VECTOR_LEN;
396
+ const ret = wasm.evaluateWriteFirewall(ptr0, len0);
397
+ var ptr2 = ret[0];
398
+ var len2 = ret[1];
399
+ if (ret[3]) {
400
+ ptr2 = 0; len2 = 0;
401
+ throw takeFromExternrefTable0(ret[2]);
402
+ }
403
+ deferred3_0 = ptr2;
404
+ deferred3_1 = len2;
405
+ return getStringFromWasm0(ptr2, len2);
406
+ } finally {
407
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
408
+ }
409
+ }
410
+ exports.evaluateWriteFirewall = evaluateWriteFirewall;
411
+
412
+ /**
413
+ * Returns a list of modules available in this WASM build.
414
+ * @returns {string}
415
+ */
416
+ function getAvailableModules() {
417
+ let deferred1_0;
418
+ let deferred1_1;
419
+ try {
420
+ const ret = wasm.getAvailableModules();
421
+ deferred1_0 = ret[0];
422
+ deferred1_1 = ret[1];
423
+ return getStringFromWasm0(ret[0], ret[1]);
424
+ } finally {
425
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
426
+ }
427
+ }
428
+ exports.getAvailableModules = getAvailableModules;
429
+
430
+ /**
431
+ * Get the default token registry as JSON.
432
+ * @returns {string}
433
+ */
434
+ function getDefaultTokenRegistry() {
435
+ let deferred2_0;
436
+ let deferred2_1;
437
+ try {
438
+ const ret = wasm.getDefaultTokenRegistry();
439
+ var ptr1 = ret[0];
440
+ var len1 = ret[1];
441
+ if (ret[3]) {
442
+ ptr1 = 0; len1 = 0;
443
+ throw takeFromExternrefTable0(ret[2]);
444
+ }
445
+ deferred2_0 = ptr1;
446
+ deferred2_1 = len1;
447
+ return getStringFromWasm0(ptr1, len1);
448
+ } finally {
449
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
450
+ }
451
+ }
452
+ exports.getDefaultTokenRegistry = getDefaultTokenRegistry;
453
+
454
+ /**
455
+ * Returns the version and build info.
456
+ * @returns {string}
457
+ */
458
+ function getVersion() {
459
+ let deferred1_0;
460
+ let deferred1_1;
461
+ try {
462
+ const ret = wasm.getVersion();
463
+ deferred1_0 = ret[0];
464
+ deferred1_1 = ret[1];
465
+ return getStringFromWasm0(ret[0], ret[1]);
466
+ } finally {
467
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
468
+ }
469
+ }
470
+ exports.getVersion = getVersion;
471
+
472
+ /**
473
+ * ECDSA sign 32-byte message hash → 65 bytes (r || s || recovery_id).
474
+ * @param {Uint8Array} private_key
475
+ * @param {Uint8Array} message_hash
476
+ * @returns {Uint8Array}
477
+ */
478
+ function signEcdsa(private_key, message_hash) {
479
+ const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
480
+ const len0 = WASM_VECTOR_LEN;
481
+ const ptr1 = passArray8ToWasm0(message_hash, wasm.__wbindgen_malloc);
482
+ const len1 = WASM_VECTOR_LEN;
483
+ const ret = wasm.signEcdsa(ptr0, len0, ptr1, len1);
484
+ if (ret[3]) {
485
+ throw takeFromExternrefTable0(ret[2]);
486
+ }
487
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
488
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
489
+ return v3;
490
+ }
491
+ exports.signEcdsa = signEcdsa;
492
+
493
+ /**
494
+ * Add two TokenAmount JSONs. Returns the sum as JSON.
495
+ * @param {string} a_json
496
+ * @param {string} b_json
497
+ * @returns {string}
498
+ */
499
+ function tokenAmountAdd(a_json, b_json) {
500
+ let deferred4_0;
501
+ let deferred4_1;
502
+ try {
503
+ const ptr0 = passStringToWasm0(a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
504
+ const len0 = WASM_VECTOR_LEN;
505
+ const ptr1 = passStringToWasm0(b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
506
+ const len1 = WASM_VECTOR_LEN;
507
+ const ret = wasm.tokenAmountAdd(ptr0, len0, ptr1, len1);
508
+ var ptr3 = ret[0];
509
+ var len3 = ret[1];
510
+ if (ret[3]) {
511
+ ptr3 = 0; len3 = 0;
512
+ throw takeFromExternrefTable0(ret[2]);
513
+ }
514
+ deferred4_0 = ptr3;
515
+ deferred4_1 = len3;
516
+ return getStringFromWasm0(ptr3, len3);
517
+ } finally {
518
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
519
+ }
520
+ }
521
+ exports.tokenAmountAdd = tokenAmountAdd;
522
+
523
+ /**
524
+ * Create a TokenAmount from a human-readable f64 value and decimal count.
525
+ * Returns JSON: `{"raw": "...", "decimals": N}`
526
+ * @param {number} human
527
+ * @param {number} decimals
528
+ * @returns {string}
529
+ */
530
+ function tokenAmountFromHuman(human, decimals) {
531
+ let deferred2_0;
532
+ let deferred2_1;
533
+ try {
534
+ const ret = wasm.tokenAmountFromHuman(human, decimals);
535
+ var ptr1 = ret[0];
536
+ var len1 = ret[1];
537
+ if (ret[3]) {
538
+ ptr1 = 0; len1 = 0;
539
+ throw takeFromExternrefTable0(ret[2]);
540
+ }
541
+ deferred2_0 = ptr1;
542
+ deferred2_1 = len1;
543
+ return getStringFromWasm0(ptr1, len1);
544
+ } finally {
545
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
546
+ }
547
+ }
548
+ exports.tokenAmountFromHuman = tokenAmountFromHuman;
549
+
550
+ /**
551
+ * Multiply a TokenAmount by basis points. Returns result as JSON.
552
+ * @param {string} json
553
+ * @param {bigint} bps
554
+ * @returns {string}
555
+ */
556
+ function tokenAmountMulBps(json, bps) {
557
+ let deferred3_0;
558
+ let deferred3_1;
559
+ try {
560
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
561
+ const len0 = WASM_VECTOR_LEN;
562
+ const ret = wasm.tokenAmountMulBps(ptr0, len0, bps);
563
+ var ptr2 = ret[0];
564
+ var len2 = ret[1];
565
+ if (ret[3]) {
566
+ ptr2 = 0; len2 = 0;
567
+ throw takeFromExternrefTable0(ret[2]);
568
+ }
569
+ deferred3_0 = ptr2;
570
+ deferred3_1 = len2;
571
+ return getStringFromWasm0(ptr2, len2);
572
+ } finally {
573
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
574
+ }
575
+ }
576
+ exports.tokenAmountMulBps = tokenAmountMulBps;
577
+
578
+ /**
579
+ * Subtract two TokenAmount JSONs. Returns the difference as JSON.
580
+ * @param {string} a_json
581
+ * @param {string} b_json
582
+ * @returns {string}
583
+ */
584
+ function tokenAmountSub(a_json, b_json) {
585
+ let deferred4_0;
586
+ let deferred4_1;
587
+ try {
588
+ const ptr0 = passStringToWasm0(a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
589
+ const len0 = WASM_VECTOR_LEN;
590
+ const ptr1 = passStringToWasm0(b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
591
+ const len1 = WASM_VECTOR_LEN;
592
+ const ret = wasm.tokenAmountSub(ptr0, len0, ptr1, len1);
593
+ var ptr3 = ret[0];
594
+ var len3 = ret[1];
595
+ if (ret[3]) {
596
+ ptr3 = 0; len3 = 0;
597
+ throw takeFromExternrefTable0(ret[2]);
598
+ }
599
+ deferred4_0 = ptr3;
600
+ deferred4_1 = len3;
601
+ return getStringFromWasm0(ptr3, len3);
602
+ } finally {
603
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
604
+ }
605
+ }
606
+ exports.tokenAmountSub = tokenAmountSub;
607
+
608
+ /**
609
+ * Convert a TokenAmount JSON back to a human-readable f64.
610
+ * @param {string} json
611
+ * @returns {number}
612
+ */
613
+ function tokenAmountToHuman(json) {
614
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
615
+ const len0 = WASM_VECTOR_LEN;
616
+ const ret = wasm.tokenAmountToHuman(ptr0, len0);
617
+ if (ret[2]) {
618
+ throw takeFromExternrefTable0(ret[1]);
619
+ }
620
+ return ret[0];
621
+ }
622
+ exports.tokenAmountToHuman = tokenAmountToHuman;
623
+
624
+ /**
625
+ * @param {Uint8Array} public_key
626
+ * @param {Uint8Array} message_hash
627
+ * @param {Uint8Array} signature
628
+ * @returns {boolean}
629
+ */
630
+ function verifyEcdsa(public_key, message_hash, signature) {
631
+ const ptr0 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
632
+ const len0 = WASM_VECTOR_LEN;
633
+ const ptr1 = passArray8ToWasm0(message_hash, wasm.__wbindgen_malloc);
634
+ const len1 = WASM_VECTOR_LEN;
635
+ const ptr2 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
636
+ const len2 = WASM_VECTOR_LEN;
637
+ const ret = wasm.verifyEcdsa(ptr0, len0, ptr1, len1, ptr2, len2);
638
+ if (ret[2]) {
639
+ throw takeFromExternrefTable0(ret[1]);
640
+ }
641
+ return ret[0] !== 0;
642
+ }
643
+ exports.verifyEcdsa = verifyEcdsa;
644
+
645
+ function __wbg_get_imports() {
646
+ const import0 = {
647
+ __proto__: null,
648
+ __wbg_Error_7c536b7a8123d334: function(arg0, arg1) {
649
+ const ret = Error(getStringFromWasm0(arg0, arg1));
650
+ return ret;
651
+ },
652
+ __wbg___wbindgen_throw_bd5a70920abf0236: function(arg0, arg1) {
653
+ throw new Error(getStringFromWasm0(arg0, arg1));
654
+ },
655
+ __wbg_getRandomValues_d49329ff89a07af1: function() { return handleError(function (arg0, arg1) {
656
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
657
+ }, arguments); },
658
+ __wbg_getTime_60f8d1fb5b61be64: function(arg0) {
659
+ const ret = arg0.getTime();
660
+ return ret;
661
+ },
662
+ __wbg_new_0_1211b165db93342c: function() {
663
+ const ret = new Date();
664
+ return ret;
665
+ },
666
+ __wbindgen_init_externref_table: function() {
667
+ const table = wasm.__wbindgen_externrefs;
668
+ const offset = table.grow(4);
669
+ table.set(0, undefined);
670
+ table.set(offset + 0, undefined);
671
+ table.set(offset + 1, null);
672
+ table.set(offset + 2, true);
673
+ table.set(offset + 3, false);
674
+ },
675
+ };
676
+ return {
677
+ __proto__: null,
678
+ "./clawpowers_wasm_bg.js": import0,
679
+ };
680
+ }
681
+
682
+ const WasmCanonicalStoreFinalization = (typeof FinalizationRegistry === 'undefined')
683
+ ? { register: () => {}, unregister: () => {} }
684
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmcanonicalstore_free(ptr >>> 0, 1));
685
+
686
+ function addToExternrefTable0(obj) {
687
+ const idx = wasm.__externref_table_alloc();
688
+ wasm.__wbindgen_externrefs.set(idx, obj);
689
+ return idx;
690
+ }
691
+
692
+ function getArrayU8FromWasm0(ptr, len) {
693
+ ptr = ptr >>> 0;
694
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
695
+ }
696
+
697
+ function getStringFromWasm0(ptr, len) {
698
+ ptr = ptr >>> 0;
699
+ return decodeText(ptr, len);
700
+ }
701
+
702
+ let cachedUint8ArrayMemory0 = null;
703
+ function getUint8ArrayMemory0() {
704
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
705
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
706
+ }
707
+ return cachedUint8ArrayMemory0;
708
+ }
709
+
710
+ function handleError(f, args) {
711
+ try {
712
+ return f.apply(this, args);
713
+ } catch (e) {
714
+ const idx = addToExternrefTable0(e);
715
+ wasm.__wbindgen_exn_store(idx);
716
+ }
717
+ }
718
+
719
+ function isLikeNone(x) {
720
+ return x === undefined || x === null;
721
+ }
722
+
723
+ function passArray8ToWasm0(arg, malloc) {
724
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
725
+ getUint8ArrayMemory0().set(arg, ptr / 1);
726
+ WASM_VECTOR_LEN = arg.length;
727
+ return ptr;
728
+ }
729
+
730
+ function passStringToWasm0(arg, malloc, realloc) {
731
+ if (realloc === undefined) {
732
+ const buf = cachedTextEncoder.encode(arg);
733
+ const ptr = malloc(buf.length, 1) >>> 0;
734
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
735
+ WASM_VECTOR_LEN = buf.length;
736
+ return ptr;
737
+ }
738
+
739
+ let len = arg.length;
740
+ let ptr = malloc(len, 1) >>> 0;
741
+
742
+ const mem = getUint8ArrayMemory0();
743
+
744
+ let offset = 0;
745
+
746
+ for (; offset < len; offset++) {
747
+ const code = arg.charCodeAt(offset);
748
+ if (code > 0x7F) break;
749
+ mem[ptr + offset] = code;
750
+ }
751
+ if (offset !== len) {
752
+ if (offset !== 0) {
753
+ arg = arg.slice(offset);
754
+ }
755
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
756
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
757
+ const ret = cachedTextEncoder.encodeInto(arg, view);
758
+
759
+ offset += ret.written;
760
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
761
+ }
762
+
763
+ WASM_VECTOR_LEN = offset;
764
+ return ptr;
765
+ }
766
+
767
+ function takeFromExternrefTable0(idx) {
768
+ const value = wasm.__wbindgen_externrefs.get(idx);
769
+ wasm.__externref_table_dealloc(idx);
770
+ return value;
771
+ }
772
+
773
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
774
+ cachedTextDecoder.decode();
775
+ function decodeText(ptr, len) {
776
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
777
+ }
778
+
779
+ const cachedTextEncoder = new TextEncoder();
780
+
781
+ if (!('encodeInto' in cachedTextEncoder)) {
782
+ cachedTextEncoder.encodeInto = function (arg, view) {
783
+ const buf = cachedTextEncoder.encode(arg);
784
+ view.set(buf);
785
+ return {
786
+ read: arg.length,
787
+ written: buf.length
788
+ };
789
+ };
790
+ }
791
+
792
+ let WASM_VECTOR_LEN = 0;
793
+
794
+ const wasmPath = `${__dirname}/clawpowers_wasm_bg.wasm`;
795
+ const wasmBytes = require('fs').readFileSync(wasmPath);
796
+ const wasmModule = new WebAssembly.Module(wasmBytes);
797
+ let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
798
+ wasm.__wbindgen_start();