Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ override URLs.

Default output is adaptive:

- coding-agent, CI, non-TTY, and automation signals use compact structured
agent output;
- `AGENT` names/flags, coding-agent, CI, non-TTY, and automation signals use
compact structured agent output;
- interactive TTY sessions use human output;
- `--json`, `--quiet`, `-q`, `--output <mode>`, `-o <mode>`, and `AKUA_OUTPUT`
override detection.
Expand Down
3 changes: 2 additions & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ stored with user-only file permissions.
The default output mode is adaptive:

- `human`: interactive TTY without automation or coding-agent signals;
- `agent`: known coding-agent env vars, CI env vars, or non-TTY stdout;
- `agent`: `AGENT` names/flags, known coding-agent env vars, CI env vars, or
non-TTY stdout;
- `json`: explicit `--json`, `--output json`, `-o json`, or
`AKUA_OUTPUT=json`;
- `quiet`: explicit `--quiet`, `-q`, `--output quiet`, `-o quiet`, or
Expand Down
1 change: 1 addition & 0 deletions src/runtime/mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface OutputModeInput {
}

const AGENT_ENV_VARS = [
"AGENT",
"CODEX_SANDBOX",
"CODEX_CLI",
"OPENAI_CODEX",
Expand Down
8 changes: 8 additions & 0 deletions test/mode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ describe("detectOutputMode", () => {
expect(detectOutputMode({ argv: [], env: { CODEX_SANDBOX: "1" }, stdoutIsTTY: true })).toBe("agent");
});

test("detects universal agent environment flag", () => {
expect(detectOutputMode({ argv: [], env: { AGENT: "true" }, stdoutIsTTY: true })).toBe("agent");
});

test("detects universal agent environment name", () => {
expect(detectOutputMode({ argv: [], env: { AGENT: "codex" }, stdoutIsTTY: true })).toBe("agent");
});

test("detects CI and non-tty automation", () => {
expect(detectOutputMode({ argv: [], env: { CI: "true" }, stdoutIsTTY: true })).toBe("agent");
expect(detectOutputMode({ argv: [], env: {}, stdoutIsTTY: false })).toBe("agent");
Expand Down
Loading