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
@@ -1,230 +0,0 @@
1
- #!/usr/bin/env node
2
- // runtime/demo/x402-mock-server.js — x402 Mock Merchant Demo Server
3
- //
4
- // Starts a local HTTP server that demonstrates the x402 payment-required flow:
5
- // 1. GET /api/premium-data without payment header → 402 Payment Required
6
- // 2. GET /api/premium-data with 'x-payment: mock-proof' header → 200 OK with data
7
- //
8
- // This server is for DEMO and DEVELOPMENT ONLY — it does not process real payments.
9
- //
10
- // Usage:
11
- // node runtime/demo/x402-mock-server.js
12
- // npx clawpowers demo x402
13
- //
14
- // The server picks a random available port and prints instructions on startup.
15
- // Press Ctrl+C to stop.
16
- 'use strict';
17
-
18
- const http = require('http');
19
-
20
-
21
- // Track requests for demo visibility
22
- let requestCount = 0;
23
-
24
- /**
25
- * Returns an ISO 8601 timestamp without milliseconds.
26
- *
27
- * @returns {string} e.g. "2026-03-22T21:42:00Z"
28
- */
29
- function isoTimestamp() {
30
- return new Date().toISOString().replace(/\.\d{3}Z$/, 'Z');
31
- }
32
-
33
- /**
34
- * Logs a request to stdout with timestamp and key details.
35
- * Allows the demo runner to see exactly what is happening.
36
- *
37
- * @param {string} method - HTTP method (GET, POST, etc.)
38
- * @param {string} url - Request URL path
39
- * @param {number} status - Response HTTP status code
40
- * @param {string} [note=''] - Optional human-readable note about this request
41
- */
42
- function logRequest(method, url, status, note = '') {
43
- const ts = isoTimestamp();
44
- const noteStr = note ? ` — ${note}` : '';
45
- console.log(` [${ts}] ${method} ${url} → ${status}${noteStr}`);
46
- }
47
-
48
- /**
49
- * Builds the x402 Payment Required response body for the mock merchant.
50
- * This mimics the response a real x402-compliant API would return.
51
- *
52
- * @param {number} port - The port this server is running on (embedded in the resource URL).
53
- * @returns {object} x402 payment requirements object.
54
- */
55
- function buildPaymentRequired(port) {
56
- return {
57
- x402Version: 1,
58
- accepts: [
59
- {
60
- scheme: 'exact',
61
- network: 'base-sepolia',
62
- maxAmountRequired: '100000',
63
- resource: `http://localhost:${port}/api/premium-data`,
64
- asset: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
65
- payTo: '0xff86829393C6C26A4EC122bE0Cc3E466Ef876AdD',
66
- },
67
- ],
68
- error: 'Payment Required',
69
- };
70
- }
71
-
72
- /**
73
- * Builds the mock premium data response returned after (simulated) payment.
74
- *
75
- * @returns {object} Mock API data payload.
76
- */
77
- function buildPremiumData() {
78
- return {
79
- status: 'ok',
80
- data: {
81
- market: 'AGENT/USDC',
82
- price: '4.20',
83
- volume_24h: '1234567.89',
84
- change_24h: '+12.3%',
85
- source: 'mock-premium-api',
86
- paid_with: 'x402',
87
- timestamp: isoTimestamp(),
88
- },
89
- message: 'Payment accepted. Here is your premium data.',
90
- };
91
- }
92
-
93
- /**
94
- * Main HTTP request handler for the mock x402 merchant.
95
- *
96
- * Routes:
97
- * GET /api/premium-data — Returns 402 or 200 depending on x-payment header
98
- * GET / — Returns a simple HTML help page
99
- * All others — Returns 404
100
- *
101
- * @param {http.IncomingMessage} req - Incoming HTTP request
102
- * @param {http.ServerResponse} res - HTTP response object
103
- */
104
- function handleRequest(req, res) {
105
- requestCount++;
106
- const url = req.url || '/';
107
- const method = req.method || 'GET';
108
-
109
- // CORS headers — allow curl and browser requests during demo
110
- res.setHeader('Access-Control-Allow-Origin', '*');
111
- res.setHeader('Access-Control-Allow-Headers', 'x-payment, content-type');
112
-
113
- if (url === '/api/premium-data' && method === 'GET') {
114
- const paymentHeader = req.headers['x-payment'];
115
-
116
- if (!paymentHeader) {
117
- // No payment header — return 402 Payment Required with x402 spec body
118
- const body = JSON.stringify(buildPaymentRequired(server.address().port), null, 2);
119
- res.setHeader('Content-Type', 'application/json');
120
- res.writeHead(402);
121
- res.end(body);
122
- logRequest(method, url, 402, 'No x-payment header — returning payment requirements');
123
- } else {
124
- // Payment header present — simulate successful payment verification
125
- const body = JSON.stringify(buildPremiumData(), null, 2);
126
- res.setHeader('Content-Type', 'application/json');
127
- res.writeHead(200);
128
- res.end(body);
129
- logRequest(method, url, 200, `x-payment: ${paymentHeader} — payment accepted, returning data`);
130
- }
131
-
132
- } else if (url === '/' && method === 'GET') {
133
- // Help page — shows curl examples
134
- const port = server.address().port;
135
- const body = [
136
- '<html><body><pre>',
137
- 'x402 Mock Merchant Demo',
138
- '=======================',
139
- '',
140
- 'Try these curl commands:',
141
- '',
142
- `# Step 1: Request without payment (returns 402)`,
143
- `curl -i http://localhost:${port}/api/premium-data`,
144
- '',
145
- `# Step 2: Request with payment header (returns 200 + data)`,
146
- `curl -i -H "x-payment: mock-proof" http://localhost:${port}/api/premium-data`,
147
- '</pre></body></html>',
148
- ].join('\n');
149
- res.setHeader('Content-Type', 'text/html');
150
- res.writeHead(200);
151
- res.end(body);
152
- logRequest(method, url, 200, 'help page');
153
-
154
- } else {
155
- res.setHeader('Content-Type', 'application/json');
156
- res.writeHead(404);
157
- res.end(JSON.stringify({ error: 'Not Found', path: url }));
158
- logRequest(method, url, 404);
159
- }
160
- }
161
-
162
- /**
163
- * Finds a random available port by binding to port 0 and reading what the OS assigned.
164
- * Returns a Promise that resolves to the chosen port number.
165
- *
166
- * @returns {Promise<number>} Available port number.
167
- */
168
- function getAvailablePort() {
169
- return new Promise((resolve, reject) => {
170
- const tmp = http.createServer();
171
- tmp.listen(0, '127.0.0.1', () => {
172
- const port = tmp.address().port;
173
- tmp.close(() => resolve(port));
174
- });
175
- tmp.on('error', reject);
176
- });
177
- }
178
-
179
- // The server object is referenced inside handleRequest for the port — declare before use
180
- /** @type {http.Server} */
181
- const server = http.createServer(handleRequest);
182
-
183
- /**
184
- * Main entry point: picks a port, starts the server, and prints instructions.
185
- * Waits for Ctrl+C (SIGINT) or SIGTERM to shut down cleanly.
186
- */
187
- async function main() {
188
- let port;
189
- try {
190
- port = await getAvailablePort();
191
- } catch (_) {
192
- // If dynamic port detection fails, fall back to a fixed high port
193
- port = 18402;
194
- }
195
-
196
- server.listen(port, '127.0.0.1', () => {
197
- console.log('');
198
- console.log('╔══════════════════════════════════════════════════════════════╗');
199
- console.log('║ x402 Mock Merchant — Demo Server ║');
200
- console.log('╚══════════════════════════════════════════════════════════════╝');
201
- console.log('');
202
- console.log(` Mock x402 merchant running on http://localhost:${port}`);
203
- console.log('');
204
- console.log(' Try:');
205
- console.log(` curl http://localhost:${port}/api/premium-data`);
206
- console.log('');
207
- console.log(' The server will return 402 (Payment Required) on first request.');
208
- console.log('');
209
- console.log(` curl -H 'x-payment: mock-proof' http://localhost:${port}/api/premium-data`);
210
- console.log('');
211
- console.log(" Send with header 'x-payment: mock-proof' to simulate payment.");
212
- console.log('');
213
- console.log(' Request log:');
214
- });
215
-
216
- // Handle Ctrl+C and process termination signals cleanly
217
- const shutdown = () => {
218
- console.log('');
219
- console.log(` Shutting down after ${requestCount} request(s). Goodbye.`);
220
- server.close(() => process.exit(0));
221
- };
222
-
223
- process.on('SIGINT', shutdown);
224
- process.on('SIGTERM', shutdown);
225
- }
226
-
227
- main().catch((err) => {
228
- process.stderr.write(`Error starting mock server: ${err.message}\n`);
229
- process.exit(1);
230
- });