nexum-code 0.14.1 → 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 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";
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.14.1"),
33
+ version: optionalBuildString("0.14.7"),
34
34
  channel: optionalBuildString(""),
35
35
  commit: optionalBuildString(""),
36
36
  buildTarget: optionalBuildString("win32-x64")
@@ -1862,16 +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
- /** 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
- }
1874
- //#endregion
1875
1865
  //#region src/tui/components/messages/status-message.ts
1876
1866
  var StatusMessageComponent = class extends Container {
1877
1867
  constructor(content, colors, color) {
@@ -2445,7 +2435,8 @@ var SessionEventHandler = class {
2445
2435
  tool_call_id: `${subagentId}:${event.toolCallId}`,
2446
2436
  output: serializeToolResultOutput(event.output),
2447
2437
  is_error: event.isError,
2448
- display: event.display
2438
+ display: event.display,
2439
+ message: event.message
2449
2440
  });
2450
2441
  return true;
2451
2442
  case "agent.status.updated": {
@@ -2693,7 +2684,8 @@ var SessionEventHandler = class {
2693
2684
  output: serializeToolResultOutput(event.output),
2694
2685
  is_error: event.isError,
2695
2686
  synthetic: event.synthetic,
2696
- display: event.display
2687
+ display: event.display,
2688
+ message: event.message
2697
2689
  };
2698
2690
  streamingUI.completeToolResult(event.toolCallId, resultData);
2699
2691
  if (canTransitionTo(this.host.state.appState.streamingPhase, "waiting")) this.host.setAppState({ streamingPhase: "waiting" });
@@ -3275,7 +3267,7 @@ function replayBackgroundProjection(background) {
3275
3267
  }
3276
3268
  return { backgroundAgentMetadata };
3277
3269
  }
3278
- function createReplayRenderContext() {
3270
+ function createReplayRenderContext(subagentsByParentToolCall = /* @__PURE__ */ new Map()) {
3279
3271
  return {
3280
3272
  turnIndex: 0,
3281
3273
  stepIndex: 0,
@@ -3287,9 +3279,71 @@ function createReplayRenderContext() {
3287
3279
  toolCalls: /* @__PURE__ */ new Map(),
3288
3280
  completedToolCallIds: /* @__PURE__ */ new Set(),
3289
3281
  skillActivationIds: /* @__PURE__ */ new Set(),
3290
- suppressNextPlanModeOffNotice: false
3282
+ suppressNextPlanModeOffNotice: false,
3283
+ subagentsByParentToolCall
3291
3284
  };
3292
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
+ }
3293
3347
  function limitReplayRecordsByTurn(records, maxTurns) {
3294
3348
  if (maxTurns <= 0) return [];
3295
3349
  const turnStarts = records.flatMap((record, index) => isReplayUserTurnRecord(record) ? [index] : []);
@@ -3328,7 +3382,8 @@ function toolCallFromReplayMessage(rawToolCall, context) {
3328
3382
  name,
3329
3383
  args: parseReplayToolArguments(rawToolCall.arguments),
3330
3384
  step: context.stepIndex,
3331
- turnId: context.currentTurnId
3385
+ turnId: context.currentTurnId,
3386
+ subagent: context.subagentsByParentToolCall.get(id)
3332
3387
  };
3333
3388
  }
3334
3389
  function toolResultOutput(content) {
@@ -3381,6 +3436,7 @@ function isReplayUserTurnRecord(record) {
3381
3436
  case "cron_missed":
3382
3437
  case "hook_result":
3383
3438
  case "injection":
3439
+ case "subagent":
3384
3440
  case "system_trigger": return false;
3385
3441
  }
3386
3442
  }
@@ -3419,13 +3475,14 @@ var SessionReplayRenderer = class {
3419
3475
  async hydrateFromReplay(session) {
3420
3476
  this.host.setAppState({ isReplaying: true });
3421
3477
  try {
3422
- const main = session.getResumeState()?.agents["main"];
3423
- if (main === void 0) {
3478
+ const agents = session.getResumeState()?.agents;
3479
+ const main = agents?.["main"];
3480
+ if (agents === void 0 || main === void 0) {
3424
3481
  this.host.showError(t("replay.history_unavailable"));
3425
3482
  return false;
3426
3483
  }
3427
3484
  this.hydrateSnapshot(main);
3428
- this.renderRecords(main);
3485
+ this.renderRecords(main, agents);
3429
3486
  this.applyTerminalBackgroundAgentStatuses(main);
3430
3487
  return true;
3431
3488
  } catch (error) {
@@ -3490,8 +3547,8 @@ var SessionReplayRenderer = class {
3490
3547
  state.footer.setBackgroundCounts(countActiveBackgroundTasks(sessionEventHandler.backgroundTasks));
3491
3548
  state.ui.requestRender();
3492
3549
  }
3493
- renderRecords(agent) {
3494
- const context = createReplayRenderContext();
3550
+ renderRecords(agent, agents) {
3551
+ const context = createReplayRenderContext(subagentReplaysByParentToolCall(agents, "main"));
3495
3552
  for (const record of limitReplayRecordsByTurn(agent.replay, 10)) this.renderRecord(context, record);
3496
3553
  this.flushAssistant(context);
3497
3554
  this.cleanupRuntime(context);
@@ -3595,7 +3652,8 @@ var SessionReplayRenderer = class {
3595
3652
  const result = {
3596
3653
  tool_call_id: toolCallId,
3597
3654
  output: toolResultOutput(message.content),
3598
- is_error: message.isError
3655
+ is_error: message.isError,
3656
+ message: message.toolResultMessage
3599
3657
  };
3600
3658
  call.result = result;
3601
3659
  this.applyStepContext(context);
@@ -3984,10 +4042,7 @@ var StreamingUIController = class {
3984
4042
  const tokens = estimateTokens(delta);
3985
4043
  if (this.lastDeltaAt !== void 0) {
3986
4044
  const elapsedMs = now - this.lastDeltaAt;
3987
- if (elapsedMs > 0) {
3988
- const rate = tokens / elapsedMs * 1e3;
3989
- getSharedSpeedTracker().observe(rate, now);
3990
- }
4045
+ if (elapsedMs > 0) getSharedSpeedTracker().observe(tokens, elapsedMs, now);
3991
4046
  }
3992
4047
  this.lastDeltaAt = now;
3993
4048
  }
@@ -12233,7 +12288,7 @@ var NexumTUI = class {
12233
12288
  this.mountEditorReplacement(new OnboardingCardComponent({
12234
12289
  colors: this.state.theme.colors,
12235
12290
  onConfigure: () => {
12236
- import("./dispatch-GH0cUcBE.mjs").then(({ handleConnectCommand }) => handleConnectCommand(this, "")).finally(() => this.restoreEditor());
12291
+ import("./dispatch-DDk2X6gp.mjs").then(({ handleConnectCommand }) => handleConnectCommand(this, "")).finally(() => this.restoreEditor());
12237
12292
  },
12238
12293
  onSkip: () => this.restoreEditor()
12239
12294
  }));
@@ -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 { qt as handleConnectCommand } from "./dispatch-B2jPWSmW.mjs";
6
+ import { Yt as handleConnectCommand } from "./dispatch-Dx4JpQB7.mjs";
7
7
  export { handleConnectCommand };