@builder.io/buildercode 0.4.4 → 0.4.6

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +887 -668
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -44471,8 +44471,12 @@ function App$1({ children, stdin, stdout, stderr, writeToStdout, writeToStderr,
44471
44471
  handleExit();
44472
44472
  return;
44473
44473
  }
44474
- if (input === escape$3) setActiveFocusId(void 0);
44475
- }, [exitOnCtrlC, handleExit]);
44474
+ if (input === escape$3 && isFocusEnabled) setActiveFocusId(void 0);
44475
+ }, [
44476
+ exitOnCtrlC,
44477
+ handleExit,
44478
+ isFocusEnabled
44479
+ ]);
44476
44480
  const emitInput = (0, import_react.useCallback)((input) => {
44477
44481
  handleInput(input);
44478
44482
  internal_eventEmitter.current.emit("input", input);
@@ -45767,6 +45771,10 @@ const parseKeypress = (s = "") => {
45767
45771
  };
45768
45772
  //#endregion
45769
45773
  //#region ../../node_modules/ink/build/hooks/use-stdin.js
45774
+ /**
45775
+ A React hook that returns the stdin stream and stdin-related utilities.
45776
+ */
45777
+ const useStdin = () => (0, import_react.useContext)(StdinContext);
45770
45778
  const useStdinContext = () => (0, import_react.useContext)(StdinContext);
45771
45779
  //#endregion
45772
45780
  //#region ../../node_modules/ink/build/hooks/use-input.js
@@ -45916,6 +45924,70 @@ A React hook that returns the stdout stream where Ink renders your app.
45916
45924
  */
45917
45925
  const useStdout = () => (0, import_react.useContext)(StdoutContext);
45918
45926
  //#endregion
45927
+ //#region ../../node_modules/ink/build/hooks/use-focus.js
45928
+ /**
45929
+ A React hook that returns focus state and focus controls for the current component.
45930
+ A component that uses the `useFocus` hook becomes "focusable" to Ink, so when the user presses <kbd>Tab</kbd>, Ink will switch focus to this component. If there are multiple components that execute the `useFocus` hook, focus will be given to them in the order in which these components are rendered.
45931
+ */
45932
+ const useFocus = ({ isActive = true, autoFocus = false, id: customId } = {}) => {
45933
+ const { isRawModeSupported, setRawMode } = useStdin();
45934
+ const { activeId, add, remove, activate, deactivate, focus } = (0, import_react.useContext)(FocusContext);
45935
+ const id = (0, import_react.useMemo)(() => {
45936
+ return customId ?? Math.random().toString().slice(2, 7);
45937
+ }, [customId]);
45938
+ (0, import_react.useEffect)(() => {
45939
+ add(id, { autoFocus });
45940
+ return () => {
45941
+ remove(id);
45942
+ };
45943
+ }, [
45944
+ id,
45945
+ autoFocus,
45946
+ add,
45947
+ remove
45948
+ ]);
45949
+ (0, import_react.useEffect)(() => {
45950
+ if (isActive) activate(id);
45951
+ else deactivate(id);
45952
+ }, [
45953
+ isActive,
45954
+ id,
45955
+ activate,
45956
+ deactivate
45957
+ ]);
45958
+ (0, import_react.useEffect)(() => {
45959
+ if (!isRawModeSupported || !isActive) return;
45960
+ setRawMode(true);
45961
+ return () => {
45962
+ setRawMode(false);
45963
+ };
45964
+ }, [
45965
+ isActive,
45966
+ isRawModeSupported,
45967
+ setRawMode
45968
+ ]);
45969
+ return {
45970
+ isFocused: Boolean(id) && activeId === id,
45971
+ focus
45972
+ };
45973
+ };
45974
+ //#endregion
45975
+ //#region ../../node_modules/ink/build/hooks/use-focus-manager.js
45976
+ /**
45977
+ A React hook that returns methods to enable or disable focus management for all components or manually switch focus to the next or previous components.
45978
+ */
45979
+ const useFocusManager = () => {
45980
+ const focusContext = (0, import_react.useContext)(FocusContext);
45981
+ return {
45982
+ enableFocus: focusContext.enableFocus,
45983
+ disableFocus: focusContext.disableFocus,
45984
+ focusNext: focusContext.focusNext,
45985
+ focusPrevious: focusContext.focusPrevious,
45986
+ focus: focusContext.focus,
45987
+ activeId: focusContext.activeId
45988
+ };
45989
+ };
45990
+ //#endregion
45919
45991
  //#region ../../node_modules/ink/build/hooks/use-animation.js
45920
45992
  const defaultAnimationInterval = 100;
45921
45993
  const maximumTimerInterval = 2147483647;
@@ -54110,9 +54182,9 @@ var init_platform = __esmMin((() => {
54110
54182
  }));
54111
54183
  //#endregion
54112
54184
  //#region ../../node_modules/@opentelemetry/api/build/esm/version.js
54113
- var VERSION$5;
54185
+ var VERSION$6;
54114
54186
  var init_version = __esmMin((() => {
54115
- VERSION$5 = "1.9.0";
54187
+ VERSION$6 = "1.9.0";
54116
54188
  }));
54117
54189
  //#endregion
54118
54190
  //#region ../../node_modules/@opentelemetry/api/build/esm/internal/semver.js
@@ -54181,26 +54253,26 @@ var re$7, isCompatible;
54181
54253
  var init_semver = __esmMin((() => {
54182
54254
  init_version();
54183
54255
  re$7 = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
54184
- isCompatible = _makeCompatibilityCheck(VERSION$5);
54256
+ isCompatible = _makeCompatibilityCheck(VERSION$6);
54185
54257
  }));
54186
54258
  //#endregion
54187
54259
  //#region ../../node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
54188
54260
  function registerGlobal(type, instance, diag, allowOverride) {
54189
54261
  var _a;
54190
54262
  if (allowOverride === void 0) allowOverride = false;
54191
- var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : { version: VERSION$5 };
54263
+ var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : { version: VERSION$6 };
54192
54264
  if (!allowOverride && api[type]) {
54193
54265
  var err = /* @__PURE__ */ new Error("@opentelemetry/api: Attempted duplicate registration of API: " + type);
54194
54266
  diag.error(err.stack || err.message);
54195
54267
  return false;
54196
54268
  }
54197
54269
  if (api.version !== "1.9.0") {
54198
- var err = /* @__PURE__ */ new Error("@opentelemetry/api: Registration of version v" + api.version + " for " + type + " does not match previously registered API v" + VERSION$5);
54270
+ var err = /* @__PURE__ */ new Error("@opentelemetry/api: Registration of version v" + api.version + " for " + type + " does not match previously registered API v" + VERSION$6);
54199
54271
  diag.error(err.stack || err.message);
54200
54272
  return false;
54201
54273
  }
54202
54274
  api[type] = instance;
54203
- diag.debug("@opentelemetry/api: Registered a global for " + type + " v" + VERSION$5 + ".");
54275
+ diag.debug("@opentelemetry/api: Registered a global for " + type + " v" + VERSION$6 + ".");
54204
54276
  return true;
54205
54277
  }
54206
54278
  function getGlobal(type) {
@@ -54210,7 +54282,7 @@ function getGlobal(type) {
54210
54282
  return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];
54211
54283
  }
54212
54284
  function unregisterGlobal(type, diag) {
54213
- diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + VERSION$5 + ".");
54285
+ diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + VERSION$6 + ".");
54214
54286
  var api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
54215
54287
  if (api) delete api[type];
54216
54288
  }
@@ -54219,7 +54291,7 @@ var init_global_utils = __esmMin((() => {
54219
54291
  init_platform();
54220
54292
  init_version();
54221
54293
  init_semver();
54222
- major = VERSION$5.split(".")[0];
54294
+ major = VERSION$6.split(".")[0];
54223
54295
  GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
54224
54296
  _global = _globalThis;
54225
54297
  }));
@@ -87613,8 +87685,8 @@ var package_default$3 = {
87613
87685
  },
87614
87686
  sideEffects: false
87615
87687
  };
87616
- var VERSION$1 = package_default$3.version;
87617
- var majorVersion = VERSION$1.split(".")[0];
87688
+ var VERSION$2 = package_default$3.version;
87689
+ var majorVersion = VERSION$2.split(".")[0];
87618
87690
  var GLOBAL_INSTRUMENTATION_ACCESSOR_KEY = "PRISMA_INSTRUMENTATION";
87619
87691
  var GLOBAL_VERSIONED_INSTRUMENTATION_ACCESSOR_KEY = `V${majorVersion}_PRISMA_INSTRUMENTATION`;
87620
87692
  var NAME = package_default$3.name;
