nexum-code 0.13.3 → 0.13.5

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,7 +4,7 @@ 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 serializeToolResultOutput, A as highlightLines, An as PRODUCT_NAME, At as ENABLE_TERMINAL_FOCUS_REPORTING, B as AssistantMessageComponent, Bn as resolveGlobalLogPath, Bt as TERMINAL_THEME_LIGHT, C as UserMessageComponent, Cn as getDataDir, Ct as createThemeStyles, D as ToolCallComponent, Dn as CLI_COMMAND_NAME, Dt as parseOsc11BackgroundTheme, E as toggleEmptySessionHint, En as detectInstallSource, Et as detectTerminalTheme, F as getSharedSpeedTracker, Ft as OSC11_RESPONSE_PREFIX_NO_ESC, G as getBreathingFrame, H as WelcomeComponent, Hn as isOrphanedToolCallError, Ht as isStreaming, I as SkillActivationComponent, In as resolveNexumHome, It as QUERY_TERMINAL_THEME, J as refineGoal, Jt as appendStreamingArgsPreview, K as resetBreathingClock, Kt as printableChar, L as ReadGroupComponent, Ln as MemoryMemoStore, Lt as TERMINAL_FOCUS_IN, M as CachedContainer, Mn as fetchCatalog, Mt as OSC11_QUERY, N as ThinkingComponent, Nn as saveCatalogCache, Nt as OSC11_RESPONSE, O as renderDiffLines, On as CLI_UI_MODE, Ot as DISABLE_TERMINAL_FOCUS_REPORTING, P as estimateTokens, Pn as NexumHarness, Pt as OSC11_RESPONSE_PREFIX, Qt as parseStreamingArgs, R as parseReadGroupOutput, Rn as flushDiagnosticLogs, Rt as TERMINAL_FOCUS_OUT, Sn as detectShellEnvironment, St as createMarkdownTheme, T as isTurnElapsedEnabled, Tn as getLogDir, Tt as getColorPalette, U as NEXUM_CODE_LOGO, Un as ErrorCodes, Ut as FooterComponent, V as AgentGroupComponent, Vn as isNexumError, Vt as isBusy, W as BREATHE_CYCLE_MS, Wn as NEXUM_ERROR_INFO, Xt as formatErrorMessage, Yt as argsRecord, Zt as isTodoItemShape, _ as readUpdateCache, _n as PULSE_WAVE_FRAMES, _t as clearInfoPanelState, an as SESSION_TIPS, bn as loadTuiConfig, bt as resolveThemeSync, c as isPlanExpandable, cn as getCtrlDHint, ct as handlePlanCommand, dn as buildSkillSlashCommands, en as stringValue, et as toTerminalHyperlink, fn as BUILTIN_SLASH_COMMANDS, g as refreshUpdateCache, gn as PIXEL_PULSE_FRAMES, gt as supportsBalance, h as selectUpdateTarget, hn as setExperimentalFlags, ht as refreshProviderBalance, i as buildRoleAdditionalText, in as MAIN_AGENT_ID, j as langFromPath, jn as DEFAULT_CATALOG_URL, jt as ENABLE_TERMINAL_THEME_REPORTING, k as renderDiffLinesClustered, kn as CLI_USER_AGENT_PRODUCT, kt as DISABLE_TERMINAL_THEME_REPORTING, l as MoonLoader, ln as getLlmNotSetMessage, mn as isExperimentalFlagEnabled, n as clearEvalPanelState, nn as EMPTY_SESSION_HINT_URL, nt as getModelCycleLevel, o as disposeChildren, on as TIP_ROTATION_INTERVAL_MS, ot as handleFusionPlanCommand, pn as sortSlashCommands, q as clearGoalState, qt as STATUS_BULLET, r as openUrl, rn as EXIT_CONFIRM_WINDOW_MS, s as hasDispose, sn as getCtrlCHint, t as dispatchInput, tn as truncateErrorMessage, tt as changeThinkingLevel, u as formatMemoryMemoForInjection, un as getNoActiveSessionMessage, v as appendJsonlLine, vn as TuiConfigParseError, w as isEmptySessionHintDismissed, wn as getInputHistoryFile, wt as contrastTextHex, x as getDaemonInstructions, xn as saveTuiConfig, xt as createEditorTheme, y as readJsonlFile, yn as TuiLikePreferencesSchema, z as BackgroundAgentStatusComponent, zn as log, zt as TERMINAL_THEME_DARK } from "./dispatch-xaiGN5VV.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
8
  import { a as setLocale, o as t } from "./text-input-dialog-Bncn0-6m.mjs";
9
9
  import { createRequire } from "node:module";
10
10
  import { randomUUID } from "node:crypto";
@@ -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.3"),
33
+ version: optionalBuildString("0.13.5"),
34
34
  channel: optionalBuildString(""),
