scream-code 0.13.3 → 0.13.4

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 { $ as toTerminalHyperlink, $t as stringValue, A as highlightLines, An as DEFAULT_CATALOG_URL, At as ENABLE_TERMINAL_THEME_REPORTING, B as AssistantMessageComponent, Bn as isScreamError, Bt as isBusy, C as UserMessageComponent, Cn as getInputHistoryFile, Ct as contrastTextHex, D as ToolCallComponent, Dn as CLI_UI_MODE, Dt as DISABLE_TERMINAL_FOCUS_REPORTING, E as toggleEmptySessionHint, En as CLI_COMMAND_NAME, Et as parseOsc11BackgroundTheme, F as getSharedSpeedTracker, Fn as resolveScreamHome, Ft as QUERY_TERMINAL_THEME, G as resetBreathingClock, Gt as printableChar, H as WelcomeComponent, Hn as ErrorCodes, Ht as FooterComponent, I as SkillActivationComponent, In as MemoryMemoStore, It as TERMINAL_FOCUS_IN, Jt as argsRecord, K as clearGoalState, Kt as STATUS_BULLET, L as ReadGroupComponent, Ln as flushDiagnosticLogs, Lt as TERMINAL_FOCUS_OUT, M as CachedContainer, Mn as saveCatalogCache, Mt as OSC11_RESPONSE, N as ThinkingComponent, Nn as ScreamHarness, Nt as OSC11_RESPONSE_PREFIX, O as renderDiffLines, On as CLI_USER_AGENT_PRODUCT, Ot as DISABLE_TERMINAL_THEME_REPORTING, P as estimateTokens, Pt as OSC11_RESPONSE_PREFIX_NO_ESC, Qt as serializeToolResultOutput, R as parseReadGroupOutput, Rn as log, Rt as TERMINAL_THEME_DARK, Sn as getDataDir, St as createThemeStyles, T as isTurnElapsedEnabled, Tn as detectInstallSource, Tt as detectTerminalTheme, U as BREATHE_CYCLE_MS, Un as SCREAM_ERROR_INFO, V as AgentGroupComponent, Vn as isOrphanedToolCallError, Vt as isStreaming, W as getBreathingFrame, Xt as isTodoItemShape, Yt as formatErrorMessage, Zt as parseStreamingArgs, _ as readUpdateCache, _n as TuiConfigParseError, an as TIP_ROTATION_INTERVAL_MS, at as handleFusionPlanCommand, bn as saveTuiConfig, bt as createEditorTheme, c as isPlanExpandable, cn as getLlmNotSetMessage, dn as BUILTIN_SLASH_COMMANDS, en as truncateErrorMessage, et as changeThinkingLevel, fn as sortSlashCommands, g as refreshUpdateCache, gn as PULSE_WAVE_FRAMES, gt as clearInfoPanelState, h as selectUpdateTarget, hn as PIXEL_PULSE_FRAMES, ht as supportsBalance, i as buildRoleAdditionalText, in as SESSION_TIPS, j as langFromPath, jn as fetchCatalog, jt as OSC11_QUERY, k as renderDiffLinesClustered, kn as PRODUCT_NAME, kt as ENABLE_TERMINAL_FOCUS_REPORTING, l as MoonLoader, ln as getNoActiveSessionMessage, mn as setExperimentalFlags, mt as refreshProviderBalance, n as clearEvalPanelState, nn as EXIT_CONFIRM_WINDOW_MS, o as disposeChildren, on as getCtrlCHint, pn as isExperimentalFlagEnabled, q as refineGoal, qt as appendStreamingArgsPreview, r as openUrl, rn as MAIN_AGENT_ID, s as hasDispose, sn as getCtrlDHint, st as handlePlanCommand, t as dispatchInput, tn as EMPTY_SESSION_HINT_URL, tt as getModelCycleLevel, u as formatMemoryMemoForInjection, un as buildSkillSlashCommands, v as appendJsonlLine, vn as TuiLikePreferencesSchema, w as isEmptySessionHintDismissed, wn as getLogDir, wt as getColorPalette, x as getDaemonInstructions, xn as detectShellEnvironment, xt as createMarkdownTheme, y as readJsonlFile, yn as loadTuiConfig, yt as resolveThemeSync, z as BackgroundAgentStatusComponent, zn as resolveGlobalLogPath, zt as TERMINAL_THEME_LIGHT } from "./dispatch-sa_KwTpz.mjs";
8
- import { a as setLocale, o as t } from "./text-input-dialog-Cwnq9vFO.mjs";
7
+ import { $ as toTerminalHyperlink, $t as parseStreamingArgs, A as highlightLines, An as CLI_USER_AGENT_PRODUCT, At as ENABLE_TERMINAL_THEME_REPORTING, B as AssistantMessageComponent, Bn as log, Bt as isBusy, C as UserMessageComponent, Cn as detectShellEnvironment, Ct as contrastTextHex, D as ToolCallComponent, Dn as detectInstallSource, Dt as DISABLE_TERMINAL_FOCUS_REPORTING, E as toggleEmptySessionHint, En as getLogDir, Et as parseOsc11BackgroundTheme, F as getSharedSpeedTracker, Fn as ScreamHarness, Ft as QUERY_TERMINAL_THEME, G as resetBreathingClock, Gn as SCREAM_ERROR_INFO, H as WelcomeComponent, Hn as isScreamError, Ht as FooterComponent, I as SkillActivationComponent, It as TERMINAL_FOCUS_IN, Jt as STATUS_BULLET, K as clearGoalState, L as ReadGroupComponent, Ln as resolveScreamHome, Lt as TERMINAL_FOCUS_OUT, M as CachedContainer, Mn as DEFAULT_CATALOG_URL, Mt as OSC11_RESPONSE, N as ThinkingComponent, Nn as fetchCatalog, Nt as OSC11_RESPONSE_PREFIX, O as renderDiffLines, On as CLI_COMMAND_NAME, Ot as DISABLE_TERMINAL_THEME_REPORTING, P as estimateTokens, Pn as saveCatalogCache, Pt as OSC11_RESPONSE_PREFIX_NO_ESC, Qt as isTodoItemShape, R as parseReadGroupOutput, Rn as MemoryMemoStore, Rt as TERMINAL_THEME_DARK, Sn as saveTuiConfig, St as createThemeStyles, T as isTurnElapsedEnabled, Tn as getInputHistoryFile, Tt as detectTerminalTheme, U as BREATHE_CYCLE_MS, Un as isOrphanedToolCallError, V as AgentGroupComponent, Vn as resolveGlobalLogPath, Vt as isStreaming, W as getBreathingFrame, Wn as ErrorCodes, Xt as argsRecord, Yt as appendStreamingArgsPreview, Zt as formatErrorMessage, _ as readUpdateCache, _n as PIXEL_PULSE_FRAMES, an as MAIN_AGENT_ID, at as handleFusionPlanCommand, bn as TuiLikePreferencesSchema, bt as createEditorTheme, c as isPlanExpandable, cn as getCtrlCHint, dn as getNoActiveSessionMessage, en as serializeToolResultOutput, et as changeThinkingLevel, fn as buildSkillSlashCommands, g as refreshUpdateCache, gn as setExperimentalFlags, gt as clearInfoPanelState, h as selectUpdateTarget, hn as isExperimentalFlagEnabled, ht as supportsBalance, i as buildRoleAdditionalText, in as EXIT_CONFIRM_WINDOW_MS, j as langFromPath, jn as PRODUCT_NAME, jt as OSC11_QUERY, k as renderDiffLinesClustered, kn as CLI_UI_MODE, kt as ENABLE_TERMINAL_FOCUS_REPORTING, l as MoonLoader, ln as getCtrlDHint, mn as sortSlashCommands, mt as refreshProviderBalance, n as clearEvalPanelState, nn as truncateErrorMessage, o as disposeChildren, on as SESSION_TIPS, pn as BUILTIN_SLASH_COMMANDS, q as refineGoal, qt as printableChar, r as openUrl, rn as EMPTY_SESSION_HINT_URL, s as hasDispose, sn as TIP_ROTATION_INTERVAL_MS, st as handlePlanCommand, t as dispatchInput, tn as stringValue, tt as getModelCycleLevel, u as formatMemoryMemoForInjection, un as getLlmNotSetMessage, v as appendJsonlLine, vn as PULSE_WAVE_FRAMES, w as isEmptySessionHintDismissed, wn as getDataDir, wt as getColorPalette, x as getDaemonInstructions, xn as loadTuiConfig, xt as createMarkdownTheme, y as readJsonlFile, yn as TuiConfigParseError, yt as resolveThemeSync, z as BackgroundAgentStatusComponent, zn as flushDiagnosticLogs, zt as TERMINAL_THEME_LIGHT } from "./dispatch-Dk8_Wqp6.mjs";
8
+ import { a as setLocale, o as t } from "./text-input-dialog-ClcJf9pu.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 SCREAM_BUILD_INFO = {
33
- version: optionalBuildString("0.13.3"),
33
+ version: optionalBuildString("0.13.4"),
34
34
  channel: optionalBuildString(""),