@@ -87622,13 +87694,13 @@ var MODULE_NAME = "@prisma/client";
87622
87694
  var PrismaInstrumentation = class extends import_src$11.InstrumentationBase {
87623
87695
  tracerProvider;
87624
87696
  constructor(config = {}) {
87625
- super(NAME, VERSION$1, config);
87697
+ super(NAME, VERSION$2, config);
87626
87698
  }
87627
87699
  setTracerProvider(tracerProvider) {
87628
87700
  this.tracerProvider = tracerProvider;
87629
87701
  }
87630
87702
  init() {
87631
- return [new import_src$11.InstrumentationNodeModuleDefinition(MODULE_NAME, [VERSION$1])];
87703
+ return [new import_src$11.InstrumentationNodeModuleDefinition(MODULE_NAME, [VERSION$2])];
87632
87704
  }
87633
87705
  enable() {
87634
87706
  const config = this._config;
@@ -245183,7 +245255,7 @@ const LIB_CACHE = /* @__PURE__ */ new Map();
245183
245255
  const PENDING_LIB_CACHE = /* @__PURE__ */ new Map();
245184
245256
  const NODE_MODULE_CACHE = /* @__PURE__ */ new Map();
245185
245257
  const TSCONFIG_CACHE = /* @__PURE__ */ new Map();
245186
- const pkgVersion = process.env.OVERRIDE_VERSION ?? "0.4.4";
245258
+ const pkgVersion = process.env.OVERRIDE_VERSION ?? "0.4.6";
245187
245259
  //#endregion
245188
245260
  //#region ../dev-tools/core/detect-frameworks.ts
245189
245261
  async function detectFrameworks$1(sys) {
@@ -499150,7 +499222,7 @@ function joinPaths(origin, path) {
499150
499222
  * @returns The normalized URL string
499151
499223
  */
499152
499224
  function normalizeRepoUrl(remoteUrl) {
499153
- let normalized = remoteUrl.replace(/\.git$/, "");
499225
+ let normalized = remoteUrl.trim().replace(/\.git$/, "");
499154
499226
  if (normalized.startsWith("git@")) normalized = normalized.replace(/^git@/, "").replace(/:([^/])/, "/$1");
499155
499227
  normalized = normalized.replace(/^https?:\/\//, "").replace(/^[^@]+@/, "");
499156
499228
  return normalized.toLowerCase();
@@ -520781,6 +520853,14 @@ var CodeGenSession = class CodeGenSession {
520781
520853
  if (gitLocation) this.#lastAICommits = await this.#getAllRepoCommits();
520782
520854
  const primaryRepoUrl = this.#gitRepoContexts[0]?.repoUrl;
520783
520855
  this.#repoHash = await computeRepoHash(primaryRepoUrl);
520856
+ if (!this.#repoHash) try {
520857
+ const result = await this.git([
520858
+ "remote",
520859
+ "get-url",
520860
+ "origin"
520861
+ ], { cwd: this.#workingDirectory });
520862
+ if (result) this.#repoHash = await computeRepoHash(result);
520863
+ } catch {}
520784
520864
  let sessionId;
520785
520865
  let sessionMetadata;
520786
520866
  if (!this.#sessionOrCompletionId) this.#sessionOrCompletionId = gitLocation?.sessionId;
@@ -534266,7 +534346,7 @@ const ControlledScrollView$1 = (0, import_react.forwardRef)(({ scrollOffset, onV
534266
534346
  ]);
534267
534347
  (0, import_react.useLayoutEffect)(() => {
534268
534348
  measureViewport();
534269
- });
534349
+ }, [measureViewport, import_react.Children.count(children)]);
534270
534350
  const currentKeys = [];
534271
534351
  import_react.Children.forEach(children, (child, index_0) => {
534272
534352
  if (!child) return;
@@ -534779,7 +534859,7 @@ function makePasteToken(id, lineCount) {
534779
534859
  return `[Pasted text #${id} +${lineCount} line${lineCount === 1 ? "" : "s"}]`;
534780
534860
  }
534781
534861
  function useTextInput(options = {}) {
534782
- const { onSubmit, onChange, onTab, onShiftTab, onPaste, onBackspaceEmpty, isActive = true, getIsMenuActive, submitDisabled = false, disableHistory = false, initialValue = "", inputWidth = 0 } = options;
534862
+ const { onSubmit, onChange, onTab, onShiftTab, onPaste, onBackspaceEmpty, onUpEmpty, onDownEmpty, isActive = true, getIsMenuActive, submitDisabled = false, disableHistory = false, initialValue = "", inputWidth = 0 } = options;
534783
534863
  const [value, setValueState] = (0, import_react.useState)(initialValue);
534784
534864
  const [cursorIndex, setCursorIndex] = (0, import_react.useState)(initialValue.length);
534785
534865
  useInputHistory();
@@ -534947,6 +535027,7 @@ function useTextInput(options = {}) {
534947
535027
  return;
534948
535028
  }
534949
535029
  }
535030
+ if (val_3 === "") onUpEmpty?.();
534950
535031
  return;
534951
535032
  }
534952
535033
  if (key.downArrow) {
@@ -534975,6 +535056,7 @@ function useTextInput(options = {}) {
534975
535056
  return;
534976
535057
  }
534977
535058
  }
535059
+ if (val_3 === "") onDownEmpty?.();
534978
535060
  return;
534979
535061
  }
534980
535062
  if (key.leftArrow) {
@@ -536764,6 +536846,53 @@ function usePreferences() {
536764
536846
  return t3;
536765
536847
  }
536766
536848
  //#endregion
536849
+ //#region src/hooks/useLocalHistory.ts
536850
+ const SysContext = (0, import_react.createContext)(null);
536851
+ function formatRelativeTime(ts) {
536852
+ const diffMs = Date.now() - ts;
536853
+ const diffSec = Math.floor(diffMs / 1e3);
536854
+ if (diffSec < 60) return "just now";
536855
+ const diffMin = Math.floor(diffSec / 60);
536856
+ if (diffMin < 60) return `${diffMin}m ago`;
536857
+ const diffHr = Math.floor(diffMin / 60);
536858
+ if (diffHr < 24) return `${diffHr}h ago`;
536859
+ const diffDays = Math.floor(diffHr / 24);
536860
+ if (diffDays < 7) return `${diffDays}d ago`;
536861
+ return new Date(ts).toLocaleDateString();
536862
+ }
536863
+ function useLocalHistory(cwd) {
536864
+ const $ = (0, import_compiler_runtime.c)(5);
536865
+ const sys = (0, import_react.useContext)(SysContext);
536866
+ let t0;
536867
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
536868
+ t0 = [];
536869
+ $[0] = t0;
536870
+ } else t0 = $[0];
536871
+ const [history, setHistory] = (0, import_react.useState)(t0);
536872
+ let t1;
536873
+ let t2;
536874
+ if ($[1] !== cwd || $[2] !== sys) {
536875
+ t1 = () => {
536876
+ if (!sys) return;
536877
+ getHistory(sys, cwd ?? process.cwd()).then((entries) => setHistory(entries.sort(_temp$8))).catch(_temp2$5);
536878
+ };
536879
+ t2 = [sys, cwd];
536880
+ $[1] = cwd;
536881
+ $[2] = sys;
536882
+ $[3] = t1;
536883
+ $[4] = t2;
536884
+ } else {
536885
+ t1 = $[3];
536886
+ t2 = $[4];
536887
+ }
536888
+ (0, import_react.useEffect)(t1, t2);
536889
+ return history;
536890
+ }
536891
+ function _temp2$5() {}
536892
+ function _temp$8(a, b) {
536893
+ return b.lastActiveAt - a.lastActiveAt;
536894
+ }
536895
+ //#endregion
536767
536896
  //#region src/components/SlashCommandMenu.tsx
536768
536897
  const SLASH_COMMANDS = [
536769
536898
  {
@@ -536820,6 +536949,11 @@ const SLASH_COMMANDS = [
536820
536949
  id: "rewind",
536821
536950
  label: "/rewind",
536822
536951
  description: "Browse history and restore a previous state"
536952
+ },
536953
+ {
536954
+ id: "sessions",
536955
+ label: "/sessions",
536956
+ description: "Browse recent local sessions"
536823
536957
  }
536824
536958
  ];
536825
536959
  const BUILTIN_COMMAND_IDS = new Set(SLASH_COMMANDS.map((c) => c.id));
@@ -536891,7 +537025,8 @@ const SUBVIEW_IDS = new Set([
536891
537025
  "config",
536892
537026
  "effort",
536893
537027
  "context",
536894
- "help"
537028
+ "help",
537029
+ "sessions"
536895
537030
  ]);
536896
537031
  const MAX_VISIBLE_ITEMS = 8;
536897
537032
  const SUBVIEW_CONFIG = {
@@ -536910,6 +537045,10 @@ const SUBVIEW_CONFIG = {
536910
537045
  effort: {
536911
537046
  title: "Effort",
536912
537047
  description: "Choose reasoning effort level"
537048
+ },
537049
+ sessions: {
537050
+ title: "Sessions",
537051
+ description: "Recent local sessions"
536913
537052
  }
536914
537053
  };
536915
537054
  function renderCommandRow({ cmd, isSelected, maxLabelLen, theme }) {
@@ -536946,508 +537085,387 @@ function renderCommandRow({ cmd, isSelected, maxLabelLen, theme }) {
536946
537085
  ] })
536947
537086
  }, cmd.id);
536948
537087
  }
536949
- function SlashCommandMenu(t0) {
536950
- const $ = (0, import_compiler_runtime.c)(41);
536951
- const { filter, onSelect, onCancel, currentReasoning: t1 } = t0;
536952
- const currentReasoning = t1 === void 0 ? "medium" : t1;
537088
+ function SlashCommandMenu({ filter, onSelect, onCancel, currentReasoning = "medium" }) {
536953
537089
  const [view, setView] = (0, import_react.useState)("commands");
536954
537090
  const [selectedIndex, setSelectedIndex] = (0, import_react.useState)(0);
536955
537091
  const [scrollOffset, setScrollOffset] = (0, import_react.useState)(0);
536956
537092
  const theme = useTheme();
536957
537093
  const [state, , proxy] = useCodeGenState();
537094
+ const sessionHistory = useLocalHistory(state.cwd ?? process.cwd());
536958
537095
  const [prefs] = usePreferences();
536959
537096
  const contextUsed = state.contextWindow?.usedTokens ?? 0;
536960
537097
  const contextTotal = state.contextWindow?.totalTokens ?? 0;
536961
- let t2;
536962
- if ($[0] !== contextTotal || $[1] !== contextUsed) {
536963
- t2 = contextTotal > 0 ? Math.round(contextUsed / contextTotal * 100) : 0;
536964
- $[0] = contextTotal;
536965
- $[1] = contextUsed;
536966
- $[2] = t2;
536967
- } else t2 = $[2];
536968
- const contextPct = t2;
536969
- let t3;
536970
- if ($[3] !== state.customInstructions) {
536971
- t3 = (state.customInstructions ?? []).filter(_temp$8).map(_temp2$5);
536972
- $[3] = state.customInstructions;
536973
- $[4] = t3;
536974
- } else t3 = $[4];
536975
- const skillCommands = t3;
536976
- let t4;
536977
- if ($[5] !== filter || $[6] !== skillCommands) {
536978
- bb0: {
536979
- const query = filter.toLowerCase().replace(/^\//, "");
536980
- const allCommands = [...SLASH_COMMANDS, ...skillCommands];
536981
- if (!query) {
536982
- t4 = allCommands;
536983
- break bb0;
536984
- }
536985
- t4 = allCommands.filter((cmd) => cmd.id.toLowerCase().includes(query) || cmd.label.toLowerCase().includes(query));
536986
- }
536987
- $[5] = filter;
536988
- $[6] = skillCommands;
536989
- $[7] = t4;
536990
- } else t4 = $[7];
536991
- const filtered = t4;
536992
- let t5;
536993
- bb1: {
536994
- if (view === "mode") {
536995
- t5 = MODE_COMMANDS;
536996
- break bb1;
536997
- }
536998
- if (view === "model") {
536999
- t5 = MODEL_COMMANDS;
537000
- break bb1;
537001
- }
537002
- if (view === "config") {
537003
- t5 = CONFIG_COMMANDS;
537004
- break bb1;
537005
- }
537006
- if (view === "effort") {
537007
- t5 = EFFORT_COMMANDS;
537008
- break bb1;
537009
- }
537010
- if (view === "context") {
537011
- let t6;
537012
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
537013
- t6 = [];
537014
- $[8] = t6;
537015
- } else t6 = $[8];
537016
- t5 = t6;
537017
- break bb1;
537018
- }
537019
- if (view === "help") {
537020
- let t6;
537021
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
537022
- t6 = [];
537023
- $[9] = t6;
537024
- } else t6 = $[9];
537025
- t5 = t6;
537026
- break bb1;
537027
- }
537028
- t5 = filtered;
537029
- }
537030
- const commands = t5;
537031
- let t6;
537032
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
537033
- t6 = () => {
537034
- setView("commands");
537035
- setSelectedIndex(0);
537036
- setScrollOffset(0);
537037
- };
537038
- $[10] = t6;
537039
- } else t6 = $[10];
537040
- let t7;
537041
- if ($[11] !== filter) {
537042
- t7 = [filter];
537043
- $[11] = filter;
537044
- $[12] = t7;
537045
- } else t7 = $[12];
537046
- (0, import_react.useEffect)(t6, t7);
537047
- let t8;
537048
- if ($[13] !== commands || $[14] !== onCancel || $[15] !== onSelect || $[16] !== selectedIndex || $[17] !== view) {
537049
- t8 = (input, key) => {
537050
- if (key.escape) {
537051
- if (view !== "commands") {
537052
- setView("commands");
537053
- setSelectedIndex(0);
537054
- setScrollOffset(0);
537055
- return;
537056
- }
537057
- onCancel();
537058
- return;
537059
- }
537060
- if (key.upArrow) {
537061
- setSelectedIndex((i_1) => {
537062
- if (i_1 === 0) return i_1;
537063
- const next = i_1 - 1;
537064
- setScrollOffset((off) => {
537065
- if (next < off) return next;
537066
- return off;
537067
- });
537068
- return next;
537069
- });
537070
- return;
537071
- }
537072
- if (key.downArrow) {
537073
- setSelectedIndex((i_2) => {
537074
- if (i_2 === commands.length - 1) return i_2;
537075
- const next_0 = i_2 + 1;
537076
- setScrollOffset((off_0) => {
537077
- if (next_0 >= off_0 + MAX_VISIBLE_ITEMS) return next_0 - MAX_VISIBLE_ITEMS + 1;
537078
- return off_0;
537079
- });
537080
- return next_0;
537081
- });
537082
- return;
537083
- }
537084
- if (!key.return && input !== " ") return;
537085
- const selected = commands[selectedIndex];
537086
- if (!selected) return;
537098
+ const contextPct = contextTotal > 0 ? Math.round(contextUsed / contextTotal * 100) : 0;
537099
+ const skillCommands = (0, import_react.useMemo)(() => {
537100
+ return (state.customInstructions ?? []).filter((i) => i.isSkill && i.userInvocable !== false && !BUILTIN_COMMAND_IDS.has(i.name)).map((i_0) => ({
537101
+ id: i_0.name,
537102
+ label: `/${i_0.name}`,
537103
+ description: i_0.description
537104
+ }));
537105
+ }, [state.customInstructions]);
537106
+ const filtered = (0, import_react.useMemo)(() => {
537107
+ const query = filter.toLowerCase().replace(/^\//, "");
537108
+ const allCommands = [...SLASH_COMMANDS, ...skillCommands];
537109
+ if (!query) return allCommands;
537110
+ return allCommands.filter((cmd) => cmd.id.toLowerCase().includes(query) || cmd.label.toLowerCase().includes(query));
537111
+ }, [filter, skillCommands]);
537112
+ const commands = (0, import_react.useMemo)(() => {
537113
+ if (view === "mode") return MODE_COMMANDS;
537114
+ if (view === "model") return MODEL_COMMANDS;
537115
+ if (view === "config") return CONFIG_COMMANDS;
537116
+ if (view === "effort") return EFFORT_COMMANDS;
537117
+ if (view === "context") return [];
537118
+ if (view === "help") return [];
537119
+ if (view === "sessions") return sessionHistory.slice(0, 10).map((entry) => ({
537120
+ id: entry.sessionId,
537121
+ label: formatRelativeTime(entry.lastActiveAt),
537122
+ description: entry.title
537123
+ }));
537124
+ return filtered;
537125
+ }, [view, filtered]);
537126
+ (0, import_react.useEffect)(() => {
537127
+ setView("commands");
537128
+ setSelectedIndex(0);
537129
+ setScrollOffset(0);
537130
+ }, [filter]);
537131
+ useInput((input, key) => {
537132
+ if (key.escape) {
537087
537133
  if (view !== "commands") {
537088
- onSelect({
537089
- commandId: view,
537090
- value: selected.id,
537091
- keepMenuOpen: view === "config",
537092
- captureSpace: view === "config"
537093
- });
537094
- return;
537095
- }
537096
- if (SUBVIEW_IDS.has(selected.id)) {
537097
- setView(selected.id);
537134
+ setView("commands");
537098
537135
  setSelectedIndex(0);
537099
537136
  setScrollOffset(0);
537100
537137
  return;
537101
537138
  }
537102
- onSelect({ commandId: selected.id });
537103
- };
537104
- $[13] = commands;
537105
- $[14] = onCancel;
537106
- $[15] = onSelect;
537107
- $[16] = selectedIndex;
537108
- $[17] = view;
537109
- $[18] = t8;
537110
- } else t8 = $[18];
537111
- useInput(t8);
537112
- if (view === "commands" && filtered.length === 0) {
537113
- let t9;
537114
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
537115
- t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537116
- dimColor: true,
537117
- children: "No matching commands"
537139
+ onCancel();
537140
+ return;
537141
+ }
537142
+ if (key.upArrow) {
537143
+ setSelectedIndex((i_1) => {
537144
+ if (i_1 === 0) return i_1;
537145
+ const next = i_1 - 1;
537146
+ setScrollOffset((off) => {
537147
+ if (next < off) return next;
537148
+ return off;
537149
+ });
537150
+ return next;
537118
537151
  });
537119
- $[19] = t9;
537120
- } else t9 = $[19];
537121
- let t10;
537122
- if ($[20] !== theme.background) {
537123
- t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537124
- borderStyle: "bold",
537125
- borderColor: "magenta",
537126
- borderLeft: true,
537127
- borderRight: false,
537128
- borderBottom: false,
537129
- borderTop: false,
537130
- paddingX: 2,
537131
- paddingY: 1,
537132
- backgroundColor: theme.background,
537133
- children: t9
537152
+ return;
537153
+ }
537154
+ if (key.downArrow) {
537155
+ setSelectedIndex((i_2) => {
537156
+ if (i_2 === commands.length - 1) return i_2;
537157
+ const next_0 = i_2 + 1;
537158
+ setScrollOffset((off_0) => {
537159
+ if (next_0 >= off_0 + MAX_VISIBLE_ITEMS) return next_0 - MAX_VISIBLE_ITEMS + 1;
537160
+ return off_0;
537161
+ });
537162
+ return next_0;
537134
537163
  });
537135
- $[20] = theme.background;
537136
- $[21] = t10;
537137
- } else t10 = $[21];
537138
- return t10;
537139
- }
537140
- let t9;
537141
- if ($[22] !== commands) {
537142
- t9 = commands.length > 0 ? Math.max(...commands.map(_temp3$4)) : 0;
537143
- $[22] = commands;
537144
- $[23] = t9;
537145
- } else t9 = $[23];
537146
- const maxLabelLen = t9;
537164
+ return;
537165
+ }
537166
+ if (!key.return && input !== " ") return;
537167
+ const selected = commands[selectedIndex];
537168
+ if (!selected) return;
537169
+ if (view !== "commands") {
537170
+ onSelect({
537171
+ commandId: view,
537172
+ value: selected.id,
537173
+ keepMenuOpen: view === "config",
537174
+ captureSpace: view === "config"
537175
+ });
537176
+ return;
537177
+ }
537178
+ if (SUBVIEW_IDS.has(selected.id)) {
537179
+ setView(selected.id);
537180
+ setSelectedIndex(0);
537181
+ setScrollOffset(0);
537182
+ return;
537183
+ }
537184
+ onSelect({ commandId: selected.id });
537185
+ });
537186
+ if (view === "commands" && filtered.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537187
+ borderStyle: "bold",
537188
+ borderColor: "magenta",
537189
+ borderLeft: true,
537190
+ borderRight: false,
537191
+ borderBottom: false,
537192
+ borderTop: false,
537193
+ paddingX: 2,
537194
+ paddingY: 1,
537195
+ backgroundColor: theme.background,
537196
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537197
+ dimColor: true,
537198
+ children: "No matching commands"
537199
+ })
537200
+ });
537201
+ const maxLabelLen = commands.length > 0 ? Math.max(...commands.map((c) => c.label.length)) : 0;
537147
537202
  const visibleStart = scrollOffset;
537148
537203
  const visibleEnd = Math.min(scrollOffset + MAX_VISIBLE_ITEMS, commands.length);
537149
- let t10;
537150
- if ($[24] !== commands || $[25] !== contextPct || $[26] !== contextTotal || $[27] !== contextUsed || $[28] !== currentReasoning || $[29] !== maxLabelLen || $[30] !== prefs || $[31] !== proxy || $[32] !== selectedIndex || $[33] !== state.model || $[34] !== state.modelOverride || $[35] !== state.sessionMode || $[36] !== theme || $[37] !== view || $[38] !== visibleEnd || $[39] !== visibleStart) {
537151
- const visibleCommands = commands.slice(visibleStart, visibleEnd);
537152
- const itemsAbove = visibleStart;
537153
- const itemsBelow = commands.length - visibleEnd;
537154
- t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537204
+ const visibleCommands = commands.slice(visibleStart, visibleEnd);
537205
+ const itemsAbove = visibleStart;
537206
+ const itemsBelow = commands.length - visibleEnd;
537207
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537208
+ flexDirection: "column",
537209
+ borderStyle: "bold",
537210
+ borderColor: "magenta",
537211
+ borderLeft: true,
537212
+ borderRight: false,
537213
+ borderTop: false,
537214
+ borderBottom: false,
537215
+ paddingX: 0,
537216
+ paddingTop: itemsAbove > 0 ? 0 : 1,
537217
+ paddingBottom: itemsBelow > 0 ? 0 : 1,
537218
+ backgroundColor: theme.background,
537219
+ children: view === "commands" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
537220
+ itemsAbove > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537221
+ paddingX: 2,
537222
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537223
+ dimColor: true,
537224
+ children: `▲ ${itemsAbove} more`
537225
+ })
537226
+ }),
537227
+ visibleCommands.map((cmd_0, i_3) => renderCommandRow({
537228
+ cmd: cmd_0,
537229
+ isSelected: visibleStart + i_3 === selectedIndex,
537230
+ maxLabelLen,
537231
+ theme
537232
+ })),
537233
+ itemsBelow > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537234
+ paddingX: 2,
537235
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537236
+ dimColor: true,
537237
+ children: `▼ ${itemsBelow} more`
537238
+ })
537239
+ })
537240
+ ] }) : view === "help" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537241
+ paddingX: 1,
537242
+ gap: 1,
537243
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537244
+ bold: true,
537245
+ children: "Help"
537246
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
537247
+ dimColor: true,
537248
+ children: [
537249
+ " · ",
537250
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537251
+ bold: true,
537252
+ children: "esc"
537253
+ }),
537254
+ " back"
537255
+ ]
537256
+ })]
537257
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537258
+ paddingX: 3,
537155
537259
  flexDirection: "column",