35
35
  commit: optionalBuildString(""),
36
36
  buildTarget: optionalBuildString("win32-x64")
@@ -7698,6 +7698,91 @@ const INITIAL_LIVE_PANE = {
7698
7698
  pendingQuestion: null
7699
7699
  };
7700
7700
  //#endregion
7701
+ //#region src/utils/clipboard/clipboard-text.ts
7702
+ /**
7703
+ * Write plain text to the system clipboard with platform-specific commands.
7704
+ *
7705
+ * nexum-core's clipboard layer is read-only (clipboard-native / clipboard-image),
7706
+ * so the TUI's "copy selected text" needs its own writer. Used to back the
7707
+ * pi-tui `copySelection` hook — return true/false so the TUI can flash
7708
+ * "Copied!" or "Copy failed".
7709
+ *
7710
+ * Platform mapping:
7711
+ * macOS -> pbcopy
7712
+ * Windows-> powershell Set-Clipboard (base64 payload, avoids quoting issues)
7713
+ * Linux -> wl-copy (Wayland) / xclip -selection clipboard -i (X11)
7714
+ */
7715
+ var ClipboardTextError = class extends Error {
7716
+ constructor(message) {
7717
+ super(message);
7718
+ this.name = "ClipboardTextError";
7719
+ }
7720
+ };
7721
+ const defaultRunCommand = (command, args, input) => {
7722
+ const result = spawnSync(command, args, {
7723
+ input,
7724
+ encoding: "utf8",
7725
+ timeout: 3e3
7726
+ });
7727
+ if (result.status === 0) return { ok: true };
7728
+ return {
7729
+ ok: false,
7730
+ error: result.error?.message ?? result.stderr?.toString() ?? `exit ${result.status}`
7731
+ };
7732
+ };
7733
+ function detectPlatform() {
7734
+ if (process.platform === "darwin") return "macos";
7735
+ if (process.platform === "win32") return "windows";
7736
+ if (process.platform === "linux") return process.env["WAYLAND_DISPLAY"] ? "linux-wayland" : "linux-x11";
7737
+ return "unsupported";
7738
+ }
7739
+ /**
7740
+ * Write `text` to the system clipboard. Throws ClipboardTextError when the
7741
+ * platform is unsupported or the underlying command fails, so callers can
7742
+ * surface a "Copy failed" indicator.
7743
+ */
7744
+ async function writeTextClipboard(text, runCommand = defaultRunCommand) {
7745
+ const platform = detectPlatform();
7746
+ let command;
7747
+ let args;
7748
+ let input;
7749
+ switch (platform) {
7750
+ case "macos":
7751
+ command = "pbcopy";
7752
+ args = [];
7753
+ input = text;
7754
+ break;
7755
+ case "windows": {
7756
+ const base64 = Buffer.from(text, "utf8").toString("base64");
7757
+ command = "powershell";
7758
+ args = [
7759
+ "-NoProfile",
7760
+ "-Command",
7761
+ `[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('${base64}')) | Set-Clipboard`
7762
+ ];
7763
+ input = "";
7764
+ break;
7765
+ }
7766
+ case "linux-wayland":
7767
+ command = "wl-copy";
7768
+ args = [];
7769
+ input = text;
7770
+ break;
7771
+ case "linux-x11":
7772
+ command = "xclip";
7773
+ args = [
7774
+ "-selection",
7775
+ "clipboard",
7776
+ "-i"
7777
+ ];
7778
+ input = text;
7779
+ break;
7780
+ default: throw new ClipboardTextError(`unsupported clipboard platform: ${process.platform}`);
7781
+ }
7782
+ const result = runCommand(command, args, input);
7783
+ if (!result.ok) throw new ClipboardTextError(`failed to copy to clipboard: ${command} ${result.error ?? "unknown error"}`);
7784
+ }
7785
+ //#endregion
7701
7786
  //#region src/tui/utils/render-batcher.ts
