@golba98/codexa 1.0.1
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.
- package/README.md +320 -0
- package/bin/codexa.js +445 -0
- package/package.json +45 -0
- package/scripts/audit-codexa-capabilities.mjs +466 -0
- package/scripts/smoke-terminal-bench.mjs +35 -0
- package/src/app.tsx +4561 -0
- package/src/appRenderStability.test.ts +131 -0
- package/src/commands/handler.test.ts +643 -0
- package/src/commands/handler.ts +875 -0
- package/src/config/launchArgs.test.ts +158 -0
- package/src/config/launchArgs.ts +186 -0
- package/src/config/layeredConfig.test.ts +143 -0
- package/src/config/layeredConfig.ts +836 -0
- package/src/config/persistence.test.ts +110 -0
- package/src/config/persistence.ts +311 -0
- package/src/config/runtimeConfig.test.ts +218 -0
- package/src/config/runtimeConfig.ts +554 -0
- package/src/config/settings.test.ts +155 -0
- package/src/config/settings.ts +401 -0
- package/src/config/toml-serialize.ts +98 -0
- package/src/config/trustStore.test.ts +29 -0
- package/src/config/trustStore.ts +68 -0
- package/src/core/attachments.test.ts +155 -0
- package/src/core/attachments.ts +71 -0
- package/src/core/auth/codexAuth.test.ts +68 -0
- package/src/core/auth/codexAuth.ts +359 -0
- package/src/core/cleanupFastFail.test.ts +76 -0
- package/src/core/cleanupFastFail.ts +67 -0
- package/src/core/clipboard.ts +24 -0
- package/src/core/codex.ts +124 -0
- package/src/core/codexExecArgs.test.ts +195 -0
- package/src/core/codexExecArgs.ts +152 -0
- package/src/core/codexLaunch.test.ts +205 -0
- package/src/core/codexLaunch.ts +162 -0
- package/src/core/codexPrompt.test.ts +252 -0
- package/src/core/codexPrompt.ts +428 -0
- package/src/core/executables/claudeExecutable.ts +63 -0
- package/src/core/executables/codexExecutable.test.ts +212 -0
- package/src/core/executables/codexExecutable.ts +159 -0
- package/src/core/executables/executableResolver.test.ts +129 -0
- package/src/core/executables/executableResolver.ts +138 -0
- package/src/core/executables/geminiExecutable.test.ts +116 -0
- package/src/core/executables/geminiExecutable.ts +78 -0
- package/src/core/executables/pathSanityScan.test.ts +47 -0
- package/src/core/githubDiagnostics.test.ts +92 -0
- package/src/core/githubDiagnostics.ts +222 -0
- package/src/core/hollowResponseFormat.test.ts +58 -0
- package/src/core/hollowResponseFormat.ts +39 -0
- package/src/core/inputDebug.ts +51 -0
- package/src/core/launchContext.test.ts +157 -0
- package/src/core/launchContext.ts +266 -0
- package/src/core/models/codexCapabilities.test.ts +45 -0
- package/src/core/models/codexCapabilities.ts +95 -0
- package/src/core/models/codexModelCapabilities.test.ts +246 -0
- package/src/core/models/codexModelCapabilities.ts +571 -0
- package/src/core/models/modelSpecs.test.ts +283 -0
- package/src/core/models/modelSpecs.ts +300 -0
- package/src/core/perf/profiler.ts +125 -0
- package/src/core/perf/renderDebug.test.ts +230 -0
- package/src/core/perf/renderDebug.ts +373 -0
- package/src/core/planStorage.test.ts +143 -0
- package/src/core/planStorage.ts +141 -0
- package/src/core/process/CommandRunner.test.ts +105 -0
- package/src/core/process/CommandRunner.ts +269 -0
- package/src/core/process/processValidation.ts +101 -0
- package/src/core/projectInstructions.test.ts +50 -0
- package/src/core/projectInstructions.ts +54 -0
- package/src/core/providerLauncher/launcher.test.ts +238 -0
- package/src/core/providerLauncher/launcher.ts +203 -0
- package/src/core/providerLauncher/registry.test.ts +324 -0
- package/src/core/providerLauncher/registry.ts +253 -0
- package/src/core/providerLauncher/types.ts +84 -0
- package/src/core/providerLauncher/workspaceConfig.test.ts +638 -0
- package/src/core/providerLauncher/workspaceConfig.ts +407 -0
- package/src/core/providerRuntime/anthropic.test.ts +1120 -0
- package/src/core/providerRuntime/anthropic.ts +576 -0
- package/src/core/providerRuntime/capabilityProfile.test.ts +311 -0
- package/src/core/providerRuntime/capabilityProfile.ts +288 -0
- package/src/core/providerRuntime/claudeCodeDiscovery.ts +446 -0
- package/src/core/providerRuntime/contextMetadata.test.ts +468 -0
- package/src/core/providerRuntime/contextMetadata.ts +409 -0
- package/src/core/providerRuntime/gemini.test.ts +437 -0
- package/src/core/providerRuntime/gemini.ts +784 -0
- package/src/core/providerRuntime/lmstudio.test.ts +168 -0
- package/src/core/providerRuntime/lmstudio.ts +118 -0
- package/src/core/providerRuntime/local.test.ts +787 -0
- package/src/core/providerRuntime/local.ts +754 -0
- package/src/core/providerRuntime/models.ts +150 -0
- package/src/core/providerRuntime/reasoning.ts +17 -0
- package/src/core/providerRuntime/registry.test.ts +233 -0
- package/src/core/providerRuntime/registry.ts +203 -0
- package/src/core/providerRuntime/types.ts +103 -0
- package/src/core/providers/codexJsonStream.test.ts +148 -0
- package/src/core/providers/codexJsonStream.ts +305 -0
- package/src/core/providers/codexSubprocess.test.ts +68 -0
- package/src/core/providers/codexSubprocess.ts +372 -0
- package/src/core/providers/codexTranscript.test.ts +284 -0
- package/src/core/providers/codexTranscript.ts +695 -0
- package/src/core/providers/openaiNative.ts +13 -0
- package/src/core/providers/registry.ts +21 -0
- package/src/core/providers/types.ts +59 -0
- package/src/core/terminal/terminalCapabilities.test.ts +93 -0
- package/src/core/terminal/terminalCapabilities.ts +100 -0
- package/src/core/terminal/terminalControl.test.ts +75 -0
- package/src/core/terminal/terminalControl.ts +147 -0
- package/src/core/terminal/terminalSanitize.test.ts +22 -0
- package/src/core/terminal/terminalSanitize.ts +147 -0
- package/src/core/terminal/terminalSelection.test.ts +42 -0
- package/src/core/terminal/terminalSelection.ts +66 -0
- package/src/core/terminal/terminalTitle.test.ts +328 -0
- package/src/core/terminal/terminalTitle.ts +483 -0
- package/src/core/workspaceActivity.test.ts +163 -0
- package/src/core/workspaceActivity.ts +380 -0
- package/src/core/workspaceGuard.test.ts +151 -0
- package/src/core/workspaceGuard.ts +288 -0
- package/src/core/workspaceRoot.test.ts +23 -0
- package/src/core/workspaceRoot.ts +47 -0
- package/src/exec.test.ts +13 -0
- package/src/exec.ts +72 -0
- package/src/headless/execArgs.test.ts +147 -0
- package/src/headless/execArgs.ts +294 -0
- package/src/headless/execRunner.test.ts +434 -0
- package/src/headless/execRunner.ts +304 -0
- package/src/index.test.tsx +618 -0
- package/src/index.tsx +296 -0
- package/src/session/appSession.test.ts +897 -0
- package/src/session/appSession.ts +761 -0
- package/src/session/chatLifecycle.test.ts +64 -0
- package/src/session/chatLifecycle.ts +951 -0
- package/src/session/liveRenderScheduler.test.ts +201 -0
- package/src/session/liveRenderScheduler.ts +214 -0
- package/src/session/planFlow.test.ts +103 -0
- package/src/session/planFlow.ts +149 -0
- package/src/session/planTranscript.test.ts +65 -0
- package/src/session/planTranscript.ts +15 -0
- package/src/session/promptRunSchedule.test.ts +36 -0
- package/src/session/promptRunSchedule.ts +26 -0
- package/src/session/types.ts +228 -0
- package/src/test/runtimeTestUtils.ts +14 -0
- package/src/types/react-dom.d.ts +3 -0
- package/src/ui/ActionRequiredBlock.tsx +38 -0
- package/src/ui/ActivityBars.tsx +68 -0
- package/src/ui/ActivityIndicator.test.tsx +58 -0
- package/src/ui/ActivityIndicator.tsx +58 -0
- package/src/ui/AgentBlock.test.ts +6 -0
- package/src/ui/AgentBlock.tsx +130 -0
- package/src/ui/AnimatedStatusText.test.ts +16 -0
- package/src/ui/AnimatedStatusText.tsx +69 -0
- package/src/ui/AppShell.test.tsx +1739 -0
- package/src/ui/AppShell.tsx +698 -0
- package/src/ui/AttachmentImportPanel.test.tsx +204 -0
- package/src/ui/AttachmentImportPanel.tsx +98 -0
- package/src/ui/AuthPanel.tsx +113 -0
- package/src/ui/BackendPicker.tsx +28 -0
- package/src/ui/BottomComposer.test.ts +674 -0
- package/src/ui/BottomComposer.tsx +1028 -0
- package/src/ui/CodexLogo.tsx +55 -0
- package/src/ui/DashCard.tsx +82 -0
- package/src/ui/Markdown.test.ts +157 -0
- package/src/ui/Markdown.tsx +310 -0
- package/src/ui/ModePicker.tsx +27 -0
- package/src/ui/ModelPicker.tsx +31 -0
- package/src/ui/ModelPickerProviderScope.test.tsx +411 -0
- package/src/ui/ModelPickerScreen.test.tsx +99 -0
- package/src/ui/ModelPickerScreen.tsx +416 -0
- package/src/ui/ModelPickerState.test.tsx +151 -0
- package/src/ui/ModelReasoningPicker.test.tsx +447 -0
- package/src/ui/ModelReasoningPicker.tsx +458 -0
- package/src/ui/Panel.tsx +51 -0
- package/src/ui/PermissionsPanel.tsx +78 -0
- package/src/ui/PlanActionPicker.tsx +119 -0
- package/src/ui/PlanReviewPanel.test.tsx +267 -0
- package/src/ui/PlanReviewPanel.tsx +212 -0
- package/src/ui/PromptCardBorder.test.tsx +161 -0
- package/src/ui/ProviderPicker.test.tsx +289 -0
- package/src/ui/ProviderPicker.tsx +321 -0
- package/src/ui/ProviderShortcut.test.tsx +143 -0
- package/src/ui/ReasoningPicker.tsx +46 -0
- package/src/ui/RunFooter.tsx +65 -0
- package/src/ui/SelectionPanel.tsx +67 -0
- package/src/ui/SettingsPanel.test.tsx +233 -0
- package/src/ui/SettingsPanel.tsx +156 -0
- package/src/ui/Spinner.tsx +25 -0
- package/src/ui/StaticIntroItem.tsx +54 -0
- package/src/ui/StaticTranscriptItem.tsx +56 -0
- package/src/ui/TextEntryPanel.tsx +139 -0
- package/src/ui/ThemePicker.tsx +31 -0
- package/src/ui/ThinkingBlock.tsx +100 -0
- package/src/ui/Timeline.test.ts +2067 -0
- package/src/ui/Timeline.tsx +1472 -0
- package/src/ui/TimelineNavigation.test.tsx +201 -0
- package/src/ui/TopHeader.test.tsx +239 -0
- package/src/ui/TopHeader.tsx +257 -0
- package/src/ui/TurnGroup.test.tsx +365 -0
- package/src/ui/TurnGroup.tsx +657 -0
- package/src/ui/busyStatusAnimation.test.ts +30 -0
- package/src/ui/busyStatusAnimation.ts +11 -0
- package/src/ui/commandNormalize.test.ts +142 -0
- package/src/ui/commandNormalize.ts +66 -0
- package/src/ui/diffRenderer.test.ts +102 -0
- package/src/ui/diffRenderer.ts +116 -0
- package/src/ui/focus.ts +61 -0
- package/src/ui/focusFlow.test.tsx +1098 -0
- package/src/ui/inputBuffer.test.ts +151 -0
- package/src/ui/inputBuffer.ts +203 -0
- package/src/ui/layout.test.ts +145 -0
- package/src/ui/layout.ts +287 -0
- package/src/ui/modeDisplay.test.ts +42 -0
- package/src/ui/modeDisplay.ts +52 -0
- package/src/ui/outputPipeline.ts +64 -0
- package/src/ui/progressEntries.ts +156 -0
- package/src/ui/runActivityView.test.ts +89 -0
- package/src/ui/runActivityView.ts +37 -0
- package/src/ui/runLifecycleView.test.tsx +237 -0
- package/src/ui/slashCommands.ts +41 -0
- package/src/ui/statusRenderIsolation.test.tsx +654 -0
- package/src/ui/terminalAnswerFormat.test.ts +19 -0
- package/src/ui/terminalAnswerFormat.ts +128 -0
- package/src/ui/textLayout.test.ts +18 -0
- package/src/ui/textLayout.ts +338 -0
- package/src/ui/theme.tsx +395 -0
- package/src/ui/themeFlow.test.ts +53 -0
- package/src/ui/themeFlow.ts +41 -0
- package/src/ui/timelineMeasure.ts +3088 -0
- package/src/ui/timelineMeasureCache.test.ts +986 -0
- package/src/ui/useThrottledValue.ts +31 -0
|
@@ -0,0 +1,654 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { PassThrough } from "node:stream";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { render } from "ink";
|
|
9
|
+
import type { TimelineEvent, UIState } from "../session/types.js";
|
|
10
|
+
import { TEST_RUNTIME } from "../test/runtimeTestUtils.js";
|
|
11
|
+
import * as renderDebug from "../core/perf/renderDebug.js";
|
|
12
|
+
import { AppShell } from "./AppShell.js";
|
|
13
|
+
import { Timeline } from "./Timeline.js";
|
|
14
|
+
import { BottomComposer, measureBottomComposerRows } from "./BottomComposer.js";
|
|
15
|
+
import { createLayoutSnapshot } from "./layout.js";
|
|
16
|
+
import { ThemeProvider } from "./theme.js";
|
|
17
|
+
|
|
18
|
+
class TestInput extends PassThrough {
|
|
19
|
+
readonly isTTY = true;
|
|
20
|
+
|
|
21
|
+
setRawMode(): this {
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override resume(): this {
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
override pause(): this {
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
ref(): this {
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
unref(): this {
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
class TestOutput extends PassThrough {
|
|
43
|
+
readonly isTTY = true;
|
|
44
|
+
columns = 120;
|
|
45
|
+
rows = 40;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function sleep(ms = 50): Promise<void> {
|
|
49
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function readRecords(path: string): Array<Record<string, unknown>> {
|
|
53
|
+
if (!existsSync(path)) return [];
|
|
54
|
+
const text = readFileSync(path, "utf8").trim();
|
|
55
|
+
return text ? text.split("\n").map((line) => JSON.parse(line) as Record<string, unknown>) : [];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function countMatching(records: Array<Record<string, unknown>>, predicate: (record: Record<string, unknown>) => boolean): number {
|
|
59
|
+
return records.filter(predicate).length;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
type ActionStatus = "running" | "completed";
|
|
63
|
+
|
|
64
|
+
function makeToolActivity(id: string, command: string, status: ActionStatus, streamSeq: number) {
|
|
65
|
+
return {
|
|
66
|
+
id,
|
|
67
|
+
command,
|
|
68
|
+
status,
|
|
69
|
+
startedAt: streamSeq + 1,
|
|
70
|
+
completedAt: status === "completed" ? streamSeq + 3 : null,
|
|
71
|
+
summary: status === "completed" ? "Read 12 lines" : null,
|
|
72
|
+
streamSeq,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function makeActiveEvents(actionStatus: ActionStatus | null = "completed", secondActionStatus?: ActionStatus): TimelineEvent[] {
|
|
77
|
+
const toolActivities = actionStatus === null
|
|
78
|
+
? []
|
|
79
|
+
: [
|
|
80
|
+
makeToolActivity("tool-1", "Get-Content README.md", actionStatus, 2),
|
|
81
|
+
...(secondActionStatus ? [makeToolActivity("tool-2", "Get-Content package.json", secondActionStatus, 3)] : []),
|
|
82
|
+
];
|
|
83
|
+
return [
|
|
84
|
+
{
|
|
85
|
+
id: 1,
|
|
86
|
+
type: "user",
|
|
87
|
+
createdAt: 1,
|
|
88
|
+
prompt: "What is the point of 5-Date Verification",
|
|
89
|
+
turnId: 1,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 2,
|
|
93
|
+
type: "run",
|
|
94
|
+
createdAt: 2,
|
|
95
|
+
startedAt: 2,
|
|
96
|
+
durationMs: null,
|
|
97
|
+
backendId: "codex-subprocess",
|
|
98
|
+
backendLabel: "Codexa",
|
|
99
|
+
runtime: TEST_RUNTIME,
|
|
100
|
+
prompt: "What is the point of 5-Date Verification",
|
|
101
|
+
progressEntries: [{
|
|
102
|
+
id: "thinking-1",
|
|
103
|
+
source: "reasoning",
|
|
104
|
+
text: "Checking the verification rule.",
|
|
105
|
+
sequence: 1,
|
|
106
|
+
createdAt: 2,
|
|
107
|
+
updatedAt: 2,
|
|
108
|
+
pendingNewlineCount: 0,
|
|
109
|
+
blocks: [{
|
|
110
|
+
id: "thinking-1-block-1",
|
|
111
|
+
text: "Checking the verification rule.",
|
|
112
|
+
sequence: 1,
|
|
113
|
+
createdAt: 2,
|
|
114
|
+
updatedAt: 2,
|
|
115
|
+
status: "completed",
|
|
116
|
+
streamSeq: 1,
|
|
117
|
+
}],
|
|
118
|
+
}],
|
|
119
|
+
status: "running",
|
|
120
|
+
summary: "Running",
|
|
121
|
+
truncatedOutput: false,
|
|
122
|
+
toolActivities,
|
|
123
|
+
activity: [],
|
|
124
|
+
touchedFileCount: 0,
|
|
125
|
+
errorMessage: null,
|
|
126
|
+
turnId: 1,
|
|
127
|
+
streamItems: [
|
|
128
|
+
{ kind: "thinking", streamSeq: 1, refId: "thinking-1-block-1" },
|
|
129
|
+
...toolActivities.map((tool) => ({ kind: "action" as const, streamSeq: tool.streamSeq, refId: tool.id })),
|
|
130
|
+
],
|
|
131
|
+
responseSegments: [],
|
|
132
|
+
lastStreamSeq: toolActivities.at(-1)?.streamSeq ?? 1,
|
|
133
|
+
activeResponseSegmentId: null,
|
|
134
|
+
},
|
|
135
|
+
];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function Harness({
|
|
139
|
+
actionStatus = "completed",
|
|
140
|
+
secondActionStatus,
|
|
141
|
+
mouseCapture = false,
|
|
142
|
+
}: {
|
|
143
|
+
actionStatus?: ActionStatus | null;
|
|
144
|
+
secondActionStatus?: ActionStatus;
|
|
145
|
+
mouseCapture?: boolean;
|
|
146
|
+
}) {
|
|
147
|
+
const layout = createLayoutSnapshot(120, 40);
|
|
148
|
+
const uiState: UIState = { kind: "THINKING", turnId: 1 };
|
|
149
|
+
const composerRows = measureBottomComposerRows({
|
|
150
|
+
layout,
|
|
151
|
+
uiState,
|
|
152
|
+
mode: "suggest",
|
|
153
|
+
model: "gpt-5.4",
|
|
154
|
+
reasoningLevel: "balanced",
|
|
155
|
+
value: "",
|
|
156
|
+
cursor: 0,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<ThemeProvider theme="purple">
|
|
161
|
+
<AppShell
|
|
162
|
+
layout={layout}
|
|
163
|
+
screen="main"
|
|
164
|
+
authState="authenticated"
|
|
165
|
+
workspaceLabel="workspace"
|
|
166
|
+
runtimeSummary={null}
|
|
167
|
+
staticEvents={[]}
|
|
168
|
+
activeEvents={makeActiveEvents(actionStatus, secondActionStatus)}
|
|
169
|
+
uiState={uiState}
|
|
170
|
+
composerRows={composerRows}
|
|
171
|
+
panel={null}
|
|
172
|
+
mouseCapture={mouseCapture}
|
|
173
|
+
composer={(
|
|
174
|
+
<BottomComposer
|
|
175
|
+
layout={layout}
|
|
176
|
+
uiState={uiState}
|
|
177
|
+
mode="suggest"
|
|
178
|
+
model="gpt-5.4"
|
|
179
|
+
reasoningLevel="balanced"
|
|
180
|
+
tokensUsed={100}
|
|
181
|
+
value=""
|
|
182
|
+
cursor={0}
|
|
183
|
+
onChangeInput={() => {}}
|
|
184
|
+
onSubmit={() => {}}
|
|
185
|
+
onCancel={() => {}}
|
|
186
|
+
onChangeValue={() => {}}
|
|
187
|
+
onChangeCursor={() => {}}
|
|
188
|
+
onHistoryUp={() => {}}
|
|
189
|
+
onHistoryDown={() => {}}
|
|
190
|
+
onOpenBackendPicker={() => {}}
|
|
191
|
+
onOpenModelPicker={() => {}}
|
|
192
|
+
onOpenModePicker={() => {}}
|
|
193
|
+
onOpenThemePicker={() => {}}
|
|
194
|
+
onOpenAuthPanel={() => {}}
|
|
195
|
+
onTogglePlanMode={() => {}}
|
|
196
|
+
onClear={() => {}}
|
|
197
|
+
onCycleMode={() => {}}
|
|
198
|
+
onQuit={() => {}}
|
|
199
|
+
/>
|
|
200
|
+
)}
|
|
201
|
+
/>
|
|
202
|
+
</ThemeProvider>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function AppShellHarness({
|
|
207
|
+
staticEvents,
|
|
208
|
+
activeEvents,
|
|
209
|
+
uiState,
|
|
210
|
+
workspaceLabel = "13-Custom-CLI-Normal",
|
|
211
|
+
mouseCapture = false,
|
|
212
|
+
}: {
|
|
213
|
+
staticEvents: TimelineEvent[];
|
|
214
|
+
activeEvents: TimelineEvent[];
|
|
215
|
+
uiState: UIState;
|
|
216
|
+
workspaceLabel?: string;
|
|
217
|
+
mouseCapture?: boolean;
|
|
218
|
+
}) {
|
|
219
|
+
const layout = createLayoutSnapshot(120, 40);
|
|
220
|
+
const composerRows = measureBottomComposerRows({
|
|
221
|
+
layout,
|
|
222
|
+
uiState,
|
|
223
|
+
mode: "suggest",
|
|
224
|
+
model: "gpt-5.4",
|
|
225
|
+
reasoningLevel: "balanced",
|
|
226
|
+
value: "",
|
|
227
|
+
cursor: 0,
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
return (
|
|
231
|
+
<ThemeProvider theme="purple">
|
|
232
|
+
<AppShell
|
|
233
|
+
layout={layout}
|
|
234
|
+
screen="main"
|
|
235
|
+
authState="authenticated"
|
|
236
|
+
workspaceLabel={workspaceLabel}
|
|
237
|
+
runtimeSummary={null}
|
|
238
|
+
staticEvents={staticEvents}
|
|
239
|
+
activeEvents={activeEvents}
|
|
240
|
+
uiState={uiState}
|
|
241
|
+
composerRows={composerRows}
|
|
242
|
+
panel={null}
|
|
243
|
+
mouseCapture={mouseCapture}
|
|
244
|
+
composer={(
|
|
245
|
+
<BottomComposer
|
|
246
|
+
layout={layout}
|
|
247
|
+
uiState={uiState}
|
|
248
|
+
mode="suggest"
|
|
249
|
+
model="gpt-5.4"
|
|
250
|
+
reasoningLevel="balanced"
|
|
251
|
+
tokensUsed={100}
|
|
252
|
+
value=""
|
|
253
|
+
cursor={0}
|
|
254
|
+
onChangeInput={() => {}}
|
|
255
|
+
onSubmit={() => {}}
|
|
256
|
+
onCancel={() => {}}
|
|
257
|
+
onChangeValue={() => {}}
|
|
258
|
+
onChangeCursor={() => {}}
|
|
259
|
+
onHistoryUp={() => {}}
|
|
260
|
+
onHistoryDown={() => {}}
|
|
261
|
+
onOpenBackendPicker={() => {}}
|
|
262
|
+
onOpenModelPicker={() => {}}
|
|
263
|
+
onOpenModePicker={() => {}}
|
|
264
|
+
onOpenThemePicker={() => {}}
|
|
265
|
+
onOpenAuthPanel={() => {}}
|
|
266
|
+
onTogglePlanMode={() => {}}
|
|
267
|
+
onClear={() => {}}
|
|
268
|
+
onCycleMode={() => {}}
|
|
269
|
+
onQuit={() => {}}
|
|
270
|
+
/>
|
|
271
|
+
)}
|
|
272
|
+
/>
|
|
273
|
+
</ThemeProvider>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function stripAnsi(text: string): string {
|
|
278
|
+
return text.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "");
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
test("status dot ticks do not invalidate timeline rendering", async () => {
|
|
282
|
+
const logPath = join(tmpdir(), `codexa-status-isolation-${process.pid}.jsonl`);
|
|
283
|
+
rmSync(logPath, { force: true });
|
|
284
|
+
renderDebug.configureRenderDebug({
|
|
285
|
+
CODEXA_DEBUG_RENDER_TRACE: "1",
|
|
286
|
+
CODEXA_RENDER_DEBUG_FILE: logPath,
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
const stdin = new TestInput();
|
|
290
|
+
const stdout = new TestOutput();
|
|
291
|
+
const instance = render(<Harness />, {
|
|
292
|
+
stdin: stdin as unknown as NodeJS.ReadStream,
|
|
293
|
+
stdout: stdout as unknown as NodeJS.WriteStream,
|
|
294
|
+
stderr: stdout as unknown as NodeJS.WriteStream,
|
|
295
|
+
debug: true,
|
|
296
|
+
exitOnCtrlC: false,
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
try {
|
|
300
|
+
await sleep(100);
|
|
301
|
+
const beforeTick = readRecords(logPath);
|
|
302
|
+
|
|
303
|
+
await sleep(950);
|
|
304
|
+
const afterTick = readRecords(logPath);
|
|
305
|
+
const tickWindow = afterTick.slice(beforeTick.length);
|
|
306
|
+
|
|
307
|
+
assert.equal(countMatching(tickWindow, (record) => record.kind === "status" && record.event === "tick"), 1);
|
|
308
|
+
assert(countMatching(tickWindow, (record) => record.kind === "render" && record.component === "Status") >= 1);
|
|
309
|
+
assert.equal(countMatching(tickWindow, (record) => record.kind === "render" && record.component === "Timeline"), 0);
|
|
310
|
+
assert.equal(countMatching(tickWindow, (record) => record.kind === "timeline" && record.event === "rowGeneration"), 0);
|
|
311
|
+
assert.equal(countMatching(tickWindow, (record) => record.kind === "viewport" && record.event === "slice"), 0);
|
|
312
|
+
assert.equal(countMatching(tickWindow, (record) => record.kind === "render" && record.component === "ActionLog"), 0);
|
|
313
|
+
} finally {
|
|
314
|
+
instance.unmount();
|
|
315
|
+
renderDebug.configureRenderDebug({});
|
|
316
|
+
rmSync(logPath, { force: true });
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
test("app-scroll action rows update without remounting when a running action completes", async () => {
|
|
321
|
+
const logPath = join(tmpdir(), `codexa-action-remount-${process.pid}.jsonl`);
|
|
322
|
+
rmSync(logPath, { force: true });
|
|
323
|
+
renderDebug.configureRenderDebug({
|
|
324
|
+
CODEXA_DEBUG_RENDER_TRACE: "1",
|
|
325
|
+
CODEXA_RENDER_DEBUG_FILE: logPath,
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
const stdin = new TestInput();
|
|
329
|
+
const stdout = new TestOutput();
|
|
330
|
+
const instance = render(<Harness actionStatus="running" mouseCapture={true} />, {
|
|
331
|
+
stdin: stdin as unknown as NodeJS.ReadStream,
|
|
332
|
+
stdout: stdout as unknown as NodeJS.WriteStream,
|
|
333
|
+
stderr: stdout as unknown as NodeJS.WriteStream,
|
|
334
|
+
debug: true,
|
|
335
|
+
exitOnCtrlC: false,
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
try {
|
|
339
|
+
await sleep(100);
|
|
340
|
+
const beforeCompletion = readRecords(logPath);
|
|
341
|
+
const mountedActionRows = beforeCompletion
|
|
342
|
+
.filter((record) => record.kind === "flicker" && record.event === "timelineRowMount")
|
|
343
|
+
.map((record) => String(record.rowKey ?? ""))
|
|
344
|
+
.filter((rowKey) => rowKey.includes("-action-"));
|
|
345
|
+
|
|
346
|
+
assert.ok(mountedActionRows.length > 0, "expected action rows to mount in the initial frame");
|
|
347
|
+
|
|
348
|
+
instance.rerender(<Harness actionStatus="completed" mouseCapture={true} />);
|
|
349
|
+
await sleep(100);
|
|
350
|
+
|
|
351
|
+
const afterCompletion = readRecords(logPath).slice(beforeCompletion.length);
|
|
352
|
+
const unmountedActionRows = afterCompletion
|
|
353
|
+
.filter((record) => record.kind === "flicker" && record.event === "timelineRowUnmount")
|
|
354
|
+
.map((record) => String(record.rowKey ?? ""))
|
|
355
|
+
.filter((rowKey) => rowKey.includes("-action-"));
|
|
356
|
+
|
|
357
|
+
assert.deepEqual(unmountedActionRows, []);
|
|
358
|
+
} finally {
|
|
359
|
+
instance.unmount();
|
|
360
|
+
renderDebug.configureRenderDebug({});
|
|
361
|
+
rmSync(logPath, { force: true });
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
test("first action activity keeps the shell frame mounted and visible", async () => {
|
|
366
|
+
const logPath = join(tmpdir(), `codexa-first-action-shell-${process.pid}.jsonl`);
|
|
367
|
+
rmSync(logPath, { force: true });
|
|
368
|
+
renderDebug.configureRenderDebug({
|
|
369
|
+
CODEXA_RENDER_DEBUG: "1",
|
|
370
|
+
CODEXA_RENDER_DEBUG_FILE: logPath,
|
|
371
|
+
});
|
|
372
|
+
const stdin = new TestInput();
|
|
373
|
+
const stdout = new TestOutput();
|
|
374
|
+
let output = "";
|
|
375
|
+
stdout.on("data", (chunk) => {
|
|
376
|
+
output += chunk.toString();
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
const instance = render(<Harness actionStatus={null} />, {
|
|
380
|
+
stdin: stdin as unknown as NodeJS.ReadStream,
|
|
381
|
+
stdout: stdout as unknown as NodeJS.WriteStream,
|
|
382
|
+
stderr: stdout as unknown as NodeJS.WriteStream,
|
|
383
|
+
debug: true,
|
|
384
|
+
exitOnCtrlC: false,
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
try {
|
|
388
|
+
await sleep(100);
|
|
389
|
+
instance.rerender(<Harness actionStatus="running" />);
|
|
390
|
+
await sleep(100);
|
|
391
|
+
|
|
392
|
+
const frame = stripAnsi(output);
|
|
393
|
+
assert.match(frame, /workspace/);
|
|
394
|
+
assert.match(frame, /What is the point of 5-Date Verification/);
|
|
395
|
+
assert.match(frame, /Codexa is thinking/i);
|
|
396
|
+
assert.match(frame, /Get-Content README\.md/);
|
|
397
|
+
|
|
398
|
+
const records = readRecords(logPath);
|
|
399
|
+
const unexpectedUnmounts = records
|
|
400
|
+
.filter((record) => record.kind === "lifecycle" && record.event === "unmount")
|
|
401
|
+
.map((record) => String(record.component ?? ""))
|
|
402
|
+
.filter((component) => ["AppShell", "Timeline", "Header", "Composer", "Status"].includes(component));
|
|
403
|
+
assert.deepEqual(unexpectedUnmounts, []);
|
|
404
|
+
assert.equal(
|
|
405
|
+
countMatching(records, (record) =>
|
|
406
|
+
record.kind === "blankFrame" && record.reason === "visible-rows-zero-with-events"
|
|
407
|
+
),
|
|
408
|
+
0,
|
|
409
|
+
);
|
|
410
|
+
} finally {
|
|
411
|
+
instance.unmount();
|
|
412
|
+
renderDebug.configureRenderDebug({});
|
|
413
|
+
rmSync(logPath, { force: true });
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
test("appending a second action does not remount existing action rows", async () => {
|
|
418
|
+
const logPath = join(tmpdir(), `codexa-action-append-${process.pid}.jsonl`);
|
|
419
|
+
rmSync(logPath, { force: true });
|
|
420
|
+
renderDebug.configureRenderDebug({
|
|
421
|
+
CODEXA_DEBUG_RENDER_TRACE: "1",
|
|
422
|
+
CODEXA_RENDER_DEBUG_FILE: logPath,
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
const stdin = new TestInput();
|
|
426
|
+
const stdout = new TestOutput();
|
|
427
|
+
const instance = render(<Harness actionStatus="running" />, {
|
|
428
|
+
stdin: stdin as unknown as NodeJS.ReadStream,
|
|
429
|
+
stdout: stdout as unknown as NodeJS.WriteStream,
|
|
430
|
+
stderr: stdout as unknown as NodeJS.WriteStream,
|
|
431
|
+
debug: true,
|
|
432
|
+
exitOnCtrlC: false,
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
try {
|
|
436
|
+
await sleep(100);
|
|
437
|
+
const beforeUpdates = readRecords(logPath);
|
|
438
|
+
const firstActionMounts = beforeUpdates
|
|
439
|
+
.filter((record) => record.kind === "flicker" && record.event === "timelineRowMount")
|
|
440
|
+
.map((record) => String(record.rowKey ?? ""))
|
|
441
|
+
.filter((rowKey) => rowKey.includes("-action-2-"));
|
|
442
|
+
|
|
443
|
+
assert.ok(firstActionMounts.length > 0, "expected first action rows to mount in the initial frame");
|
|
444
|
+
|
|
445
|
+
instance.rerender(<Harness actionStatus="completed" />);
|
|
446
|
+
await sleep(100);
|
|
447
|
+
const beforeAppend = readRecords(logPath);
|
|
448
|
+
|
|
449
|
+
instance.rerender(<Harness actionStatus="completed" secondActionStatus="running" />);
|
|
450
|
+
await sleep(100);
|
|
451
|
+
|
|
452
|
+
const appendWindow = readRecords(logPath).slice(beforeAppend.length);
|
|
453
|
+
const firstActionUnmounts = appendWindow
|
|
454
|
+
.filter((record) => record.kind === "flicker" && record.event === "timelineRowUnmount")
|
|
455
|
+
.map((record) => String(record.rowKey ?? ""))
|
|
456
|
+
.filter((rowKey) => rowKey.includes("-action-2-"));
|
|
457
|
+
|
|
458
|
+
assert.deepEqual(firstActionUnmounts, []);
|
|
459
|
+
} finally {
|
|
460
|
+
instance.unmount();
|
|
461
|
+
renderDebug.configureRenderDebug({});
|
|
462
|
+
rmSync(logPath, { force: true });
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
test("native AppShell finalize keeps transcript rows in one keyed tree", async () => {
|
|
467
|
+
const logPath = join(tmpdir(), `codexa-native-finalize-${process.pid}.jsonl`);
|
|
468
|
+
rmSync(logPath, { force: true });
|
|
469
|
+
renderDebug.configureRenderDebug({
|
|
470
|
+
CODEXA_DEBUG_RENDER_TRACE: "1",
|
|
471
|
+
CODEXA_RENDER_DEBUG_FILE: logPath,
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
const stdin = new TestInput();
|
|
475
|
+
const stdout = new TestOutput();
|
|
476
|
+
let output = "";
|
|
477
|
+
stdout.on("data", (chunk) => {
|
|
478
|
+
output += chunk.toString();
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
const runningEvents = makeActiveEvents("completed");
|
|
482
|
+
const completedEvents = JSON.parse(JSON.stringify(runningEvents)) as TimelineEvent[];
|
|
483
|
+
const completedRun = completedEvents.find((event): event is Extract<TimelineEvent, { type: "run" }> => event.type === "run");
|
|
484
|
+
assert.ok(completedRun);
|
|
485
|
+
completedRun.status = "completed";
|
|
486
|
+
completedRun.durationMs = 1234;
|
|
487
|
+
completedRun.responseSegments = [{
|
|
488
|
+
id: "response-2-3",
|
|
489
|
+
streamSeq: 3,
|
|
490
|
+
chunks: ["Hello"],
|
|
491
|
+
status: "completed",
|
|
492
|
+
startedAt: 5,
|
|
493
|
+
}];
|
|
494
|
+
completedRun.streamItems = [
|
|
495
|
+
...(completedRun.streamItems ?? []),
|
|
496
|
+
{ kind: "response", streamSeq: 3, refId: "response-2-3" },
|
|
497
|
+
];
|
|
498
|
+
completedEvents.push({
|
|
499
|
+
id: 3,
|
|
500
|
+
type: "assistant",
|
|
501
|
+
createdAt: 6,
|
|
502
|
+
content: "Hello",
|
|
503
|
+
contentChunks: [],
|
|
504
|
+
turnId: 1,
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
const instance = render(
|
|
508
|
+
<AppShellHarness
|
|
509
|
+
staticEvents={[]}
|
|
510
|
+
activeEvents={runningEvents}
|
|
511
|
+
uiState={{ kind: "THINKING", turnId: 1 }}
|
|
512
|
+
mouseCapture={false}
|
|
513
|
+
/>,
|
|
514
|
+
{
|
|
515
|
+
stdin: stdin as unknown as NodeJS.ReadStream,
|
|
516
|
+
stdout: stdout as unknown as NodeJS.WriteStream,
|
|
517
|
+
stderr: stdout as unknown as NodeJS.WriteStream,
|
|
518
|
+
debug: true,
|
|
519
|
+
exitOnCtrlC: false,
|
|
520
|
+
},
|
|
521
|
+
);
|
|
522
|
+
|
|
523
|
+
try {
|
|
524
|
+
await sleep(100);
|
|
525
|
+
const beforeFinalize = readRecords(logPath);
|
|
526
|
+
|
|
527
|
+
instance.rerender(
|
|
528
|
+
<AppShellHarness
|
|
529
|
+
staticEvents={completedEvents}
|
|
530
|
+
activeEvents={[]}
|
|
531
|
+
uiState={{ kind: "IDLE" }}
|
|
532
|
+
mouseCapture={false}
|
|
533
|
+
/>,
|
|
534
|
+
);
|
|
535
|
+
await sleep(100);
|
|
536
|
+
|
|
537
|
+
const finalizeWindow = readRecords(logPath).slice(beforeFinalize.length);
|
|
538
|
+
const unmountedActionRows = finalizeWindow
|
|
539
|
+
.filter((record) => record.kind === "flicker" && record.event === "timelineRowUnmount")
|
|
540
|
+
.map((record) => String(record.rowKey ?? ""))
|
|
541
|
+
.filter((rowKey) => rowKey.includes("-action-"));
|
|
542
|
+
const majorUnmounts = finalizeWindow
|
|
543
|
+
.filter((record) => record.kind === "lifecycle" && record.event === "unmount")
|
|
544
|
+
.map((record) => String(record.component ?? ""))
|
|
545
|
+
.filter((component) => ["AppShell", "Header", "Composer"].includes(component));
|
|
546
|
+
|
|
547
|
+
assert.deepEqual(unmountedActionRows, []);
|
|
548
|
+
assert.deepEqual(majorUnmounts, []);
|
|
549
|
+
const frame = stripAnsi(output);
|
|
550
|
+
assert.match(frame, /13-Custom-CLI-Normal/);
|
|
551
|
+
assert.match(frame, /Hello/);
|
|
552
|
+
} finally {
|
|
553
|
+
instance.unmount();
|
|
554
|
+
renderDebug.configureRenderDebug({});
|
|
555
|
+
rmSync(logPath, { force: true });
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
test("THINKING -> RESPONDING -> FINALIZE_RUN preserves action rows and renders response below", async () => {
|
|
561
|
+
const logPath = join(tmpdir(), `codexa-action-response-finalize-${process.pid}.jsonl`);
|
|
562
|
+
rmSync(logPath, { force: true });
|
|
563
|
+
renderDebug.configureRenderDebug({
|
|
564
|
+
CODEXA_DEBUG_RENDER_TRACE: "1",
|
|
565
|
+
CODEXA_RENDER_DEBUG_FILE: logPath,
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
const stdin = new TestInput();
|
|
569
|
+
const stdout = new TestOutput();
|
|
570
|
+
let output = "";
|
|
571
|
+
stdout.on("data", (chunk) => {
|
|
572
|
+
output += chunk.toString();
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
let runningEvents: TimelineEvent[] = makeActiveEvents("running");
|
|
576
|
+
let uiState: UIState = { kind: "THINKING", turnId: 1 };
|
|
577
|
+
|
|
578
|
+
const TestTimeline = (props: {
|
|
579
|
+
staticEvents: TimelineEvent[];
|
|
580
|
+
activeEvents: TimelineEvent[];
|
|
581
|
+
uiState: UIState;
|
|
582
|
+
}) => {
|
|
583
|
+
const layout = createLayoutSnapshot(120, 40);
|
|
584
|
+
return <Timeline
|
|
585
|
+
staticEvents={props.staticEvents}
|
|
586
|
+
activeEvents={props.activeEvents}
|
|
587
|
+
layout={layout}
|
|
588
|
+
uiState={props.uiState}
|
|
589
|
+
viewportRows={30}
|
|
590
|
+
verboseMode={true}
|
|
591
|
+
/>;
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
const instance = render(<TestTimeline staticEvents={[]} activeEvents={runningEvents} uiState={uiState} />, {
|
|
595
|
+
stdin: stdin as unknown as NodeJS.ReadStream,
|
|
596
|
+
stdout: stdout as unknown as NodeJS.WriteStream,
|
|
597
|
+
stderr: stdout as unknown as NodeJS.WriteStream,
|
|
598
|
+
debug: true,
|
|
599
|
+
exitOnCtrlC: false,
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
try {
|
|
603
|
+
await sleep(100);
|
|
604
|
+
const beforeUpdates = readRecords(logPath);
|
|
605
|
+
|
|
606
|
+
// RESPONDING
|
|
607
|
+
let streamingEvents = JSON.parse(JSON.stringify(runningEvents)) as TimelineEvent[];
|
|
608
|
+
let streamingTurn = streamingEvents[1] as Extract<TimelineEvent, { type: "run" }>;
|
|
609
|
+
streamingTurn.toolActivities[0].status = "completed";
|
|
610
|
+
streamingTurn.responseSegments = [{
|
|
611
|
+
id: "resp-1",
|
|
612
|
+
streamSeq: 3,
|
|
613
|
+
chunks: ["Final response text"],
|
|
614
|
+
status: "active",
|
|
615
|
+
startedAt: 5,
|
|
616
|
+
}];
|
|
617
|
+
streamingTurn.streamItems = [
|
|
618
|
+
...(streamingTurn.streamItems ?? []),
|
|
619
|
+
{ kind: "response", streamSeq: 3, refId: "resp-1" },
|
|
620
|
+
];
|
|
621
|
+
uiState = { kind: "RESPONDING", turnId: 1 };
|
|
622
|
+
|
|
623
|
+
instance.rerender(<TestTimeline staticEvents={[]} activeEvents={streamingEvents} uiState={uiState} />);
|
|
624
|
+
await sleep(100);
|
|
625
|
+
|
|
626
|
+
// FINALIZE_RUN
|
|
627
|
+
let completedEvents = JSON.parse(JSON.stringify(streamingEvents)) as TimelineEvent[];
|
|
628
|
+
let completedTurn = completedEvents[1] as Extract<TimelineEvent, { type: "run" }>;
|
|
629
|
+
completedTurn.status = "completed";
|
|
630
|
+
completedTurn.responseSegments = (completedTurn.responseSegments ?? []).map((segment, index) =>
|
|
631
|
+
index === 0 ? { ...segment, status: "completed" } : segment
|
|
632
|
+
);
|
|
633
|
+
uiState = { kind: "IDLE" };
|
|
634
|
+
|
|
635
|
+
instance.rerender(<TestTimeline staticEvents={completedEvents} activeEvents={[]} uiState={uiState} />);
|
|
636
|
+
await sleep(100);
|
|
637
|
+
|
|
638
|
+
const frame = stripAnsi(output);
|
|
639
|
+
|
|
640
|
+
const unmounts = readRecords(logPath)
|
|
641
|
+
.filter((record) => record.kind === "flicker" && record.event === "timelineRowUnmount")
|
|
642
|
+
.map((record) => String(record.rowKey ?? ""))
|
|
643
|
+
.filter((rowKey) => rowKey.includes("-action-"));
|
|
644
|
+
|
|
645
|
+
assert.deepEqual(unmounts, [], "Action rows should not unmount during response and finalize");
|
|
646
|
+
assert.match(frame, /Final response text/i, "Answer text should appear");
|
|
647
|
+
assert.match(frame, /action/i, "Action card should remain");
|
|
648
|
+
|
|
649
|
+
} finally {
|
|
650
|
+
instance.unmount();
|
|
651
|
+
renderDebug.configureRenderDebug({});
|
|
652
|
+
rmSync(logPath, { force: true });
|
|
653
|
+
}
|
|
654
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { formatTerminalAnswerInline } from "./terminalAnswerFormat.js";
|
|
4
|
+
|
|
5
|
+
test("terminal answer formatting collapses local markdown links and Windows paths", () => {
|
|
6
|
+
const formatted = formatTerminalAnswerInline([
|
|
7
|
+
"- [`src/App.tsx`](C:/Users/Example/Projects/Project/src/App.tsx#L22)",
|
|
8
|
+
"- [README.md](file:///C:/Users/Example/Projects/Project/README.md)",
|
|
9
|
+
"- C:\\Users\\Example\\Projects\\Project\\docs\\proof.md#L26",
|
|
10
|
+
"- [OpenAI](https://platform.openai.com/docs)",
|
|
11
|
+
].join("\n"));
|
|
12
|
+
|
|
13
|
+
assert.match(formatted, /src\/App\.tsx:22/);
|
|
14
|
+
assert.match(formatted, /README\.md/);
|
|
15
|
+
assert.match(formatted, /docs\/proof\.md:26/);
|
|
16
|
+
assert.match(formatted, /\[OpenAI\]\(https:\/\/platform\.openai\.com\/docs\)/);
|
|
17
|
+
assert.doesNotMatch(formatted, /C:\/Users|C:\\Users|file:\/\//);
|
|
18
|
+
assert.doesNotMatch(formatted, /\]\(C:/);
|
|
19
|
+
});
|