537156
- borderStyle: "bold",
537157
- borderColor: "magenta",
537158
- borderLeft: true,
537159
- borderRight: false,
537160
- borderTop: false,
537161
- borderBottom: false,
537162
- paddingX: 0,
537163
- paddingTop: itemsAbove > 0 ? 0 : 1,
537164
- paddingBottom: itemsBelow > 0 ? 0 : 1,
537165
- backgroundColor: theme.background,
537166
- children: view === "commands" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
537167
- itemsAbove > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537168
- paddingX: 2,
537169
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537260
+ children: [
537261
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537262
+ bold: true,
537263
+ dimColor: true,
537264
+ children: "Keyboard Shortcuts"
537265
+ }),
537266
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537267
+ gap: 2,
537268
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537170
537269
  dimColor: true,
537171
- children: `▲ ${itemsAbove} more`
537172
- })
537270
+ children: "Enter "
537271
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Submit prompt" })]
537173
537272
  }),
537174
- visibleCommands.map((cmd_0, i_3) => renderCommandRow({
537175
- cmd: cmd_0,
537176
- isSelected: visibleStart + i_3 === selectedIndex,
537177
- maxLabelLen,
537178
- theme
537179
- })),
537180
- itemsBelow > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537181
- paddingX: 2,
537182
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537273
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537274
+ gap: 2,
537275
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537183
537276
  dimColor: true,
