fix(plugins): persist synthetic auth refs in index

This commit is contained in:
Vincent Koc
2026-04-26 04:03:57 -07:00
parent a97ee5c1d3
commit 3a54bbb617
4 changed files with 8 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ function createIndex(overrides: Partial<InstalledPluginIndex> = {}): InstalledPl
rootDir: "/plugins/demo",
origin: "global",
enabled: true,
syntheticAuthRefs: ["demo"],
startup: {
sidecar: false,
memory: false,

View File

@@ -69,6 +69,7 @@ const InstalledPluginIndexRecordSchema = z.object({
origin: z.string(),
enabled: z.boolean(),
enabledByDefault: z.boolean().optional(),
syntheticAuthRefs: StringArraySchema.optional(),
startup: InstalledPluginIndexStartupSchema,
compat: z.array(z.string()),
});

View File

@@ -123,6 +123,7 @@ function createRichPluginFixture(params: { packageVersion?: string } = {}) {
providerAuthEnvVars: {
demo: ["DEMO_API_KEY"],
},
syntheticAuthRefs: ["demo", "demo-cli"],
channelEnvVars: {
"demo-chat": ["DEMO_CHAT_TOKEN"],
},
@@ -182,6 +183,7 @@ describe("installed plugin index", () => {
rootDir: fixture.rootDir,
source: path.join(fixture.rootDir, "index.ts"),
enabled: true,
syntheticAuthRefs: ["demo", "demo-cli"],
packageInstall: {
defaultChoice: "npm",
npm: {

View File

@@ -103,6 +103,7 @@ export type InstalledPluginIndexRecord = {
origin: PluginManifestRecord["origin"];
enabled: boolean;
enabledByDefault?: boolean;
syntheticAuthRefs?: readonly string[];
startup: InstalledPluginStartupInfo;
compat: readonly PluginCompatCode[];
};
@@ -591,6 +592,9 @@ function buildInstalledPluginIndex(
startup: buildStartupInfo(record),
compat: collectCompatCodes(record),
};
if (record.syntheticAuthRefs && record.syntheticAuthRefs.length > 0) {
indexRecord.syntheticAuthRefs = record.syntheticAuthRefs;
}
if (record.format && record.format !== "openclaw") {
indexRecord.format = record.format;
}