clawpowers 2.2.5 → 2.2.7

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 (138) hide show
  1. package/CHANGELOG.md +186 -160
  2. package/COMPATIBILITY.md +48 -13
  3. package/KNOWN_LIMITATIONS.md +20 -19
  4. package/LICENSE +44 -44
  5. package/LICENSING.md +10 -10
  6. package/README.md +486 -462
  7. package/SECURITY.md +52 -52
  8. package/dist/index.d.ts +17 -5
  9. package/dist/index.js +187 -92
  10. package/dist/index.js.map +1 -1
  11. package/native/Cargo.lock +4927 -4927
  12. package/native/Cargo.toml +73 -73
  13. package/native/crates/canonical/Cargo.toml +24 -24
  14. package/native/crates/canonical/src/lib.rs +677 -673
  15. package/native/crates/compression/Cargo.toml +20 -20
  16. package/native/crates/compression/benches/compression_bench.rs +42 -42
  17. package/native/crates/compression/src/lib.rs +393 -393
  18. package/native/crates/evm-eth/Cargo.toml +13 -13
  19. package/native/crates/evm-eth/src/lib.rs +105 -105
  20. package/native/crates/fee/Cargo.toml +15 -15
  21. package/native/crates/fee/src/lib.rs +281 -281
  22. package/native/crates/index/Cargo.toml +16 -16
  23. package/native/crates/index/src/lib.rs +277 -277
  24. package/native/crates/policy/Cargo.toml +17 -17
  25. package/native/crates/policy/src/lib.rs +614 -614
  26. package/native/crates/security/Cargo.toml +22 -22
  27. package/native/crates/security/src/lib.rs +478 -478
  28. package/native/crates/tokens/Cargo.toml +13 -13
  29. package/native/crates/tokens/src/lib.rs +534 -534
  30. package/native/crates/verification/Cargo.toml +23 -23
  31. package/native/crates/verification/src/lib.rs +333 -333
  32. package/native/crates/wallet/Cargo.toml +20 -20
  33. package/native/crates/wallet/src/lib.rs +261 -261
  34. package/native/crates/x402/Cargo.toml +30 -30
  35. package/native/crates/x402/src/lib.rs +423 -423
  36. package/native/ffi/Cargo.toml +34 -34
  37. package/native/ffi/build.rs +4 -4
  38. package/native/ffi/src/lib.rs +352 -352
  39. package/native/ffi/tests/integration.rs +354 -354
  40. package/native/pyo3/Cargo.toml +26 -26
  41. package/native/pyo3/pyproject.toml +16 -16
  42. package/native/pyo3/src/lib.rs +407 -407
  43. package/native/pyo3/tests/test_smoke.py +180 -180
  44. package/native/wasm/Cargo.toml +47 -44
  45. package/native/wasm/pkg/.gitignore +6 -6
  46. package/native/wasm/pkg/clawpowers_wasm.d.ts +208 -208
  47. package/native/wasm/pkg/clawpowers_wasm.js +872 -872
  48. package/native/wasm/pkg/clawpowers_wasm_bg.wasm.d.ts +40 -40
  49. package/native/wasm/pkg/package.json +16 -16
  50. package/native/wasm/pkg-node/clawpowers_wasm.d.ts +143 -143
  51. package/native/wasm/pkg-node/clawpowers_wasm.js +798 -798
  52. package/native/wasm/pkg-node/clawpowers_wasm_bg.wasm.d.ts +40 -40
  53. package/native/wasm/pkg-node/package.json +12 -12
  54. package/native/wasm/src/lib.rs +433 -433
  55. package/package.json +13 -8
  56. package/scripts/build-wasm.mjs +59 -0
  57. package/scripts/generate_hermes_wrappers.py +211 -0
  58. package/scripts/hermes_wrapper_overrides.json +184 -0
  59. package/scripts/run-python-script.mjs +48 -0
  60. package/scripts/verify-consumer-install.mjs +109 -0
  61. package/scripts/verify-wasm-artifacts.mjs +26 -3
  62. package/scripts/verify_hermes_wrappers.py +154 -0
  63. package/skill.json +20 -0
  64. package/skills/1password/SKILL.md +34 -0
  65. package/skills/README.md +44 -0
  66. package/skills/agent-nexus-2/SKILL.md +34 -0
  67. package/skills/apple-notes/SKILL.md +34 -0
  68. package/skills/apple-reminders/SKILL.md +34 -0
  69. package/skills/autoresearch/SKILL.md +43 -0
  70. package/skills/bear-notes/SKILL.md +34 -0
  71. package/skills/blogwatcher/SKILL.md +34 -0
  72. package/skills/blucli/SKILL.md +34 -0
  73. package/skills/bluebubbles/SKILL.md +34 -0
  74. package/skills/business-strategy/SKILL.md +41 -0
  75. package/skills/camsnap/SKILL.md +34 -0
  76. package/skills/canvas/SKILL.md +34 -0
  77. package/skills/clawhub/SKILL.md +34 -0
  78. package/skills/coding-agent/SKILL.md +34 -0
  79. package/skills/coding-discipline.skill/SKILL.md +34 -0
  80. package/skills/content-writer/SKILL.md +41 -0
  81. package/skills/discord/SKILL.md +34 -0
  82. package/skills/eightctl/SKILL.md +34 -0
  83. package/skills/execution-validation.skill/SKILL.md +34 -0
  84. package/skills/gemini/SKILL.md +34 -0
  85. package/skills/gh-issues/SKILL.md +34 -0
  86. package/skills/gifgrep/SKILL.md +34 -0
  87. package/skills/github/SKILL.md +41 -0
  88. package/skills/gog/SKILL.md +34 -0
  89. package/skills/goplaces/SKILL.md +34 -0
  90. package/skills/healthcheck/SKILL.md +34 -0
  91. package/skills/himalaya/SKILL.md +34 -0
  92. package/skills/humanize/SKILL.md +41 -0
  93. package/skills/imsg/SKILL.md +34 -0
  94. package/skills/itp/SKILL.md +112 -0
  95. package/skills/mcporter/SKILL.md +34 -0
  96. package/skills/model-usage/SKILL.md +34 -0
  97. package/skills/nano-pdf/SKILL.md +34 -0
  98. package/skills/node-connect/SKILL.md +34 -0
  99. package/skills/notion/SKILL.md +34 -0
  100. package/skills/obsidian/SKILL.md +34 -0
  101. package/skills/openai-whisper/SKILL.md +34 -0
  102. package/skills/openai-whisper-api/SKILL.md +34 -0
  103. package/skills/openhue/SKILL.md +34 -0
  104. package/skills/oracle/SKILL.md +34 -0
  105. package/skills/ordercli/SKILL.md +34 -0
  106. package/skills/peekaboo/SKILL.md +34 -0
  107. package/skills/polyclaw/SKILL.md +34 -0
  108. package/skills/prospector/SKILL.md +41 -0
  109. package/skills/rsi.skill/SKILL.md +34 -0
  110. package/skills/sag/SKILL.md +34 -0
  111. package/skills/security/SKILL.md +41 -0
  112. package/skills/session-logs/SKILL.md +34 -0
  113. package/skills/sherpa-onnx-tts/SKILL.md +34 -0
  114. package/skills/skill-creator/SKILL.md +34 -0
  115. package/skills/slack/SKILL.md +34 -0
  116. package/skills/songsee/SKILL.md +34 -0
  117. package/skills/sonoscli/SKILL.md +34 -0
  118. package/skills/spotify-player/SKILL.md +34 -0
  119. package/skills/strykr-prism/SKILL.md +41 -0
  120. package/skills/summarize/SKILL.md +34 -0
  121. package/skills/taskbridge/SKILL.md +34 -0
  122. package/skills/things-mac/SKILL.md +34 -0
  123. package/skills/tmux/SKILL.md +34 -0
  124. package/skills/trello/SKILL.md +34 -0
  125. package/skills/validator-agent/SKILL.md +41 -0
  126. package/skills/video-frames/SKILL.md +34 -0
  127. package/skills/voice-call/SKILL.md +34 -0
  128. package/skills/wacli/SKILL.md +34 -0
  129. package/skills/weather/SKILL.md +34 -0
  130. package/skills/webmcp-payments/SKILL.md +41 -0
  131. package/skills/xurl/SKILL.md +34 -0
  132. package/src/skills/catalog.ts +435 -435
  133. package/src/skills/executor.ts +56 -56
  134. package/src/skills/index.ts +3 -3
  135. package/src/skills/itp/SKILL.md +112 -112
  136. package/src/skills/loader.ts +262 -193
  137. package/native/ffi/index.node +0 -0
  138. package/native/wasm/pkg-node/.gitignore +0 -6