35
35
  commit: optionalBuildString(""),
36
36
  buildTarget: optionalBuildString("darwin-arm64")
@@ -7704,6 +7704,91 @@ const INITIAL_LIVE_PANE = {
7704
7704
  pendingQuestion: null
7705
7705
  };
7706
7706
  //#endregion
7707
+ //#region src/utils/clipboard/clipboard-text.ts
7708
+ /**
7709
+ * Write plain text to the system clipboard with platform-specific commands.
7710
+ *
7711
+ * scream-core's clipboard layer is read-only (clipboard-native / clipboard-image),
7712
+ * so the TUI's "copy selected text" needs its own writer. Used to back the
7713
+ * pi-tui `copySelection` hook — return true/false so the TUI can flash
7714
+ * "Copied!" or "Copy failed".
7715
+ *
7716
+ * Platform mapping:
7717
+ * macOS -> pbcopy
7718
+ * Windows-> powershell Set-Clipboard (base64 payload, avoids quoting issues)
7719
+ * Linux -> wl-copy (Wayland) / xclip -selection clipboard -i (X11)
7720
+ */
7721
+ var ClipboardTextError = class extends Error {
7722
+ constructor(message) {
7723
+ super(message);
7724
+ this.name = "ClipboardTextError";
7725
+ }
7726
+ };
7727
+ const defaultRunCommand = (command, args, input) => {
7728
+ const result = spawnSync(command, args, {
7729
+ input,
7730
+ encoding: "utf8",
7731
+ timeout: 3e3
7732
+ });
7733
+ if (result.status === 0) return { ok: true };
7734
+ return {
7735
+ ok: false,
7736
+ error: result.error?.message ?? result.stderr?.toString() ?? `exit ${result.status}`
7737
+ };
7738
+ };
7739
+ function detectPlatform() {
7740
+ if (process.platform === "darwin") return "macos";
7741
+ if (process.platform === "win32") return "windows";
7742
+ if (process.platform === "linux") return process.env["WAYLAND_DISPLAY"] ? "linux-wayland" : "linux-x11";
7743
+ return "unsupported";
7744
+ }
7745
+ /**
7746
+ * Write `text` to the system clipboard. Throws ClipboardTextError when the
7747
+ * platform is unsupported or the underlying command fails, so callers can
7748
+ * surface a "Copy failed" indicator.
7749
+ */
7750
+ async function writeTextClipboard(text, runCommand = defaultRunCommand) {
7751
+ const platform = detectPlatform();
7752
+ let command;
7753
+ let args;
7754
+ let input;
7755
+ switch (platform) {
7756
+ case "macos":
7757
+ command = "pbcopy";
7758
+ args = [];
7759
+ input = text;
7760
+ break;
7761
+ case "windows": {
7762
+ const base64 = Buffer.from(text, "utf8").toString("base64");
7763
+ command = "powershell";
7764
+ args = [
7765
+ "-NoProfile",
7766
+ "-Command",
7767
+ `[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('${base64}')) | Set-Clipboard`
7768
+ ];
7769
+ input = "";
7770
+ break;
7771
+ }
7772
+ case "linux-wayland":
7773
+ command = "wl-copy";
7774
+ args = [];
7775
+ input = text;
7776
+ break;
7777
+ case "linux-x11":
7778
+ command = "xclip";
7779
+ args = [
7780
+ "-selection",
7781
+ "clipboard",
7782
+ "-i"
7783
+ ];
7784
+ input = text;
7785
+ break;
7786
+ default: throw new ClipboardTextError(`unsupported clipboard platform: ${process.platform}`);
7787
+ }
7788
+ const result = runCommand(command, args, input);
7789
+ if (!result.ok) throw new ClipboardTextError(`failed to copy to clipboard: ${command} ${result.error ?? "unknown error"}`);
7790
+ }
7791
+ //#endregion
7707
7792
  //#region src/tui/utils/render-batcher.ts
