nexum-code 0.13.5 → 0.14.7

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.
@@ -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 isTodoItemShape, A as highlightLines, An as CLI_UI_MODE, At as ENABLE_TERMINAL_FOCUS_REPORTING, B as AssistantMessageComponent, Bn as flushDiagnosticLogs, Bt as TERMINAL_THEME_LIGHT, C as UserMessageComponent, Cn as saveTuiConfig, Ct as createThemeStyles, D as ToolCallComponent, Dn as getLogDir, Dt as parseOsc11BackgroundTheme, E as toggleEmptySessionHint, En as getInputHistoryFile, Et as detectTerminalTheme, F as getSharedSpeedTracker, Fn as saveCatalogCache, Ft as OSC11_RESPONSE_PREFIX_NO_ESC, G as getBreathingFrame, Gn as ErrorCodes, H as WelcomeComponent, Hn as resolveGlobalLogPath, Ht as isStreaming, I as SkillActivationComponent, In as NexumHarness, It as QUERY_TERMINAL_THEME, J as refineGoal, Jt as printableChar, K as resetBreathingClock, Kn as NEXUM_ERROR_INFO, L as ReadGroupComponent, Lt as TERMINAL_FOCUS_IN, M as CachedContainer, Mn as PRODUCT_NAME, Mt as OSC11_QUERY, N as ThinkingComponent, Nn as DEFAULT_CATALOG_URL, Nt as OSC11_RESPONSE, O as renderDiffLines, On as detectInstallSource, Ot as DISABLE_TERMINAL_FOCUS_REPORTING, P as estimateTokens, Pn as fetchCatalog, Pt as OSC11_RESPONSE_PREFIX, Qt as formatErrorMessage, R as parseReadGroupOutput, Rn as resolveNexumHome, Rt as TERMINAL_FOCUS_OUT, Sn as loadTuiConfig, St as createMarkdownTheme, T as isTurnElapsedEnabled, Tn as getDataDir, Tt as getColorPalette, U as NEXUM_CODE_LOGO, Un as isNexumError, Ut as FooterComponent, V as AgentGroupComponent, Vn as log, Vt as isBusy, W as BREATHE_CYCLE_MS, Wn as isOrphanedToolCallError, Xt as appendStreamingArgsPreview, Yt as STATUS_BULLET, Zt as argsRecord, _ as readUpdateCache, _n as setExperimentalFlags, _t as clearInfoPanelState, an as EXIT_CONFIRM_WINDOW_MS, bn as TuiConfigParseError, bt as resolveThemeSync, c as isPlanExpandable, cn as TIP_ROTATION_INTERVAL_MS, ct as handlePlanCommand, dn as getLlmNotSetMessage, en as parseStreamingArgs, et as toTerminalHyperlink, fn as getNoActiveSessionMessage, g as refreshUpdateCache, gn as isExperimentalFlagEnabled, gt as supportsBalance, h as selectUpdateTarget, hn as sortSlashCommands, ht as refreshProviderBalance, i as buildRoleAdditionalText, in as EMPTY_SESSION_HINT_URL, j as langFromPath, jn as CLI_USER_AGENT_PRODUCT, jt as ENABLE_TERMINAL_THEME_REPORTING, k as renderDiffLinesClustered, kn as CLI_COMMAND_NAME, kt as DISABLE_TERMINAL_THEME_REPORTING, l as MoonLoader, ln as getCtrlCHint, mn as BUILTIN_SLASH_COMMANDS, n as clearEvalPanelState, nn as stringValue, nt as getModelCycleLevel, o as disposeChildren, on as MAIN_AGENT_ID, ot as handleFusionPlanCommand, pn as buildSkillSlashCommands, q as clearGoalState, r as openUrl, rn as truncateErrorMessage, s as hasDispose, sn as SESSION_TIPS, t as dispatchInput, tn as serializeToolResultOutput, tt as changeThinkingLevel, u as formatMemoryMemoForInjection, un as getCtrlDHint, v as appendJsonlLine, vn as PIXEL_PULSE_FRAMES, w as isEmptySessionHintDismissed, wn as detectShellEnvironment, wt as contrastTextHex, x as getDaemonInstructions, xn as TuiLikePreferencesSchema, xt as createEditorTheme, y as readJsonlFile, yn as PULSE_WAVE_FRAMES, z as BackgroundAgentStatusComponent, zn as MemoryMemoStore, zt as TERMINAL_THEME_DARK } from "./dispatch-DpQYVKBT.mjs";
8
- import { a as setLocale, o as t } from "./text-input-dialog-Bncn0-6m.mjs";
7
+ import { $t as appendStreamingArgsPreview, A as renderDiffLinesClustered, An as getInputHistoryFile, At as parseOsc11BackgroundTheme, B as BackgroundAgentStatusComponent, Bn as NexumHarness, Bt as TERMINAL_FOCUS_IN, Cn as PULSE_WAVE_FRAMES, Ct as resolveThemeSync, D as toggleEmptySessionHint, Dn as saveTuiConfig, Dt as contrastTextHex, E as isTurnElapsedEnabled, En as loadTuiConfig, Et as createThemeStyles, F as estimateTokens, Fn as CLI_USER_AGENT_PRODUCT, Ft as OSC11_QUERY, G as WelcomeComponent, Gn as log, Gt as isStreaming, H as AgentGroupComponent, Hn as resolveNexumHome, Ht as TERMINAL_THEME_DARK, I as getSharedSpeedTracker, In as PRODUCT_NAME, It as OSC11_RESPONSE, J as getBreathingFrame, Jn as isOrphanedToolCallError, K as NEXUM_CODE_LOGO, Kn as resolveGlobalLogPath, Kt as FooterComponent, L as SkillActivationComponent, Ln as DEFAULT_CATALOG_URL, Lt as OSC11_RESPONSE_PREFIX, M as langFromPath, Mn as detectInstallSource, Mt as DISABLE_TERMINAL_THEME_REPORTING, N as CachedContainer, Nn as CLI_COMMAND_NAME, Nt as ENABLE_TERMINAL_FOCUS_REPORTING, O as ToolCallComponent, On as detectShellEnvironment, Ot as getColorPalette, P as ThinkingComponent, Pn as CLI_UI_MODE, Pt as ENABLE_TERMINAL_THEME_REPORTING, Qt as STATUS_BULLET, R as ReadGroupComponent, Rn as fetchCatalog, Rt as OSC11_RESPONSE_PREFIX_NO_ESC, S as getDaemonInstructions, Sn as PIXEL_PULSE_FRAMES, T as isEmptySessionHintDismissed, Tn as TuiLikePreferencesSchema, Tt as createMarkdownTheme, U as replaceTabs, Un as MemoryMemoStore, Ut as TERMINAL_THEME_LIGHT, V as AssistantMessageComponent, Vt as TERMINAL_FOCUS_OUT, W as sanitizeShellOutput, Wn as flushDiagnosticLogs, Wt as isBusy, X as clearGoalState, Xn as NEXUM_ERROR_INFO, Y as resetBreathingClock, Yn as ErrorCodes, Z as refineGoal, Zt as printableChar, _ as refreshUpdateCache, _n as buildSkillSlashCommands, an as stringValue, at as getModelCycleLevel, b as readJsonlFile, bn as isExperimentalFlagEnabled, bt as clearInfoPanelState, c as hasDispose, cn as EMPTY_SESSION_HINT_URL, d as formatMemoryMemoForInjection, dn as SESSION_TIPS, dt as handlePlanCommand, en as argsRecord, fn as TIP_ROTATION_INTERVAL_MS, g as selectUpdateTarget, gn as getNoActiveSessionMessage, hn as getLlmNotSetMessage, i as buildRoleAdditionalText, in as serializeToolResultOutput, it as changeThinkingLevel, j as highlightLines, jn as getLogDir, jt as DISABLE_TERMINAL_FOCUS_REPORTING, k as renderDiffLines, kn as getDataDir, kt as detectTerminalTheme, l as isPlanExpandable, ln as EXIT_CONFIRM_WINDOW_MS, lt as handleFusionPlanCommand, mn as getCtrlDHint, n as clearEvalPanelState, nn as isTodoItemShape, on as truncateErrorMessage, pn as getCtrlCHint, q as BREATHE_CYCLE_MS, qn as isNexumError, r as openUrl, rn as parseStreamingArgs, rt as toTerminalHyperlink, s as disposeChildren, sn as CHARS_PER_TOKEN, t as dispatchInput, tn as formatErrorMessage, u as MoonLoader, un as MAIN_AGENT_ID, v as readUpdateCache, vn as BUILTIN_SLASH_COMMANDS, vt as refreshProviderBalance, w as UserMessageComponent, wn as TuiConfigParseError, wt as createEditorTheme, xn as setExperimentalFlags, y as appendJsonlLine, yn as sortSlashCommands, yt as supportsBalance, z as parseReadGroupOutput, zn as saveCatalogCache, zt as QUERY_TERMINAL_THEME } from "./dispatch-Dx4JpQB7.mjs";
8
+ import { a as setLocale, o as t } from "./text-input-dialog-DL5a0FC3.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.13.5"),
33
+ version: optionalBuildString("0.14.7"),
34
34
  channel: optionalBuildString(""),
