refactor(plugin-sdk): remove direct extension source leaks

This commit is contained in:
Peter Steinberger
2026-03-29 23:10:51 +01:00
parent 40446ea27c
commit e01ca8cfc6
4 changed files with 18 additions and 3 deletions

View File

@@ -22,3 +22,4 @@ read_when:
- adjusted session-listing subagent selection to prefer active disk-only runs while still honoring newer in-memory replacement rows
- deleted the flaky duplicated Telegram gateway writeback integration test and kept stable coverage in `server-methods/send.test.ts` plus `extensions/telegram/src/target-writeback.test.ts`
- trimmed remaining Telegram-specific assertions from `src/gateway/server-methods/send.test.ts` so core only covers generic channel-send contracts and Telegram writeback behavior stays extension-owned
- removed public SDK re-exports that reached directly into bundled extension source paths; `plugin-sdk/agent-runtime` no longer leaks `sglang`/`vllm`, and `plugin-sdk/xai-model-id` now uses the facade loader instead of `../../extensions/xai/*`

View File

@@ -16,12 +16,10 @@ export * from "../agents/pi-embedded-utils.js";
export * from "../agents/provider-id.js";
export * from "../agents/sandbox-paths.js";
export * from "../agents/schema/typebox.js";
export * from "../../extensions/sglang/api.js";
export * from "../agents/tools/common.js";
export * from "../agents/tools/web-guarded-fetch.js";
export * from "../agents/tools/web-shared.js";
export * from "../agents/tools/web-fetch-utils.js";
export * from "../../extensions/vllm/api.js";
// Intentional public runtime surface: channel plugins use ingress agent helpers directly.
export * from "../agents/agent-command.js";
export * from "../tts/tts.js";

View File

@@ -666,7 +666,9 @@ describe("plugin-sdk subpath exports", () => {
expectSourceOmitsImportPattern("self-hosted-provider-setup", "./sglang.js");
expectSourceOmitsSnippet("agent-runtime", "./sglang.js");
expectSourceOmitsSnippet("agent-runtime", "./vllm.js");
expectSourceOmitsSnippet("agent-runtime", "../../extensions/");
expectSourceOmitsSnippet("xai-model-id", "./xai.js");
expectSourceOmitsSnippet("xai-model-id", "../../extensions/");
expectSourceMentions("sandbox", ["registerSandboxBackend", "runPluginCommandWithTimeout"]);
expectSourceMentions("secret-input", [

View File

@@ -1 +1,15 @@
export { normalizeXaiModelId } from "../../extensions/xai/model-id.js";
import type { PluginSdkFacadeTypeMap } from "../generated/plugin-sdk-facade-type-map.generated.js";
import { loadBundledPluginPublicSurfaceModuleSync } from "./facade-runtime.js";
type FacadeEntry = PluginSdkFacadeTypeMap["xai"];
type FacadeModule = FacadeEntry["module"];
function loadFacadeModule(): FacadeModule {
return loadBundledPluginPublicSurfaceModuleSync<FacadeModule>({
dirName: "xai",
artifactBasename: "api.js",
});
}
export const normalizeXaiModelId: FacadeModule["normalizeXaiModelId"] = ((...args) =>
loadFacadeModule()["normalizeXaiModelId"](...args)) as FacadeModule["normalizeXaiModelId"];