nexum-code 0.13.3 → 0.14.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/dist/{app-DzUJjo-N.mjs → app-cVy5vxdq.mjs} +188 -31
- package/dist/{dispatch-xaiGN5VV.mjs → dispatch-B2jPWSmW.mjs} +2893 -582
- package/dist/{dispatch-KEOSyNQQ.mjs → dispatch-GH0cUcBE.mjs} +1 -1
- package/dist/{dist-AcjRoBBn.mjs → dist-B_OG4w84.mjs} +6 -6
- package/dist/main.mjs +1 -1
- package/dist/public/assets/index-CSHfYrxD.css +1 -0
- package/dist/public/assets/index-DCh1yGQ_.js +90 -0
- package/dist/public/assets/index-DCh1yGQ_.js.map +1 -0
- package/dist/public/index.html +16 -2
- package/dist/{text-input-dialog-Bncn0-6m.mjs → text-input-dialog-9TU2p7Py.mjs} +126 -82
- package/dist/{text-input-dialog-B5DB64Yp.mjs → text-input-dialog-D7p11_lV.mjs} +1 -1
- package/package.json +3 -3
- package/dist/public/assets/index-Dk4bewva.js +0 -90
- package/dist/public/assets/index-Dk4bewva.js.map +0 -1
- package/dist/public/assets/index-nfSMt8uX.css +0 -1
|
@@ -4,8 +4,8 @@ import { dirname as __cjsShimDirname } from 'node:path';
|
|
|
4
4
|
const __filename = __cjsShimFileURLToPath(import.meta.url);
|
|
5
5
|
const __dirname = __cjsShimDirname(__filename);
|
|
6
6
|
import "./suppress-sqlite-warning-C2VB0doZ.mjs";
|
|
7
|
-
import { $t as
|
|
8
|
-
import { a as setLocale, o as t } from "./text-input-dialog-
|
|
7
|
+
import { $t as formatErrorMessage, A as renderDiffLinesClustered, An as detectInstallSource, At as DISABLE_TERMINAL_THEME_REPORTING, B as BackgroundAgentStatusComponent, Bn as resolveNexumHome, Bt as TERMINAL_THEME_DARK, Cn as TuiLikePreferencesSchema, Ct as createMarkdownTheme, D as toggleEmptySessionHint, Dn as getDataDir, Dt as detectTerminalTheme, E as isTurnElapsedEnabled, En as detectShellEnvironment, Et as getColorPalette, F as estimateTokens, Fn as DEFAULT_CATALOG_URL, Ft as OSC11_RESPONSE_PREFIX, G as BREATHE_CYCLE_MS, Gn as isNexumError, H as AgentGroupComponent, Hn as flushDiagnosticLogs, Ht as isBusy, I as getSharedSpeedTracker, In as fetchCatalog, It as OSC11_RESPONSE_PREFIX_NO_ESC, J as clearGoalState, Jn as NEXUM_ERROR_INFO, K as getBreathingFrame, Kn as isOrphanedToolCallError, L as SkillActivationComponent, Ln as saveCatalogCache, Lt as QUERY_TERMINAL_THEME, M as langFromPath, Mn as CLI_UI_MODE, Mt as ENABLE_TERMINAL_THEME_REPORTING, N as CachedContainer, Nn as CLI_USER_AGENT_PRODUCT, Nt as OSC11_QUERY, O as ToolCallComponent, On as getInputHistoryFile, Ot as parseOsc11BackgroundTheme, P as ThinkingComponent, Pn as PRODUCT_NAME, Pt as OSC11_RESPONSE, Qt as argsRecord, R as ReadGroupComponent, Rn as NexumHarness, Rt as TERMINAL_FOCUS_IN, S as getDaemonInstructions, Sn as TuiConfigParseError, St as createEditorTheme, T as isEmptySessionHintDismissed, Tn as saveTuiConfig, Tt as contrastTextHex, U as WelcomeComponent, Un as log, Ut as isStreaming, V as AssistantMessageComponent, Vn as MemoryMemoStore, Vt as TERMINAL_THEME_LIGHT, W as NEXUM_CODE_LOGO, Wn as resolveGlobalLogPath, Wt as FooterComponent, Xt as STATUS_BULLET, Y as refineGoal, Yt as printableChar, Zt as appendStreamingArgsPreview, _ as refreshUpdateCache, _n as sortSlashCommands, _t as supportsBalance, an as CHARS_PER_TOKEN, b as readJsonlFile, bn as PIXEL_PULSE_FRAMES, c as hasDispose, cn as MAIN_AGENT_ID, d as formatMemoryMemoForInjection, dn as getCtrlCHint, en as isTodoItemShape, fn as getCtrlDHint, g as selectUpdateTarget, gn as BUILTIN_SLASH_COMMANDS, gt as refreshProviderBalance, hn as buildSkillSlashCommands, i as buildRoleAdditionalText, in as truncateErrorMessage, j as highlightLines, jn as CLI_COMMAND_NAME, jt as ENABLE_TERMINAL_FOCUS_REPORTING, k as renderDiffLines, kn as getLogDir, kt as DISABLE_TERMINAL_FOCUS_REPORTING, l as isPlanExpandable, ln as SESSION_TIPS, lt as handlePlanCommand, mn as getNoActiveSessionMessage, n as clearEvalPanelState, nn as serializeToolResultOutput, nt as changeThinkingLevel, on as EMPTY_SESSION_HINT_URL, pn as getLlmNotSetMessage, q as resetBreathingClock, qn as ErrorCodes, r as openUrl, rn as stringValue, rt as getModelCycleLevel, s as disposeChildren, sn as EXIT_CONFIRM_WINDOW_MS, st as handleFusionPlanCommand, t as dispatchInput, tn as parseStreamingArgs, tt as toTerminalHyperlink, u as MoonLoader, un as TIP_ROTATION_INTERVAL_MS, v as readUpdateCache, vn as isExperimentalFlagEnabled, vt as clearInfoPanelState, w as UserMessageComponent, wn as loadTuiConfig, wt as createThemeStyles, xn as PULSE_WAVE_FRAMES, xt as resolveThemeSync, y as appendJsonlLine, yn as setExperimentalFlags, z as parseReadGroupOutput, zt as TERMINAL_FOCUS_OUT } from "./dispatch-B2jPWSmW.mjs";
|
|
8
|
+
import { a as setLocale, o as t } from "./text-input-dialog-9TU2p7Py.mjs";
|
|
9
9
|
import { createRequire } from "node:module";
|
|
10
10
|
import { randomUUID } from "node:crypto";
|
|
11
11
|
import { access, mkdir, mkdtemp, readFile, readdir, realpath, rm, unlink, writeFile } from "node:fs/promises";
|
|
@@ -30,7 +30,7 @@ function optionalBuildString(value) {
|
|
|
30
30
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
31
31
|
}
|
|
32
32
|
const NEXUM_BUILD_INFO = {
|
|
33
|
-
version: optionalBuildString("0.
|
|
33
|
+
version: optionalBuildString("0.14.1"),
|
|
34
34
|
channel: optionalBuildString(""),
|
|
35
35
|
commit: optionalBuildString(""),
|
|
36
36
|
buildTarget: optionalBuildString("win32-x64")
|
|
@@ -1867,6 +1867,10 @@ var EditorKeyboardController = class {
|
|
|
1867
1867
|
function replaceTabs(text, tabWidth = 4) {
|
|
1868
1868
|
return text.replaceAll(" ", " ".repeat(tabWidth));
|
|
1869
1869
|
}
|
|
1870
|
+
/** Strip terminal control sequences from captured shell output. */
|
|
1871
|
+
function sanitizeShellOutput(output) {
|
|
1872
|
+
return output.replaceAll("\r", "").replaceAll(/\u001B\[[0-?]*[ -/]*[@-~]/g, "").replaceAll(/\u001B\][^\u0007\u001B]*(?:\u0007|\u001B\\)/g, "").replaceAll(/\u001B[P^_][^\u0007\u001B]*(?:\u0007|\u001B\\)/g, "").replaceAll(/\u001B[()][0-9A-Za-z]/g, "").replaceAll(/\u001B[=>78DEFHMc]/g, "");
|
|
1873
|
+
}
|
|
1870
1874
|
//#endregion
|
|
1871
1875
|
//#region src/tui/components/messages/status-message.ts
|
|
1872
1876
|
var StatusMessageComponent = class extends Container {
|
|
@@ -2897,9 +2901,9 @@ var SessionEventHandler = class {
|
|
|
2897
2901
|
const { name, purpose } = event.candidate;
|
|
2898
2902
|
if (name.length === 0) return;
|
|
2899
2903
|
if (this.promptedSkillCandidates.has(name)) return;
|
|
2900
|
-
this.promptedSkillCandidates.add(name);
|
|
2901
2904
|
const session = this.host.session;
|
|
2902
2905
|
if (session === void 0) return;
|
|
2906
|
+
this.promptedSkillCandidates.add(name);
|
|
2903
2907
|
if (this.host.streamingUI.hasActiveTurn()) {
|
|
2904
2908
|
this.pendingSkillCandidates.push({
|
|
2905
2909
|
name,
|
|
@@ -3927,6 +3931,7 @@ var StreamingUIController = class {
|
|
|
3927
3931
|
turnStartAt = 0;
|
|
3928
3932
|
_currentStep = 0;
|
|
3929
3933
|
_assistantDraft = "";
|
|
3934
|
+
_shownAssistantLength = 0;
|
|
3930
3935
|
_thinkingDraft = "";
|
|
3931
3936
|
lastDeltaAt;
|
|
3932
3937
|
_thinkingEntry = void 0;
|
|
@@ -4000,6 +4005,7 @@ var StreamingUIController = class {
|
|
|
4000
4005
|
}
|
|
4001
4006
|
clearAssistantDraft() {
|
|
4002
4007
|
this._assistantDraft = "";
|
|
4008
|
+
this._shownAssistantLength = 0;
|
|
4003
4009
|
}
|
|
4004
4010
|
getActiveToolCall(id) {
|
|
4005
4011
|
return this._activeToolCalls.get(id);
|
|
@@ -4182,7 +4188,7 @@ var StreamingUIController = class {
|
|
|
4182
4188
|
}
|
|
4183
4189
|
}
|
|
4184
4190
|
hasPending() {
|
|
4185
|
-
return this.pendingAssistantFlush || this.pendingThinkingFlush || this.pendingToolCallFlushIds.size > 0;
|
|
4191
|
+
return this.pendingAssistantFlush || this.pendingThinkingFlush || this.pendingToolCallFlushIds.size > 0 || this._shownAssistantLength < this._assistantDraft.length;
|
|
4186
4192
|
}
|
|
4187
4193
|
clearFlushTimer() {
|
|
4188
4194
|
if (this.flushTimer === void 0) return;
|
|
@@ -4199,10 +4205,10 @@ var StreamingUIController = class {
|
|
|
4199
4205
|
this.pendingThinkingFlush = false;
|
|
4200
4206
|
this.pendingToolCallFlushIds.clear();
|
|
4201
4207
|
}
|
|
4202
|
-
scheduleFlush() {
|
|
4208
|
+
scheduleFlush(frameMs = 50) {
|
|
4203
4209
|
if (!this.hasPending()) return;
|
|
4204
4210
|
if (this.flushTimer !== void 0) return;
|
|
4205
|
-
const delay = this.lastFlushAt === void 0 ? 0 : Math.max(0,
|
|
4211
|
+
const delay = this.lastFlushAt === void 0 ? 0 : Math.max(0, frameMs - (Date.now() - this.lastFlushAt));
|
|
4206
4212
|
this.flushTimer = setTimeout(() => {
|
|
4207
4213
|
this.flushTimer = void 0;
|
|
4208
4214
|
this.flush();
|
|
@@ -4222,8 +4228,19 @@ var StreamingUIController = class {
|
|
|
4222
4228
|
this.pendingAssistantFlush = false;
|
|
4223
4229
|
this.pendingToolCallFlushIds.clear();
|
|
4224
4230
|
if (shouldFlushThinking && this._thinkingDraft.length > 0) this.onThinkingUpdate(this._thinkingDraft);
|
|
4225
|
-
if (shouldFlushAssistant
|
|
4231
|
+
if (shouldFlushAssistant || this._shownAssistantLength < this._assistantDraft.length) {
|
|
4232
|
+
const shown = this.advanceAssistantShown();
|
|
4233
|
+
if (shown > 0) this.onStreamingTextUpdate(this._assistantDraft.slice(0, shown));
|
|
4234
|
+
}
|
|
4226
4235
|
for (const id of toolCallIds) this.flushToolCallPreview(id);
|
|
4236
|
+
if (this._shownAssistantLength < this._assistantDraft.length) this.scheduleFlush(50);
|
|
4237
|
+
}
|
|
4238
|
+
advanceAssistantShown() {
|
|
4239
|
+
if (this._shownAssistantLength >= this._assistantDraft.length) return this._shownAssistantLength;
|
|
4240
|
+
const measured = getSharedSpeedTracker().getSpeed();
|
|
4241
|
+
const budget = Math.min(25, Math.max(1, Math.ceil((measured > 0 ? measured : 50) * (50 / 1e3) * CHARS_PER_TOKEN)));
|
|
4242
|
+
this._shownAssistantLength = Math.min(this._assistantDraft.length, this._shownAssistantLength + budget);
|
|
4243
|
+
return this._shownAssistantLength;
|
|
4227
4244
|
}
|
|
4228
4245
|
markAssistantDirty() {
|
|
4229
4246
|
this.pendingAssistantFlush = true;
|
|
@@ -4237,17 +4254,21 @@ var StreamingUIController = class {
|
|
|
4237
4254
|
this.onThinkingEnd();
|
|
4238
4255
|
}
|
|
4239
4256
|
finalizeAssistantStream() {
|
|
4257
|
+
if (this._shownAssistantLength < this._assistantDraft.length) this._shownAssistantLength = this._assistantDraft.length;
|
|
4258
|
+
this.pendingAssistantFlush = true;
|
|
4240
4259
|
this.flushNow();
|
|
4241
4260
|
if (this._streamingBlock !== null) this.onStreamingTextEnd();
|
|
4242
4261
|
this._assistantDraft = "";
|
|
4262
|
+
this._shownAssistantLength = 0;
|
|
4243
4263
|
this.host.updateActivityPane();
|
|
4244
4264
|
this.host.state.ui.requestRender();
|
|
4245
4265
|
}
|
|
4246
4266
|
resetLiveText() {
|
|
4247
4267
|
this.pendingAssistantFlush = false;
|
|
4248
4268
|
this.pendingThinkingFlush = false;
|
|
4249
|
-
this.clearFlushTimerIfIdle();
|
|
4250
4269
|
this._assistantDraft = "";
|
|
4270
|
+
this._shownAssistantLength = 0;
|
|
4271
|
+
this.clearFlushTimerIfIdle();
|
|
4251
4272
|
this._streamingBlock = null;
|
|
4252
4273
|
this._thinkingDraft = "";
|
|
4253
4274
|
this.lastDeltaAt = void 0;
|
|
@@ -4787,7 +4808,8 @@ var TaskOutputViewer = class extends Container {
|
|
|
4787
4808
|
this.invalidate();
|
|
4788
4809
|
}
|
|
4789
4810
|
splitOutput(output) {
|
|
4790
|
-
|
|
4811
|
+
const sanitized = sanitizeShellOutput(output);
|
|
4812
|
+
return (sanitized.length > 0 ? sanitized : t("taskviewer.no_output")).split("\n");
|
|
4791
4813
|
}
|
|
4792
4814
|
handleInput(data) {
|
|
4793
4815
|
const visible = this.viewableRows();
|
|
@@ -5295,7 +5317,7 @@ var TasksBrowserApp = class extends Container {
|
|
|
5295
5317
|
let body;
|
|
5296
5318
|
if (this.props.tailLoading) body = "[loading…]";
|
|
5297
5319
|
else if (this.props.tailOutput === void 0 || this.props.tailOutput.length === 0) body = "[no output captured]";
|
|
5298
|
-
else body = this.props.tailOutput;
|
|
5320
|
+
else body = sanitizeShellOutput(this.props.tailOutput);
|
|
5299
5321
|
const styled = body.split("\n").slice(-innerHeight).map((line) => chalk.hex(colors.textDim)(line));
|
|
5300
5322
|
while (styled.length < innerHeight) styled.push("");
|
|
5301
5323
|
return this.renderFrame("Preview Output", styled, width, height);
|
|
@@ -7698,6 +7720,91 @@ const INITIAL_LIVE_PANE = {
|
|
|
7698
7720
|
pendingQuestion: null
|
|
7699
7721
|
};
|
|
7700
7722
|
//#endregion
|
|
7723
|
+
//#region src/utils/clipboard/clipboard-text.ts
|
|
7724
|
+
/**
|
|
7725
|
+
* Write plain text to the system clipboard with platform-specific commands.
|
|
7726
|
+
*
|
|
7727
|
+
* nexum-core's clipboard layer is read-only (clipboard-native / clipboard-image),
|
|
7728
|
+
* so the TUI's "copy selected text" needs its own writer. Used to back the
|
|
7729
|
+
* pi-tui `copySelection` hook — return true/false so the TUI can flash
|
|
7730
|
+
* "Copied!" or "Copy failed".
|
|
7731
|
+
*
|
|
7732
|
+
* Platform mapping:
|
|
7733
|
+
* macOS -> pbcopy
|
|
7734
|
+
* Windows-> powershell Set-Clipboard (base64 payload, avoids quoting issues)
|
|
7735
|
+
* Linux -> wl-copy (Wayland) / xclip -selection clipboard -i (X11)
|
|
7736
|
+
*/
|
|
7737
|
+
var ClipboardTextError = class extends Error {
|
|
7738
|
+
constructor(message) {
|
|
7739
|
+
super(message);
|
|
7740
|
+
this.name = "ClipboardTextError";
|
|
7741
|
+
}
|
|
7742
|
+
};
|
|
7743
|
+
const defaultRunCommand = (command, args, input) => {
|
|
7744
|
+
const result = spawnSync(command, args, {
|
|
7745
|
+
input,
|
|
7746
|
+
encoding: "utf8",
|
|
7747
|
+
timeout: 3e3
|
|
7748
|
+
});
|
|
7749
|
+
if (result.status === 0) return { ok: true };
|
|
7750
|
+
return {
|
|
7751
|
+
ok: false,
|
|
7752
|
+
error: result.error?.message ?? result.stderr?.toString() ?? `exit ${result.status}`
|
|
7753
|
+
};
|
|
7754
|
+
};
|
|
7755
|
+
function detectPlatform() {
|
|
7756
|
+
if (process.platform === "darwin") return "macos";
|
|
7757
|
+
if (process.platform === "win32") return "windows";
|
|
7758
|
+
if (process.platform === "linux") return process.env["WAYLAND_DISPLAY"] ? "linux-wayland" : "linux-x11";
|
|
7759
|
+
return "unsupported";
|
|
7760
|
+
}
|
|
7761
|
+
/**
|
|
7762
|
+
* Write `text` to the system clipboard. Throws ClipboardTextError when the
|
|
7763
|
+
* platform is unsupported or the underlying command fails, so callers can
|
|
7764
|
+
* surface a "Copy failed" indicator.
|
|
7765
|
+
*/
|
|
7766
|
+
async function writeTextClipboard(text, runCommand = defaultRunCommand) {
|
|
7767
|
+
const platform = detectPlatform();
|
|
7768
|
+
let command;
|
|
7769
|
+
let args;
|
|
7770
|
+
let input;
|
|
7771
|
+
switch (platform) {
|
|
7772
|
+
case "macos":
|
|
7773
|
+
command = "pbcopy";
|
|
7774
|
+
args = [];
|
|
7775
|
+
input = text;
|
|
7776
|
+
break;
|
|
7777
|
+
case "windows": {
|
|
7778
|
+
const base64 = Buffer.from(text, "utf8").toString("base64");
|
|
7779
|
+
command = "powershell";
|
|
7780
|
+
args = [
|
|
7781
|
+
"-NoProfile",
|
|
7782
|
+
"-Command",
|
|
7783
|
+
`[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('${base64}')) | Set-Clipboard`
|
|
7784
|
+
];
|
|
7785
|
+
input = "";
|
|
7786
|
+
break;
|
|
7787
|
+
}
|
|
7788
|
+
case "linux-wayland":
|
|
7789
|
+
command = "wl-copy";
|
|
7790
|
+
args = [];
|
|
7791
|
+
input = text;
|
|
7792
|
+
break;
|
|
7793
|
+
case "linux-x11":
|
|
7794
|
+
command = "xclip";
|
|
7795
|
+
args = [
|
|
7796
|
+
"-selection",
|
|
7797
|
+
"clipboard",
|
|
7798
|
+
"-i"
|
|
7799
|
+
];
|
|
7800
|
+
input = text;
|
|
7801
|
+
break;
|
|
7802
|
+
default: throw new ClipboardTextError(`unsupported clipboard platform: ${process.platform}`);
|
|
7803
|
+
}
|
|
7804
|
+
const result = runCommand(command, args, input);
|
|
7805
|
+
if (!result.ok) throw new ClipboardTextError(`failed to copy to clipboard: ${command} ${result.error ?? "unknown error"}`);
|
|
7806
|
+
}
|
|
7807
|
+
//#endregion
|
|
7701
7808
|
//#region src/tui/utils/render-batcher.ts
|
|
7702
7809
|
function createRenderBatcher(doRender) {
|
|
7703
7810
|
let scheduled = false;
|
|
@@ -8556,7 +8663,14 @@ function createTUIState(options) {
|
|
|
8556
8663
|
const initialAppState = options.initialAppState;
|
|
8557
8664
|
const theme = createNexumTUIThemeBundle(initialAppState.theme, options.resolvedTheme);
|
|
8558
8665
|
const terminal = new ProcessTerminal();
|
|
8559
|
-
const ui = new TuiAltScreen(terminal)
|
|
8666
|
+
const ui = new TuiAltScreen(terminal, void 0, void 0, { copySelection: async (text) => {
|
|
8667
|
+
try {
|
|
8668
|
+
await writeTextClipboard(text);
|
|
8669
|
+
return true;
|
|
8670
|
+
} catch {
|
|
8671
|
+
return false;
|
|
8672
|
+
}
|
|
8673
|
+
} });
|
|
8560
8674
|
const uiAny = ui;
|
|
8561
8675
|
const originalDoRender = uiAny["doRender"].bind(ui);
|
|
8562
8676
|
let recovering = false;
|
|
@@ -9198,6 +9312,7 @@ var SessionManager$1 = class {
|
|
|
9198
9312
|
contextTokens: status.contextTokens,
|
|
9199
9313
|
maxContextTokens: status.maxContextTokens,
|
|
9200
9314
|
contextUsage: status.contextUsage,
|
|
9315
|
+
...status.usage?.turnTotal !== void 0 ? { sessionUsage: status.usage.turnTotal } : {},
|
|
9201
9316
|
sessionTitle: session.summary?.title ?? null,
|
|
9202
9317
|
goal: goal ? {
|
|
9203
9318
|
objective: goal.objective,
|
|
@@ -11935,12 +12050,14 @@ var NexumTUI = class {
|
|
|
11935
12050
|
Object.assign(this.state.appState, patch);
|
|
11936
12051
|
const planModeChanged = "planMode" in patch && prevPlanMode !== this.state.appState.planMode;
|
|
11937
12052
|
const sessionChanged = "sessionId" in patch && this.state.appState.sessionId !== prevSessionId;
|
|
11938
|
-
if (sessionChanged)
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
12053
|
+
if (sessionChanged) {
|
|
12054
|
+
if (!("sessionUsage" in patch)) this.state.appState.sessionUsage = {
|
|
12055
|
+
inputOther: 0,
|
|
12056
|
+
output: 0,
|
|
12057
|
+
inputCacheRead: 0,
|
|
12058
|
+
inputCacheCreation: 0
|
|
12059
|
+
};
|
|
12060
|
+
}
|
|
11944
12061
|
if (planModeChanged || sessionChanged) {
|
|
11945
12062
|
this.updateEditorBorderHighlight();
|
|
11946
12063
|
this.state.planModeBanner.setPlanMode(this.state.appState.planMode ?? "off");
|
|
@@ -12116,7 +12233,7 @@ var NexumTUI = class {
|
|
|
12116
12233
|
this.mountEditorReplacement(new OnboardingCardComponent({
|
|
12117
12234
|
colors: this.state.theme.colors,
|
|
12118
12235
|
onConfigure: () => {
|
|
12119
|
-
import("./dispatch-
|
|
12236
|
+
import("./dispatch-GH0cUcBE.mjs").then(({ handleConnectCommand }) => handleConnectCommand(this, "")).finally(() => this.restoreEditor());
|
|
12120
12237
|
},
|
|
12121
12238
|
onSkip: () => this.restoreEditor()
|
|
12122
12239
|
}));
|
|
@@ -13072,6 +13189,31 @@ function mapCcConnectMode(mode) {
|
|
|
13072
13189
|
};
|
|
13073
13190
|
}
|
|
13074
13191
|
}
|
|
13192
|
+
/** Exit quietly when cc-connect closes the stdout pipe during restart. */
|
|
13193
|
+
function installStdoutEpipeGuard() {
|
|
13194
|
+
const handleStdoutClosed = () => {
|
|
13195
|
+
log.debug("stream-json: stdout closed (EPIPE), exiting");
|
|
13196
|
+
process.exit(0);
|
|
13197
|
+
};
|
|
13198
|
+
process.stdout.on("error", (error) => {
|
|
13199
|
+
if (error.code === "EPIPE") {
|
|
13200
|
+
handleStdoutClosed();
|
|
13201
|
+
return;
|
|
13202
|
+
}
|
|
13203
|
+
log.error("stream-json: stdout error", { error: String(error) });
|
|
13204
|
+
});
|
|
13205
|
+
return (line) => {
|
|
13206
|
+
try {
|
|
13207
|
+
process.stdout.write(`${line}\n`);
|
|
13208
|
+
} catch (error) {
|
|
13209
|
+
if (error.code === "EPIPE") {
|
|
13210
|
+
handleStdoutClosed();
|
|
13211
|
+
return;
|
|
13212
|
+
}
|
|
13213
|
+
throw error;
|
|
13214
|
+
}
|
|
13215
|
+
};
|
|
13216
|
+
}
|
|
13075
13217
|
async function runStreamJson(opts) {
|
|
13076
13218
|
const homeDir = resolveNexumHome();
|
|
13077
13219
|
const workDir = opts.workDir ?? process.cwd();
|
|
@@ -13092,9 +13234,7 @@ async function runStreamJson(opts) {
|
|
|
13092
13234
|
}
|
|
13093
13235
|
const streamSubagentModels = streamTuiConfig.subagentModels;
|
|
13094
13236
|
harness.setSubagentModelBindings(() => streamSubagentModels);
|
|
13095
|
-
const writer = new ClaudeStreamJsonWriter((
|
|
13096
|
-
process.stdout.write(`${line}\n`);
|
|
13097
|
-
});
|
|
13237
|
+
const writer = new ClaudeStreamJsonWriter(installStdoutEpipeGuard());
|
|
13098
13238
|
let session;
|
|
13099
13239
|
let currentSessionId;
|
|
13100
13240
|
let sessionKey = "cc-connect-main";
|
|
@@ -14549,6 +14689,7 @@ var WebSession = class {
|
|
|
14549
14689
|
const messages = [];
|
|
14550
14690
|
let currentAssistant = null;
|
|
14551
14691
|
let userIndex = 0;
|
|
14692
|
+
let turnCount = 0;
|
|
14552
14693
|
const flushUserMessagesBefore = (seq) => {
|
|
14553
14694
|
while (userIndex < this.userMessages.length) {
|
|
14554
14695
|
const item = this.userMessages[userIndex];
|
|
@@ -14561,23 +14702,39 @@ var WebSession = class {
|
|
|
14561
14702
|
const event = entry.payload;
|
|
14562
14703
|
flushUserMessagesBefore(entry.seq);
|
|
14563
14704
|
switch (event.type) {
|
|
14564
|
-
case "turn.started":
|
|
14565
|
-
|
|
14705
|
+
case "turn.started": {
|
|
14706
|
+
turnCount += 1;
|
|
14707
|
+
const assistant = {
|
|
14566
14708
|
role: "assistant",
|
|
14567
14709
|
content: "",
|
|
14568
|
-
tools: []
|
|
14710
|
+
tools: [],
|
|
14711
|
+
turnStats: {
|
|
14712
|
+
turn: turnCount,
|
|
14713
|
+
step: 0,
|
|
14714
|
+
status: "done",
|
|
14715
|
+
firstTokenMs: null,
|
|
14716
|
+
llmMs: null,
|
|
14717
|
+
toolMs: null,
|
|
14718
|
+
tokens: null,
|
|
14719
|
+
tokensPerSec: null
|
|
14720
|
+
}
|
|
14569
14721
|
};
|
|
14570
|
-
|
|
14722
|
+
currentAssistant = assistant;
|
|
14723
|
+
messages.push(assistant);
|
|
14571
14724
|
break;
|
|
14725
|
+
}
|
|
14572
14726
|
case "assistant.delta":
|
|
14573
14727
|
if (currentAssistant) currentAssistant.content += event.delta;
|
|
14574
14728
|
break;
|
|
14575
14729
|
case "tool.call.started":
|
|
14576
|
-
if (currentAssistant)
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14730
|
+
if (currentAssistant) {
|
|
14731
|
+
currentAssistant.tools.push({
|
|
14732
|
+
toolCallId: event.toolCallId,
|
|
14733
|
+
name: event.name,
|
|
14734
|
+
args: event.args
|
|
14735
|
+
});
|
|
14736
|
+
if (currentAssistant.turnStats) currentAssistant.turnStats.step += 1;
|
|
14737
|
+
}
|
|
14581
14738
|
break;
|
|
14582
14739
|
case "tool.result":
|
|
14583
14740
|
if (currentAssistant) {
|