Skip to content

Commit d90dcc2

Browse files
authored
feat(plugin-sdk): export saveMediaSource from media-store (#125278)
Plugins holding a remote URL had no non-deprecated Plugin SDK path to turn it into managed media; saveMediaSource was only reachable through the deprecated media-runtime barrel while docs pointed at media-store. Re-export it from the focused subpath and move the bundled qa-channel plugin off the deprecated barrel. Maintainer decision: full saveMediaSource (local path + HTTP(S)) is the supported media-store contract. Fixes #125259
1 parent 914d8f6 commit d90dcc2

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎docs/plugins/sdk-subpaths.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ Use `isLoopbackHost(host)` when a plugin must accept only the local machine. It
328328
| `plugin-sdk/media-runtime` | Deprecated broad media barrel including `saveRemoteMedia`, `saveResponseMedia`, `readRemoteMediaBuffer`, and deprecated `fetchRemoteMedia`; prefer `plugin-sdk/media-store`, `plugin-sdk/media-mime`, `plugin-sdk/outbound-media`, and capability runtime subpaths, and prefer store helpers before buffer reads when a URL should become OpenClaw media |
329329
| `plugin-sdk/media-local-roots` | Focused `getAgentScopedMediaLocalRoots(...)` and policy-aware `getAgentScopedMediaLocalRootsForSources(...)` helpers for plugin-owned local media reads |
330330
| `plugin-sdk/media-mime` | Narrow MIME normalization, file-extension mapping, MIME detection, and media-kind helpers |
331-
| `plugin-sdk/media-store` | Narrow media store helpers such as `saveMediaBuffer` and `saveMediaStream` |
331+
| `plugin-sdk/media-store` | Narrow media store helpers such as `saveMediaBuffer`, `saveMediaStream`, and `saveMediaSource` (local path or HTTP(S) URL into managed media with core's SSRF, byte, redirect, and timeout limits) |
332332
| `plugin-sdk/media-generation-runtime` | Private-local after July 2026; Shared media-generation failover helpers, candidate selection, and missing-model messaging |
333333
| `plugin-sdk/media-understanding` | Deprecated compatibility facade for media-understanding provider types and helpers; new providers register through the injected plugin API and keep request helpers plugin-owned |
334334
| `plugin-sdk/text-chunking` | Outbound text and offset-preserving range chunking, markdown chunking/render helpers, quote-aware HTML tag tokenization, markdown table conversion, directive-tag stripping, and safe-text utilities |

‎extensions/qa-channel/src/inbound.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Qa Channel tests cover inbound plugin behavior.
22
import path from "node:path";
33
import { createPluginRuntimeMock } from "openclaw/plugin-sdk/channel-test-helpers";
4-
import { saveMediaBuffer } from "openclaw/plugin-sdk/media-runtime";
4+
import { saveMediaBuffer } from "openclaw/plugin-sdk/media-store";
55
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
66
import { beforeEach, describe, expect, it, vi } from "vitest";
77
import { setQaChannelRuntime } from "../api.js";
@@ -34,8 +34,8 @@ vi.mock("openclaw/plugin-sdk/outbound-media", async (importOriginal) => {
3434
};
3535
});
3636

37-
vi.mock("openclaw/plugin-sdk/media-runtime", async (importOriginal) => ({
38-
...(await importOriginal<typeof import("openclaw/plugin-sdk/media-runtime")>()),
37+
vi.mock("openclaw/plugin-sdk/media-store", async (importOriginal) => ({
38+
...(await importOriginal<typeof import("openclaw/plugin-sdk/media-store")>()),
3939
saveMediaBuffer: vi.fn(async () => ({
4040
id: "stored-audio.ogg",
4141
path: "/tmp/openclaw-media/stored-audio.ogg",

‎extensions/qa-channel/src/inbound.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ import { resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-
88
import { resolveNativeCommandSessionTargets } from "openclaw/plugin-sdk/command-auth-native";
99
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
1010
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
11-
import {
12-
getAgentScopedMediaLocalRoots,
13-
saveMediaBuffer,
14-
saveMediaSource,
15-
} from "openclaw/plugin-sdk/media-runtime";
11+
import { getAgentScopedMediaLocalRoots } from "openclaw/plugin-sdk/media-local-roots";
12+
import { saveMediaBuffer, saveMediaSource } from "openclaw/plugin-sdk/media-store";
1613
import {
1714
sanitizeQaBusToolCallArguments,
1815
type QaBusToolCall,

‎scripts/plugin-sdk-surface-report.mts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ export function readPluginSdkSurfaceBudgets(env: NodeJS.ProcessEnv = process.env
294294
// +3: two focused primitives and the closed read-only SecretRef result contract.
295295
// -2: remove obsolete transcript display helper exports.
296296
// +2: lightweight agent config resolution and nonthrowing default-agent lookup.
297-
4327,
297+
// +1: focused media-store URL/path ingestion (saveMediaSource) off the deprecated barrel.
298+
4328,
298299
env,
299300
),
300301
publicFunctionExports: readPluginSdkSurfaceBudgetEnv(
@@ -374,7 +375,8 @@ export function readPluginSdkSurfaceBudgets(env: NodeJS.ProcessEnv = process.env
374375
// +2: bounded provider stream and read-only SecretRef resolver.
375376
// -1: remove the obsolete transcript tool-call predicate.
376377
// +2: lightweight agent config resolution and nonthrowing default-agent lookup.
377-
2571,
378+
// +1: focused media-store URL/path ingestion (saveMediaSource) off the deprecated barrel.
379+
2572,
378380
env,
379381
),
380382
publicDeprecatedExports: readPluginSdkSurfaceBudgetEnv(

‎src/plugin-sdk/media-store.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export {
44
readMediaBuffer,
55
resolveMediaBufferPath,
66
saveMediaBuffer,
7+
saveMediaSource,
78
saveMediaStream,
89
} from "../media/store.js";
910
export type { SavedMedia } from "../media/store.js";

0 commit comments

Comments
 (0)