fix(plugin-handlers): remove ZWSP prefixes from API-facing agent paths
This commit is contained in:
@@ -9,11 +9,11 @@ import type { OhMyOpenCodeConfig } from "../config"
|
||||
import * as agentLoader from "../features/claude-code-agent-loader"
|
||||
import * as skillLoader from "../features/opencode-skill-loader"
|
||||
import type { LoadedSkill } from "../features/opencode-skill-loader"
|
||||
import { getAgentDisplayName, getAgentListDisplayName } from "../shared/agent-display-names"
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names"
|
||||
import { applyAgentConfig } from "./agent-config-handler"
|
||||
import type { PluginComponents } from "./plugin-components-loader"
|
||||
|
||||
const BUILTIN_SISYPHUS_DISPLAY_NAME = getAgentListDisplayName("sisyphus")
|
||||
const BUILTIN_SISYPHUS_DISPLAY_NAME = getAgentDisplayName("sisyphus")
|
||||
const BUILTIN_SISYPHUS_JUNIOR_DISPLAY_NAME = getAgentDisplayName("sisyphus-junior")
|
||||
const BUILTIN_MULTIMODAL_LOOKER_DISPLAY_NAME = getAgentDisplayName("multimodal-looker")
|
||||
|
||||
@@ -38,6 +38,11 @@ function createBaseConfig(): Record<string, unknown> {
|
||||
|
||||
function createPluginConfig(): OhMyOpenCodeConfig {
|
||||
return {
|
||||
git_master: {
|
||||
commit_footer: true,
|
||||
include_co_authored_by: true,
|
||||
git_env_prefix: "GIT_MASTER=1",
|
||||
},
|
||||
sisyphus_agent: {
|
||||
planner_enabled: false,
|
||||
},
|
||||
|
||||
@@ -2,8 +2,8 @@ import { createBuiltinAgents } from "../agents";
|
||||
import { createSisyphusJuniorAgentWithOverrides } from "../agents/sisyphus-junior";
|
||||
import type { OhMyOpenCodeConfig } from "../config";
|
||||
import { isTaskSystemEnabled, log, migrateAgentConfig } from "../shared";
|
||||
import { AGENT_NAME_MAP } from "../shared/migration";
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names";
|
||||
import { AGENT_NAME_MAP } from "../shared/migration";
|
||||
import { registerAgentName } from "../features/claude-code-session-state";
|
||||
import {
|
||||
discoverConfigSourceSkills,
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
} from "./agent-override-protection";
|
||||
import { buildPrometheusAgentConfig } from "./prometheus-agent-config-builder";
|
||||
import { buildPlanDemoteConfig } from "./plan-model-inheritance";
|
||||
import { getAgentListDisplayName } from "../shared/agent-display-names";
|
||||
|
||||
type AgentConfigRecord = Record<string, Record<string, unknown> | undefined> & {
|
||||
build?: Record<string, unknown>;
|
||||
@@ -160,10 +159,10 @@ export async function applyAgentConfig(params: {
|
||||
if (isSisyphusEnabled && builtinAgents.sisyphus) {
|
||||
if (configuredDefaultAgent) {
|
||||
(params.config as { default_agent?: string }).default_agent =
|
||||
getAgentListDisplayName(configuredDefaultAgent);
|
||||
getAgentDisplayName(configuredDefaultAgent);
|
||||
} else {
|
||||
(params.config as { default_agent?: string }).default_agent =
|
||||
getAgentListDisplayName("sisyphus");
|
||||
getAgentDisplayName("sisyphus");
|
||||
}
|
||||
|
||||
// Assembly order: Sisyphus -> Hephaestus -> Prometheus -> Atlas
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect } from "bun:test"
|
||||
import { remapAgentKeysToDisplayNames } from "./agent-key-remapper"
|
||||
import { getAgentDisplayName, getAgentListDisplayName } from "../shared/agent-display-names"
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names"
|
||||
|
||||
describe("remapAgentKeysToDisplayNames", () => {
|
||||
it("remaps known agent keys to display names", () => {
|
||||
@@ -14,7 +14,7 @@ describe("remapAgentKeysToDisplayNames", () => {
|
||||
const result = remapAgentKeysToDisplayNames(agents)
|
||||
|
||||
// then known agents get display name keys only
|
||||
expect(result[getAgentListDisplayName("sisyphus")]).toBeDefined()
|
||||
expect(result[getAgentDisplayName("sisyphus")]).toBeDefined()
|
||||
expect(result["oracle"]).toBeDefined()
|
||||
expect(result["sisyphus"]).toBeUndefined()
|
||||
})
|
||||
@@ -49,13 +49,13 @@ describe("remapAgentKeysToDisplayNames", () => {
|
||||
const result = remapAgentKeysToDisplayNames(agents)
|
||||
|
||||
// then all get display name keys
|
||||
expect(result[getAgentListDisplayName("sisyphus")]).toBeDefined()
|
||||
expect(result[getAgentDisplayName("sisyphus")]).toBeDefined()
|
||||
expect(result["sisyphus"]).toBeUndefined()
|
||||
expect(result[getAgentListDisplayName("hephaestus")]).toBeDefined()
|
||||
expect(result[getAgentDisplayName("hephaestus")]).toBeDefined()
|
||||
expect(result["hephaestus"]).toBeUndefined()
|
||||
expect(result[getAgentListDisplayName("prometheus")]).toBeDefined()
|
||||
expect(result[getAgentDisplayName("prometheus")]).toBeDefined()
|
||||
expect(result["prometheus"]).toBeUndefined()
|
||||
expect(result[getAgentListDisplayName("atlas")]).toBeDefined()
|
||||
expect(result[getAgentDisplayName("atlas")]).toBeDefined()
|
||||
expect(result["atlas"]).toBeUndefined()
|
||||
expect(result[getAgentDisplayName("athena")]).toBeDefined()
|
||||
expect(result["athena"]).toBeUndefined()
|
||||
@@ -77,12 +77,12 @@ describe("remapAgentKeysToDisplayNames", () => {
|
||||
const result = remapAgentKeysToDisplayNames(agents)
|
||||
|
||||
// then only display key is emitted
|
||||
expect(Object.keys(result)).toEqual([getAgentListDisplayName("sisyphus")])
|
||||
expect(result[getAgentListDisplayName("sisyphus")]).toBeDefined()
|
||||
expect(Object.keys(result)).toEqual([getAgentDisplayName("sisyphus")])
|
||||
expect(result[getAgentDisplayName("sisyphus")]).toBeDefined()
|
||||
expect(result["sisyphus"]).toBeUndefined()
|
||||
})
|
||||
|
||||
it("keeps the four core agents in canonical order under opencode name sorting", () => {
|
||||
it("returns clean core agent display names without ZWSP prefixes", () => {
|
||||
// given
|
||||
const result = remapAgentKeysToDisplayNames({
|
||||
atlas: {},
|
||||
@@ -92,14 +92,17 @@ describe("remapAgentKeysToDisplayNames", () => {
|
||||
})
|
||||
|
||||
// when
|
||||
const sortedNames = Object.keys(result).sort()
|
||||
const remappedNames = Object.keys(result)
|
||||
|
||||
// then
|
||||
expect(sortedNames).toEqual([
|
||||
getAgentListDisplayName("sisyphus"),
|
||||
getAgentListDisplayName("hephaestus"),
|
||||
getAgentListDisplayName("prometheus"),
|
||||
getAgentListDisplayName("atlas"),
|
||||
expect(remappedNames).toEqual([
|
||||
getAgentDisplayName("atlas"),
|
||||
getAgentDisplayName("prometheus"),
|
||||
getAgentDisplayName("hephaestus"),
|
||||
getAgentDisplayName("sisyphus"),
|
||||
])
|
||||
for (const name of remappedNames) {
|
||||
expect(name).not.toContain("\u200B")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getAgentListDisplayName } from "../shared/agent-display-names"
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names"
|
||||
|
||||
export function remapAgentKeysToDisplayNames(
|
||||
agents: Record<string, unknown>,
|
||||
@@ -6,7 +6,7 @@ export function remapAgentKeysToDisplayNames(
|
||||
const result: Record<string, unknown> = {}
|
||||
|
||||
for (const [key, value] of Object.entries(agents)) {
|
||||
const displayName = getAgentListDisplayName(key)
|
||||
const displayName = getAgentDisplayName(key)
|
||||
if (displayName && displayName !== key) {
|
||||
result[displayName] = value
|
||||
// Regression guard: do not also assign result[key].
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
/// <reference types="bun-types" />
|
||||
|
||||
import { describe, expect, test } from "bun:test"
|
||||
|
||||
import { reorderAgentsByPriority } from "./agent-priority-order"
|
||||
import { getAgentDisplayName, getAgentListDisplayName } from "../shared/agent-display-names"
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names"
|
||||
|
||||
describe("reorderAgentsByPriority", () => {
|
||||
test("moves core agents to canonical order and injects runtime order fields", () => {
|
||||
// given
|
||||
const sisyphus = getAgentListDisplayName("sisyphus")
|
||||
const hephaestus = getAgentListDisplayName("hephaestus")
|
||||
const prometheus = getAgentListDisplayName("prometheus")
|
||||
const atlas = getAgentListDisplayName("atlas")
|
||||
const sisyphus = getAgentDisplayName("sisyphus")
|
||||
const hephaestus = getAgentDisplayName("hephaestus")
|
||||
const prometheus = getAgentDisplayName("prometheus")
|
||||
const atlas = getAgentDisplayName("atlas")
|
||||
const oracle = getAgentDisplayName("oracle")
|
||||
|
||||
const agents: Record<string, unknown> = {
|
||||
@@ -59,8 +61,8 @@ describe("reorderAgentsByPriority", () => {
|
||||
|
||||
test("leaves non-object agent configs untouched while still reordering keys", () => {
|
||||
// given
|
||||
const sisyphus = getAgentListDisplayName("sisyphus")
|
||||
const atlas = getAgentListDisplayName("atlas")
|
||||
const sisyphus = getAgentDisplayName("sisyphus")
|
||||
const atlas = getAgentDisplayName("atlas")
|
||||
|
||||
const agents: Record<string, unknown> = {
|
||||
[atlas]: "atlas-config",
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { getAgentListDisplayName } from "../shared/agent-display-names";
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names";
|
||||
|
||||
const CORE_AGENT_ORDER: ReadonlyArray<{ displayName: string; order: number }> = [
|
||||
{ displayName: getAgentListDisplayName("sisyphus"), order: 1 },
|
||||
{ displayName: getAgentListDisplayName("hephaestus"), order: 2 },
|
||||
{ displayName: getAgentListDisplayName("prometheus"), order: 3 },
|
||||
{ displayName: getAgentListDisplayName("atlas"), order: 4 },
|
||||
{ displayName: getAgentDisplayName("sisyphus"), order: 1 },
|
||||
{ displayName: getAgentDisplayName("hephaestus"), order: 2 },
|
||||
{ displayName: getAgentDisplayName("prometheus"), order: 3 },
|
||||
{ displayName: getAgentDisplayName("atlas"), order: 4 },
|
||||
];
|
||||
|
||||
function injectOrderField(
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference types="bun-types" />
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, spyOn, test } from "bun:test";
|
||||
import * as builtinCommands from "../features/builtin-commands";
|
||||
import * as commandLoader from "../features/claude-code-command-loader";
|
||||
@@ -7,7 +9,6 @@ import type { PluginComponents } from "./plugin-components-loader";
|
||||
import { applyCommandConfig } from "./command-config-handler";
|
||||
import {
|
||||
getAgentDisplayName,
|
||||
getAgentListDisplayName,
|
||||
} from "../shared/agent-display-names";
|
||||
|
||||
function createPluginComponents(): PluginComponents {
|
||||
@@ -23,7 +24,13 @@ function createPluginComponents(): PluginComponents {
|
||||
}
|
||||
|
||||
function createPluginConfig(): OhMyOpenCodeConfig {
|
||||
return {};
|
||||
return {
|
||||
git_master: {
|
||||
commit_footer: true,
|
||||
include_co_authored_by: true,
|
||||
git_env_prefix: "GIT_MASTER=1",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
describe("applyCommandConfig", () => {
|
||||
@@ -100,7 +107,7 @@ describe("applyCommandConfig", () => {
|
||||
expect(commandConfig["agents-global-skill"]?.description).toContain("Agents global skill");
|
||||
});
|
||||
|
||||
test("normalizes Atlas command agents to the exported list key used by opencode command routing", async () => {
|
||||
test("normalizes Atlas command agents to the clean display name used by opencode command routing", async () => {
|
||||
// given
|
||||
loadBuiltinCommandsSpy.mockReturnValue({
|
||||
"start-work": {
|
||||
@@ -122,10 +129,10 @@ describe("applyCommandConfig", () => {
|
||||
|
||||
// then
|
||||
const commandConfig = config.command as Record<string, { agent?: string }>;
|
||||
expect(commandConfig["start-work"]?.agent).toBe(getAgentListDisplayName("atlas"));
|
||||
expect(commandConfig["start-work"]?.agent).toBe(getAgentDisplayName("atlas"));
|
||||
});
|
||||
|
||||
test("normalizes legacy display-name command agents to the exported list key", async () => {
|
||||
test("normalizes legacy display-name command agents to the clean display name", async () => {
|
||||
// given
|
||||
loadBuiltinCommandsSpy.mockReturnValue({
|
||||
"start-work": {
|
||||
@@ -147,6 +154,6 @@ describe("applyCommandConfig", () => {
|
||||
|
||||
// then
|
||||
const commandConfig = config.command as Record<string, { agent?: string }>;
|
||||
expect(commandConfig["start-work"]?.agent).toBe(getAgentListDisplayName("atlas"));
|
||||
expect(commandConfig["start-work"]?.agent).toBe(getAgentDisplayName("atlas"));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { OhMyOpenCodeConfig } from "../config";
|
||||
import {
|
||||
getAgentConfigKey,
|
||||
getAgentListDisplayName,
|
||||
getAgentDisplayName,
|
||||
} from "../shared/agent-display-names";
|
||||
import {
|
||||
loadUserCommands,
|
||||
@@ -99,7 +99,7 @@ export async function applyCommandConfig(params: {
|
||||
function remapCommandAgentFields(commands: Record<string, Record<string, unknown>>): void {
|
||||
for (const cmd of Object.values(commands)) {
|
||||
if (cmd?.agent && typeof cmd.agent === "string") {
|
||||
cmd.agent = getAgentListDisplayName(getAgentConfigKey(cmd.agent));
|
||||
cmd.agent = getAgentDisplayName(getAgentConfigKey(cmd.agent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { describe, test, expect, spyOn, beforeEach, afterEach, mock } from "bun:test"
|
||||
import type { CategoryConfig } from "../config/schema"
|
||||
import type { OhMyOpenCodeConfig } from "../config"
|
||||
import { getAgentDisplayName, getAgentListDisplayName } from "../shared/agent-display-names"
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names"
|
||||
import { resolveCategoryConfig } from "./category-config-resolver"
|
||||
|
||||
import * as agents from "../agents"
|
||||
@@ -260,10 +260,10 @@ describe("Plan agent demote behavior", () => {
|
||||
// #then
|
||||
const keys = Object.keys(config.agent as Record<string, unknown>)
|
||||
const coreAgents = [
|
||||
getAgentListDisplayName("sisyphus"),
|
||||
getAgentListDisplayName("hephaestus"),
|
||||
getAgentListDisplayName("prometheus"),
|
||||
getAgentListDisplayName("atlas"),
|
||||
getAgentDisplayName("sisyphus"),
|
||||
getAgentDisplayName("hephaestus"),
|
||||
getAgentDisplayName("prometheus"),
|
||||
getAgentDisplayName("atlas"),
|
||||
]
|
||||
const ordered = keys.filter((key) => coreAgents.includes(key))
|
||||
expect(ordered).toEqual(coreAgents)
|
||||
@@ -308,10 +308,10 @@ describe("Plan agent demote behavior", () => {
|
||||
reorderSpy.mock.calls.at(0)?.[0] as Record<string, unknown>
|
||||
)
|
||||
expect(assembledAgentKeys.slice(0, 4)).toEqual([
|
||||
getAgentListDisplayName("sisyphus"),
|
||||
getAgentListDisplayName("hephaestus"),
|
||||
getAgentListDisplayName("prometheus"),
|
||||
getAgentListDisplayName("atlas"),
|
||||
getAgentDisplayName("sisyphus"),
|
||||
getAgentDisplayName("hephaestus"),
|
||||
getAgentDisplayName("prometheus"),
|
||||
getAgentDisplayName("atlas"),
|
||||
])
|
||||
})
|
||||
|
||||
@@ -350,7 +350,7 @@ describe("Plan agent demote behavior", () => {
|
||||
expect(agents.plan).toBeDefined()
|
||||
expect(agents.plan.mode).toBe("subagent")
|
||||
expect(agents.plan.prompt).toBeUndefined()
|
||||
expect(agents[getAgentListDisplayName("prometheus")]?.prompt).toBeDefined()
|
||||
expect(agents[getAgentDisplayName("prometheus")]?.prompt).toBeDefined()
|
||||
})
|
||||
|
||||
test("plan agent remains unchanged when planner is disabled", async () => {
|
||||
@@ -384,7 +384,7 @@ describe("Plan agent demote behavior", () => {
|
||||
|
||||
// #then - plan is not touched, prometheus is not created
|
||||
const agents = config.agent as Record<string, { mode?: string; name?: string; prompt?: string }>
|
||||
expect(agents[getAgentListDisplayName("prometheus")]).toBeUndefined()
|
||||
expect(agents[getAgentDisplayName("prometheus")]).toBeUndefined()
|
||||
expect(agents.plan).toBeDefined()
|
||||
expect(agents.plan.mode).toBe("primary")
|
||||
expect(agents.plan.prompt).toBe("original plan prompt")
|
||||
@@ -415,7 +415,7 @@ describe("Plan agent demote behavior", () => {
|
||||
|
||||
// then
|
||||
const agents = config.agent as Record<string, { mode?: string }>
|
||||
const prometheusKey = getAgentListDisplayName("prometheus")
|
||||
const prometheusKey = getAgentDisplayName("prometheus")
|
||||
expect(agents[prometheusKey]).toBeDefined()
|
||||
expect(agents[prometheusKey].mode).toBe("all")
|
||||
})
|
||||
@@ -451,7 +451,7 @@ describe("Agent permission defaults", () => {
|
||||
|
||||
// #then
|
||||
const agentConfig = config.agent as Record<string, { permission?: Record<string, string> }>
|
||||
const hephaestusKey = getAgentListDisplayName("hephaestus")
|
||||
const hephaestusKey = getAgentDisplayName("hephaestus")
|
||||
expect(agentConfig[hephaestusKey]).toBeDefined()
|
||||
expect(agentConfig[hephaestusKey].permission?.task).toBe("allow")
|
||||
})
|
||||
@@ -479,7 +479,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// then
|
||||
expect(config.default_agent).toBe(getAgentListDisplayName("hephaestus"))
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("hephaestus"))
|
||||
})
|
||||
|
||||
test("canonicalizes configured default_agent when key uses mixed case", async () => {
|
||||
@@ -503,7 +503,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// then
|
||||
expect(config.default_agent).toBe(getAgentListDisplayName("hephaestus"))
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("hephaestus"))
|
||||
})
|
||||
|
||||
test("canonicalizes configured default_agent key to display name", async () => {
|
||||
@@ -527,13 +527,13 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// #then
|
||||
expect(config.default_agent).toBe(getAgentListDisplayName("hephaestus"))
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("hephaestus"))
|
||||
})
|
||||
|
||||
test("preserves existing display-name default_agent", async () => {
|
||||
// #given
|
||||
const pluginConfig = createPluginConfig({})
|
||||
const displayName = getAgentListDisplayName("hephaestus")
|
||||
const displayName = getAgentDisplayName("hephaestus")
|
||||
const config: Record<string, unknown> = {
|
||||
model: "anthropic/claude-opus-4-6",
|
||||
default_agent: displayName,
|
||||
@@ -575,7 +575,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// #then
|
||||
expect(config.default_agent).toBe(getAgentListDisplayName("sisyphus"))
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("sisyphus"))
|
||||
})
|
||||
|
||||
test("sets default_agent to sisyphus when configured default_agent is empty after trim", async () => {
|
||||
@@ -599,7 +599,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// then
|
||||
expect(config.default_agent).toBe(getAgentListDisplayName("sisyphus"))
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("sisyphus"))
|
||||
})
|
||||
|
||||
test("preserves custom default_agent names while trimming whitespace", async () => {
|
||||
@@ -793,7 +793,7 @@ describe("Prometheus direct override priority over category", () => {
|
||||
|
||||
// then - direct override's reasoningEffort wins
|
||||
const agents = config.agent as Record<string, { reasoningEffort?: string }>
|
||||
const pKey = getAgentListDisplayName("prometheus")
|
||||
const pKey = getAgentDisplayName("prometheus")
|
||||
expect(agents[pKey]).toBeDefined()
|
||||
expect(agents[pKey].reasoningEffort).toBe("low")
|
||||
})
|
||||
@@ -834,7 +834,7 @@ describe("Prometheus direct override priority over category", () => {
|
||||
|
||||
// then - category's reasoningEffort is applied
|
||||
const agents = config.agent as Record<string, { reasoningEffort?: string }>
|
||||
const pKey = getAgentListDisplayName("prometheus")
|
||||
const pKey = getAgentDisplayName("prometheus")
|
||||
expect(agents[pKey]).toBeDefined()
|
||||
expect(agents[pKey].reasoningEffort).toBe("high")
|
||||
})
|
||||
@@ -876,7 +876,7 @@ describe("Prometheus direct override priority over category", () => {
|
||||
|
||||
// then - direct temperature wins over category
|
||||
const agents = config.agent as Record<string, { temperature?: number }>
|
||||
const pKey = getAgentListDisplayName("prometheus")
|
||||
const pKey = getAgentDisplayName("prometheus")
|
||||
expect(agents[pKey]).toBeDefined()
|
||||
expect(agents[pKey].temperature).toBe(0.1)
|
||||
})
|
||||
@@ -912,7 +912,7 @@ describe("Prometheus direct override priority over category", () => {
|
||||
|
||||
// #then - prompt_append is appended to base prompt, not overwriting it
|
||||
const agents = config.agent as Record<string, { prompt?: string }>
|
||||
const pKey = getAgentListDisplayName("prometheus")
|
||||
const pKey = getAgentDisplayName("prometheus")
|
||||
expect(agents[pKey]).toBeDefined()
|
||||
expect(agents[pKey].prompt).toContain("Prometheus")
|
||||
expect(agents[pKey].prompt).toContain(customInstructions)
|
||||
@@ -1137,7 +1137,7 @@ describe("Deadlock prevention - fetchAvailableModels must not receive client", (
|
||||
|
||||
// then - regression guard: handler completes and still assembles planner config
|
||||
const agentConfig = config.agent as Record<string, unknown>
|
||||
expect(agentConfig[getAgentListDisplayName("prometheus")]).toBeDefined()
|
||||
expect(agentConfig[getAgentDisplayName("prometheus")]).toBeDefined()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1303,17 +1303,17 @@ describe("command agent routing coherence", () => {
|
||||
//#then
|
||||
const agentConfig = config.agent as Record<string, unknown>
|
||||
const commandConfig = config.command as Record<string, { agent?: string }>
|
||||
expect(Object.keys(agentConfig)).toContain(getAgentListDisplayName("atlas"))
|
||||
expect(commandConfig["start-work"]?.agent).toBe(getAgentListDisplayName("atlas"))
|
||||
expect(Object.keys(agentConfig)).toContain(getAgentDisplayName("atlas"))
|
||||
expect(commandConfig["start-work"]?.agent).toBe(getAgentDisplayName("atlas"))
|
||||
})
|
||||
})
|
||||
|
||||
describe("per-agent todowrite/todoread deny when task_system enabled", () => {
|
||||
const AGENTS_WITH_TODO_DENY = new Set([
|
||||
getAgentListDisplayName("sisyphus"),
|
||||
getAgentListDisplayName("hephaestus"),
|
||||
getAgentListDisplayName("prometheus"),
|
||||
getAgentListDisplayName("atlas"),
|
||||
getAgentDisplayName("sisyphus"),
|
||||
getAgentDisplayName("hephaestus"),
|
||||
getAgentDisplayName("prometheus"),
|
||||
getAgentDisplayName("atlas"),
|
||||
getAgentDisplayName("sisyphus-junior"),
|
||||
])
|
||||
|
||||
@@ -1394,10 +1394,10 @@ describe("per-agent todowrite/todoread deny when task_system enabled", () => {
|
||||
expect(lastCall?.[11]).toBe(false)
|
||||
|
||||
const agentResult = config.agent as Record<string, { permission?: Record<string, unknown> }>
|
||||
expect(agentResult[getAgentListDisplayName("sisyphus")]?.permission?.todowrite).toBeUndefined()
|
||||
expect(agentResult[getAgentListDisplayName("sisyphus")]?.permission?.todoread).toBeUndefined()
|
||||
expect(agentResult[getAgentListDisplayName("hephaestus")]?.permission?.todowrite).toBeUndefined()
|
||||
expect(agentResult[getAgentListDisplayName("hephaestus")]?.permission?.todoread).toBeUndefined()
|
||||
expect(agentResult[getAgentDisplayName("sisyphus")]?.permission?.todowrite).toBeUndefined()
|
||||
expect(agentResult[getAgentDisplayName("sisyphus")]?.permission?.todoread).toBeUndefined()
|
||||
expect(agentResult[getAgentDisplayName("hephaestus")]?.permission?.todowrite).toBeUndefined()
|
||||
expect(agentResult[getAgentDisplayName("hephaestus")]?.permission?.todoread).toBeUndefined()
|
||||
})
|
||||
|
||||
test("does not deny todowrite/todoread when task_system is undefined", async () => {
|
||||
@@ -1433,8 +1433,8 @@ describe("per-agent todowrite/todoread deny when task_system enabled", () => {
|
||||
expect(lastCall?.[11]).toBe(false)
|
||||
|
||||
const agentResult = config.agent as Record<string, { permission?: Record<string, unknown> }>
|
||||
expect(agentResult[getAgentListDisplayName("sisyphus")]?.permission?.todowrite).toBeUndefined()
|
||||
expect(agentResult[getAgentListDisplayName("sisyphus")]?.permission?.todoread).toBeUndefined()
|
||||
expect(agentResult[getAgentDisplayName("sisyphus")]?.permission?.todowrite).toBeUndefined()
|
||||
expect(agentResult[getAgentDisplayName("sisyphus")]?.permission?.todoread).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect, beforeEach, afterEach } from "bun:test"
|
||||
import { applyToolConfig } from "./tool-config-handler"
|
||||
import type { OhMyOpenCodeConfig } from "../config"
|
||||
import { getAgentListDisplayName } from "../shared/agent-display-names"
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names"
|
||||
|
||||
function createParams(overrides: {
|
||||
taskSystem?: boolean
|
||||
@@ -251,9 +251,9 @@ describe("applyToolConfig", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("#given agentResult uses exported list display keys", () => {
|
||||
it("#then should still resolve atlas permissions through the prefixed key", () => {
|
||||
const atlasKey = getAgentListDisplayName("atlas")
|
||||
describe("#given agentResult uses clean display keys", () => {
|
||||
it("#then should still resolve atlas permissions through the display key", () => {
|
||||
const atlasKey = getAgentDisplayName("atlas")
|
||||
const params = createParams({ agents: [atlasKey] })
|
||||
|
||||
applyToolConfig(params)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { OhMyOpenCodeConfig } from "../config";
|
||||
import { getAgentDisplayName, getAgentListDisplayName } from "../shared/agent-display-names";
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names";
|
||||
import { isTaskSystemEnabled } from "../shared";
|
||||
|
||||
type AgentWithPermission = { permission?: Record<string, unknown> };
|
||||
@@ -16,7 +16,7 @@ function getConfigQuestionPermission(): string | null {
|
||||
}
|
||||
|
||||
function agentByKey(agentResult: Record<string, unknown>, key: string): AgentWithPermission | undefined {
|
||||
return (agentResult[getAgentListDisplayName(key)] ?? agentResult[getAgentDisplayName(key)] ?? agentResult[key]) as
|
||||
return (agentResult[getAgentDisplayName(key)] ?? agentResult[key]) as
|
||||
| AgentWithPermission
|
||||
| undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user