refactor(config-handler): separate plan prompt into dedicated configuration (#1413)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
e36dde6e64
commit
7ebafe2267
@ -176,10 +176,12 @@ describe("Plan agent demote behavior", () => {
|
|||||||
await handler(config)
|
await handler(config)
|
||||||
|
|
||||||
// then
|
// then
|
||||||
const agents = config.agent as Record<string, { mode?: string; name?: string }>
|
const agents = config.agent as Record<string, { mode?: string; name?: string; prompt?: string }>
|
||||||
expect(agents.plan).toBeDefined()
|
expect(agents.plan).toBeDefined()
|
||||||
expect(agents.plan.mode).toBe("subagent")
|
expect(agents.plan.mode).toBe("subagent")
|
||||||
expect(agents.plan.name).toBe("plan")
|
expect(agents.plan.name).toBe("plan")
|
||||||
|
expect(agents.plan.prompt).toBe("original plan prompt")
|
||||||
|
expect(agents.plan.prompt).not.toBe(agents.prometheus?.prompt)
|
||||||
})
|
})
|
||||||
|
|
||||||
test("prometheus should have mode 'all' to be callable via delegate_task", async () => {
|
test("prometheus should have mode 'all' to be callable via delegate_task", async () => {
|
||||||
|
|||||||
@ -210,6 +210,12 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
|||||||
};
|
};
|
||||||
const configAgent = config.agent as AgentConfig | undefined;
|
const configAgent = config.agent as AgentConfig | undefined;
|
||||||
|
|
||||||
|
const { name: _planName, mode: _planMode, ...planConfigWithoutName } =
|
||||||
|
configAgent?.plan ?? {};
|
||||||
|
const planPrompt = (migrateAgentConfig(
|
||||||
|
planConfigWithoutName as Record<string, unknown>
|
||||||
|
) as { prompt?: string }).prompt;
|
||||||
|
|
||||||
if (isSisyphusEnabled && builtinAgents.sisyphus) {
|
if (isSisyphusEnabled && builtinAgents.sisyphus) {
|
||||||
(config as { default_agent?: string }).default_agent = "sisyphus";
|
(config as { default_agent?: string }).default_agent = "sisyphus";
|
||||||
|
|
||||||
@ -241,11 +247,6 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (plannerEnabled) {
|
if (plannerEnabled) {
|
||||||
const { name: _planName, mode: _planMode, ...planConfigWithoutName } =
|
|
||||||
configAgent?.plan ?? {};
|
|
||||||
const migratedPlanConfig = migrateAgentConfig(
|
|
||||||
planConfigWithoutName as Record<string, unknown>
|
|
||||||
);
|
|
||||||
const prometheusOverride =
|
const prometheusOverride =
|
||||||
pluginConfig.agents?.["prometheus"] as
|
pluginConfig.agents?.["prometheus"] as
|
||||||
| (Record<string, unknown> & {
|
| (Record<string, unknown> & {
|
||||||
@ -365,7 +366,8 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
|||||||
? {
|
? {
|
||||||
...agentConfig["prometheus"],
|
...agentConfig["prometheus"],
|
||||||
name: "plan",
|
name: "plan",
|
||||||
mode: "subagent" as const
|
mode: "subagent" as const,
|
||||||
|
...(planPrompt ? { prompt: planPrompt } : {}),
|
||||||
}
|
}
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user