diff --git a/extensions/feishu/runtime-api.ts b/extensions/feishu/runtime-api.ts index cde6bbf5569..ece8df41cca 100644 --- a/extensions/feishu/runtime-api.ts +++ b/extensions/feishu/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Feishu extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../src/plugin-sdk/feishu.js"; +export * from "openclaw/plugin-sdk/feishu"; diff --git a/extensions/googlechat/runtime-api.ts b/extensions/googlechat/runtime-api.ts index cd47c0e56c7..df946f8ec4a 100644 --- a/extensions/googlechat/runtime-api.ts +++ b/extensions/googlechat/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Google Chat extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../src/plugin-sdk/googlechat.js"; +export * from "openclaw/plugin-sdk/googlechat"; diff --git a/extensions/irc/src/runtime-api.ts b/extensions/irc/src/runtime-api.ts index 96e4bdbbe90..40f35e1ad53 100644 --- a/extensions/irc/src/runtime-api.ts +++ b/extensions/irc/src/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled IRC extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../../src/plugin-sdk/irc.js"; +export * from "openclaw/plugin-sdk/irc"; diff --git a/extensions/line/runtime-api.ts b/extensions/line/runtime-api.ts index 53f1be0c51c..b40e5c76e0e 100644 --- a/extensions/line/runtime-api.ts +++ b/extensions/line/runtime-api.ts @@ -1,12 +1,12 @@ // Private runtime barrel for the bundled LINE extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../src/plugin-sdk/line.js"; -export { resolveExactLineGroupConfigKey } from "../../src/plugin-sdk/line-core.js"; +export * from "openclaw/plugin-sdk/line"; +export { resolveExactLineGroupConfigKey } from "openclaw/plugin-sdk/line-core"; export { formatDocsLink, setSetupChannelEnabled, splitSetupEntries, type ChannelSetupDmPolicy, type ChannelSetupWizard, -} from "../../src/plugin-sdk/line-core.js"; +} from "openclaw/plugin-sdk/line-core"; diff --git a/extensions/line/src/config-adapter.ts b/extensions/line/src/config-adapter.ts index 1b10989b45c..3894210f0a6 100644 --- a/extensions/line/src/config-adapter.ts +++ b/extensions/line/src/config-adapter.ts @@ -5,7 +5,7 @@ import { resolveLineAccount, type OpenClawConfig, type ResolvedLineAccount, -} from "../runtime-api.js"; +} from "openclaw/plugin-sdk/line-core"; export function normalizeLineAllowFrom(entry: string): string { return entry.replace(/^line:(?:user:)?/i, ""); diff --git a/extensions/line/src/group-policy.ts b/extensions/line/src/group-policy.ts index eaf30e04cf7..e6b4fa0ba95 100644 --- a/extensions/line/src/group-policy.ts +++ b/extensions/line/src/group-policy.ts @@ -1,5 +1,5 @@ import { resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy"; -import { resolveExactLineGroupConfigKey, type OpenClawConfig } from "../runtime-api.js"; +import { resolveExactLineGroupConfigKey, type OpenClawConfig } from "openclaw/plugin-sdk/line-core"; type LineGroupContext = { cfg: OpenClawConfig; diff --git a/extensions/line/src/setup-core.ts b/extensions/line/src/setup-core.ts index 7e894d2b87a..363b4dcb2a1 100644 --- a/extensions/line/src/setup-core.ts +++ b/extensions/line/src/setup-core.ts @@ -1,11 +1,11 @@ -import type { ChannelSetupAdapter, OpenClawConfig } from "openclaw/plugin-sdk/setup"; import { DEFAULT_ACCOUNT_ID, listLineAccountIds, normalizeAccountId, resolveLineAccount, type LineConfig, -} from "../runtime-api.js"; +} from "openclaw/plugin-sdk/line-core"; +import type { ChannelSetupAdapter, OpenClawConfig } from "openclaw/plugin-sdk/setup"; const channel = "line" as const; diff --git a/extensions/line/src/setup-surface.ts b/extensions/line/src/setup-surface.ts index 6f46cc92217..640ad3812b8 100644 --- a/extensions/line/src/setup-surface.ts +++ b/extensions/line/src/setup-surface.ts @@ -1,4 +1,3 @@ -import { createAllowFromSection, createTopLevelChannelDmPolicy } from "openclaw/plugin-sdk/setup"; import { DEFAULT_ACCOUNT_ID, formatDocsLink, @@ -7,7 +6,8 @@ import { splitSetupEntries, type ChannelSetupDmPolicy, type ChannelSetupWizard, -} from "../runtime-api.js"; +} from "openclaw/plugin-sdk/line-core"; +import { createAllowFromSection, createTopLevelChannelDmPolicy } from "openclaw/plugin-sdk/setup"; import { isLineConfigured, listLineAccountIds, diff --git a/extensions/mattermost/runtime-api.ts b/extensions/mattermost/runtime-api.ts index 2bc65439262..d4e591c8c1e 100644 --- a/extensions/mattermost/runtime-api.ts +++ b/extensions/mattermost/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Mattermost extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../src/plugin-sdk/mattermost.js"; +export * from "openclaw/plugin-sdk/mattermost"; diff --git a/extensions/msteams/runtime-api.ts b/extensions/msteams/runtime-api.ts index e2b75780399..d32cb7b65d5 100644 --- a/extensions/msteams/runtime-api.ts +++ b/extensions/msteams/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Microsoft Teams extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../src/plugin-sdk/msteams.js"; +export * from "openclaw/plugin-sdk/msteams"; diff --git a/extensions/nextcloud-talk/runtime-api.ts b/extensions/nextcloud-talk/runtime-api.ts index 80bc1b1dc7b..b2093a7a057 100644 --- a/extensions/nextcloud-talk/runtime-api.ts +++ b/extensions/nextcloud-talk/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Nextcloud Talk extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../src/plugin-sdk/nextcloud-talk.js"; +export * from "openclaw/plugin-sdk/nextcloud-talk"; diff --git a/extensions/nostr/runtime-api.ts b/extensions/nostr/runtime-api.ts index 602b0ac81b7..29825771891 100644 --- a/extensions/nostr/runtime-api.ts +++ b/extensions/nostr/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Nostr extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../src/plugin-sdk/nostr.js"; +export * from "openclaw/plugin-sdk/nostr"; diff --git a/extensions/signal/src/runtime-api.ts b/extensions/signal/src/runtime-api.ts index 172943641f8..6aeeef0adb1 100644 --- a/extensions/signal/src/runtime-api.ts +++ b/extensions/signal/src/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Signal extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../../src/plugin-sdk/signal.js"; +export * from "openclaw/plugin-sdk/signal"; diff --git a/extensions/tlon/runtime-api.ts b/extensions/tlon/runtime-api.ts index 3ba9718868f..3c2c83655c5 100644 --- a/extensions/tlon/runtime-api.ts +++ b/extensions/tlon/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Tlon extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../src/plugin-sdk/tlon.js"; +export * from "openclaw/plugin-sdk/tlon"; diff --git a/extensions/twitch/runtime-api.ts b/extensions/twitch/runtime-api.ts index 9d055202a39..87433b1997f 100644 --- a/extensions/twitch/runtime-api.ts +++ b/extensions/twitch/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Twitch extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../src/plugin-sdk/twitch.js"; +export * from "openclaw/plugin-sdk/twitch"; diff --git a/extensions/voice-call/runtime-api.ts b/extensions/voice-call/runtime-api.ts index f0b32548645..9dd4fb0f3bc 100644 --- a/extensions/voice-call/runtime-api.ts +++ b/extensions/voice-call/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Voice Call extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../src/plugin-sdk/voice-call.js"; +export * from "openclaw/plugin-sdk/voice-call"; diff --git a/extensions/zalo/runtime-api.ts b/extensions/zalo/runtime-api.ts index 082f65d43b8..90ced0da803 100644 --- a/extensions/zalo/runtime-api.ts +++ b/extensions/zalo/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Zalo extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../src/plugin-sdk/zalo.js"; +export * from "openclaw/plugin-sdk/zalo"; diff --git a/extensions/zalouser/runtime-api.ts b/extensions/zalouser/runtime-api.ts index 1b63edaea42..7d931f2d118 100644 --- a/extensions/zalouser/runtime-api.ts +++ b/extensions/zalouser/runtime-api.ts @@ -1,4 +1,4 @@ // Private runtime barrel for the bundled Zalo Personal extension. // Keep this barrel thin and aligned with the local extension surface. -export * from "../../src/plugin-sdk/zalouser.js"; +export * from "openclaw/plugin-sdk/zalouser"; diff --git a/package.json b/package.json index a522ced8380..91abc6172a7 100644 --- a/package.json +++ b/package.json @@ -193,10 +193,50 @@ "types": "./dist/plugin-sdk/discord-core.d.ts", "default": "./dist/plugin-sdk/discord-core.js" }, + "./plugin-sdk/feishu": { + "types": "./dist/plugin-sdk/feishu.d.ts", + "default": "./dist/plugin-sdk/feishu.js" + }, + "./plugin-sdk/googlechat": { + "types": "./dist/plugin-sdk/googlechat.d.ts", + "default": "./dist/plugin-sdk/googlechat.js" + }, + "./plugin-sdk/irc": { + "types": "./dist/plugin-sdk/irc.d.ts", + "default": "./dist/plugin-sdk/irc.js" + }, + "./plugin-sdk/line": { + "types": "./dist/plugin-sdk/line.d.ts", + "default": "./dist/plugin-sdk/line.js" + }, + "./plugin-sdk/line-core": { + "types": "./dist/plugin-sdk/line-core.d.ts", + "default": "./dist/plugin-sdk/line-core.js" + }, "./plugin-sdk/matrix": { "types": "./dist/plugin-sdk/matrix.d.ts", "default": "./dist/plugin-sdk/matrix.js" }, + "./plugin-sdk/mattermost": { + "types": "./dist/plugin-sdk/mattermost.d.ts", + "default": "./dist/plugin-sdk/mattermost.js" + }, + "./plugin-sdk/msteams": { + "types": "./dist/plugin-sdk/msteams.d.ts", + "default": "./dist/plugin-sdk/msteams.js" + }, + "./plugin-sdk/nextcloud-talk": { + "types": "./dist/plugin-sdk/nextcloud-talk.d.ts", + "default": "./dist/plugin-sdk/nextcloud-talk.js" + }, + "./plugin-sdk/nostr": { + "types": "./dist/plugin-sdk/nostr.d.ts", + "default": "./dist/plugin-sdk/nostr.js" + }, + "./plugin-sdk/signal": { + "types": "./dist/plugin-sdk/signal.d.ts", + "default": "./dist/plugin-sdk/signal.js" + }, "./plugin-sdk/slack": { "types": "./dist/plugin-sdk/slack.d.ts", "default": "./dist/plugin-sdk/slack.js" @@ -205,6 +245,26 @@ "types": "./dist/plugin-sdk/slack-core.d.ts", "default": "./dist/plugin-sdk/slack-core.js" }, + "./plugin-sdk/tlon": { + "types": "./dist/plugin-sdk/tlon.d.ts", + "default": "./dist/plugin-sdk/tlon.js" + }, + "./plugin-sdk/twitch": { + "types": "./dist/plugin-sdk/twitch.d.ts", + "default": "./dist/plugin-sdk/twitch.js" + }, + "./plugin-sdk/voice-call": { + "types": "./dist/plugin-sdk/voice-call.d.ts", + "default": "./dist/plugin-sdk/voice-call.js" + }, + "./plugin-sdk/zalo": { + "types": "./dist/plugin-sdk/zalo.d.ts", + "default": "./dist/plugin-sdk/zalo.js" + }, + "./plugin-sdk/zalouser": { + "types": "./dist/plugin-sdk/zalouser.d.ts", + "default": "./dist/plugin-sdk/zalouser.js" + }, "./plugin-sdk/imessage": { "types": "./dist/plugin-sdk/imessage.d.ts", "default": "./dist/plugin-sdk/imessage.js" diff --git a/scripts/lib/plugin-sdk-entrypoints.json b/scripts/lib/plugin-sdk-entrypoints.json index e5dad4777eb..1dc306bd9b7 100644 --- a/scripts/lib/plugin-sdk-entrypoints.json +++ b/scripts/lib/plugin-sdk-entrypoints.json @@ -38,9 +38,24 @@ "telegram-core", "discord", "discord-core", + "feishu", + "googlechat", + "irc", + "line", + "line-core", "matrix", + "mattermost", + "msteams", + "nextcloud-talk", + "nostr", + "signal", "slack", "slack-core", + "tlon", + "twitch", + "voice-call", + "zalo", + "zalouser", "imessage", "imessage-core", "whatsapp", diff --git a/src/plugin-sdk/line-core.ts b/src/plugin-sdk/line-core.ts index 04b2950a50d..596593fc8f4 100644 --- a/src/plugin-sdk/line-core.ts +++ b/src/plugin-sdk/line-core.ts @@ -3,11 +3,11 @@ export type { LineConfig } from "../line/types.js"; export { createTopLevelChannelDmPolicy, DEFAULT_ACCOUNT_ID, - formatDocsLink, setSetupChannelEnabled, setTopLevelChannelDmPolicyWithAllowFrom, splitSetupEntries, } from "./setup.js"; +export { formatDocsLink } from "../terminal/links.js"; export type { ChannelSetupAdapter, ChannelSetupDmPolicy, ChannelSetupWizard } from "./setup.js"; export { listLineAccountIds, diff --git a/src/plugin-sdk/root-alias.cjs b/src/plugin-sdk/root-alias.cjs index 669586bb80c..11ffc459ef2 100644 --- a/src/plugin-sdk/root-alias.cjs +++ b/src/plugin-sdk/root-alias.cjs @@ -62,6 +62,14 @@ function resolveControlCommandGate(params) { return { commandAuthorized, shouldBlock }; } +function onDiagnosticEvent(listener) { + const monolithic = loadMonolithicSdk(); + if (!monolithic || typeof monolithic.onDiagnosticEvent !== "function") { + throw new Error("openclaw/plugin-sdk root alias could not resolve onDiagnosticEvent"); + } + return monolithic.onDiagnosticEvent(listener); +} + function getPackageRoot() { return path.resolve(__dirname, "..", ".."); } @@ -152,6 +160,7 @@ function tryLoadMonolithicSdk() { const fastExports = { emptyPluginConfigSchema, + onDiagnosticEvent, resolveControlCommandGate, }; diff --git a/src/plugin-sdk/root-alias.test.ts b/src/plugin-sdk/root-alias.test.ts index 48ae4a7b43c..37072f9ded7 100644 --- a/src/plugin-sdk/root-alias.test.ts +++ b/src/plugin-sdk/root-alias.test.ts @@ -180,7 +180,11 @@ describe("plugin-sdk root alias", () => { const lazyRootSdk = lazyModule.moduleExports; expect(typeof lazyRootSdk.onDiagnosticEvent).toBe("function"); - expect(lazyRootSdk.onDiagnosticEvent).toBe(onDiagnosticEvent); + expect( + typeof (lazyRootSdk.onDiagnosticEvent as (listener: () => void) => () => void)( + () => undefined, + ), + ).toBe("function"); expect("onDiagnosticEvent" in lazyRootSdk).toBe(true); }); diff --git a/src/plugin-sdk/runtime-api-guardrails.test.ts b/src/plugin-sdk/runtime-api-guardrails.test.ts index 2158edff7d0..afa32af0b7f 100644 --- a/src/plugin-sdk/runtime-api-guardrails.test.ts +++ b/src/plugin-sdk/runtime-api-guardrails.test.ts @@ -34,14 +34,14 @@ const RUNTIME_API_EXPORT_GUARDS: Record = { 'export { probeIMessage } from "./src/probe.js";', 'export { sendMessageIMessage } from "./src/send.js";', ], - "extensions/googlechat/runtime-api.ts": ['export * from "../../src/plugin-sdk/googlechat.js";'], + "extensions/googlechat/runtime-api.ts": ['export * from "openclaw/plugin-sdk/googlechat";'], "extensions/matrix/runtime-api.ts": [ 'export * from "./src/auth-precedence.js";', 'export * from "./helper-api.js";', 'export * from "./thread-bindings-runtime.js";', ], "extensions/nextcloud-talk/runtime-api.ts": [ - 'export * from "../../src/plugin-sdk/nextcloud-talk.js";', + 'export * from "openclaw/plugin-sdk/nextcloud-talk";', ], "extensions/signal/runtime-api.ts": ['export * from "./src/runtime-api.js";'], "extensions/slack/runtime-api.ts": [ diff --git a/src/plugin-sdk/subpaths.test.ts b/src/plugin-sdk/subpaths.test.ts index ab8c16d71f7..566dc6645e1 100644 --- a/src/plugin-sdk/subpaths.test.ts +++ b/src/plugin-sdk/subpaths.test.ts @@ -61,30 +61,15 @@ describe("plugin-sdk subpath exports", () => { expect(pluginSdkSubpaths).not.toContain("acpx"); expect(pluginSdkSubpaths).not.toContain("compat"); expect(pluginSdkSubpaths).not.toContain("device-pair"); - expect(pluginSdkSubpaths).not.toContain("feishu"); expect(pluginSdkSubpaths).not.toContain("google"); - expect(pluginSdkSubpaths).not.toContain("googlechat"); - expect(pluginSdkSubpaths).not.toContain("irc"); - expect(pluginSdkSubpaths).not.toContain("line"); - expect(pluginSdkSubpaths).not.toContain("line-core"); expect(pluginSdkSubpaths).not.toContain("lobster"); - expect(pluginSdkSubpaths).not.toContain("mattermost"); - expect(pluginSdkSubpaths).not.toContain("msteams"); - expect(pluginSdkSubpaths).not.toContain("nextcloud-talk"); - expect(pluginSdkSubpaths).not.toContain("nostr"); expect(pluginSdkSubpaths).not.toContain("pairing-access"); expect(pluginSdkSubpaths).not.toContain("qwen-portal-auth"); expect(pluginSdkSubpaths).not.toContain("reply-prefix"); - expect(pluginSdkSubpaths).not.toContain("signal"); expect(pluginSdkSubpaths).not.toContain("signal-core"); expect(pluginSdkSubpaths).not.toContain("synology-chat"); - expect(pluginSdkSubpaths).not.toContain("tlon"); - expect(pluginSdkSubpaths).not.toContain("twitch"); expect(pluginSdkSubpaths).not.toContain("typing"); - expect(pluginSdkSubpaths).not.toContain("voice-call"); - expect(pluginSdkSubpaths).not.toContain("zalo"); expect(pluginSdkSubpaths).not.toContain("zai"); - expect(pluginSdkSubpaths).not.toContain("zalouser"); expect(pluginSdkSubpaths).not.toContain("provider-model-definitions"); });