nexum-code 0.13.5 → 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.
@@ -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 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.13.5"),
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, 50 - (Date.now() - this.lastFlushAt));
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) this.onStreamingTextUpdate(this._assistantDraft);
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
- return (output.length > 0 ? output : t("taskviewer.no_output")).split("\n");
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);
@@ -12211,7 +12233,7 @@ var NexumTUI = class {
12211
12233
  this.mountEditorReplacement(new OnboardingCardComponent({
12212
12234
  colors: this.state.theme.colors,
12213
12235
  onConfigure: () => {
12214
- import("./dispatch-BZRbUcV-.mjs").then(({ handleConnectCommand }) => handleConnectCommand(this, "")).finally(() => this.restoreEditor());
12236
+ import("./dispatch-GH0cUcBE.mjs").then(({ handleConnectCommand }) => handleConnectCommand(this, "")).finally(() => this.restoreEditor());
12215
12237
  },
12216
12238
  onSkip: () => this.restoreEditor()
12217
12239
  }));
@@ -13167,6 +13189,31 @@ function mapCcConnectMode(mode) {
13167
13189
  };
13168
13190
  }
13169
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
+ }
13170
13217
  async function runStreamJson(opts) {
13171
13218
  const homeDir = resolveNexumHome();
13172
13219
  const workDir = opts.workDir ?? process.cwd();
@@ -13187,9 +13234,7 @@ async function runStreamJson(opts) {
13187
13234
  }
13188
13235
  const streamSubagentModels = streamTuiConfig.subagentModels;
13189
13236
  harness.setSubagentModelBindings(() => streamSubagentModels);
13190
- const writer = new ClaudeStreamJsonWriter((line) => {
13191
- process.stdout.write(`${line}\n`);
13192
- });
13237
+ const writer = new ClaudeStreamJsonWriter(installStdoutEpipeGuard());
13193
13238
  let session;
13194
13239
  let currentSessionId;
13195
13240
  let sessionKey = "cc-connect-main";