This commit is contained in:
+9
-1
@@ -42,6 +42,7 @@ const pluginSchema = z.union([z.string(), entrySchema]);
|
||||
const registrationSchema = z
|
||||
.union([z.string().transform((packageName) => ({ package: packageName })), entrySchema])
|
||||
.pipe(entrySchema);
|
||||
const experimentalSchema = z.object({ subagent_depth: z.number().optional() }).catchall(z.json());
|
||||
const configSchema = z
|
||||
.object({ plugins: z.array(pluginSchema).optional(), $schema: z.string().optional() })
|
||||
.catchall(z.json());
|
||||
@@ -145,11 +146,18 @@ export async function install(source: string, config: string, selection?: string
|
||||
const first = configured.findIndex((entry) => isOwned(entry.package));
|
||||
const next = entries.filter((_entry, index) => !isOwned(configured[index]!.package));
|
||||
next.splice(first < 0 ? next.length : first, 0, ...registrations);
|
||||
const updated = {
|
||||
const updated: z.infer<typeof configSchema> = {
|
||||
...current,
|
||||
$schema: current.$schema ?? "https://opencode.ai/config.json",
|
||||
plugins: next,
|
||||
};
|
||||
// Coordinate delegates to workers from Multi-work children, so routing needs depth >= 2.
|
||||
const experimental = experimentalSchema.safeParse(current.experimental ?? {});
|
||||
if (selected.includes("agents") && experimental.success)
|
||||
updated.experimental = {
|
||||
...experimental.data,
|
||||
subagent_depth: Math.max(experimental.data.subagent_depth ?? 0, 2),
|
||||
};
|
||||
const parent = join(config, "plugins");
|
||||
await mkdir(parent, { recursive: true });
|
||||
const staged = join(parent, `.stanp-opencode.new.${process.pid}`);
|
||||
|
||||
Reference in New Issue
Block a user