test: update expectations for ZWSP-free object keys
- Add RFC 7230 compliance tests for object key validation - Verify name field still contains ZWSP for core agents - Update all test expectations to use getAgentDisplayName()
This commit is contained in:
@@ -9,13 +9,13 @@ 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 { getAgentListDisplayName, getAgentRuntimeName } from "../shared/agent-display-names"
|
||||
import { getAgentDisplayName, getAgentRuntimeName } 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_JUNIOR_DISPLAY_NAME = getAgentListDisplayName("sisyphus-junior")
|
||||
const BUILTIN_MULTIMODAL_LOOKER_DISPLAY_NAME = getAgentListDisplayName("multimodal-looker")
|
||||
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")
|
||||
|
||||
function createPluginComponents(): PluginComponents {
|
||||
return {
|
||||
|
||||
@@ -1,8 +1,59 @@
|
||||
import { describe, it, expect } from "bun:test"
|
||||
import { remapAgentKeysToDisplayNames } from "./agent-key-remapper"
|
||||
import { getAgentDisplayName, getAgentListDisplayName, getAgentRuntimeName } from "../shared/agent-display-names"
|
||||
import { getAgentDisplayName, getAgentRuntimeName } from "../shared/agent-display-names"
|
||||
|
||||
const ZWSP_REGEX = /[\u200B\u200C\u200D\uFEFF]/
|
||||
|
||||
describe("remapAgentKeysToDisplayNames", () => {
|
||||
it("object keys must not contain ZWSP characters (RFC 7230)", () => {
|
||||
// given all core agents with ZWSP-based ordering
|
||||
const agents = {
|
||||
sisyphus: { prompt: "test" },
|
||||
hephaestus: { prompt: "test" },
|
||||
prometheus: { prompt: "test" },
|
||||
atlas: { prompt: "test" },
|
||||
}
|
||||
|
||||
// when remapping
|
||||
const result = remapAgentKeysToDisplayNames(agents)
|
||||
|
||||
// then NO object key should contain ZWSP (RFC 7230 compliance)
|
||||
for (const key of Object.keys(result)) {
|
||||
expect(key).not.toMatch(ZWSP_REGEX)
|
||||
}
|
||||
})
|
||||
|
||||
it("name field MUST contain ZWSP for core agents (OpenCode sort ordering)", () => {
|
||||
// given core agents
|
||||
const agents = {
|
||||
sisyphus: { prompt: "test" },
|
||||
hephaestus: { prompt: "test" },
|
||||
prometheus: { prompt: "test" },
|
||||
atlas: { prompt: "test" },
|
||||
}
|
||||
|
||||
// when remapping
|
||||
const result = remapAgentKeysToDisplayNames(agents)
|
||||
|
||||
// then name fields MUST have ZWSP prefixes for sort ordering
|
||||
const sisyphusConfig = result[getAgentDisplayName("sisyphus")] as Record<string, unknown>
|
||||
const hephaestusConfig = result[getAgentDisplayName("hephaestus")] as Record<string, unknown>
|
||||
const prometheusConfig = result[getAgentDisplayName("prometheus")] as Record<string, unknown>
|
||||
const atlasConfig = result[getAgentDisplayName("atlas")] as Record<string, unknown>
|
||||
|
||||
expect(sisyphusConfig.name).toMatch(ZWSP_REGEX)
|
||||
expect(hephaestusConfig.name).toMatch(ZWSP_REGEX)
|
||||
expect(prometheusConfig.name).toMatch(ZWSP_REGEX)
|
||||
expect(atlasConfig.name).toMatch(ZWSP_REGEX)
|
||||
|
||||
// And they should be the runtime names (with ZWSP)
|
||||
expect(sisyphusConfig.name).toBe(getAgentRuntimeName("sisyphus"))
|
||||
expect(hephaestusConfig.name).toBe(getAgentRuntimeName("hephaestus"))
|
||||
expect(prometheusConfig.name).toBe(getAgentRuntimeName("prometheus"))
|
||||
expect(atlasConfig.name).toBe(getAgentRuntimeName("atlas"))
|
||||
})
|
||||
|
||||
|
||||
it("remaps known agent keys to display names", () => {
|
||||
// given agents with lowercase keys
|
||||
const agents = {
|
||||
@@ -14,7 +65,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 +100,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,8 +128,8 @@ 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()
|
||||
})
|
||||
|
||||
@@ -96,10 +147,10 @@ describe("remapAgentKeysToDisplayNames", () => {
|
||||
|
||||
// then
|
||||
expect(remappedNames).toEqual([
|
||||
getAgentListDisplayName("atlas"),
|
||||
getAgentListDisplayName("prometheus"),
|
||||
getAgentListDisplayName("hephaestus"),
|
||||
getAgentListDisplayName("sisyphus"),
|
||||
getAgentDisplayName("atlas"),
|
||||
getAgentDisplayName("prometheus"),
|
||||
getAgentDisplayName("hephaestus"),
|
||||
getAgentDisplayName("sisyphus"),
|
||||
])
|
||||
})
|
||||
|
||||
@@ -118,27 +169,27 @@ describe("remapAgentKeysToDisplayNames", () => {
|
||||
|
||||
// then keys and names both use the same runtime-facing list names
|
||||
expect(Object.keys(result).slice(0, 4)).toEqual([
|
||||
getAgentListDisplayName("sisyphus"),
|
||||
getAgentListDisplayName("hephaestus"),
|
||||
getAgentListDisplayName("prometheus"),
|
||||
getAgentListDisplayName("atlas"),
|
||||
getAgentDisplayName("sisyphus"),
|
||||
getAgentDisplayName("hephaestus"),
|
||||
getAgentDisplayName("prometheus"),
|
||||
getAgentDisplayName("atlas"),
|
||||
])
|
||||
expect(result[getAgentListDisplayName("sisyphus")]).toEqual({
|
||||
expect(result[getAgentDisplayName("sisyphus")]).toEqual({
|
||||
name: getAgentRuntimeName("sisyphus"),
|
||||
prompt: "test",
|
||||
mode: "primary",
|
||||
})
|
||||
expect(result[getAgentListDisplayName("hephaestus")]).toEqual({
|
||||
expect(result[getAgentDisplayName("hephaestus")]).toEqual({
|
||||
name: getAgentRuntimeName("hephaestus"),
|
||||
prompt: "test",
|
||||
mode: "primary",
|
||||
})
|
||||
expect(result[getAgentListDisplayName("prometheus")]).toEqual({
|
||||
expect(result[getAgentDisplayName("prometheus")]).toEqual({
|
||||
name: getAgentRuntimeName("prometheus"),
|
||||
prompt: "test",
|
||||
mode: "all",
|
||||
})
|
||||
expect(result[getAgentListDisplayName("atlas")]).toEqual({
|
||||
expect(result[getAgentDisplayName("atlas")]).toEqual({
|
||||
name: getAgentRuntimeName("atlas"),
|
||||
prompt: "test",
|
||||
mode: "primary",
|
||||
@@ -159,22 +210,22 @@ describe("remapAgentKeysToDisplayNames", () => {
|
||||
const result = remapAgentKeysToDisplayNames(agents)
|
||||
|
||||
// then runtime-facing names stay aligned even when builtin configs omit name
|
||||
expect(result[getAgentListDisplayName("sisyphus")]).toEqual({
|
||||
expect(result[getAgentDisplayName("sisyphus")]).toEqual({
|
||||
name: getAgentRuntimeName("sisyphus"),
|
||||
prompt: "test",
|
||||
mode: "primary",
|
||||
})
|
||||
expect(result[getAgentListDisplayName("hephaestus")]).toEqual({
|
||||
expect(result[getAgentDisplayName("hephaestus")]).toEqual({
|
||||
name: getAgentRuntimeName("hephaestus"),
|
||||
prompt: "test",
|
||||
mode: "primary",
|
||||
})
|
||||
expect(result[getAgentListDisplayName("prometheus")]).toEqual({
|
||||
expect(result[getAgentDisplayName("prometheus")]).toEqual({
|
||||
name: getAgentRuntimeName("prometheus"),
|
||||
prompt: "test",
|
||||
mode: "all",
|
||||
})
|
||||
expect(result[getAgentListDisplayName("atlas")]).toEqual({
|
||||
expect(result[getAgentDisplayName("atlas")]).toEqual({
|
||||
name: getAgentRuntimeName("atlas"),
|
||||
prompt: "test",
|
||||
mode: "primary",
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
reorderAgentsByPriority,
|
||||
CANONICAL_CORE_AGENT_ORDER,
|
||||
} from "./agent-priority-order"
|
||||
import { getAgentDisplayName, getAgentListDisplayName } from "../shared/agent-display-names"
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names"
|
||||
|
||||
describe("agent-priority-order", () => {
|
||||
describe("CANONICAL_CORE_AGENT_ORDER", () => {
|
||||
@@ -35,11 +35,11 @@ describe("agent-priority-order", () => {
|
||||
})
|
||||
|
||||
describe("reorderAgentsByPriority", () => {
|
||||
// given: display names for all core agents
|
||||
const sisyphus = getAgentListDisplayName("sisyphus")
|
||||
const hephaestus = getAgentListDisplayName("hephaestus")
|
||||
const prometheus = getAgentListDisplayName("prometheus")
|
||||
const atlas = getAgentListDisplayName("atlas")
|
||||
// given: display names for all core agents (no ZWSP in keys)
|
||||
const sisyphus = getAgentDisplayName("sisyphus")
|
||||
const hephaestus = getAgentDisplayName("hephaestus")
|
||||
const prometheus = getAgentDisplayName("prometheus")
|
||||
const atlas = getAgentDisplayName("atlas")
|
||||
const oracle = getAgentDisplayName("oracle")
|
||||
const librarian = getAgentDisplayName("librarian")
|
||||
const explore = getAgentDisplayName("explore")
|
||||
|
||||
@@ -7,10 +7,7 @@ import * as skillLoader from "../features/opencode-skill-loader";
|
||||
import type { OhMyOpenCodeConfig } from "../config";
|
||||
import type { PluginComponents } from "./plugin-components-loader";
|
||||
import { applyCommandConfig } from "./command-config-handler";
|
||||
import {
|
||||
getAgentDisplayName,
|
||||
getAgentListDisplayName,
|
||||
} from "../shared/agent-display-names";
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names";
|
||||
|
||||
function createPluginComponents(): PluginComponents {
|
||||
return {
|
||||
@@ -108,7 +105,7 @@ describe("applyCommandConfig", () => {
|
||||
expect(commandConfig["agents-global-skill"]?.description).toContain("Agents global skill");
|
||||
});
|
||||
|
||||
test("normalizes Atlas command agents to the runtime list name used by opencode command routing", async () => {
|
||||
test("normalizes Atlas command agents to the display name for HTTP-safe routing", async () => {
|
||||
// given
|
||||
loadBuiltinCommandsSpy.mockReturnValue({
|
||||
"start-work": {
|
||||
@@ -130,10 +127,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 runtime list name", async () => {
|
||||
test("normalizes legacy display-name command agents to the display name", async () => {
|
||||
// given
|
||||
loadBuiltinCommandsSpy.mockReturnValue({
|
||||
"start-work": {
|
||||
@@ -155,6 +152,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"));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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, getAgentRuntimeName } from "../shared/agent-display-names"
|
||||
import { getAgentDisplayName, getAgentDisplayName, getAgentRuntimeName } 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"),
|
||||
])
|
||||
})
|
||||
|
||||
@@ -354,19 +354,19 @@ describe("Plan agent demote behavior", () => {
|
||||
|
||||
expect(emittedCoreEntries).toEqual([
|
||||
[
|
||||
getAgentListDisplayName("sisyphus"),
|
||||
getAgentDisplayName("sisyphus"),
|
||||
expect.objectContaining({ name: getAgentRuntimeName("sisyphus") }),
|
||||
],
|
||||
[
|
||||
getAgentListDisplayName("hephaestus"),
|
||||
getAgentDisplayName("hephaestus"),
|
||||
expect.objectContaining({ name: getAgentRuntimeName("hephaestus") }),
|
||||
],
|
||||
[
|
||||
getAgentListDisplayName("prometheus"),
|
||||
getAgentDisplayName("prometheus"),
|
||||
expect.objectContaining({ name: getAgentRuntimeName("prometheus") }),
|
||||
],
|
||||
[
|
||||
getAgentListDisplayName("atlas"),
|
||||
getAgentDisplayName("atlas"),
|
||||
expect.objectContaining({ name: getAgentRuntimeName("atlas") }),
|
||||
],
|
||||
])
|
||||
@@ -407,7 +407,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 () => {
|
||||
@@ -441,7 +441,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")
|
||||
@@ -472,7 +472,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")
|
||||
})
|
||||
@@ -508,7 +508,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")
|
||||
})
|
||||
@@ -536,7 +536,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// then
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("hephaestus"))
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("hephaestus"))
|
||||
})
|
||||
|
||||
test("canonicalizes configured default_agent when key uses mixed case", async () => {
|
||||
@@ -560,7 +560,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// then
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("hephaestus"))
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("hephaestus"))
|
||||
})
|
||||
|
||||
test("canonicalizes configured default_agent key to display name", async () => {
|
||||
@@ -584,13 +584,13 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// #then
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("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,
|
||||
@@ -609,7 +609,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// #then
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("hephaestus"))
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("hephaestus"))
|
||||
})
|
||||
|
||||
test("sets default_agent to sisyphus when missing", async () => {
|
||||
@@ -632,7 +632,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// #then
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("sisyphus"))
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("sisyphus"))
|
||||
})
|
||||
|
||||
test("uses canonical default_agent display name so OpenCode lookups match emitted agent keys", async () => {
|
||||
@@ -656,7 +656,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// then
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("hephaestus"))
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("hephaestus"))
|
||||
})
|
||||
|
||||
test("sets default_agent to sisyphus when configured default_agent is empty after trim", async () => {
|
||||
@@ -680,7 +680,7 @@ describe("default_agent behavior with Sisyphus orchestration", () => {
|
||||
await handler(config)
|
||||
|
||||
// then
|
||||
expect(config.default_agent).toBe(getAgentRuntimeName("sisyphus"))
|
||||
expect(config.default_agent).toBe(getAgentDisplayName("sisyphus"))
|
||||
})
|
||||
|
||||
test("preserves custom default_agent names while trimming whitespace", async () => {
|
||||
@@ -874,7 +874,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")
|
||||
})
|
||||
@@ -915,7 +915,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")
|
||||
})
|
||||
@@ -957,7 +957,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)
|
||||
})
|
||||
@@ -993,7 +993,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)
|
||||
@@ -1218,7 +1218,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()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1384,17 +1384,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"),
|
||||
])
|
||||
|
||||
@@ -1475,10 +1475,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 () => {
|
||||
@@ -1514,8 +1514,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()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { randomUUID } from "node:crypto"
|
||||
import { createPluginInterface } from "./plugin-interface"
|
||||
import { createAutoSlashCommandHook } from "./hooks/auto-slash-command"
|
||||
import { createStartWorkHook } from "./hooks/start-work"
|
||||
import { getAgentListDisplayName } from "./shared/agent-display-names"
|
||||
import { getAgentDisplayName } from "./shared/agent-display-names"
|
||||
import { readBoulderState } from "./features/boulder-state"
|
||||
import {
|
||||
_resetForTesting,
|
||||
|
||||
@@ -10,7 +10,7 @@ import { createKeywordDetectorHook } from "../hooks/keyword-detector"
|
||||
import { createStartWorkHook } from "../hooks/start-work"
|
||||
import { readBoulderState } from "../features/boulder-state"
|
||||
import { _resetForTesting, setMainSession, subagentSessions, registerAgentName, updateSessionAgent, getSessionAgent } from "../features/claude-code-session-state"
|
||||
import { getAgentListDisplayName } from "../shared/agent-display-names"
|
||||
import { getAgentDisplayName } from "../shared/agent-display-names"
|
||||
import { getOmoOpenCodeCacheDir, getOpenCodeCacheDir } from "../shared/data-path"
|
||||
import { clearSessionModel, getSessionModel, setSessionModel } from "../shared/session-model-state"
|
||||
|
||||
@@ -738,7 +738,7 @@ describe("createChatMessageHandler - TUI variant passthrough", () => {
|
||||
},
|
||||
})
|
||||
const handler = createChatMessageHandler(args)
|
||||
const input = createMockInput(getAgentListDisplayName("prometheus"))
|
||||
const input = createMockInput(getAgentDisplayName("prometheus"))
|
||||
const output = createMockOutput()
|
||||
|
||||
//#when
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
declare const require: NodeJS.Require
|
||||
const { describe, test, expect, beforeEach, afterEach, spyOn, mock } = require("bun:test")
|
||||
import { DEFAULT_CATEGORIES, CATEGORY_PROMPT_APPENDS, CATEGORY_DESCRIPTIONS, isPlanAgent, PLAN_AGENT_NAMES, isPlanFamily, PLAN_FAMILY_NAMES } from "./constants"
|
||||
import { getAgentDisplayName, getAgentListDisplayName } from "../../shared/agent-display-names"
|
||||
import { getAgentDisplayName, getAgentDisplayName } from "../../shared/agent-display-names"
|
||||
import type { CategoryConfig } from "../../config/schema"
|
||||
import type { DelegateTaskArgs } from "./types"
|
||||
import { __resetModelCache } from "../../shared/model-availability"
|
||||
@@ -277,7 +277,7 @@ describe("sisyphus-task", () => {
|
||||
|
||||
test("returns true for prometheus list display name with zwsp prefix", () => {
|
||||
//#given / #when
|
||||
const result = isPlanFamily(getAgentListDisplayName("prometheus"))
|
||||
const result = isPlanFamily(getAgentDisplayName("prometheus"))
|
||||
//#then
|
||||
expect(result).toBe(true)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user