7708
7793
  function createRenderBatcher(doRender) {
7709
7794
  let scheduled = false;
@@ -8566,7 +8651,14 @@ function createTUIState(options) {
8566
8651
  const initialAppState = options.initialAppState;
8567
8652
  const theme = createScreamTUIThemeBundle(initialAppState.theme, options.resolvedTheme);
8568
8653
  const terminal = new ProcessTerminal();
8569
- const ui = new TuiAltScreen(terminal);
8654
+ const ui = new TuiAltScreen(terminal, void 0, void 0, { copySelection: async (text) => {
8655
+ try {
8656
+ await writeTextClipboard(text);
8657
+ return true;
8658
+ } catch {
8659
+ return false;
8660
+ }
8661
+ } });
8570
8662
  const uiAny = ui;
8571
8663
  const originalDoRender = uiAny["doRender"].bind(ui);
8572
8664
  let recovering = false;
@@ -9207,6 +9299,7 @@ var SessionManager$1 = class {
9207
9299
  contextTokens: status.contextTokens,
9208
9300
  maxContextTokens: status.maxContextTokens,
9209
9301
  contextUsage: status.contextUsage,
9302
+ ...status.usage?.turnTotal !== void 0 ? { sessionUsage: status.usage.turnTotal } : {},
9210
9303
  sessionTitle: session.summary?.title ?? null,
9211
9304
  goal: goal ? {
9212
9305
  objective: goal.objective,
@@ -11948,12 +12041,14 @@ var ScreamTUI = class {
11948
12041
  Object.assign(this.state.appState, patch);
11949
12042
  const planModeChanged = "planMode" in patch && prevPlanMode !== this.state.appState.planMode;
11950
12043
  const sessionChanged = "sessionId" in patch && this.state.appState.sessionId !== prevSessionId;
11951
- if (sessionChanged) this.state.appState.sessionUsage = {
11952
- inputOther: 0,
11953
- output: 0,
11954
- inputCacheRead: 0,
11955
- inputCacheCreation: 0
11956
- };
12044
+ if (sessionChanged) {
12045
+ if (!("sessionUsage" in patch)) this.state.appState.sessionUsage = {
12046
+ inputOther: 0,
12047
+ output: 0,
12048
+ inputCacheRead: 0,
12049
+ inputCacheCreation: 0
12050
+ };
12051
+ }
11957
12052
  if (planModeChanged || sessionChanged) {
11958
12053
  this.updateEditorBorderHighlight();
11959
12054
  this.state.planModeBanner.setPlanMode(this.state.appState.planMode ?? "off");
@@ -12055,7 +12150,7 @@ var ScreamTUI = class {
12055
12150
  const card = new OnboardingCardComponent({
12056
12151
  colors: this.state.theme.colors,
12057
12152
  onConfigure: () => {
12058
- import("./dispatch-C7WVQ8OE.mjs").then(({ handleConnectCommand }) => handleConnectCommand(this, "")).finally(() => {
12153
+ import("./dispatch-BKrBb5IE.mjs").then(({ handleConnectCommand }) => handleConnectCommand(this, "")).finally(() => {
12059
12154
  this.restoreEditor();
12060
12155
  });
12061
12156
  },
@@ -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 { Ut as handleConnectCommand } from "./dispatch-sa_KwTpz.mjs";
6
+ import { Gt as handleConnectCommand } from "./dispatch-Dk8_Wqp6.mjs";
7
7
  export { handleConnectCommand };