7702
7787
  function createRenderBatcher(doRender) {
7703
7788
  let scheduled = false;
@@ -8556,7 +8641,14 @@ function createTUIState(options) {
8556
8641
  const initialAppState = options.initialAppState;
8557
8642
  const theme = createNexumTUIThemeBundle(initialAppState.theme, options.resolvedTheme);
8558
8643
  const terminal = new ProcessTerminal();
8559
- const ui = new TuiAltScreen(terminal);
8644
+ const ui = new TuiAltScreen(terminal, void 0, void 0, { copySelection: async (text) => {
8645
+ try {
8646
+ await writeTextClipboard(text);
8647
+ return true;
8648
+ } catch {
8649
+ return false;
8650
+ }
8651
+ } });
8560
8652
  const uiAny = ui;
8561
8653
  const originalDoRender = uiAny["doRender"].bind(ui);
8562
8654
  let recovering = false;
@@ -9198,6 +9290,7 @@ var SessionManager$1 = class {
9198
9290
  contextTokens: status.contextTokens,
9199
9291
  maxContextTokens: status.maxContextTokens,
9200
9292
  contextUsage: status.contextUsage,
9293
+ ...status.usage?.turnTotal !== void 0 ? { sessionUsage: status.usage.turnTotal } : {},
9201
9294
  sessionTitle: session.summary?.title ?? null,
9202
9295
  goal: goal ? {
9203
9296
  objective: goal.objective,
@@ -11935,12 +12028,14 @@ var NexumTUI = class {
11935
12028
  Object.assign(this.state.appState, patch);
11936
12029
  const planModeChanged = "planMode" in patch && prevPlanMode !== this.state.appState.planMode;
11937
12030
  const sessionChanged = "sessionId" in patch && this.state.appState.sessionId !== prevSessionId;
11938
- if (sessionChanged) this.state.appState.sessionUsage = {
11939
- inputOther: 0,
11940
- output: 0,
11941
- inputCacheRead: 0,
11942
- inputCacheCreation: 0
11943
- };
12031
+ if (sessionChanged) {
12032
+ if (!("sessionUsage" in patch)) this.state.appState.sessionUsage = {
12033
+ inputOther: 0,
12034
+ output: 0,
12035
+ inputCacheRead: 0,
12036
+ inputCacheCreation: 0
12037
+ };
12038
+ }
11944
12039
  if (planModeChanged || sessionChanged) {
11945
12040
  this.updateEditorBorderHighlight();
11946
12041
  this.state.planModeBanner.setPlanMode(this.state.appState.planMode ?? "off");
@@ -12116,7 +12211,7 @@ var NexumTUI = class {
12116
12211
  this.mountEditorReplacement(new OnboardingCardComponent({
12117
12212
  colors: this.state.theme.colors,
12118
12213
  onConfigure: () => {
12119
- import("./dispatch-KEOSyNQQ.mjs").then(({ handleConnectCommand }) => handleConnectCommand(this, "")).finally(() => this.restoreEditor());
12214
+ import("./dispatch-BZRbUcV-.mjs").then(({ handleConnectCommand }) => handleConnectCommand(this, "")).finally(() => this.restoreEditor());
12120
12215
  },
12121
12216
  onSkip: () => this.restoreEditor()
12122
12217
  }));
@@ -14549,6 +14644,7 @@ var WebSession = class {
14549
14644
  const messages = [];
14550
14645
  let currentAssistant = null;
14551
14646
  let userIndex = 0;
14647
+ let turnCount = 0;
14552
14648
  const flushUserMessagesBefore = (seq) => {
14553
14649
  while (userIndex < this.userMessages.length) {
14554
14650
  const item = this.userMessages[userIndex];
@@ -14561,23 +14657,39 @@ var WebSession = class {
14561
14657
  const event = entry.payload;
14562
14658
  flushUserMessagesBefore(entry.seq);
14563
14659
  switch (event.type) {
14564
- case "turn.started":
14565
- currentAssistant = {
14660
+ case "turn.started": {
14661
+ turnCount += 1;
14662
+ const assistant = {
14566
14663
  role: "assistant",
14567
14664
  content: "",
14568
- tools: []
14665
+ tools: [],
14666
+ turnStats: {
14667
+ turn: turnCount,
14668
+ step: 0,
14669
+ status: "done",
14670
+ firstTokenMs: null,
14671
+ llmMs: null,
14672
+ toolMs: null,
14673
+ tokens: null,
14674
+ tokensPerSec: null
14675
+ }
14569
14676
  };
14570
- messages.push(currentAssistant);
14677
+ currentAssistant = assistant;
14678
+ messages.push(assistant);
14571
14679
  break;
14680
+ }
14572
14681
  case "assistant.delta":
14573
14682
  if (currentAssistant) currentAssistant.content += event.delta;
14574
14683
  break;
14575
14684
  case "tool.call.started":
14576
- if (currentAssistant) currentAssistant.tools.push({
14577
- toolCallId: event.toolCallId,
14578
- name: event.name,
14579
- args: event.args
14580
- });
14685
+ if (currentAssistant) {
14686
+ currentAssistant.tools.push({
14687
+ toolCallId: event.toolCallId,
14688
+ name: event.name,
14689
+ args: event.args
14690
+ });
14691
+ if (currentAssistant.turnStats) currentAssistant.turnStats.step += 1;
14692
+ }
14581
14693
  break;
14582
14694
  case "tool.result":
14583
14695
  if (currentAssistant) {
@@ -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 { Wt as handleConnectCommand } from "./dispatch-xaiGN5VV.mjs";
6
+ import { Kt as handleConnectCommand } from "./dispatch-DpQYVKBT.mjs";
7
7
  export { handleConnectCommand };