537184
- children: `▼ ${itemsBelow} more`
537185
- })
537186
- })
537187
- ] }) : view === "help" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537188
- paddingX: 1,
537189
- gap: 1,
537190
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537277
+ children: "Ctrl+Enter "
537278
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "New line" })]
537279
+ }),
537280
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537281
+ gap: 2,
537282
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537283
+ dimColor: true,
537284
+ children: "Tab "
537285
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Toggle session mode" })]
537286
+ }),
537287
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537288
+ gap: 2,
537289
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537290
+ dimColor: true,
537291
+ children: "Esc "
537292
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Interrupt / close menu" })]
537293
+ }),
537294
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537295
+ gap: 2,
537296
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537297
+ dimColor: true,
537298
+ children: "Ctrl+C x2 "
537299
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Exit" })]
537300
+ }),
537301
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537302
+ gap: 2,
537303
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537304
+ dimColor: true,
537305
+ children: "Ctrl+V "
537306
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Paste / attach image" })]
537307
+ }),
537308
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537309
+ gap: 2,
537310
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537311
+ dimColor: true,
537312
+ children: "PageUp/Down "
537313
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Scroll history" })]
537314
+ }),
537315
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: " " }),
537316
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537191
537317
  bold: true,
537192
- children: "Help"
537193
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
537194
537318
  dimColor: true,
537195
- children: [
537196
- " · ",
537197
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537198
- bold: true,
537199
- children: "esc"
537200
- }),
537201
- " back"
537202
- ]
537203
- })]
537204
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537205
- paddingX: 3,
537206
- flexDirection: "column",
537207
- children: [
537208
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537209
- bold: true,
537319
+ children: "Slash Commands"
537320
+ }),
537321
+ SLASH_COMMANDS.map((cmd_1) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537322
+ gap: 2,
537323
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537210
537324
  dimColor: true,
537211
- children: "Keyboard Shortcuts"
537212
- }),
537213
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537214
- gap: 2,
537215
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537216
- dimColor: true,
537217
- children: "Enter "
537218
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Submit prompt" })]
537219
- }),
537220
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537221
- gap: 2,
537222
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537223
- dimColor: true,
537224
- children: "Ctrl+Enter "
537225
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "New line" })]
537226
- }),
537227
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537228
- gap: 2,
537229
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537230
- dimColor: true,
537231
- children: "Tab "
537232
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Toggle session mode" })]
537233
- }),
537234
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537235
- gap: 2,
537236
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537237
- dimColor: true,
537238
- children: "Esc "
537239
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Interrupt / close menu" })]
537240
- }),
537241
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537242
- gap: 2,
537243
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537244
- dimColor: true,
537245
- children: "Ctrl+C x2 "
537246
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Exit" })]
537247
- }),
537248
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537249
- gap: 2,
537250
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537251
- dimColor: true,
537252
- children: "Ctrl+V "
537253
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Paste / attach image" })]
537254
- }),
537255
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537256
- gap: 2,
537257
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537258
- dimColor: true,
537259
- children: "PageUp/Down "
537260
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Scroll history" })]
537261
- }),
537262
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: " " }),
537325
+ children: cmd_1.label.padEnd(16)
537326
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: cmd_1.description })]
537327
+ }, cmd_1.id))
537328
+ ]
537329
+ })] }) : view === "context" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537330
+ paddingX: 1,
537331
+ gap: 1,
537332
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537333
+ bold: true,
537334
+ children: "Session Info"
537335
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
537336
+ dimColor: true,
537337
+ children: [
537338
+ " · ",
537263
537339
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537264
537340
  bold: true,
537265
- dimColor: true,
537266
- children: "Slash Commands"
537341
+ children: "esc"
537267
537342
  }),
537268
- SLASH_COMMANDS.map(_temp4$1)
537343
+ " back"
537269
537344
  ]
537270
- })] }) : view === "context" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537345
+ })]
537346
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537347
+ paddingX: 3,
537348
+ flexDirection: "column",
537349
+ children: [
537350
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537351
+ gap: 2,
537352
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537353
+ dimColor: true,
537354
+ children: "Session ID:"
537355
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: proxy.sessionId ?? "—" })]
537356
+ }),
537357
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537358
+ gap: 2,
537359
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537360
+ dimColor: true,
537361
+ children: "Model:"
537362
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: state.modelOverride ? `${state.model ?? "—"} (override: ${state.modelOverride})` : state.model ?? "—" })]
537363
+ }),
537364
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537365
+ gap: 2,
537366
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537367
+ dimColor: true,
537368
+ children: "Mode:"
537369
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: state.sessionMode ?? "normal" })]
537370
+ }),
537371
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537372
+ gap: 2,
537373
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537374
+ dimColor: true,
537375
+ children: "Effort:"
537376
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: prefs.reasoning })]
537377
+ }),
537378
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537379
+ gap: 2,
537380
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537381
+ dimColor: true,
537382
+ children: "Context:"
537383
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: contextTotal > 0 ? `${contextUsed.toLocaleString()} / ${contextTotal.toLocaleString()} tokens (${contextPct}%)` : "—" })]
537384
+ })
537385
+ ]
537386
+ })] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
537387
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537271
537388
  paddingX: 1,
537272
537389
  gap: 1,
537273
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537274
- bold: true,
537275
- children: "Session Info"
537276
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
537277
- dimColor: true,
537278
- children: [
537279
- " · ",
537280
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537281
- bold: true,
537282
- children: "esc"
537283
- }),
537284
- " back"
537285
- ]
537286
- })]
537287
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537288
- paddingX: 3,
537289
- flexDirection: "column",
537290
537390
  children: [
537291
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537292
- gap: 2,
537293
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537294
- dimColor: true,
537295
- children: "Session ID:"
537296
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: proxy.sessionId ?? "—" })]
537297
- }),
537298
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537299
- gap: 2,
537300
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537301
- dimColor: true,
537302
- children: "Model:"
537303
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: state.modelOverride ? `${state.model ?? "—"} (override: ${state.modelOverride})` : state.model ?? "—" })]
537304
- }),
537305
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537306
- gap: 2,
537307
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537308
- dimColor: true,
537309
- children: "Mode:"
537310
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: state.sessionMode ?? "normal" })]
537391
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537392
+ bold: true,
537393
+ children: SUBVIEW_CONFIG[view].title
537311
537394
  }),
537312
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537313
- gap: 2,
537314
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537315
- dimColor: true,
537316
- children: "Effort:"
537317
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: prefs.reasoning })]
537395
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537396
+ dimColor: true,
537397
+ wrap: "truncate-end",
537398
+ children: SUBVIEW_CONFIG[view].description
537318
537399
  }),
537319
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537320
- gap: 2,
537321
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537322
- dimColor: true,
537323
- children: "Context:"
537324
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: contextTotal > 0 ? `${contextUsed.toLocaleString()} / ${contextTotal.toLocaleString()} tokens (${contextPct}%)` : "—" })]
537325
- })
537326
- ]
537327
- })] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
537328
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537329
- paddingX: 1,
537330
- gap: 1,
537331
- children: [
537332
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537333
- bold: true,
537334
- children: SUBVIEW_CONFIG[view].title
537335
- }),
537336
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537337
- dimColor: true,
537338
- wrap: "truncate-end",
537339
- children: SUBVIEW_CONFIG[view].description
537340
- }),
537341
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
537342
- dimColor: true,
537343
- children: [
537344
- " · ",
537345
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537346
- bold: true,
537347
- children: "esc"
537348
- }),
537349
- " back"
537350
- ]
537351
- })
537352
- ]
537353
- }),
537354
- itemsAbove > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537355
- paddingX: 2,
537356
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537400
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
537357
537401
  dimColor: true,
537358
- children: `▲ ${itemsAbove} more`
537402
+ children: [
537403
+ " · ",
537404
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537405
+ bold: true,
537406
+ children: "esc"
537407
+ }),
537408
+ " back"
537409
+ ]
537359
537410
  })
537360
- }),
537361
- visibleCommands.map((cmd_2, i_4) => {
537362
- const absoluteIndex = visibleStart + i_4;
537363
- let prefix;
537364
- if (view === "config") prefix = prefs[cmd_2.id] ? "[✓]" : "[ ]";
537365
- if (view === "effort") prefix = cmd_2.id === currentReasoning ? "●" : " ";
537366
- const displayLabel = prefix ? `${prefix} ${cmd_2.label}` : cmd_2.label;
537367
- const padLen = maxLabelLen + 4;
537368
- const padded = displayLabel.padEnd(padLen);
537369
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537370
- width: "100%",
537371
- paddingLeft: 2,
537372
- children: absoluteIndex === selectedIndex ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
537373
- backgroundColor: theme.highlightBackground,
537374
- color: theme.highlight,
537375
- children: [
537376
- " ",
537377
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537378
- backgroundColor: theme.highlightBackground,
537379
- color: theme.highlight,
537380
- bold: true,
537381
- children: padded
537382
- }),
537383
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537384
- backgroundColor: theme.highlightBackground,
537385
- color: theme.highlight,
537386
- dimColor: true,
537387
- children: cmd_2.description
537388
- }),
537389
- " "
537390
- ]
537391
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
537411
+ ]
537412
+ }),
537413
+ itemsAbove > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537414
+ paddingX: 2,
537415
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537416
+ dimColor: true,
537417
+ children: `▲ ${itemsAbove} more`
537418
+ })
537419
+ }),
537420
+ visibleCommands.map((cmd_2, i_4) => {
537421
+ const absoluteIndex = visibleStart + i_4;
537422
+ let prefix;
537423
+ if (view === "config") prefix = prefs[cmd_2.id] ? "[✓]" : "[ ]";
537424
+ if (view === "effort") prefix = cmd_2.id === currentReasoning ? "●" : " ";
537425
+ const displayLabel = prefix ? `${prefix} ${cmd_2.label}` : cmd_2.label;
537426
+ const padLen = maxLabelLen + 4;
537427
+ const padded = displayLabel.padEnd(padLen);
537428
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537429
+ width: "100%",
537430
+ paddingLeft: 2,
537431
+ children: absoluteIndex === selectedIndex ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
537432
+ backgroundColor: theme.highlightBackground,
537433
+ color: theme.highlight,
537434
+ children: [
537392
537435
  " ",
537393
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: padded }),
537394
537436
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537437
+ backgroundColor: theme.highlightBackground,
537438
+ color: theme.highlight,
537439
+ bold: true,
537440
+ children: padded
537441
+ }),
537442
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537443
+ backgroundColor: theme.highlightBackground,
537444
+ color: theme.highlight,
537395
537445
  dimColor: true,
