@builder.io/buildercode 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +907 -651
  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.5";
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,11 @@ 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
+ autoFocus: true,
537799
+ isActive: isTabActive
537800
+ });
537801
+ const { focusNext } = useFocusManager();
537779
537802
  const [state] = useCodeGenState();
537780
537803
  const [dismissedSlashValue, setDismissedSlashValue] = (0, import_react.useState)(null);
537781
537804
  const [dismissedAtValue, setDismissedAtValue] = (0, import_react.useState)(null);
@@ -537812,12 +537835,13 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
537812
537835
  onChange: handleChange,
537813
537836
  onTab: onToggleSessionMode,
537814
537837
  onShiftTab: onToggleSessionMode,
537815
- isActive: isTabActive,
537838
+ isActive: isTabActive && isFocused,
537816
537839
  getIsMenuActive,
537817
537840
  submitDisabled: false,
537818
537841
  initialValue,
537819
537842
  inputWidth,
537820
537843
  onPaste: () => void Promise.resolve(pasteHandlerRef.current()).catch(() => {}),
537844
+ onDownEmpty: focusNext,
537821
537845
  onBackspaceEmpty: pendingAttachments.length > 0 && onRemoveAttachment ? () => {
537822
537846
  const last = pendingAttachments[pendingAttachments.length - 1];
537823
537847
  if (last) onRemoveAttachment(last.id);
@@ -537996,6 +538020,7 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
537996
538020
  rows: 1,
537997
538021
  placeholder: hint,
537998
538022
  showCursor: true,
538023
+ focus: isTabActive && isFocused,
537999
538024
  maxRows: 10
538000
538025
  })
538001
538026
  }),
@@ -540242,7 +540267,96 @@ const Gradient = (props) => {
540242
540267
  return (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: applyGradientToChildren(props.children) });
540243
540268
  };
540244
540269
  //#endregion
540270
+ //#region src/components/RecentSessions.tsx
540271
+ const RecentSessions = (0, import_react.memo)(({ cwd, sessions: sessionsProp, limit = 5, maxTitleWidth = 60, showHint = false, focusId, isTabActive = true, onSelect }) => {
540272
+ const localHistory = useLocalHistory(cwd ?? process.cwd());
540273
+ const theme = useTheme();
540274
+ const sessions = (sessionsProp ?? localHistory).slice(0, limit);
540275
+ const { isFocused } = useFocus({
540276
+ id: focusId ?? "__noop__",
540277
+ isActive: isTabActive
540278
+ });
540279
+ const { focusPrevious } = useFocusManager();
540280
+ const [selectedIndex, setSelectedIndex] = (0, import_react.useState)(0);
540281
+ const selectedIndexRef = (0, import_react.useRef)(selectedIndex);
540282
+ selectedIndexRef.current = selectedIndex;
540283
+ (0, import_react.useEffect)(() => {
540284
+ if (isFocused) setSelectedIndex(0);
540285
+ }, [isFocused]);
540286
+ const isNavigable = Boolean(focusId);
540287
+ useInput((_, key) => {
540288
+ if (key.upArrow) {
540289
+ if (selectedIndexRef.current === 0) focusPrevious();
540290
+ else setSelectedIndex((i) => i - 1);
540291
+ return;
540292
+ }
540293
+ if (key.downArrow) {
540294
+ setSelectedIndex((i_0) => i_0 < sessions.length - 1 ? i_0 + 1 : i_0);
540295
+ return;
540296
+ }
540297
+ if (key.escape) {
540298
+ focusPrevious();
540299
+ return;
540300
+ }
540301
+ if (key.return) {
540302
+ const entry = sessions[selectedIndexRef.current];
540303
+ if (entry) onSelect?.(entry.sessionId);
540304
+ }
540305
+ }, { isActive: isNavigable && isTabActive && isFocused });
540306
+ const activeIndex = isNavigable && isFocused ? selectedIndex : void 0;
540307
+ if (sessions.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540308
+ paddingX: 1,
540309
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540310
+ dimColor: true,
540311
+ children: "No recent sessions found for this directory."
540312
+ })
540313
+ });
540314
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540315
+ flexDirection: "column",
540316
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540317
+ paddingX: 1,
540318
+ marginBottom: 0,
540319
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540320
+ dimColor: true,
540321
+ bold: true,
540322
+ children: "Recent sessions"
540323
+ }), showHint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540324
+ dimColor: true,
540325
+ children: " · /sessions to browse"
540326
+ })]
540327
+ }), sessions.map((entry_0, i_1) => {
540328
+ const isSelected = i_1 === activeIndex;
540329
+ const title = entry_0.title.length > maxTitleWidth ? entry_0.title.slice(0, maxTitleWidth - 3) + "..." : entry_0.title;
540330
+ const timeStr = formatRelativeTime(entry_0.lastActiveAt);
540331
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540332
+ paddingX: 1,
540333
+ gap: 1,
540334
+ children: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540335
+ backgroundColor: theme.highlightBackground,
540336
+ color: theme.highlight,
540337
+ children: ` ▶ ${title} ${timeStr} `
540338
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
540339
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540340
+ dimColor: true,
540341
+ children: "·"
540342
+ }),
540343
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540344
+ dimColor: true,
540345
+ children: title
540346
+ }),
540347
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540348
+ dimColor: true,
540349
+ children: timeStr
540350
+ })
540351
+ ] })
540352
+ }, entry_0.sessionId);
540353
+ })]
540354
+ });
540355
+ });
540356
+ //#endregion
540245
540357
  //#region src/components/WelcomeScreen.tsx
