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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ mode, and configuration; slash commands cannot be steered.
- `CODEX_CONFIG` - JSON object merged into the Codex session config.
- `MODEL_PROVIDER` - model provider to pass to Codex for new sessions.
- `DEFAULT_AUTH_REQUEST` - ACP auth request JSON used when Codex requires authentication.
- `INITIAL_AGENT_MODE` - initial mode id: `read-only`, `agent`, or `agent-full-access`.
- `INITIAL_AGENT_MODE` - initial mode id: `read-only`, `agent`, `agent-auto-review`, or `agent-full-access`.
- `NO_BROWSER` - hide browser-based ChatGPT auth when set.
- `APP_SERVER_LOGS` - directory for adapter logs.

Expand Down
2 changes: 1 addition & 1 deletion readme-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Set `CODEX_PATH` to run a different Codex binary; versions other than the one sp
- `CODEX_CONFIG` - JSON object merged into the Codex session config.
- `MODEL_PROVIDER` - model provider to pass to Codex for new sessions.
- `DEFAULT_AUTH_REQUEST` - ACP auth request JSON used when Codex requires authentication.
- `INITIAL_AGENT_MODE` - initial mode id: `read-only`, `agent`, or `agent-full-access`.
- `INITIAL_AGENT_MODE` - initial mode id: `read-only`, `agent`, `agent-auto-review`, or `agent-full-access`.
- `NO_BROWSER` - hide browser-based ChatGPT auth when set.
- `APP_SERVER_LOGS` - directory for adapter logs.

Expand Down
23 changes: 20 additions & 3 deletions src/AgentMode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {AskForApproval, SandboxMode, SandboxPolicy} from "./app-server/v2";
import type {ApprovalsReviewer, AskForApproval, SandboxMode, SandboxPolicy} from "./app-server/v2";
import type {SessionConfigOption, SessionMode, SessionModeState} from "@agentclientprotocol/sdk";

export const MODE_CONFIG_ID = "mode";
Expand All @@ -10,14 +10,16 @@ export class AgentMode {
readonly approvalPolicy: AskForApproval;
readonly sandboxPolicy: SandboxPolicy;
readonly sandboxMode: SandboxMode;
readonly approvalsReviewer: ApprovalsReviewer;

private constructor(id: string, name: string, description: string, approval: AskForApproval, sandbox: SandboxPolicy, sandboxMode: SandboxMode) {
private constructor(id: string, name: string, description: string, approval: AskForApproval, sandbox: SandboxPolicy, sandboxMode: SandboxMode, approvalsReviewer: ApprovalsReviewer = "user") {
this.id = id;
this.name = name;
this.description = description;
this.approvalPolicy = approval;
this.sandboxPolicy = sandbox;
this.sandboxMode = sandboxMode; // same as sandboxPolicy, need to look for
this.approvalsReviewer = approvalsReviewer;
}

static readonly ReadOnly = new AgentMode(
Expand Down Expand Up @@ -45,6 +47,21 @@ export class AgentMode {
},
"workspace-write"
);
static readonly AgentAutoReview = new AgentMode(
"agent-auto-review",
"Agent (auto review)",
"Read and edit files, and run commands. Approval requests are reviewed automatically by a Codex subagent.",
"on-request",
{
type: "workspaceWrite",
writableRoots: [],
networkAccess: false,
excludeTmpdirEnvVar: false,
excludeSlashTmp: false
},
"workspace-write",
"auto_review"
);
static readonly AgentFullAccess = new AgentMode(
"agent-full-access",
"Agent (full access)",
Expand Down Expand Up @@ -88,7 +105,7 @@ export class AgentMode {
}

static all(): AgentMode[] {
return [AgentMode.ReadOnly, AgentMode.Agent, AgentMode.AgentFullAccess];
return [AgentMode.ReadOnly, AgentMode.Agent, AgentMode.AgentAutoReview, AgentMode.AgentFullAccess];
}

static find(modeId: string): AgentMode | null {
Expand Down
1 change: 1 addition & 0 deletions src/CodexAcpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ export class CodexAcpClient {
threadId: request.sessionId,
input: input,
approvalPolicy: agentMode.approvalPolicy,
approvalsReviewer: agentMode.approvalsReviewer,
sandboxPolicy: addAdditionalDirectoriesToSandboxPolicy(agentMode.sandboxPolicy, additionalDirectories),
summary: disableSummary ? "none" : "auto",
effort: effort,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
}
],
"approvalPolicy": "on-request",
"approvalsReviewer": "approvalsReviewer",
"sandboxPolicy": {
"type": "workspaceWrite",
"writableRoots": [],
Expand Down