537396
537446
  children: cmd_2.description
537397
- })
537398
- ] })
537399
- }, cmd_2.id);
537400
- }),
537401
- itemsBelow > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537402
- paddingX: 2,
537403
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537404
- dimColor: true,
537405
- children: `▼ ${itemsBelow} more`
537406
- })
537447
+ }),
537448
+ " "
537449
+ ]
537450
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
537451
+ " ",
537452
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: padded }),
537453
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537454
+ dimColor: true,
537455
+ children: cmd_2.description
537456
+ })
537457
+ ] })
537458
+ }, cmd_2.id);
537459
+ }),
537460
+ itemsBelow > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537461
+ paddingX: 2,
537462
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537463
+ dimColor: true,
537464
+ children: `▼ ${itemsBelow} more`
537407
537465
  })
537408
- ] })
537409
- });
537410
- $[24] = commands;
537411
- $[25] = contextPct;
537412
- $[26] = contextTotal;
537413
- $[27] = contextUsed;
537414
- $[28] = currentReasoning;
537415
- $[29] = maxLabelLen;
537416
- $[30] = prefs;
537417
- $[31] = proxy;
537418
- $[32] = selectedIndex;
537419
- $[33] = state.model;
537420
- $[34] = state.modelOverride;
537421
- $[35] = state.sessionMode;
537422
- $[36] = theme;
537423
- $[37] = view;
537424
- $[38] = visibleEnd;
537425
- $[39] = visibleStart;
537426
- $[40] = t10;
537427
- } else t10 = $[40];
537428
- return t10;
537429
- }
537430
- function _temp4$1(cmd_1) {
537431
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537432
- gap: 2,
537433
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537434
- dimColor: true,
537435
- children: cmd_1.label.padEnd(16)
537436
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: cmd_1.description })]
537437
- }, cmd_1.id);
537438
- }
537439
- function _temp3$4(c) {
537440
- return c.label.length;
537441
- }
537442
- function _temp2$5(i_0) {
537443
- return {
537444
- id: i_0.name,
537445
- label: `/${i_0.name}`,
537446
- description: i_0.description
537447
- };
537448
- }
537449
- function _temp$8(i) {
537450
- return i.isSkill && i.userInvocable !== false && !BUILTIN_COMMAND_IDS.has(i.name);
537466
+ })
537467
+ ] })
537468
+ });
537451
537469
  }
537452
537470
  //#endregion
537453
537471
  //#region src/components/FilePicker.tsx
@@ -537776,6 +537794,12 @@ function getAtQuery(value) {
537776
537794
  return match ? match[1] : null;
537777
537795
  }
537778
537796
  const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand, onToggleSessionMode, onSlashMenuActiveChange, isTabActive = true, currentReasoning, initialValue, pendingAttachments = [], onAddAttachment, onRemoveAttachment }) => {
537797
+ const { isFocused } = useFocus({
537798
+ id: "input-prompt",
537799
+ autoFocus: true,
537800
+ isActive: isTabActive
537801
+ });
537802
+ const { focusNext } = useFocusManager();
537779
537803
  const [state] = useCodeGenState();
537780
537804
  const [dismissedSlashValue, setDismissedSlashValue] = (0, import_react.useState)(null);
537781
537805
  const [dismissedAtValue, setDismissedAtValue] = (0, import_react.useState)(null);
@@ -537812,12 +537836,13 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
537812
537836
  onChange: handleChange,
537813
537837
  onTab: onToggleSessionMode,
537814
537838
  onShiftTab: onToggleSessionMode,
537815
- isActive: isTabActive,
537839
+ isActive: isTabActive && isFocused,
537816
537840
  getIsMenuActive,
537817
537841
  submitDisabled: false,
537818
537842
  initialValue,
537819
537843
  inputWidth,
537820
537844
  onPaste: () => void Promise.resolve(pasteHandlerRef.current()).catch(() => {}),
537845
+ onDownEmpty: focusNext,
537821
537846
  onBackspaceEmpty: pendingAttachments.length > 0 && onRemoveAttachment ? () => {
537822
537847
  const last = pendingAttachments[pendingAttachments.length - 1];
537823
537848
  if (last) onRemoveAttachment(last.id);
@@ -537913,6 +537938,7 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
537913
537938
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537914
537939
  flexDirection: "column",
537915
537940
  marginY: 1,
537941
+ flexShrink: 0,
537916
537942
  children: [
537917
537943
  state.queue && state.queue.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537918
537944
  flexDirection: "column",
@@ -537996,6 +538022,7 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
537996
538022
  rows: 1,
537997
538023
  placeholder: hint,
537998
538024
  showCursor: true,
538025
+ focus: isTabActive && isFocused,
537999
538026
  maxRows: 10
538000
538027
  })
538001
538028
  }),
@@ -540242,7 +540269,96 @@ const Gradient = (props) => {
540242
540269
  return (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: applyGradientToChildren(props.children) });
540243
540270
  };
540244
540271
  //#endregion
540272
+ //#region src/components/RecentSessions.tsx
540273
+ const RecentSessions = (0, import_react.memo)(({ cwd, sessions: sessionsProp, limit = 5, maxTitleWidth = 60, showHint = false, focusId, isTabActive = true, onSelect }) => {
540274
+ const localHistory = useLocalHistory(cwd ?? process.cwd());
540275
+ const theme = useTheme();
540276
+ const sessions = (sessionsProp ?? localHistory).slice(0, limit);
540277
+ const { isFocused } = useFocus({
540278
+ id: focusId ?? "__noop__",
540279
+ isActive: isTabActive
540280
+ });
540281
+ const { focusPrevious } = useFocusManager();
540282
+ const [selectedIndex, setSelectedIndex] = (0, import_react.useState)(0);
540283
+ const selectedIndexRef = (0, import_react.useRef)(selectedIndex);
540284
+ selectedIndexRef.current = selectedIndex;
540285
+ (0, import_react.useEffect)(() => {
540286
+ if (isFocused) setSelectedIndex(0);
540287
+ }, [isFocused]);
540288
+ const isNavigable = Boolean(focusId);
540289
+ useInput((_, key) => {
540290
+ if (key.upArrow) {
540291
+ if (selectedIndexRef.current === 0) focusPrevious();
540292
+ else setSelectedIndex((i) => i - 1);
540293
+ return;
540294
+ }
540295
+ if (key.downArrow) {
540296
+ setSelectedIndex((i_0) => i_0 < sessions.length - 1 ? i_0 + 1 : i_0);
540297
+ return;
540298
+ }
540299
+ if (key.escape) {
540300
+ focusPrevious();
540301
+ return;
540302
+ }
540303
+ if (key.return) {
540304
+ const entry = sessions[selectedIndexRef.current];
540305
+ if (entry) onSelect?.(entry.sessionId);
540306
+ }
540307
+ }, { isActive: isNavigable && isTabActive && isFocused });
540308
+ const activeIndex = isNavigable && isFocused ? selectedIndex : void 0;
540309
+ if (sessions.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540310
+ paddingX: 1,
540311
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540312
+ dimColor: true,
540313
+ children: "No recent sessions found for this directory."
540314
+ })
540315
+ });
540316
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540317
+ flexDirection: "column",
540318
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540319
+ paddingX: 1,
540320
+ marginBottom: 0,
540321
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540322
+ dimColor: true,
540323
+ bold: true,
540324
+ children: "Recent sessions"
540325
+ }), showHint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540326
+ dimColor: true,
540327
+ children: " · /sessions to browse"
540328
+ })]
540329
+ }), sessions.map((entry_0, i_1) => {
540330
+ const isSelected = i_1 === activeIndex;
540331
+ const title = entry_0.title.length > maxTitleWidth ? entry_0.title.slice(0, maxTitleWidth - 3) + "..." : entry_0.title;
540332
+ const timeStr = formatRelativeTime(entry_0.lastActiveAt);
540333
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540334
+ paddingX: 1,
540335
+ gap: 1,
540336
+ children: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540337
+ backgroundColor: theme.highlightBackground,
540338
+ color: theme.highlight,
540339
+ children: ` ▶ ${title} ${timeStr} `
540340
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
540341
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540342
+ dimColor: true,
540343
+ children: "·"
540344
+ }),
540345
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540346
+ dimColor: true,
540347
+ children: title
540348
+ }),
540349
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540350
+ dimColor: true,
540351
+ children: timeStr
540352
+ })
540353
+ ] })
540354
+ }, entry_0.sessionId);
540355
+ })]
540356
+ });
540357
+ });
540358
+ //#endregion
540245
540359
  //#region src/components/WelcomeScreen.tsx
540360
+ const VERSION$1 = "0.4.6";
540361
+ const FOCUS_SESSIONS = "welcome-sessions";
540246
540362
  const LOGO = `
540247
540363
  ██████╗ ██╗ ██╗ ██╗ ██╗ ██████╗ ███████╗ ██████╗
540248
540364
  ██╔══██╗ ██║ ██║ ██║ ██║ ██╔══██╗ ██╔════╝ ██╔══██╗
@@ -540255,50 +540371,55 @@ const LOGO_SMALL = `
540255
540371
  ╔╗ ╦ ╦ ╦ ╦ ╔╦╗ ╔═╗ ╦═╗
540256
540372
  ╠╩╗ ║ ║ ║ ║ ║ ║ ║╣ ╠╦╝
