openclaw-nostr 2026.7.30

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 (72) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/README.md +845 -0
  3. package/api.ts +6 -0
  4. package/index.ts +69 -0
  5. package/node_modules/cascadia-ts/cascadia.ts +1187 -0
  6. package/node_modules/cascadia-ts/dist/cascadia.d.ts +607 -0
  7. package/node_modules/cascadia-ts/dist/cascadia.js +705 -0
  8. package/node_modules/cascadia-ts/package.json +21 -0
  9. package/openclaw.plugin.json +153 -0
  10. package/package.json +81 -0
  11. package/runtime-api.ts +12 -0
  12. package/setup-api.ts +1 -0
  13. package/setup-entry.ts +4 -0
  14. package/src/channel-actions.test.ts +304 -0
  15. package/src/channel-actions.ts +199 -0
  16. package/src/channel.dm-access.test.ts +387 -0
  17. package/src/channel.inbound.test.ts +476 -0
  18. package/src/channel.lifecycle.test.ts +768 -0
  19. package/src/channel.outbound.test.ts +1143 -0
  20. package/src/channel.test.ts +175 -0
  21. package/src/channel.ts +2827 -0
  22. package/src/config-schema.test.ts +486 -0
  23. package/src/config-schema.ts +356 -0
  24. package/src/default-relays.ts +1 -0
  25. package/src/fleet-agent.test.ts +423 -0
  26. package/src/fleet-agent.ts +549 -0
  27. package/src/metrics.ts +466 -0
  28. package/src/nip46-cutover.test.ts +324 -0
  29. package/src/nip46-cutover.ts +461 -0
  30. package/src/nip46-doctor.test.ts +191 -0
  31. package/src/nip46-doctor.ts +329 -0
  32. package/src/nip46-enroll.test.ts +346 -0
  33. package/src/nip46-enroll.ts +567 -0
  34. package/src/nip46-signer.test.ts +809 -0
  35. package/src/nip46-signer.ts +1263 -0
  36. package/src/nip46-status.test.ts +186 -0
  37. package/src/nip46-status.ts +250 -0
  38. package/src/nip51-lists.test.ts +404 -0
  39. package/src/nip51-lists.ts +777 -0
  40. package/src/nostr-access.test.ts +175 -0
  41. package/src/nostr-access.ts +134 -0
  42. package/src/nostr-bus-nip29.ts +998 -0
  43. package/src/nostr-bus-relay.ts +477 -0
  44. package/src/nostr-bus-types.ts +392 -0
  45. package/src/nostr-bus.fuzz.test.ts +533 -0
  46. package/src/nostr-bus.integration.test.ts +505 -0
  47. package/src/nostr-bus.protocol.test.ts +2057 -0
  48. package/src/nostr-bus.test.ts +235 -0
  49. package/src/nostr-bus.ts +1868 -0
  50. package/src/nostr-capabilities-extended.test.ts +612 -0
  51. package/src/nostr-capabilities.ts +719 -0
  52. package/src/nostr-discovery.test.ts +568 -0
  53. package/src/nostr-discovery.ts +336 -0
  54. package/src/nostr-extras.test.ts +88 -0
  55. package/src/nostr-extras.ts +136 -0
  56. package/src/nostr-profile-http.test.ts +662 -0
  57. package/src/nostr-profile-http.ts +836 -0
  58. package/src/nostr-profile-import.test.ts +274 -0
  59. package/src/nostr-profile-import.ts +295 -0
  60. package/src/nostr-profile.fuzz.test.ts +480 -0
  61. package/src/nostr-profile.test.ts +410 -0
  62. package/src/nostr-profile.ts +320 -0
  63. package/src/nostr-pubkey.ts +56 -0
  64. package/src/nostr-state-store.test.ts +790 -0
  65. package/src/nostr-state-store.ts +1284 -0
  66. package/src/runtime.ts +9 -0
  67. package/src/seen-tracker.test.ts +25 -0
  68. package/src/seen-tracker.ts +292 -0
  69. package/src/session-route.ts +25 -0
  70. package/src/setup-surface.ts +320 -0
  71. package/src/types.test.ts +783 -0
  72. package/src/types.ts +508 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,183 @@
