mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-24 15:41:40 +00:00
feat: add nostr setup and unify channel setup discovery
This commit is contained in:
36
src/plugin-sdk/entrypoints.ts
Normal file
36
src/plugin-sdk/entrypoints.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import pluginSdkEntryList from "../../scripts/lib/plugin-sdk-entrypoints.json" with { type: "json" };
|
||||
|
||||
export const pluginSdkEntrypoints = [...pluginSdkEntryList];
|
||||
|
||||
export const pluginSdkSubpaths = pluginSdkEntrypoints.filter((entry) => entry !== "index");
|
||||
|
||||
export function buildPluginSdkEntrySources() {
|
||||
return Object.fromEntries(
|
||||
pluginSdkEntrypoints.map((entry) => [entry, `src/plugin-sdk/${entry}.ts`]),
|
||||
);
|
||||
}
|
||||
|
||||
export function buildPluginSdkSpecifiers() {
|
||||
return pluginSdkEntrypoints.map((entry) =>
|
||||
entry === "index" ? "openclaw/plugin-sdk" : `openclaw/plugin-sdk/${entry}`,
|
||||
);
|
||||
}
|
||||
|
||||
export function buildPluginSdkPackageExports() {
|
||||
return Object.fromEntries(
|
||||
pluginSdkEntrypoints.map((entry) => [
|
||||
entry === "index" ? "./plugin-sdk" : `./plugin-sdk/${entry}`,
|
||||
{
|
||||
types: `./dist/plugin-sdk/${entry}.d.ts`,
|
||||
default: `./dist/plugin-sdk/${entry}.js`,
|
||||
},
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
export function listPluginSdkDistArtifacts() {
|
||||
return pluginSdkEntrypoints.flatMap((entry) => [
|
||||
`dist/plugin-sdk/${entry}.js`,
|
||||
`dist/plugin-sdk/${entry}.d.ts`,
|
||||
]);
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
buildPluginSdkPackageExports,
|
||||
buildPluginSdkSpecifiers,
|
||||
pluginSdkEntrypoints,
|
||||
} from "../../scripts/lib/plugin-sdk-entries.mjs";
|
||||
} from "./entrypoints.js";
|
||||
import * as sdk from "./index.js";
|
||||
|
||||
const pluginSdkSpecifiers = buildPluginSdkSpecifiers();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Keep this list additive and scoped to symbols used under extensions/nostr.
|
||||
|
||||
export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js";
|
||||
export type { ChannelSetupAdapter } from "../channels/plugins/types.adapters.js";
|
||||
export { formatPairingApproveHint } from "../channels/plugins/helpers.js";
|
||||
export type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
|
||||
export type { OpenClawConfig } from "../config/config.js";
|
||||
@@ -18,3 +19,4 @@ export {
|
||||
} from "./status-helpers.js";
|
||||
export { createFixedWindowRateLimiter } from "./webhook-memory-guards.js";
|
||||
export { mapAllowFromEntries } from "./channel-config-helpers.js";
|
||||
export { nostrSetupAdapter, nostrSetupWizard } from "../../extensions/nostr/src/setup-surface.js";
|
||||
|
||||
@@ -4,12 +4,13 @@ import * as discordSdk from "openclaw/plugin-sdk/discord";
|
||||
import * as imessageSdk from "openclaw/plugin-sdk/imessage";
|
||||
import * as lineSdk from "openclaw/plugin-sdk/line";
|
||||
import * as msteamsSdk from "openclaw/plugin-sdk/msteams";
|
||||
import * as nostrSdk from "openclaw/plugin-sdk/nostr";
|
||||
import * as signalSdk from "openclaw/plugin-sdk/signal";
|
||||
import * as slackSdk from "openclaw/plugin-sdk/slack";
|
||||
import * as telegramSdk from "openclaw/plugin-sdk/telegram";
|
||||
import * as whatsappSdk from "openclaw/plugin-sdk/whatsapp";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { pluginSdkSubpaths } from "../../scripts/lib/plugin-sdk-entries.mjs";
|
||||
import { pluginSdkSubpaths } from "./entrypoints.js";
|
||||
|
||||
const importPluginSdkSubpath = (specifier: string) => import(/* @vite-ignore */ specifier);
|
||||
|
||||
@@ -93,6 +94,11 @@ describe("plugin-sdk subpath exports", () => {
|
||||
expect(typeof msteamsSdk.msteamsSetupAdapter).toBe("object");
|
||||
});
|
||||
|
||||
it("exports Nostr helpers", () => {
|
||||
expect(typeof nostrSdk.nostrSetupWizard).toBe("object");
|
||||
expect(typeof nostrSdk.nostrSetupAdapter).toBe("object");
|
||||
});
|
||||
|
||||
it("exports Google Chat helpers", async () => {
|
||||
const googlechatSdk = await import("openclaw/plugin-sdk/googlechat");
|
||||
expect(typeof googlechatSdk.googlechatSetupWizard).toBe("object");
|
||||
|
||||
Reference in New Issue
Block a user