540257
540373
  ╚═╝ ╚═╝ ╩ ╩═╝╚╩╝ ╚═╝ ╩╚═`.trim();
540374
+ const MAX_SESSIONS = 5;
540258
540375
  const WelcomeScreen = (0, import_react.memo)((t0) => {
540259
- const $ = (0, import_compiler_runtime.c)(26);
540260
- const { onSubmit, onChange, onSlashCommand, onSlashMenuActiveChange, onToggleSessionMode, isTabActive: t1 } = t0;
540376
+ const $ = (0, import_compiler_runtime.c)(36);
540377
+ const { onSubmit, onChange, onSlashCommand, onSlashMenuActiveChange, onToggleSessionMode, isTabActive: t1, localSessions: t2 } = t0;
540261
540378
  const isTabActive = t1 === void 0 ? true : t1;
540379
+ let t3;
540380
+ if ($[0] !== t2) {
540381
+ t3 = t2 === void 0 ? [] : t2;
540382
+ $[0] = t2;
540383
+ $[1] = t3;
540384
+ } else t3 = $[1];
540385
+ const localSessions = t3;
540262
540386
  const [state] = useCodeGenState();
540263
- const { stdout } = useStdout();
540264
540387
  const theme = useTheme();
540265
- const [cols, setCols] = (0, import_react.useState)(stdout?.columns ?? 80);
540266
- const [rows, setRows] = (0, import_react.useState)(stdout?.rows ?? 24);
540267
- let t2;
540268
- let t3;
540269
- if ($[0] !== stdout) {
540270
- t2 = () => {
540271
- if (!stdout) return;
540272
- const onResize = () => {
540273
- setCols(stdout.columns ?? 80);
540274
- setRows(stdout.rows ?? 24);
540275
- };
540276
- stdout.on("resize", onResize);
540277
- return () => {
540278
- stdout.off("resize", onResize);
540279
- };
540280
- };
540281
- t3 = [stdout];
540282
- $[0] = stdout;
540283
- $[1] = t2;
540284
- $[2] = t3;
540285
- } else {
540286
- t2 = $[1];
540287
- t3 = $[2];
540288
- }
540289
- (0, import_react.useEffect)(t2, t3);
540388
+ const { activeId } = useFocusManager();
540389
+ const { rows, columns } = useWindowSize();
540290
540390
  let t4;
540291
- if ($[3] !== state.cwd) {
540391
+ if ($[2] !== state.cwd) {
540292
540392
  t4 = state.cwd ? state.cwd.replace(process.env.HOME ?? "", "~") : process.cwd().replace(process.env.HOME ?? "", "~");
540293
- $[3] = state.cwd;
540294
- $[4] = t4;
540295
- } else t4 = $[4];
540393
+ $[2] = state.cwd;
540394
+ $[3] = t4;
540395
+ } else t4 = $[3];
540296
540396
  const displayCwd = t4;
540297
- const inputWidth = Math.min(Math.max(cols, 20), 90);
540298
- const t5 = cols >= 70 && rows >= 20 ? LOGO : cols >= 28 && rows >= 14 ? LOGO_SMALL : "BUILDER";
540397
+ const inputWidth = Math.min(Math.max(columns, 20), 90);
540398
+ let t5;
540399
+ if ($[4] !== localSessions) {
540400
+ t5 = localSessions.slice(0, MAX_SESSIONS);
540401
+ $[4] = localSessions;
540402
+ $[5] = t5;
540403
+ } else t5 = $[5];
540404
+ const sessions = t5;
540405
+ const showHistory = rows >= 16 && sessions.length > 0;
540406
+ const sessionsFocused = activeId === FOCUS_SESSIONS;
540299
540407
  let t6;
540300
- if ($[5] !== t5 || $[6] !== theme.background) {
540301
- t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540408
+ if ($[6] !== onSlashCommand) {
540409
+ t6 = (sessionId) => {
540410
+ onSlashCommand?.({
540411
+ commandId: "sessions",
540412
+ value: sessionId
540413
+ });
540414
+ };
540415
+ $[6] = onSlashCommand;
540416
+ $[7] = t6;
540417
+ } else t6 = $[7];
540418
+ const handleSessionSelect = t6;
540419
+ const t7 = columns >= 70 && rows >= 20 ? LOGO : columns >= 28 && rows >= 14 ? LOGO_SMALL : "BUILDER";
540420
+ let t8;
540421
+ if ($[8] !== t7 || $[9] !== theme.background) {
540422
+ t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540302
540423
  flexDirection: "column",
540303
540424
  alignItems: "center",
540304
540425
  marginBottom: 1,
@@ -540306,17 +540427,17 @@ const WelcomeScreen = (0, import_react.memo)((t0) => {
540306
540427
  name: "vice",
540307
540428
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540308
540429
  backgroundColor: theme.background,
540309
- children: t5
540430
+ children: t7
540310
540431
  })
540311
540432
  })
540312
540433
  });
540313
- $[5] = t5;
540314
- $[6] = theme.background;
540315
- $[7] = t6;
540316
- } else t6 = $[7];
540317
- let t7;
540318
- if ($[8] !== isTabActive || $[9] !== onChange || $[10] !== onSlashCommand || $[11] !== onSlashMenuActiveChange || $[12] !== onSubmit || $[13] !== onToggleSessionMode) {
540319
- t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputPrompt, {
540434
+ $[8] = t7;
540435
+ $[9] = theme.background;
540436
+ $[10] = t8;
540437
+ } else t8 = $[10];
540438
+ let t9;
540439
+ if ($[11] !== isTabActive || $[12] !== onChange || $[13] !== onSlashCommand || $[14] !== onSlashMenuActiveChange || $[15] !== onSubmit || $[16] !== onToggleSessionMode) {
540440
+ t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputPrompt, {
540320
540441
  onSubmit,
540321
540442
  onChange,
540322
540443
  onSlashCommand,
@@ -540324,83 +540445,119 @@ const WelcomeScreen = (0, import_react.memo)((t0) => {
540324
540445
  onToggleSessionMode,
540325
540446
  isTabActive
540326
540447
  });
540327
- $[8] = isTabActive;
540328
- $[9] = onChange;
540329
- $[10] = onSlashCommand;
540330
- $[11] = onSlashMenuActiveChange;
540331
- $[12] = onSubmit;
540332
- $[13] = onToggleSessionMode;
540333
- $[14] = t7;
540334
- } else t7 = $[14];
540335
- let t8;
540336
- if ($[15] !== inputWidth || $[16] !== t7) {
540337
- t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540448
+ $[11] = isTabActive;
540449
+ $[12] = onChange;
540450
+ $[13] = onSlashCommand;
540451
+ $[14] = onSlashMenuActiveChange;
540452
+ $[15] = onSubmit;
540453
+ $[16] = onToggleSessionMode;
540454
+ $[17] = t9;
540455
+ } else t9 = $[17];
540456
+ let t10;
540457
+ if ($[18] !== inputWidth || $[19] !== t9) {
540458
+ t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540338
540459
  width: inputWidth,
540339
540460
  flexDirection: "column",
540340
- children: t7
540341
- });
540342
- $[15] = inputWidth;
540343
- $[16] = t7;
540344
- $[17] = t8;
540345
- } else t8 = $[17];
540346
- let t9;
540347
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
540348
- t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540349
- dimColor: true,
540350
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540351
- bold: true,
540352
- children: "tab"
540353
- }), " agents"]
540461
+ children: t9
540354
540462
  });
540355
- $[18] = t9;
540356
- } else t9 = $[18];
540357
- let t10;
540358
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
540359
- t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540360
- gap: 3,
540361
- children: [t9, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540362
- dimColor: true,
540363
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540364
- bold: true,
540365
- children: "ctrl+]"
540366
- }), " cycle modes"]
540367
- })]
540368
- });
540369
- $[19] = t10;
540370
- } else t10 = $[19];
540463
+ $[18] = inputWidth;
540464
+ $[19] = t9;
540465
+ $[20] = t10;
540466
+ } else t10 = $[20];
540371
540467
  let t11;
540372
- if ($[20] !== displayCwd) {
540373
- t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540468
+ if ($[21] !== handleSessionSelect || $[22] !== inputWidth || $[23] !== isTabActive || $[24] !== sessions || $[25] !== showHistory) {
540469
+ t11 = showHistory && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540470
+ width: inputWidth,
540471
+ marginTop: 1,
540472
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecentSessions, {
540473
+ sessions,
540474
+ maxTitleWidth: inputWidth - 20,
540475
+ focusId: FOCUS_SESSIONS,
540476
+ isTabActive,
540477
+ onSelect: handleSessionSelect
540478
+ })
540479
+ });
540480
+ $[21] = handleSessionSelect;
540481
+ $[22] = inputWidth;
540482
+ $[23] = isTabActive;
540483
+ $[24] = sessions;
540484
+ $[25] = showHistory;
540485
+ $[26] = t11;
540486
+ } else t11 = $[26];
540487
+ let t12;
540488
+ if ($[27] !== displayCwd || $[28] !== rows || $[29] !== sessionsFocused) {
540489
+ t12 = rows > 14 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540374
540490
  marginTop: 1,
540375
540491
  flexDirection: "column",
540376
540492
  alignItems: "center",
540377
- children: [t10, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540493
+ children: [sessionsFocused ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540494
+ gap: 3,
540495
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540496
+ dimColor: true,
540497
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540498
+ bold: true,
540499
+ children: "↑↓"
540500
+ }), " navigate"]
540501
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540502
+ dimColor: true,
540503
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540504
+ bold: true,
540505
+ children: "enter"
540506
+ }), " resume"]
540507
+ })]
540508
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540509
+ gap: 3,
540510
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540511
+ dimColor: true,
540512
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540513
+ bold: true,
540514
+ children: "↑↓"
540515
+ }), " navigate"]
540516
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540517
+ dimColor: true,
540518
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540519
+ bold: true,
540520
+ children: "tab"
540521
+ }), " switch modes"]
540522
+ })]
540523
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540378
540524
  dimColor: true,
540379
- children: displayCwd
540525
+ children: [
540526
+ displayCwd,
540527
+ " ",
540528
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540529
+ dimColor: true,
540530
+ children: ["v", VERSION$1]
540531
+ })
540532
+ ]
540380
540533
  })]
540381
540534
  });
540382
- $[20] = displayCwd;
540383
- $[21] = t11;
540384
- } else t11 = $[21];
540385
- let t12;
540386
- if ($[22] !== t11 || $[23] !== t6 || $[24] !== t8) {
540387
- t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540535
+ $[27] = displayCwd;
540536
+ $[28] = rows;
540537
+ $[29] = sessionsFocused;
540538
+ $[30] = t12;
540539
+ } else t12 = $[30];
540540
+ let t13;
540541
+ if ($[31] !== t10 || $[32] !== t11 || $[33] !== t12 || $[34] !== t8) {
540542
+ t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540388
540543
  flexDirection: "column",
540389
540544
  alignItems: "center",
540390
540545
  justifyContent: "center",
540391
540546
  flexGrow: 1,
540392
540547
  children: [
540393
- t6,
540394
540548
  t8,
540395
- t11
540549
+ t10,
540550
+ t11,
540551
+ t12
540396
540552
  ]
540397
540553
  });
540398
- $[22] = t11;
540399
- $[23] = t6;
540400
- $[24] = t8;
540401
- $[25] = t12;
540402
- } else t12 = $[25];
540403
- return t12;
540554
+ $[31] = t10;
540555
+ $[32] = t11;
540556
+ $[33] = t12;
540557
+ $[34] = t8;
540558
+ $[35] = t13;
540559
+ } else t13 = $[35];
540560
+ return t13;
540404
540561
  });
540405
540562
  //#endregion
540406
540563
  //#region src/hooks/useToast.ts
@@ -540754,7 +540911,7 @@ const GeneratingProgress = (0, import_react.memo)(() => {
540754
540911
  const todos = state.todoItems ?? [];
540755
540912
  const completed = todos.filter(_temp$5);
540756
540913
  const inProgress = todos.find(_temp2$4);
540757
- const pending = todos.filter(_temp3$3);
540914
+ const pending = todos.filter(_temp3$2);
540758
540915
  const lastCompleted = completed[completed.length - 1];
540759
540916
  const openCount = pending.length + (inProgress ? 1 : 0);
540760
540917
  const hasTodos = todos.length > 0;
@@ -540977,12 +541134,12 @@ const ProgressBar = (0, import_react.memo)(() => {
540977
541134
  $[0] = t0;
540978
541135
  } else t0 = $[0];
540979
541136
  const { frame } = useAnimation(t0);
540980
- const pos = frame % 20;
540981
- const center = pos < 10 ? pos : 20 - pos;
541137
+ const pos = frame % 16;
541138
+ const center = pos < 8 ? pos : 16 - pos;
540982
541139
  let t1;
540983
541140
  if ($[1] !== center) {
540984
- t1 = Array.from({ length: 10 }, (_, i) => {
540985
- return Math.abs(i - center) < 4 ? "█" : "░";
541141
+ t1 = Array.from({ length: 8 }, (_, i) => {
541142
+ return Math.abs(i - center) < 3 ? "█" : "░";
540986
541143
  });
540987
541144
  $[1] = center;
540988
541145
  $[2] = t1;
@@ -541005,7 +541162,7 @@ function _temp$5(t) {
541005
541162
  function _temp2$4(t_0) {
541006
541163
  return t_0.status === "in_progress";
541007
541164
  }
541008
- function _temp3$3(t_1) {
541165
+ function _temp3$2(t_1) {
541009
541166
  return t_1.status === "pending";
541010
541167
  }
541011
541168
  //#endregion
@@ -542040,7 +542197,7 @@ const TodoSection = (0, import_react.memo)(() => {
542040
542197
  } else t2 = $[5];
542041
542198
  let t3;
542042
542199
  if ($[6] !== state.todoItems) {
542043
- t3 = state.todoItems.map(_temp3$2);
542200
+ t3 = state.todoItems.map(_temp3$1);
542044
542201
  $[6] = state.todoItems;
542045
542202
  $[7] = t3;
542046
542203
  } else t3 = $[7];
@@ -542125,7 +542282,7 @@ const FooterSection = (0, import_react.memo)(() => {
542125
542282
  children: [
542126
542283
  "•",
542127
542284
  " Fusion ",
542128
- "0.4.4"
542285
+ "0.4.6"
542129
542286
  ]
542130
542287
  });
542131
542288
  $[10] = t7;
@@ -542217,7 +542374,7 @@ function _temp$4(item) {
542217
542374
  function _temp2$3(t) {
542218
542375
  return t.status === "completed";
542219
542376
  }
542220
- function _temp3$2(item) {
542377
+ function _temp3$1(item) {
542221
542378
  const icon = item.status === "completed" ? "✓" : item.status === "in_progress" ? "▶" : "○";
542222
542379
  const color = item.status === "completed" ? "green" : item.status === "in_progress" ? "yellow" : "gray";
542223
542380
  const content = item.content ?? "";
@@ -602151,7 +602308,7 @@ function ToolCallGrep(t0) {
602151
602308
  t5 = previewFiles && previewFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
602152
602309
  flexDirection: "column",
602153
602310
  paddingLeft: 2,
602154
- children: [previewFiles.map(_temp3$1), hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
602311
+ children: [previewFiles.map(_temp3), hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
602155
602312
  flexDirection: "row",
602156
602313
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
602157
602314
  dimColor: true,
@@ -602221,7 +602378,7 @@ function ToolCallGrep(t0) {
602221
602378
  } else t7 = $[35];
602222
602379
  return t7;
602223
602380
  }
602224
- function _temp3$1(file, i) {
602381
+ function _temp3(file, i) {
602225
602382
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
602226
602383
  flexDirection: "row",
602227
602384
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
@@ -603667,6 +603824,7 @@ function _temp$2(result) {
603667
603824
  justifyContent: "space-between",
603668
603825
  paddingLeft: 6,
603669
603826
  "aria-hidden": true,
603827
+ columnGap: 2,
603670
603828
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603671
603829
  dimColor: true,
603672
603830
  children: result.filePath
@@ -603731,8 +603889,8 @@ var ErrorBoundary = class extends import_react.Component {
603731
603889
  //#endregion
603732
603890
  //#region src/components/CodeSession.tsx
603733
603891
  const CodeSessionWrapper = (0, import_react.memo)((t0) => {
603734
- const $ = (0, import_compiler_runtime.c)(11);
603735
- const { session, onExit, isTabActive: t1, updateCheck, credentials } = t0;
603892
+ const $ = (0, import_compiler_runtime.c)(13);
603893
+ const { session, onExit, isTabActive: t1, updateCheck, credentials, onResumeSession, localSessions } = t0;
603736
603894
  const isTabActive = t1 === void 0 ? true : t1;
603737
603895
  const [proxy, api] = useCodeGenFromSession(session);
603738
603896
  let t2;
@@ -603743,32 +603901,36 @@ const CodeSessionWrapper = (0, import_react.memo)((t0) => {
603743
603901
  $[2] = t2;
603744
603902
  } else t2 = $[2];
603745
603903
  let t3;
603746
- if ($[3] !== credentials || $[4] !== isTabActive || $[5] !== onExit || $[6] !== updateCheck) {
603904
+ if ($[3] !== credentials || $[4] !== isTabActive || $[5] !== localSessions || $[6] !== onExit || $[7] !== onResumeSession || $[8] !== updateCheck) {
603747
603905
  t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeSession, {
603748
603906
  onExit,
603749
603907
  isTabActive,
603750
603908
  updateCheck,
603751
- credentials
603909
+ credentials,
603910
+ onResumeSession,
603911
+ localSessions
603752
603912
  });
603753
603913
  $[3] = credentials;
603754
603914
  $[4] = isTabActive;
603755
- $[5] = onExit;
603756
- $[6] = updateCheck;
603757
- $[7] = t3;
603758
- } else t3 = $[7];
603915
+ $[5] = localSessions;
603916
+ $[6] = onExit;
603917
+ $[7] = onResumeSession;
603918
+ $[8] = updateCheck;
603919
+ $[9] = t3;
603920
+ } else t3 = $[9];
603759
603921
  let t4;
603760
- if ($[8] !== t2 || $[9] !== t3) {
603922
+ if ($[10] !== t2 || $[11] !== t3) {
603761
603923
  t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeGenStateContext.Provider, {
603762
603924
  value: t2,
603763
603925
  children: t3
603764
603926
  });
603765
- $[8] = t2;
603766
- $[9] = t3;
603767
- $[10] = t4;
603768
- } else t4 = $[10];
603927
+ $[10] = t2;
603928
+ $[11] = t3;
603929
+ $[12] = t4;
603930
+ } else t4 = $[12];
603769
603931
  return t4;
603770
603932
  });
603771
- const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, updateCheck, credentials }) => {
603933
+ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, updateCheck, credentials, onResumeSession, localSessions }) => {
603772
603934
  const { stdout } = useStdout();
603773
603935
  const { rows, columns } = useWindowSize();
603774
603936
  const [slashMenuActive, setSlashMenuActive] = (0, import_react.useState)(false);
@@ -603947,6 +604109,9 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, update
603947
604109
  case "rewind":
603948
604110
  setRewindMode(true);
603949
604111
  break;
604112
+ case "sessions":
604113
+ if (selection.value && onResumeSession) onResumeSession(selection.value);
604114
+ break;
603950
604115
  case "effort":
603951
604116
  if (selection.value) setPreference("reasoning", selection.value);
603952
604117
  break;
@@ -603968,7 +604133,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, update
603968
604133
  api,
603969
604134
  proxy,
603970
604135
  prefs,
603971
- setPreference
604136
+ setPreference,
604137
+ onResumeSession
603972
604138
  ]);
603973
604139
  const handleToggleSessionMode = (0, import_react.useCallback)(() => {
603974
604140
  if (proxy.sessionMode) if (proxy.sessionMode === "planning" || proxy.sessionMode === "auto-planning") api.switchSessionMode("normal");
@@ -604094,21 +604260,18 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, update
604094
604260
  const isAnsweringQuestion = !!state.activeUserQuestions;
604095
604261
  const showPlanActions = !!state.hasPlanToApply && !refinePlanMode && !isAnsweringQuestion && state.state !== "generating";
604096
604262
  const showInput = !isAnsweringQuestion && !showPlanActions && !rewindMode;
604097
- if (showWelcome()) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
604263
+ if (showWelcome()) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
604098
604264
  flexDirection: "column",
604099
604265
  flexGrow: 1,
604100
604266
  paddingX: 1,
604101
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(WelcomeScreen, {
604267
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WelcomeScreen, {
604102
604268
  onSubmit: handlePromptSubmit,
604103
604269
  onSlashCommand: handleSlashCommand,
604104
604270
  onSlashMenuActiveChange: setSlashMenuActive,
604105
604271
  onToggleSessionMode: handleToggleSessionMode,
604106
- isTabActive
604107
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusBar, {
604108
- ctrlCPending,
604109
- showSidebar: false,
604110
- updateCheck
604111
- })]
604272
+ isTabActive,
604273
+ localSessions
604274
+ })
604112
604275
  });
604113
604276
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
604114
604277
  flexDirection: "row",
@@ -604117,12 +604280,19 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, update
604117
604280
  flexDirection: "column",
604118
604281
  flexGrow: 1,
604119
604282
  paddingRight: 2,
604120
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
604283
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
604121
604284
  flexDirection: "column",
604122
604285
  flexGrow: 1,
604123
604286
  flexBasis: 0,
604124
604287
  overflow: "hidden",
604125
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
604288
+ children: [messageCount === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
604289
+ paddingX: 2,
604290
+ paddingY: 1,
604291
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
604292
+ dimColor: true,
604293
+ children: "No messages yet. Type a prompt below to get started."
604294
+ })
604295
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
604126
604296
  fallback: (error) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
604127
604297
  flexDirection: "column",
604128
604298
  padding: 1,
@@ -604151,7 +604321,7 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, update
604151
604321
  }, `${msgId}-${idx}`);
604152
604322
  })
604153
604323
  })
604154
- })
604324
+ })]
604155
604325
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
604156
604326
  flexDirection: "column",
604157
604327
  children: [
@@ -606187,9 +606357,12 @@ function CodeCommand({ onExit, sys, options, updateCheck }) {
606187
606357
  const sessionRef = (0, import_react.useRef)(null);
606188
606358
  const credentialsRef = (0, import_react.useRef)(null);
606189
606359
  const { rows } = useWindowSize();
606360
+ const { focus } = useFocusManager();
606190
606361
  const [credentials, setCredentials] = (0, import_react.useState)(null);
606362
+ const [sessionVersion, setSessionVersion] = (0, import_react.useState)(0);
606191
606363
  const [displayMode, setDisplayMode] = (0, import_react.useState)("code");
606192
606364
  const [clawHasUnread, setClawHasUnread] = (0, import_react.useState)(false);
606365
+ const localSessions = useLocalHistory(sys.getCwdDir?.() ?? process.cwd());
606193
606366
  const { columns: kanbanColumns, loading: kanbanLoading, error: kanbanError, refetch: kanbanRefetch, clawEnabled } = useKanbanSession(credentials);
606194
606367
  const cleanup = (0, import_react.useCallback)((info) => {
606195
606368
  exit();
@@ -606213,6 +606386,9 @@ function CodeCommand({ onExit, sys, options, updateCheck }) {
606213
606386
  setDisplayMode((prev) => prev === "code" ? "claw" : prev === "claw" ? "kanban" : "code");
606214
606387
  }
606215
606388
  }, { isActive: initPhase === "ready" });
606389
+ (0, import_react.useEffect)(() => {
606390
+ if (displayMode === "code") focus("input-prompt");
606391
+ }, [displayMode]);
606216
606392
  const handleClawNewMessages = (0, import_react.useCallback)(() => {
606217
606393
  if (displayMode !== "claw") setClawHasUnread(true);
606218
606394
  }, [displayMode]);
@@ -606249,10 +606425,11 @@ function CodeCommand({ onExit, sys, options, updateCheck }) {
606249
606425
  const codeSession = new CodeGenSession({
606250
606426
  sys,
606251
606427
  credentials: creds,
606252
- position: "cli",
606428
+ position: "builder-code",
606253
606429
  mode: "quality-v4",
606254
606430
  fusionConfig,
606255
606431
  git: false,
606432
+ persistSessionLocally: true,
606256
606433
  ...sessionId ? { sessionOrCompletionId: sessionId } : {}
606257
606434
  });
606258
606435
  await codeSession.initializeSession({ skipSessionLoading: !sessionId && !options?.continue });
@@ -606265,6 +606442,31 @@ function CodeCommand({ onExit, sys, options, updateCheck }) {
606265
606442
  setInitPhase("error");
606266
606443
  }
606267
606444
  }, []);
606445
+ const resumeSession = (0, import_react.useCallback)(async (sessionId_0) => {
606446
+ if (!credentialsRef.current) return;
606447
+ setInitPhase("loading");
606448
+ try {
606449
+ const fusionConfig_0 = await getFusionConfig(sys, { _: [] });
606450
+ const newSession = new CodeGenSession({
606451
+ sys,
606452
+ credentials: credentialsRef.current,
606453
+ position: "builder-code",
606454
+ mode: "quality-v4",
606455
+ fusionConfig: fusionConfig_0,
606456
+ git: false,
606457
+ persistSessionLocally: true,
606458
+ sessionOrCompletionId: sessionId_0,
606459
+ queueMode: "next-turn"
606460
+ });
606461
+ await newSession.initializeSession({ skipSessionLoading: false });
606462
+ sessionRef.current = newSession;
606463
+ setSessionVersion((v) => v + 1);
606464
+ setInitPhase("ready");
606465
+ } catch (err_1) {
606466
+ setInitError(err_1?.message ?? String(err_1));
606467
+ setInitPhase("error");
606468
+ }
606469
+ }, [sys]);
606268
606470
  if (initPhase === "loading") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606269
606471
  flexDirection: "column",
606270
606472
  flexGrow: 1,
@@ -606295,12 +606497,10 @@ function CodeCommand({ onExit, sys, options, updateCheck }) {
606295
606497
  })
606296
606498
  });
606297
606499
  if (initPhase === "needs-login") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NeedsLoginScreen, {
606298
- rows,
606299
606500
  onConfirm: continueInit,
606300
606501
  onExit: cleanup
606301
606502
  });
606302
606503
  if (initPhase === "authenticating") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AuthenticatingScreen, {
606303
- rows,
606304
606504
  authStatus,
606305
606505
  authUrl,
606306
606506
  onExit: cleanup
@@ -606317,7 +606517,7 @@ function CodeCommand({ onExit, sys, options, updateCheck }) {
606317
606517
  flexDirection: "column",
606318
606518
  flexGrow: 1,
606319
606519
  children: [
606320
- clawEnabled === true && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabBar, {
606520
+ clawEnabled === true && rows > 20 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabBar, {
606321
606521
  displayMode,
606322
606522
  clawHasUnread
606323
606523
  }),
@@ -606330,8 +606530,10 @@ function CodeCommand({ onExit, sys, options, updateCheck }) {
606330
606530
  session: sessionRef.current,
606331
606531
  onExit: cleanup,
606332
606532
  isTabActive: onCodegen,
606333
- updateCheck
606334
- })
606533
+ updateCheck,
606534
+ onResumeSession: resumeSession,
606535
+ localSessions
606536
+ }, sessionVersion)
606335
606537
  }),
606336
606538
  clawEnabled === true && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606337
606539
  flexDirection: "column",
@@ -606375,7 +606577,7 @@ function isStandaloneBinary() {
606375
606577
  return !path$6.basename(process.execPath, ".exe").startsWith("node");
606376
606578
  }
606377
606579
  function getCurrentVersion() {
606378
- return "0.4.4";
606580
+ return "0.4.6";
606379
606581
  }
606380
606582
  async function fetchLatestVersion() {
606381
606583
  return new Promise((resolve, reject) => {
@@ -606707,21 +606909,32 @@ function FatalErrorScreen(t0) {
606707
606909
  return t5;
606708
606910
  }
606709
606911
  function App(t0) {
606710
- const $ = (0, import_compiler_runtime.c)(13);
606912
+ const $ = (0, import_compiler_runtime.c)(18);
606711
606913
  const { command, options, sys, theme } = t0;
606712
606914
  const { exit } = useApp();
606713
606915
  const { rows } = useWindowSize();
606714
606916
  const updateCheck = useUpdateCheck();
606917
+ const { disableFocus } = useFocusManager();
606715
606918
  let t1;
606716
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
606717
- t1 = [];
606718
- $[0] = t1;
606719
- } else t1 = $[0];
606720
- (0, import_react.useEffect)(_temp2, t1);
606919
+ if ($[0] !== disableFocus) {
606920
+ t1 = () => {
606921
+ enableSgrMouse();
606922
+ disableFocus();
606923
+ return _temp;
606924
+ };
606925
+ $[0] = disableFocus;
606926
+ $[1] = t1;
606927
+ } else t1 = $[1];
606721
606928
  let t2;
606722
- if ($[1] !== command || $[2] !== exit || $[3] !== options || $[4] !== sys || $[5] !== updateCheck) {
606723
- t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
606724
- fallback: _temp3,
606929
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
606930
+ t2 = [];
606931
+ $[2] = t2;
606932
+ } else t2 = $[2];
606933
+ (0, import_react.useEffect)(t1, t2);
606934
+ let t3;
606935
+ if ($[3] !== command || $[4] !== exit || $[5] !== options || $[6] !== sys || $[7] !== updateCheck) {
606936
+ t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
606937
+ fallback: _temp2,
606725
606938
  children: command === "code" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeCommand, {
606726
606939
  onExit: exit,
606727
606940
  sys,
@@ -606753,43 +606966,49 @@ function App(t0) {
606753
606966
  })]
606754
606967
  })
606755
606968
  });
606756
- $[1] = command;
606757
- $[2] = exit;
606758
- $[3] = options;
606759
- $[4] = sys;
606760
- $[5] = updateCheck;
606761
- $[6] = t2;
606762
- } else t2 = $[6];
606763
- let t3;
606764
- if ($[7] !== rows || $[8] !== t2) {
606765
- t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606969
+ $[3] = command;
606970
+ $[4] = exit;
606971
+ $[5] = options;
606972
+ $[6] = sys;
606973
+ $[7] = updateCheck;
606974
+ $[8] = t3;
606975
+ } else t3 = $[8];
606976
+ let t4;
606977
+ if ($[9] !== rows || $[10] !== t3) {
606978
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606766
606979
  flexDirection: "column",
606767
606980
  height: rows,
606768
- children: t2
606769
- });
606770
- $[7] = rows;
606771
- $[8] = t2;
606772
- $[9] = t3;
606773
- } else t3 = $[9];
606774
- let t4;
606775
- if ($[10] !== t3 || $[11] !== theme) {
606776
- t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext$1.Provider, {
606777
- value: theme,
606778
606981
  children: t3
606779
606982
  });
606983
+ $[9] = rows;
606780
606984
  $[10] = t3;
606781
- $[11] = theme;
606985
+ $[11] = t4;
606986
+ } else t4 = $[11];
606987
+ let t5;
606988
+ if ($[12] !== t4 || $[13] !== theme) {
606989
+ t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext$1.Provider, {
606990
+ value: theme,
606991
+ children: t4
606992
+ });
606782
606993
  $[12] = t4;
606783
- } else t4 = $[12];
606784
- return t4;
606994
+ $[13] = theme;
606995
+ $[14] = t5;
606996
+ } else t5 = $[14];
606997
+ let t6;
606998
+ if ($[15] !== sys || $[16] !== t5) {
606999
+ t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SysContext.Provider, {
607000
+ value: sys,
607001
+ children: t5
607002
+ });
607003
+ $[15] = sys;
607004
+ $[16] = t5;
607005
+ $[17] = t6;
607006
+ } else t6 = $[17];
607007
+ return t6;
606785
607008
  }
606786
- function _temp3(error) {
607009
+ function _temp2(error) {
606787
607010
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FatalErrorScreen, { error });
606788
607011
  }
606789
- function _temp2() {
606790
- enableSgrMouse();
606791
- return _temp;
606792
- }
606793
607012
  function _temp() {
606794
607013
  resetTerminal();
606795
607014
  }
@@ -606799,7 +607018,7 @@ function initSentry() {
606799
607018
  init({
606800
607019
  dsn: "https://1c5033d697e0271ebe53773bff826de0@o117565.ingest.us.sentry.io/4511107776905216",
606801
607020
  tracesSampleRate: 0,
606802
- release: "0.4.4",
607021
+ release: "0.4.6",
606803
607022
  environment: process.env.NODE_ENV ?? "development",
606804
607023
  enabled: false,
606805
607024
  registerEsmLoaderHooks: false,
@@ -606811,7 +607030,7 @@ function initSentry() {
606811
607030
  }
606812
607031
  //#endregion
606813
607032
  //#region src/cli.tsx
606814
- const VERSION = "0.4.4";
607033
+ const VERSION = "0.4.6";
606815
607034
  async function startInk(command, options) {
606816
607035
  const sys = await createDevToolsNodeSys({
606817
607036
  cwd: process.cwd(),