@openclaw/nostr 2026.9.3 → 2026.9.5
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/assets/activity.svg +3 -0
- package/assets/icon.png +0 -0
- package/dist/{channel-DWFChLbP.js → .setup/channel-ByGdjtr3.mjs} +35 -19
- 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-mA5PMspO.js → .setup/setup-surface-Dx8QxWSP.mjs} +1 -1
- package/dist/api.js +60 -7
- package/dist/channel-plugin-api.js +1 -1
- package/dist/doctor-contract-api.js +62 -106
- 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/node_modules/nostr-tools/lib/cjs/abstract-pool.js +3 -1
- package/node_modules/nostr-tools/lib/cjs/abstract-pool.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/abstract-relay.js +3 -1
- package/node_modules/nostr-tools/lib/cjs/abstract-relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/index.js +3 -1
- package/node_modules/nostr-tools/lib/cjs/index.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/nip46.js +3 -1
- package/node_modules/nostr-tools/lib/cjs/nip46.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/pool.js +3 -1
- package/node_modules/nostr-tools/lib/cjs/pool.js.map +2 -2
- package/node_modules/nostr-tools/lib/cjs/relay.js +3 -1
- package/node_modules/nostr-tools/lib/cjs/relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/abstract-pool.js +3 -1
- package/node_modules/nostr-tools/lib/esm/abstract-pool.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/abstract-relay.js +3 -1
- package/node_modules/nostr-tools/lib/esm/abstract-relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/index.js +3 -1
- package/node_modules/nostr-tools/lib/esm/index.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/nip46.js +3 -1
- package/node_modules/nostr-tools/lib/esm/nip46.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/pool.js +3 -1
- package/node_modules/nostr-tools/lib/esm/pool.js.map +2 -2
- package/node_modules/nostr-tools/lib/esm/relay.js +3 -1
- package/node_modules/nostr-tools/lib/esm/relay.js.map +2 -2
- package/node_modules/nostr-tools/lib/nostr.bundle.js +3 -1
- package/node_modules/nostr-tools/lib/nostr.bundle.js.map +2 -2
- package/node_modules/nostr-tools/package.json +1 -1
- package/node_modules/zod/README.md +27 -0
- package/node_modules/zod/compile.cjs +77 -0
- package/node_modules/zod/compile.d.cts +1 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +2 -2
- package/node_modules/zod/index.d.cts +1 -2
- package/node_modules/zod/index.d.ts +1 -2
- package/node_modules/zod/index.js +5 -2
- package/node_modules/zod/package.json +13 -2
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +5 -2
- package/node_modules/zod/src/v3/ZodError.ts +22 -12
- package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
- package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
- package/node_modules/zod/src/v3/types.ts +5 -5
- package/node_modules/zod/src/v4/classic/checks.ts +1 -0
- package/node_modules/zod/src/v4/classic/compat.ts +26 -18
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +59 -44
- package/node_modules/zod/src/v4/classic/external.ts +12 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +140 -78
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +2 -2
- package/node_modules/zod/src/v4/classic/iso.ts +2 -72
- package/node_modules/zod/src/v4/classic/parse.ts +10 -4
- package/node_modules/zod/src/v4/classic/schemas.ts +452 -262
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +135 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +30 -1
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +720 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +155 -13
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +11 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +274 -6
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +425 -10
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +281 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +47 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +183 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +46 -9
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +245 -12
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +234 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +33 -2
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +127 -5
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +11 -2
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1585 -173
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +48 -12
- package/node_modules/zod/src/v4/core/checks.ts +57 -44
- package/node_modules/zod/src/v4/core/compile.ts +2188 -0
- package/node_modules/zod/src/v4/core/core.ts +98 -19
- package/node_modules/zod/src/v4/core/doc.ts +11 -7
- package/node_modules/zod/src/v4/core/errors.ts +115 -24
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +6 -1
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +257 -93
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +284 -0
- package/node_modules/zod/src/v4/core/parse.ts +131 -38
- package/node_modules/zod/src/v4/core/regexes.ts +30 -13
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +759 -461
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +969 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +1639 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +31 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +275 -42
- package/node_modules/zod/src/v4/core/util.ts +268 -42
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/index.ts +3 -3
- package/node_modules/zod/src/v4/locales/ar.ts +3 -0
- package/node_modules/zod/src/v4/locales/az.ts +3 -0
- package/node_modules/zod/src/v4/locales/be.ts +10 -0
- package/node_modules/zod/src/v4/locales/bg.ts +3 -0
- package/node_modules/zod/src/v4/locales/bn.ts +121 -0
- package/node_modules/zod/src/v4/locales/ca.ts +3 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +138 -0
- package/node_modules/zod/src/v4/locales/cs.ts +3 -0
- package/node_modules/zod/src/v4/locales/da.ts +5 -2
- package/node_modules/zod/src/v4/locales/de.ts +3 -0
- package/node_modules/zod/src/v4/locales/el.ts +1 -0
- package/node_modules/zod/src/v4/locales/en.ts +15 -4
- package/node_modules/zod/src/v4/locales/eo.ts +3 -0
- package/node_modules/zod/src/v4/locales/es.ts +2 -0
- package/node_modules/zod/src/v4/locales/fa.ts +3 -0
- package/node_modules/zod/src/v4/locales/fi.ts +3 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +3 -0
- package/node_modules/zod/src/v4/locales/fr.ts +19 -14
- package/node_modules/zod/src/v4/locales/gu.ts +121 -0
- package/node_modules/zod/src/v4/locales/he.ts +6 -1
- package/node_modules/zod/src/v4/locales/hi.ts +124 -0
- package/node_modules/zod/src/v4/locales/hr.ts +2 -0
- package/node_modules/zod/src/v4/locales/hu.ts +3 -0
- package/node_modules/zod/src/v4/locales/hy.ts +9 -0
- package/node_modules/zod/src/v4/locales/id.ts +3 -0
- package/node_modules/zod/src/v4/locales/index.ts +10 -0
- package/node_modules/zod/src/v4/locales/is.ts +3 -0
- package/node_modules/zod/src/v4/locales/it.ts +3 -0
- package/node_modules/zod/src/v4/locales/ja.ts +3 -0
- package/node_modules/zod/src/v4/locales/ka.ts +3 -0
- package/node_modules/zod/src/v4/locales/km.ts +3 -0
- package/node_modules/zod/src/v4/locales/kn.ts +124 -0
- package/node_modules/zod/src/v4/locales/ko.ts +3 -0
- package/node_modules/zod/src/v4/locales/lt.ts +2 -0
- package/node_modules/zod/src/v4/locales/mk.ts +3 -0
- package/node_modules/zod/src/v4/locales/ms.ts +3 -0
- package/node_modules/zod/src/v4/locales/ne.ts +126 -0
- package/node_modules/zod/src/v4/locales/nl.ts +3 -0
- package/node_modules/zod/src/v4/locales/nn.ts +119 -0
- package/node_modules/zod/src/v4/locales/no.ts +5 -2
- package/node_modules/zod/src/v4/locales/ota.ts +3 -0
- package/node_modules/zod/src/v4/locales/pl.ts +3 -0
- package/node_modules/zod/src/v4/locales/ps.ts +3 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +159 -0
- package/node_modules/zod/src/v4/locales/pt.ts +99 -58
- package/node_modules/zod/src/v4/locales/ro.ts +1 -0
- package/node_modules/zod/src/v4/locales/ru.ts +10 -0
- package/node_modules/zod/src/v4/locales/sk.ts +121 -0
- package/node_modules/zod/src/v4/locales/sl.ts +3 -0
- package/node_modules/zod/src/v4/locales/sv.ts +5 -2
- package/node_modules/zod/src/v4/locales/ta.ts +3 -0
- package/node_modules/zod/src/v4/locales/th.ts +3 -0
- package/node_modules/zod/src/v4/locales/tk.ts +111 -0
- package/node_modules/zod/src/v4/locales/tr.ts +3 -0
- package/node_modules/zod/src/v4/locales/uk.ts +3 -0
- package/node_modules/zod/src/v4/locales/ur.ts +3 -0
- package/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/zod/src/v4/locales/vi.ts +3 -0
- package/node_modules/zod/src/v4/locales/yo.ts +3 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +3 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +3 -0
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +10 -1
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/parse.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +135 -56
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +72 -5
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +21 -0
- package/node_modules/zod/v3/ZodError.cjs +22 -12
- package/node_modules/zod/v3/ZodError.d.cts +1 -1
- package/node_modules/zod/v3/ZodError.d.ts +1 -1
- package/node_modules/zod/v3/ZodError.js +22 -12
- package/node_modules/zod/v3/types.cjs +7 -5
- package/node_modules/zod/v3/types.js +7 -5
- package/node_modules/zod/v4/classic/checks.cjs +2 -1
- package/node_modules/zod/v4/classic/checks.d.cts +1 -1
- package/node_modules/zod/v4/classic/checks.d.ts +1 -1
- package/node_modules/zod/v4/classic/checks.js +1 -1
- package/node_modules/zod/v4/classic/compat.d.cts +9 -11
- package/node_modules/zod/v4/classic/compat.d.ts +9 -11
- package/node_modules/zod/v4/classic/deep-partial.cjs +39 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +43 -34
- package/node_modules/zod/v4/classic/errors.d.cts +3 -4
- package/node_modules/zod/v4/classic/errors.d.ts +3 -4
- package/node_modules/zod/v4/classic/errors.js +43 -34
- package/node_modules/zod/v4/classic/external.cjs +30 -27
- package/node_modules/zod/v4/classic/external.d.cts +5 -2
- package/node_modules/zod/v4/classic/external.d.ts +5 -2
- package/node_modules/zod/v4/classic/external.js +5 -8
- package/node_modules/zod/v4/classic/from-json-schema.cjs +136 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +136 -75
- package/node_modules/zod/v4/classic/in-out.cjs +63 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +2 -2
- package/node_modules/zod/v4/classic/index.d.cts +1 -2
- package/node_modules/zod/v4/classic/index.d.ts +1 -2
- package/node_modules/zod/v4/classic/index.js +2 -2
- package/node_modules/zod/v4/classic/iso.cjs +11 -22
- package/node_modules/zod/v4/classic/iso.d.cts +2 -17
- package/node_modules/zod/v4/classic/iso.d.ts +2 -17
- package/node_modules/zod/v4/classic/iso.js +2 -17
- package/node_modules/zod/v4/classic/parse.cjs +4 -1
- package/node_modules/zod/v4/classic/parse.d.cts +17 -4
- package/node_modules/zod/v4/classic/parse.d.ts +17 -4
- package/node_modules/zod/v4/classic/parse.js +1 -0
- package/node_modules/zod/v4/classic/schemas.cjs +498 -398
- package/node_modules/zod/v4/classic/schemas.d.cts +53 -18
- package/node_modules/zod/v4/classic/schemas.d.ts +53 -18
- package/node_modules/zod/v4/classic/schemas.js +492 -396
- package/node_modules/zod/v4/core/api.cjs +23 -4
- package/node_modules/zod/v4/core/api.d.cts +13 -9
- package/node_modules/zod/v4/core/api.d.ts +13 -9
- package/node_modules/zod/v4/core/api.js +21 -4
- package/node_modules/zod/v4/core/checks.cjs +37 -31
- package/node_modules/zod/v4/core/checks.d.cts +13 -13
- package/node_modules/zod/v4/core/checks.d.ts +13 -13
- package/node_modules/zod/v4/core/checks.js +37 -31
- package/node_modules/zod/v4/core/compile.cjs +1813 -0
- package/node_modules/zod/v4/core/compile.d.cts +51 -0
- package/node_modules/zod/v4/core/compile.d.ts +51 -0
- package/node_modules/zod/v4/core/compile.js +1783 -0
- package/node_modules/zod/v4/core/core.cjs +81 -18
- package/node_modules/zod/v4/core/core.d.cts +16 -4
- package/node_modules/zod/v4/core/core.d.ts +16 -4
- package/node_modules/zod/v4/core/core.js +82 -19
- package/node_modules/zod/v4/core/doc.cjs +5 -7
- package/node_modules/zod/v4/core/doc.d.cts +3 -1
- package/node_modules/zod/v4/core/doc.d.ts +3 -1
- package/node_modules/zod/v4/core/doc.js +5 -7
- package/node_modules/zod/v4/core/errors.cjs +110 -25
- package/node_modules/zod/v4/core/errors.d.cts +4 -0
- package/node_modules/zod/v4/core/errors.d.ts +4 -0
- package/node_modules/zod/v4/core/errors.js +110 -25
- package/node_modules/zod/v4/core/index.cjs +5 -1
- package/node_modules/zod/v4/core/index.d.cts +3 -0
- package/node_modules/zod/v4/core/index.d.ts +3 -0
- package/node_modules/zod/v4/core/index.js +3 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +4 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.js +4 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +264 -95
- package/node_modules/zod/v4/core/json-schema-processors.js +243 -97
- package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
- package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
- package/node_modules/zod/v4/core/memoizer.cjs +272 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +265 -0
- package/node_modules/zod/v4/core/parse.cjs +96 -34
- package/node_modules/zod/v4/core/parse.d.cts +14 -11
- package/node_modules/zod/v4/core/parse.d.ts +14 -11
- package/node_modules/zod/v4/core/parse.js +94 -33
- package/node_modules/zod/v4/core/regexes.cjs +27 -15
- package/node_modules/zod/v4/core/regexes.d.cts +2 -0
- package/node_modules/zod/v4/core/regexes.d.ts +2 -0
- package/node_modules/zod/v4/core/regexes.js +24 -13
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +537 -326
- package/node_modules/zod/v4/core/schemas.d.cts +100 -31
- package/node_modules/zod/v4/core/schemas.d.ts +100 -31
- package/node_modules/zod/v4/core/schemas.js +526 -325
- package/node_modules/zod/v4/core/to-json-schema.cjs +242 -39
- package/node_modules/zod/v4/core/to-json-schema.d.cts +42 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +42 -3
- package/node_modules/zod/v4/core/to-json-schema.js +241 -39
- package/node_modules/zod/v4/core/util.cjs +212 -31
- package/node_modules/zod/v4/core/util.d.cts +58 -1
- package/node_modules/zod/v4/core/util.d.ts +58 -1
- package/node_modules/zod/v4/core/util.js +202 -30
- package/node_modules/zod/v4/core/versions.cjs +2 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/core/visit.cjs +195 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +15 -5
- package/node_modules/zod/v4/index.d.cts +2 -2
- package/node_modules/zod/v4/index.d.ts +2 -2
- package/node_modules/zod/v4/index.js +3 -2
- package/node_modules/zod/v4/locales/ar.cjs +3 -0
- package/node_modules/zod/v4/locales/ar.js +3 -0
- package/node_modules/zod/v4/locales/az.cjs +3 -0
- package/node_modules/zod/v4/locales/az.js +3 -0
- package/node_modules/zod/v4/locales/be.cjs +10 -0
- package/node_modules/zod/v4/locales/be.js +10 -0
- package/node_modules/zod/v4/locales/bg.cjs +3 -0
- package/node_modules/zod/v4/locales/bg.js +3 -0
- package/node_modules/zod/v4/locales/bn.cjs +138 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +111 -0
- package/node_modules/zod/v4/locales/ca.cjs +3 -0
- package/node_modules/zod/v4/locales/ca.js +3 -0
- package/node_modules/zod/v4/locales/ckb.cjs +158 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +131 -0
- package/node_modules/zod/v4/locales/cs.cjs +3 -0
- package/node_modules/zod/v4/locales/cs.js +3 -0
- package/node_modules/zod/v4/locales/da.cjs +5 -2
- package/node_modules/zod/v4/locales/da.js +5 -2
- package/node_modules/zod/v4/locales/de.cjs +3 -0
- package/node_modules/zod/v4/locales/de.js +3 -0
- package/node_modules/zod/v4/locales/el.cjs +1 -0
- package/node_modules/zod/v4/locales/el.js +1 -0
- package/node_modules/zod/v4/locales/en.cjs +14 -4
- package/node_modules/zod/v4/locales/en.js +14 -4
- package/node_modules/zod/v4/locales/eo.cjs +3 -0
- package/node_modules/zod/v4/locales/eo.js +3 -0
- package/node_modules/zod/v4/locales/es.cjs +2 -0
- package/node_modules/zod/v4/locales/es.js +2 -0
- package/node_modules/zod/v4/locales/fa.cjs +3 -0
- package/node_modules/zod/v4/locales/fa.js +3 -0
- package/node_modules/zod/v4/locales/fi.cjs +3 -0
- package/node_modules/zod/v4/locales/fi.js +3 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +3 -0
- package/node_modules/zod/v4/locales/fr-CA.js +3 -0
- package/node_modules/zod/v4/locales/fr.cjs +16 -14
- package/node_modules/zod/v4/locales/fr.js +16 -14
- package/node_modules/zod/v4/locales/gu.cjs +138 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +111 -0
- package/node_modules/zod/v4/locales/he.cjs +5 -0
- package/node_modules/zod/v4/locales/he.js +5 -0
- package/node_modules/zod/v4/locales/hi.cjs +136 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +109 -0
- package/node_modules/zod/v4/locales/hr.cjs +2 -0
- package/node_modules/zod/v4/locales/hr.js +2 -0
- package/node_modules/zod/v4/locales/hu.cjs +3 -0
- package/node_modules/zod/v4/locales/hu.js +3 -0
- package/node_modules/zod/v4/locales/hy.cjs +9 -0
- package/node_modules/zod/v4/locales/hy.js +9 -0
- package/node_modules/zod/v4/locales/id.cjs +3 -0
- package/node_modules/zod/v4/locales/id.js +3 -0
- package/node_modules/zod/v4/locales/index.cjs +22 -2
- package/node_modules/zod/v4/locales/index.d.cts +10 -0
- package/node_modules/zod/v4/locales/index.d.ts +10 -0
- package/node_modules/zod/v4/locales/index.js +10 -0
- package/node_modules/zod/v4/locales/is.cjs +3 -0
- package/node_modules/zod/v4/locales/is.js +3 -0
- package/node_modules/zod/v4/locales/it.cjs +3 -0
- package/node_modules/zod/v4/locales/it.js +3 -0
- package/node_modules/zod/v4/locales/ja.cjs +3 -0
- package/node_modules/zod/v4/locales/ja.js +3 -0
- package/node_modules/zod/v4/locales/ka.cjs +3 -0
- package/node_modules/zod/v4/locales/ka.js +3 -0
- package/node_modules/zod/v4/locales/km.cjs +3 -0
- package/node_modules/zod/v4/locales/km.js +3 -0
- package/node_modules/zod/v4/locales/kn.cjs +141 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +114 -0
- package/node_modules/zod/v4/locales/ko.cjs +3 -0
- package/node_modules/zod/v4/locales/ko.js +3 -0
- package/node_modules/zod/v4/locales/lt.cjs +2 -0
- package/node_modules/zod/v4/locales/lt.js +2 -0
- package/node_modules/zod/v4/locales/mk.cjs +3 -0
- package/node_modules/zod/v4/locales/mk.js +3 -0
- package/node_modules/zod/v4/locales/ms.cjs +3 -0
- package/node_modules/zod/v4/locales/ms.js +3 -0
- package/node_modules/zod/v4/locales/ne.cjs +136 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +109 -0
- package/node_modules/zod/v4/locales/nl.cjs +3 -0
- package/node_modules/zod/v4/locales/nl.js +3 -0
- package/node_modules/zod/v4/locales/nn.cjs +138 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +111 -0
- package/node_modules/zod/v4/locales/no.cjs +5 -2
- package/node_modules/zod/v4/locales/no.js +5 -2
- package/node_modules/zod/v4/locales/ota.cjs +3 -0
- package/node_modules/zod/v4/locales/ota.js +3 -0
- package/node_modules/zod/v4/locales/pl.cjs +3 -0
- package/node_modules/zod/v4/locales/pl.js +3 -0
- package/node_modules/zod/v4/locales/ps.cjs +3 -0
- package/node_modules/zod/v4/locales/ps.js +3 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +168 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +141 -0
- package/node_modules/zod/v4/locales/pt.cjs +87 -55
- package/node_modules/zod/v4/locales/pt.js +87 -55
- package/node_modules/zod/v4/locales/ro.cjs +1 -0
- package/node_modules/zod/v4/locales/ro.js +1 -0
- package/node_modules/zod/v4/locales/ru.cjs +10 -0
- package/node_modules/zod/v4/locales/ru.js +10 -0
- package/node_modules/zod/v4/locales/sk.cjs +141 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +114 -0
- package/node_modules/zod/v4/locales/sl.cjs +3 -0
- package/node_modules/zod/v4/locales/sl.js +3 -0
- package/node_modules/zod/v4/locales/sv.cjs +5 -2
- package/node_modules/zod/v4/locales/sv.js +5 -2
- package/node_modules/zod/v4/locales/ta.cjs +3 -0
- package/node_modules/zod/v4/locales/ta.js +3 -0
- package/node_modules/zod/v4/locales/th.cjs +3 -0
- package/node_modules/zod/v4/locales/th.js +3 -0
- package/node_modules/zod/v4/locales/tk.cjs +132 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +105 -0
- package/node_modules/zod/v4/locales/tr.cjs +3 -0
- package/node_modules/zod/v4/locales/tr.js +3 -0
- package/node_modules/zod/v4/locales/uk.cjs +3 -0
- package/node_modules/zod/v4/locales/uk.js +3 -0
- package/node_modules/zod/v4/locales/ur.cjs +3 -0
- package/node_modules/zod/v4/locales/ur.js +3 -0
- package/node_modules/zod/v4/locales/uz.cjs +1 -0
- package/node_modules/zod/v4/locales/uz.js +1 -0
- package/node_modules/zod/v4/locales/vi.cjs +3 -0
- package/node_modules/zod/v4/locales/vi.js +3 -0
- package/node_modules/zod/v4/locales/yo.cjs +3 -0
- package/node_modules/zod/v4/locales/yo.js +3 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +3 -0
- package/node_modules/zod/v4/locales/zh-CN.js +3 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +3 -0
- package/node_modules/zod/v4/locales/zh-TW.js +3 -0
- package/node_modules/zod/v4/mini/checks.cjs +2 -1
- package/node_modules/zod/v4/mini/checks.d.cts +1 -1
- package/node_modules/zod/v4/mini/checks.d.ts +1 -1
- package/node_modules/zod/v4/mini/checks.js +1 -1
- package/node_modules/zod/v4/mini/deep-partial.cjs +39 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +12 -1
- package/node_modules/zod/v4/mini/external.d.cts +5 -2
- package/node_modules/zod/v4/mini/external.d.ts +5 -2
- package/node_modules/zod/v4/mini/external.js +3 -1
- package/node_modules/zod/v4/mini/in-out.cjs +63 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -0
- package/node_modules/zod/v4/mini/parse.cjs +3 -1
- package/node_modules/zod/v4/mini/parse.d.cts +1 -1
- package/node_modules/zod/v4/mini/parse.d.ts +1 -1
- package/node_modules/zod/v4/mini/parse.js +1 -1
- package/node_modules/zod/v4/mini/schemas.cjs +75 -47
- package/node_modules/zod/v4/mini/schemas.d.cts +43 -13
- package/node_modules/zod/v4/mini/schemas.d.ts +43 -13
- package/node_modules/zod/v4/mini/schemas.js +71 -45
- package/openclaw.plugin.json +6 -7
- package/package.json +10 -7
- package/node_modules/zod/src/v4/core/config.ts +0 -15
- /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
package/assets/icon.png
ADDED
|
Binary file
|
|
@@ -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";
|
|
@@ -1050,7 +1050,7 @@ async function startNostrBus(options) {
|
|
|
1050
1050
|
return;
|
|
1051
1051
|
}
|
|
1052
1052
|
const replyTo = async (text) => {
|
|
1053
|
-
await sendEncryptedDm(pool, sk, event.pubkey, text, relays, metrics, circuitBreakers, healthTracker, onError, event.id);
|
|
1053
|
+
await sendEncryptedDm(pool, sk, event.pubkey, text, relays, metrics, circuitBreakers, healthTracker, onError, { replyToEventId: event.id });
|
|
1054
1054
|
};
|
|
1055
1055
|
if (Buffer.byteLength(event.content, "utf8") > guardPolicy.maxCiphertextBytes) {
|
|
1056
1056
|
if (rejectIfGlobalRateLimited()) throw new Error(`Nostr event ${event.id} hit the global rate limit.`);
|
|
@@ -1214,8 +1214,8 @@ async function startNostrBus(options) {
|
|
|
1214
1214
|
await Promise.allSettled([stopRelays("startup failed"), ingress.stop()]);
|
|
1215
1215
|
throw error;
|
|
1216
1216
|
}
|
|
1217
|
-
const sendDm = async (toPubkey, text) => {
|
|
1218
|
-
return await sendEncryptedDm(pool, sk, toPubkey, text, relays, metrics, circuitBreakers, healthTracker, onError);
|
|
1217
|
+
const sendDm = async (toPubkey, text, sendOptions) => {
|
|
1218
|
+
return await sendEncryptedDm(pool, sk, toPubkey, text, relays, metrics, circuitBreakers, healthTracker, onError, sendOptions);
|
|
1219
1219
|
};
|
|
1220
1220
|
const publishProfile$1 = async (profile) => {
|
|
1221
1221
|
const lastPublishedAt = (await readNostrProfileState({ accountId }))?.lastPublishedAt ?? void 0;
|
|
@@ -1263,10 +1263,10 @@ async function startNostrBus(options) {
|
|
|
1263
1263
|
/**
|
|
1264
1264
|
* Send an encrypted DM to a pubkey
|
|
1265
1265
|
*/
|
|
1266
|
-
async function sendEncryptedDm(pool, sk, toPubkey, text, relays, metrics, circuitBreakers, healthTracker, onError,
|
|
1266
|
+
async function sendEncryptedDm(pool, sk, toPubkey, text, relays, metrics, circuitBreakers, healthTracker, onError, options) {
|
|
1267
1267
|
const ciphertext = encrypt(sk, toPubkey, text);
|
|
1268
1268
|
const tags = [["p", toPubkey]];
|
|
1269
|
-
if (replyToEventId) tags.push(["e", replyToEventId]);
|
|
1269
|
+
if (options?.replyToEventId) tags.push(["e", options.replyToEventId]);
|
|
1270
1270
|
const reply = finalizeEvent({
|
|
1271
1271
|
kind: 4,
|
|
1272
1272
|
content: ciphertext,
|
|
@@ -1276,16 +1276,11 @@ async function sendEncryptedDm(pool, sk, toPubkey, text, relays, metrics, circui
|
|
|
1276
1276
|
const sortedRelays = healthTracker.getSortedRelays(relays);
|
|
1277
1277
|
let lastError;
|
|
1278
1278
|
for (const relay of sortedRelays) {
|
|
1279
|
+
options?.assertDirectAdapterHandoff?.();
|
|
1279
1280
|
const cb = circuitBreakers.get(relay);
|
|
1280
1281
|
if (cb && !cb.canAttempt()) continue;
|
|
1281
1282
|
const startTime = Date.now();
|
|
1282
|
-
|
|
1283
|
-
await pool.publish([relay], reply)[0];
|
|
1284
|
-
const latency = Date.now() - startTime;
|
|
1285
|
-
cb?.recordSuccess();
|
|
1286
|
-
healthTracker.recordSuccess(relay, latency);
|
|
1287
|
-
return reply.id;
|
|
1288
|
-
} catch (err) {
|
|
1283
|
+
const recordFailure = (err) => {
|
|
1289
1284
|
lastError = err instanceof Error ? err : new Error(String(err));
|
|
1290
1285
|
const latency = Date.now() - startTime;
|
|
1291
1286
|
cb?.recordFailure();
|
|
@@ -1295,6 +1290,24 @@ async function sendEncryptedDm(pool, sk, toPubkey, text, relays, metrics, circui
|
|
|
1295
1290
|
latency
|
|
1296
1291
|
});
|
|
1297
1292
|
onError?.(lastError, `publish to ${relay}`);
|
|
1293
|
+
};
|
|
1294
|
+
const connection = await pool.ensureRelay(relay, { connectionTimeout: pool.maxWaitForConnection }).catch((err) => {
|
|
1295
|
+
recordFailure(/* @__PURE__ */ new Error(`connection failure: ${String(err)}`));
|
|
1296
|
+
});
|
|
1297
|
+
if (!connection) continue;
|
|
1298
|
+
options?.assertDirectAdapterHandoff?.();
|
|
1299
|
+
if (options?.onPlatformSendDispatch) {
|
|
1300
|
+
await options.onPlatformSendDispatch();
|
|
1301
|
+
options.assertDirectAdapterHandoff?.();
|
|
1302
|
+
}
|
|
1303
|
+
try {
|
|
1304
|
+
await connection.publish(reply);
|
|
1305
|
+
const latency = Date.now() - startTime;
|
|
1306
|
+
cb?.recordSuccess();
|
|
1307
|
+
healthTracker.recordSuccess(relay, latency);
|
|
1308
|
+
return reply.id;
|
|
1309
|
+
} catch (err) {
|
|
1310
|
+
recordFailure(err);
|
|
1298
1311
|
}
|
|
1299
1312
|
}
|
|
1300
1313
|
throw new Error(`Failed to publish to any relay: ${lastError?.message}`);
|
|
@@ -1408,7 +1421,7 @@ const startNostrGatewayAccount = async (ctx) => {
|
|
|
1408
1421
|
ctx.log?.warn?.(`[${account.accountId}] dropping Nostr DM after preflight drift (${senderPubkey}, ${resolvedAccess.senderAccess.reasonCode})`);
|
|
1409
1422
|
return;
|
|
1410
1423
|
}
|
|
1411
|
-
const { dispatchInboundDirectDm } = await import("./inbound-direct-dm-runtime-DHn9NoYN.
|
|
1424
|
+
const { dispatchInboundDirectDm } = await import("./inbound-direct-dm-runtime-DHn9NoYN.mjs");
|
|
1412
1425
|
await dispatchInboundDirectDm({
|
|
1413
1426
|
channelRuntime,
|
|
1414
1427
|
resolveChannelIngress: async (contextBinding) => {
|
|
@@ -1517,7 +1530,7 @@ const nostrOutboundAdapter = {
|
|
|
1517
1530
|
text: true,
|
|
1518
1531
|
messageSendingHooks: true
|
|
1519
1532
|
} },
|
|
1520
|
-
sendText: async ({ cfg, to, text, accountId }) => {
|
|
1533
|
+
sendText: async ({ cfg, to, text, accountId, assertDirectAdapterHandoff, onPlatformSendDispatch }) => {
|
|
1521
1534
|
const core = getNostrRuntime();
|
|
1522
1535
|
const aid = accountId ?? resolveDefaultNostrAccountId(cfg);
|
|
1523
1536
|
const bus = activeBuses.get(aid);
|
|
@@ -1530,7 +1543,10 @@ const nostrOutboundAdapter = {
|
|
|
1530
1543
|
const message = stripMarkdown(core.channel.text.convertMarkdownTables(text ?? "", tableMode));
|
|
1531
1544
|
if (!message) throw new Error("Nostr send requires non-empty text after markdown stripping.");
|
|
1532
1545
|
const normalizedTo = normalizePubkey(to);
|
|
1533
|
-
const eventId = await bus.sendDm(normalizedTo, message
|
|
1546
|
+
const eventId = await bus.sendDm(normalizedTo, message, {
|
|
1547
|
+
assertDirectAdapterHandoff,
|
|
1548
|
+
onPlatformSendDispatch
|
|
1549
|
+
});
|
|
1534
1550
|
return attachChannelToResult("nostr", {
|
|
1535
1551
|
to: normalizedTo,
|
|
1536
1552
|
messageId: eventId
|
|
@@ -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";
|
package/dist/api.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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 "
|
|
5
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
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-ByGdjtr3.mjs";
|
|
5
|
+
import { isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { SimplePool } from "nostr-tools";
|
|
8
8
|
import { createFixedWindowRateLimiter as createFixedWindowRateLimiter$1 } from "openclaw/plugin-sdk/webhook-ingress";
|
|
@@ -11,9 +11,26 @@ import { isBlockedHostnameOrIp, isLoopbackHost } from "openclaw/plugin-sdk/ssrf-
|
|
|
11
11
|
import { readJsonBodyWithLimit, requestBodyErrorToText } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
12
12
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
13
13
|
//#region extensions/nostr/src/nostr-profile-url-safety.ts
|
|
14
|
+
function normalizeNostrProfileUrlForRuntime(urlStr) {
|
|
15
|
+
return urlStr.replace(/^([a-z][a-z\d+.-]*:\/\/\[[\da-f:]*:)(0|[1-9]\d{0,2})\.(0|[1-9]\d{0,2})\.(0|[1-9]\d{0,2})\.(0|[1-9]\d{0,2})(\].*)$/iu, (original, prefix, a, b, c, d, suffix) => {
|
|
16
|
+
const octets = [
|
|
17
|
+
a,
|
|
18
|
+
b,
|
|
19
|
+
c,
|
|
20
|
+
d
|
|
21
|
+
].map(Number);
|
|
22
|
+
if (octets.some((octet) => !Number.isInteger(octet) || octet > 255)) return original;
|
|
23
|
+
const high = (octets[0] ?? 0) << 8 | (octets[1] ?? 0);
|
|
24
|
+
const low = (octets[2] ?? 0) << 8 | (octets[3] ?? 0);
|
|
25
|
+
return `${prefix}${high.toString(16)}:${low.toString(16)}${suffix}`;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function parseNostrProfileUrl(urlStr) {
|
|
29
|
+
return new URL(normalizeNostrProfileUrlForRuntime(urlStr));
|
|
30
|
+
}
|
|
14
31
|
function validateUrlSafety(urlStr) {
|
|
15
32
|
try {
|
|
16
|
-
const url =
|
|
33
|
+
const url = parseNostrProfileUrl(urlStr);
|
|
17
34
|
if (url.protocol !== "https:") return {
|
|
18
35
|
ok: false,
|
|
19
36
|
error: "URL must use https:// protocol"
|
|
@@ -204,6 +221,36 @@ const ProfileUpdateSchema = NostrProfileSchema.extend({
|
|
|
204
221
|
lud16: lud16FormatSchema
|
|
205
222
|
});
|
|
206
223
|
const PROFILE_MUTATION_SCOPE = "operator.admin";
|
|
224
|
+
const PROFILE_URL_FIELDS = [
|
|
225
|
+
"picture",
|
|
226
|
+
"banner",
|
|
227
|
+
"website"
|
|
228
|
+
];
|
|
229
|
+
function normalizeProfileUpdateUrlInputs(value) {
|
|
230
|
+
if (!isRecord(value)) return value;
|
|
231
|
+
const record = value;
|
|
232
|
+
let normalized;
|
|
233
|
+
for (const field of PROFILE_URL_FIELDS) {
|
|
234
|
+
const input = record[field];
|
|
235
|
+
if (typeof input !== "string") continue;
|
|
236
|
+
const next = normalizeNostrProfileUrlForRuntime(input);
|
|
237
|
+
if (next !== input) {
|
|
238
|
+
normalized ??= { ...record };
|
|
239
|
+
normalized[field] = next;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return normalized ?? value;
|
|
243
|
+
}
|
|
244
|
+
function restoreProfileUpdateUrlInputs(profile, value) {
|
|
245
|
+
if (!isRecord(value)) return profile;
|
|
246
|
+
const record = value;
|
|
247
|
+
return {
|
|
248
|
+
...profile,
|
|
249
|
+
...typeof record.picture === "string" ? { picture: record.picture } : {},
|
|
250
|
+
...typeof record.banner === "string" ? { banner: record.banner } : {},
|
|
251
|
+
...typeof record.website === "string" ? { website: record.website } : {}
|
|
252
|
+
};
|
|
253
|
+
}
|
|
207
254
|
function sendJson(res, status, body) {
|
|
208
255
|
res.statusCode = status;
|
|
209
256
|
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
@@ -341,6 +388,7 @@ function createNostrProfileHttpHandler(ctx) {
|
|
|
341
388
|
});
|
|
342
389
|
return true;
|
|
343
390
|
} catch (err) {
|
|
391
|
+
if (res.writableEnded) return true;
|
|
344
392
|
ctx.log?.error(`Profile HTTP error: ${String(err)}`);
|
|
345
393
|
sendJson(res, 500, {
|
|
346
394
|
ok: false,
|
|
@@ -380,7 +428,7 @@ async function handleUpdateProfile(accountId, ctx, req, res) {
|
|
|
380
428
|
});
|
|
381
429
|
return true;
|
|
382
430
|
}
|
|
383
|
-
const parseResult = ProfileUpdateSchema.safeParse(body);
|
|
431
|
+
const parseResult = ProfileUpdateSchema.safeParse(normalizeProfileUpdateUrlInputs(body));
|
|
384
432
|
if (!parseResult.success) {
|
|
385
433
|
sendJson(res, 400, {
|
|
386
434
|
ok: false,
|
|
@@ -389,7 +437,7 @@ async function handleUpdateProfile(accountId, ctx, req, res) {
|
|
|
389
437
|
});
|
|
390
438
|
return true;
|
|
391
439
|
}
|
|
392
|
-
const profile = parseResult.data;
|
|
440
|
+
const profile = restoreProfileUpdateUrlInputs(parseResult.data, body);
|
|
393
441
|
if (profile.picture) {
|
|
394
442
|
const pictureCheck = validateUrlSafety(profile.picture);
|
|
395
443
|
if (!pictureCheck.ok) {
|
|
@@ -426,9 +474,11 @@ async function handleUpdateProfile(accountId, ctx, req, res) {
|
|
|
426
474
|
};
|
|
427
475
|
try {
|
|
428
476
|
const result = await withPublishLock(accountId, async () => {
|
|
477
|
+
await getPluginRuntimeGatewayRequestScope()?.revalidate?.();
|
|
429
478
|
return await publishNostrProfile(accountId, mergedProfile);
|
|
430
479
|
});
|
|
431
480
|
if (result.successes.length > 0) {
|
|
481
|
+
await getPluginRuntimeGatewayRequestScope()?.revalidate?.();
|
|
432
482
|
await ctx.updateConfigProfile(accountId, mergedProfile);
|
|
433
483
|
ctx.log?.info(`[${accountId}] Profile published to ${result.successes.length} relay(s)`);
|
|
434
484
|
} else ctx.log?.warn(`[${accountId}] Profile publish failed on all relays`);
|
|
@@ -441,6 +491,7 @@ async function handleUpdateProfile(accountId, ctx, req, res) {
|
|
|
441
491
|
persisted: result.successes.length > 0
|
|
442
492
|
});
|
|
443
493
|
} catch (err) {
|
|
494
|
+
if (res.writableEnded) return true;
|
|
444
495
|
ctx.log?.error(`[${accountId}] Profile publish error: ${String(err)}`);
|
|
445
496
|
sendJson(res, 500, {
|
|
446
497
|
ok: false,
|
|
@@ -473,6 +524,7 @@ async function handleImportProfile(accountId, ctx, req, res) {
|
|
|
473
524
|
const body = await readJsonBody(req);
|
|
474
525
|
if (typeof body === "object" && body !== null) autoMerge = body.autoMerge === true;
|
|
475
526
|
} catch {}
|
|
527
|
+
await getPluginRuntimeGatewayRequestScope()?.revalidate?.();
|
|
476
528
|
ctx.log?.info(`[${accountId}] Importing profile for ${pubkey.slice(0, 8)}...`);
|
|
477
529
|
const result = await importProfileFromRelays({
|
|
478
530
|
pubkey,
|
|
@@ -488,6 +540,7 @@ async function handleImportProfile(accountId, ctx, req, res) {
|
|
|
488
540
|
return true;
|
|
489
541
|
}
|
|
490
542
|
if (autoMerge && result.profile) {
|
|
543
|
+
await getPluginRuntimeGatewayRequestScope()?.revalidate?.();
|
|
491
544
|
const merged = mergeProfiles(ctx.getConfigProfile(accountId), result.profile);
|
|
492
545
|
await ctx.updateConfigProfile(accountId, merged);
|
|
493
546
|
ctx.log?.info(`[${accountId}] Profile imported and merged`);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as nostrPlugin } from "
|
|
1
|
+
import { n as nostrPlugin } from "./.setup/channel-ByGdjtr3.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";
|
|
@@ -72,116 +72,72 @@ async function ensureStoreCapacity(params) {
|
|
|
72
72
|
}
|
|
73
73
|
return existingKeys;
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
});
|
|
106
|
-
if (!existingKeys) return {
|
|
107
|
-
changes,
|
|
108
|
-
warnings
|
|
109
|
-
};
|
|
110
|
-
let imported = 0;
|
|
111
|
-
for (const file of files) {
|
|
112
|
-
if (!existingKeys.has(file.accountId)) {
|
|
113
|
-
await store.register(file.accountId, file.value);
|
|
114
|
-
existingKeys.add(file.accountId);
|
|
115
|
-
imported++;
|
|
116
|
-
}
|
|
117
|
-
await archiveLegacyStateSource({
|
|
118
|
-
filePath: file.filePath,
|
|
119
|
-
label: "Nostr bus state",
|
|
120
|
-
changes,
|
|
75
|
+
function createNostrStateMigration(options) {
|
|
76
|
+
return {
|
|
77
|
+
id: `nostr-${options.namespace}-json-to-plugin-state`,
|
|
78
|
+
label: options.label,
|
|
79
|
+
async detectLegacyState(params) {
|
|
80
|
+
const files = await listLegacyFiles({
|
|
81
|
+
stateDir: params.stateDir,
|
|
82
|
+
prefix: `${options.namespace}-`,
|
|
83
|
+
parse: options.parse
|
|
84
|
+
});
|
|
85
|
+
if (files.length === 0) return null;
|
|
86
|
+
return { preview: [`- ${options.label}: ${files.length} ${files.length === 1 ? "account" : "accounts"} -> plugin state (${options.namespace})`] };
|
|
87
|
+
},
|
|
88
|
+
async migrateLegacyState(params) {
|
|
89
|
+
const changes = [];
|
|
90
|
+
const warnings = [];
|
|
91
|
+
const files = await listLegacyFiles({
|
|
92
|
+
stateDir: params.stateDir,
|
|
93
|
+
prefix: `${options.namespace}-`,
|
|
94
|
+
parse: options.parse
|
|
95
|
+
});
|
|
96
|
+
const store = params.context.openPluginStateKeyedStore({
|
|
97
|
+
namespace: options.namespace,
|
|
98
|
+
maxEntries: MAX_NOSTR_STATE_ENTRIES
|
|
99
|
+
});
|
|
100
|
+
const existingKeys = await ensureStoreCapacity({
|
|
101
|
+
files,
|
|
102
|
+
store,
|
|
103
|
+
maxEntries: MAX_NOSTR_STATE_ENTRIES,
|
|
104
|
+
label: options.label,
|
|
121
105
|
warnings
|
|
122
106
|
});
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return { preview: [`- Nostr profile state: ${files.length} ${files.length === 1 ? "account" : "accounts"} -> plugin state (${PROFILE_STATE_NAMESPACE})`] };
|
|
141
|
-
},
|
|
142
|
-
async migrateLegacyState(params) {
|
|
143
|
-
const changes = [];
|
|
144
|
-
const warnings = [];
|
|
145
|
-
const files = await listLegacyFiles({
|
|
146
|
-
stateDir: params.stateDir,
|
|
147
|
-
prefix: "profile-state-",
|
|
148
|
-
parse: parseProfileState
|
|
149
|
-
});
|
|
150
|
-
const store = params.context.openPluginStateKeyedStore({
|
|
151
|
-
namespace: PROFILE_STATE_NAMESPACE,
|
|
152
|
-
maxEntries: MAX_NOSTR_STATE_ENTRIES
|
|
153
|
-
});
|
|
154
|
-
const existingKeys = await ensureStoreCapacity({
|
|
155
|
-
files,
|
|
156
|
-
store,
|
|
157
|
-
maxEntries: MAX_NOSTR_STATE_ENTRIES,
|
|
158
|
-
label: "Nostr profile state",
|
|
159
|
-
warnings
|
|
160
|
-
});
|
|
161
|
-
if (!existingKeys) return {
|
|
162
|
-
changes,
|
|
163
|
-
warnings
|
|
164
|
-
};
|
|
165
|
-
let imported = 0;
|
|
166
|
-
for (const file of files) {
|
|
167
|
-
if (!existingKeys.has(file.accountId)) {
|
|
168
|
-
await store.register(file.accountId, file.value);
|
|
169
|
-
existingKeys.add(file.accountId);
|
|
170
|
-
imported++;
|
|
107
|
+
if (!existingKeys) return {
|
|
108
|
+
changes,
|
|
109
|
+
warnings
|
|
110
|
+
};
|
|
111
|
+
let imported = 0;
|
|
112
|
+
for (const file of files) {
|
|
113
|
+
if (!existingKeys.has(file.accountId)) {
|
|
114
|
+
await store.register(file.accountId, file.value);
|
|
115
|
+
existingKeys.add(file.accountId);
|
|
116
|
+
imported++;
|
|
117
|
+
}
|
|
118
|
+
await archiveLegacyStateSource({
|
|
119
|
+
filePath: file.filePath,
|
|
120
|
+
label: options.label,
|
|
121
|
+
changes,
|
|
122
|
+
warnings
|
|
123
|
+
});
|
|
171
124
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
label: "Nostr profile state",
|
|
125
|
+
if (imported > 0) changes.unshift(`Migrated ${imported} Nostr ${options.namespace} ${imported === 1 ? "entry" : "entries"} -> plugin state`);
|
|
126
|
+
return {
|
|
175
127
|
changes,
|
|
176
128
|
warnings
|
|
177
|
-
}
|
|
129
|
+
};
|
|
178
130
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const stateMigrations = [createNostrStateMigration({
|
|
134
|
+
namespace: BUS_STATE_NAMESPACE,
|
|
135
|
+
label: "Nostr bus state",
|
|
136
|
+
parse: parseBusState
|
|
137
|
+
}), createNostrStateMigration({
|
|
138
|
+
namespace: PROFILE_STATE_NAMESPACE,
|
|
139
|
+
label: "Nostr profile state",
|
|
140
|
+
parse: parseProfileState
|
|
141
|
+
})];
|
|
186
142
|
//#endregion
|
|
187
143
|
export { stateMigrations };
|
|
@@ -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
|
});
|