@openclaw/nostr 2026.7.1 → 2026.7.2-beta.2
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.
- package/dist/api.js +35 -61
- package/dist/{channel-B2Y66pl3.js → channel-B51rExHD.js} +76 -124
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{config-schema-DIiXiBKr.js → config-schema-CelPzg1N.js} +1 -1
- package/dist/setup-api.js +1 -1
- package/dist/setup-plugin-api.js +2 -2
- package/dist/{setup-surface-CKamwGa3.js → setup-surface-B52P4uo2.js} +16 -28
- package/npm-shrinkwrap.json +3 -3
- package/package.json +4 -4
package/dist/api.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { o as resolveNostrAccount } from "./setup-surface-
|
|
1
|
+
import { o as resolveNostrAccount } from "./setup-surface-B52P4uo2.js";
|
|
2
2
|
import { getPluginRuntimeGatewayRequestScope } from "./runtime-api.js";
|
|
3
|
-
import { n as NostrProfileSchema } from "./config-schema-
|
|
4
|
-
import { a as setNostrRuntime, i as getNostrRuntime, n as nostrPlugin, o as contentToProfile, r as publishNostrProfile, t as getNostrProfileState } from "./channel-
|
|
3
|
+
import { n as NostrProfileSchema } from "./config-schema-CelPzg1N.js";
|
|
4
|
+
import { a as setNostrRuntime, i as getNostrRuntime, n as nostrPlugin, o as contentToProfile, r as publishNostrProfile, t as getNostrProfileState } from "./channel-B51rExHD.js";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
import { SimplePool
|
|
7
|
+
import { SimplePool } from "nostr-tools";
|
|
8
8
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
9
9
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
10
10
|
import { readJsonBodyWithLimit, requestBodyErrorToText } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
@@ -79,69 +79,42 @@ async function importProfileFromRelays(opts) {
|
|
|
79
79
|
relaysQueried: []
|
|
80
80
|
};
|
|
81
81
|
const pool = new SimplePool();
|
|
82
|
-
const relaysQueried = [];
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
82
|
+
const relaysQueried = [...relays];
|
|
83
|
+
let deadlineTimer;
|
|
84
|
+
const deadline = new Promise((resolve) => {
|
|
85
|
+
deadlineTimer = setTimeout(resolve, timeoutMs);
|
|
86
|
+
deadlineTimer.unref?.();
|
|
87
|
+
});
|
|
88
|
+
const subscriptions = [];
|
|
90
89
|
try {
|
|
91
90
|
const events = [];
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (completed >= relays.length) resolve();
|
|
114
|
-
},
|
|
115
|
-
onclose() {
|
|
116
|
-
completed++;
|
|
117
|
-
if (completed >= relays.length) resolve();
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
scheduleTimeout(() => {
|
|
121
|
-
sub.close();
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
await Promise.race([subscriptionPromise, timeoutPromise]);
|
|
126
|
-
for (const timer of timers.splice(0)) clearTimeout(timer);
|
|
91
|
+
await Promise.race([Promise.all(relays.map((relay) => new Promise((resolve) => {
|
|
92
|
+
const subscription = pool.subscribeMany([relay], {
|
|
93
|
+
kinds: [0],
|
|
94
|
+
authors: [pubkey],
|
|
95
|
+
limit: 1
|
|
96
|
+
}, {
|
|
97
|
+
onevent(event) {
|
|
98
|
+
events.push({
|
|
99
|
+
event,
|
|
100
|
+
relay
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
oneose() {
|
|
104
|
+
resolve();
|
|
105
|
+
},
|
|
106
|
+
onclose() {
|
|
107
|
+
resolve();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
subscriptions.push(subscription);
|
|
111
|
+
}))), deadline]);
|
|
127
112
|
if (events.length === 0) return {
|
|
128
113
|
ok: false,
|
|
129
114
|
error: "No profile found on any relay",
|
|
130
115
|
relaysQueried
|
|
131
116
|
};
|
|
132
|
-
|
|
133
|
-
for (const item of events) if (!bestEvent || item.event.created_at > bestEvent.event.created_at) bestEvent = item;
|
|
134
|
-
if (!bestEvent) return {
|
|
135
|
-
ok: false,
|
|
136
|
-
error: "No valid profile event found",
|
|
137
|
-
relaysQueried
|
|
138
|
-
};
|
|
139
|
-
if (!verifyEvent(bestEvent.event)) return {
|
|
140
|
-
ok: false,
|
|
141
|
-
error: "Profile event has invalid signature",
|
|
142
|
-
relaysQueried,
|
|
143
|
-
sourceRelay: bestEvent.relay
|
|
144
|
-
};
|
|
117
|
+
const bestEvent = events.reduce((current, candidate) => candidate.event.created_at > current.event.created_at ? candidate : current);
|
|
145
118
|
let content;
|
|
146
119
|
try {
|
|
147
120
|
content = JSON.parse(bestEvent.event.content);
|
|
@@ -165,7 +138,8 @@ async function importProfileFromRelays(opts) {
|
|
|
165
138
|
sourceRelay: bestEvent.relay
|
|
166
139
|
};
|
|
167
140
|
} finally {
|
|
168
|
-
|
|
141
|
+
if (deadlineTimer) clearTimeout(deadlineTimer);
|
|
142
|
+
for (const subscription of subscriptions) subscription.close();
|
|
169
143
|
pool.close(relays);
|
|
170
144
|
}
|
|
171
145
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as resolveDefaultNostrAccountId, c as validatePrivateKey, i as listNostrAccountIds, n as nostrSetupWizard, o as resolveNostrAccount, s as normalizePubkey, t as nostrSetupAdapter } from "./setup-surface-
|
|
2
|
-
import { a as collectStatusIssuesFromLastError, i as buildChannelConfigSchema, n as NostrProfileSchema, o as createDefaultChannelRuntimeState, r as DEFAULT_ACCOUNT_ID, s as formatPairingApproveHint, t as NostrConfigSchema } from "./config-schema-
|
|
1
|
+
import { a as resolveDefaultNostrAccountId, c as validatePrivateKey, i as listNostrAccountIds, n as nostrSetupWizard, o as resolveNostrAccount, s as normalizePubkey, t as nostrSetupAdapter } from "./setup-surface-B52P4uo2.js";
|
|
2
|
+
import { a as collectStatusIssuesFromLastError, i as buildChannelConfigSchema, n as NostrProfileSchema, o as createDefaultChannelRuntimeState, r as DEFAULT_ACCOUNT_ID, s as formatPairingApproveHint, t as NostrConfigSchema } from "./config-schema-CelPzg1N.js";
|
|
3
3
|
import { i as DEFAULT_RELAYS } from "./setup-adapter-DEU3o8MF.js";
|
|
4
4
|
import { t as normalizeNostrStateAccountId } from "./state-account-id-CvBZ9s6P.js";
|
|
5
5
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
@@ -20,41 +20,62 @@ import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
|
20
20
|
import { resolveIntegerOption, resolvePositiveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
21
21
|
import { buildChannelOutboundSessionRoute, stripChannelTargetPrefix } from "openclaw/plugin-sdk/core";
|
|
22
22
|
//#region extensions/nostr/src/metrics.ts
|
|
23
|
+
function createZeroMetricsState() {
|
|
24
|
+
return {
|
|
25
|
+
eventsReceived: 0,
|
|
26
|
+
eventsProcessed: 0,
|
|
27
|
+
eventsDuplicate: 0,
|
|
28
|
+
eventsRejected: {
|
|
29
|
+
invalidShape: 0,
|
|
30
|
+
wrongKind: 0,
|
|
31
|
+
stale: 0,
|
|
32
|
+
future: 0,
|
|
33
|
+
rateLimited: 0,
|
|
34
|
+
invalidSignature: 0,
|
|
35
|
+
oversizedCiphertext: 0,
|
|
36
|
+
oversizedPlaintext: 0,
|
|
37
|
+
decryptFailed: 0,
|
|
38
|
+
selfMessage: 0
|
|
39
|
+
},
|
|
40
|
+
relays: /* @__PURE__ */ new Map(),
|
|
41
|
+
rateLimiting: {
|
|
42
|
+
perSenderHits: 0,
|
|
43
|
+
globalHits: 0
|
|
44
|
+
},
|
|
45
|
+
decrypt: {
|
|
46
|
+
success: 0,
|
|
47
|
+
failure: 0
|
|
48
|
+
},
|
|
49
|
+
memory: {
|
|
50
|
+
seenTrackerSize: 0,
|
|
51
|
+
rateLimiterEntries: 0
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function createMetricsSnapshot(state, snapshotAt) {
|
|
56
|
+
const relays = {};
|
|
57
|
+
for (const [url, stats] of state.relays) relays[url] = {
|
|
58
|
+
...stats,
|
|
59
|
+
messagesReceived: { ...stats.messagesReceived }
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
...state,
|
|
63
|
+
eventsRejected: { ...state.eventsRejected },
|
|
64
|
+
relays,
|
|
65
|
+
rateLimiting: { ...state.rateLimiting },
|
|
66
|
+
decrypt: { ...state.decrypt },
|
|
67
|
+
memory: { ...state.memory },
|
|
68
|
+
snapshotAt: snapshotAt ?? Date.now()
|
|
69
|
+
};
|
|
70
|
+
}
|
|
23
71
|
/**
|
|
24
72
|
* Create a metrics collector instance.
|
|
25
73
|
* Optionally pass an onMetric callback to receive real-time metric events.
|
|
26
74
|
*/
|
|
27
75
|
function createMetrics(onMetric) {
|
|
28
|
-
let
|
|
29
|
-
let eventsProcessed = 0;
|
|
30
|
-
let eventsDuplicate = 0;
|
|
31
|
-
const eventsRejected = {
|
|
32
|
-
invalidShape: 0,
|
|
33
|
-
wrongKind: 0,
|
|
34
|
-
stale: 0,
|
|
35
|
-
future: 0,
|
|
36
|
-
rateLimited: 0,
|
|
37
|
-
invalidSignature: 0,
|
|
38
|
-
oversizedCiphertext: 0,
|
|
39
|
-
oversizedPlaintext: 0,
|
|
40
|
-
decryptFailed: 0,
|
|
41
|
-
selfMessage: 0
|
|
42
|
-
};
|
|
43
|
-
const relays = /* @__PURE__ */ new Map();
|
|
44
|
-
const rateLimiting = {
|
|
45
|
-
perSenderHits: 0,
|
|
46
|
-
globalHits: 0
|
|
47
|
-
};
|
|
48
|
-
const decrypt = {
|
|
49
|
-
success: 0,
|
|
50
|
-
failure: 0
|
|
51
|
-
};
|
|
52
|
-
const memory = {
|
|
53
|
-
seenTrackerSize: 0,
|
|
54
|
-
rateLimiterEntries: 0
|
|
55
|
-
};
|
|
76
|
+
let state = createZeroMetricsState();
|
|
56
77
|
function getOrCreateRelay(url) {
|
|
57
|
-
let relay = relays.get(url);
|
|
78
|
+
let relay = state.relays.get(url);
|
|
58
79
|
if (!relay) {
|
|
59
80
|
relay = {
|
|
60
81
|
connects: 0,
|
|
@@ -73,7 +94,7 @@ function createMetrics(onMetric) {
|
|
|
73
94
|
circuitBreakerOpens: 0,
|
|
74
95
|
circuitBreakerCloses: 0
|
|
75
96
|
};
|
|
76
|
-
relays.set(url, relay);
|
|
97
|
+
state.relays.set(url, relay);
|
|
77
98
|
}
|
|
78
99
|
return relay;
|
|
79
100
|
}
|
|
@@ -87,43 +108,43 @@ function createMetrics(onMetric) {
|
|
|
87
108
|
const relayUrl = labels?.relay;
|
|
88
109
|
switch (name) {
|
|
89
110
|
case "event.received":
|
|
90
|
-
eventsReceived += value;
|
|
111
|
+
state.eventsReceived += value;
|
|
91
112
|
break;
|
|
92
113
|
case "event.processed":
|
|
93
|
-
eventsProcessed += value;
|
|
114
|
+
state.eventsProcessed += value;
|
|
94
115
|
break;
|
|
95
116
|
case "event.duplicate":
|
|
96
|
-
eventsDuplicate += value;
|
|
117
|
+
state.eventsDuplicate += value;
|
|
97
118
|
break;
|
|
98
119
|
case "event.rejected.invalid_shape":
|
|
99
|
-
eventsRejected.invalidShape += value;
|
|
120
|
+
state.eventsRejected.invalidShape += value;
|
|
100
121
|
break;
|
|
101
122
|
case "event.rejected.wrong_kind":
|
|
102
|
-
eventsRejected.wrongKind += value;
|
|
123
|
+
state.eventsRejected.wrongKind += value;
|
|
103
124
|
break;
|
|
104
125
|
case "event.rejected.stale":
|
|
105
|
-
eventsRejected.stale += value;
|
|
126
|
+
state.eventsRejected.stale += value;
|
|
106
127
|
break;
|
|
107
128
|
case "event.rejected.future":
|
|
108
|
-
eventsRejected.future += value;
|
|
129
|
+
state.eventsRejected.future += value;
|
|
109
130
|
break;
|
|
110
131
|
case "event.rejected.rate_limited":
|
|
111
|
-
eventsRejected.rateLimited += value;
|
|
132
|
+
state.eventsRejected.rateLimited += value;
|
|
112
133
|
break;
|
|
113
134
|
case "event.rejected.invalid_signature":
|
|
114
|
-
eventsRejected.invalidSignature += value;
|
|
135
|
+
state.eventsRejected.invalidSignature += value;
|
|
115
136
|
break;
|
|
116
137
|
case "event.rejected.oversized_ciphertext":
|
|
117
|
-
eventsRejected.oversizedCiphertext += value;
|
|
138
|
+
state.eventsRejected.oversizedCiphertext += value;
|
|
118
139
|
break;
|
|
119
140
|
case "event.rejected.oversized_plaintext":
|
|
120
|
-
eventsRejected.oversizedPlaintext += value;
|
|
141
|
+
state.eventsRejected.oversizedPlaintext += value;
|
|
121
142
|
break;
|
|
122
143
|
case "event.rejected.decrypt_failed":
|
|
123
|
-
eventsRejected.decryptFailed += value;
|
|
144
|
+
state.eventsRejected.decryptFailed += value;
|
|
124
145
|
break;
|
|
125
146
|
case "event.rejected.self_message":
|
|
126
|
-
eventsRejected.selfMessage += value;
|
|
147
|
+
state.eventsRejected.selfMessage += value;
|
|
127
148
|
break;
|
|
128
149
|
case "relay.connect":
|
|
129
150
|
if (relayUrl) getOrCreateRelay(relayUrl).connects += value;
|
|
@@ -173,66 +194,30 @@ function createMetrics(onMetric) {
|
|
|
173
194
|
if (relayUrl) getOrCreateRelay(relayUrl).circuitBreakerState = "half_open";
|
|
174
195
|
break;
|
|
175
196
|
case "rate_limit.per_sender":
|
|
176
|
-
rateLimiting.perSenderHits += value;
|
|
197
|
+
state.rateLimiting.perSenderHits += value;
|
|
177
198
|
break;
|
|
178
199
|
case "rate_limit.global":
|
|
179
|
-
rateLimiting.globalHits += value;
|
|
200
|
+
state.rateLimiting.globalHits += value;
|
|
180
201
|
break;
|
|
181
202
|
case "decrypt.success":
|
|
182
|
-
decrypt.success += value;
|
|
203
|
+
state.decrypt.success += value;
|
|
183
204
|
break;
|
|
184
205
|
case "decrypt.failure":
|
|
185
|
-
decrypt.failure += value;
|
|
206
|
+
state.decrypt.failure += value;
|
|
186
207
|
break;
|
|
187
208
|
case "memory.seen_tracker_size":
|
|
188
|
-
memory.seenTrackerSize = value;
|
|
209
|
+
state.memory.seenTrackerSize = value;
|
|
189
210
|
break;
|
|
190
211
|
case "memory.rate_limiter_entries":
|
|
191
|
-
memory.rateLimiterEntries = value;
|
|
212
|
+
state.memory.rateLimiterEntries = value;
|
|
192
213
|
break;
|
|
193
214
|
}
|
|
194
215
|
}
|
|
195
216
|
function getSnapshot() {
|
|
196
|
-
|
|
197
|
-
for (const [url, stats] of relays) relaysObj[url] = {
|
|
198
|
-
...stats,
|
|
199
|
-
messagesReceived: { ...stats.messagesReceived }
|
|
200
|
-
};
|
|
201
|
-
return {
|
|
202
|
-
eventsReceived,
|
|
203
|
-
eventsProcessed,
|
|
204
|
-
eventsDuplicate,
|
|
205
|
-
eventsRejected: { ...eventsRejected },
|
|
206
|
-
relays: relaysObj,
|
|
207
|
-
rateLimiting: { ...rateLimiting },
|
|
208
|
-
decrypt: { ...decrypt },
|
|
209
|
-
memory: { ...memory },
|
|
210
|
-
snapshotAt: Date.now()
|
|
211
|
-
};
|
|
217
|
+
return createMetricsSnapshot(state);
|
|
212
218
|
}
|
|
213
219
|
function reset() {
|
|
214
|
-
|
|
215
|
-
eventsProcessed = 0;
|
|
216
|
-
eventsDuplicate = 0;
|
|
217
|
-
Object.assign(eventsRejected, {
|
|
218
|
-
invalidShape: 0,
|
|
219
|
-
wrongKind: 0,
|
|
220
|
-
stale: 0,
|
|
221
|
-
future: 0,
|
|
222
|
-
rateLimited: 0,
|
|
223
|
-
invalidSignature: 0,
|
|
224
|
-
oversizedCiphertext: 0,
|
|
225
|
-
oversizedPlaintext: 0,
|
|
226
|
-
decryptFailed: 0,
|
|
227
|
-
selfMessage: 0
|
|
228
|
-
});
|
|
229
|
-
relays.clear();
|
|
230
|
-
rateLimiting.perSenderHits = 0;
|
|
231
|
-
rateLimiting.globalHits = 0;
|
|
232
|
-
decrypt.success = 0;
|
|
233
|
-
decrypt.failure = 0;
|
|
234
|
-
memory.seenTrackerSize = 0;
|
|
235
|
-
memory.rateLimiterEntries = 0;
|
|
220
|
+
state = createZeroMetricsState();
|
|
236
221
|
}
|
|
237
222
|
return {
|
|
238
223
|
emit,
|
|
@@ -244,37 +229,7 @@ function createMetrics(onMetric) {
|
|
|
244
229
|
* Create a no-op metrics instance (for when metrics are disabled).
|
|
245
230
|
*/
|
|
246
231
|
function createNoopMetrics() {
|
|
247
|
-
const emptySnapshot =
|
|
248
|
-
eventsReceived: 0,
|
|
249
|
-
eventsProcessed: 0,
|
|
250
|
-
eventsDuplicate: 0,
|
|
251
|
-
eventsRejected: {
|
|
252
|
-
invalidShape: 0,
|
|
253
|
-
wrongKind: 0,
|
|
254
|
-
stale: 0,
|
|
255
|
-
future: 0,
|
|
256
|
-
rateLimited: 0,
|
|
257
|
-
invalidSignature: 0,
|
|
258
|
-
oversizedCiphertext: 0,
|
|
259
|
-
oversizedPlaintext: 0,
|
|
260
|
-
decryptFailed: 0,
|
|
261
|
-
selfMessage: 0
|
|
262
|
-
},
|
|
263
|
-
relays: {},
|
|
264
|
-
rateLimiting: {
|
|
265
|
-
perSenderHits: 0,
|
|
266
|
-
globalHits: 0
|
|
267
|
-
},
|
|
268
|
-
decrypt: {
|
|
269
|
-
success: 0,
|
|
270
|
-
failure: 0
|
|
271
|
-
},
|
|
272
|
-
memory: {
|
|
273
|
-
seenTrackerSize: 0,
|
|
274
|
-
rateLimiterEntries: 0
|
|
275
|
-
},
|
|
276
|
-
snapshotAt: 0
|
|
277
|
-
};
|
|
232
|
+
const emptySnapshot = createMetricsSnapshot(createZeroMetricsState(), 0);
|
|
278
233
|
return {
|
|
279
234
|
emit: () => {},
|
|
280
235
|
getSnapshot: () => ({
|
|
@@ -603,10 +558,7 @@ function createSeenTracker(options) {
|
|
|
603
558
|
}
|
|
604
559
|
function seed(ids) {
|
|
605
560
|
const now = Date.now();
|
|
606
|
-
for (
|
|
607
|
-
const id = ids[i];
|
|
608
|
-
if (!entries.has(id) && entries.size < maxEntries) insertAtFront(id, now);
|
|
609
|
-
}
|
|
561
|
+
for (const id of ids.toReversed()) if (!entries.has(id) && entries.size < maxEntries) insertAtFront(id, now);
|
|
610
562
|
}
|
|
611
563
|
return {
|
|
612
564
|
has,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as nostrPlugin } from "./channel-
|
|
1
|
+
import { n as nostrPlugin } from "./channel-B51rExHD.js";
|
|
2
2
|
export { nostrPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { collectStatusIssuesFromLastError, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
|
|
2
2
|
import { DEFAULT_ACCOUNT_ID, buildChannelConfigSchema, formatPairingApproveHint } from "openclaw/plugin-sdk/channel-plugin-common";
|
|
3
|
-
import { AllowFromListSchema, DmPolicySchema, MarkdownConfigSchema } from "openclaw/plugin-sdk/channel-config-
|
|
3
|
+
import { AllowFromListSchema, DmPolicySchema, MarkdownConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
|
|
4
4
|
import { buildSecretInputSchema } from "openclaw/plugin-sdk/secret-input";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region extensions/nostr/src/config-schema.ts
|
package/dist/setup-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as nostrSetupWizard, t as nostrSetupAdapter } from "./setup-surface-
|
|
1
|
+
import { n as nostrSetupWizard, t as nostrSetupAdapter } from "./setup-surface-B52P4uo2.js";
|
|
2
2
|
export { nostrSetupAdapter, nostrSetupWizard };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as buildChannelConfigSchema, t as NostrConfigSchema } from "./config-schema-
|
|
1
|
+
import { i as buildChannelConfigSchema, t as NostrConfigSchema } from "./config-schema-CelPzg1N.js";
|
|
2
2
|
import { i as DEFAULT_RELAYS, n as createNostrSetupAdapter } from "./setup-adapter-DEU3o8MF.js";
|
|
3
3
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
4
4
|
import { DEFAULT_ACCOUNT_ID, createDelegatedSetupWizardProxy, createSetupTranslator, createStandardChannelSetupStatus } from "openclaw/plugin-sdk/setup-runtime";
|
|
@@ -51,7 +51,7 @@ const nostrSetupAdapter = createNostrSetupAdapter({
|
|
|
51
51
|
});
|
|
52
52
|
const nostrSetupWizard = createDelegatedSetupWizardProxy({
|
|
53
53
|
channel,
|
|
54
|
-
loadWizard: async () => (await import("./setup-surface-
|
|
54
|
+
loadWizard: async () => (await import("./setup-surface-B52P4uo2.js").then((n) => n.r)).nostrSetupWizard,
|
|
55
55
|
status: { ...createStandardChannelSetupStatus({
|
|
56
56
|
channelLabel: "Nostr",
|
|
57
57
|
configuredLabel: t("wizard.channels.statusConfigured"),
|
|
@@ -5,7 +5,7 @@ import { getPublicKey, nip19 } from "nostr-tools";
|
|
|
5
5
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId, normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
|
|
6
6
|
import { listCombinedAccountIds, resolveListedDefaultAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
7
7
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "openclaw/plugin-sdk/routing";
|
|
8
|
-
import { createSetupTranslator, createStandardChannelSetupStatus, createTopLevelChannelDmPolicy, createTopLevelChannelParsedAllowFromPrompt, formatDocsLink, mergeAllowFromEntries, parseSetupEntriesWithParser, patchTopLevelChannelConfigSection } from "openclaw/plugin-sdk/setup";
|
|
8
|
+
import { createSetupTranslator, createStandardChannelSetupStatus, createTopLevelChannelDmPolicy, createTopLevelChannelParsedAllowFromPrompt, defineTokenCredential, formatDocsLink, mergeAllowFromEntries, parseSetupEntriesWithParser, patchTopLevelChannelConfigSection, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
|
|
9
9
|
//#region \0rolldown/runtime.js
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
11
11
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -209,8 +209,9 @@ const nostrSetupWizard = {
|
|
|
209
209
|
patch: buildNostrSetupPatch(accountId, {})
|
|
210
210
|
})
|
|
211
211
|
},
|
|
212
|
-
credentials: [{
|
|
212
|
+
credentials: [defineTokenCredential({
|
|
213
213
|
inputKey: "privateKey",
|
|
214
|
+
configKey: "privateKey",
|
|
214
215
|
providerHint: channel,
|
|
215
216
|
credentialLabel: "private key",
|
|
216
217
|
preferredEnvVar: "NOSTR_PRIVATE_KEY",
|
|
@@ -220,32 +221,23 @@ const nostrSetupWizard = {
|
|
|
220
221
|
keepPrompt: t("wizard.nostr.privateKeyKeep"),
|
|
221
222
|
inputPrompt: t("wizard.nostr.privateKeyInput"),
|
|
222
223
|
allowEnv: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID$1,
|
|
223
|
-
|
|
224
|
-
const account = resolveNostrAccount({
|
|
225
|
-
cfg,
|
|
226
|
-
accountId
|
|
227
|
-
});
|
|
228
|
-
return {
|
|
229
|
-
accountConfigured: account.configured,
|
|
230
|
-
hasConfiguredValue: hasConfiguredSecretInput(account.config.privateKey),
|
|
231
|
-
resolvedValue: normalizeSecretInputString(account.config.privateKey),
|
|
232
|
-
envValue: process.env.NOSTR_PRIVATE_KEY?.trim()
|
|
233
|
-
};
|
|
234
|
-
},
|
|
235
|
-
applyUseEnv: async ({ cfg, accountId }) => patchTopLevelChannelConfigSection({
|
|
224
|
+
resolveAccount: ({ cfg, accountId }) => resolveNostrAccount({
|
|
236
225
|
cfg,
|
|
237
|
-
|
|
238
|
-
enabled: true,
|
|
239
|
-
clearFields: ["privateKey"],
|
|
240
|
-
patch: buildNostrSetupPatch(accountId, {})
|
|
226
|
+
accountId
|
|
241
227
|
}),
|
|
242
|
-
|
|
228
|
+
accountConfigured: (account) => account.configured,
|
|
229
|
+
resolvedValue: (account) => normalizeSecretInputString(account.config.privateKey),
|
|
230
|
+
envValue: () => process.env.NOSTR_PRIVATE_KEY?.trim(),
|
|
231
|
+
patchAccount: ({ cfg, accountId, patch, clearFields }) => patchTopLevelChannelConfigSection({
|
|
243
232
|
cfg,
|
|
244
233
|
channel,
|
|
245
234
|
enabled: true,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
235
|
+
clearFields,
|
|
236
|
+
patch: buildNostrSetupPatch(accountId, patch)
|
|
237
|
+
}),
|
|
238
|
+
useEnv: { clearFields: ["privateKey"] },
|
|
239
|
+
set: { value: "resolved" }
|
|
240
|
+
})],
|
|
249
241
|
textInputs: [{
|
|
250
242
|
inputKey: "relayUrls",
|
|
251
243
|
message: t("wizard.nostr.relayUrlsPrompt"),
|
|
@@ -276,11 +268,7 @@ const nostrSetupWizard = {
|
|
|
276
268
|
}
|
|
277
269
|
}],
|
|
278
270
|
dmPolicy: nostrDmPolicy,
|
|
279
|
-
disable: (cfg) =>
|
|
280
|
-
cfg,
|
|
281
|
-
channel,
|
|
282
|
-
patch: { enabled: false }
|
|
283
|
-
})
|
|
271
|
+
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false)
|
|
284
272
|
};
|
|
285
273
|
//#endregion
|
|
286
274
|
export { resolveDefaultNostrAccountId as a, validatePrivateKey as c, listNostrAccountIds as i, nostrSetupWizard as n, resolveNostrAccount as o, setup_surface_exports as r, normalizePubkey as s, nostrSetupAdapter as t };
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/nostr",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.2-beta.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/nostr",
|
|
9
|
-
"version": "2026.7.
|
|
9
|
+
"version": "2026.7.2-beta.2",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"nostr-tools": "2.23.9",
|
|
12
12
|
"zod": "4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"openclaw": ">=2026.7.
|
|
15
|
+
"openclaw": ">=2026.7.2-beta.2"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/nostr",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.2-beta.2",
|
|
4
4
|
"description": "OpenClaw Nostr channel plugin for NIP-04 encrypted direct messages.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"zod": "4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"openclaw": ">=2026.7.
|
|
15
|
+
"openclaw": ">=2026.7.2-beta.2"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"minHostVersion": ">=2026.4.10"
|
|
51
51
|
},
|
|
52
52
|
"compat": {
|
|
53
|
-
"pluginApi": ">=2026.7.
|
|
53
|
+
"pluginApi": ">=2026.7.2-beta.2"
|
|
54
54
|
},
|
|
55
55
|
"build": {
|
|
56
|
-
"openclawVersion": "2026.7.
|
|
56
|
+
"openclawVersion": "2026.7.2-beta.2"
|
|
57
57
|
},
|
|
58
58
|
"release": {
|
|
59
59
|
"publishToClawHub": true,
|