From 6fb6d1256cfcb67af7479a4fd1a2ef623c681dc2 Mon Sep 17 00:00:00 2001 From: ismeth Date: Mon, 2 Mar 2026 22:18:08 +0100 Subject: [PATCH] feat(athena): dual prompt selection with MODE=all Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- src/agents/athena/agent.test.ts | 107 ++++++++++++++++++++++++++++++++ src/agents/athena/index.ts | 2 + 2 files changed, 109 insertions(+) create mode 100644 src/agents/athena/agent.test.ts diff --git a/src/agents/athena/agent.test.ts b/src/agents/athena/agent.test.ts new file mode 100644 index 000000000..26fa9c3a1 --- /dev/null +++ b/src/agents/athena/agent.test.ts @@ -0,0 +1,107 @@ +/// + +import { afterEach, beforeEach, describe, expect, it } from "bun:test" +import { createAthenaAgent } from "./agent" + +describe("createAthenaAgent", () => { + const originalEnv = process.env.OPENCODE_CLI_RUN_MODE + + beforeEach(() => { + delete process.env.OPENCODE_CLI_RUN_MODE + }) + + afterEach(() => { + if (originalEnv !== undefined) { + process.env.OPENCODE_CLI_RUN_MODE = originalEnv + } else { + delete process.env.OPENCODE_CLI_RUN_MODE + } + }) + + describe("#given the agent mode", () => { + describe("#when accessing the static mode property", () => { + it("#then equals 'all' to support both primary and subagent contexts", () => { + expect(createAthenaAgent.mode).toBe("all") + }) + }) + }) + + describe("#given the agent config", () => { + describe("#when creating the agent with a model", () => { + it("#then returns config with the specified model", () => { + const config = createAthenaAgent("anthropic/claude-opus-4-6") + expect(config.model).toBe("anthropic/claude-opus-4-6") + }) + + it("#then sets temperature to 0.1", () => { + const config = createAthenaAgent("anthropic/claude-opus-4-6") + expect(config.temperature).toBe(0.1) + }) + + it("#then includes tool restrictions denying call_omo_agent", () => { + const config = createAthenaAgent("anthropic/claude-opus-4-6") + expect(config.permission).toBeDefined() + }) + + it("#then includes a description", () => { + const config = createAthenaAgent("anthropic/claude-opus-4-6") + expect(config.description).toContain("synthesis strategist") + }) + }) + }) + + describe("#given default invocation (no CLI mode)", () => { + describe("#when OPENCODE_CLI_RUN_MODE is not set", () => { + it("#then selects the interactive prompt", () => { + const config = createAthenaAgent("anthropic/claude-opus-4-6") + expect(config.prompt).toContain("Question tool") + }) + + it("#then contains interactive workflow sections", () => { + const config = createAthenaAgent("anthropic/claude-opus-4-6") + expect(config.prompt).toContain("Step 2: Council setup (default flow before launch).") + expect(config.prompt).toContain("") + }) + + it("#then does not contain non-interactive output contract", () => { + const config = createAthenaAgent("anthropic/claude-opus-4-6") + expect(config.prompt).not.toContain("") + }) + }) + }) + + describe("#given CLI run mode", () => { + describe("#when OPENCODE_CLI_RUN_MODE is 'true'", () => { + beforeEach(() => { + process.env.OPENCODE_CLI_RUN_MODE = "true" + }) + + it("#then selects the non-interactive prompt", () => { + const config = createAthenaAgent("anthropic/claude-opus-4-6") + expect(config.prompt).toContain("") + }) + + it("#then contains non-interactive constraints", () => { + const config = createAthenaAgent("anthropic/claude-opus-4-6") + expect(config.prompt).toContain("NEVER use the Question tool") + }) + + it("#then does not contain interactive agent handoff section", () => { + const config = createAthenaAgent("anthropic/claude-opus-4-6") + expect(config.prompt).not.toContain("") + }) + }) + + describe("#when OPENCODE_CLI_RUN_MODE is 'false'", () => { + beforeEach(() => { + process.env.OPENCODE_CLI_RUN_MODE = "false" + }) + + it("#then selects the interactive prompt", () => { + const config = createAthenaAgent("anthropic/claude-opus-4-6") + expect(config.prompt).toContain("Question tool") + expect(config.prompt).not.toContain("") + }) + }) + }) +}) diff --git a/src/agents/athena/index.ts b/src/agents/athena/index.ts index 971242d17..ef4e1ef7f 100644 --- a/src/agents/athena/index.ts +++ b/src/agents/athena/index.ts @@ -8,3 +8,5 @@ export { } from "./council-runtime-guidance" export type { CouncilIntent } from "./council-runtime-guidance" export { COUNCIL_DEFAULTS } from "./constants" +export { ATHENA_INTERACTIVE_PROMPT } from "./interactive-prompt" +export { ATHENA_NON_INTERACTIVE_PROMPT } from "./non-interactive-prompt"