@golba98/codexa 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/README.md +391 -94
  2. package/package.json +12 -7
  3. package/src/app.tsx +149 -117
  4. package/src/commands/handler.ts +4 -4
  5. package/src/config/buildInfo.ts +2 -2
  6. package/src/config/persistence.ts +10 -0
  7. package/src/config/settings.ts +7 -15
  8. package/src/config/updateCheckCache.ts +19 -1
  9. package/src/core/channel.ts +23 -0
  10. package/src/core/executables/codexExecutable.ts +1 -0
  11. package/src/core/executables/executableResolver.ts +61 -43
  12. package/src/core/launchContext.ts +33 -33
  13. package/src/core/process/processValidation.ts +9 -5
  14. package/src/core/providerLauncher/launcher.ts +59 -42
  15. package/src/core/updateCheck.ts +111 -95
  16. package/src/session/types.ts +2 -1
  17. package/src/ui/ActionRequiredBlock.tsx +5 -5
  18. package/src/ui/ActivityBars.tsx +3 -3
  19. package/src/ui/ActivityIndicator.tsx +6 -6
  20. package/src/ui/AgentBlock.tsx +6 -6
  21. package/src/ui/AnimatedStatusText.tsx +1 -1
  22. package/src/ui/AppShell.tsx +9 -24
  23. package/src/ui/AttachmentImportPanel.tsx +8 -8
  24. package/src/ui/AuthPanel.tsx +20 -20
  25. package/src/ui/BottomComposer.tsx +117 -78
  26. package/src/ui/DashCard.tsx +3 -3
  27. package/src/ui/Markdown.tsx +17 -17
  28. package/src/ui/ModelPickerScreen.tsx +10 -10
  29. package/src/ui/ModelReasoningPicker.tsx +14 -14
  30. package/src/ui/Panel.tsx +3 -3
  31. package/src/ui/PlanActionPicker.tsx +6 -6
  32. package/src/ui/PlanReviewPanel.tsx +8 -8
  33. package/src/ui/ProviderPicker.tsx +18 -18
  34. package/src/ui/RunFooter.tsx +3 -3
  35. package/src/ui/SelectionPanel.tsx +4 -4
  36. package/src/ui/SettingsPanel.tsx +8 -8
  37. package/src/ui/Spinner.tsx +1 -1
  38. package/src/ui/TextEntryPanel.tsx +10 -10
  39. package/src/ui/ThinkingBlock.tsx +8 -8
  40. package/src/ui/Timeline.tsx +21 -17
  41. package/src/ui/TopHeader.tsx +421 -293
  42. package/src/ui/TurnGroup.tsx +31 -31
  43. package/src/ui/UpdateAvailableCard.tsx +41 -0
  44. package/src/ui/UpdatePromptPanel.tsx +203 -0
  45. package/src/ui/focus.ts +3 -0
  46. package/src/ui/layout.ts +1 -1
  47. package/src/ui/logoVariants.ts +107 -0
  48. package/src/ui/modeDisplay.ts +12 -12
  49. package/src/ui/runtimeDisplay.ts +100 -0
  50. package/src/ui/theme.tsx +274 -395
  51. package/src/ui/timelineMeasure.ts +29 -19
  52. package/scripts/audit-codexa-capabilities.mjs +0 -466
  53. package/scripts/gen-build-info.mjs +0 -33
  54. package/scripts/smoke-terminal-bench.mjs +0 -35
  55. package/src/appRenderStability.test.ts +0 -131
  56. package/src/commands/handler.test.ts +0 -655
  57. package/src/config/launchArgs.test.ts +0 -189
  58. package/src/config/layeredConfig.test.ts +0 -143
  59. package/src/config/persistence.test.ts +0 -114
  60. package/src/config/runtimeConfig.test.ts +0 -218
  61. package/src/config/settings.test.ts +0 -155
  62. package/src/config/trustStore.test.ts +0 -29
  63. package/src/core/attachments.test.ts +0 -155
  64. package/src/core/auth/codexAuth.test.ts +0 -68
  65. package/src/core/cleanupFastFail.test.ts +0 -76
  66. package/src/core/codexExecArgs.test.ts +0 -195
  67. package/src/core/codexLaunch.test.ts +0 -205
  68. package/src/core/codexPrompt.test.ts +0 -252
  69. package/src/core/executables/codexExecutable.test.ts +0 -212
  70. package/src/core/executables/executableResolver.test.ts +0 -129
  71. package/src/core/executables/geminiExecutable.test.ts +0 -116
  72. package/src/core/executables/pathSanityScan.test.ts +0 -47
  73. package/src/core/githubDiagnostics.test.ts +0 -92
  74. package/src/core/hollowResponseFormat.test.ts +0 -58
  75. package/src/core/launchContext.test.ts +0 -157
  76. package/src/core/models/codexCapabilities.test.ts +0 -45
  77. package/src/core/models/codexModelCapabilities.test.ts +0 -246
  78. package/src/core/models/modelSpecs.test.ts +0 -283
  79. package/src/core/perf/renderDebug.test.ts +0 -230
  80. package/src/core/planStorage.test.ts +0 -143
  81. package/src/core/process/CommandRunner.test.ts +0 -105
  82. package/src/core/projectInstructions.test.ts +0 -50
  83. package/src/core/providerLauncher/launcher.test.ts +0 -238
  84. package/src/core/providerLauncher/registry.test.ts +0 -324
  85. package/src/core/providerLauncher/workspaceConfig.test.ts +0 -638
  86. package/src/core/providerRuntime/anthropic.test.ts +0 -1120
  87. package/src/core/providerRuntime/capabilityProfile.test.ts +0 -311
  88. package/src/core/providerRuntime/contextMetadata.test.ts +0 -468
  89. package/src/core/providerRuntime/gemini.test.ts +0 -437
  90. package/src/core/providerRuntime/lmstudio.test.ts +0 -168
  91. package/src/core/providerRuntime/local.test.ts +0 -787
  92. package/src/core/providerRuntime/registry.test.ts +0 -233
  93. package/src/core/providers/codexJsonStream.test.ts +0 -148
  94. package/src/core/providers/codexSubprocess.test.ts +0 -68
  95. package/src/core/providers/codexTranscript.test.ts +0 -284
  96. package/src/core/terminal/startupClear.test.ts +0 -55
  97. package/src/core/terminal/terminalCapabilities.test.ts +0 -93
  98. package/src/core/terminal/terminalControl.test.ts +0 -75
  99. package/src/core/terminal/terminalSanitize.test.ts +0 -22
  100. package/src/core/terminal/terminalSelection.test.ts +0 -42
  101. package/src/core/terminal/terminalTitle.test.ts +0 -328
  102. package/src/core/updateCheck.test.ts +0 -194
  103. package/src/core/workspaceActivity.test.ts +0 -163
  104. package/src/core/workspaceGuard.test.ts +0 -151
  105. package/src/core/workspaceRoot.test.ts +0 -23
  106. package/src/exec.test.ts +0 -13
  107. package/src/headless/execArgs.test.ts +0 -147
  108. package/src/headless/execRunner.test.ts +0 -436
  109. package/src/index.test.tsx +0 -620
  110. package/src/session/appSession.test.ts +0 -897
  111. package/src/session/chatLifecycle.test.ts +0 -64
  112. package/src/session/liveRenderScheduler.test.ts +0 -201
  113. package/src/session/planFlow.test.ts +0 -103
  114. package/src/session/planTranscript.test.ts +0 -65
  115. package/src/session/promptRunSchedule.test.ts +0 -36
  116. package/src/ui/ActivityIndicator.test.tsx +0 -58
  117. package/src/ui/AgentBlock.test.ts +0 -6
  118. package/src/ui/AnimatedStatusText.test.ts +0 -16
  119. package/src/ui/AppShell.test.tsx +0 -1776
  120. package/src/ui/AttachmentImportPanel.test.tsx +0 -204
  121. package/src/ui/BottomComposer.test.ts +0 -674
  122. package/src/ui/CodexLogo.tsx +0 -55
  123. package/src/ui/Markdown.test.ts +0 -157
  124. package/src/ui/ModelPickerProviderScope.test.tsx +0 -411
  125. package/src/ui/ModelPickerScreen.test.tsx +0 -99
  126. package/src/ui/ModelPickerState.test.tsx +0 -151
  127. package/src/ui/ModelReasoningPicker.test.tsx +0 -447
  128. package/src/ui/PlanReviewPanel.test.tsx +0 -267
  129. package/src/ui/PromptCardBorder.test.tsx +0 -161
  130. package/src/ui/ProviderPicker.test.tsx +0 -289
  131. package/src/ui/ProviderShortcut.test.tsx +0 -143
  132. package/src/ui/SettingsPanel.test.tsx +0 -233
  133. package/src/ui/Timeline.test.ts +0 -2067
  134. package/src/ui/TimelineNavigation.test.tsx +0 -201
  135. package/src/ui/TopHeader.test.tsx +0 -254
  136. package/src/ui/TurnGroup.test.tsx +0 -365
  137. package/src/ui/busyStatusAnimation.test.ts +0 -30
  138. package/src/ui/commandNormalize.test.ts +0 -142
  139. package/src/ui/diffRenderer.test.ts +0 -102
  140. package/src/ui/focusFlow.test.tsx +0 -1098
  141. package/src/ui/inputBuffer.test.ts +0 -151
  142. package/src/ui/layout.test.ts +0 -146
  143. package/src/ui/modeDisplay.test.ts +0 -42
  144. package/src/ui/runActivityView.test.ts +0 -89
  145. package/src/ui/runLifecycleView.test.tsx +0 -237
  146. package/src/ui/statusRenderIsolation.test.tsx +0 -654
  147. package/src/ui/terminalAnswerFormat.test.ts +0 -19
  148. package/src/ui/textLayout.test.ts +0 -18
  149. package/src/ui/themeFlow.test.ts +0 -53
  150. package/src/ui/timelineMeasureCache.test.ts +0 -986