540358
+ const VERSION$1 = "0.4.5";
540359
+ const FOCUS_SESSIONS = "welcome-sessions";
540246
540360
  const LOGO = `
540247
540361
  ██████╗ ██╗ ██╗ ██╗ ██╗ ██████╗ ███████╗ ██████╗
540248
540362
  ██╔══██╗ ██║ ██║ ██║ ██║ ██╔══██╗ ██╔════╝ ██╔══██╗
@@ -540255,19 +540369,28 @@ const LOGO_SMALL = `
540255
540369
  ╔╗ ╦ ╦ ╦ ╦ ╔╦╗ ╔═╗ ╦═╗
540256
540370
  ╠╩╗ ║ ║ ║ ║ ║ ║ ║╣ ╠╦╝
540257
540371
  ╚═╝ ╚═╝ ╩ ╩═╝╚╩╝ ╚═╝ ╩╚═`.trim();
540372
+ const MAX_SESSIONS = 5;
540258
540373
  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;
540374
+ const $ = (0, import_compiler_runtime.c)(43);
540375
+ const { onSubmit, onChange, onSlashCommand, onSlashMenuActiveChange, onToggleSessionMode, isTabActive: t1, localSessions: t2 } = t0;
540261
540376
  const isTabActive = t1 === void 0 ? true : t1;
540377
+ let t3;
540378
+ if ($[0] !== t2) {
540379
+ t3 = t2 === void 0 ? [] : t2;
540380
+ $[0] = t2;
540381
+ $[1] = t3;
540382
+ } else t3 = $[1];
540383
+ const localSessions = t3;
540262
540384
  const [state] = useCodeGenState();
540263
540385
  const { stdout } = useStdout();
540264
540386
  const theme = useTheme();
540387
+ const { activeId } = useFocusManager();
540265
540388
  const [cols, setCols] = (0, import_react.useState)(stdout?.columns ?? 80);
540266
540389
  const [rows, setRows] = (0, import_react.useState)(stdout?.rows ?? 24);
540267
- let t2;
540268
- let t3;
540269
- if ($[0] !== stdout) {
540270
- t2 = () => {
540390
+ let t4;
540391
+ let t5;
540392
+ if ($[2] !== stdout) {
540393
+ t4 = () => {
540271
540394
  if (!stdout) return;
540272
540395
  const onResize = () => {
540273
540396
  setCols(stdout.columns ?? 80);
@@ -540278,27 +540401,48 @@ const WelcomeScreen = (0, import_react.memo)((t0) => {
540278
540401
  stdout.off("resize", onResize);
540279
540402
  };
540280
540403
  };
540281
- t3 = [stdout];
540282
- $[0] = stdout;
540283
- $[1] = t2;
540284
- $[2] = t3;
540404
+ t5 = [stdout];
540405
+ $[2] = stdout;
540406
+ $[3] = t4;
540407
+ $[4] = t5;
540285
540408
  } else {
540286
- t2 = $[1];
540287
- t3 = $[2];
540409
+ t4 = $[3];
540410
+ t5 = $[4];
540288
540411
  }
540289
- (0, import_react.useEffect)(t2, t3);
540290
- let t4;
540291
- if ($[3] !== state.cwd) {
540292
- 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];
540296
- 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";
540412
+ (0, import_react.useEffect)(t4, t5);
540299
540413
  let t6;
540300
- if ($[5] !== t5 || $[6] !== theme.background) {
540301
- t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540414
+ if ($[5] !== state.cwd) {
540415
+ t6 = state.cwd ? state.cwd.replace(process.env.HOME ?? "", "~") : process.cwd().replace(process.env.HOME ?? "", "~");
540416
+ $[5] = state.cwd;
540417
+ $[6] = t6;
540418
+ } else t6 = $[6];
540419
+ const displayCwd = t6;
540420
+ const inputWidth = Math.min(Math.max(cols, 20), 90);
540421
+ let t7;
540422
+ if ($[7] !== localSessions) {
540423
+ t7 = localSessions.slice(0, MAX_SESSIONS);
540424
+ $[7] = localSessions;
540425
+ $[8] = t7;
540426
+ } else t7 = $[8];
540427
+ const sessions = t7;
540428
+ const showHistory = rows >= 16 && sessions.length > 0;
540429
+ const sessionsFocused = activeId === FOCUS_SESSIONS;
540430
+ let t8;
540431
+ if ($[9] !== onSlashCommand) {
540432
+ t8 = (sessionId) => {
540433
+ onSlashCommand?.({
540434
+ commandId: "sessions",
540435
+ value: sessionId
540436
+ });
540437
+ };
540438
+ $[9] = onSlashCommand;
540439
+ $[10] = t8;
540440
+ } else t8 = $[10];
540441
+ const handleSessionSelect = t8;
540442
+ const t9 = cols >= 70 && rows >= 20 ? LOGO : cols >= 28 && rows >= 14 ? LOGO_SMALL : "BUILDER";
540443
+ let t10;
540444
+ if ($[11] !== t9 || $[12] !== theme.background) {
540445
+ t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540302
540446
  flexDirection: "column",
540303
540447
  alignItems: "center",
540304
540448
  marginBottom: 1,
@@ -540306,17 +540450,17 @@ const WelcomeScreen = (0, import_react.memo)((t0) => {
540306
540450
  name: "vice",
540307
540451
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540308
540452
  backgroundColor: theme.background,
540309
- children: t5
540453
+ children: t9
540310
540454
  })
540311
540455
  })
540312
540456
  });
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, {
540457
+ $[11] = t9;
540458
+ $[12] = theme.background;
540459
+ $[13] = t10;
540460
+ } else t10 = $[13];
540461
+ let t11;
540462
+ if ($[14] !== isTabActive || $[15] !== onChange || $[16] !== onSlashCommand || $[17] !== onSlashMenuActiveChange || $[18] !== onSubmit || $[19] !== onToggleSessionMode) {
540463
+ t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputPrompt, {
540320
540464
  onSubmit,
540321
540465
  onChange,
540322
540466
  onSlashCommand,
@@ -540324,83 +540468,135 @@ const WelcomeScreen = (0, import_react.memo)((t0) => {
540324
540468
  onToggleSessionMode,
540325
540469
  isTabActive
540326
540470
  });
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, {
540471
+ $[14] = isTabActive;
540472
+ $[15] = onChange;
540473
+ $[16] = onSlashCommand;
540474
+ $[17] = onSlashMenuActiveChange;
540475
+ $[18] = onSubmit;
540476
+ $[19] = onToggleSessionMode;
540477
+ $[20] = t11;
540478
+ } else t11 = $[20];
540479
+ let t12;
540480
+ if ($[21] !== inputWidth || $[22] !== t11) {
540481
+ t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540338
540482
  width: inputWidth,
540339
540483
  flexDirection: "column",
540340
- children: t7
540484
+ children: t11
540341
540485
  });
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"]
540486
+ $[21] = inputWidth;
540487
+ $[22] = t11;
540488
+ $[23] = t12;
540489
+ } else t12 = $[23];
540490
+ let t13;
540491
+ if ($[24] !== handleSessionSelect || $[25] !== inputWidth || $[26] !== isTabActive || $[27] !== sessions || $[28] !== showHistory) {
540492
+ t13 = showHistory && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540493
+ width: inputWidth,
540494
+ marginTop: 1,
540495
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecentSessions, {
540496
+ sessions,
540497
+ maxTitleWidth: inputWidth - 20,
540498
+ focusId: FOCUS_SESSIONS,
540499
+ isTabActive,
540500
+ onSelect: handleSessionSelect
540501
+ })
540354
540502
  });
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, {
540503
+ $[24] = handleSessionSelect;
540504
+ $[25] = inputWidth;
540505
+ $[26] = isTabActive;
540506
+ $[27] = sessions;
540507
+ $[28] = showHistory;
540508
+ $[29] = t13;
540509
+ } else t13 = $[29];
540510
+ let t14;
540511
+ if ($[30] !== sessionsFocused) {
540512
+ t14 = sessionsFocused ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540360
540513
  gap: 3,
540361
- children: [t9, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540514
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540515
+ dimColor: true,
540516
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540517
+ bold: true,
540518
+ children: "↑↓"
540519
+ }), " navigate"]
540520
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540362
540521
  dimColor: true,
540363
540522
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540364
540523
  bold: true,
540365
- children: "ctrl+]"
540366
- }), " cycle modes"]
540524
+ children: "enter"
540525
+ }), " resume"]
540526
+ })]
540527
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540528
+ gap: 3,
540529
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540530
+ dimColor: true,
540531
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540532
+ bold: true,
540533
+ children: "↑↓"
540534
+ }), " navigate"]
540535
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540536
+ dimColor: true,
540537
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540538
+ bold: true,
540539
+ children: "tab"
540540
+ }), " switch modes"]
540367
540541
  })]
540368
540542
  });
540369
- $[19] = t10;
540370
- } else t10 = $[19];
540371
- let t11;
540372
- if ($[20] !== displayCwd) {
540373
- t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540543
+ $[30] = sessionsFocused;
540544
+ $[31] = t14;
540545
+ } else t14 = $[31];
540546
+ let t15;
540547
+ if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
540548
+ t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540549
+ dimColor: true,
540550
+ children: ["v", VERSION$1]
540551
+ });
540552
+ $[32] = t15;
540553
+ } else t15 = $[32];
540554
+ let t16;
540555
+ if ($[33] !== displayCwd) {
540556
+ t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540557
+ dimColor: true,
540558
+ children: [
540559
+ displayCwd,
540560
+ " ",
540561
+ t15
540562
+ ]
540563
+ });
540564
+ $[33] = displayCwd;
540565
+ $[34] = t16;
540566
+ } else t16 = $[34];
540567
+ let t17;
540568
+ if ($[35] !== t14 || $[36] !== t16) {
540569
+ t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540374
540570
  marginTop: 1,
540375
540571
  flexDirection: "column",
540376
540572
  alignItems: "center",
540377
- children: [t10, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540378
- dimColor: true,
540379
- children: displayCwd
540380
- })]
540381
- });
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, {
540573
+ children: [t14, t16]
540574
+ });
540575
+ $[35] = t14;
540576
+ $[36] = t16;
540577
+ $[37] = t17;
540578
+ } else t17 = $[37];
540579
+ let t18;
540580
+ if ($[38] !== t10 || $[39] !== t12 || $[40] !== t13 || $[41] !== t17) {
540581
+ t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540388
540582
  flexDirection: "column",
540389
540583
  alignItems: "center",
540390
540584
  justifyContent: "center",
540391
540585
  flexGrow: 1,
540392
540586
  children: [
540393
- t6,
540394
- t8,
540395
- t11
540587
+ t10,
540588
+ t12,
540589
+ t13,
540590
+ t17
540396
540591
  ]
540397
540592
  });
540398
- $[22] = t11;
540399
- $[23] = t6;
540400
- $[24] = t8;
540401
- $[25] = t12;
540402
- } else t12 = $[25];
540403
- return t12;
540593
+ $[38] = t10;
540594
+ $[39] = t12;
540595
+ $[40] = t13;
540596
+ $[41] = t17;
540597
+ $[42] = t18;
540598
+ } else t18 = $[42];
540599
+ return t18;
540404
540600
  });
540405
540601
  //#endregion
540406
540602
  //#region src/hooks/useToast.ts
@@ -540754,7 +540950,7 @@ const GeneratingProgress = (0, import_react.memo)(() => {
540754
540950
  const todos = state.todoItems ?? [];
540755
540951
  const completed = todos.filter(_temp$5);
540756
540952
  const inProgress = todos.find(_temp2$4);
540757
- const pending = todos.filter(_temp3$3);
540953
+ const pending = todos.filter(_temp3$2);
540758
540954
  const lastCompleted = completed[completed.length - 1];
540759
540955
  const openCount = pending.length + (inProgress ? 1 : 0);
540760
540956
  const hasTodos = todos.length > 0;
@@ -540977,12 +541173,12 @@ const ProgressBar = (0, import_react.memo)(() => {
540977
541173
  $[0] = t0;
540978
541174
  } else t0 = $[0];
540979
541175
  const { frame } = useAnimation(t0);
540980
- const pos = frame % 20;
540981
- const center = pos < 10 ? pos : 20 - pos;
541176
+ const pos = frame % 16;
541177
+ const center = pos < 8 ? pos : 16 - pos;
540982
541178
  let t1;
540983
541179
  if ($[1] !== center) {
540984
- t1 = Array.from({ length: 10 }, (_, i) => {
540985
- return Math.abs(i - center) < 4 ? "█" : "░";
541180
+ t1 = Array.from({ length: 8 }, (_, i) => {
541181
+ return Math.abs(i - center) < 3 ? "█" : "░";
540986
541182
  });
540987
541183
  $[1] = center;
540988
541184
  $[2] = t1;
@@ -541005,7 +541201,7 @@ function _temp$5(t) {
541005
541201
  function _temp2$4(t_0) {
541006
541202
  return t_0.status === "in_progress";
541007
541203
  }
541008
- function _temp3$3(t_1) {
541204
+ function _temp3$2(t_1) {
541009
541205
  return t_1.status === "pending";
541010
541206
  }
541011
541207
  //#endregion
@@ -542040,7 +542236,7 @@ const TodoSection = (0, import_react.memo)(() => {
542040
542236
  } else t2 = $[5];
542041
542237
  let t3;
542042
542238
  if ($[6] !== state.todoItems) {
542043
- t3 = state.todoItems.map(_temp3$2);
542239
+ t3 = state.todoItems.map(_temp3$1);
542044
542240
  $[6] = state.todoItems;
542045
542241
  $[7] = t3;
542046
542242
  } else t3 = $[7];
@@ -542125,7 +542321,7 @@ const FooterSection = (0, import_react.memo)(() => {
542125
542321
  children: [
542126
542322
  "•",
542127
542323
  " Fusion ",
542128
- "0.4.4"
542324
+ "0.4.5"
542129
542325
  ]
542130
542326
  });
542131
542327
  $[10] = t7;
@@ -542217,7 +542413,7 @@ function _temp$4(item) {
542217
542413
  function _temp2$3(t) {
542218
542414
  return t.status === "completed";
542219
542415
  }
542220
- function _temp3$2(item) {
542416
+ function _temp3$1(item) {
542221
542417
  const icon = item.status === "completed" ? "✓" : item.status === "in_progress" ? "▶" : "○";
542222
542418
  const color = item.status === "completed" ? "green" : item.status === "in_progress" ? "yellow" : "gray";
542223
542419
  const content = item.content ?? "";
@@ -602151,7 +602347,7 @@ function ToolCallGrep(t0) {
602151
602347
  t5 = previewFiles && previewFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
602152
602348
  flexDirection: "column",
602153
602349
  paddingLeft: 2,
602154
- children: [previewFiles.map(_temp3$1), hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
602350
+ children: [previewFiles.map(_temp3), hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
602155
602351
  flexDirection: "row",
602156
602352
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
602157
602353
  dimColor: true,
@@ -602221,7 +602417,7 @@ function ToolCallGrep(t0) {
602221
602417
  } else t7 = $[35];
602222
602418
  return t7;
602223
602419
  }
602224
- function _temp3$1(file, i) {
602420
+ function _temp3(file, i) {
602225
602421
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
602226
602422
  flexDirection: "row",
602227
602423
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
@@ -603667,6 +603863,7 @@ function _temp$2(result) {
603667
603863
  justifyContent: "space-between",
603668
603864
  paddingLeft: 6,
603669
603865
  "aria-hidden": true,
603866
+ columnGap: 2,
603670
603867
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603671
603868
  dimColor: true,
603672
603869
  children: result.filePath
@@ -603731,8 +603928,8 @@ var ErrorBoundary = class extends import_react.Component {
603731
603928
  //#endregion
603732
603929
  //#region src/components/CodeSession.tsx
603733
603930
  const CodeSessionWrapper = (0, import_react.memo)((t0) => {
603734
- const $ = (0, import_compiler_runtime.c)(11);
603735
- const { session, onExit, isTabActive: t1, updateCheck, credentials } = t0;
603931
+ const $ = (0, import_compiler_runtime.c)(13);
603932
+ const { session, onExit, isTabActive: t1, updateCheck, credentials, onResumeSession, localSessions } = t0;
603736
603933
  const isTabActive = t1 === void 0 ? true : t1;
603737
603934
  const [proxy, api] = useCodeGenFromSession(session);
603738
603935
  let t2;
@@ -603743,32 +603940,36 @@ const CodeSessionWrapper = (0, import_react.memo)((t0) => {
603743
603940
  $[2] = t2;
603744
603941
  } else t2 = $[2];
603745
603942
  let t3;
603746
- if ($[3] !== credentials || $[4] !== isTabActive || $[5] !== onExit || $[6] !== updateCheck) {
603943
+ if ($[3] !== credentials || $[4] !== isTabActive || $[5] !== localSessions || $[6] !== onExit || $[7] !== onResumeSession || $[8] !== updateCheck) {
603747
603944
  t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeSession, {
603748
603945
  onExit,
603749
603946
  isTabActive,
603750
603947
  updateCheck,
603751
- credentials
603948
+ credentials,
603949
+ onResumeSession,
603950
+ localSessions
603752
603951
  });
603753
603952
  $[3] = credentials;
603754
603953
  $[4] = isTabActive;
603755
- $[5] = onExit;
603756
- $[6] = updateCheck;
603757
- $[7] = t3;
603758
- } else t3 = $[7];
603954
+ $[5] = localSessions;
603955
+ $[6] = onExit;
603956
+ $[7] = onResumeSession;
603957
+ $[8] = updateCheck;
603958
+ $[9] = t3;
603959
+ } else t3 = $[9];
603759
603960
  let t4;
603760
- if ($[8] !== t2 || $[9] !== t3) {
603961
+ if ($[10] !== t2 || $[11] !== t3) {
603761
603962
  t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeGenStateContext.Provider, {
603762
603963
  value: t2,
603763
603964
  children: t3
603764
603965
  });
603765
- $[8] = t2;
603766
- $[9] = t3;
603767
- $[10] = t4;
603768
- } else t4 = $[10];
603966
+ $[10] = t2;
603967
+ $[11] = t3;
603968
+ $[12] = t4;
603969
+ } else t4 = $[12];
603769
603970
  return t4;
603770
603971
  });
603771
- const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, updateCheck, credentials }) => {
603972
+ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, updateCheck, credentials, onResumeSession, localSessions }) => {
603772
603973
  const { stdout } = useStdout();
603773
603974
  const { rows, columns } = useWindowSize();
603774
603975
  const [slashMenuActive, setSlashMenuActive] = (0, import_react.useState)(false);
@@ -603947,6 +604148,9 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, update
603947
604148
  case "rewind":
603948
604149
  setRewindMode(true);
603949
604150
  break;
604151
+ case "sessions":
604152
+ if (selection.value && onResumeSession) onResumeSession(selection.value);
604153
+ break;
603950
604154
  case "effort":
603951
604155
  if (selection.value) setPreference("reasoning", selection.value);
603952
604156
  break;
@@ -603968,7 +604172,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, update
603968
604172
  api,
603969
604173
  proxy,
603970
604174
  prefs,
603971
- setPreference
604175
+ setPreference,
604176
+ onResumeSession
603972
604177
  ]);
603973
604178
  const handleToggleSessionMode = (0, import_react.useCallback)(() => {
603974
604179
  if (proxy.sessionMode) if (proxy.sessionMode === "planning" || proxy.sessionMode === "auto-planning") api.switchSessionMode("normal");
@@ -604094,21 +604299,18 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, update
604094
604299
  const isAnsweringQuestion = !!state.activeUserQuestions;
604095
604300
  const showPlanActions = !!state.hasPlanToApply && !refinePlanMode && !isAnsweringQuestion && state.state !== "generating";
604096
604301
  const showInput = !isAnsweringQuestion && !showPlanActions && !rewindMode;
604097
- if (showWelcome()) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
604302
+ if (showWelcome()) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
604098
604303
  flexDirection: "column",
604099
604304
  flexGrow: 1,
604100
604305
  paddingX: 1,
604101
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(WelcomeScreen, {
604306
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WelcomeScreen, {
604102
604307
  onSubmit: handlePromptSubmit,
604103
604308
  onSlashCommand: handleSlashCommand,
604104
604309
  onSlashMenuActiveChange: setSlashMenuActive,
604105
604310
  onToggleSessionMode: handleToggleSessionMode,
604106
- isTabActive
604107
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusBar, {
604108
- ctrlCPending,
604109
- showSidebar: false,
604110
- updateCheck
604111
- })]
604311
+ isTabActive,
604312
+ localSessions
604313
+ })
604112
604314
  });
604113
604315
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
604114
604316
  flexDirection: "row",
@@ -604117,12 +604319,19 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, update
604117
604319
  flexDirection: "column",
604118
604320
  flexGrow: 1,
604119
604321
  paddingRight: 2,
604120
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
604322
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
604121
604323
  flexDirection: "column",
604122
604324
  flexGrow: 1,
604123
604325
  flexBasis: 0,
604124
604326
  overflow: "hidden",
604125
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
604327
+ children: [messageCount === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
604328
+ paddingX: 2,
604329
+ paddingY: 1,
604330
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
604331
+ dimColor: true,
604332
+ children: "No messages yet. Type a prompt below to get started."
604333
+ })
604334
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
604126
604335
  fallback: (error) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
604127
604336
  flexDirection: "column",
604128
604337
  padding: 1,
@@ -604151,7 +604360,7 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, update
604151
604360
  }, `${msgId}-${idx}`);
604152
604361
  })
604153
604362
  })
604154
- })
604363
+ })]
604155
604364
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
604156
604365
  flexDirection: "column",
604157
604366
  children: [
@@ -606188,8 +606397,10 @@ function CodeCommand({ onExit, sys, options, updateCheck }) {
606188
606397
  const credentialsRef = (0, import_react.useRef)(null);
606189
606398
  const { rows } = useWindowSize();
606190
606399
  const [credentials, setCredentials] = (0, import_react.useState)(null);
606400
+ const [sessionVersion, setSessionVersion] = (0, import_react.useState)(0);
606191
606401
  const [displayMode, setDisplayMode] = (0, import_react.useState)("code");
606192
606402
  const [clawHasUnread, setClawHasUnread] = (0, import_react.useState)(false);
606403
+ const localSessions = useLocalHistory(sys.getCwdDir?.() ?? process.cwd());
606193
606404
  const { columns: kanbanColumns, loading: kanbanLoading, error: kanbanError, refetch: kanbanRefetch, clawEnabled } = useKanbanSession(credentials);
606194
606405
  const cleanup = (0, import_react.useCallback)((info) => {
606195
606406
  exit();
@@ -606249,10 +606460,11 @@ function CodeCommand({ onExit, sys, options, updateCheck }) {
606249
606460
  const codeSession = new CodeGenSession({
606250
606461
  sys,
606251
606462
  credentials: creds,
606252
- position: "cli",
606463
+ position: "builder-code",
606253
606464
  mode: "quality-v4",
606254
606465
  fusionConfig,
606255
606466
  git: false,
606467
+ persistSessionLocally: true,
606256
606468
  ...sessionId ? { sessionOrCompletionId: sessionId } : {}
606257
606469
  });
606258
606470
  await codeSession.initializeSession({ skipSessionLoading: !sessionId && !options?.continue });
@@ -606265,6 +606477,31 @@ function CodeCommand({ onExit, sys, options, updateCheck }) {
606265
606477
  setInitPhase("error");
606266
606478
  }
606267
606479
  }, []);
606480
+ const resumeSession = (0, import_react.useCallback)(async (sessionId_0) => {
606481
+ if (!credentialsRef.current) return;
606482
+ setInitPhase("loading");
606483
+ try {
606484
+ const fusionConfig_0 = await getFusionConfig(sys, { _: [] });
606485
+ const newSession = new CodeGenSession({
606486
+ sys,
606487
+ credentials: credentialsRef.current,
606488
+ position: "builder-code",
606489
+ mode: "quality-v4",
606490
+ fusionConfig: fusionConfig_0,
606491
+ git: false,
606492
+ persistSessionLocally: true,
606493
+ sessionOrCompletionId: sessionId_0,
606494
+ queueMode: "next-turn"
606495
+ });
606496
+ await newSession.initializeSession({ skipSessionLoading: false });
606497
+ sessionRef.current = newSession;
606498
+ setSessionVersion((v) => v + 1);
606499
+ setInitPhase("ready");
606500
+ } catch (err_1) {
606501
+ setInitError(err_1?.message ?? String(err_1));
606502
+ setInitPhase("error");
606503
+ }
606504
+ }, [sys]);
606268
606505
  if (initPhase === "loading") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606269
606506
  flexDirection: "column",
606270
606507
  flexGrow: 1,
@@ -606330,8 +606567,10 @@ function CodeCommand({ onExit, sys, options, updateCheck }) {
606330
606567
  session: sessionRef.current,
606331
606568
  onExit: cleanup,
606332
606569
  isTabActive: onCodegen,
606333
- updateCheck
606334
- })
606570
+ updateCheck,
606571
+ onResumeSession: resumeSession,
606572
+ localSessions
606573
+ }, sessionVersion)
606335
606574
  }),
606336
606575
  clawEnabled === true && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606337
606576
  flexDirection: "column",
@@ -606375,7 +606614,7 @@ function isStandaloneBinary() {
606375
606614
  return !path$6.basename(process.execPath, ".exe").startsWith("node");
606376
606615
  }
606377
606616
  function getCurrentVersion() {
606378
- return "0.4.4";
606617
+ return "0.4.5";
606379
606618
  }
606380
606619
  async function fetchLatestVersion() {
606381
606620
  return new Promise((resolve, reject) => {
@@ -606707,21 +606946,32 @@ function FatalErrorScreen(t0) {
606707
606946
  return t5;
606708
606947
  }
606709
606948
  function App(t0) {
606710
- const $ = (0, import_compiler_runtime.c)(13);
606949
+ const $ = (0, import_compiler_runtime.c)(18);
606711
606950
  const { command, options, sys, theme } = t0;
606712
606951
  const { exit } = useApp();
606713
606952
  const { rows } = useWindowSize();
606714
606953
  const updateCheck = useUpdateCheck();
606954
+ const { disableFocus } = useFocusManager();
606715
606955
  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);
606956
+ if ($[0] !== disableFocus) {
606957
+ t1 = () => {
606958
+ enableSgrMouse();
606959
+ disableFocus();
606960
+ return _temp;
606961
+ };
606962
+ $[0] = disableFocus;
606963
+ $[1] = t1;
606964
+ } else t1 = $[1];
606721
606965
  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,
606966
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
606967
+ t2 = [];
606968
+ $[2] = t2;
606969
+ } else t2 = $[2];
606970
+ (0, import_react.useEffect)(t1, t2);
606971
+ let t3;
606972
+ if ($[3] !== command || $[4] !== exit || $[5] !== options || $[6] !== sys || $[7] !== updateCheck) {
606973
+ t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
606974
+ fallback: _temp2,
606725
606975
  children: command === "code" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeCommand, {
606726
606976
  onExit: exit,
606727
606977
  sys,
@@ -606753,43 +607003,49 @@ function App(t0) {
606753
607003
  })]
606754
607004
  })
606755
607005
  });
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, {
607006
+ $[3] = command;
607007
+ $[4] = exit;
607008
+ $[5] = options;
607009
+ $[6] = sys;
607010
+ $[7] = updateCheck;
607011
+ $[8] = t3;
607012
+ } else t3 = $[8];
607013
+ let t4;
607014
+ if ($[9] !== rows || $[10] !== t3) {
607015
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606766
607016
  flexDirection: "column",
606767
607017
  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
607018
  children: t3
606779
607019
  });
607020
+ $[9] = rows;
606780
607021
  $[10] = t3;
606781
- $[11] = theme;
607022
+ $[11] = t4;
607023
+ } else t4 = $[11];
607024
+ let t5;
607025
+ if ($[12] !== t4 || $[13] !== theme) {
607026
+ t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext$1.Provider, {
607027
+ value: theme,
607028
+ children: t4
607029
+ });
606782
607030
  $[12] = t4;
606783
- } else t4 = $[12];
606784
- return t4;
607031
+ $[13] = theme;
607032
+ $[14] = t5;
607033
+ } else t5 = $[14];
607034
+ let t6;
607035
+ if ($[15] !== sys || $[16] !== t5) {
607036
+ t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SysContext.Provider, {
607037
+ value: sys,
607038
+ children: t5
607039
+ });
607040
+ $[15] = sys;
607041
+ $[16] = t5;
607042
+ $[17] = t6;
607043
+ } else t6 = $[17];
607044
+ return t6;
606785
607045
  }
606786
- function _temp3(error) {
607046
+ function _temp2(error) {
606787
607047
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FatalErrorScreen, { error });
606788
607048
  }
606789
- function _temp2() {
606790
- enableSgrMouse();
606791
- return _temp;
606792
- }
606793
607049
  function _temp() {
606794
607050
  resetTerminal();
606795
607051
  }
@@ -606799,7 +607055,7 @@ function initSentry() {
606799
607055
  init({
606800
607056
  dsn: "https://1c5033d697e0271ebe53773bff826de0@o117565.ingest.us.sentry.io/4511107776905216",
606801
607057
  tracesSampleRate: 0,
606802
- release: "0.4.4",
607058
+ release: "0.4.5",
606803
607059
  environment: process.env.NODE_ENV ?? "development",
606804
607060
  enabled: false,
606805
607061
  registerEsmLoaderHooks: false,
@@ -606811,7 +607067,7 @@ function initSentry() {
606811
607067
  }
606812
607068
  //#endregion
606813
607069
  //#region src/cli.tsx
606814
- const VERSION = "0.4.4";
607070
+ const VERSION = "0.4.5";
606815
607071
  async function startInk(command, options) {
606816
607072
  const sys = await createDevToolsNodeSys({
606817
607073
  cwd: process.cwd(),