@@ -1,13 +1,13 @@
1
- [package]
2
- name = "clawpowers-evm-eth"
3
- version.workspace = true
4
- edition.workspace = true
5
- license.workspace = true
6
- description = "secp256k1 + Keccak Ethereum address and ECDSA helpers (pure Rust, WASM-safe)"
7
-
8
- [dependencies]
9
- k256 = { version = "0.13", features = ["ecdsa", "sha2"] }
10
- alloy-primitives = { workspace = true }
11
-
12
- [dev-dependencies]
13
- hex = "0.4"
1
+ [package]
2
+ name = "clawpowers-evm-eth"
3
+ version.workspace = true
4
+ edition.workspace = true
5
+ license.workspace = true
6
+ description = "secp256k1 + Keccak Ethereum address and ECDSA helpers (pure Rust, WASM-safe)"
7
+
8
+ [dependencies]
9
+ k256 = { version = "0.13", features = ["ecdsa", "sha2"] }
10
+ alloy-primitives = { workspace = true }
11
+
12
+ [dev-dependencies]
13
+ hex = "0.4"
@@ -1,105 +1,105 @@
1
- //! Ethereum address derivation (pubkey → Keccak last 20) and ECDSA over secp256k1 (k256).
2
-
3
- use alloy_primitives::{keccak256, Address};
4
- use k256::ecdsa::signature::hazmat::PrehashVerifier;
5
- use k256::ecdsa::{RecoveryId, Signature, SigningKey, VerifyingKey};
6
-
7
- /// Uncompressed public key as 64 bytes (x || y), without the `0x04` prefix.
8
- pub fn derive_public_key(private_key_bytes: &[u8]) -> Result<Vec<u8>, String> {
9
- if private_key_bytes.len() != 32 {
10
- return Err("private key must be 32 bytes".into());
11
- }
12
- let sk = SigningKey::from_slice(private_key_bytes).map_err(|e| e.to_string())?;
13
- let vk = VerifyingKey::from(&sk);
14
- let encoded = vk.to_encoded_point(false);
15
- let bytes = encoded.as_bytes();
16
- if bytes.len() != 65 || bytes[0] != 0x04 {
17
- return Err("invalid uncompressed public key encoding".into());
18
- }
19
- Ok(bytes[1..].to_vec())
20
- }
21
-
22
- /// `0x` + 20-byte Ethereum address (Keccak-256 of 64-byte pubkey, last 20 bytes), EIP-55 checksummed.
23
- pub fn derive_ethereum_address(private_key_bytes: &[u8]) -> Result<String, String> {
24
- let pk64 = derive_public_key(private_key_bytes)?;
25
- let digest = keccak256(pk64.as_slice());
26
- let addr = Address::from_slice(&digest[12..]);
27
- Ok(addr.to_checksum(None))
28
- }
29
-
30
- /// ECDSA sign a 32-byte message hash; returns 65 bytes: r (32) || s (32) || recovery_id (0–3).
31
- pub fn sign_ecdsa(private_key_bytes: &[u8], message_hash: &[u8]) -> Result<Vec<u8>, String> {
32
- if message_hash.len() != 32 {
33
- return Err("message hash must be 32 bytes".into());
34
- }
35
- let sk = SigningKey::from_slice(private_key_bytes).map_err(|e| e.to_string())?;
36
- let (sig, recid) = sk
37
- .sign_prehash_recoverable(message_hash)
38
- .map_err(|e| e.to_string())?;
39
- let mut out = Vec::with_capacity(65);
40
- out.extend_from_slice(&sig.to_bytes());
41
- out.push(recid.to_byte());
42
- Ok(out)
43
- }
44
-
45
- /// Verify ECDSA over a 32-byte prehash. `public_key_bytes` is 64-byte uncompressed x||y (no prefix).
46
- /// `signature` is 65 bytes (r||s||v) or 64 bytes (r||s) using the given public key.
47
- pub fn verify_ecdsa(
48
- public_key_bytes: &[u8],
49
- message_hash: &[u8],
50
- signature: &[u8],
51
- ) -> Result<bool, String> {
52
- if message_hash.len() != 32 {
53
- return Err("message hash must be 32 bytes".into());
54
- }
55
- if public_key_bytes.len() != 64 {
56
- return Err("public key must be 64 bytes (uncompressed x||y, no 0x04 prefix)".into());
57
- }
58
- let mut sec1 = Vec::with_capacity(65);
59
- sec1.push(0x04);
60
- sec1.extend_from_slice(public_key_bytes);
61
- let vk = VerifyingKey::from_sec1_bytes(&sec1).map_err(|e| e.to_string())?;
62
-
63
- match signature.len() {
64
- 65 => {
65
- let sig = Signature::try_from(&signature[..64]).map_err(|e| e.to_string())?;
66
- let recid = RecoveryId::try_from(signature[64])
67
- .map_err(|_| "invalid recovery id (expected 0–3)".to_string())?;
68
- let recovered = VerifyingKey::recover_from_prehash(message_hash, &sig, recid)
69
- .map_err(|e| e.to_string())?;
70
- Ok(recovered == vk)
71
- }
72
- 64 => {
73
- let sig = Signature::try_from(signature).map_err(|e| e.to_string())?;
74
- vk.verify_prehash(message_hash, &sig)
75
- .map(|_| true)
76
- .map_err(|e| e.to_string())
77
- }
78
- _ => Err("signature must be 64 or 65 bytes".into()),
79
- }
80
- }
81
-
82
- #[cfg(test)]
83
- mod tests {
84
- use super::*;
85
-
86
- /// Hardhat / Foundry default account #0
87
- const HH0_SK: &str = "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
88
- const HH0_ADDR: &str = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266";
89
-
90
- #[test]
91
- fn hardhat_account_0_address() {
92
- let sk = hex::decode(HH0_SK).unwrap();
93
- let addr = derive_ethereum_address(&sk).unwrap();
94
- assert_eq!(addr.to_lowercase(), HH0_ADDR.to_lowercase());
95
- }
96
-
97
- #[test]
98
- fn sign_and_verify_roundtrip() {
99
- let sk = hex::decode(HH0_SK).unwrap();
100
- let pk = derive_public_key(&sk).unwrap();
101
- let msg_hash = keccak256(b"hello clawpowers");
102
- let sig = sign_ecdsa(&sk, msg_hash.as_slice()).unwrap();
103
- assert!(verify_ecdsa(&pk, msg_hash.as_slice(), &sig).unwrap());
104
- }
105
- }
1
+ //! Ethereum address derivation (pubkey → Keccak last 20) and ECDSA over secp256k1 (k256).
2
+
3
+ use alloy_primitives::{keccak256, Address};
4
+ use k256::ecdsa::signature::hazmat::PrehashVerifier;
5
+ use k256::ecdsa::{RecoveryId, Signature, SigningKey, VerifyingKey};
6
+
7
+ /// Uncompressed public key as 64 bytes (x || y), without the `0x04` prefix.
8
+ pub fn derive_public_key(private_key_bytes: &[u8]) -> Result<Vec<u8>, String> {
9
+ if private_key_bytes.len() != 32 {
10
+ return Err("private key must be 32 bytes".into());
11
+ }
12
+ let sk = SigningKey::from_slice(private_key_bytes).map_err(|e| e.to_string())?;
13
+ let vk = VerifyingKey::from(&sk);
14
+ let encoded = vk.to_encoded_point(false);
15
+ let bytes = encoded.as_bytes();
16
+ if bytes.len() != 65 || bytes[0] != 0x04 {
17
+ return Err("invalid uncompressed public key encoding".into());
18
+ }
19
+ Ok(bytes[1..].to_vec())
20
+ }
21
+
22
+ /// `0x` + 20-byte Ethereum address (Keccak-256 of 64-byte pubkey, last 20 bytes), EIP-55 checksummed.
23
+ pub fn derive_ethereum_address(private_key_bytes: &[u8]) -> Result<String, String> {
24
+ let pk64 = derive_public_key(private_key_bytes)?;
25
+ let digest = keccak256(pk64.as_slice());
26
+ let addr = Address::from_slice(&digest[12..]);
27
+ Ok(addr.to_checksum(None))
28
+ }
29
+
30
+ /// ECDSA sign a 32-byte message hash; returns 65 bytes: r (32) || s (32) || recovery_id (0–3).
31
+ pub fn sign_ecdsa(private_key_bytes: &[u8], message_hash: &[u8]) -> Result<Vec<u8>, String> {
32
+ if message_hash.len() != 32 {
33
+ return Err("message hash must be 32 bytes".into());
34
+ }
35
+ let sk = SigningKey::from_slice(private_key_bytes).map_err(|e| e.to_string())?;
36
+ let (sig, recid) = sk
37
+ .sign_prehash_recoverable(message_hash)
38
+ .map_err(|e| e.to_string())?;
39
+ let mut out = Vec::with_capacity(65);
40
+ out.extend_from_slice(&sig.to_bytes());
41
+ out.push(recid.to_byte());
42
+ Ok(out)
43
+ }
44
+
45
+ /// Verify ECDSA over a 32-byte prehash. `public_key_bytes` is 64-byte uncompressed x||y (no prefix).
46
+ /// `signature` is 65 bytes (r||s||v) or 64 bytes (r||s) using the given public key.
47
+ pub fn verify_ecdsa(
48
+ public_key_bytes: &[u8],
49
+ message_hash: &[u8],
50
+ signature: &[u8],
51
+ ) -> Result<bool, String> {
52
+ if message_hash.len() != 32 {
53
+ return Err("message hash must be 32 bytes".into());
54
+ }
55
+ if public_key_bytes.len() != 64 {
56
+ return Err("public key must be 64 bytes (uncompressed x||y, no 0x04 prefix)".into());
57
+ }
58
+ let mut sec1 = Vec::with_capacity(65);
59
+ sec1.push(0x04);
60
+ sec1.extend_from_slice(public_key_bytes);
61
+ let vk = VerifyingKey::from_sec1_bytes(&sec1).map_err(|e| e.to_string())?;
62
+
63
+ match signature.len() {
64
+ 65 => {
65
+ let sig = Signature::try_from(&signature[..64]).map_err(|e| e.to_string())?;
66
+ let recid = RecoveryId::try_from(signature[64])
67
+ .map_err(|_| "invalid recovery id (expected 0–3)".to_string())?;
68
+ let recovered = VerifyingKey::recover_from_prehash(message_hash, &sig, recid)
69
+ .map_err(|e| e.to_string())?;
70
+ Ok(recovered == vk)
71
+ }
72
+ 64 => {
73
+ let sig = Signature::try_from(signature).map_err(|e| e.to_string())?;
74
+ vk.verify_prehash(message_hash, &sig)
75
+ .map(|_| true)
76
+ .map_err(|e| e.to_string())
77
+ }
78
+ _ => Err("signature must be 64 or 65 bytes".into()),
79
+ }
80
+ }
81
+
82
+ #[cfg(test)]
83
+ mod tests {
84
+ use super::*;
85
+
86
+ /// Hardhat / Foundry default account #0
87
+ const HH0_SK: &str = "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
88
+ const HH0_ADDR: &str = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266";
89
+
90
+ #[test]
91
+ fn hardhat_account_0_address() {
92
+ let sk = hex::decode(HH0_SK).unwrap();
93
+ let addr = derive_ethereum_address(&sk).unwrap();
94
+ assert_eq!(addr.to_lowercase(), HH0_ADDR.to_lowercase());
95
+ }
96
+
97
+ #[test]
98
+ fn sign_and_verify_roundtrip() {
99
+ let sk = hex::decode(HH0_SK).unwrap();
100
+ let pk = derive_public_key(&sk).unwrap();
101
+ let msg_hash = keccak256(b"hello clawpowers");
102
+ let sig = sign_ecdsa(&sk, msg_hash.as_slice()).unwrap();
103
+ assert!(verify_ecdsa(&pk, msg_hash.as_slice(), &sig).unwrap());
104
+ }
105
+ }
@@ -1,15 +1,15 @@
1
- [package]
2
- name = "clawpowers-fee"
3
- version.workspace = true
4
- edition.workspace = true
5
- license.workspace = true
6
-
7
- [dependencies]
8
- serde = { workspace = true }
9
- serde_json = { workspace = true }
10
- thiserror = { workspace = true }
11
- tracing = { workspace = true }
12
- alloy-primitives = { workspace = true }
13
- clawpowers-tokens = { path = "../tokens" }
14
-
15
- [dev-dependencies]
1
+ [package]
2
+ name = "clawpowers-fee"
3
+ version.workspace = true
4
+ edition.workspace = true
5
+ license.workspace = true
6
+
7
+ [dependencies]
8
+ serde = { workspace = true }
9
+ serde_json = { workspace = true }
10
+ thiserror = { workspace = true }
11
+ tracing = { workspace = true }
12
+ alloy-primitives = { workspace = true }
13
+ clawpowers-tokens = { path = "../tokens" }
14
+
15
+ [dev-dependencies]