The best way to control Claude Code, Codex and more from any computer or phone
feat: add "hide whitespace changes" option for diffs (#2389)
Illia Panasenko committed
May 3, 2026 at 20:47 UTC
f7748a0d656f918080828130aceda039457897e0
16 files changed
+308
-6
apps/desktop/src/clientPersistence.test.ts
+1
@@ -52,6 +52,7 @@ const clientSettings: ClientSettings = {
52
autoOpenPlanSidebar: false,
53
confirmThreadArchive: true,
54
confirmThreadDelete: false,
55
+ diffIgnoreWhitespace: true,
56
diffWordWrap: true,
57
favorites: [],
58
providerModelPreferences: {},
apps/server/integration/orchestrationEngine.integration.test.ts
+2
@@ -506,6 +506,7 @@ it.live("runs multi-turn file edits and persists checkpoint diffs", () =>
506
fromCheckpointRef: checkpointRefForThreadTurn(THREAD_ID, 1),
507
toCheckpointRef: checkpointRefForThreadTurn(THREAD_ID, 2),
508
fallbackFromToHead: false,
509
+ ignoreWhitespace: false,
510
});
511
assert.equal(incrementalDiff.includes("README.md"), true);
512
@@ -514,6 +515,7 @@ it.live("runs multi-turn file edits and persists checkpoint diffs", () =>
515
fromCheckpointRef: checkpointRefForThreadTurn(THREAD_ID, 0),
516
toCheckpointRef: checkpointRefForThreadTurn(THREAD_ID, 2),
517
fallbackFromToHead: false,
518
+ ignoreWhitespace: false,
519
});
520
assert.equal(fullDiff.includes("README.md"), true);
521
apps/server/src/checkpointing/Layers/CheckpointDiffQuery.test.ts
+71
-2
@@ -48,6 +48,7 @@ describe("CheckpointDiffQueryLive", () => {
48
readonly fromCheckpointRef: CheckpointRef;
49
readonly toCheckpointRef: CheckpointRef;
50
readonly cwd: string;
51
+ readonly ignoreWhitespace: boolean;
52
}> = [];
53
54
const threadCheckpointContext = makeThreadCheckpointContext({
@@ -68,9 +69,14 @@ describe("CheckpointDiffQueryLive", () => {
69
return true;
70
}),
71
restoreCheckpoint: () => Effect.succeed(true),
71
- diffCheckpoints: ({ fromCheckpointRef, toCheckpointRef, cwd }) =>
72
+ diffCheckpoints: ({ fromCheckpointRef, toCheckpointRef, cwd, ignoreWhitespace }) =>
73
Effect.sync(() => {
73
- diffCheckpointsCalls.push({ fromCheckpointRef, toCheckpointRef, cwd });
74
+ diffCheckpointsCalls.push({
75
+ fromCheckpointRef,
76
+ toCheckpointRef,
77
+ cwd,
78
+ ignoreWhitespace,
79
+ });
80
return "diff patch";
81
}),
82
deleteCheckpointRefs: () => Effect.void,
@@ -102,6 +108,7 @@ describe("CheckpointDiffQueryLive", () => {
108
threadId,
109
fromTurnCount: 0,
110
toTurnCount: 1,
111
+ ignoreWhitespace: true,
112
});
113
}).pipe(Effect.provide(layer)),
114
);
@@ -113,6 +120,7 @@ describe("CheckpointDiffQueryLive", () => {
120
cwd: "/tmp/workspace",
121
fromCheckpointRef: expectedFromRef,
122
toCheckpointRef,
123
+ ignoreWhitespace: true,
124
},
125
]);
126
expect(result).toEqual({
@@ -123,6 +131,67 @@ describe("CheckpointDiffQueryLive", () => {
131
});
132
});
133
134
+ it("defaults to hide whitespace changes", async () => {
135
+ const projectId = ProjectId.make("project-default-whitespace");
136
+ const threadId = ThreadId.make("thread-default-whitespace");
137
+ const toCheckpointRef = checkpointRefForThreadTurn(threadId, 1);
138
+ const diffCheckpointsCalls: Array<{ readonly ignoreWhitespace: boolean }> = [];
139
+
140
+ const threadCheckpointContext = makeThreadCheckpointContext({
141
+ projectId,
142
+ threadId,
143
+ workspaceRoot: "/tmp/workspace",
144
+ worktreePath: null,
145
+ checkpointTurnCount: 1,
146
+ checkpointRef: toCheckpointRef,
147
+ });
148
+
149
+ const checkpointStore: CheckpointStoreShape = {
150
+ isGitRepository: () => Effect.succeed(true),
151
+ captureCheckpoint: () => Effect.void,
152
+ hasCheckpointRef: () => Effect.succeed(true),
153
+ restoreCheckpoint: () => Effect.succeed(true),
154
+ diffCheckpoints: ({ ignoreWhitespace }) =>
155
+ Effect.sync(() => {
156
+ diffCheckpointsCalls.push({ ignoreWhitespace });
157
+ return "diff patch";
158
+ }),
159
+ deleteCheckpointRefs: () => Effect.void,
160
+ };
161
+
162
+ const layer = CheckpointDiffQueryLive.pipe(
163
+ Layer.provideMerge(Layer.succeed(CheckpointStore, checkpointStore)),
164
+ Layer.provideMerge(
165
+ Layer.succeed(ProjectionSnapshotQuery, {
166
+ getSnapshot: () =>
167
+ Effect.die("CheckpointDiffQuery should not request the full orchestration snapshot"),
168
+ getShellSnapshot: () =>
169
+ Effect.die("CheckpointDiffQuery should not request the orchestration shell snapshot"),
170
+ getCounts: () => Effect.succeed({ projectCount: 0, threadCount: 0 }),
171
+ getActiveProjectByWorkspaceRoot: () => Effect.succeed(Option.none()),
172
+ getProjectShellById: () => Effect.succeed(Option.none()),
173
+ getFirstActiveThreadIdByProjectId: () => Effect.succeed(Option.none()),
174
+ getThreadCheckpointContext: () => Effect.succeed(Option.some(threadCheckpointContext)),
175
+ getThreadShellById: () => Effect.succeed(Option.none()),
176
+ getThreadDetailById: () => Effect.succeed(Option.none()),
177
+ }),
178
+ ),
179
+ );
180
+
181
+ await Effect.runPromise(
182
+ Effect.gen(function* () {
183
+ const query = yield* CheckpointDiffQuery;
184
+ return yield* query.getTurnDiff({
185
+ threadId,
186
+ fromTurnCount: 0,
187
+ toTurnCount: 1,
188
+ });
189
+ }).pipe(Effect.provide(layer)),
190
+ );
191
+
192
+ expect(diffCheckpointsCalls).toEqual([{ ignoreWhitespace: true }]);
193
+ });
194
+
195
it("fails when the thread is missing from the snapshot", async () => {
196
const threadId = ThreadId.make("thread-missing");
197
apps/server/src/checkpointing/Layers/CheckpointDiffQuery.ts
+3
@@ -24,6 +24,7 @@ const make = Effect.gen(function* () {
24
const getTurnDiff: CheckpointDiffQueryShape["getTurnDiff"] = Effect.fn("getTurnDiff")(
25
function* (input) {
26
const operation = "CheckpointDiffQuery.getTurnDiff";
27
+ const ignoreWhitespace = input.ignoreWhitespace ?? true;
28
29
if (input.fromTurnCount === input.toTurnCount) {
30
const emptyDiff: OrchestrationGetTurnDiffResultType = {
@@ -131,6 +132,7 @@ const make = Effect.gen(function* () {
132
fromCheckpointRef,
133
toCheckpointRef,
134
fallbackFromToHead: false,
135
+ ignoreWhitespace,
136
});
137
138
const turnDiff: OrchestrationGetTurnDiffResultType = {
@@ -157,6 +159,7 @@ const make = Effect.gen(function* () {
159
threadId: input.threadId,
160
fromTurnCount: 0,
161
toTurnCount: input.toTurnCount,
162
+ ignoreWhitespace: input.ignoreWhitespace ?? true,
163
}).pipe(Effect.map((result): OrchestrationGetFullThreadDiffResult => result));
164
165
return {
apps/server/src/checkpointing/Layers/CheckpointStore.test.ts
+76
@@ -114,6 +114,7 @@ it.layer(TestLayer)("CheckpointStoreLive", (it) => {
114
cwd: tmp,
115
fromCheckpointRef,
116
toCheckpointRef,
117
+ ignoreWhitespace: true,
118
});
119
120
expect(diff).toContain("diff --git");
@@ -121,5 +122,80 @@ it.layer(TestLayer)("CheckpointStoreLive", (it) => {
122
expect(diff).toContain("+line 04999");
123
}),
124
);
125
+
126
+ it.effect("can hide indentation churn when changes wrap existing lines", () =>
127
+ Effect.gen(function* () {
128
+ const tmp = yield* makeTmpDir();
129
+ yield* initRepoWithCommit(tmp);
130
+ const checkpointStore = yield* CheckpointStore;
131
+ const threadId = ThreadId.make("thread-checkpoint-store-whitespace");
132
+ const fromCheckpointRef = checkpointRefForThreadTurn(threadId, 0);
133
+ const toCheckpointRef = checkpointRefForThreadTurn(threadId, 1);
134
+
135
+ const componentPath = path.join(tmp, "Component.tsx");
136
+ yield* writeTextFile(
137
+ componentPath,
138
+ [
139
+ "export function View() {",
140
+ " return (",
141
+ " <section>",
142
+ " <h1>Title</h1>",
143
+ " <p>Body</p>",
144
+ " </section>",
145
+ " );",
146
+ "}",
147
+ "",
148
+ ].join("\n"),
149
+ );
150
+ yield* checkpointStore.captureCheckpoint({
151
+ cwd: tmp,
152
+ checkpointRef: fromCheckpointRef,
153
+ });
154
+ yield* writeTextFile(
155
+ componentPath,
156
+ [
157
+ "export function View() {",
158
+ " return (",
159
+ " <section>",
160
+ " {isReady ? (",
161
+ " <div>",
162
+ " <h1>Title</h1>",
163
+ " <p>Body</p>",
164
+ " </div>",
165
+ " ) : null}",
166
+ " </section>",
167
+ " );",
168
+ "}",
169
+ "",
170
+ ].join("\n"),
171
+ );
172
+ yield* checkpointStore.captureCheckpoint({
173
+ cwd: tmp,
174
+ checkpointRef: toCheckpointRef,
175
+ });
176
+
177
+ const normalDiff = yield* checkpointStore.diffCheckpoints({
178
+ cwd: tmp,
179
+ fromCheckpointRef,
180
+ toCheckpointRef,
181
+ ignoreWhitespace: false,
182
+ });
183
+ const whitespaceIgnoredDiff = yield* checkpointStore.diffCheckpoints({
184
+ cwd: tmp,
185
+ fromCheckpointRef,
186
+ toCheckpointRef,
187
+ ignoreWhitespace: true,
188
+ });
189
+
190
+ expect(normalDiff).toContain("diff --git");
191
+ expect(normalDiff).toContain("- <h1>Title</h1>");
192
+ expect(normalDiff).toContain("+ <h1>Title</h1>");
193
+ expect(whitespaceIgnoredDiff).toContain("diff --git");
194
+ expect(whitespaceIgnoredDiff).toContain("+ {isReady ? (");
195
+ expect(whitespaceIgnoredDiff).toContain("+ <div>");
196
+ expect(whitespaceIgnoredDiff).not.toContain("- <h1>Title</h1>");
197
+ expect(whitespaceIgnoredDiff).not.toContain("+ <h1>Title</h1>");
198
+ }),
199
+ );
200
});
201
});
apps/server/src/checkpointing/Layers/CheckpointStore.ts
+11
-1
@@ -259,10 +259,20 @@ const makeCheckpointStore = Effect.gen(function* () {
259
});
260
}
261
262
+ const diffArgs = [
263
+ "diff",
264
+ "--patch",
265
+ "--minimal",
266
+ "--no-color",
267
+ ...(input.ignoreWhitespace ? ["--ignore-all-space"] : []),
268
+ fromCommitOid,
269
+ toCommitOid,
270
+ ];
271
+
272
const result = yield* vcs.execute({
273
operation,
274
cwd: input.cwd,
265
- args: ["diff", "--patch", "--minimal", "--no-color", fromCommitOid, toCommitOid],
275
+ args: diffArgs,
276
maxOutputBytes: CHECKPOINT_DIFF_MAX_OUTPUT_BYTES,
277
});
278
apps/server/src/checkpointing/Services/CheckpointStore.ts
+1
@@ -32,6 +32,7 @@ export interface DiffCheckpointsInput {
32
readonly fromCheckpointRef: CheckpointRef;
33
readonly toCheckpointRef: CheckpointRef;
34
readonly fallbackFromToHead?: boolean;
35
+ readonly ignoreWhitespace: boolean;
36
}
37
38
export interface DeleteCheckpointRefsInput {
apps/server/src/orchestration/Layers/CheckpointReactor.ts
+1
@@ -237,6 +237,7 @@ const make = Effect.gen(function* () {
237
fromCheckpointRef,
238
toCheckpointRef: targetCheckpointRef,
239
fallbackFromToHead: false,
240
+ ignoreWhitespace: false,
241
})
242
.pipe(
243
Effect.map((diff) =>
apps/web/src/components/DiffPanel.tsx
+17
-1
@@ -8,6 +8,7 @@ import {
8
ChevronLeftIcon,
9
ChevronRightIcon,
10
Columns2Icon,
11
+ PilcrowIcon,
12
Rows3Icon,
13
TextWrapIcon,
14
} from "lucide-react";
@@ -172,6 +173,7 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
173
const settings = useSettings();
174
const [diffRenderMode, setDiffRenderMode] = useState<DiffRenderMode>("stacked");
175
const [diffWordWrap, setDiffWordWrap] = useState(settings.diffWordWrap);
176
+ const [diffIgnoreWhitespace, setDiffIgnoreWhitespace] = useState(settings.diffIgnoreWhitespace);
177
const patchViewportRef = useRef<HTMLDivElement>(null);
178
const turnStripRef = useRef<HTMLDivElement>(null);
179
const previousDiffOpenRef = useRef(false);
@@ -277,6 +279,7 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
279
threadId: activeThreadId,
280
fromTurnCount: activeCheckpointRange?.fromTurnCount ?? null,
281
toTurnCount: activeCheckpointRange?.toTurnCount ?? null,
282
+ ignoreWhitespace: diffIgnoreWhitespace,
283
cacheScope: selectedTurn ? `turn:${selectedTurn.turnId}` : conversationCacheScope,
284
enabled: isGitRepo,
285
}),
@@ -317,9 +320,10 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
320
useEffect(() => {
321
if (diffOpen && !previousDiffOpenRef.current) {
322
setDiffWordWrap(settings.diffWordWrap);
323
+ setDiffIgnoreWhitespace(settings.diffIgnoreWhitespace);
324
}
325
previousDiffOpenRef.current = diffOpen;
322
- }, [diffOpen, settings.diffWordWrap]);
326
+ }, [diffOpen, settings.diffIgnoreWhitespace, settings.diffWordWrap]);
327
328
useEffect(() => {
329
if (!selectedFilePath || !patchViewportRef.current) {
@@ -551,6 +555,18 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
555
>
556
<TextWrapIcon className="size-3" />
557
</Toggle>
558
+ <Toggle
559
+ aria-label={diffIgnoreWhitespace ? "Show whitespace changes" : "Hide whitespace changes"}
560
+ title={diffIgnoreWhitespace ? "Show whitespace changes" : "Hide whitespace changes"}
561
+ variant="outline"
562
+ size="xs"
563
+ pressed={diffIgnoreWhitespace}
564
+ onPressedChange={(pressed) => {
565
+ setDiffIgnoreWhitespace(Boolean(pressed));
566
+ }}
567
+ >
568
+ <PilcrowIcon className="size-3" />
569
+ </Toggle>
570
</div>
571
</>
572
);
apps/web/src/components/settings/SettingsPanels.tsx
+30
@@ -386,6 +386,9 @@ export function useSettingsRestore(onRestored?: () => void) {
386
...(settings.diffWordWrap !== DEFAULT_UNIFIED_SETTINGS.diffWordWrap
387
? ["Diff line wrapping"]
388
: []),
389
+ ...(settings.diffIgnoreWhitespace !== DEFAULT_UNIFIED_SETTINGS.diffIgnoreWhitespace
390
+ ? ["Diff whitespace changes"]
391
+ : []),
392
...(settings.autoOpenPlanSidebar !== DEFAULT_UNIFIED_SETTINGS.autoOpenPlanSidebar
393
? ["Auto-open task panel"]
394
: []),
@@ -415,6 +418,7 @@ export function useSettingsRestore(onRestored?: () => void) {
418
settings.confirmThreadDelete,
419
settings.addProjectBaseDirectory,
420
settings.defaultThreadEnvMode,
421
+ settings.diffIgnoreWhitespace,
422
settings.diffWordWrap,
423
settings.enableAssistantStreaming,
424
settings.timestampFormat,
@@ -889,6 +893,32 @@ export function GeneralSettingsPanel() {
893
}
894
/>
895
896
+ <SettingsRow
897
+ title="Hide whitespace changes"
898
+ description="Set whether the diff panel ignores whitespace-only edits by default."
899
+ resetAction={
900
+ settings.diffIgnoreWhitespace !== DEFAULT_UNIFIED_SETTINGS.diffIgnoreWhitespace ? (
901
+ <SettingResetButton
902
+ label="diff whitespace changes"
903
+ onClick={() =>
904
+ updateSettings({
905
+ diffIgnoreWhitespace: DEFAULT_UNIFIED_SETTINGS.diffIgnoreWhitespace,
906
+ })
907
+ }
908
+ />
909
+ ) : null
910
+ }
911
+ control={
912
+ <Switch
913
+ checked={settings.diffIgnoreWhitespace}
914
+ onCheckedChange={(checked) =>
915
+ updateSettings({ diffIgnoreWhitespace: Boolean(checked) })
916
+ }
917
+ aria-label="Hide whitespace changes by default"
918
+ />
919
+ }
920
+ />
921
+
922
<SettingsRow
923
title="Assistant output"
924
description="Show token-by-token output while a response is in progress."
apps/web/src/lib/providerReactQuery.test.ts
+57
-1
@@ -30,6 +30,7 @@ describe("providerQueryKeys.checkpointDiff", () => {
30
threadId,
31
fromTurnCount: 1,
32
toTurnCount: 2,
33
+ ignoreWhitespace: false,
34
} as const;
35
36
expect(
@@ -44,10 +45,58 @@ describe("providerQueryKeys.checkpointDiff", () => {
45
}),
46
);
47
});
48
+
49
+ it("includes ignoreWhitespace so normal and whitespace-hidden diffs do not collide", () => {
50
+ const baseInput = {
51
+ environmentId,
52
+ threadId,
53
+ fromTurnCount: 1,
54
+ toTurnCount: 2,
55
+ cacheScope: "turn:abc",
56
+ } as const;
57
+
58
+ expect(
59
+ providerQueryKeys.checkpointDiff({
60
+ ...baseInput,
61
+ ignoreWhitespace: false,
62
+ }),
63
+ ).not.toEqual(
64
+ providerQueryKeys.checkpointDiff({
65
+ ...baseInput,
66
+ ignoreWhitespace: true,
67
+ }),
68
+ );
69
+ });
70
});
71
72
describe("checkpointDiffQueryOptions", () => {
50
- it("forwards checkpoint range to the provider API", async () => {
73
+ it("forwards checkpoint range to the provider API by default", async () => {
74
+ const getTurnDiff = vi.fn().mockResolvedValue({ diff: "patch" });
75
+ const getFullThreadDiff = vi.fn().mockResolvedValue({ diff: "patch" });
76
+ mockNativeApi({ getTurnDiff, getFullThreadDiff });
77
+
78
+ const options = checkpointDiffQueryOptions({
79
+ environmentId,
80
+ threadId,
81
+ fromTurnCount: 3,
82
+ toTurnCount: 4,
83
+ ignoreWhitespace: false,
84
+ cacheScope: "turn:abc",
85
+ });
86
+
87
+ const queryClient = new QueryClient();
88
+ await queryClient.fetchQuery(options);
89
+
90
+ expect(getTurnDiff).toHaveBeenCalledWith({
91
+ threadId,
92
+ fromTurnCount: 3,
93
+ toTurnCount: 4,
94
+ ignoreWhitespace: false,
95
+ });
96
+ expect(getFullThreadDiff).not.toHaveBeenCalled();
97
+ });
98
+
99
+ it("forwards whitespace-hidden checkpoint range to the provider API", async () => {
100
const getTurnDiff = vi.fn().mockResolvedValue({ diff: "patch" });
101
const getFullThreadDiff = vi.fn().mockResolvedValue({ diff: "patch" });
102
mockNativeApi({ getTurnDiff, getFullThreadDiff });
@@ -57,6 +106,7 @@ describe("checkpointDiffQueryOptions", () => {
106
threadId,
107
fromTurnCount: 3,
108
toTurnCount: 4,
109
+ ignoreWhitespace: true,
110
cacheScope: "turn:abc",
111
});
112
@@ -67,6 +117,7 @@ describe("checkpointDiffQueryOptions", () => {
117
threadId,
118
fromTurnCount: 3,
119
toTurnCount: 4,
120
+ ignoreWhitespace: true,
121
});
122
expect(getFullThreadDiff).not.toHaveBeenCalled();
123
});
@@ -81,6 +132,7 @@ describe("checkpointDiffQueryOptions", () => {
132
threadId,
133
fromTurnCount: 0,
134
toTurnCount: 2,
135
+ ignoreWhitespace: true,
136
cacheScope: "thread:all",
137
});
138
@@ -90,6 +142,7 @@ describe("checkpointDiffQueryOptions", () => {
142
expect(getFullThreadDiff).toHaveBeenCalledWith({
143
threadId,
144
toTurnCount: 2,
145
+ ignoreWhitespace: true,
146
});
147
expect(getTurnDiff).not.toHaveBeenCalled();
148
});
@@ -104,6 +157,7 @@ describe("checkpointDiffQueryOptions", () => {
157
threadId,
158
fromTurnCount: 4,
159
toTurnCount: 3,
160
+ ignoreWhitespace: false,
161
cacheScope: "turn:invalid",
162
});
163
@@ -122,6 +176,7 @@ describe("checkpointDiffQueryOptions", () => {
176
threadId,
177
fromTurnCount: 1,
178
toTurnCount: 2,
179
+ ignoreWhitespace: false,
180
cacheScope: "turn:abc",
181
});
182
const retry = options.retry;
@@ -147,6 +202,7 @@ describe("checkpointDiffQueryOptions", () => {
202
threadId,
203
fromTurnCount: 1,
204
toTurnCount: 2,
205
+ ignoreWhitespace: false,
206
cacheScope: "turn:abc",
207
});
208
const retryDelay = options.retryDelay;
apps/web/src/lib/providerReactQuery.ts
+4
@@ -13,6 +13,7 @@ interface CheckpointDiffQueryInput {
13
threadId: ThreadId | null;
14
fromTurnCount: number | null;
15
toTurnCount: number | null;
16
+ ignoreWhitespace: boolean;
17
cacheScope?: string | null;
18
enabled?: boolean;
19
}
@@ -27,6 +28,7 @@ export const providerQueryKeys = {
28
input.threadId,
29
input.fromTurnCount,
30
input.toTurnCount,
31
+ input.ignoreWhitespace,
32
input.cacheScope ?? null,
33
] as const,
34
};
@@ -36,6 +38,7 @@ function decodeCheckpointDiffRequest(input: CheckpointDiffQueryInput) {
38
return Schema.decodeUnknownOption(OrchestrationGetFullThreadDiffInput)({
39
threadId: input.threadId,
40
toTurnCount: input.toTurnCount,
41
+ ignoreWhitespace: input.ignoreWhitespace,
42
}).pipe(Option.map((fields) => ({ kind: "fullThreadDiff" as const, input: fields })));
43
}
44
@@ -43,6 +46,7 @@ function decodeCheckpointDiffRequest(input: CheckpointDiffQueryInput) {
46
threadId: input.threadId,
47
fromTurnCount: input.fromTurnCount,
48
toTurnCount: input.toTurnCount,
49
+ ignoreWhitespace: input.ignoreWhitespace,
50
}).pipe(Option.map((fields) => ({ kind: "turnDiff" as const, input: fields })));
51
}
52
apps/web/src/localApi.test.ts
+2
@@ -537,6 +537,7 @@ describe("wsApi", () => {
537
autoOpenPlanSidebar: false,
538
confirmThreadArchive: true,
539
confirmThreadDelete: false,
540
+ diffIgnoreWhitespace: true,
541
diffWordWrap: true,
542
favorites: [],
543
providerModelPreferences: {},
@@ -597,6 +598,7 @@ describe("wsApi", () => {
598
autoOpenPlanSidebar: false,
599
confirmThreadArchive: true,
600
confirmThreadDelete: false,
601
+ diffIgnoreWhitespace: true,
602
diffWordWrap: true,
603
favorites: [],
604
providerModelPreferences: {},
packages/contracts/src/orchestration.test.ts
+25
@@ -8,6 +8,7 @@ import {
8
ModelSelection,
9
OrchestrationCommand,
10
OrchestrationEvent,
11
+ OrchestrationGetFullThreadDiffInput,
12
OrchestrationGetTurnDiffInput,
13
OrchestrationLatestTurn,
14
ProjectCreatedPayload,
@@ -24,6 +25,7 @@ import {
25
import { ProviderInstanceId } from "./providerInstance.ts";
26
27
const decodeTurnDiffInput = Schema.decodeUnknownEffect(OrchestrationGetTurnDiffInput);
28
+const decodeFullThreadDiffInput = Schema.decodeUnknownEffect(OrchestrationGetFullThreadDiffInput);
29
const decodeThreadTurnDiff = Schema.decodeUnknownEffect(ThreadTurnDiff);
30
const decodeProjectCreateCommand = Schema.decodeUnknownEffect(ProjectCreateCommand);
31
const decodeProjectCreatedPayload = Schema.decodeUnknownEffect(ProjectCreatedPayload);
@@ -59,6 +61,29 @@ it.effect("parses turn diff input when fromTurnCount <= toTurnCount", () =>
61
}),
62
);
63
64
+it.effect("parses turn diff input with whitespace ignoring enabled", () =>
65
+ Effect.gen(function* () {
66
+ const parsed = yield* decodeTurnDiffInput({
67
+ threadId: "thread-1",
68
+ fromTurnCount: 1,
69
+ toTurnCount: 2,
70
+ ignoreWhitespace: true,
71
+ });
72
+ assert.strictEqual(parsed.ignoreWhitespace, true);
73
+ }),
74
+);
75
+
76
+it.effect("parses full thread diff input with whitespace ignoring enabled", () =>
77
+ Effect.gen(function* () {
78
+ const parsed = yield* decodeFullThreadDiffInput({
79
+ threadId: "thread-1",
80
+ toTurnCount: 2,
81
+ ignoreWhitespace: true,
82
+ });
83
+ assert.strictEqual(parsed.ignoreWhitespace, true);
84
+ }),
85
+);
86
+
87
it.effect("rejects turn diff input when fromTurnCount > toTurnCount", () =>
88
Effect.gen(function* () {
89
const result = yield* Effect.exit(
packages/contracts/src/orchestration.ts
+5
-1
@@ -1171,7 +1171,10 @@ export const DispatchResult = Schema.Struct({
1171
export type DispatchResult = typeof DispatchResult.Type;
1172
1173
export const OrchestrationGetTurnDiffInput = TurnCountRange.mapFields(
1174
- Struct.assign({ threadId: ThreadId }),
1174
+ Struct.assign({
1175
+ threadId: ThreadId,
1176
+ ignoreWhitespace: Schema.optionalKey(Schema.Boolean),
1177
+ }),
1178
{ unsafePreserveChecks: true },
1179
);
1180
export type OrchestrationGetTurnDiffInput = typeof OrchestrationGetTurnDiffInput.Type;
@@ -1182,6 +1185,7 @@ export type OrchestrationGetTurnDiffResult = typeof OrchestrationGetTurnDiffResu
1185
export const OrchestrationGetFullThreadDiffInput = Schema.Struct({
1186
threadId: ThreadId,
1187
toTurnCount: NonNegativeInt,
1188
+ ignoreWhitespace: Schema.optionalKey(Schema.Boolean),
1189
});
1190
export type OrchestrationGetFullThreadDiffInput = typeof OrchestrationGetFullThreadDiffInput.Type;
1191
packages/contracts/src/settings.ts
+2
@@ -32,6 +32,7 @@ export const ClientSettingsSchema = Schema.Struct({
32
autoOpenPlanSidebar: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
33
confirmThreadArchive: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
34
confirmThreadDelete: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
35
+ diffIgnoreWhitespace: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
36
diffWordWrap: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
37
// Model favorites. Historically keyed by provider kind, now
38
// widened to `ProviderInstanceId` so users can favorite a specific model
@@ -451,6 +452,7 @@ export const ClientSettingsPatch = Schema.Struct({
452
autoOpenPlanSidebar: Schema.optionalKey(Schema.Boolean),
453
confirmThreadArchive: Schema.optionalKey(Schema.Boolean),
454
confirmThreadDelete: Schema.optionalKey(Schema.Boolean),
455
+ diffIgnoreWhitespace: Schema.optionalKey(Schema.Boolean),
456
diffWordWrap: Schema.optionalKey(Schema.Boolean),
457
favorites: Schema.optionalKey(
458
Schema.Array(