@openclaw/nostr 2026.7.2-beta.3 → 2026.7.2-beta.4
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 +12 -4
- package/dist/{channel-DgBHZ53s.js → channel-DqbdMXMg.js} +785 -412
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{setup-adapter-DEU3o8MF.js → setup-adapter-BjKmSwdW.js} +31 -1
- package/dist/setup-api.js +1 -1
- package/dist/setup-plugin-api.js +4 -2
- package/dist/{setup-surface-BF7_7BEx.js → setup-surface-ChtM-WSY.js} +4 -2
- package/node_modules/nostr-tools/lib/cjs/abstract-pool.js +35 -3
- package/node_modules/nostr-tools/lib/cjs/abstract-pool.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/abstract-relay.js +30 -2
- package/node_modules/nostr-tools/lib/cjs/abstract-relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/index.js +35 -3
- package/node_modules/nostr-tools/lib/cjs/index.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip46.js +35 -3
- package/node_modules/nostr-tools/lib/cjs/nip46.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nipb0.js +4 -1
- package/node_modules/nostr-tools/lib/cjs/nipb0.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/pool.js +35 -3
- package/node_modules/nostr-tools/lib/cjs/pool.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/relay.js +30 -2
- package/node_modules/nostr-tools/lib/cjs/relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/abstract-pool.js +35 -3
- package/node_modules/nostr-tools/lib/esm/abstract-pool.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/abstract-relay.js +30 -2
- package/node_modules/nostr-tools/lib/esm/abstract-relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/index.js +35 -3
- package/node_modules/nostr-tools/lib/esm/index.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip46.js +35 -3
- package/node_modules/nostr-tools/lib/esm/nip46.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nipb0.js +4 -1
- package/node_modules/nostr-tools/lib/esm/nipb0.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/pool.js +35 -3
- package/node_modules/nostr-tools/lib/esm/pool.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/relay.js +30 -2
- package/node_modules/nostr-tools/lib/esm/relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/nostr.bundle.js +35 -3
- package/node_modules/nostr-tools/lib/nostr.bundle.js.map +2 -2
- package/node_modules/nostr-tools/lib/types/abstract-pool.d.ts +1 -0
- package/node_modules/nostr-tools/lib/types/abstract-relay.d.ts +5 -0
- package/node_modules/nostr-tools/lib/types/relay.d.ts +2 -2
- package/node_modules/nostr-tools/package.json +1 -1
- package/npm-shrinkwrap.json +7 -7
- package/openclaw.plugin.json +0 -5
- package/package.json +41 -15
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as nostrPlugin } from "./channel-
|
|
1
|
+
import { n as nostrPlugin } from "./channel-DqbdMXMg.js";
|
|
2
2
|
export { nostrPlugin };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
2
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing";
|
|
3
3
|
import { patchTopLevelChannelConfigSection, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
4
|
+
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
4
5
|
//#region extensions/nostr/src/default-relays.ts
|
|
5
6
|
const DEFAULT_RELAYS = ["wss://relay.damus.io", "wss://nos.lol"];
|
|
6
7
|
//#endregion
|
|
@@ -65,5 +66,34 @@ function createNostrSetupAdapter(params) {
|
|
|
65
66
|
}
|
|
66
67
|
};
|
|
67
68
|
}
|
|
69
|
+
function createNostrSetupContract(adapter) {
|
|
70
|
+
return defineChannelSetupContract({
|
|
71
|
+
fields: {
|
|
72
|
+
privateKey: {
|
|
73
|
+
kind: "string",
|
|
74
|
+
sensitive: true,
|
|
75
|
+
cli: {
|
|
76
|
+
flags: "--private-key <key>",
|
|
77
|
+
description: "Nostr private key"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
relayUrls: {
|
|
81
|
+
kind: "string",
|
|
82
|
+
cli: {
|
|
83
|
+
flags: "--relay-urls <urls>",
|
|
84
|
+
description: "Nostr relay URLs"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
useEnv: {
|
|
88
|
+
kind: "boolean",
|
|
89
|
+
cli: {
|
|
90
|
+
flags: "--use-env",
|
|
91
|
+
description: "Use NOSTR_PRIVATE_KEY"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
legacyAdapter: adapter
|
|
96
|
+
});
|
|
97
|
+
}
|
|
68
98
|
//#endregion
|
|
69
|
-
export { DEFAULT_RELAYS as i, createNostrSetupAdapter as n,
|
|
99
|
+
export { DEFAULT_RELAYS as a, parseRelayUrls as i, createNostrSetupAdapter as n, createNostrSetupContract as r, buildNostrSetupPatch as t };
|
package/dist/setup-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as nostrSetupWizard, t as nostrSetupAdapter } from "./setup-surface-ChtM-WSY.js";
|
|
2
2
|
export { nostrSetupAdapter, nostrSetupWizard };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as buildChannelConfigSchema, t as NostrConfigSchema } from "./config-schema-CelPzg1N.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as DEFAULT_RELAYS, n as createNostrSetupAdapter, r as createNostrSetupContract } from "./setup-adapter-BjKmSwdW.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";
|
|
5
5
|
//#region extensions/nostr/src/channel.setup.ts
|
|
@@ -49,9 +49,10 @@ const nostrSetupAdapter = createNostrSetupAdapter({
|
|
|
49
49
|
resolveAccountId: (cfg, accountId) => accountId?.trim() || resolveDefaultSetupNostrAccountId(cfg),
|
|
50
50
|
validatePrivateKey: looksLikeNostrPrivateKey
|
|
51
51
|
});
|
|
52
|
+
const nostrSetupContract = createNostrSetupContract(nostrSetupAdapter);
|
|
52
53
|
const nostrSetupWizard = createDelegatedSetupWizardProxy({
|
|
53
54
|
channel,
|
|
54
|
-
loadWizard: async () => (await import("./setup-surface-
|
|
55
|
+
loadWizard: async () => (await import("./setup-surface-ChtM-WSY.js").then((n) => n.i)).nostrSetupWizard,
|
|
55
56
|
status: { ...createStandardChannelSetupStatus({
|
|
56
57
|
channelLabel: "Nostr",
|
|
57
58
|
configuredLabel: t("wizard.channels.statusConfigured"),
|
|
@@ -91,6 +92,7 @@ const nostrSetupPlugin = {
|
|
|
91
92
|
reload: { configPrefixes: ["channels.nostr"] },
|
|
92
93
|
configSchema: buildChannelConfigSchema(NostrConfigSchema),
|
|
93
94
|
setup: nostrSetupAdapter,
|
|
95
|
+
setupContract: nostrSetupContract,
|
|
94
96
|
setupWizard: nostrSetupWizard,
|
|
95
97
|
config: {
|
|
96
98
|
listAccountIds: listSetupNostrAccountIds,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as DEFAULT_RELAYS, i as parseRelayUrls, n as createNostrSetupAdapter, r as createNostrSetupContract, t as buildNostrSetupPatch } from "./setup-adapter-BjKmSwdW.js";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { hasConfiguredSecretInput, normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
4
4
|
import { getPublicKey, nip19 } from "nostr-tools";
|
|
@@ -115,6 +115,7 @@ function resolveNostrAccount(opts) {
|
|
|
115
115
|
//#region extensions/nostr/src/setup-surface.ts
|
|
116
116
|
var setup_surface_exports = /* @__PURE__ */ __exportAll({
|
|
117
117
|
nostrSetupAdapter: () => nostrSetupAdapter,
|
|
118
|
+
nostrSetupContract: () => nostrSetupContract,
|
|
118
119
|
nostrSetupWizard: () => nostrSetupWizard
|
|
119
120
|
});
|
|
120
121
|
const t = createSetupTranslator();
|
|
@@ -172,6 +173,7 @@ const nostrSetupAdapter = createNostrSetupAdapter({
|
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
});
|
|
176
|
+
const nostrSetupContract = createNostrSetupContract(nostrSetupAdapter);
|
|
175
177
|
const nostrSetupWizard = {
|
|
176
178
|
channel,
|
|
177
179
|
resolveAccountIdForConfigure: ({ accountOverride, defaultAccountId }) => accountOverride?.trim() || defaultAccountId,
|
|
@@ -271,4 +273,4 @@ const nostrSetupWizard = {
|
|
|
271
273
|
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false)
|
|
272
274
|
};
|
|
273
275
|
//#endregion
|
|
274
|
-
export {
|
|
276
|
+
export { listNostrAccountIds as a, normalizePubkey as c, setup_surface_exports as i, validatePrivateKey as l, nostrSetupContract as n, resolveDefaultNostrAccountId as o, nostrSetupWizard as r, resolveNostrAccount as s, nostrSetupAdapter as t };
|
|
@@ -146,12 +146,14 @@ var AbstractRelay = class {
|
|
|
146
146
|
openSubs = /* @__PURE__ */ new Map();
|
|
147
147
|
enablePing;
|
|
148
148
|
enableReconnect;
|
|
149
|
+
idleTimeout = 0;
|
|
149
150
|
idleSince = Date.now();
|
|
150
151
|
ongoingOperations = 0;
|
|
151
152
|
reconnectTimeoutHandle;
|
|
152
153
|
pingIntervalHandle;
|
|
153
154
|
reconnectAttempts = 0;
|
|
154
155
|
skipReconnection = false;
|
|
156
|
+
idleTimeoutHandle;
|
|
155
157
|
connectionPromise;
|
|
156
158
|
openCountRequests = /* @__PURE__ */ new Map();
|
|
157
159
|
openEventPublishes = /* @__PURE__ */ new Map();
|
|
@@ -167,6 +169,8 @@ var AbstractRelay = class {
|
|
|
167
169
|
this._WebSocket = opts.websocketImplementation || WebSocket;
|
|
168
170
|
this.enablePing = opts.enablePing;
|
|
169
171
|
this.enableReconnect = opts.enableReconnect || false;
|
|
172
|
+
if (opts.idleTimeout)
|
|
173
|
+
this.idleTimeout = opts.idleTimeout;
|
|
170
174
|
}
|
|
171
175
|
static async connect(url, opts) {
|
|
172
176
|
const relay = new AbstractRelay(url, opts);
|
|
@@ -190,6 +194,22 @@ var AbstractRelay = class {
|
|
|
190
194
|
get connected() {
|
|
191
195
|
return this._connected;
|
|
192
196
|
}
|
|
197
|
+
clearIdleTimeout() {
|
|
198
|
+
if (this.idleTimeoutHandle) {
|
|
199
|
+
clearTimeout(this.idleTimeoutHandle);
|
|
200
|
+
this.idleTimeoutHandle = void 0;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
scheduleIdleClose() {
|
|
204
|
+
this.clearIdleTimeout();
|
|
205
|
+
if (this.idleTimeout > 0) {
|
|
206
|
+
this.idleTimeoutHandle = setTimeout(() => {
|
|
207
|
+
if (this.ongoingOperations === 0 && this.idleSince) {
|
|
208
|
+
this.close();
|
|
209
|
+
}
|
|
210
|
+
}, this.idleTimeout);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
193
213
|
async reconnect() {
|
|
194
214
|
const backoff = this.resubscribeBackoff[Math.min(this.reconnectAttempts, this.resubscribeBackoff.length - 1)];
|
|
195
215
|
this.reconnectAttempts++;
|
|
@@ -208,6 +228,7 @@ var AbstractRelay = class {
|
|
|
208
228
|
this._connected = false;
|
|
209
229
|
this.connectionPromise = void 0;
|
|
210
230
|
this.idleSince = void 0;
|
|
231
|
+
this.clearIdleTimeout();
|
|
211
232
|
if (this.enableReconnect && !this.skipReconnection) {
|
|
212
233
|
this.reconnect();
|
|
213
234
|
} else {
|
|
@@ -365,6 +386,7 @@ var AbstractRelay = class {
|
|
|
365
386
|
}
|
|
366
387
|
async publish(event) {
|
|
367
388
|
this.idleSince = void 0;
|
|
389
|
+
this.clearIdleTimeout();
|
|
368
390
|
this.ongoingOperations++;
|
|
369
391
|
const ret = new Promise((resolve, reject) => {
|
|
370
392
|
const timeout = setTimeout(() => {
|
|
@@ -386,8 +408,10 @@ var AbstractRelay = class {
|
|
|
386
408
|
}
|
|
387
409
|
}
|
|
388
410
|
this.ongoingOperations--;
|
|
389
|
-
if (this.ongoingOperations === 0)
|
|
411
|
+
if (this.ongoingOperations === 0) {
|
|
390
412
|
this.idleSince = Date.now();
|
|
413
|
+
this.scheduleIdleClose();
|
|
414
|
+
}
|
|
391
415
|
return ret;
|
|
392
416
|
}
|
|
393
417
|
async count(filters, params) {
|
|
@@ -413,6 +437,7 @@ var AbstractRelay = class {
|
|
|
413
437
|
subscribe(filters, params) {
|
|
414
438
|
if (params.label !== "<forced-ping>") {
|
|
415
439
|
this.idleSince = void 0;
|
|
440
|
+
this.clearIdleTimeout();
|
|
416
441
|
this.ongoingOperations++;
|
|
417
442
|
}
|
|
418
443
|
const sub = this.prepareSubscription(filters, params);
|
|
@@ -442,6 +467,7 @@ var AbstractRelay = class {
|
|
|
442
467
|
this.closeAllSubscriptions("relay connection closed by us");
|
|
443
468
|
this._connected = false;
|
|
444
469
|
this.idleSince = void 0;
|
|
470
|
+
this.clearIdleTimeout();
|
|
445
471
|
this.onclose?.();
|
|
446
472
|
if (this.ws?.readyState === this._WebSocket.OPEN) {
|
|
447
473
|
this.ws?.close();
|
|
@@ -619,8 +645,10 @@ var Subscription = class {
|
|
|
619
645
|
}
|
|
620
646
|
this.relay.openSubs.delete(this.id);
|
|
621
647
|
this.relay.ongoingOperations--;
|
|
622
|
-
if (this.relay.ongoingOperations === 0)
|
|
648
|
+
if (this.relay.ongoingOperations === 0) {
|
|
623
649
|
this.relay.idleSince = Date.now();
|
|
650
|
+
this.relay.scheduleIdleClose();
|
|
651
|
+
}
|
|
624
652
|
this.onclose?.(reason);
|
|
625
653
|
}
|
|
626
654
|
};
|
|
@@ -696,6 +724,7 @@ var AbstractSimplePool = class {
|
|
|
696
724
|
verifyEvent;
|
|
697
725
|
enablePing;
|
|
698
726
|
enableReconnect;
|
|
727
|
+
idleTimeout = 2e4;
|
|
699
728
|
automaticallyAuth;
|
|
700
729
|
trustedRelayURLs = /* @__PURE__ */ new Set();
|
|
701
730
|
onRelayConnectionFailure;
|
|
@@ -708,6 +737,8 @@ var AbstractSimplePool = class {
|
|
|
708
737
|
this._WebSocket = opts.websocketImplementation;
|
|
709
738
|
this.enablePing = opts.enablePing;
|
|
710
739
|
this.enableReconnect = opts.enableReconnect || false;
|
|
740
|
+
if (opts.idleTimeout)
|
|
741
|
+
this.idleTimeout = opts.idleTimeout;
|
|
711
742
|
this.automaticallyAuth = opts.automaticallyAuth;
|
|
712
743
|
this.onRelayConnectionFailure = opts.onRelayConnectionFailure;
|
|
713
744
|
this.onRelayConnectionSuccess = opts.onRelayConnectionSuccess;
|
|
@@ -722,7 +753,8 @@ var AbstractSimplePool = class {
|
|
|
722
753
|
verifyEvent: this.trustedRelayURLs.has(url) ? alwaysTrue : this.verifyEvent,
|
|
723
754
|
websocketImplementation: this._WebSocket,
|
|
724
755
|
enablePing: this.enablePing,
|
|
725
|
-
enableReconnect: this.enableReconnect
|
|
756
|
+
enableReconnect: this.enableReconnect,
|
|
757
|
+
idleTimeout: this.idleTimeout
|
|
726
758
|
});
|
|
727
759
|
relay.onclose = () => {
|
|
728
760
|
this.relays.delete(url);
|