@openclaw/nostr 2026.8.1 → 2026.8.33
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/{channel-BwnvE_wr.js → .setup/channel-B_gAHZXU.mjs} +14 -15
- package/dist/.setup/secret-contract-api-DUmw8THQ.mjs +2 -0
- package/dist/.setup/secret-contract-api-nVWula4c.mjs +37 -0
- package/dist/.setup/setup-plugin-api-B7i5rR6T.mjs +2 -0
- package/dist/.setup/setup-plugin-api-B7qtJE84.mjs +82 -0
- package/dist/{setup-surface-CzjfhV72.js → .setup/setup-surface-Dx8QxWSP.mjs} +12 -11
- package/dist/api.js +8 -6
- package/dist/channel-plugin-api.js +1 -1
- package/dist/doctor-contract-api.js +3 -2
- package/dist/secret-contract-api.js +1 -36
- package/dist/setup-api.js +1 -1
- package/dist/setup-entry.js +3 -2
- package/dist/setup-plugin-api.js +1 -81
- package/package.json +4 -4
- /package/dist/{config-schema-CkYd8ACn.js → .setup/config-schema-CkYd8ACn.mjs} +0 -0
- /package/dist/{inbound-direct-dm-runtime-DHn9NoYN.js → .setup/inbound-direct-dm-runtime-DHn9NoYN.mjs} +0 -0
- /package/dist/{setup-adapter-KJ_iGKiG.js → .setup/setup-adapter-KJ_iGKiG.mjs} +0 -0
- /package/dist/{state-account-id-CvBZ9s6P.js → .setup/state-account-id-CvBZ9s6P.mjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as listNostrAccountIds, c as normalizePubkey, n as nostrSetupContract, o as resolveDefaultNostrAccountId, r as nostrSetupWizard, s as resolveNostrAccount } 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-CkYd8ACn.
|
|
3
|
-
import { c as validatePrivateKey, l as DEFAULT_RELAYS } from "./setup-adapter-KJ_iGKiG.
|
|
4
|
-
import { t as normalizeNostrStateAccountId } from "./state-account-id-CvBZ9s6P.
|
|
1
|
+
import { a as listNostrAccountIds, c as normalizePubkey, n as nostrSetupContract, o as resolveDefaultNostrAccountId, r as nostrSetupWizard, s as resolveNostrAccount } from "./setup-surface-Dx8QxWSP.mjs";
|
|
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-CkYd8ACn.mjs";
|
|
3
|
+
import { c as validatePrivateKey, l as DEFAULT_RELAYS } from "./setup-adapter-KJ_iGKiG.mjs";
|
|
4
|
+
import { t as normalizeNostrStateAccountId } from "./state-account-id-CvBZ9s6P.mjs";
|
|
5
5
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
6
6
|
import { createScopedDmSecurityResolver, createTopLevelChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
7
7
|
import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
@@ -213,9 +213,7 @@ function createMetrics(onMetric) {
|
|
|
213
213
|
case "memory.seen_tracker_size":
|
|
214
214
|
state.memory.seenTrackerSize = value;
|
|
215
215
|
break;
|
|
216
|
-
case "memory.rate_limiter_entries":
|
|
217
|
-
state.memory.rateLimiterEntries = value;
|
|
218
|
-
break;
|
|
216
|
+
case "memory.rate_limiter_entries": state.memory.rateLimiterEntries = value;
|
|
219
217
|
}
|
|
220
218
|
}
|
|
221
219
|
function getSnapshot() {
|
|
@@ -365,9 +363,7 @@ function createNostrCursorStateWriter(options) {
|
|
|
365
363
|
return;
|
|
366
364
|
} catch (error) {
|
|
367
365
|
options.onBackgroundError?.(error);
|
|
368
|
-
await
|
|
369
|
-
setTimeout(resolve, options.recoveryRetryMs ?? CURSOR_RECOVERY_RETRY_MS);
|
|
370
|
-
});
|
|
366
|
+
await sleepWithAbort(CURSOR_RECOVERY_RETRY_MS);
|
|
371
367
|
}
|
|
372
368
|
})().finally(() => {
|
|
373
369
|
recoveryFlush = void 0;
|
|
@@ -679,11 +675,12 @@ function createProfileEvent(sk, profile, lastPublishedAt) {
|
|
|
679
675
|
const content = profileToContent(profile);
|
|
680
676
|
const contentJson = JSON.stringify(content);
|
|
681
677
|
const now = Math.floor(Date.now() / 1e3);
|
|
678
|
+
const createdAt = lastPublishedAt !== void 0 ? Math.max(now, lastPublishedAt + 1) : now;
|
|
682
679
|
return finalizeEvent({
|
|
683
680
|
kind: 0,
|
|
684
681
|
content: contentJson,
|
|
685
682
|
tags: [],
|
|
686
|
-
created_at:
|
|
683
|
+
created_at: createdAt
|
|
687
684
|
}, sk);
|
|
688
685
|
}
|
|
689
686
|
/** Per-relay publish timeout (ms) */
|
|
@@ -862,7 +859,7 @@ async function writeNostrProfileState(params) {
|
|
|
862
859
|
//#region extensions/nostr/src/nostr-bus.ts
|
|
863
860
|
const STARTUP_LOOKBACK_SEC = 120;
|
|
864
861
|
const STATE_PERSIST_DEBOUNCE_MS = 5e3;
|
|
865
|
-
const NOSTR_INGRESS_ENVELOPE_OVERHEAD_BYTES =
|
|
862
|
+
const NOSTR_INGRESS_ENVELOPE_OVERHEAD_BYTES = 16384;
|
|
866
863
|
const NOSTR_INGRESS_MAX_PENDING_EVENTS = 1e3;
|
|
867
864
|
const DEFAULT_INBOUND_GUARD_POLICY = createDirectDmPreCryptoGuardPolicy();
|
|
868
865
|
const CIRCUIT_BREAKER_THRESHOLD = 5;
|
|
@@ -1421,7 +1418,7 @@ const startNostrGatewayAccount = async (ctx) => {
|
|
|
1421
1418
|
ctx.log?.warn?.(`[${account.accountId}] dropping Nostr DM after preflight drift (${senderPubkey}, ${resolvedAccess.senderAccess.reasonCode})`);
|
|
1422
1419
|
return;
|
|
1423
1420
|
}
|
|
1424
|
-
const { dispatchInboundDirectDm } = await import("./inbound-direct-dm-runtime-DHn9NoYN.
|
|
1421
|
+
const { dispatchInboundDirectDm } = await import("./inbound-direct-dm-runtime-DHn9NoYN.mjs");
|
|
1425
1422
|
await dispatchInboundDirectDm({
|
|
1426
1423
|
channelRuntime,
|
|
1427
1424
|
resolveChannelIngress: async (contextBinding) => {
|
|
@@ -1447,7 +1444,8 @@ const startNostrGatewayAccount = async (ctx) => {
|
|
|
1447
1444
|
commandAuthorized: resolvedAccess.commandAccess.requested ? resolvedAccess.commandAccess.authorized : void 0,
|
|
1448
1445
|
turnAdoptionLifecycle: bindIngressLifecycleToReplyOptions(lifecycle).turnAdoptionLifecycle,
|
|
1449
1446
|
deliver: async (payload) => {
|
|
1450
|
-
const
|
|
1447
|
+
const outboundText = payload && typeof payload === "object" && "text" in payload ? payload.text ?? "" : "";
|
|
1448
|
+
const sanitizedText = sanitizeAssistantVisibleText(outboundText);
|
|
1451
1449
|
if (!sanitizedText) return;
|
|
1452
1450
|
const tableMode = runtime.channel.text.resolveMarkdownTableMode({
|
|
1453
1451
|
cfg: ctx.cfg,
|
|
@@ -1542,9 +1540,10 @@ const nostrOutboundAdapter = {
|
|
|
1542
1540
|
const message = stripMarkdown(core.channel.text.convertMarkdownTables(text ?? "", tableMode));
|
|
1543
1541
|
if (!message) throw new Error("Nostr send requires non-empty text after markdown stripping.");
|
|
1544
1542
|
const normalizedTo = normalizePubkey(to);
|
|
1543
|
+
const eventId = await bus.sendDm(normalizedTo, message);
|
|
1545
1544
|
return attachChannelToResult("nostr", {
|
|
1546
1545
|
to: normalizedTo,
|
|
1547
|
-
messageId:
|
|
1546
|
+
messageId: eventId
|
|
1548
1547
|
});
|
|
1549
1548
|
}
|
|
1550
1549
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
2
|
+
import { collectSecretInputAssignment, createChannelSecretTargetRegistryEntries, getChannelRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
3
|
+
//#region extensions/nostr/src/secret-contract.ts
|
|
4
|
+
const secretTargetRegistryEntries = createChannelSecretTargetRegistryEntries({
|
|
5
|
+
channelKey: "nostr",
|
|
6
|
+
channel: ["privateKey"]
|
|
7
|
+
});
|
|
8
|
+
function collectRuntimeConfigAssignments(params) {
|
|
9
|
+
const nostr = getChannelRecord(params.config, "nostr");
|
|
10
|
+
if (!nostr) return;
|
|
11
|
+
const accountId = normalizeAccountId(typeof nostr.defaultAccount === "string" ? nostr.defaultAccount : void 0);
|
|
12
|
+
collectSecretInputAssignment({
|
|
13
|
+
value: nostr.privateKey,
|
|
14
|
+
path: "channels.nostr.privateKey",
|
|
15
|
+
expected: "string",
|
|
16
|
+
defaults: params.defaults,
|
|
17
|
+
context: params.context,
|
|
18
|
+
active: nostr.enabled !== false,
|
|
19
|
+
inactiveReason: "Nostr channel is disabled.",
|
|
20
|
+
owner: {
|
|
21
|
+
ownerKind: "account",
|
|
22
|
+
ownerId: `nostr:${accountId}`,
|
|
23
|
+
requiredForGateway: false,
|
|
24
|
+
disposition: "isolate",
|
|
25
|
+
contract: nostr
|
|
26
|
+
},
|
|
27
|
+
apply: (value) => {
|
|
28
|
+
nostr.privateKey = value;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const channelSecrets = {
|
|
33
|
+
secretTargetRegistryEntries,
|
|
34
|
+
collectRuntimeConfigAssignments
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { collectRuntimeConfigAssignments as n, secretTargetRegistryEntries as r, channelSecrets as t };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { i as buildChannelConfigSchema, t as NostrConfigSchema } from "./config-schema-CkYd8ACn.mjs";
|
|
2
|
+
import { i as createNostrSetupStatus, l as DEFAULT_RELAYS, n as createNostrSetupAdapter, o as hasConfiguredNostrPrivateKey, r as createNostrSetupContract, s as resolveNostrPrivateKey } from "./setup-adapter-KJ_iGKiG.mjs";
|
|
3
|
+
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
4
|
+
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
5
|
+
import { createDelegatedSetupWizardProxy } from "openclaw/plugin-sdk/setup-runtime";
|
|
6
|
+
//#region extensions/nostr/src/channel.setup.ts
|
|
7
|
+
const channel = "nostr";
|
|
8
|
+
function getNostrConfig(cfg) {
|
|
9
|
+
return cfg.channels?.nostr;
|
|
10
|
+
}
|
|
11
|
+
function resolveDefaultSetupNostrAccountId(cfg) {
|
|
12
|
+
return normalizeAccountId(getNostrConfig(cfg)?.defaultAccount);
|
|
13
|
+
}
|
|
14
|
+
function resolveSetupNostrAccount(params) {
|
|
15
|
+
const nostrCfg = getNostrConfig(params.cfg);
|
|
16
|
+
const accountId = normalizeAccountId(params.accountId ?? resolveDefaultSetupNostrAccountId(params.cfg));
|
|
17
|
+
const privateKey = resolveNostrPrivateKey(nostrCfg?.privateKey);
|
|
18
|
+
const configured = hasConfiguredNostrPrivateKey(nostrCfg?.privateKey);
|
|
19
|
+
return {
|
|
20
|
+
accountId,
|
|
21
|
+
name: typeof nostrCfg?.name === "string" ? nostrCfg.name : void 0,
|
|
22
|
+
enabled: nostrCfg?.enabled !== false,
|
|
23
|
+
configured,
|
|
24
|
+
privateKey,
|
|
25
|
+
publicKey: "",
|
|
26
|
+
relays: nostrCfg?.relays ?? DEFAULT_RELAYS,
|
|
27
|
+
profile: nostrCfg?.profile,
|
|
28
|
+
config: {
|
|
29
|
+
enabled: nostrCfg?.enabled,
|
|
30
|
+
name: nostrCfg?.name,
|
|
31
|
+
privateKey: nostrCfg?.privateKey,
|
|
32
|
+
relays: nostrCfg?.relays,
|
|
33
|
+
dmPolicy: nostrCfg?.dmPolicy,
|
|
34
|
+
allowFrom: nostrCfg?.allowFrom,
|
|
35
|
+
profile: nostrCfg?.profile
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const nostrSetupWizard = createDelegatedSetupWizardProxy({
|
|
40
|
+
channel,
|
|
41
|
+
loadWizard: async () => (await import("./setup-surface-Dx8QxWSP.mjs").then((n) => n.i)).nostrSetupWizard,
|
|
42
|
+
status: createNostrSetupStatus(resolveSetupNostrAccount),
|
|
43
|
+
resolveShouldPromptAccountIds: () => false,
|
|
44
|
+
delegatePrepare: true,
|
|
45
|
+
delegateFinalize: true
|
|
46
|
+
});
|
|
47
|
+
const nostrSetupPlugin = {
|
|
48
|
+
id: channel,
|
|
49
|
+
meta: {
|
|
50
|
+
id: channel,
|
|
51
|
+
label: "Nostr",
|
|
52
|
+
selectionLabel: "Nostr",
|
|
53
|
+
docsPath: "/channels/nostr",
|
|
54
|
+
docsLabel: "nostr",
|
|
55
|
+
blurb: "Decentralized DMs via Nostr relays (NIP-04)",
|
|
56
|
+
order: 100
|
|
57
|
+
},
|
|
58
|
+
capabilities: {
|
|
59
|
+
chatTypes: ["direct"],
|
|
60
|
+
media: false
|
|
61
|
+
},
|
|
62
|
+
reload: { configPrefixes: ["channels.nostr"] },
|
|
63
|
+
configSchema: buildChannelConfigSchema(NostrConfigSchema),
|
|
64
|
+
setupContract: createNostrSetupContract(createNostrSetupAdapter({ resolveAccountId: (cfg, accountId) => accountId?.trim() || resolveDefaultSetupNostrAccountId(cfg) })),
|
|
65
|
+
setupWizard: nostrSetupWizard,
|
|
66
|
+
config: {
|
|
67
|
+
listAccountIds: (cfg) => resolveSetupNostrAccount({ cfg }).configured ? [resolveDefaultSetupNostrAccountId(cfg)] : [],
|
|
68
|
+
resolveAccount: (cfg, accountId) => resolveSetupNostrAccount({
|
|
69
|
+
cfg,
|
|
70
|
+
accountId
|
|
71
|
+
}),
|
|
72
|
+
defaultAccountId: resolveDefaultSetupNostrAccountId,
|
|
73
|
+
isConfigured: (account) => account.configured,
|
|
74
|
+
describeAccount: (account) => describeAccountSnapshot({
|
|
75
|
+
account,
|
|
76
|
+
configured: account.configured,
|
|
77
|
+
extra: { publicKey: account.publicKey }
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
export { nostrSetupPlugin as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as parseRelayUrls, c as validatePrivateKey, i as createNostrSetupStatus, l as DEFAULT_RELAYS, n as createNostrSetupAdapter, o as hasConfiguredNostrPrivateKey, r as createNostrSetupContract, s as resolveNostrPrivateKey, t as buildNostrSetupPatch } from "./setup-adapter-KJ_iGKiG.
|
|
1
|
+
import { a as parseRelayUrls, c as validatePrivateKey, i as createNostrSetupStatus, l as DEFAULT_RELAYS, n as createNostrSetupAdapter, o as hasConfiguredNostrPrivateKey, r as createNostrSetupContract, s as resolveNostrPrivateKey, t as buildNostrSetupPatch } from "./setup-adapter-KJ_iGKiG.mjs";
|
|
2
2
|
import { createAccountListHelpers } from "openclaw/plugin-sdk/account-helpers";
|
|
3
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { hasConfiguredSecretInput, normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
@@ -109,22 +109,23 @@ function parseNostrAllowFrom(raw) {
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
+
const promptNostrAllowFrom = createTopLevelChannelParsedAllowFromPrompt({
|
|
113
|
+
channel,
|
|
114
|
+
defaultAccountId: resolveDefaultNostrAccountId,
|
|
115
|
+
noteTitle: t("wizard.nostr.allowlistTitle"),
|
|
116
|
+
noteLines: NOSTR_ALLOW_FROM_HELP_LINES,
|
|
117
|
+
message: t("wizard.nostr.allowFromPrompt"),
|
|
118
|
+
placeholder: "npub1..., 0123abcd...",
|
|
119
|
+
parseEntries: parseNostrAllowFrom,
|
|
120
|
+
mergeEntries: ({ existing, parsed }) => mergeAllowFromEntries(existing, parsed)
|
|
121
|
+
});
|
|
112
122
|
const nostrDmPolicy = createTopLevelChannelDmPolicy({
|
|
113
123
|
label: "Nostr",
|
|
114
124
|
channel,
|
|
115
125
|
policyKey: "channels.nostr.dmPolicy",
|
|
116
126
|
allowFromKey: "channels.nostr.allowFrom",
|
|
117
127
|
getCurrent: (cfg) => cfg.channels?.nostr?.dmPolicy ?? "pairing",
|
|
118
|
-
promptAllowFrom:
|
|
119
|
-
channel,
|
|
120
|
-
defaultAccountId: resolveDefaultNostrAccountId,
|
|
121
|
-
noteTitle: t("wizard.nostr.allowlistTitle"),
|
|
122
|
-
noteLines: NOSTR_ALLOW_FROM_HELP_LINES,
|
|
123
|
-
message: t("wizard.nostr.allowFromPrompt"),
|
|
124
|
-
placeholder: "npub1..., 0123abcd...",
|
|
125
|
-
parseEntries: parseNostrAllowFrom,
|
|
126
|
-
mergeEntries: ({ existing, parsed }) => mergeAllowFromEntries(existing, parsed)
|
|
127
|
-
})
|
|
128
|
+
promptAllowFrom: promptNostrAllowFrom
|
|
128
129
|
});
|
|
129
130
|
const nostrSetupAdapter = createNostrSetupAdapter({ resolveAccountId: (cfg, accountId) => accountId?.trim() || resolveDefaultNostrAccountId(cfg) });
|
|
130
131
|
const nostrSetupContract = createNostrSetupContract(nostrSetupAdapter);
|
package/dist/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { s as resolveNostrAccount } from "
|
|
1
|
+
import { s as resolveNostrAccount } from "./.setup/setup-surface-Dx8QxWSP.mjs";
|
|
2
2
|
import { getPluginRuntimeGatewayRequestScope } from "./runtime-api.js";
|
|
3
|
-
import { n as NostrProfileSchema } from "
|
|
4
|
-
import { a as getNostrRuntime, i as contentToProfile, n as nostrPlugin, o as setNostrRuntime, r as publishNostrProfile, t as getNostrProfileState } from "
|
|
3
|
+
import { n as NostrProfileSchema } from "./.setup/config-schema-CkYd8ACn.mjs";
|
|
4
|
+
import { a as getNostrRuntime, i as contentToProfile, n as nostrPlugin, o as setNostrRuntime, r as publishNostrProfile, t as getNostrProfileState } from "./.setup/channel-B_gAHZXU.mjs";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { SimplePool } from "nostr-tools";
|
|
@@ -18,7 +18,8 @@ function validateUrlSafety(urlStr) {
|
|
|
18
18
|
ok: false,
|
|
19
19
|
error: "URL must use https:// protocol"
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
const hostname = url.hostname.trim().toLowerCase();
|
|
22
|
+
if (isBlockedHostnameOrIp(hostname)) return {
|
|
22
23
|
ok: false,
|
|
23
24
|
error: "URL must not point to private/internal addresses"
|
|
24
25
|
};
|
|
@@ -208,7 +209,7 @@ function sendJson(res, status, body) {
|
|
|
208
209
|
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
209
210
|
res.end(JSON.stringify(body));
|
|
210
211
|
}
|
|
211
|
-
async function readJsonBody(req, maxBytes =
|
|
212
|
+
async function readJsonBody(req, maxBytes = 65536, timeoutMs = 3e4) {
|
|
212
213
|
const result = await readJsonBodyWithLimit(req, {
|
|
213
214
|
maxBytes,
|
|
214
215
|
timeoutMs,
|
|
@@ -234,7 +235,8 @@ function isLoopbackRemoteAddress(remoteAddress) {
|
|
|
234
235
|
}
|
|
235
236
|
function isLoopbackOriginLike(value) {
|
|
236
237
|
try {
|
|
237
|
-
|
|
238
|
+
const url = new URL(value);
|
|
239
|
+
return isLoopbackHost(url.hostname);
|
|
238
240
|
} catch {
|
|
239
241
|
return false;
|
|
240
242
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as nostrPlugin } from "
|
|
1
|
+
import { n as nostrPlugin } from "./.setup/channel-B_gAHZXU.mjs";
|
|
2
2
|
export { nostrPlugin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as normalizeNostrStateAccountId } from "
|
|
1
|
+
import { t as normalizeNostrStateAccountId } from "./.setup/state-account-id-CvBZ9s6P.mjs";
|
|
2
2
|
import { asFiniteNumber } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
@@ -49,7 +49,8 @@ async function listLegacyFiles(params) {
|
|
|
49
49
|
const files = [];
|
|
50
50
|
for (const entry of entries) {
|
|
51
51
|
if (!entry.isFile() || !entry.name.startsWith(params.prefix) || !entry.name.endsWith(suffix)) continue;
|
|
52
|
-
const
|
|
52
|
+
const rawAccountId = entry.name.slice(params.prefix.length, -5);
|
|
53
|
+
const accountId = normalizeNostrStateAccountId(rawAccountId);
|
|
53
54
|
const filePath = path.join(dir, entry.name);
|
|
54
55
|
try {
|
|
55
56
|
const value = params.parse(await readJsonFile(filePath));
|
|
@@ -1,37 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { collectSecretInputAssignment, createChannelSecretTargetRegistryEntries, getChannelRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
3
|
-
//#region extensions/nostr/src/secret-contract.ts
|
|
4
|
-
const secretTargetRegistryEntries = createChannelSecretTargetRegistryEntries({
|
|
5
|
-
channelKey: "nostr",
|
|
6
|
-
channel: ["privateKey"]
|
|
7
|
-
});
|
|
8
|
-
function collectRuntimeConfigAssignments(params) {
|
|
9
|
-
const nostr = getChannelRecord(params.config, "nostr");
|
|
10
|
-
if (!nostr) return;
|
|
11
|
-
const accountId = normalizeAccountId(typeof nostr.defaultAccount === "string" ? nostr.defaultAccount : void 0);
|
|
12
|
-
collectSecretInputAssignment({
|
|
13
|
-
value: nostr.privateKey,
|
|
14
|
-
path: "channels.nostr.privateKey",
|
|
15
|
-
expected: "string",
|
|
16
|
-
defaults: params.defaults,
|
|
17
|
-
context: params.context,
|
|
18
|
-
active: nostr.enabled !== false,
|
|
19
|
-
inactiveReason: "Nostr channel is disabled.",
|
|
20
|
-
owner: {
|
|
21
|
-
ownerKind: "account",
|
|
22
|
-
ownerId: `nostr:${accountId}`,
|
|
23
|
-
requiredForGateway: false,
|
|
24
|
-
disposition: "isolate",
|
|
25
|
-
contract: nostr
|
|
26
|
-
},
|
|
27
|
-
apply: (value) => {
|
|
28
|
-
nostr.privateKey = value;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
const channelSecrets = {
|
|
33
|
-
secretTargetRegistryEntries,
|
|
34
|
-
collectRuntimeConfigAssignments
|
|
35
|
-
};
|
|
36
|
-
//#endregion
|
|
1
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./.setup/secret-contract-api-nVWula4c.mjs";
|
|
37
2
|
export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
|
package/dist/setup-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as nostrSetupWizard, t as nostrSetupAdapter } from "
|
|
1
|
+
import { r as nostrSetupWizard, t as nostrSetupAdapter } from "./.setup/setup-surface-Dx8QxWSP.mjs";
|
|
2
2
|
export { nostrSetupAdapter, nostrSetupWizard };
|
package/dist/setup-entry.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { defineBundledChannelSetupEntry } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
2
3
|
//#region extensions/nostr/setup-entry.ts
|
|
3
4
|
var setup_entry_default = defineBundledChannelSetupEntry({
|
|
4
5
|
importMetaUrl: import.meta.url,
|
|
5
6
|
plugin: {
|
|
6
|
-
specifier: "
|
|
7
|
+
specifier: fileURLToPath(new URL(".setup/setup-plugin-api-B7i5rR6T.mjs", import.meta.url).href),
|
|
7
8
|
exportName: "nostrSetupPlugin"
|
|
8
9
|
},
|
|
9
10
|
secrets: {
|
|
10
|
-
specifier: "
|
|
11
|
+
specifier: fileURLToPath(new URL(".setup/secret-contract-api-DUmw8THQ.mjs", import.meta.url).href),
|
|
11
12
|
exportName: "channelSecrets"
|
|
12
13
|
}
|
|
13
14
|
});
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,82 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as createNostrSetupStatus, l as DEFAULT_RELAYS, n as createNostrSetupAdapter, o as hasConfiguredNostrPrivateKey, r as createNostrSetupContract, s as resolveNostrPrivateKey } from "./setup-adapter-KJ_iGKiG.js";
|
|
3
|
-
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
4
|
-
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
5
|
-
import { createDelegatedSetupWizardProxy } from "openclaw/plugin-sdk/setup-runtime";
|
|
6
|
-
//#region extensions/nostr/src/channel.setup.ts
|
|
7
|
-
const channel = "nostr";
|
|
8
|
-
function getNostrConfig(cfg) {
|
|
9
|
-
return cfg.channels?.nostr;
|
|
10
|
-
}
|
|
11
|
-
function resolveDefaultSetupNostrAccountId(cfg) {
|
|
12
|
-
return normalizeAccountId(getNostrConfig(cfg)?.defaultAccount);
|
|
13
|
-
}
|
|
14
|
-
function resolveSetupNostrAccount(params) {
|
|
15
|
-
const nostrCfg = getNostrConfig(params.cfg);
|
|
16
|
-
const accountId = normalizeAccountId(params.accountId ?? resolveDefaultSetupNostrAccountId(params.cfg));
|
|
17
|
-
const privateKey = resolveNostrPrivateKey(nostrCfg?.privateKey);
|
|
18
|
-
const configured = hasConfiguredNostrPrivateKey(nostrCfg?.privateKey);
|
|
19
|
-
return {
|
|
20
|
-
accountId,
|
|
21
|
-
name: typeof nostrCfg?.name === "string" ? nostrCfg.name : void 0,
|
|
22
|
-
enabled: nostrCfg?.enabled !== false,
|
|
23
|
-
configured,
|
|
24
|
-
privateKey,
|
|
25
|
-
publicKey: "",
|
|
26
|
-
relays: nostrCfg?.relays ?? DEFAULT_RELAYS,
|
|
27
|
-
profile: nostrCfg?.profile,
|
|
28
|
-
config: {
|
|
29
|
-
enabled: nostrCfg?.enabled,
|
|
30
|
-
name: nostrCfg?.name,
|
|
31
|
-
privateKey: nostrCfg?.privateKey,
|
|
32
|
-
relays: nostrCfg?.relays,
|
|
33
|
-
dmPolicy: nostrCfg?.dmPolicy,
|
|
34
|
-
allowFrom: nostrCfg?.allowFrom,
|
|
35
|
-
profile: nostrCfg?.profile
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
const nostrSetupWizard = createDelegatedSetupWizardProxy({
|
|
40
|
-
channel,
|
|
41
|
-
loadWizard: async () => (await import("./setup-surface-CzjfhV72.js").then((n) => n.i)).nostrSetupWizard,
|
|
42
|
-
status: createNostrSetupStatus(resolveSetupNostrAccount),
|
|
43
|
-
resolveShouldPromptAccountIds: () => false,
|
|
44
|
-
delegatePrepare: true,
|
|
45
|
-
delegateFinalize: true
|
|
46
|
-
});
|
|
47
|
-
const nostrSetupPlugin = {
|
|
48
|
-
id: channel,
|
|
49
|
-
meta: {
|
|
50
|
-
id: channel,
|
|
51
|
-
label: "Nostr",
|
|
52
|
-
selectionLabel: "Nostr",
|
|
53
|
-
docsPath: "/channels/nostr",
|
|
54
|
-
docsLabel: "nostr",
|
|
55
|
-
blurb: "Decentralized DMs via Nostr relays (NIP-04)",
|
|
56
|
-
order: 100
|
|
57
|
-
},
|
|
58
|
-
capabilities: {
|
|
59
|
-
chatTypes: ["direct"],
|
|
60
|
-
media: false
|
|
61
|
-
},
|
|
62
|
-
reload: { configPrefixes: ["channels.nostr"] },
|
|
63
|
-
configSchema: buildChannelConfigSchema(NostrConfigSchema),
|
|
64
|
-
setupContract: createNostrSetupContract(createNostrSetupAdapter({ resolveAccountId: (cfg, accountId) => accountId?.trim() || resolveDefaultSetupNostrAccountId(cfg) })),
|
|
65
|
-
setupWizard: nostrSetupWizard,
|
|
66
|
-
config: {
|
|
67
|
-
listAccountIds: (cfg) => resolveSetupNostrAccount({ cfg }).configured ? [resolveDefaultSetupNostrAccountId(cfg)] : [],
|
|
68
|
-
resolveAccount: (cfg, accountId) => resolveSetupNostrAccount({
|
|
69
|
-
cfg,
|
|
70
|
-
accountId
|
|
71
|
-
}),
|
|
72
|
-
defaultAccountId: resolveDefaultSetupNostrAccountId,
|
|
73
|
-
isConfigured: (account) => account.configured,
|
|
74
|
-
describeAccount: (account) => describeAccountSnapshot({
|
|
75
|
-
account,
|
|
76
|
-
configured: account.configured,
|
|
77
|
-
extra: { publicKey: account.publicKey }
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
//#endregion
|
|
1
|
+
import { t as nostrSetupPlugin } from "./.setup/setup-plugin-api-B7qtJE84.mjs";
|
|
82
2
|
export { nostrSetupPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/nostr",
|
|
3
|
-
"version": "2026.8.
|
|
3
|
+
"version": "2026.8.33",
|
|
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.8.
|
|
15
|
+
"openclaw": ">=2026.8.33"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
"minHostVersion": ">=2026.4.10"
|
|
80
80
|
},
|
|
81
81
|
"compat": {
|
|
82
|
-
"pluginApi": ">=2026.8.
|
|
82
|
+
"pluginApi": ">=2026.8.33"
|
|
83
83
|
},
|
|
84
84
|
"build": {
|
|
85
|
-
"openclawVersion": "2026.8.
|
|
85
|
+
"openclawVersion": "2026.8.33"
|
|
86
86
|
},
|
|
87
87
|
"release": {
|
|
88
88
|
"publishToClawHub": true,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|