1
+ # Changelog
2
+
3
+ ## Unreleased (Cascadia Fork)
4
+
5
+ ### Packaging
6
+ - Split the scanner-clean `openclaw-nostr` runtime plugin from the optional `openclaw-nostr-bootstrap` legacy migration CLI. Normal installs now use `openclaw plugins install npm:openclaw-nostr`; bootstrap scripts and process-spawning imports are excluded from the plugin tarball.
7
+ - Added a CI guard that stages the declared runtime package files and invokes OpenClaw's real hash-named install scanner, requiring zero critical findings when the internal scanner module is available.
8
+
9
+ ### Fixes — DM Delivery & Relay Connections
10
+ - **Seen-list gating on delivery confirmation (ocn-zi7)**: an inbound DM is now durably marked seen only after the agent dispatch succeeds — including the relay OK on the reply send. Model timeouts and NIP-46 signer failures no longer blacklist a DM without a response; failed events are rolled back and retried via relay redelivery.
11
+ - **Bounded redispatch retries (ocn-8kh)**: failure rollbacks are backoff-delayed (30s/2m/5m) and capped at 3 attempts per process lifetime; the give-up mark is in-memory only so a gateway restart retries the DM.
12
+ - **Persistent relay connections (ocn-nu0)**: pinned nostr-tools to 2.23.3 — 2.23.x patch releases introduced a default 20s relay idle reaper plus a `<forced-ping>` accounting bug that tore down healthy DM subscriptions every ~78s ("relay connection closed by us" loop). Pools now also use the `ws` WebSocket implementation for real protocol-level ping/pong (no more dummy-REQ keepalive every 29s) and disable the idle reaper defensively. DM pool reverted to `enableReconnect: false` so reconnects always re-REQ from the jitter-safe `since` anchor (NIP-59 ±48h) instead of nostr-tools' `lastEmitted + 1`.
13
+
14
+ ### Features — NIP Implementations
15
+
16
+ #### Tier 1: Agent-Essential
17
+ - **NIP-05**: Identity resolution with 5-min TTL caching (500-entry LRU), domain search, validation
18
+ - **NIP-11**: Relay information documents with 10-min TTL caching (100-entry LRU), capability summaries, NIP filtering
19
+ - **NIP-42**: Relay authentication (`makeAuthEvent` re-export from nostr-tools)
20
+ - **NIP-46**: Remote signing / Nostr Connect (`BunkerSigner`, `parseBunkerInput`, `createNostrConnectURI`)
21
+ - **NIP-57**: Zap utilities (`makeZapRequest`, `validateZapRequest`, `getSatoshisAmountFromBolt11`)
22
+ - **NIP-94**: File metadata — kind:1063 event builder, parser, and validator
23
+ - **NIP-98**: HTTP authentication token generation and validation
24
+ - **NIP-B7**: Blossom media server client re-export
25
+
26
+ #### Tier 2: Social & Channel
27
+ - **NIP-13**: Proof of Work (`minePow`, `getPow` re-exports)
28
+ - **NIP-18**: Reposts — kind:6 for short text notes, kind:16 for generic events, with NIP-70 protected event handling
29
+ - **NIP-27**: Content block parsing (text, URLs, nostr: references, media, hashtags, emoji)
30
+ - **NIP-28**: Public channels — create (kind:40), message (kind:42), hide message (kind:43), mute user (kind:44)
31
+ - **NIP-44**: Versioned encryption — conversation key derivation, encrypt/decrypt
32
+
33
+ #### Tier 3: Niche (Namespace Re-exports)
34
+ - **NIP-29**: Relay-based groups
35
+ - **NIP-30**: Custom emoji matching
36
+ - **NIP-39**: External identity verification
37
+ - **NIP-47**: Nostr Wallet Connect
38
+ - **NIP-49**: Private key encryption (ncryptsec)
39
+ - **NIP-58**: Badges
40
+ - **NIP-75**: Zap goals (fundraising)
41
+ - **NIP-77**: Negentropy sync
42
+
43
+ ### Architecture
44
+ - New `nostr-discovery.ts` module — NIP-05/NIP-11/NIP-27 with caching and agent-friendly interfaces
45
+ - New `nostr-extras.ts` module — Tier 3 namespace re-exports
46
+ - Extended `nostr-capabilities.ts` with 15 new builder functions and re-exports
47
+ - Extended `nostr-bus.ts` with 17 new handle methods
48
+ - Extended `channel.ts` with 10 new convenience functions
49
+ - Extended `nostr-profile-http.ts` with 3 new HTTP endpoints (identity, search, relay-info)
50
+
51
+ ### Testing
52
+ - `nostr-discovery.test.ts` — 40+ tests for NIP-05/NIP-11/NIP-27
53
+ - `nostr-capabilities-extended.test.ts` — 28 tests for NIP-18/28/94/13/44/57/42/98
54
+ - `nostr-extras.test.ts` — 9 smoke tests for Tier 3 re-export surface
55
+ - Extended `nostr-profile-http.test.ts` with 7 new endpoint tests
56
+
57
+ ### Earlier Changes (this fork)
58
+ - NIP-17 gift-wrapped DM support (kind:1059) with NIP-59 seals
59
+ - Per-sender message serialization (race condition fix)
60
+ - Provider lifecycle fix (stay resident until abort signal)
61
+ - nostr-tools reconnect fix
62
+ - Full SDK alignment with OpenClaw plugin interface
63
+
64
+ ## 2026.3.14
65
+
66
+ ### Changes
67
+
68
+ - Version alignment with core OpenClaw release numbers.
69
+
70
+ ## 2026.3.13
71
+
72
+ ### Changes
73
+
74
+ - Version alignment with core OpenClaw release numbers.
75
+
76
+ ## 2026.3.12
77
+
78
+ ### Changes
79
+
80
+ - Version alignment with core OpenClaw release numbers.
81
+
82
+ ## 2026.3.11
83
+
84
+ ### Changes
85
+
86
+ - Version alignment with core OpenClaw release numbers.
87
+
88
+ ## 2026.3.10
89
+
90
+ ### Changes
91
+
92
+ - Version alignment with core OpenClaw release numbers.
93
+
94
+ ## 2026.3.9
95
+
96
+ ### Changes
97
+
98
+ - Version alignment with core OpenClaw release numbers.
99
+
100
+ ## 2026.3.8-beta.1
101
+
102
+ ### Changes
103
+
104
+ - Version alignment with core OpenClaw release numbers.
105
+
106
+ ## 2026.3.8
107
+
108
+ ### Changes
109
+
110
+ - Version alignment with core OpenClaw release numbers.
111
+
112
+ ## 2026.3.7
113
+
114
+ ### Changes
115
+
116
+ - Version alignment with core OpenClaw release numbers.
117
+
118
+ ## 2026.3.3
119
+
120
+ ### Changes
121
+
122
+ - Version alignment with core OpenClaw release numbers.
123
+
124
+ ## 2026.3.2
125
+
126
+ ### Changes
127
+
128
+ - Version alignment with core OpenClaw release numbers.
129
+
130
+ ## 2026.3.1
131
+
132
+ ### Changes
133
+
134
+ - Version alignment with core OpenClaw release numbers.
135
+
136
+ ## 2026.2.26
137
+
138
+ ### Changes
139
+
140
+ - Version alignment with core OpenClaw release numbers.
141
+
142
+ ## 2026.2.25
143
+
144
+ ### Changes
145
+
146
+ - Version alignment with core OpenClaw release numbers.
147
+
148
+ ## 2026.2.24
149
+
150
+ ### Changes
151
+
152
+ - Version alignment with core OpenClaw release numbers.
153
+
154
+ ## 2026.2.22
155
+
156
+ ### Changes
157
+
158
+ - Version alignment with core OpenClaw release numbers.
159
+
160
+ ## 2026.1.19-1
161
+
162
+ Initial release.
163
+
164
+ ### Features
165
+
166
+ - NIP-04 encrypted DM support (kind:4 events)
167
+ - Key validation (hex and nsec formats)
168
+ - Multi-relay support with sequential fallback
169
+ - Event signature verification
170
+ - TTL-based deduplication (24h)
171
+ - Access control via dmPolicy (pairing, allowlist, open, disabled)
172
+ - Pubkey normalization (hex/npub)
173
+
174
+ ### Protocol Support
175
+
176
+ - NIP-01: Basic event structure
177
+ - NIP-04: Encrypted direct messages
178
+
179
+ ### Planned for v2
180
+
181
+ - NIP-17: Gift-wrapped DMs
182
+ - NIP-44: Versioned encryption
183
+ - Media attachments