mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:30:42 +00:00
fix(plugins): persist synthetic auth refs in index
This commit is contained in:
@@ -39,6 +39,7 @@ function createIndex(overrides: Partial<InstalledPluginIndex> = {}): InstalledPl
|
||||
rootDir: "/plugins/demo",
|
||||
origin: "global",
|
||||
enabled: true,
|
||||
syntheticAuthRefs: ["demo"],
|
||||
startup: {
|
||||
sidecar: false,
|
||||
memory: false,
|
||||
|
||||
@@ -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()),
|
||||
});
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user