@@ -1,64 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import test from "node:test";
3
- import { appendStaticEvents } from "./chatLifecycle.js";
4
- import type { TimelineEvent } from "./types.js";
5
-
6
- test("appendStaticEvents deduplicates consecutive identical system events", () => {
7
- const events: TimelineEvent[] = [
8
- { id: 1, type: "system", createdAt: 100, title: "T1", content: "C1" },
9
- ];
10
- const additions: TimelineEvent[] = [
11
- { id: 2, type: "system", createdAt: 200, title: "T1", content: "C1" }, // Duplicate
12
- { id: 3, type: "system", createdAt: 300, title: "T2", content: "C2" }, // Different
13
- ];
14
-
15
- const result = appendStaticEvents(events, additions);
16
- assert.equal(result.length, 2);
17
- assert.equal(result[0]?.id, 1);
18
- assert.equal(result[1]?.id, 3);
19
- });
20
-
21
- test("appendStaticEvents deduplicates consecutive identical error events", () => {
22
- const events: TimelineEvent[] = [
23
- { id: 1, type: "error", createdAt: 100, title: "E1", content: "M1" },
24
- ];
25
- const additions: TimelineEvent[] = [
26
- { id: 2, type: "error", createdAt: 200, title: "E1", content: "M1" }, // Duplicate
27
- { id: 3, type: "error", createdAt: 300, title: "E2", content: "M2" }, // Different
28
- ];
29
-
30
- const result = appendStaticEvents(events, additions);
31
- assert.equal(result.length, 2);
32
- assert.equal(result[0]?.id, 1);
33
- assert.equal(result[1]?.id, 3);
34
- });
35
-
36
- test("appendStaticEvents does not deduplicate different event types with same content", () => {
37
- const events: TimelineEvent[] = [
38
- { id: 1, type: "system", createdAt: 100, title: "Same", content: "Same" },
39
- ];
40
- const additions: TimelineEvent[] = [
41
- { id: 2, type: "error", createdAt: 200, title: "Same", content: "Same" },
42
- ];
43
-
44
- const result = appendStaticEvents(events, additions);
45
- assert.equal(result.length, 2);
46
- assert.equal(result[0]?.id, 1);
47
- assert.equal(result[1]?.id, 2);
48
- });
49
-
50
- test("appendStaticEvents does not deduplicate non-consecutive duplicates", () => {
51
- const events: TimelineEvent[] = [
52
- { id: 1, type: "system", createdAt: 100, title: "T1", content: "C1" },
53
- ];
54
- const additions: TimelineEvent[] = [
55
- { id: 2, type: "system", createdAt: 200, title: "T2", content: "C2" },
56
- { id: 3, type: "system", createdAt: 300, title: "T1", content: "C1" }, // Identical to first, but not consecutive
57
- ];
58
-
59
- const result = appendStaticEvents(events, additions);
60
- assert.equal(result.length, 3);
61
- assert.equal(result[0]?.id, 1);
62
- assert.equal(result[1]?.id, 2);
63
- assert.equal(result[2]?.id, 3);
64
- });
@@ -1,201 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import test from "node:test";
3
- import { createLiveRenderScheduler, type LiveRenderUpdate } from "./liveRenderScheduler.js";
4
-
5
- type FakeTimer = {
6
- callback: () => void;
7
- delayMs: number;
8
- cleared: boolean;
9
- };
10
-
11
- function createFakeTimers() {
12
- const timers: FakeTimer[] = [];
13
- return {
14
- timers,
15
- setTimer(callback: () => void, delayMs: number) {
16
- const timer: FakeTimer = { callback, delayMs, cleared: false };
17
- timers.push(timer);
18
- return timer as unknown as ReturnType<typeof setTimeout>;
19
- },
20
- clearTimer(timer: ReturnType<typeof setTimeout>) {
21
- (timer as unknown as FakeTimer).cleared = true;
22
- },
23
- };
24
- }
25
-
26
- function progress(id: string, text: string): LiveRenderUpdate {
27
- return { type: "progress", update: { id, source: "reasoning", text } };
28
- }
29
-
30
- function tool(id: string, status: "running" | "completed"): LiveRenderUpdate {
31
- return {
32
- type: "tool",
33
- activity: {
34
- id,
35
- command: "Get-Content README.md",
36
- status,
37
- startedAt: 1,
38
- completedAt: status === "completed" ? 2 : undefined,
39
- },
40
- };
41
- }
42
-
43
- test("coalesces adjacent assistant chunks at the cadence flush", () => {
44
- const flushed: LiveRenderUpdate[][] = [];
45
- const fakeTimers = createFakeTimers();
46
- const scheduler = createLiveRenderScheduler({
47
- assistantFlushMs: 50,
48
- progressOnlyFlushMs: 50,
49
- flush: (updates) => flushed.push(updates),
50
- setTimer: fakeTimers.setTimer,
51
- clearTimer: fakeTimers.clearTimer,
52
- });
53
-
54
- scheduler.enqueue({ type: "assistant", chunk: "Hello" });
55
- scheduler.enqueue({ type: "assistant", chunk: ", world" });
56
-
57
- assert.equal(flushed.length, 0);
58
- assert.equal(fakeTimers.timers.length, 1);
59
- assert.equal(fakeTimers.timers[0]?.delayMs, 50);
60
- fakeTimers.timers[0]!.callback();
61
-
62
- assert.equal(flushed.length, 1);
63
- assert.deepEqual(flushed[0], [{ type: "assistant", chunk: "Hello, world" }]);
64
- });
65
-
66
- test("first progress-only update waits for the progress cadence", () => {
67
- const flushed: LiveRenderUpdate[][] = [];
68
- const fakeTimers = createFakeTimers();
69
- const scheduler = createLiveRenderScheduler({
70
- assistantFlushMs: 50,
71
- progressOnlyFlushMs: 50,
72
- flush: (updates) => flushed.push(updates),
73
- setTimer: fakeTimers.setTimer,
74
- clearTimer: fakeTimers.clearTimer,
75
- });
76
-
77
- scheduler.enqueue(tool("t1", "running"));
78
-
79
- assert.equal(flushed.length, 0);
80
- assert.equal(fakeTimers.timers.length, 1);
81
- assert.equal(fakeTimers.timers[0]?.delayMs, 50);
82
-
83
- fakeTimers.timers[0]!.callback();
84
- assert.deepEqual(flushed[0]?.map((update) => update.type), ["tool"]);
85
- });
86
-
87
- test("preserves event order while keeping only the latest same-id progress update", () => {
88
- const flushed: LiveRenderUpdate[][] = [];
89
- const scheduler = createLiveRenderScheduler({
90
- assistantFlushMs: 50,
91
- progressOnlyFlushMs: 50,
92
- flush: (updates) => flushed.push(updates),
93
- });
94
-
95
- scheduler.enqueue(progress("p1", "Thinking"));
96
- scheduler.enqueue(tool("t1", "running"));
97
- scheduler.enqueue({ type: "assistant", chunk: "First" });
98
- scheduler.enqueue({ type: "assistant", chunk: " segment" });
99
- scheduler.enqueue(progress("p1", "Thinking harder"));
100
- scheduler.flushNow();
101
-
102
- assert.deepEqual(flushed[0]?.map((update) => update.type), ["progress", "tool", "assistant"]);
103
- assert.equal((flushed[0]?.[2] as Extract<LiveRenderUpdate, { type: "assistant" }>).chunk, "First segment");
104
- assert.equal((flushed[0]?.[0] as Extract<LiveRenderUpdate, { type: "progress" }>).update.text, "Thinking harder");
105
- });
106
-
107
- test("coalesces repeated keyed progress and tool updates across a noisy flush window", () => {
108
- const flushed: LiveRenderUpdate[][] = [];
109
- const scheduler = createLiveRenderScheduler({
110
- assistantFlushMs: 50,
111
- progressOnlyFlushMs: 175,
112
- flush: (updates) => flushed.push(updates),
113
- });
114
-
115
- scheduler.enqueue(progress("p1", "Reading file 1"));
116
- scheduler.enqueue(tool("t1", "running"));
117
- scheduler.enqueue(progress("p1", "Reading file 2"));
118
- scheduler.enqueue(tool("t1", "completed"));
119
- scheduler.enqueue(progress("p2", "Listing files"));
120
- scheduler.flushNow();
121
-
122
- assert.deepEqual(flushed[0]?.map((update) => update.type), ["progress", "tool", "progress"]);
123
- assert.equal((flushed[0]?.[0] as Extract<LiveRenderUpdate, { type: "progress" }>).update.text, "Reading file 2");
124
- assert.equal((flushed[0]?.[1] as Extract<LiveRenderUpdate, { type: "tool" }>).activity.status, "completed");
125
- });
126
-
127
- test("records scheduler flush diagnostics", () => {
128
- const flushed: LiveRenderUpdate[][] = [];
129
- const fakeTimers = createFakeTimers();
130
- const scheduler = createLiveRenderScheduler({
131
- assistantFlushMs: 50,
132
- progressOnlyFlushMs: 175,
133
- flush: (updates) => flushed.push(updates),
134
- setTimer: fakeTimers.setTimer,
135
- clearTimer: fakeTimers.clearTimer,
136
- });
137
-
138
- scheduler.enqueue(progress("p1", "Listing files"));
139
- assert.equal(scheduler.getStats().providerEvents, 1);
140
- assert.equal(fakeTimers.timers[0]?.delayMs, 175);
141
- fakeTimers.timers[0]!.callback();
142
-
143
- scheduler.enqueue({ type: "assistant", chunk: "hello" });
144
- assert.equal(fakeTimers.timers[1]?.delayMs, 50);
145
- fakeTimers.timers[1]!.callback();
146
-
147
- const stats = scheduler.getStats();
148
- assert.equal(stats.providerEvents, 2);
149
- assert.equal(stats.flushes, 2);
150
- assert.ok(stats.maxFlushIntervalMs >= 0);
151
- assert.ok(stats.averageFlushIntervalMs >= 0);
152
- });
153
-
154
- test("prevents reentrant flushes when a producer enqueues during a flush", () => {
155
- const flushed: LiveRenderUpdate[][] = [];
156
- let inFlush = false;
157
- let scheduler: ReturnType<typeof createLiveRenderScheduler>;
158
-
159
- scheduler = createLiveRenderScheduler({
160
- assistantFlushMs: 50,
161
- progressOnlyFlushMs: 50,
162
- flush: (updates) => {
163
- assert.equal(inFlush, false, "flush should not reenter itself");
164
- inFlush = true;
165
- flushed.push(updates);
166
- if (flushed.length === 1) {
167
- scheduler.enqueue({ type: "assistant", chunk: "queued during flush" });
168
- }
169
- inFlush = false;
170
- },
171
- });
172
-
173
- scheduler.enqueue({ type: "assistant", chunk: "first" });
174
-
175
- assert.equal(scheduler.flushNow(), true);
176
- assert.equal(flushed.length, 2);
177
- assert.equal((flushed[0]?.[0] as Extract<LiveRenderUpdate, { type: "assistant" }>).chunk, "first");
178
- assert.equal((flushed[1]?.[0] as Extract<LiveRenderUpdate, { type: "assistant" }>).chunk, "queued during flush");
179
- });
180
-
181
- test("flushNow drains queued updates before finalization", () => {
182
- const flushed: LiveRenderUpdate[][] = [];
183
- const fakeTimers = createFakeTimers();
184
- const scheduler = createLiveRenderScheduler({
185
- assistantFlushMs: 50,
186
- progressOnlyFlushMs: 50,
187
- flush: (updates) => flushed.push(updates),
188
- setTimer: fakeTimers.setTimer,
189
- clearTimer: fakeTimers.clearTimer,
190
- });
191
-
192
- scheduler.enqueue({ type: "assistant", chunk: "final chunk" });
193
-
194
- assert.equal(scheduler.flushNow(), true);
195
- assert.equal(flushed.length, 1);
196
- assert.equal(scheduler.hasPendingUpdates(), false);
197
-
198
- assert.equal(fakeTimers.timers[0]?.cleared, true);
199
- fakeTimers.timers[0]?.callback();
200
- assert.equal(flushed.length, 1);
201
- });
@@ -1,103 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import test from "node:test";
3
- import {
4
- approvePlanExecution,
5
- beginPlanFeedback,
6
- cancelPlanFeedback,
7
- createInitialPlanFlowState,
8
- finishPlanGeneration,
9
- resetPlanFlow,
10
- startPlanGeneration,
11
- submitPlanFeedback,
12
- } from "./planFlow.js";
13
-
14
- test("starts a fresh plan generation flow from idle", () => {
15
- const state = startPlanGeneration("Build a hello world script", "auto-edit");
16
-
17
- assert.deepEqual(createInitialPlanFlowState(), { kind: "idle" });
18
- assert.equal(state.kind, "generating");
19
- assert.equal(state.originalPrompt, "Build a hello world script");
20
- assert.equal(state.executionMode, "auto-edit");
21
- assert.deepEqual(state.constraints, []);
22
- assert.equal(state.planFilePath, null);
23
- assert.equal(state.currentPlan, null);
24
- assert.equal(state.pendingFeedback, null);
25
- });
26
-
27
- test("finishes plan generation into an awaiting-action state with a plan file path", () => {
28
- const state = finishPlanGeneration(
29
- startPlanGeneration("Build a hello world script", "auto-edit"),
30
- "## Files\n- hello_world.py",
31
- "C:\\Workspace\\.codexa\\last-plan.md",
32
- );
33
-
34
- assert.equal(state.kind, "awaiting_action");
35
- assert.equal(state.currentPlan, "## Files\n- hello_world.py");
36
- assert.equal(state.planFilePath, "C:\\Workspace\\.codexa\\last-plan.md");
37
- });
38
-
39
- test("revising the plan keeps constraints and records revision feedback", () => {
40
- const awaiting = finishPlanGeneration(
41
- startPlanGeneration("Build a hello world script", "auto-edit"),
42
- "Plan v1",
43
- "C:\\Workspace\\.codexa\\last-plan.md",
44
- );
45
- const collecting = beginPlanFeedback(awaiting, "revise");
46
- const generating = submitPlanFeedback(collecting, "Keep it to a single file.");
47
-
48
- assert.equal(collecting.kind, "collecting_feedback");
49
- assert.equal(collecting.mode, "revise");
50
- assert.equal(generating.kind, "generating");
51
- assert.equal(generating.currentPlan, "Plan v1");
52
- assert.equal(generating.planFilePath, "C:\\Workspace\\.codexa\\last-plan.md");
53
- assert.deepEqual(generating.constraints, []);
54
- assert.deepEqual(generating.pendingFeedback, {
55
- mode: "revise",
56
- text: "Keep it to a single file.",
57
- });
58
- });
59
-
60
- test("adding constraints accumulates them before the next plan pass", () => {
61
- const awaiting = finishPlanGeneration(
62
- startPlanGeneration("Build a hello world script", "auto-edit"),
63
- "Plan v1",
64
- "C:\\Workspace\\.codexa\\last-plan.md",
65
- );
66
- const collecting = beginPlanFeedback(awaiting, "constraints");
67
- const generating = submitPlanFeedback(collecting, "Do not touch any other files.");
68
-
69
- assert.equal(generating.kind, "generating");
70
- assert.deepEqual(generating.constraints, ["Do not touch any other files."]);
71
- assert.deepEqual(generating.pendingFeedback, {
72
- mode: "constraints",
73
- text: "Do not touch any other files.",
74
- });
75
- });
76
-
77
- test("canceling feedback returns to the action picker without losing the plan", () => {
78
- const awaiting = finishPlanGeneration(
79
- startPlanGeneration("Build a hello world script", "auto-edit"),
80
- "Plan v1",
81
- "C:\\Workspace\\.codexa\\last-plan.md",
82
- );
83
- const collecting = beginPlanFeedback(awaiting, "revise");
84
- const canceled = cancelPlanFeedback(collecting);
85
-
86
- assert.equal(canceled.kind, "awaiting_action");
87
- assert.equal(canceled.currentPlan, "Plan v1");
88
- assert.equal(canceled.planFilePath, "C:\\Workspace\\.codexa\\last-plan.md");
89
- });
90
-
91
- test("approving execution moves to executing and reset returns to idle", () => {
92
- const awaiting = finishPlanGeneration(
93
- startPlanGeneration("Build a hello world script", "auto-edit"),
94
- "Plan v1",
95
- "C:\\Workspace\\.codexa\\last-plan.md",
96
- );
97
- const executing = approvePlanExecution(awaiting);
98
-
99
- assert.equal(executing.kind, "executing");
100
- assert.equal(executing.executionMode, "auto-edit");
101
- assert.equal(executing.planFilePath, "C:\\Workspace\\.codexa\\last-plan.md");
102
- assert.deepEqual(resetPlanFlow(), { kind: "idle" });
103
- });
@@ -1,65 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import test from "node:test";
3
- import { TEST_RUNTIME } from "../test/runtimeTestUtils.js";
4
- import type { RunEvent, TimelineEvent } from "./types.js";
5
- import { hasFinalizedTranscriptPlan } from "./planTranscript.js";
6
-
7
- function makeRun(overrides: Partial<RunEvent> = {}): RunEvent {
8
- return {
9
- id: 1,
10
- type: "run",
11
- createdAt: 1,
12
- startedAt: 1,
13
- durationMs: 10,
14
- backendId: "codex-subprocess",
15
- backendLabel: "Codexa",
16
- runtime: TEST_RUNTIME,
17
- prompt: "Plan work",
18
- progressEntries: [],
19
- status: "completed",
20
- summary: "completed",
21
- truncatedOutput: false,
22
- toolActivities: [],
23
- activity: [],
24
- touchedFileCount: 0,
25
- errorMessage: null,
26
- turnId: 1,
27
- streamItems: [{ kind: "plan", streamSeq: 1, refId: "plan-1" }],
28
- responseSegments: [],
29
- lastStreamSeq: 1,
30
- activeResponseSegmentId: null,
31
- plan: {
32
- id: "plan-1",
33
- streamSeq: 1,
34
- chunks: ["1. Inspect\n2. Update"],
35
- status: "completed",
36
- startedAt: 1,
37
- },
38
- ...overrides,
39
- };
40
- }
41
-
42
- test("approval visibility requires a non-empty finalized transcript plan", () => {
43
- assert.equal(hasFinalizedTranscriptPlan([], "1. Inspect"), false);
44
- assert.equal(hasFinalizedTranscriptPlan([makeRun()], ""), false);
45
- assert.equal(hasFinalizedTranscriptPlan([makeRun({ plan: null })], "1. Inspect"), false);
46
- assert.equal(
47
- hasFinalizedTranscriptPlan([
48
- makeRun({
49
- status: "running",
50
- plan: {
51
- id: "plan-1",
52
- streamSeq: 1,
53
- chunks: ["1. Inspect"],
54
- status: "active",
55
- startedAt: 1,
56
- },
57
- }),
58
- ], "1. Inspect"),
59
- false,
60
- );
61
- assert.equal(
62
- hasFinalizedTranscriptPlan([makeRun()] satisfies TimelineEvent[], "1. Inspect\n2. Update"),
63
- true,
64
- );
65
- });
@@ -1,36 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import test from "node:test";
3
- import { schedulePromptRunStartAfterVisibleCommit } from "./promptRunSchedule.js";
4
-
5
- function waitForTimerTurn(): Promise<void> {
6
- return new Promise((resolve) => setTimeout(resolve, 0));
7
- }
8
-
9
- test("schedulePromptRunStartAfterVisibleCommit waits past the reducer microtask before starting work", async () => {
10
- const order: string[] = [];
11
-
12
- schedulePromptRunStartAfterVisibleCommit(() => {
13
- order.push("provider-started");
14
- });
15
- order.push("visible-run-dispatched");
16
-
17
- await Promise.resolve();
18
- assert.deepEqual(order, ["visible-run-dispatched"]);
19
-
20
- await waitForTimerTurn();
21
- assert.deepEqual(order, ["visible-run-dispatched", "provider-started"]);
22
- });
23
-
24
- test("schedulePromptRunStartAfterVisibleCommit can be canceled before provider start", async () => {
25
- let started = false;
26
-
27
- const cancel = schedulePromptRunStartAfterVisibleCommit(() => {
28
- started = true;
29
- });
30
- cancel();
31
-
32
- await Promise.resolve();
33
- await waitForTimerTurn();
34
-
35
- assert.equal(started, false);
36
- });
@@ -1,58 +0,0 @@
1
- import test from "node:test";
2
- import assert from "node:assert/strict";
3
- import React from "react";
4
- import { PassThrough } from "node:stream";
5
- import { render } from "ink";
6
- import { ActivityIndicator } from "./ActivityIndicator.js";
7
-
8
- class TestOutput extends PassThrough {
9
- readonly isTTY = true;
10
- columns = 120;
11
- rows = 40;
12
- }
13
-
14
- function renderIndicator(props: any): Promise<string> {
15
- const stdout = new TestOutput();
16
- let output = "";
17
- stdout.on("data", (chunk) => {
18
- output += chunk.toString();
19
- });
20
- const instance = render(<ActivityIndicator {...props} />, { stdout: stdout as unknown as NodeJS.WriteStream });
21
- instance.unmount();
22
- return Promise.resolve(output);
23
- }
24
-
25
- test("idle state renders static subtle indicator", async () => {
26
- const output = await renderIndicator({ uiState: { kind: "IDLE" }, externalCliStatus: "idle" });
27
- assert.ok(output.includes("?"));
28
- });
29
-
30
- test("error state renders error indicator", async () => {
31
- const output = await renderIndicator({ uiState: { kind: "ERROR", turnId: 1, message: "err" } });
32
- assert.ok(output.includes("�"));
33
- });
34
-
35
- test("tool/action state renders action indicator", async () => {
36
- const output = await renderIndicator({ uiState: { kind: "SHELL_RUNNING", shellId: 1 } });
37
- assert.ok(output.includes("?"));
38
- });
39
-
40
- test("waiting/thinking state renders animated indicator frame", async () => {
41
- const output = await renderIndicator({ uiState: { kind: "THINKING", turnId: 1 } });
42
- assert.ok(output.includes("?"));
43
- });
44
-
45
- test("streaming state renders streaming indicator frame", async () => {
46
- const output = await renderIndicator({ uiState: { kind: "RESPONDING", turnId: 1 } });
47
- assert.ok(output.includes("?")); // first frame
48
- });
49
-
50
- test("provider loading renders animated indicator frame", async () => {
51
- const output = await renderIndicator({ uiState: { kind: "IDLE" }, externalCliStatus: "starting" });
52
- assert.ok(output.includes("?"));
53
- });
54
-
55
- test("provider failed renders error indicator", async () => {
56
- const output = await renderIndicator({ uiState: { kind: "IDLE" }, externalCliStatus: "failed" });
57
- assert.ok(output.includes("�"));
58
- });
@@ -1,6 +0,0 @@
1
- import test from "node:test";
2
-
3
- test("AgentBlock output streams organically without layout truncation", () => {
4
- // buildStreamingPreviewRows has been intentionally removed to support
5
- // true variable-height scrolling transcript behavior per project requirements.
6
- });
@@ -1,16 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { readFileSync } from "node:fs";
3
- import { fileURLToPath } from "node:url";
4
- import { dirname, join } from "node:path";
5
- import test from "node:test";
6
-
7
- const here = dirname(fileURLToPath(import.meta.url));
8
-
9
- test("busy status text owns the local animation timer", () => {
10
- const source = readFileSync(join(here, "AnimatedStatusText.tsx"), "utf8");
11
-
12
- assert.match(source, /setInterval/);
13
- assert.match(source, /useEffect/);
14
- assert.match(source, /useState/);
15
- assert.doesNotMatch(source, /useAnimatedDots|useThrottledValue/);
16
- });