diff --git a/ENVIRONMENT.md b/ENVIRONMENT.md
index 9151754fad..fb81e2ed83 100644
--- a/ENVIRONMENT.md
+++ b/ENVIRONMENT.md
@@ -362,8 +362,8 @@ When `VERCEL_TARGET_ENV` is absent in local development or a script process, tra
- `KILO_BIN_PATH` - Path or name of the `kilo` CLI binary; used by `services/cloud-agent-next/scripts/update-default-slash-commands.mjs`. [SERVER]
- `WORKSPACE_PATH` - Filesystem path of the agent workspace. [SERVER]
- `SESSION_ID` - Reserved session identifier for the `cloud-agent-next` runtime; reserved in `RESERVED_ENV_VARS`. [SERVER]
-- `CONTROL_PLANE_IDS` - Comma-separated user or org IDs admitted to the call-home control plane at session creation. Empty admits nobody. `*` includes personal accounts. Does not enable new worktree creation by itself; that also requires `WORKTREE_CREATION_ENABLED_IDS` enrollment. [SERVER]
-- `WORKTREE_CREATION_ENABLED_IDS` - Comma-separated user or org IDs allowed to create new worktrees, or `*` for all, including personal accounts. Defaults to empty/off and also requires enrollment in `CONTROL_PLANE_IDS`. Disabling it does not block existing worktrees or sibling chats in them. [SERVER]
+- `CONTROL_PLANE_IDS` - Comma-separated user or org IDs admitted to the call-home control plane at session creation. Empty admits nobody. `*` includes personal accounts. Production defaults to empty. Wrangler `dev` defaults to `*`. Does not enable new worktree creation by itself; that also requires `WORKTREE_CREATION_ENABLED_IDS` enrollment. [SERVER]
+- `WORKTREE_CREATION_ENABLED_IDS` - Comma-separated user or org IDs allowed to create new worktrees, or `*` for all, including personal accounts. Production defaults to empty/off. Wrangler `dev` defaults to `*`. Also requires enrollment in `CONTROL_PLANE_IDS`. Disabling it does not block existing worktrees or sibling chats in them. [SERVER]
- `VERCEL_SANDBOX_ORG_IDS` - Comma-separated org IDs routed to Vercel sandboxes. Empty is off. `*` includes personal accounts. [SERVER]
- `HOME` - Reserved in `RESERVED_ENV_VARS` for cloud-agent-next session home management. [SYSTEM]
diff --git a/apps/web/src/components/cloud-agent-next/ApplyPatchToolCard.tsx b/apps/web/src/components/cloud-agent-next/ApplyPatchToolCard.tsx
new file mode 100644
index 0000000000..cfc81a8c9f
--- /dev/null
+++ b/apps/web/src/components/cloud-agent-next/ApplyPatchToolCard.tsx
@@ -0,0 +1,115 @@
+import { FileDiff } from 'lucide-react';
+import { ToolCardShell } from './ToolCardShell';
+import { ToolDiff, ToolDiffStats, ToolFilePath } from './ToolDiff';
+import { ToolCodeBlock } from './ToolOutput';
+import {
+ getUnifiedPatch,
+ MAX_TOOL_DIFF_CHARACTERS,
+ readApplyPatchFiles,
+ sumFileChanges,
+} from './toolDiffUtils';
+import type { ToolPart } from './types';
+
+type ApplyPatchToolCardProps = {
+ toolPart: ToolPart;
+};
+
+const changeLabels = {
+ add: 'Added',
+ update: 'Updated',
+ delete: 'Deleted',
+ move: 'Moved',
+};
+
+export function ApplyPatchToolCard({ toolPart }: ApplyPatchToolCardProps) {
+ const state = toolPart.state;
+ const files = readApplyPatchFiles(state.status === 'pending' ? undefined : state.metadata);
+ const single = files.length === 1 ? files[0] : undefined;
+ const patchText = typeof state.input.patchText === 'string' ? state.input.patchText : undefined;
+ const error = state.status === 'error' ? state.error : undefined;
+
+ return (
+ {filePath}
+ {file.filePath ?? 'Unknown source'}
+
+ {file.movePath ?? file.relativePath ?? 'Unknown destination'}
+
+
+ {patchText.slice(0, MAX_TOOL_DIFF_CHARACTERS)}
+
+ {patchText.length > MAX_TOOL_DIFF_CHARACTERS && (
+
+ {error}
+
+ )}
+ {state.status === 'running' && (
+
- {input.command}
-
+ {cwd && (
+
- {output}
-
-
- {error}
-
-