35
35
  commit: optionalBuildString(""),
36
36
  buildTarget: optionalBuildString("win32-x64")
@@ -1862,12 +1862,6 @@ var EditorKeyboardController = class {
1862
1862
  }
1863
1863
  };
1864
1864
  //#endregion
1865
- //#region src/tui/utils/sanitize.ts
1866
- /** Replace tabs with spaces, keeping column alignment. Default tab width 4. */
1867
- function replaceTabs(text, tabWidth = 4) {
1868
- return text.replaceAll(" ", " ".repeat(tabWidth));
1869
- }
1870
- //#endregion
1871
1865
  //#region src/tui/components/messages/status-message.ts
1872
1866
  var StatusMessageComponent = class extends Container {
1873
1867
  constructor(content, colors, color) {
@@ -2441,7 +2435,8 @@ var SessionEventHandler = class {
2441
2435
  tool_call_id: `${subagentId}:${event.toolCallId}`,
2442
2436
  output: serializeToolResultOutput(event.output),
2443
2437
  is_error: event.isError,
2444
- display: event.display
2438
+ display: event.display,
2439
+ message: event.message
2445
2440
  });
2446
2441
  return true;
2447
2442
  case "agent.status.updated": {
@@ -2689,7 +2684,8 @@ var SessionEventHandler = class {
2689
2684
  output: serializeToolResultOutput(event.output),
2690
2685
  is_error: event.isError,
2691
2686
  synthetic: event.synthetic,
2692
- display: event.display
2687
+ display: event.display,
2688
+ message: event.message
2693
2689
  };
2694
2690
  streamingUI.completeToolResult(event.toolCallId, resultData);
2695
2691
  if (canTransitionTo(this.host.state.appState.streamingPhase, "waiting")) this.host.setAppState({ streamingPhase: "waiting" });
@@ -2897,9 +2893,9 @@ var SessionEventHandler = class {
2897
2893
  const { name, purpose } = event.candidate;
2898
2894
  if (name.length === 0) return;
2899
2895
  if (this.promptedSkillCandidates.has(name)) return;
2900
- this.promptedSkillCandidates.add(name);
2901
2896
  const session = this.host.session;
2902
2897
  if (session === void 0) return;
2898
+ this.promptedSkillCandidates.add(name);
2903
2899
  if (this.host.streamingUI.hasActiveTurn()) {
2904
2900
  this.pendingSkillCandidates.push({
2905
2901
  name,
@@ -3271,7 +3267,7 @@ function replayBackgroundProjection(background) {
3271
3267
  }
3272
3268
  return { backgroundAgentMetadata };
3273
3269
  }
3274
- function createReplayRenderContext() {
3270
+ function createReplayRenderContext(subagentsByParentToolCall = /* @__PURE__ */ new Map()) {
3275
3271
  return {
3276
3272
  turnIndex: 0,
3277
3273
  stepIndex: 0,
@@ -3283,9 +3279,71 @@ function createReplayRenderContext() {
3283
3279
  toolCalls: /* @__PURE__ */ new Map(),
3284
3280
  completedToolCallIds: /* @__PURE__ */ new Set(),
3285
3281
  skillActivationIds: /* @__PURE__ */ new Set(),
3286
- suppressNextPlanModeOffNotice: false
3282
+ suppressNextPlanModeOffNotice: false,
3283
+ subagentsByParentToolCall
3287
3284
  };
3288
3285
  }
3286
+ /** Projects persisted child-agent messages onto their parent Agent tool calls. */
3287
+ function subagentReplaysByParentToolCall(agents, parentAgentId) {
3288
+ const builders = /* @__PURE__ */ new Map();
3289
+ for (const [subagentId, agent] of Object.entries(agents)) {
3290
+ if (agent.type !== "sub") continue;
3291
+ let current;
3292
+ for (const record of agent.replay) {
3293
+ if (record.type !== "message") continue;
3294
+ const message = record.message;
3295
+ if (message.role === "user" && message.origin?.kind === "subagent") {
3296
+ const origin = message.origin;
3297
+ if (origin.parentAgentId !== parentAgentId) {
3298
+ current = void 0;
3299
+ continue;
3300
+ }
3301
+ current = builders.get(origin.parentToolCallId);
3302
+ if (current === void 0) {
3303
+ current = {
3304
+ id: subagentId,
3305
+ name: origin.subagentName,
3306
+ text: [],
3307
+ toolCalls: [],
3308
+ toolCallsById: /* @__PURE__ */ new Map()
3309
+ };
3310
+ builders.set(origin.parentToolCallId, current);
3311
+ }
3312
+ continue;
3313
+ }
3314
+ if (current === void 0) continue;
3315
+ if (message.role === "assistant") {
3316
+ current.text.push(contentPartsToText(message.content));
3317
+ for (const rawToolCall of message.toolCalls) {
3318
+ if (current.toolCallsById.has(rawToolCall.id)) continue;
3319
+ const toolCall = {
3320
+ id: rawToolCall.id,
3321
+ name: rawToolCall.name,
3322
+ args: parseReplayToolArguments(rawToolCall.arguments)
3323
+ };
3324
+ current.toolCalls.push(toolCall);
3325
+ current.toolCallsById.set(toolCall.id, toolCall);
3326
+ }
3327
+ continue;
3328
+ }
3329
+ if (message.role !== "tool" || message.toolCallId === void 0) continue;
3330
+ const toolCall = current.toolCallsById.get(message.toolCallId);
3331
+ if (toolCall === void 0) continue;
3332
+ toolCall.result = {
3333
+ tool_call_id: message.toolCallId,
3334
+ output: toolResultOutput(message.content),
3335
+ is_error: message.isError,
3336
+ message: message.toolResultMessage
3337
+ };
3338
+ }
3339
+ }
3340
+ return new Map([...builders].map(([parentToolCallId, builder]) => [parentToolCallId, {
3341
+ id: builder.id,
3342
+ name: builder.name,
3343
+ text: builder.text.join(""),
3344
+ toolCalls: builder.toolCalls
3345
+ }]));
3346
+ }
3289
3347
  function limitReplayRecordsByTurn(records, maxTurns) {
3290
3348
  if (maxTurns <= 0) return [];
3291
3349
  const turnStarts = records.flatMap((record, index) => isReplayUserTurnRecord(record) ? [index] : []);
@@ -3324,7 +3382,8 @@ function toolCallFromReplayMessage(rawToolCall, context) {
3324
3382
  name,
3325
3383
  args: parseReplayToolArguments(rawToolCall.arguments),
3326
3384
  step: context.stepIndex,
3327
- turnId: context.currentTurnId
3385
+ turnId: context.currentTurnId,
3386
+ subagent: context.subagentsByParentToolCall.get(id)
3328
3387
  };
3329
3388
  }
3330
3389
  function toolResultOutput(content) {
@@ -3377,6 +3436,7 @@ function isReplayUserTurnRecord(record) {
3377
3436
  case "cron_missed":
3378
3437
  case "hook_result":
3379
3438
  case "injection":
3439
+ case "subagent":
3380
3440
  case "system_trigger": return false;
3381
3441
  }
3382
3442
  }
@@ -3415,13 +3475,14 @@ var SessionReplayRenderer = class {
3415
3475
  async hydrateFromReplay(session) {
3416
3476
  this.host.setAppState({ isReplaying: true });
3417
3477
  try {
3418
- const main = session.getResumeState()?.agents["main"];
3419
- if (main === void 0) {
3478
+ const agents = session.getResumeState()?.agents;
3479
+ const main = agents?.["main"];
3480
+ if (agents === void 0 || main === void 0) {
3420
3481
  this.host.showError(t("replay.history_unavailable"));
3421
3482
  return false;
3422
3483
  }
3423
3484
  this.hydrateSnapshot(main);
3424
- this.renderRecords(main);
3485
+ this.renderRecords(main, agents);
3425
3486
  this.applyTerminalBackgroundAgentStatuses(main);
3426
3487
  return true;
3427
3488
  } catch (error) {
@@ -3486,8 +3547,8 @@ var SessionReplayRenderer = class {
3486
3547
  state.footer.setBackgroundCounts(countActiveBackgroundTasks(sessionEventHandler.backgroundTasks));
3487
3548
  state.ui.requestRender();
3488
3549
  }
3489
- renderRecords(agent) {
3490
- const context = createReplayRenderContext();
3550
+ renderRecords(agent, agents) {
3551
+ const context = createReplayRenderContext(subagentReplaysByParentToolCall(agents, "main"));
3491
3552
  for (const record of limitReplayRecordsByTurn(agent.replay, 10)) this.renderRecord(context, record);
3492
3553
  this.flushAssistant(context);
3493
3554
  this.cleanupRuntime(context);
@@ -3591,7 +3652,8 @@ var SessionReplayRenderer = class {
3591
3652
  const result = {
3592
3653
  tool_call_id: toolCallId,
3593
3654
  output: toolResultOutput(message.content),
3594
- is_error: message.isError
3655
+ is_error: message.isError,
3656
+ message: message.toolResultMessage
3595
3657
  };
3596
3658
  call.result = result;
3597
3659
  this.applyStepContext(context);
@@ -3927,6 +3989,7 @@ var StreamingUIController = class {
3927
3989
  turnStartAt = 0;
3928
3990
  _currentStep = 0;
3929
3991
  _assistantDraft = "";
3992
+ _shownAssistantLength = 0;
3930
3993
  _thinkingDraft = "";
3931
3994
  lastDeltaAt;
3932
3995
  _thinkingEntry = void 0;
@@ -3979,10 +4042,7 @@ var StreamingUIController = class {
3979
4042
  const tokens = estimateTokens(delta);
3980
4043
  if (this.lastDeltaAt !== void 0) {
3981
4044
  const elapsedMs = now - this.lastDeltaAt;
3982
- if (elapsedMs > 0) {
3983
- const rate = tokens / elapsedMs * 1e3;
3984
- getSharedSpeedTracker().observe(rate, now);
3985
- }
4045
+ if (elapsedMs > 0) getSharedSpeedTracker().observe(tokens, elapsedMs, now);
3986
4046
  }
3987
4047
  this.lastDeltaAt = now;
3988
4048
  }
@@ -4000,6 +4060,7 @@ var StreamingUIController = class {
4000
4060
  }
4001
4061
  clearAssistantDraft() {
4002
4062
  this._assistantDraft = "";
4063
+ this._shownAssistantLength = 0;
4003
4064
  }
4004
4065
  getActiveToolCall(id) {
4005
4066
  return this._activeToolCalls.get(id);
@@ -4182,7 +4243,7 @@ var StreamingUIController = class {
4182
4243
  }
4183
4244
  }
4184
4245
  hasPending() {
4185
- return this.pendingAssistantFlush || this.pendingThinkingFlush || this.pendingToolCallFlushIds.size > 0;
4246
+ return this.pendingAssistantFlush || this.pendingThinkingFlush || this.pendingToolCallFlushIds.size > 0 || this._shownAssistantLength < this._assistantDraft.length;
4186
4247
  }
4187
4248
  clearFlushTimer() {
4188
4249
  if (this.flushTimer === void 0) return;
@@ -4199,10 +4260,10 @@ var StreamingUIController = class {
4199
4260
  this.pendingThinkingFlush = false;
4200
4261
  this.pendingToolCallFlushIds.clear();
4201
4262
  }
4202
- scheduleFlush() {
4263
+ scheduleFlush(frameMs = 50) {
4203
4264
  if (!this.hasPending()) return;
4204
4265
  if (this.flushTimer !== void 0) return;
4205
- const delay = this.lastFlushAt === void 0 ? 0 : Math.max(0, 50 - (Date.now() - this.lastFlushAt));
4266
+ const delay = this.lastFlushAt === void 0 ? 0 : Math.max(0, frameMs - (Date.now() - this.lastFlushAt));
4206
4267
  this.flushTimer = setTimeout(() => {
4207
4268
  this.flushTimer = void 0;
4208
4269
  this.flush();
@@ -4222,8 +4283,19 @@ var StreamingUIController = class {
4222
4283
  this.pendingAssistantFlush = false;
4223
4284
  this.pendingToolCallFlushIds.clear();
4224
4285
  if (shouldFlushThinking && this._thinkingDraft.length > 0) this.onThinkingUpdate(this._thinkingDraft);
4225
- if (shouldFlushAssistant) this.onStreamingTextUpdate(this._assistantDraft);
4286
+ if (shouldFlushAssistant || this._shownAssistantLength < this._assistantDraft.length) {
4287
+ const shown = this.advanceAssistantShown();
4288
+ if (shown > 0) this.onStreamingTextUpdate(this._assistantDraft.slice(0, shown));
4289
+ }
4226
4290
  for (const id of toolCallIds) this.flushToolCallPreview(id);
4291
+ if (this._shownAssistantLength < this._assistantDraft.length) this.scheduleFlush(50);
4292
+ }
4293
+ advanceAssistantShown() {
4294
+ if (this._shownAssistantLength >= this._assistantDraft.length) return this._shownAssistantLength;
4295
+ const measured = getSharedSpeedTracker().getSpeed();
4296
+ const budget = Math.min(25, Math.max(1, Math.ceil((measured > 0 ? measured : 50) * (50 / 1e3) * CHARS_PER_TOKEN)));
4297
+ this._shownAssistantLength = Math.min(this._assistantDraft.length, this._shownAssistantLength + budget);
4298
+ return this._shownAssistantLength;
4227
4299
  }
4228
4300
  markAssistantDirty() {
4229
4301
  this.pendingAssistantFlush = true;
@@ -4237,17 +4309,21 @@ var StreamingUIController = class {
4237
4309
  this.onThinkingEnd();
4238
4310
  }
4239
4311
  finalizeAssistantStream() {
4312
+ if (this._shownAssistantLength < this._assistantDraft.length) this._shownAssistantLength = this._assistantDraft.length;
4313
+ this.pendingAssistantFlush = true;
4240
4314
  this.flushNow();
4241
4315
  if (this._streamingBlock !== null) this.onStreamingTextEnd();
4242
4316
  this._assistantDraft = "";
4317
+ this._shownAssistantLength = 0;
4243
4318
  this.host.updateActivityPane();
4244
4319
  this.host.state.ui.requestRender();
4245
4320
  }
4246
4321
  resetLiveText() {
4247
4322
  this.pendingAssistantFlush = false;
4248
4323
  this.pendingThinkingFlush = false;
4249
- this.clearFlushTimerIfIdle();
4250
4324
  this._assistantDraft = "";
4325
+ this._shownAssistantLength = 0;
4326
+ this.clearFlushTimerIfIdle();
4251
4327
  this._streamingBlock = null;
4252
4328
  this._thinkingDraft = "";
4253
4329
  this.lastDeltaAt = void 0;
@@ -4787,7 +4863,8 @@ var TaskOutputViewer = class extends Container {
4787
4863
  this.invalidate();
4788
4864
  }
4789
4865
  splitOutput(output) {
4790
- return (output.length > 0 ? output : t("taskviewer.no_output")).split("\n");
4866
+ const sanitized = sanitizeShellOutput(output);
4867
+ return (sanitized.length > 0 ? sanitized : t("taskviewer.no_output")).split("\n");
4791
4868
  }
4792
4869
  handleInput(data) {
4793
4870
  const visible = this.viewableRows();
@@ -5295,7 +5372,7 @@ var TasksBrowserApp = class extends Container {
5295
5372
  let body;
5296
5373
  if (this.props.tailLoading) body = "[loading…]";
5297
5374
  else if (this.props.tailOutput === void 0 || this.props.tailOutput.length === 0) body = "[no output captured]";
5298
- else body = this.props.tailOutput;
5375
+ else body = sanitizeShellOutput(this.props.tailOutput);
5299
5376
  const styled = body.split("\n").slice(-innerHeight).map((line) => chalk.hex(colors.textDim)(line));
5300
5377
  while (styled.length < innerHeight) styled.push("");
5301
5378
  return this.renderFrame("Preview Output", styled, width, height);
@@ -12211,7 +12288,7 @@ var NexumTUI = class {
12211
12288
  this.mountEditorReplacement(new OnboardingCardComponent({
12212
12289
  colors: this.state.theme.colors,
12213
12290
  onConfigure: () => {
12214
- import("./dispatch-BZRbUcV-.mjs").then(({ handleConnectCommand }) => handleConnectCommand(this, "")).finally(() => this.restoreEditor());
12291
+ import("./dispatch-DDk2X6gp.mjs").then(({ handleConnectCommand }) => handleConnectCommand(this, "")).finally(() => this.restoreEditor());
12215
12292
  },
12216
12293
  onSkip: () => this.restoreEditor()
12217
12294
  }));
@@ -13167,6 +13244,31 @@ function mapCcConnectMode(mode) {
13167
13244
  };
13168
13245
  }
13169
13246
  }
13247
+ /** Exit quietly when cc-connect closes the stdout pipe during restart. */
13248
+ function installStdoutEpipeGuard() {
13249
+ const handleStdoutClosed = () => {
13250
+ log.debug("stream-json: stdout closed (EPIPE), exiting");
13251
+ process.exit(0);
13252
+ };
13253
+ process.stdout.on("error", (error) => {
13254
+ if (error.code === "EPIPE") {
13255
+ handleStdoutClosed();
13256
+ return;
13257
+ }
13258
+ log.error("stream-json: stdout error", { error: String(error) });
13259
+ });
13260
+ return (line) => {
13261
+ try {
13262
+ process.stdout.write(`${line}\n`);
13263
+ } catch (error) {
13264
+ if (error.code === "EPIPE") {
13265
+ handleStdoutClosed();
13266
+ return;
13267
+ }
13268
+ throw error;
13269
+ }
13270
+ };
13271
+ }
13170
13272
  async function runStreamJson(opts) {
13171
13273
  const homeDir = resolveNexumHome();
13172
13274
  const workDir = opts.workDir ?? process.cwd();
@@ -13187,9 +13289,7 @@ async function runStreamJson(opts) {
13187
13289
  }
13188
13290
  const streamSubagentModels = streamTuiConfig.subagentModels;
13189
13291
  harness.setSubagentModelBindings(() => streamSubagentModels);
13190
- const writer = new ClaudeStreamJsonWriter((line) => {
13191
- process.stdout.write(`${line}\n`);
13192
- });
13292
+ const writer = new ClaudeStreamJsonWriter(installStdoutEpipeGuard());
13193
13293
  let session;
13194
13294
  let currentSessionId;
13195
13295
  let sessionKey = "cc-connect-main";
@@ -3,5 +3,5 @@ import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
3
3
  import { dirname as __cjsShimDirname } from 'node:path';
4
4
  const __filename = __cjsShimFileURLToPath(import.meta.url);
5
5
  const __dirname = __cjsShimDirname(__filename);
6
- import { Kt as handleConnectCommand } from "./dispatch-DpQYVKBT.mjs";
6
+ import { Yt as handleConnectCommand } from "./dispatch-Dx4JpQB7.mjs";
7
7
  export { handleConnectCommand };