@metaphi-ai/hum 0.2.24 → 0.2.26

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 +1678 -975
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -453,8 +453,8 @@ var require_react_production = __commonJS({
453
453
  exports.useMemo = function(create3, deps) {
454
454
  return ReactSharedInternals.H.useMemo(create3, deps);
455
455
  };
456
- exports.useOptimistic = function(passthrough, reducer) {
457
- return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
456
+ exports.useOptimistic = function(passthrough2, reducer) {
457
+ return ReactSharedInternals.H.useOptimistic(passthrough2, reducer);
458
458
  };
459
459
  exports.useReducer = function(reducer, initialArg, init) {
460
460
  return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
@@ -1423,8 +1423,8 @@ var require_react_development = __commonJS({
1423
1423
  exports.useMemo = function(create3, deps) {
1424
1424
  return resolveDispatcher().useMemo(create3, deps);
1425
1425
  };
1426
- exports.useOptimistic = function(passthrough, reducer) {
1427
- return resolveDispatcher().useOptimistic(passthrough, reducer);
1426
+ exports.useOptimistic = function(passthrough2, reducer) {
1427
+ return resolveDispatcher().useOptimistic(passthrough2, reducer);
1428
1428
  };
1429
1429
  exports.useReducer = function(reducer, initialArg, init) {
1430
1430
  return resolveDispatcher().useReducer(reducer, initialArg, init);
@@ -7583,8 +7583,8 @@ var require_react_reconciler_production = __commonJS({
7583
7583
  };
7584
7584
  return hook;
7585
7585
  }
7586
- function updateOptimisticImpl(hook, current, passthrough, reducer) {
7587
- hook.baseState = passthrough;
7586
+ function updateOptimisticImpl(hook, current, passthrough2, reducer) {
7587
+ hook.baseState = passthrough2;
7588
7588
  return updateReducerImpl(
7589
7589
  hook,
7590
7590
  currentHook,
@@ -12710,14 +12710,14 @@ var require_react_reconciler_production = __commonJS({
12710
12710
  }
12711
12711
  var exports2 = {};
12712
12712
  "use strict";
12713
- var React16 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
12713
+ var React18 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
12714
12714
  Symbol.for("react.scope");
12715
12715
  var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
12716
12716
  Symbol.for("react.legacy_hidden");
12717
12717
  Symbol.for("react.tracing_marker");
12718
12718
  var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
12719
12719
  Symbol.for("react.view_transition");
12720
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React16.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
12720
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React18.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
12721
12721
  $$$config.cloneMutableInstance;
12722
12722
  var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
12723
12723
  $$$config.cloneMutableTextInstance;
@@ -12987,9 +12987,9 @@ var require_react_reconciler_production = __commonJS({
12987
12987
  useHostTransitionStatus,
12988
12988
  useFormState: mountActionState,
12989
12989
  useActionState: mountActionState,
12990
- useOptimistic: function(passthrough) {
12990
+ useOptimistic: function(passthrough2) {
12991
12991
  var hook = mountWorkInProgressHook();
12992
- hook.memoizedState = hook.baseState = passthrough;
12992
+ hook.memoizedState = hook.baseState = passthrough2;
12993
12993
  var queue = {
12994
12994
  pending: null,
12995
12995
  lanes: 0,
@@ -13005,7 +13005,7 @@ var require_react_reconciler_production = __commonJS({
13005
13005
  queue
13006
13006
  );
13007
13007
  queue.dispatch = hook;
13008
- return [passthrough, hook];
13008
+ return [passthrough2, hook];
13009
13009
  },
13010
13010
  useMemoCache,
13011
13011
  useCacheRefresh: function() {
@@ -13060,9 +13060,9 @@ var require_react_reconciler_production = __commonJS({
13060
13060
  useHostTransitionStatus,
13061
13061
  useFormState: updateActionState,
13062
13062
  useActionState: updateActionState,
13063
- useOptimistic: function(passthrough, reducer) {
13063
+ useOptimistic: function(passthrough2, reducer) {
13064
13064
  var hook = updateWorkInProgressHook();
13065
- return updateOptimisticImpl(hook, currentHook, passthrough, reducer);
13065
+ return updateOptimisticImpl(hook, currentHook, passthrough2, reducer);
13066
13066
  },
13067
13067
  useMemoCache,
13068
13068
  useCacheRefresh: updateRefresh
@@ -13105,12 +13105,12 @@ var require_react_reconciler_production = __commonJS({
13105
13105
  useHostTransitionStatus,
13106
13106
  useFormState: rerenderActionState,
13107
13107
  useActionState: rerenderActionState,
13108
- useOptimistic: function(passthrough, reducer) {
13108
+ useOptimistic: function(passthrough2, reducer) {
13109
13109
  var hook = updateWorkInProgressHook();
13110
13110
  if (null !== currentHook)
13111
- return updateOptimisticImpl(hook, currentHook, passthrough, reducer);
13112
- hook.baseState = passthrough;
13113
- return [passthrough, hook.queue.dispatch];
13111
+ return updateOptimisticImpl(hook, currentHook, passthrough2, reducer);
13112
+ hook.baseState = passthrough2;
13113
+ return [passthrough2, hook.queue.dispatch];
13114
13114
  },
13115
13115
  useMemoCache,
13116
13116
  useCacheRefresh: updateRefresh
@@ -13507,10 +13507,10 @@ var require_react_reconciler_development = __commonJS({
13507
13507
  fiber = fiber.next, id--;
13508
13508
  return fiber;
13509
13509
  }
13510
- function copyWithSetImpl(obj, path7, index, value) {
13511
- if (index >= path7.length) return value;
13512
- var key = path7[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
13513
- updated[key] = copyWithSetImpl(obj[key], path7, index + 1, value);
13510
+ function copyWithSetImpl(obj, path9, index, value) {
13511
+ if (index >= path9.length) return value;
13512
+ var key = path9[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
13513
+ updated[key] = copyWithSetImpl(obj[key], path9, index + 1, value);
13514
13514
  return updated;
13515
13515
  }
13516
13516
  function copyWithRename(obj, oldPath, newPath) {
@@ -13537,11 +13537,11 @@ var require_react_reconciler_development = __commonJS({
13537
13537
  );
13538
13538
  return updated;
13539
13539
  }
13540
- function copyWithDeleteImpl(obj, path7, index) {
13541
- var key = path7[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
13542
- if (index + 1 === path7.length)
13540
+ function copyWithDeleteImpl(obj, path9, index) {
13541
+ var key = path9[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
13542
+ if (index + 1 === path9.length)
13543
13543
  return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
13544
- updated[key] = copyWithDeleteImpl(obj[key], path7, index + 1);
13544
+ updated[key] = copyWithDeleteImpl(obj[key], path9, index + 1);
13545
13545
  return updated;
13546
13546
  }
13547
13547
  function shouldSuspendImpl() {
@@ -17759,9 +17759,9 @@ var require_react_reconciler_development = __commonJS({
17759
17759
  queue.dispatch = dispatch;
17760
17760
  return [initialState.memoizedState, dispatch];
17761
17761
  }
17762
- function mountOptimistic(passthrough) {
17762
+ function mountOptimistic(passthrough2) {
17763
17763
  var hook = mountWorkInProgressHook();
17764
- hook.memoizedState = hook.baseState = passthrough;
17764
+ hook.memoizedState = hook.baseState = passthrough2;
17765
17765
  var queue = {
17766
17766
  pending: null,
17767
17767
  lanes: 0,
@@ -17777,26 +17777,26 @@ var require_react_reconciler_development = __commonJS({
17777
17777
  queue
17778
17778
  );
17779
17779
  queue.dispatch = hook;
17780
- return [passthrough, hook];
17780
+ return [passthrough2, hook];
17781
17781
  }
17782
- function updateOptimistic(passthrough, reducer) {
17782
+ function updateOptimistic(passthrough2, reducer) {
17783
17783
  var hook = updateWorkInProgressHook();
17784
- return updateOptimisticImpl(hook, currentHook, passthrough, reducer);
17784
+ return updateOptimisticImpl(hook, currentHook, passthrough2, reducer);
17785
17785
  }
17786
- function updateOptimisticImpl(hook, current2, passthrough, reducer) {
17787
- hook.baseState = passthrough;
17786
+ function updateOptimisticImpl(hook, current2, passthrough2, reducer) {
17787
+ hook.baseState = passthrough2;
17788
17788
  return updateReducerImpl(
17789
17789
  hook,
17790
17790
  currentHook,
17791
17791
  "function" === typeof reducer ? reducer : basicStateReducer
17792
17792
  );
17793
17793
  }
17794
- function rerenderOptimistic(passthrough, reducer) {
17794
+ function rerenderOptimistic(passthrough2, reducer) {
17795
17795
  var hook = updateWorkInProgressHook();
17796
17796
  if (null !== currentHook)
17797
- return updateOptimisticImpl(hook, currentHook, passthrough, reducer);
17798
- hook.baseState = passthrough;
17799
- return [passthrough, hook.queue.dispatch];
17797
+ return updateOptimisticImpl(hook, currentHook, passthrough2, reducer);
17798
+ hook.baseState = passthrough2;
17799
+ return [passthrough2, hook.queue.dispatch];
17800
17800
  }
17801
17801
  function dispatchActionState(fiber, actionQueue, setPendingState, setState, payload) {
17802
17802
  if (isRenderPhaseUpdate(fiber))
@@ -25310,14 +25310,14 @@ var require_react_reconciler_development = __commonJS({
25310
25310
  }
25311
25311
  var exports2 = {};
25312
25312
  "use strict";
25313
- var React16 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
25313
+ var React18 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
25314
25314
  Symbol.for("react.scope");
25315
25315
  var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
25316
25316
  Symbol.for("react.legacy_hidden");
25317
25317
  Symbol.for("react.tracing_marker");
25318
25318
  var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
25319
25319
  Symbol.for("react.view_transition");
25320
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React16.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
25320
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React18.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance = $$$config.createInstance;
25321
25321
  $$$config.cloneMutableInstance;
25322
25322
  var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
25323
25323
  $$$config.cloneMutableTextInstance;
@@ -25855,10 +25855,10 @@ var require_react_reconciler_development = __commonJS({
25855
25855
  mountHookTypesDev();
25856
25856
  return mountActionState(action, initialState);
25857
25857
  },
25858
- useOptimistic: function(passthrough) {
25858
+ useOptimistic: function(passthrough2) {
25859
25859
  currentHookNameInDev = "useOptimistic";
25860
25860
  mountHookTypesDev();
25861
- return mountOptimistic(passthrough);
25861
+ return mountOptimistic(passthrough2);
25862
25862
  },
25863
25863
  useHostTransitionStatus,
25864
25864
  useMemoCache,
@@ -25985,10 +25985,10 @@ var require_react_reconciler_development = __commonJS({
25985
25985
  warnOnUseFormStateInDev();
25986
25986
  return mountActionState(action, initialState);
25987
25987
  },
25988
- useOptimistic: function(passthrough) {
25988
+ useOptimistic: function(passthrough2) {
25989
25989
  currentHookNameInDev = "useOptimistic";
25990
25990
  updateHookTypesDev();
25991
- return mountOptimistic(passthrough);
25991
+ return mountOptimistic(passthrough2);
25992
25992
  },
25993
25993
  useHostTransitionStatus,
25994
25994
  useMemoCache,
@@ -26115,10 +26115,10 @@ var require_react_reconciler_development = __commonJS({
26115
26115
  updateHookTypesDev();
26116
26116
  return updateActionState(action);
26117
26117
  },
26118
- useOptimistic: function(passthrough, reducer) {
26118
+ useOptimistic: function(passthrough2, reducer) {
26119
26119
  currentHookNameInDev = "useOptimistic";
26120
26120
  updateHookTypesDev();
26121
- return updateOptimistic(passthrough, reducer);
26121
+ return updateOptimistic(passthrough2, reducer);
26122
26122
  },
26123
26123
  useHostTransitionStatus,
26124
26124
  useMemoCache,
@@ -26245,10 +26245,10 @@ var require_react_reconciler_development = __commonJS({
26245
26245
  updateHookTypesDev();
26246
26246
  return rerenderActionState(action);
26247
26247
  },
26248
- useOptimistic: function(passthrough, reducer) {
26248
+ useOptimistic: function(passthrough2, reducer) {
26249
26249
  currentHookNameInDev = "useOptimistic";
26250
26250
  updateHookTypesDev();
26251
- return rerenderOptimistic(passthrough, reducer);
26251
+ return rerenderOptimistic(passthrough2, reducer);
26252
26252
  },
26253
26253
  useHostTransitionStatus,
26254
26254
  useMemoCache,
@@ -26395,11 +26395,11 @@ var require_react_reconciler_development = __commonJS({
26395
26395
  mountHookTypesDev();
26396
26396
  return mountActionState(action, initialState);
26397
26397
  },
26398
- useOptimistic: function(passthrough) {
26398
+ useOptimistic: function(passthrough2) {
26399
26399
  currentHookNameInDev = "useOptimistic";
26400
26400
  warnInvalidHookAccess();
26401
26401
  mountHookTypesDev();
26402
- return mountOptimistic(passthrough);
26402
+ return mountOptimistic(passthrough2);
26403
26403
  },
26404
26404
  useMemoCache: function(size) {
26405
26405
  warnInvalidHookAccess();
@@ -26550,11 +26550,11 @@ var require_react_reconciler_development = __commonJS({
26550
26550
  updateHookTypesDev();
26551
26551
  return updateActionState(action);
26552
26552
  },
26553
- useOptimistic: function(passthrough, reducer) {
26553
+ useOptimistic: function(passthrough2, reducer) {
26554
26554
  currentHookNameInDev = "useOptimistic";
26555
26555
  warnInvalidHookAccess();
26556
26556
  updateHookTypesDev();
26557
- return updateOptimistic(passthrough, reducer);
26557
+ return updateOptimistic(passthrough2, reducer);
26558
26558
  },
26559
26559
  useMemoCache: function(size) {
26560
26560
  warnInvalidHookAccess();
@@ -26705,11 +26705,11 @@ var require_react_reconciler_development = __commonJS({
26705
26705
  updateHookTypesDev();
26706
26706
  return rerenderActionState(action);
26707
26707
  },
26708
- useOptimistic: function(passthrough, reducer) {
26708
+ useOptimistic: function(passthrough2, reducer) {
26709
26709
  currentHookNameInDev = "useOptimistic";
26710
26710
  warnInvalidHookAccess();
26711
26711
  updateHookTypesDev();
26712
- return rerenderOptimistic(passthrough, reducer);
26712
+ return rerenderOptimistic(passthrough2, reducer);
26713
26713
  },
26714
26714
  useMemoCache: function(size) {
26715
26715
  warnInvalidHookAccess();
@@ -26818,29 +26818,29 @@ var require_react_reconciler_development = __commonJS({
26818
26818
  var didWarnAboutNestedUpdates = false;
26819
26819
  var didWarnAboutFindNodeInStrictMode = {};
26820
26820
  var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, scheduleRetry = null, setErrorHandler = null, setSuspenseHandler = null;
26821
- overrideHookState = function(fiber, id, path7, value) {
26821
+ overrideHookState = function(fiber, id, path9, value) {
26822
26822
  id = findHook(fiber, id);
26823
- null !== id && (path7 = copyWithSetImpl(id.memoizedState, path7, 0, value), id.memoizedState = path7, id.baseState = path7, fiber.memoizedProps = assign({}, fiber.memoizedProps), path7 = enqueueConcurrentRenderForLane(fiber, 2), null !== path7 && scheduleUpdateOnFiber(path7, fiber, 2));
26823
+ null !== id && (path9 = copyWithSetImpl(id.memoizedState, path9, 0, value), id.memoizedState = path9, id.baseState = path9, fiber.memoizedProps = assign({}, fiber.memoizedProps), path9 = enqueueConcurrentRenderForLane(fiber, 2), null !== path9 && scheduleUpdateOnFiber(path9, fiber, 2));
26824
26824
  };
26825
- overrideHookStateDeletePath = function(fiber, id, path7) {
26825
+ overrideHookStateDeletePath = function(fiber, id, path9) {
26826
26826
  id = findHook(fiber, id);
26827
- null !== id && (path7 = copyWithDeleteImpl(id.memoizedState, path7, 0), id.memoizedState = path7, id.baseState = path7, fiber.memoizedProps = assign({}, fiber.memoizedProps), path7 = enqueueConcurrentRenderForLane(fiber, 2), null !== path7 && scheduleUpdateOnFiber(path7, fiber, 2));
26827
+ null !== id && (path9 = copyWithDeleteImpl(id.memoizedState, path9, 0), id.memoizedState = path9, id.baseState = path9, fiber.memoizedProps = assign({}, fiber.memoizedProps), path9 = enqueueConcurrentRenderForLane(fiber, 2), null !== path9 && scheduleUpdateOnFiber(path9, fiber, 2));
26828
26828
  };
26829
26829
  overrideHookStateRenamePath = function(fiber, id, oldPath, newPath) {
26830
26830
  id = findHook(fiber, id);
26831
26831
  null !== id && (oldPath = copyWithRename(id.memoizedState, oldPath, newPath), id.memoizedState = oldPath, id.baseState = oldPath, fiber.memoizedProps = assign({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), null !== oldPath && scheduleUpdateOnFiber(oldPath, fiber, 2));
26832
26832
  };
26833
- overrideProps = function(fiber, path7, value) {
26834
- fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path7, 0, value);
26833
+ overrideProps = function(fiber, path9, value) {
26834
+ fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path9, 0, value);
26835
26835
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
26836
- path7 = enqueueConcurrentRenderForLane(fiber, 2);
26837
- null !== path7 && scheduleUpdateOnFiber(path7, fiber, 2);
26836
+ path9 = enqueueConcurrentRenderForLane(fiber, 2);
26837
+ null !== path9 && scheduleUpdateOnFiber(path9, fiber, 2);
26838
26838
  };
26839
- overridePropsDeletePath = function(fiber, path7) {
26840
- fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path7, 0);
26839
+ overridePropsDeletePath = function(fiber, path9) {
26840
+ fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path9, 0);
26841
26841
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
26842
- path7 = enqueueConcurrentRenderForLane(fiber, 2);
26843
- null !== path7 && scheduleUpdateOnFiber(path7, fiber, 2);
26842
+ path9 = enqueueConcurrentRenderForLane(fiber, 2);
26843
+ null !== path9 && scheduleUpdateOnFiber(path9, fiber, 2);
26844
26844
  };
26845
26845
  overridePropsRenamePath = function(fiber, oldPath, newPath) {
26846
26846
  fiber.pendingProps = copyWithRename(
@@ -33297,8 +33297,8 @@ var init_devtools = __esm({
33297
33297
  // node_modules/ink/build/reconciler.js
33298
33298
  import process4 from "node:process";
33299
33299
  async function loadPackageJson() {
33300
- const fs9 = await import("node:fs");
33301
- const content = fs9.readFileSync(new URL("../package.json", import.meta.url), "utf8");
33300
+ const fs10 = await import("node:fs");
33301
+ const content = fs10.readFileSync(new URL("../package.json", import.meta.url), "utf8");
33302
33302
  const parsedContent = JSON.parse(content);
33303
33303
  return {
33304
33304
  name: parsedContent?.name,
@@ -33326,26 +33326,26 @@ var init_reconciler = __esm({
33326
33326
  await init_devtools().then(() => devtools_exports);
33327
33327
  }
33328
33328
  }
33329
- diff = (before, after) => {
33330
- if (before === after) {
33329
+ diff = (before, after2) => {
33330
+ if (before === after2) {
33331
33331
  return;
33332
33332
  }
33333
33333
  if (!before) {
33334
- return after;
33334
+ return after2;
33335
33335
  }
33336
33336
  const changed = {};
33337
33337
  let isChanged = false;
33338
33338
  for (const key of Object.keys(before)) {
33339
- const isDeleted = after ? !Object.hasOwn(after, key) : true;
33339
+ const isDeleted = after2 ? !Object.hasOwn(after2, key) : true;
33340
33340
  if (isDeleted) {
33341
33341
  changed[key] = void 0;
33342
33342
  isChanged = true;
33343
33343
  }
33344
33344
  }
33345
- if (after) {
33346
- for (const key of Object.keys(after)) {
33347
- if (after[key] !== before[key]) {
33348
- changed[key] = after[key];
33345
+ if (after2) {
33346
+ for (const key of Object.keys(after2)) {
33347
+ if (after2[key] !== before[key]) {
33348
+ changed[key] = after2[key];
33349
33349
  isChanged = true;
33350
33350
  }
33351
33351
  }
@@ -34311,10 +34311,10 @@ var init_render_border = __esm({
34311
34311
  init_cli_boxes();
34312
34312
  init_source();
34313
34313
  init_colorize();
34314
- stylePiece = (segment, fg, bg, dim2) => {
34314
+ stylePiece = (segment, fg, bg, dim) => {
34315
34315
  let styled = colorize_default(segment, fg, "foreground");
34316
34316
  styled = colorize_default(styled, bg, "background");
34317
- if (dim2) {
34317
+ if (dim) {
34318
34318
  styled = source_default.dim(styled);
34319
34319
  }
34320
34320
  return styled;
@@ -36093,8 +36093,8 @@ var require_stack_utils = __commonJS({
36093
36093
  closes--;
36094
36094
  if (closes === -1 && file.charAt(i - 1) === " ") {
36095
36095
  const before = file.slice(0, i - 1);
36096
- const after = file.slice(i + 1);
36097
- file = after;
36096
+ const after2 = file.slice(i + 1);
36097
+ file = after2;
36098
36098
  fname += ` (${before}`;
36099
36099
  break;
36100
36100
  }
@@ -36423,8 +36423,8 @@ var init_ErrorOverview = __esm({
36423
36423
  init_dist3();
36424
36424
  init_Box();
36425
36425
  init_Text();
36426
- cleanupPath = (path7) => {
36427
- return path7?.replace(`file://${cwd()}/`, "");
36426
+ cleanupPath = (path9) => {
36427
+ return path9?.replace(`file://${cwd()}/`, "");
36428
36428
  };
36429
36429
  stackUtils = new import_stack_utils.default({
36430
36430
  cwd: cwd(),
@@ -37630,8 +37630,8 @@ var init_ink = __esm({
37630
37630
  };
37631
37631
  return { resume, [Symbol.asyncDispose]: resume };
37632
37632
  }
37633
- setAlternateScreen(enabled) {
37634
- this.alternateScreen = this.resolveAlternateScreenOption(enabled, this.interactive);
37633
+ setAlternateScreen(enabled2) {
37634
+ this.alternateScreen = this.resolveAlternateScreenOption(enabled2, this.interactive);
37635
37635
  if (this.alternateScreen) {
37636
37636
  this.writeBestEffort(this.options.stdout, base_exports.enterAlternativeScreen);
37637
37637
  this.writeBestEffort(this.options.stdout, hideCursorEscape);
@@ -38676,6 +38676,92 @@ var init_build2 = __esm({
38676
38676
  }
38677
38677
  });
38678
38678
 
38679
+ // src/theme.js
38680
+ function Text2({ dimColor, color, ...rest }) {
38681
+ if (!light) return import_react34.default.createElement(Text, { dimColor, color, ...rest });
38682
+ const c = color === "white" ? void 0 : onGround(color);
38683
+ return import_react34.default.createElement(Text, { color: dimColor && !c ? "gray" : c, ...rest });
38684
+ }
38685
+ function Box2({ borderColor, ...rest }) {
38686
+ return import_react34.default.createElement(Box_default, borderColor === void 0 ? rest : { borderColor: onGround(borderColor), ...rest });
38687
+ }
38688
+ function probeBackground({ stdin = process.stdin, stdout = process.stdout, timeout = 100 } = {}) {
38689
+ return new Promise((resolve) => {
38690
+ let buf = "";
38691
+ let done = false;
38692
+ let timer = null;
38693
+ const onData = (d) => {
38694
+ buf += d.toString("latin1");
38695
+ if (/\x07|\x1b\\/.test(buf)) finish(parseBackground(buf));
38696
+ };
38697
+ const finish = (v) => {
38698
+ if (done) return;
38699
+ done = true;
38700
+ clearTimeout(timer);
38701
+ try {
38702
+ stdin.removeListener("data", onData);
38703
+ stdin.setRawMode(false);
38704
+ stdin.pause();
38705
+ } catch {
38706
+ }
38707
+ resolve(v);
38708
+ };
38709
+ timer = setTimeout(() => finish(null), timeout);
38710
+ try {
38711
+ stdin.setRawMode(true);
38712
+ stdin.resume();
38713
+ stdin.on("data", onData);
38714
+ stdout.write("\x1B]11;?\x1B\\");
38715
+ } catch {
38716
+ finish(null);
38717
+ }
38718
+ });
38719
+ }
38720
+ async function detectTheme({ env: env3 = process.env, stdin = process.stdin, stdout = process.stdout, timeout = 100 } = {}) {
38721
+ const said = themeFromEnv(env3);
38722
+ if (said) return said;
38723
+ if (!stdin.isTTY || !stdout.isTTY) return "dark";
38724
+ return await probeBackground({ stdin, stdout, timeout }) || "dark";
38725
+ }
38726
+ var import_react34, ACCENT_DARK, ON_LIGHT, shade, onGround, light, ACCENT, setTheme, themeFromEnv, dimText, accentInk, accentText, parseBackground;
38727
+ var init_theme = __esm({
38728
+ async "src/theme.js"() {
38729
+ import_react34 = __toESM(require_react(), 1);
38730
+ await init_build2();
38731
+ init_source();
38732
+ ACCENT_DARK = "#56B6C2";
38733
+ ON_LIGHT = { accent: ["#0B6E78", 23], cyan: ["#0E7490", 24], yellow: ["#92400E", 94] };
38734
+ shade = (name) => {
38735
+ const pair = ON_LIGHT[name];
38736
+ if (!pair) return name;
38737
+ return source_default.level >= 3 ? pair[0] : source_default.level === 2 ? `ansi256(${pair[1]})` : name === "accent" ? pair[0] : name;
38738
+ };
38739
+ onGround = (color) => light && (color === "cyan" || color === "yellow") ? shade(color) : color;
38740
+ light = false;
38741
+ ACCENT = ACCENT_DARK;
38742
+ setTheme = (name) => {
38743
+ light = name === "light";
38744
+ ACCENT = light ? shade("accent") : ACCENT_DARK;
38745
+ };
38746
+ themeFromEnv = (env3 = process.env) => {
38747
+ const v = String(env3.HUM_THEME || "").trim().toLowerCase();
38748
+ return v === "light" || v === "dark" ? v : null;
38749
+ };
38750
+ dimText = (s) => light ? source_default.gray(s) : source_default.dim(s);
38751
+ accentInk = () => {
38752
+ const cube = /^ansi256\((\d+)\)$/.exec(ACCENT);
38753
+ return cube ? source_default.ansi256(Number(cube[1])) : source_default.hex(ACCENT);
38754
+ };
38755
+ accentText = (s) => accentInk()(s);
38756
+ parseBackground = (reply) => {
38757
+ const m = /rgb:([0-9a-f]{1,4})\/([0-9a-f]{1,4})\/([0-9a-f]{1,4})/i.exec(String(reply || ""));
38758
+ if (!m) return null;
38759
+ const [r, g, b] = m.slice(1).map((h) => parseInt(h, 16) / (16 ** h.length - 1));
38760
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.5 ? "light" : "dark";
38761
+ };
38762
+ }
38763
+ });
38764
+
38679
38765
  // node_modules/cli-spinners/spinners.json
38680
38766
  var require_spinners = __commonJS({
38681
38767
  "node_modules/cli-spinners/spinners.json"(exports, module) {
@@ -40716,7 +40802,7 @@ function findClosingBracket(str, b) {
40716
40802
  }
40717
40803
  function outputLink(cap, link3, raw, lexer3) {
40718
40804
  const href = link3.href;
40719
- const title = link3.title ? escape$1(link3.title) : null;
40805
+ const title2 = link3.title ? escape$1(link3.title) : null;
40720
40806
  const text = cap[1].replace(/\\([\[\]])/g, "$1");
40721
40807
  if (cap[0].charAt(0) !== "!") {
40722
40808
  lexer3.state.inLink = true;
@@ -40724,7 +40810,7 @@ function outputLink(cap, link3, raw, lexer3) {
40724
40810
  type: "link",
40725
40811
  raw,
40726
40812
  href,
40727
- title,
40813
+ title: title2,
40728
40814
  text,
40729
40815
  tokens: lexer3.inlineTokens(text)
40730
40816
  };
@@ -40735,7 +40821,7 @@ function outputLink(cap, link3, raw, lexer3) {
40735
40821
  type: "image",
40736
40822
  raw,
40737
40823
  href,
40738
- title,
40824
+ title: title2,
40739
40825
  text: escape$1(text)
40740
40826
  };
40741
40827
  }
@@ -41034,13 +41120,13 @@ var init_marked_esm = __esm({
41034
41120
  if (cap) {
41035
41121
  const tag2 = cap[1].toLowerCase().replace(/\s+/g, " ");
41036
41122
  const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "";
41037
- const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
41123
+ const title2 = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
41038
41124
  return {
41039
41125
  type: "def",
41040
41126
  tag: tag2,
41041
41127
  raw: cap[0],
41042
41128
  href,
41043
- title
41129
+ title: title2
41044
41130
  };
41045
41131
  }
41046
41132
  }
@@ -41183,15 +41269,15 @@ var init_marked_esm = __esm({
41183
41269
  }
41184
41270
  }
41185
41271
  let href = cap[2];
41186
- let title = "";
41272
+ let title2 = "";
41187
41273
  if (this.options.pedantic) {
41188
41274
  const link3 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
41189
41275
  if (link3) {
41190
41276
  href = link3[1];
41191
- title = link3[3];
41277
+ title2 = link3[3];
41192
41278
  }
41193
41279
  } else {
41194
- title = cap[3] ? cap[3].slice(1, -1) : "";
41280
+ title2 = cap[3] ? cap[3].slice(1, -1) : "";
41195
41281
  }
41196
41282
  href = href.trim();
41197
41283
  if (/^</.test(href)) {
@@ -41203,7 +41289,7 @@ var init_marked_esm = __esm({
41203
41289
  }
41204
41290
  return outputLink(cap, {
41205
41291
  href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
41206
- title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
41292
+ title: title2 ? title2.replace(this.rules.inline.anyPunctuation, "$1") : title2
41207
41293
  }, cap[0], this.lexer);
41208
41294
  }
41209
41295
  }
@@ -41961,28 +42047,28 @@ ${content}</tr>
41961
42047
  del(text) {
41962
42048
  return `<del>${text}</del>`;
41963
42049
  }
41964
- link(href, title, text) {
42050
+ link(href, title2, text) {
41965
42051
  const cleanHref = cleanUrl(href);
41966
42052
  if (cleanHref === null) {
41967
42053
  return text;
41968
42054
  }
41969
42055
  href = cleanHref;
41970
42056
  let out = '<a href="' + href + '"';
41971
- if (title) {
41972
- out += ' title="' + title + '"';
42057
+ if (title2) {
42058
+ out += ' title="' + title2 + '"';
41973
42059
  }
41974
42060
  out += ">" + text + "</a>";
41975
42061
  return out;
41976
42062
  }
41977
- image(href, title, text) {
42063
+ image(href, title2, text) {
41978
42064
  const cleanHref = cleanUrl(href);
41979
42065
  if (cleanHref === null) {
41980
42066
  return text;
41981
42067
  }
41982
42068
  href = cleanHref;
41983
42069
  let out = `<img src="${href}" alt="${text}"`;
41984
- if (title) {
41985
- out += ` title="${title}"`;
42070
+ if (title2) {
42071
+ out += ` title="${title2}"`;
41986
42072
  }
41987
42073
  out += ">";
41988
42074
  return out;
@@ -42011,10 +42097,10 @@ ${content}</tr>
42011
42097
  text(text) {
42012
42098
  return text;
42013
42099
  }
42014
- link(href, title, text) {
42100
+ link(href, title2, text) {
42015
42101
  return "" + text;
42016
42102
  }
42017
- image(href, title, text) {
42103
+ image(href, title2, text) {
42018
42104
  return "" + text;
42019
42105
  }
42020
42106
  br() {
@@ -43009,9 +43095,9 @@ var require_utils = __commonJS({
43009
43095
  }
43010
43096
  function hyperlink(url, text) {
43011
43097
  const OSC3 = "\x1B]";
43012
- const BEL3 = "\x07";
43098
+ const BEL4 = "\x07";
43013
43099
  const SEP2 = ";";
43014
- return [OSC3, "8", SEP2, SEP2, url || text, BEL3, text, OSC3, "8", SEP2, SEP2, BEL3].join("");
43100
+ return [OSC3, "8", SEP2, SEP2, url || text, BEL4, text, OSC3, "8", SEP2, SEP2, BEL4].join("");
43015
43101
  }
43016
43102
  module.exports = {
43017
43103
  strlen,
@@ -43111,7 +43197,7 @@ var require_has_flag = __commonJS({
43111
43197
  var require_supports_colors = __commonJS({
43112
43198
  "node_modules/@colors/colors/lib/system/supports-colors.js"(exports, module) {
43113
43199
  "use strict";
43114
- var os8 = __require("os");
43200
+ var os9 = __require("os");
43115
43201
  var hasFlag2 = require_has_flag();
43116
43202
  var env3 = process.env;
43117
43203
  var forceColor = void 0;
@@ -43149,7 +43235,7 @@ var require_supports_colors = __commonJS({
43149
43235
  }
43150
43236
  var min = forceColor ? 1 : 0;
43151
43237
  if (process.platform === "win32") {
43152
- var osRelease = os8.release().split(".");
43238
+ var osRelease = os9.release().split(".");
43153
43239
  if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
43154
43240
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
43155
43241
  }
@@ -57857,9 +57943,9 @@ var require_javascript = __commonJS({
57857
57943
  return joined;
57858
57944
  }
57859
57945
  function javascript(hljs) {
57860
- const hasClosingTag = (match, { after }) => {
57946
+ const hasClosingTag = (match, { after: after2 }) => {
57861
57947
  const tag2 = "</" + match[0].slice(1);
57862
- const pos = match.input.indexOf(tag2, after);
57948
+ const pos = match.input.indexOf(tag2, after2);
57863
57949
  return pos !== -1;
57864
57950
  };
57865
57951
  const IDENT_RE$1 = IDENT_RE;
@@ -77653,9 +77739,9 @@ var require_typescript = __commonJS({
77653
77739
  return joined;
77654
77740
  }
77655
77741
  function javascript(hljs) {
77656
- const hasClosingTag = (match, { after }) => {
77742
+ const hasClosingTag = (match, { after: after2 }) => {
77657
77743
  const tag2 = "</" + match[0].slice(1);
77658
- const pos = match.input.indexOf(tag2, after);
77744
+ const pos = match.input.indexOf(tag2, after2);
77659
77745
  return pos !== -1;
77660
77746
  };
77661
77747
  const IDENT_RE$1 = IDENT_RE;
@@ -87234,15 +87320,15 @@ var require_route = __commonJS({
87234
87320
  };
87235
87321
  }
87236
87322
  function wrapConversion(toModel, graph) {
87237
- const path7 = [graph[toModel].parent, toModel];
87323
+ const path9 = [graph[toModel].parent, toModel];
87238
87324
  let fn = conversions[graph[toModel].parent][toModel];
87239
87325
  let cur = graph[toModel].parent;
87240
87326
  while (graph[cur].parent) {
87241
- path7.unshift(graph[cur].parent);
87327
+ path9.unshift(graph[cur].parent);
87242
87328
  fn = link3(conversions[graph[cur].parent][cur], fn);
87243
87329
  cur = graph[cur].parent;
87244
87330
  }
87245
- fn.conversion = path7;
87331
+ fn.conversion = path9;
87246
87332
  return fn;
87247
87333
  }
87248
87334
  module.exports = function(fromModel) {
@@ -87482,7 +87568,7 @@ var require_has_flag2 = __commonJS({
87482
87568
  var require_supports_color = __commonJS({
87483
87569
  "node_modules/supports-color/index.js"(exports, module) {
87484
87570
  "use strict";
87485
- var os8 = __require("os");
87571
+ var os9 = __require("os");
87486
87572
  var tty3 = __require("tty");
87487
87573
  var hasFlag2 = require_has_flag2();
87488
87574
  var { env: env3 } = process;
@@ -87530,7 +87616,7 @@ var require_supports_color = __commonJS({
87530
87616
  return min;
87531
87617
  }
87532
87618
  if (process.platform === "win32") {
87533
- const osRelease = os8.release().split(".");
87619
+ const osRelease = os9.release().split(".");
87534
87620
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
87535
87621
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
87536
87622
  }
@@ -87682,14 +87768,14 @@ var require_templates = __commonJS({
87682
87768
  return results;
87683
87769
  }
87684
87770
  function buildStyle(chalk2, styles5) {
87685
- const enabled = {};
87771
+ const enabled2 = {};
87686
87772
  for (const layer of styles5) {
87687
87773
  for (const style of layer.styles) {
87688
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
87774
+ enabled2[style[0]] = layer.inverse ? null : style.slice(1);
87689
87775
  }
87690
87776
  }
87691
87777
  let current = chalk2;
87692
- for (const [styleName, styles6] of Object.entries(enabled)) {
87778
+ for (const [styleName, styles6] of Object.entries(enabled2)) {
87693
87779
  if (!Array.isArray(styles6)) {
87694
87780
  continue;
87695
87781
  }
@@ -88255,18 +88341,18 @@ function renderInline(tokens) {
88255
88341
  out += source_default.strikethrough(renderInline(tok.tokens));
88256
88342
  break;
88257
88343
  case "codespan":
88258
- out += accent(unescape2(tok.text));
88344
+ out += accentText(unescape2(tok.text));
88259
88345
  break;
88260
88346
  case "link": {
88261
88347
  const text = tok.tokens?.length ? renderInline(tok.tokens) : unescape2(tok.text);
88262
- out += accent.underline(text);
88348
+ out += accentInk().underline(text);
88263
88349
  if (tok.href && tok.href !== unescape2(tok.text)) {
88264
- out += dim(` (${tok.href})`);
88350
+ out += dimText(` (${tok.href})`);
88265
88351
  }
88266
88352
  break;
88267
88353
  }
88268
88354
  case "image":
88269
- out += dim(`[image: ${unescape2(tok.text) || tok.href}]`);
88355
+ out += dimText(`[image: ${unescape2(tok.text) || tok.href}]`);
88270
88356
  break;
88271
88357
  case "br":
88272
88358
  out += "\n";
@@ -88282,25 +88368,28 @@ function renderInline(tokens) {
88282
88368
  return out;
88283
88369
  }
88284
88370
  function renderCode(tok, width) {
88371
+ const lang = (tok.lang || "").trim().split(/\s+/)[0];
88285
88372
  let body = tok.text;
88286
- if (tok.lang) {
88373
+ if (lang) {
88287
88374
  try {
88288
- body = (0, import_cli_highlight.highlight)(tok.text, { language: tok.lang, ignoreIllegals: true });
88375
+ body = (0, import_cli_highlight.highlight)(tok.text, { language: lang, ignoreIllegals: true });
88289
88376
  } catch {
88290
88377
  }
88291
88378
  }
88292
- return indentBlock(body, dim("\u258E "), dim("\u258E "));
88379
+ const rail = indentBlock(body, dimText("\u258E "), dimText("\u258E "));
88380
+ return lang ? `${dimText(`\u258E ${lang}`)}
88381
+ ${rail}` : rail;
88293
88382
  }
88294
88383
  function renderList(tok, width) {
88295
88384
  const parts = [];
88296
88385
  tok.items.forEach((item, i) => {
88297
88386
  let glyph;
88298
88387
  if (item.task) {
88299
- glyph = item.checked ? accent("\u25FC ") : dim("\u25FB ");
88388
+ glyph = item.checked ? accentText("\u25FC ") : dimText("\u25FB ");
88300
88389
  } else if (tok.ordered) {
88301
88390
  glyph = `${(tok.start || 1) + i}. `;
88302
88391
  } else {
88303
- glyph = dim("\u2022 ");
88392
+ glyph = dimText("\u2022 ");
88304
88393
  }
88305
88394
  const pad2 = " ".repeat(displayLen(glyph));
88306
88395
  const body = renderBlocks(item.tokens || [], width - pad2.length).join(item.loose ? "\n\n" : "\n");
@@ -88310,11 +88399,12 @@ function renderList(tok, width) {
88310
88399
  }
88311
88400
  function renderHeading(tok, width) {
88312
88401
  const text = renderInline(tok.tokens);
88313
- return accent(wrap(text, width));
88402
+ const weigh = HEADING[Math.min(tok.depth, HEADING.length) - 1] || ((ink) => ink);
88403
+ return weigh(accentInk())(wrap(text, width));
88314
88404
  }
88315
88405
  function renderBlockquote(tok, width) {
88316
88406
  const inner = renderBlocks(tok.tokens || [], width - 2).join("\n\n");
88317
- return indentBlock(dim(inner.replace(ANSI_RE, "")), dim("\u258E "), dim("\u258E "));
88407
+ return indentBlock(dimText(inner.replace(ANSI_RE, "")), dimText("\u258E "), dimText("\u258E "));
88318
88408
  }
88319
88409
  function renderBlocks(tokens, width) {
88320
88410
  const parts = [];
@@ -88339,13 +88429,13 @@ function renderBlocks(tokens, width) {
88339
88429
  parts.push(renderBlockquote(tok, width));
88340
88430
  break;
88341
88431
  case "hr":
88342
- parts.push(dim("\u2500".repeat(Math.min(width, 40))));
88432
+ parts.push(dimText("\u2500".repeat(Math.min(width, 40))));
88343
88433
  break;
88344
88434
  case "table":
88345
88435
  parts.push(renderTable(tok, width));
88346
88436
  break;
88347
88437
  case "html":
88348
- parts.push(wrap(dim(unescape2(tok.text).trim()), width));
88438
+ parts.push(wrap(dimText(unescape2(tok.text).trim()), width));
88349
88439
  break;
88350
88440
  default:
88351
88441
  parts.push(wrap(unescape2(tok.raw ?? tok.text ?? ""), width));
@@ -88356,7 +88446,7 @@ function renderBlocks(tokens, width) {
88356
88446
  }
88357
88447
  function renderTable(token2, width) {
88358
88448
  const inline2 = (cell2) => renderInline(cell2.tokens?.length ? cell2.tokens : [{ type: "text", text: cell2.text }]);
88359
- const head = token2.header.map((c) => accent(inline2(c)));
88449
+ const head = token2.header.map((c) => accentText(inline2(c)));
88360
88450
  const rows = token2.rows.map((r) => r.map(inline2));
88361
88451
  const ncols = head.length;
88362
88452
  if (width < ncols * 7 + 1) {
@@ -88403,17 +88493,16 @@ function renderMarkdown(text, width) {
88403
88493
  const tokens = lexer2.lexer(text);
88404
88494
  return renderBlocks(tokens, Math.max(20, width)).join("\n\n").replace(/\s+$/, "");
88405
88495
  }
88406
- var import_cli_table3, import_cli_highlight, ACCENT, accent, dim, ANSI_RE, displayLen, lexer2, ENTITIES, unescape2, wrap, indentBlock;
88496
+ var import_cli_table3, import_cli_highlight, ANSI_RE, displayLen, lexer2, ENTITIES, unescape2, wrap, indentBlock, HEADING;
88407
88497
  var init_markdown = __esm({
88408
- "src/markdown.js"() {
88498
+ async "src/markdown.js"() {
88409
88499
  init_marked_esm();
88410
88500
  import_cli_table3 = __toESM(require_cli_table3(), 1);
88411
88501
  init_source();
88412
88502
  init_wrap_ansi2();
88413
88503
  import_cli_highlight = __toESM(require_dist(), 1);
88414
- ACCENT = "#56B6C2";
88415
- accent = source_default.hex(ACCENT);
88416
- dim = source_default.dim;
88504
+ await init_theme();
88505
+ await init_theme();
88417
88506
  ANSI_RE = /\x1b\[[0-9;]*m/g;
88418
88507
  displayLen = (s) => s.replace(ANSI_RE, "").length;
88419
88508
  lexer2 = new Marked();
@@ -88429,6 +88518,315 @@ var init_markdown = __esm({
88429
88518
  unescape2 = (s) => (s || "").replace(/&(?:amp|lt|gt|quot|#39|apos|nbsp);/g, (m) => ENTITIES[m]);
88430
88519
  wrap = (text, width) => wrapAnsi2(text, Math.max(20, width), { hard: false });
88431
88520
  indentBlock = (text, first, rest) => text.split("\n").map((line, i) => (i === 0 ? first : rest) + line).join("\n");
88521
+ HEADING = [
88522
+ (ink) => ink.bold.underline,
88523
+ // h1
88524
+ (ink) => ink.bold,
88525
+ // h2
88526
+ (ink) => ink.bold.italic,
88527
+ // h3
88528
+ (ink) => ink.italic
88529
+ // h4 to h6
88530
+ ];
88531
+ }
88532
+ });
88533
+
88534
+ // node_modules/react/cjs/react-jsx-runtime.production.js
88535
+ var require_react_jsx_runtime_production = __commonJS({
88536
+ "node_modules/react/cjs/react-jsx-runtime.production.js"(exports) {
88537
+ "use strict";
88538
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element");
88539
+ var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
88540
+ function jsxProd(type, config, maybeKey) {
88541
+ var key = null;
88542
+ void 0 !== maybeKey && (key = "" + maybeKey);
88543
+ void 0 !== config.key && (key = "" + config.key);
88544
+ if ("key" in config) {
88545
+ maybeKey = {};
88546
+ for (var propName in config)
88547
+ "key" !== propName && (maybeKey[propName] = config[propName]);
88548
+ } else maybeKey = config;
88549
+ config = maybeKey.ref;
88550
+ return {
88551
+ $$typeof: REACT_ELEMENT_TYPE,
88552
+ type,
88553
+ key,
88554
+ ref: void 0 !== config ? config : null,
88555
+ props: maybeKey
88556
+ };
88557
+ }
88558
+ exports.Fragment = REACT_FRAGMENT_TYPE;
88559
+ exports.jsx = jsxProd;
88560
+ exports.jsxs = jsxProd;
88561
+ }
88562
+ });
88563
+
88564
+ // node_modules/react/cjs/react-jsx-runtime.development.js
88565
+ var require_react_jsx_runtime_development = __commonJS({
88566
+ "node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
88567
+ "use strict";
88568
+ "production" !== process.env.NODE_ENV && (function() {
88569
+ function getComponentNameFromType(type) {
88570
+ if (null == type) return null;
88571
+ if ("function" === typeof type)
88572
+ return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
88573
+ if ("string" === typeof type) return type;
88574
+ switch (type) {
88575
+ case REACT_FRAGMENT_TYPE:
88576
+ return "Fragment";
88577
+ case REACT_PROFILER_TYPE:
88578
+ return "Profiler";
88579
+ case REACT_STRICT_MODE_TYPE:
88580
+ return "StrictMode";
88581
+ case REACT_SUSPENSE_TYPE:
88582
+ return "Suspense";
88583
+ case REACT_SUSPENSE_LIST_TYPE:
88584
+ return "SuspenseList";
88585
+ case REACT_ACTIVITY_TYPE:
88586
+ return "Activity";
88587
+ }
88588
+ if ("object" === typeof type)
88589
+ switch ("number" === typeof type.tag && console.error(
88590
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
88591
+ ), type.$$typeof) {
88592
+ case REACT_PORTAL_TYPE:
88593
+ return "Portal";
88594
+ case REACT_CONTEXT_TYPE:
88595
+ return type.displayName || "Context";
88596
+ case REACT_CONSUMER_TYPE:
88597
+ return (type._context.displayName || "Context") + ".Consumer";
88598
+ case REACT_FORWARD_REF_TYPE:
88599
+ var innerType = type.render;
88600
+ type = type.displayName;
88601
+ type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
88602
+ return type;
88603
+ case REACT_MEMO_TYPE:
88604
+ return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
88605
+ case REACT_LAZY_TYPE:
88606
+ innerType = type._payload;
88607
+ type = type._init;
88608
+ try {
88609
+ return getComponentNameFromType(type(innerType));
88610
+ } catch (x) {
88611
+ }
88612
+ }
88613
+ return null;
88614
+ }
88615
+ function testStringCoercion(value) {
88616
+ return "" + value;
88617
+ }
88618
+ function checkKeyStringCoercion(value) {
88619
+ try {
88620
+ testStringCoercion(value);
88621
+ var JSCompiler_inline_result = false;
88622
+ } catch (e) {
88623
+ JSCompiler_inline_result = true;
88624
+ }
88625
+ if (JSCompiler_inline_result) {
88626
+ JSCompiler_inline_result = console;
88627
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
88628
+ var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
88629
+ JSCompiler_temp_const.call(
88630
+ JSCompiler_inline_result,
88631
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88632
+ JSCompiler_inline_result$jscomp$0
88633
+ );
88634
+ return testStringCoercion(value);
88635
+ }
88636
+ }
88637
+ function getTaskName(type) {
88638
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
88639
+ if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
88640
+ return "<...>";
88641
+ try {
88642
+ var name = getComponentNameFromType(type);
88643
+ return name ? "<" + name + ">" : "<...>";
88644
+ } catch (x) {
88645
+ return "<...>";
88646
+ }
88647
+ }
88648
+ function getOwner() {
88649
+ var dispatcher = ReactSharedInternals.A;
88650
+ return null === dispatcher ? null : dispatcher.getOwner();
88651
+ }
88652
+ function UnknownOwner() {
88653
+ return Error("react-stack-top-frame");
88654
+ }
88655
+ function hasValidKey(config) {
88656
+ if (hasOwnProperty.call(config, "key")) {
88657
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
88658
+ if (getter && getter.isReactWarning) return false;
88659
+ }
88660
+ return void 0 !== config.key;
88661
+ }
88662
+ function defineKeyPropWarningGetter(props, displayName) {
88663
+ function warnAboutAccessingKey() {
88664
+ specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
88665
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
88666
+ displayName
88667
+ ));
88668
+ }
88669
+ warnAboutAccessingKey.isReactWarning = true;
88670
+ Object.defineProperty(props, "key", {
88671
+ get: warnAboutAccessingKey,
88672
+ configurable: true
88673
+ });
88674
+ }
88675
+ function elementRefGetterWithDeprecationWarning() {
88676
+ var componentName = getComponentNameFromType(this.type);
88677
+ didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
88678
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
88679
+ ));
88680
+ componentName = this.props.ref;
88681
+ return void 0 !== componentName ? componentName : null;
88682
+ }
88683
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
88684
+ var refProp = props.ref;
88685
+ type = {
88686
+ $$typeof: REACT_ELEMENT_TYPE,
88687
+ type,
88688
+ key,
88689
+ props,
88690
+ _owner: owner
88691
+ };
88692
+ null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
88693
+ enumerable: false,
88694
+ get: elementRefGetterWithDeprecationWarning
88695
+ }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
88696
+ type._store = {};
88697
+ Object.defineProperty(type._store, "validated", {
88698
+ configurable: false,
88699
+ enumerable: false,
88700
+ writable: true,
88701
+ value: 0
88702
+ });
88703
+ Object.defineProperty(type, "_debugInfo", {
88704
+ configurable: false,
88705
+ enumerable: false,
88706
+ writable: true,
88707
+ value: null
88708
+ });
88709
+ Object.defineProperty(type, "_debugStack", {
88710
+ configurable: false,
88711
+ enumerable: false,
88712
+ writable: true,
88713
+ value: debugStack
88714
+ });
88715
+ Object.defineProperty(type, "_debugTask", {
88716
+ configurable: false,
88717
+ enumerable: false,
88718
+ writable: true,
88719
+ value: debugTask
88720
+ });
88721
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
88722
+ return type;
88723
+ }
88724
+ function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
88725
+ var children = config.children;
88726
+ if (void 0 !== children)
88727
+ if (isStaticChildren)
88728
+ if (isArrayImpl(children)) {
88729
+ for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)
88730
+ validateChildKeys(children[isStaticChildren]);
88731
+ Object.freeze && Object.freeze(children);
88732
+ } else
88733
+ console.error(
88734
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
88735
+ );
88736
+ else validateChildKeys(children);
88737
+ if (hasOwnProperty.call(config, "key")) {
88738
+ children = getComponentNameFromType(type);
88739
+ var keys = Object.keys(config).filter(function(k) {
88740
+ return "key" !== k;
88741
+ });
88742
+ isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
88743
+ didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(
88744
+ 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
88745
+ isStaticChildren,
88746
+ children,
88747
+ keys,
88748
+ children
88749
+ ), didWarnAboutKeySpread[children + isStaticChildren] = true);
88750
+ }
88751
+ children = null;
88752
+ void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
88753
+ hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
88754
+ if ("key" in config) {
88755
+ maybeKey = {};
88756
+ for (var propName in config)
88757
+ "key" !== propName && (maybeKey[propName] = config[propName]);
88758
+ } else maybeKey = config;
88759
+ children && defineKeyPropWarningGetter(
88760
+ maybeKey,
88761
+ "function" === typeof type ? type.displayName || type.name || "Unknown" : type
88762
+ );
88763
+ return ReactElement(
88764
+ type,
88765
+ children,
88766
+ maybeKey,
88767
+ getOwner(),
88768
+ debugStack,
88769
+ debugTask
88770
+ );
88771
+ }
88772
+ function validateChildKeys(node) {
88773
+ isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
88774
+ }
88775
+ function isValidElement(object) {
88776
+ return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
88777
+ }
88778
+ var React18 = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React18.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
88779
+ return null;
88780
+ };
88781
+ React18 = {
88782
+ react_stack_bottom_frame: function(callStackForError) {
88783
+ return callStackForError();
88784
+ }
88785
+ };
88786
+ var specialPropKeyWarningShown;
88787
+ var didWarnAboutElementRef = {};
88788
+ var unknownOwnerDebugStack = React18.react_stack_bottom_frame.bind(
88789
+ React18,
88790
+ UnknownOwner
88791
+ )();
88792
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
88793
+ var didWarnAboutKeySpread = {};
88794
+ exports.Fragment = REACT_FRAGMENT_TYPE;
88795
+ exports.jsx = function(type, config, maybeKey) {
88796
+ var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
88797
+ return jsxDEVImpl(
88798
+ type,
88799
+ config,
88800
+ maybeKey,
88801
+ false,
88802
+ trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
88803
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
88804
+ );
88805
+ };
88806
+ exports.jsxs = function(type, config, maybeKey) {
88807
+ var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
88808
+ return jsxDEVImpl(
88809
+ type,
88810
+ config,
88811
+ maybeKey,
88812
+ true,
88813
+ trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
88814
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
88815
+ );
88816
+ };
88817
+ })();
88818
+ }
88819
+ });
88820
+
88821
+ // node_modules/react/jsx-runtime.js
88822
+ var require_jsx_runtime = __commonJS({
88823
+ "node_modules/react/jsx-runtime.js"(exports, module) {
88824
+ "use strict";
88825
+ if (process.env.NODE_ENV === "production") {
88826
+ module.exports = require_react_jsx_runtime_production();
88827
+ } else {
88828
+ module.exports = require_react_jsx_runtime_development();
88829
+ }
88432
88830
  }
88433
88831
  });
88434
88832
 
@@ -88639,7 +89037,7 @@ var win, MINE, npmFix, NPM_FIX, humHome, versionsDir, versionDir, pkgDir, coreDi
88639
89037
  var init_install = __esm({
88640
89038
  "src/install.js"() {
88641
89039
  win = process.platform === "win32";
88642
- MINE = true ? "0.2.24" : "";
89040
+ MINE = true ? "0.2.26" : "";
88643
89041
  npmFix = (version = "") => `npm i -g @metaphi-ai/hum@${version || "latest"} --foreground-scripts`;
88644
89042
  NPM_FIX = npmFix("latest");
88645
89043
  humHome = (env3 = process.env) => env3.HUM_HOME || path.join(os3.homedir(), ".hum");
@@ -88880,6 +89278,15 @@ import os5 from "node:os";
88880
89278
  import path3 from "node:path";
88881
89279
  import crypto from "node:crypto";
88882
89280
  import { spawn as spawn2, spawnSync as spawnSync3 } from "node:child_process";
89281
+ function alive(pid) {
89282
+ if (!pid || pid <= 0) return false;
89283
+ try {
89284
+ process.kill(pid, 0);
89285
+ return true;
89286
+ } catch (e) {
89287
+ return e.code === "EPERM";
89288
+ }
89289
+ }
88883
89290
  function uvToolDirs() {
88884
89291
  const dirs = [];
88885
89292
  if (process.env.UV_TOOL_DIR) dirs.push(process.env.UV_TOOL_DIR);
@@ -88975,10 +89382,10 @@ function clientEnv() {
88975
89382
  platform: process.platform,
88976
89383
  arch: process.arch,
88977
89384
  terminal: process.env.TERM_PROGRAM || (process.env.WT_SESSION ? "Windows Terminal" : process.env.TERM || ""),
88978
- tui: true ? "0.2.24" : ""
89385
+ tui: true ? "0.2.26" : ""
88979
89386
  };
88980
89387
  }
88981
- function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.2.24" : "" } = {}) {
89388
+ function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.2.26" : "" } = {}) {
88982
89389
  const refused = failures.find((f) => f.error && f.error.code !== "ENOENT");
88983
89390
  const fix = npm ? npmFix(version) : updateCommand({ kind: "native" }, platform2);
88984
89391
  if (!refused) {
@@ -89115,7 +89522,7 @@ async function startSession(cwd2, opts = {}, {
89115
89522
  if (status !== 0) throw new EngineError("", { exit: status });
89116
89523
  return spawnCore(cwd2, opts);
89117
89524
  }
89118
- var runDir, readRun, EngineError, win3, exists, Core;
89525
+ var runDir, readRun, EngineError, win3, exists, RETRIES, RETRY_MS, Core;
89119
89526
  var init_core = __esm({
89120
89527
  "src/core.js"() {
89121
89528
  init_install();
@@ -89145,10 +89552,16 @@ var init_core = __esm({
89145
89552
  return false;
89146
89553
  }
89147
89554
  };
89555
+ RETRIES = 3;
89556
+ RETRY_MS = 1e3;
89148
89557
  Core = class {
89149
- constructor(port2, token2 = "") {
89558
+ constructor(port2, token2 = "", { retries = RETRIES, retryMs = RETRY_MS } = {}) {
89150
89559
  this.port = port2;
89151
89560
  this.token = token2;
89561
+ this.retries = retries;
89562
+ this.retryMs = retryMs;
89563
+ this.leaving = false;
89564
+ this.runId = null;
89152
89565
  this.handlers = [];
89153
89566
  this.closed = false;
89154
89567
  this.ready = false;
@@ -89160,7 +89573,9 @@ var init_core = __esm({
89160
89573
  connect() {
89161
89574
  this.ready = false;
89162
89575
  return new Promise((resolve, reject) => {
89576
+ let opened = false;
89163
89577
  const sock = net.createConnection({ host: "127.0.0.1", port: this.port }, () => {
89578
+ opened = true;
89164
89579
  try {
89165
89580
  sock.write(JSON.stringify({ cmd: "hello", kind: "interactive", token: this.token, env: clientEnv() }) + "\n");
89166
89581
  this.ready = true;
@@ -89187,16 +89602,52 @@ var init_core = __esm({
89187
89602
  } catch {
89188
89603
  continue;
89189
89604
  }
89605
+ if (ev.type === "bye") this.leaving = true;
89606
+ if (ev.type === "hello" && ev.run_id) this.runId = String(ev.run_id);
89190
89607
  for (const h of this.handlers) h(ev);
89191
89608
  }
89192
89609
  });
89193
89610
  sock.on("close", () => {
89194
- if (this.sock !== sock) return;
89195
- this.closed = true;
89196
- for (const h of this.handlers) h({ type: "bye", gone: true });
89611
+ if (this.sock !== sock || !opened) return;
89612
+ if (this.closed || this.leaving || this.coreDied()) {
89613
+ this.gone();
89614
+ return;
89615
+ }
89616
+ this.regain();
89197
89617
  });
89198
89618
  });
89199
89619
  }
89620
+ // The run file is the core's own word on itself. A core that never named its run (an older one) is
89621
+ // not known to be dead, and is tried.
89622
+ coreDied() {
89623
+ if (!this.runId) return false;
89624
+ const rec = readRun(this.runId);
89625
+ return !rec || !alive(Number(rec.pid || 0)) || Number(rec.port || 0) !== this.port;
89626
+ }
89627
+ gone() {
89628
+ this.closed = true;
89629
+ this.ready = false;
89630
+ for (const h of this.handlers) h({ type: "bye", gone: true });
89631
+ }
89632
+ // The line dropped and nobody said goodbye: say so once (`reconnecting`), try the port again, and on the
89633
+ // first try that opens the core greets us as it greets any front-end (`hello`, then `replay`). Only after
89634
+ // the last try is it `bye gone`.
89635
+ async regain() {
89636
+ const port2 = this.port;
89637
+ this.ready = false;
89638
+ for (const h of this.handlers) h({ type: "reconnecting" });
89639
+ for (let i = 0; i < this.retries; i += 1) {
89640
+ await new Promise((resolve) => setTimeout(resolve, this.retryMs));
89641
+ if (this.closed || this.port !== port2) return;
89642
+ if (this.coreDied()) break;
89643
+ try {
89644
+ await this.connect();
89645
+ return;
89646
+ } catch {
89647
+ }
89648
+ }
89649
+ if (!this.closed && this.port === port2) this.gone();
89650
+ }
89200
89651
  // Attach to another core (a session running elsewhere on this machine): its token comes
89201
89652
  // from its run file, the old socket is dropped quietly, the new one greets us with hello
89202
89653
  // and a replay.
@@ -89206,6 +89657,8 @@ var init_core = __esm({
89206
89657
  this.port = port2;
89207
89658
  this.token = token2;
89208
89659
  this.closed = false;
89660
+ this.leaving = false;
89661
+ this.runId = null;
89209
89662
  try {
89210
89663
  old.destroy();
89211
89664
  } catch {
@@ -89219,6 +89672,7 @@ var init_core = __esm({
89219
89672
  // the core cannot take it, and the caller says so on the screen rather than losing the words.
89220
89673
  send(cmd) {
89221
89674
  if (this.closed) return false;
89675
+ if (cmd && (cmd.cmd === "quit" || cmd.cmd === "stop")) this.leaving = true;
89222
89676
  if (!this.ready) {
89223
89677
  this.queue.push(cmd);
89224
89678
  return true;
@@ -89260,15 +89714,6 @@ __export(agents_exports, {
89260
89714
  import fs6 from "node:fs";
89261
89715
  import net2 from "node:net";
89262
89716
  import path4 from "node:path";
89263
- function alive(pid) {
89264
- if (!pid || pid <= 0) return false;
89265
- try {
89266
- process.kill(pid, 0);
89267
- return true;
89268
- } catch (e) {
89269
- return e.code === "EPERM";
89270
- }
89271
- }
89272
89717
  function rowOf(rec) {
89273
89718
  return {
89274
89719
  run_id: rec.run_id || "",
@@ -89428,305 +89873,6 @@ var init_agents = __esm({
89428
89873
  }
89429
89874
  });
89430
89875
 
89431
- // node_modules/react/cjs/react-jsx-runtime.production.js
89432
- var require_react_jsx_runtime_production = __commonJS({
89433
- "node_modules/react/cjs/react-jsx-runtime.production.js"(exports) {
89434
- "use strict";
89435
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element");
89436
- var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
89437
- function jsxProd(type, config, maybeKey) {
89438
- var key = null;
89439
- void 0 !== maybeKey && (key = "" + maybeKey);
89440
- void 0 !== config.key && (key = "" + config.key);
89441
- if ("key" in config) {
89442
- maybeKey = {};
89443
- for (var propName in config)
89444
- "key" !== propName && (maybeKey[propName] = config[propName]);
89445
- } else maybeKey = config;
89446
- config = maybeKey.ref;
89447
- return {
89448
- $$typeof: REACT_ELEMENT_TYPE,
89449
- type,
89450
- key,
89451
- ref: void 0 !== config ? config : null,
89452
- props: maybeKey
89453
- };
89454
- }
89455
- exports.Fragment = REACT_FRAGMENT_TYPE;
89456
- exports.jsx = jsxProd;
89457
- exports.jsxs = jsxProd;
89458
- }
89459
- });
89460
-
89461
- // node_modules/react/cjs/react-jsx-runtime.development.js
89462
- var require_react_jsx_runtime_development = __commonJS({
89463
- "node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
89464
- "use strict";
89465
- "production" !== process.env.NODE_ENV && (function() {
89466
- function getComponentNameFromType(type) {
89467
- if (null == type) return null;
89468
- if ("function" === typeof type)
89469
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
89470
- if ("string" === typeof type) return type;
89471
- switch (type) {
89472
- case REACT_FRAGMENT_TYPE:
89473
- return "Fragment";
89474
- case REACT_PROFILER_TYPE:
89475
- return "Profiler";
89476
- case REACT_STRICT_MODE_TYPE:
89477
- return "StrictMode";
89478
- case REACT_SUSPENSE_TYPE:
89479
- return "Suspense";
89480
- case REACT_SUSPENSE_LIST_TYPE:
89481
- return "SuspenseList";
89482
- case REACT_ACTIVITY_TYPE:
89483
- return "Activity";
89484
- }
89485
- if ("object" === typeof type)
89486
- switch ("number" === typeof type.tag && console.error(
89487
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
89488
- ), type.$$typeof) {
89489
- case REACT_PORTAL_TYPE:
89490
- return "Portal";
89491
- case REACT_CONTEXT_TYPE:
89492
- return type.displayName || "Context";
89493
- case REACT_CONSUMER_TYPE:
89494
- return (type._context.displayName || "Context") + ".Consumer";
89495
- case REACT_FORWARD_REF_TYPE:
89496
- var innerType = type.render;
89497
- type = type.displayName;
89498
- type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
89499
- return type;
89500
- case REACT_MEMO_TYPE:
89501
- return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
89502
- case REACT_LAZY_TYPE:
89503
- innerType = type._payload;
89504
- type = type._init;
89505
- try {
89506
- return getComponentNameFromType(type(innerType));
89507
- } catch (x) {
89508
- }
89509
- }
89510
- return null;
89511
- }
89512
- function testStringCoercion(value) {
89513
- return "" + value;
89514
- }
89515
- function checkKeyStringCoercion(value) {
89516
- try {
89517
- testStringCoercion(value);
89518
- var JSCompiler_inline_result = false;
89519
- } catch (e) {
89520
- JSCompiler_inline_result = true;
89521
- }
89522
- if (JSCompiler_inline_result) {
89523
- JSCompiler_inline_result = console;
89524
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
89525
- var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
89526
- JSCompiler_temp_const.call(
89527
- JSCompiler_inline_result,
89528
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
89529
- JSCompiler_inline_result$jscomp$0
89530
- );
89531
- return testStringCoercion(value);
89532
- }
89533
- }
89534
- function getTaskName(type) {
89535
- if (type === REACT_FRAGMENT_TYPE) return "<>";
89536
- if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
89537
- return "<...>";
89538
- try {
89539
- var name = getComponentNameFromType(type);
89540
- return name ? "<" + name + ">" : "<...>";
89541
- } catch (x) {
89542
- return "<...>";
89543
- }
89544
- }
89545
- function getOwner() {
89546
- var dispatcher = ReactSharedInternals.A;
89547
- return null === dispatcher ? null : dispatcher.getOwner();
89548
- }
89549
- function UnknownOwner() {
89550
- return Error("react-stack-top-frame");
89551
- }
89552
- function hasValidKey(config) {
89553
- if (hasOwnProperty.call(config, "key")) {
89554
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
89555
- if (getter && getter.isReactWarning) return false;
89556
- }
89557
- return void 0 !== config.key;
89558
- }
89559
- function defineKeyPropWarningGetter(props, displayName) {
89560
- function warnAboutAccessingKey() {
89561
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
89562
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
89563
- displayName
89564
- ));
89565
- }
89566
- warnAboutAccessingKey.isReactWarning = true;
89567
- Object.defineProperty(props, "key", {
89568
- get: warnAboutAccessingKey,
89569
- configurable: true
89570
- });
89571
- }
89572
- function elementRefGetterWithDeprecationWarning() {
89573
- var componentName = getComponentNameFromType(this.type);
89574
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
89575
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
89576
- ));
89577
- componentName = this.props.ref;
89578
- return void 0 !== componentName ? componentName : null;
89579
- }
89580
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
89581
- var refProp = props.ref;
89582
- type = {
89583
- $$typeof: REACT_ELEMENT_TYPE,
89584
- type,
89585
- key,
89586
- props,
89587
- _owner: owner
89588
- };
89589
- null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
89590
- enumerable: false,
89591
- get: elementRefGetterWithDeprecationWarning
89592
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
89593
- type._store = {};
89594
- Object.defineProperty(type._store, "validated", {
89595
- configurable: false,
89596
- enumerable: false,
89597
- writable: true,
89598
- value: 0
89599
- });
89600
- Object.defineProperty(type, "_debugInfo", {
89601
- configurable: false,
89602
- enumerable: false,
89603
- writable: true,
89604
- value: null
89605
- });
89606
- Object.defineProperty(type, "_debugStack", {
89607
- configurable: false,
89608
- enumerable: false,
89609
- writable: true,
89610
- value: debugStack
89611
- });
89612
- Object.defineProperty(type, "_debugTask", {
89613
- configurable: false,
89614
- enumerable: false,
89615
- writable: true,
89616
- value: debugTask
89617
- });
89618
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
89619
- return type;
89620
- }
89621
- function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
89622
- var children = config.children;
89623
- if (void 0 !== children)
89624
- if (isStaticChildren)
89625
- if (isArrayImpl(children)) {
89626
- for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)
89627
- validateChildKeys(children[isStaticChildren]);
89628
- Object.freeze && Object.freeze(children);
89629
- } else
89630
- console.error(
89631
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
89632
- );
89633
- else validateChildKeys(children);
89634
- if (hasOwnProperty.call(config, "key")) {
89635
- children = getComponentNameFromType(type);
89636
- var keys = Object.keys(config).filter(function(k) {
89637
- return "key" !== k;
89638
- });
89639
- isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
89640
- didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(
89641
- 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
89642
- isStaticChildren,
89643
- children,
89644
- keys,
89645
- children
89646
- ), didWarnAboutKeySpread[children + isStaticChildren] = true);
89647
- }
89648
- children = null;
89649
- void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
89650
- hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
89651
- if ("key" in config) {
89652
- maybeKey = {};
89653
- for (var propName in config)
89654
- "key" !== propName && (maybeKey[propName] = config[propName]);
89655
- } else maybeKey = config;
89656
- children && defineKeyPropWarningGetter(
89657
- maybeKey,
89658
- "function" === typeof type ? type.displayName || type.name || "Unknown" : type
89659
- );
89660
- return ReactElement(
89661
- type,
89662
- children,
89663
- maybeKey,
89664
- getOwner(),
89665
- debugStack,
89666
- debugTask
89667
- );
89668
- }
89669
- function validateChildKeys(node) {
89670
- isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
89671
- }
89672
- function isValidElement(object) {
89673
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
89674
- }
89675
- var React16 = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React16.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
89676
- return null;
89677
- };
89678
- React16 = {
89679
- react_stack_bottom_frame: function(callStackForError) {
89680
- return callStackForError();
89681
- }
89682
- };
89683
- var specialPropKeyWarningShown;
89684
- var didWarnAboutElementRef = {};
89685
- var unknownOwnerDebugStack = React16.react_stack_bottom_frame.bind(
89686
- React16,
89687
- UnknownOwner
89688
- )();
89689
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
89690
- var didWarnAboutKeySpread = {};
89691
- exports.Fragment = REACT_FRAGMENT_TYPE;
89692
- exports.jsx = function(type, config, maybeKey) {
89693
- var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
89694
- return jsxDEVImpl(
89695
- type,
89696
- config,
89697
- maybeKey,
89698
- false,
89699
- trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
89700
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
89701
- );
89702
- };
89703
- exports.jsxs = function(type, config, maybeKey) {
89704
- var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
89705
- return jsxDEVImpl(
89706
- type,
89707
- config,
89708
- maybeKey,
89709
- true,
89710
- trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
89711
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
89712
- );
89713
- };
89714
- })();
89715
- }
89716
- });
89717
-
89718
- // node_modules/react/jsx-runtime.js
89719
- var require_jsx_runtime = __commonJS({
89720
- "node_modules/react/jsx-runtime.js"(exports, module) {
89721
- "use strict";
89722
- if (process.env.NODE_ENV === "production") {
89723
- module.exports = require_react_jsx_runtime_production();
89724
- } else {
89725
- module.exports = require_react_jsx_runtime_development();
89726
- }
89727
- }
89728
- });
89729
-
89730
89876
  // src/doctor.js
89731
89877
  var doctor_exports = {};
89732
89878
  __export(doctor_exports, {
@@ -89735,10 +89881,10 @@ __export(doctor_exports, {
89735
89881
  onPath: () => onPath,
89736
89882
  render: () => render2
89737
89883
  });
89738
- import fs8 from "node:fs";
89739
- import os7 from "node:os";
89740
- import path6 from "node:path";
89741
- import { spawnSync as spawnSync4 } from "node:child_process";
89884
+ import fs9 from "node:fs";
89885
+ import os8 from "node:os";
89886
+ import path8 from "node:path";
89887
+ import { spawnSync as spawnSync5 } from "node:child_process";
89742
89888
  function jsonError(text, e) {
89743
89889
  const msg = e.message || "";
89744
89890
  const lc = /\(line (\d+) column \d+\)/.exec(msg);
@@ -89752,9 +89898,9 @@ function onPath(env3, { platform: platform2 = process.platform } = {}) {
89752
89898
  const names = isWin(platform2) ? ["hum.cmd", "hum.exe", "hum", "hum-core.exe", "hum-core.cmd"] : ["hum", "hum-core"];
89753
89899
  const seen = /* @__PURE__ */ new Set();
89754
89900
  const hits = [];
89755
- for (const dir of String(env3.PATH || env3.Path || "").split(path6.delimiter).filter(Boolean)) {
89901
+ for (const dir of String(env3.PATH || env3.Path || "").split(path8.delimiter).filter(Boolean)) {
89756
89902
  for (const n of names) {
89757
- const p = path6.join(dir, n);
89903
+ const p = path8.join(dir, n);
89758
89904
  if (!exists2(p) || seen.has(p)) continue;
89759
89905
  seen.add(p);
89760
89906
  hits.push({ path: p, name: n, real: realpath(p) });
@@ -89767,25 +89913,25 @@ async function diagnose({
89767
89913
  mine = "0.0.0",
89768
89914
  platform: platform2 = process.platform,
89769
89915
  execPath = process.execPath,
89770
- homedir = os7.homedir(),
89916
+ homedir = os8.homedir(),
89771
89917
  cwd: cwd2 = process.cwd(),
89772
89918
  layout: layout2 = installLayout(execPath, env3),
89773
89919
  candidates = coreCandidates(env3),
89774
- runImpl = spawnSync4,
89920
+ runImpl = spawnSync5,
89775
89921
  fetchImpl = globalThis.fetch
89776
89922
  } = {}) {
89777
- const home = env3.HUM_HOME || path6.join(homedir, ".hum");
89923
+ const home = env3.HUM_HOME || path8.join(homedir, ".hum");
89778
89924
  const sections = [];
89779
89925
  {
89780
89926
  const checks = [];
89781
- const from = layout2.kind === "native" ? path6.join(layout2.dir, layout2.exe) : realpath(execPath);
89927
+ const from = layout2.kind === "native" ? path8.join(layout2.dir, layout2.exe) : realpath(execPath);
89782
89928
  const how = { native: "the native install", npm: "npm", python: "Python (uv or pip)" }[layout2.kind] || layout2.kind;
89783
89929
  checks.push(check2("ok", `hum ${mine} \xB7 installed with ${how} \xB7 runs from ${from}`));
89784
89930
  if (layout2.kind === "native") {
89785
- const launcher = isWin(platform2) ? path6.join(env3.LOCALAPPDATA || path6.join(homedir, "AppData", "Local"), "hum", "bin", "hum.cmd") : path6.join(homedir, ".local", "bin", "hum");
89931
+ const launcher = isWin(platform2) ? path8.join(env3.LOCALAPPDATA || path8.join(homedir, "AppData", "Local"), "hum", "bin", "hum.cmd") : path8.join(homedir, ".local", "bin", "hum");
89786
89932
  if (!exists2(launcher)) checks.push(check2("warn", `no launcher at ${launcher}`, updateCommand(layout2, platform2)));
89787
89933
  else {
89788
- const target = isWin(platform2) ? (fs8.readFileSync(launcher, "utf8").match(new RegExp('"([^"]+)"')) || [])[1] || "" : realpath(launcher);
89934
+ const target = isWin(platform2) ? (fs9.readFileSync(launcher, "utf8").match(new RegExp('"([^"]+)"')) || [])[1] || "" : realpath(launcher);
89789
89935
  const insideVersions = target && realpath(target).startsWith(realpath(layout2.base));
89790
89936
  checks.push(insideVersions ? check2("ok", `launcher ${launcher} \u2192 ${target}`) : check2("warn", `launcher ${launcher} is not the installer's (it points at ${target || "?"})`, updateCommand(layout2, platform2)));
89791
89937
  }
@@ -89838,7 +89984,7 @@ async function diagnose({
89838
89984
  if (ready.length) checks.push(check2("ok", `installed here: ${ready.join(", ")} (the newest starts next)`));
89839
89985
  }
89840
89986
  if (layout2.kind === "native") {
89841
- const sib = path6.join(layout2.dir, "core", isWin(platform2) ? "hum-core.exe" : "hum-core");
89987
+ const sib = path8.join(layout2.dir, "core", isWin(platform2) ? "hum-core.exe" : "hum-core");
89842
89988
  checks.push(exists2(sib) ? check2("ok", `the working half is beside hum: ${sib}`) : check2("fail", `nothing beside hum at ${sib}: the install is incomplete`, updateCommand(layout2, platform2)));
89843
89989
  }
89844
89990
  sections.push({ key: "runtime", title: "The part of hum that does the work", checks });
@@ -89849,7 +89995,7 @@ async function diagnose({
89849
89995
  if (st && st.version) {
89850
89996
  const ready = readyVersion(layout2, st.version);
89851
89997
  checks.push(check2("ok", `last background update: ${st.version}, started ${st.started ? new Date(st.started).toISOString() : "?"}${ready ? " \xB7 ready, takes effect on restart" : ""}`));
89852
- const last = tail(path6.join(home, "update.log"));
89998
+ const last = tail(path8.join(home, "update.log"));
89853
89999
  if (last) checks.push(check2("ok", `update.log: ${last}`));
89854
90000
  } else checks.push(check2("ok", "no background update recorded"));
89855
90001
  if (env3.HUM_NO_UPDATE_CHECK) checks.push(check2("warn", "HUM_NO_UPDATE_CHECK is set: hum does not look for releases", "unset HUM_NO_UPDATE_CHECK"));
@@ -89865,12 +90011,12 @@ async function diagnose({
89865
90011
  {
89866
90012
  const checks = [];
89867
90013
  try {
89868
- fs8.accessSync(home, fs8.constants.W_OK);
90014
+ fs9.accessSync(home, fs9.constants.W_OK);
89869
90015
  checks.push(check2("ok", `HUM_HOME ${home} is writable`));
89870
90016
  } catch {
89871
90017
  checks.push(exists2(home) ? check2("fail", `${home} is not writable`, `chmod u+w ${home}`) : check2("warn", `${home} does not exist yet: it is made on first run`));
89872
90018
  }
89873
- const configPath = env3.HUM_CONFIG || path6.join(home, "config.toml");
90019
+ const configPath = env3.HUM_CONFIG || path8.join(home, "config.toml");
89874
90020
  if (!exists2(configPath)) checks.push(check2("ok", `no ${configPath}: defaults`));
89875
90021
  else if (!interp) checks.push(check2("warn", `${configPath} not checked: nothing here can parse TOML`, layout2.kind === "npm" ? npmFix2(mine) : updateCommand(layout2, platform2)));
89876
90022
  else {
@@ -89887,9 +90033,9 @@ async function diagnose({
89887
90033
  toolServers = parsed.mcp;
89888
90034
  }
89889
90035
  }
89890
- for (const f of [path6.join(home, "hooks.json"), path6.join(cwd2, ".hum", "hooks.json"), path6.join(home, "autonomy.json"), path6.join(home, "update.json"), path6.join(home, "core-install.json")]) {
90036
+ for (const f of [path8.join(home, "hooks.json"), path8.join(cwd2, ".hum", "hooks.json"), path8.join(home, "autonomy.json"), path8.join(home, "update.json"), path8.join(home, "core-install.json")]) {
89891
90037
  if (!exists2(f)) continue;
89892
- const text = fs8.readFileSync(f, "utf8");
90038
+ const text = fs9.readFileSync(f, "utf8");
89893
90039
  try {
89894
90040
  JSON.parse(text);
89895
90041
  checks.push(check2("ok", `${f} parses`));
@@ -89897,10 +90043,10 @@ async function diagnose({
89897
90043
  checks.push(check2("fail", `${f}: ${jsonError(text, e)}`, `fix ${f}`));
89898
90044
  }
89899
90045
  }
89900
- const credPath = path6.join(home, "credentials.json");
90046
+ const credPath = path8.join(home, "credentials.json");
89901
90047
  let cred = null;
89902
90048
  if (exists2(credPath)) {
89903
- const text = fs8.readFileSync(credPath, "utf8");
90049
+ const text = fs9.readFileSync(credPath, "utf8");
89904
90050
  try {
89905
90051
  cred = JSON.parse(text);
89906
90052
  } catch (e) {
@@ -89916,10 +90062,10 @@ async function diagnose({
89916
90062
  const checks = [];
89917
90063
  const local = Array.isArray(toolServers) ? toolServers : null;
89918
90064
  if (local) for (const s of local) checks.push(check2("ok", `${s.name} \xB7 ${s.transport}${s.at ? ` \xB7 ${s.at}` : ""} \xB7 from config.toml`));
89919
- else if (toolServers === null && exists2(env3.HUM_CONFIG || path6.join(home, "config.toml"))) checks.push(check2("warn", "config.toml servers not listed (it did not parse, or nothing here can read it)"));
90065
+ else if (toolServers === null && exists2(env3.HUM_CONFIG || path8.join(home, "config.toml"))) checks.push(check2("warn", "config.toml servers not listed (it did not parse, or nothing here can read it)"));
89920
90066
  let cred = null;
89921
90067
  try {
89922
- cred = JSON.parse(fs8.readFileSync(path6.join(home, "credentials.json"), "utf8"));
90068
+ cred = JSON.parse(fs9.readFileSync(path8.join(home, "credentials.json"), "utf8"));
89923
90069
  } catch {
89924
90070
  }
89925
90071
  for (const s of cred && Array.isArray(cred.mcp) ? cred.mcp : []) if (s && s.name) checks.push(check2("ok", `${s.name} \xB7 http \xB7 via the server`));
@@ -89933,12 +90079,12 @@ async function diagnose({
89933
90079
  function sandboxCheck(platform2, env3) {
89934
90080
  if (isWin(platform2)) return check2("ok", "no sandbox on Windows: commands run as you, in your account");
89935
90081
  if (platform2 === "darwin") return exists2("/usr/bin/sandbox-exec") ? check2("ok", "sandbox: macOS Seatbelt (/usr/bin/sandbox-exec)") : check2("warn", "/usr/bin/sandbox-exec is missing: commands run unsandboxed");
89936
- const dirs = String(env3.PATH || "").split(path6.delimiter);
89937
- const bwrap = dirs.map((d) => path6.join(d, "bwrap")).find(exists2);
90082
+ const dirs = String(env3.PATH || "").split(path8.delimiter);
90083
+ const bwrap = dirs.map((d) => path8.join(d, "bwrap")).find(exists2);
89938
90084
  if (!bwrap) return check2("warn", "bubblewrap is not installed: commands run unsandboxed", "sudo apt install bubblewrap");
89939
90085
  const restricted = (() => {
89940
90086
  try {
89941
- return fs8.readFileSync("/proc/sys/kernel/apparmor_restrict_unprivileged_userns", "utf8").trim() === "1";
90087
+ return fs9.readFileSync("/proc/sys/kernel/apparmor_restrict_unprivileged_userns", "utf8").trim() === "1";
89942
90088
  } catch {
89943
90089
  return false;
89944
90090
  }
@@ -89972,7 +90118,7 @@ var init_doctor = __esm({
89972
90118
  npmFix2 = (version) => `npm i -g @metaphi-ai/hum@${version || "latest"} --foreground-scripts`;
89973
90119
  exists2 = (p) => {
89974
90120
  try {
89975
- fs8.accessSync(p);
90121
+ fs9.accessSync(p);
89976
90122
  return true;
89977
90123
  } catch {
89978
90124
  return false;
@@ -89980,14 +90126,14 @@ var init_doctor = __esm({
89980
90126
  };
89981
90127
  realpath = (p) => {
89982
90128
  try {
89983
- return fs8.realpathSync(p);
90129
+ return fs9.realpathSync(p);
89984
90130
  } catch {
89985
90131
  return p;
89986
90132
  }
89987
90133
  };
89988
90134
  tail = (p) => {
89989
90135
  try {
89990
- const lines = fs8.readFileSync(p, "utf8").trim().split("\n");
90136
+ const lines = fs9.readFileSync(p, "utf8").trim().split("\n");
89991
90137
  return lines[lines.length - 1] || "";
89992
90138
  } catch {
89993
90139
  return "";
@@ -90015,19 +90161,19 @@ __export(agents_exports2, {
90015
90161
  default: () => Agents
90016
90162
  });
90017
90163
  function Agents({ onAttach, onQuit, read = liveRows, peek = peekSession, stop = stopSession, everyMs = EVERY_MS }) {
90018
- const [rows, setRows] = (0, import_react37.useState)(() => grouped(read()).rows);
90019
- const [index, setIndex] = (0, import_react37.useState)(0);
90020
- const [open, setOpen] = (0, import_react37.useState)(null);
90021
- const [value, setValue] = (0, import_react37.useState)("");
90022
- const [note, setNote] = (0, import_react37.useState)("");
90164
+ const [rows, setRows] = (0, import_react39.useState)(() => grouped(read()).rows);
90165
+ const [index, setIndex] = (0, import_react39.useState)(0);
90166
+ const [open, setOpen] = (0, import_react39.useState)(null);
90167
+ const [value, setValue] = (0, import_react39.useState)("");
90168
+ const [note, setNote] = (0, import_react39.useState)("");
90023
90169
  const { stdout } = use_stdout_default();
90024
90170
  const width = stdout && stdout.columns || 100;
90025
- (0, import_react37.useEffect)(() => {
90171
+ (0, import_react39.useEffect)(() => {
90026
90172
  const t = setInterval(() => setRows(grouped(read()).rows), everyMs);
90027
90173
  return () => clearInterval(t);
90028
90174
  }, [read, everyMs]);
90029
90175
  const row = rows[Math.min(index, Math.max(0, rows.length - 1))];
90030
- const openRef = (0, import_react37.useRef)(null);
90176
+ const openRef = (0, import_react39.useRef)(null);
90031
90177
  const show = (v) => {
90032
90178
  openRef.current = v;
90033
90179
  setOpen(v);
@@ -90091,29 +90237,29 @@ function Agents({ onAttach, onQuit, read = liveRows, peek = peekSession, stop =
90091
90237
  });
90092
90238
  if (open) {
90093
90239
  const q = open.question;
90094
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, children: [
90095
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: ACCENT, bold: true, children: [
90240
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box2, { flexDirection: "column", paddingX: 1, children: [
90241
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { color: ACCENT, bold: true, children: [
90096
90242
  open.row.name,
90097
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { dimColor: true, children: [
90243
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { dimColor: true, children: [
90098
90244
  " ",
90099
90245
  open.row.task.slice(0, width - 20)
90100
90246
  ] })
90101
90247
  ] }),
90102
- open.waiting ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: "looking \u2026" }) : null,
90103
- q ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
90104
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { children: q.question }),
90105
- (q.options || []).map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { dimColor: true, children: [
90248
+ open.waiting ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text2, { dimColor: true, children: "looking \u2026" }) : null,
90249
+ q ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box2, { flexDirection: "column", marginTop: 1, children: [
90250
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text2, { children: q.question }),
90251
+ (q.options || []).map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { dimColor: true, children: [
90106
90252
  " ",
90107
90253
  i + 1,
90108
90254
  ". ",
90109
90255
  o.label,
90110
90256
  o.description ? ` \xB7 ${o.description}` : ""
90111
90257
  ] }, i)),
90112
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { borderStyle: "round", borderColor: "gray", paddingX: 1, marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { children: value || /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: q.default ? `enter takes the default: ${q.default}` : "your answer" }) }) }),
90113
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: "enter answers and leaves \xB7 esc leaves it open" })
90114
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
90115
- open.lines.length ? open.lines.slice(-PEEK_LINES2).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: l.slice(0, width - 4) }, i)) : open.waiting ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: "nothing on its transcript yet" }),
90116
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { dimColor: true, children: [
90258
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box2, { borderStyle: "round", borderColor: "gray", paddingX: 1, marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text2, { children: value || /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text2, { dimColor: true, children: q.default ? `enter takes the default: ${q.default}` : "your answer" }) }) }),
90259
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text2, { dimColor: true, children: "enter answers and leaves \xB7 esc leaves it open" })
90260
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box2, { flexDirection: "column", marginTop: 1, children: [
90261
+ open.lines.length ? open.lines.slice(-PEEK_LINES2).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text2, { dimColor: true, children: l.slice(0, width - 4) }, i)) : open.waiting ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text2, { dimColor: true, children: "nothing on its transcript yet" }),
90262
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { dimColor: true, children: [
90117
90263
  "\n",
90118
90264
  "esc goes back"
90119
90265
  ] })
@@ -90130,12 +90276,12 @@ function Agents({ onAttach, onQuit, read = liveRows, peek = peekSession, stop =
90130
90276
  const count = `${rows.length} on this machine${teams ? ` \xB7 ${teams} team${teams === 1 ? "" : "s"}` : ""}`;
90131
90277
  const nameOf = (r) => `${" ".repeat(r.depth || 0)}${r.name}${r.agents ? ` +${r.agents}` : ""}`;
90132
90278
  const taskW = Math.max(12, width - 2 - (2 + nameW + roleW + stateW + needsW + stepsW + spentW + 6));
90133
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, children: [
90134
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: ACCENT, bold: true, children: [
90279
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box2, { flexDirection: "column", paddingX: 1, children: [
90280
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { color: ACCENT, bold: true, children: [
90135
90281
  "Agents ",
90136
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: `(${count})` })
90282
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text2, { dimColor: true, children: `(${count})` })
90137
90283
  ] }),
90138
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { dimColor: true, children: [
90284
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box2, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { dimColor: true, children: [
90139
90285
  " ",
90140
90286
  pad("NAME", nameW),
90141
90287
  " ",
@@ -90151,53 +90297,54 @@ function Agents({ onAttach, onQuit, read = liveRows, peek = peekSession, stop =
90151
90297
  " ",
90152
90298
  padLeft("SPENT", spentW)
90153
90299
  ] }) }),
90154
- rows.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { flexDirection: "column", children: [
90155
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { children: [
90156
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: ACCENT, children: i === index ? "\u276F" : "" }) }),
90157
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { bold: i === index, children: pad(nameOf(r), nameW) }),
90158
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { dimColor: true, children: [
90300
+ rows.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box2, { flexDirection: "column", children: [
90301
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box2, { children: [
90302
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box2, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text2, { color: ACCENT, children: i === index ? "\u276F" : "" }) }),
90303
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text2, { bold: i === index, children: pad(nameOf(r), nameW) }),
90304
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { dimColor: true, children: [
90159
90305
  " ",
90160
90306
  pad(r.role, roleW)
90161
90307
  ] }),
90162
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { children: [
90308
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { children: [
90163
90309
  " ",
90164
90310
  pad(r.task, taskW)
90165
90311
  ] }),
90166
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: r.needs ? "yellow" : void 0, children: [
90312
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { color: r.needs ? "yellow" : void 0, children: [
90167
90313
  " ",
90168
90314
  pad(stateText(r), stateW)
90169
90315
  ] }),
90170
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: "yellow", children: [
90316
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { color: "yellow", children: [
90171
90317
  " ",
90172
90318
  pad(r.needs, needsW)
90173
90319
  ] }),
90174
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { dimColor: true, children: [
90320
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { dimColor: true, children: [
90175
90321
  " ",
90176
90322
  padLeft(r.steps, stepsW),
90177
90323
  " ",
90178
90324
  padLeft(fmtCost(r.spent_usd), spentW)
90179
90325
  ] })
90180
90326
  ] }),
90181
- r.summary ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { dimColor: true, children: [
90327
+ r.summary ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { dimColor: true, children: [
90182
90328
  " ",
90183
90329
  r.summary.slice(0, width - 6)
90184
90330
  ] }) : null
90185
90331
  ] }, r.run_id)),
90186
- note ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { dimColor: true, children: [
90332
+ note ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text2, { dimColor: true, children: [
90187
90333
  "\n",
90188
90334
  note
90189
90335
  ] }) : null,
90190
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: FOOTER }) })
90336
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box2, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text2, { dimColor: true, children: FOOTER }) })
90191
90337
  ] });
90192
90338
  }
90193
- var import_react37, import_jsx_runtime3, EVERY_MS, PEEK_LINES2, pad, padLeft, FOOTER;
90339
+ var import_react39, import_jsx_runtime4, EVERY_MS, PEEK_LINES2, pad, padLeft, FOOTER;
90194
90340
  var init_agents2 = __esm({
90195
90341
  async "src/agents.jsx"() {
90196
- import_react37 = __toESM(require_react(), 1);
90342
+ import_react39 = __toESM(require_react(), 1);
90197
90343
  await init_build2();
90198
- init_markdown();
90344
+ await init_theme();
90345
+ await init_markdown();
90199
90346
  init_agents();
90200
- import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
90347
+ import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
90201
90348
  EVERY_MS = 2e3;
90202
90349
  PEEK_LINES2 = 20;
90203
90350
  pad = (s, n) => String(s || "").slice(0, n).padEnd(n);
@@ -90207,24 +90354,25 @@ var init_agents2 = __esm({
90207
90354
  });
90208
90355
 
90209
90356
  // src/cli.jsx
90210
- var import_react38 = __toESM(require_react(), 1);
90357
+ var import_react40 = __toESM(require_react(), 1);
90211
90358
  await init_build2();
90212
90359
 
90213
90360
  // src/app.jsx
90214
- var import_react36 = __toESM(require_react(), 1);
90361
+ var import_react38 = __toESM(require_react(), 1);
90215
90362
  await init_build2();
90216
- import fs7 from "node:fs";
90217
- import os6 from "node:os";
90218
- import path5 from "node:path";
90363
+ await init_theme();
90364
+ import fs8 from "node:fs";
90365
+ import os7 from "node:os";
90366
+ import path7 from "node:path";
90219
90367
 
90220
90368
  // node_modules/ink-spinner/build/index.js
90221
- var import_react34 = __toESM(require_react(), 1);
90369
+ var import_react35 = __toESM(require_react(), 1);
90222
90370
  await init_build2();
90223
90371
  var import_cli_spinners = __toESM(require_cli_spinners(), 1);
90224
90372
  function Spinner({ type = "dots" }) {
90225
- const [frame, setFrame] = (0, import_react34.useState)(0);
90373
+ const [frame, setFrame] = (0, import_react35.useState)(0);
90226
90374
  const spinner = import_cli_spinners.default[type];
90227
- (0, import_react34.useEffect)(() => {
90375
+ (0, import_react35.useEffect)(() => {
90228
90376
  const timer = setInterval(() => {
90229
90377
  setFrame((previousFrame) => {
90230
90378
  const isLastFrame = previousFrame === spinner.frames.length - 1;
@@ -90235,20 +90383,125 @@ function Spinner({ type = "dots" }) {
90235
90383
  clearInterval(timer);
90236
90384
  };
90237
90385
  }, [spinner]);
90238
- return import_react34.default.createElement(Text, null, spinner.frames[frame]);
90386
+ return import_react35.default.createElement(Text, null, spinner.frames[frame]);
90239
90387
  }
90240
90388
  var build_default = Spinner;
90241
90389
 
90242
90390
  // src/app.jsx
90243
90391
  init_wrap_ansi2();
90244
- init_markdown();
90392
+ await init_markdown();
90393
+
90394
+ // src/diff.jsx
90395
+ var import_react36 = __toESM(require_react(), 1);
90396
+ await init_build2();
90397
+ init_source();
90398
+ var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
90399
+ var HUNK = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;
90400
+ var DARK_ADDED = "#213A2B";
90401
+ var DARK_REMOVED = "#4A221D";
90402
+ var DARK_ADDED_256 = 22;
90403
+ var DARK_REMOVED_256 = 52;
90404
+ var LIGHT_ADDED = "#dafbe1";
90405
+ var LIGHT_REMOVED = "#ffebe9";
90406
+ var LIGHT_ADDED_256 = 194;
90407
+ var LIGHT_REMOVED_256 = 224;
90408
+ var TINTS = {
90409
+ dark: { "+": [DARK_ADDED, DARK_ADDED_256], "-": [DARK_REMOVED, DARK_REMOVED_256] },
90410
+ light: { "+": [LIGHT_ADDED, LIGHT_ADDED_256], "-": [LIGHT_REMOVED, LIGHT_REMOVED_256] }
90411
+ };
90412
+ var diffTheme = () => process.env.HUM_THEME === "light" ? "light" : "dark";
90413
+ var tint = (sign, theme) => {
90414
+ const pair = TINTS[theme][sign];
90415
+ if (!pair || source_default.level < 2) return void 0;
90416
+ return source_default.level >= 3 ? pair[0] : `ansi256(${pair[1]})`;
90417
+ };
90418
+ function numberDiff(lines) {
90419
+ const numbered = lines.some((l) => HUNK.test(l));
90420
+ let oldN = 0, newN = 0, oldLeft = 0, newLeft = 0;
90421
+ return lines.map((l) => {
90422
+ const m = numbered && HUNK.exec(l);
90423
+ if (m) {
90424
+ oldN = Number(m[1]);
90425
+ newN = Number(m[3]);
90426
+ oldLeft = Number(m[2] ?? 1);
90427
+ newLeft = Number(m[4] ?? 1);
90428
+ return { head: true, text: l };
90429
+ }
90430
+ const sign = l[0] === "+" || l[0] === "-" ? l[0] : " ";
90431
+ if (!numbered) return { sign, n: null, text: sign === " " ? l : l.slice(1) };
90432
+ if (oldLeft <= 0 && newLeft <= 0 || l[0] === "\\") return { text: l };
90433
+ const text = l.slice(1);
90434
+ if (sign === "+") {
90435
+ newLeft -= 1;
90436
+ return { sign, n: newN++, text };
90437
+ }
90438
+ if (sign === "-") {
90439
+ oldLeft -= 1;
90440
+ return { sign, n: oldN++, text };
90441
+ }
90442
+ oldLeft -= 1;
90443
+ newLeft -= 1;
90444
+ oldN += 1;
90445
+ return { sign, n: newN++, text };
90446
+ });
90447
+ }
90448
+ function diffCounts(stat, lines = []) {
90449
+ const ins = /(\d+) insertion/.exec(stat || ""), del = /(\d+) deletion/.exec(stat || "");
90450
+ if (ins || del) return { added: Number(ins?.[1] || 0), removed: Number(del?.[1] || 0) };
90451
+ const rows = numberDiff(lines);
90452
+ return { added: rows.filter((r) => r.sign === "+").length, removed: rows.filter((r) => r.sign === "-").length };
90453
+ }
90454
+ function DiffLines({ lines, headColor }) {
90455
+ const rows = numberDiff(lines);
90456
+ const theme = diffTheme();
90457
+ const gutter = Math.max(0, ...rows.map((r) => r.n == null ? 0 : String(r.n).length));
90458
+ return rows.map((r, i) => {
90459
+ if (r.sign == null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: r.head ? headColor : void 0, dimColor: true, children: r.text || " " }, i);
90460
+ const bg = tint(r.sign, theme);
90461
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
90462
+ gutter ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
90463
+ String(r.n ?? "").padStart(gutter),
90464
+ " "
90465
+ ] }) }) : null,
90466
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { flexGrow: 1, backgroundColor: bg, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: r.sign === "+" ? "green" : r.sign === "-" ? "red" : void 0, dimColor: r.sign === " ", backgroundColor: bg, children: [
90467
+ r.sign,
90468
+ r.text
90469
+ ] }) })
90470
+ ] }, i);
90471
+ });
90472
+ }
90473
+ function DiffStat({ stat, lines }) {
90474
+ const { added, removed } = diffCounts(stat, lines);
90475
+ const files = /\d+ files? changed/.exec(stat || "")?.[0];
90476
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
90477
+ files ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
90478
+ files,
90479
+ " "
90480
+ ] }) : null,
90481
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "green", children: `+${added}` }),
90482
+ " ",
90483
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "red", children: `-${removed}` })
90484
+ ] });
90485
+ }
90245
90486
 
90246
90487
  // src/consult.js
90488
+ init_source();
90247
90489
  init_wrap_ansi2();
90248
- init_markdown();
90490
+ await init_markdown();
90491
+ var optionRows = (step, options2, width, picks, cursor) => {
90492
+ const digits = String(options2.length).length;
90493
+ return options2.flatMap((o, i) => {
90494
+ const lead = `${i === cursor ? "\u203A " : " "}${String(i + 1).padStart(digits)}. ${step.multi ? `[${picks.includes(o.label) ? "x" : " "}] ` : ""}`;
90495
+ const said = String(o.description || "");
90496
+ const desc = /[\x60*_]/.test(said) ? renderMarkdown(said, 1e3).trim() : said;
90497
+ const body = `${source_default.bold(o.label)}${step.default === o.label ? " (default)" : ""}${desc ? source_default.dim(` \u2014 ${desc}`) : ""}`;
90498
+ return wrapAnsi2(body, Math.max(8, width - lead.length), { hard: true, trim: true }).split("\n").map((line, j) => (j ? " ".repeat(lead.length) : i === cursor ? source_default.hex(ACCENT)(lead) : lead) + line);
90499
+ });
90500
+ };
90249
90501
  var cell = (s) => String(s || "").replaceAll("\\", "\\\\").replaceAll("|", "\\|").replace(/\r?\n/g, " ");
90250
90502
  function consultBody(question, step, width, picks = [], cursor = 0) {
90251
90503
  const parts = [];
90504
+ let choices = [];
90252
90505
  if (question.kind === "constraints") {
90253
90506
  const rows = (question.questions || []).filter((q) => q.id !== "missed");
90254
90507
  if (width >= 60) {
@@ -90274,18 +90527,17 @@ ${q.question}`).join("\n\n"));
90274
90527
  ...options2.map((o, i) => `| ${i + 1} | ${cell(o.label)} | ${cell(o.description)} |`)
90275
90528
  ].join("\n"));
90276
90529
  } else if (options2.length) {
90277
- parts.push(options2.map((o, i) => {
90278
- const mark = step.multi ? `${i === cursor ? "\u203A " : ""}[${picks.includes(o.label) ? "x" : " "}] ` : "";
90279
- return `${i + 1}. ${mark}${o.label}${step.default === o.label ? " (default)" : ""}${o.description ? ` \u2014 ${o.description}` : ""}`;
90280
- }).join("\n\n"));
90530
+ choices = optionRows(step, options2, width, picks, cursor);
90281
90531
  }
90282
90532
  }
90283
- if (question.evidence?.length) parts.push("**Evidence**\n\n" + question.evidence.join("\n\n"));
90284
- return wrapAnsi2(
90285
- renderMarkdown(parts.filter(Boolean).join("\n\n"), width),
90533
+ const read = (md) => md.length ? wrapAnsi2(
90534
+ renderMarkdown(md.filter(Boolean).join("\n\n"), width),
90286
90535
  width,
90287
90536
  { hard: true, trim: false }
90288
- ).split("\n");
90537
+ ).split("\n") : [];
90538
+ const evidence = question.evidence?.length ? ["**Evidence**\n\n" + question.evidence.join("\n\n")] : [];
90539
+ if (!choices.length) return read([...parts, ...evidence]);
90540
+ return [...read(parts), "", ...choices, ...evidence.length ? ["", ...read(evidence)] : []];
90289
90541
  }
90290
90542
 
90291
90543
  // src/wordmark.js
@@ -90319,14 +90571,25 @@ init_core();
90319
90571
  init_agents();
90320
90572
 
90321
90573
  // src/input.jsx
90322
- var import_react35 = __toESM(require_react(), 1);
90574
+ var import_react37 = __toESM(require_react(), 1);
90323
90575
  await init_build2();
90324
90576
  init_source();
90325
- var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
90577
+ await init_theme();
90578
+ var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
90579
+ import { spawnSync as spawnSync4 } from "node:child_process";
90580
+ import fs7 from "node:fs";
90581
+ import os6 from "node:os";
90582
+ import path5 from "node:path";
90326
90583
  var BURST_MS = 40;
90327
90584
  var CHIP_AT_END = /\[Pasted text #\d+ \+\d+ lines\]$/;
90328
90585
  var CHIP_AT_START = /^\[Pasted text #\d+ \+\d+ lines\]/;
90329
90586
  var CHIP = /\[Pasted text #(\d+) \+\d+ lines\]/g;
90587
+ var editorCommand = (env3 = process.env, platform2 = process.platform) => {
90588
+ const named = (env3.VISUAL || env3.EDITOR || "").trim();
90589
+ const [bin, ...args2] = (named || (platform2 === "win32" ? "notepad" : "vi")).split(/\s+/);
90590
+ return { bin, args: args2, named: !!named };
90591
+ };
90592
+ var editedText = (raw) => normalise(raw.replace(/^\uFEFF/, "")).replace(/\n$/, "");
90330
90593
  var normalise = (s) => [...s.replace(/\r\n?/g, "\n")].filter((ch) => ch === "\n" || ch === " " || ch >= " ").join("");
90331
90594
  function MultilineInput({
90332
90595
  value,
@@ -90340,13 +90603,17 @@ function MultilineInput({
90340
90603
  navActive = true,
90341
90604
  mask = false,
90342
90605
  swallow = null,
90606
+ onSearch = null,
90607
+ onInfo = null,
90343
90608
  ref = null
90344
90609
  }) {
90345
- const [cursor, setCursor] = (0, import_react35.useState)(value.length);
90346
- const hist = (0, import_react35.useRef)({ index: null, stash: "" });
90347
- const latest = (0, import_react35.useRef)({ value, cursor });
90610
+ const { suspendTerminal } = use_app_default();
90611
+ const [cursor, setCursor] = (0, import_react37.useState)(value.length);
90612
+ const hist = (0, import_react37.useRef)({ index: null, stash: "" });
90613
+ const search = (0, import_react37.useRef)(null);
90614
+ const latest = (0, import_react37.useRef)({ value, cursor });
90348
90615
  latest.current = { value, cursor };
90349
- const burstAt = (0, import_react35.useRef)(0);
90616
+ const burstAt = (0, import_react37.useRef)(0);
90350
90617
  const clamp = (n, len) => Math.max(0, Math.min(n, len));
90351
90618
  const set = (v, c2) => {
90352
90619
  latest.current = { value: v, cursor: clamp(c2, v.length) };
@@ -90358,7 +90625,7 @@ function MultilineInput({
90358
90625
  const c2 = clamp(cu, v.length);
90359
90626
  set(v.slice(0, c2) + text + v.slice(c2), c2 + text.length);
90360
90627
  };
90361
- (0, import_react35.useImperativeHandle)(ref, () => ({
90628
+ (0, import_react37.useImperativeHandle)(ref, () => ({
90362
90629
  // text placed at the cursor as it is NOW (an image chip arrives after a round trip)
90363
90630
  insert(text) {
90364
90631
  const { value: v, cursor: cu } = latest.current;
@@ -90369,6 +90636,11 @@ function MultilineInput({
90369
90636
  // pasted text (or its chip) placed at the cursor as it is
90370
90637
  paste(text) {
90371
90638
  insertAt(text);
90639
+ },
90640
+ // a completion accepted: the value from `from` to its end becomes `text`, the caret after it
90641
+ complete(from, text) {
90642
+ const v = latest.current.value;
90643
+ set(v.slice(0, from) + text, from + text.length);
90372
90644
  }
90373
90645
  }));
90374
90646
  const lineStart = (v, c2) => v.lastIndexOf("\n", c2 - 1) + 1;
@@ -90397,6 +90669,48 @@ function MultilineInput({
90397
90669
  }
90398
90670
  }
90399
90671
  };
90672
+ const showMatch = (q, index) => {
90673
+ const seen = /* @__PURE__ */ new Set();
90674
+ const matches = [...history].reverse().filter((h) => h.toLowerCase().includes(q.toLowerCase()) && !seen.has(h) && seen.add(h));
90675
+ const i = matches.length ? index % matches.length : 0;
90676
+ search.current = { ...search.current, query: q, matches, index: i };
90677
+ if (matches.length) set(matches[i], matches[i].length);
90678
+ if (onSearch) onSearch({ query: q, hit: matches.length > 0 });
90679
+ };
90680
+ const endSearch = (restore) => {
90681
+ const { stash } = search.current;
90682
+ search.current = null;
90683
+ hist.current = { index: null, stash: "" };
90684
+ if (restore) set(stash, stash.length);
90685
+ if (onSearch) onSearch(null);
90686
+ };
90687
+ const openEditor = async () => {
90688
+ const { bin, args: args2, named } = editorCommand();
90689
+ const file = path5.join(os6.tmpdir(), `hum-edit-${process.pid}.md`);
90690
+ let text = null, why = null;
90691
+ try {
90692
+ fs7.writeFileSync(file, latest.current.value);
90693
+ await suspendTerminal(() => {
90694
+ const r = spawnSync4(bin, [...args2, file], { stdio: "inherit" });
90695
+ if (r.error) why = r.error.code === "ENOENT" ? named ? `no editor: ${bin} is not on PATH` : `no editor: set $VISUAL or $EDITOR (${bin} is not on PATH)` : `${bin}: ${r.error.message}`;
90696
+ else if (r.status !== 0) why = `${bin} exited ${r.status ?? r.signal} \xB7 the draft is as it was`;
90697
+ else text = fs7.readFileSync(file, "utf8");
90698
+ });
90699
+ } catch (e) {
90700
+ why = `editor: ${e.message}`;
90701
+ } finally {
90702
+ try {
90703
+ fs7.unlinkSync(file);
90704
+ } catch {
90705
+ }
90706
+ }
90707
+ if (why) {
90708
+ if (onInfo) onInfo(why);
90709
+ return;
90710
+ }
90711
+ const clean = editedText(text);
90712
+ set(clean, clean.length);
90713
+ };
90400
90714
  use_paste_default((text) => {
90401
90715
  const clean = normalise(text);
90402
90716
  burstAt.current = Date.now();
@@ -90407,7 +90721,22 @@ function MultilineInput({
90407
90721
  const { value: value2, cursor: cursor2 } = latest.current;
90408
90722
  const c2 = clamp(cursor2, value2.length);
90409
90723
  if (swallow && swallow(input, key)) return;
90410
- if (key.return && (key.meta || key.shift)) {
90724
+ if (search.current) {
90725
+ const { query, index } = search.current;
90726
+ if (key.ctrl && input === "r") showMatch(query, index + 1);
90727
+ else if (key.return || key.leftArrow || key.rightArrow || key.upArrow || key.downArrow) endSearch(false);
90728
+ else if (key.escape) endSearch(true);
90729
+ else if (key.backspace) showMatch(query.slice(0, -1), 0);
90730
+ else if (!key.ctrl && !key.meta && !key.tab && normalise(input)) showMatch(query + normalise(input), 0);
90731
+ return;
90732
+ }
90733
+ if (key.ctrl && input === "r") {
90734
+ if (!navActive) return;
90735
+ search.current = { query: "", matches: [], index: 0, stash: value2 };
90736
+ showMatch("", 0);
90737
+ return;
90738
+ }
90739
+ if (key.return && (key.meta || key.shift) || key.ctrl && input === "j" || !key.return && input === "\n") {
90411
90740
  insertAt("\n");
90412
90741
  return;
90413
90742
  }
@@ -90483,6 +90812,8 @@ function MultilineInput({
90483
90812
  set(head + value2.slice(c2), head.length);
90484
90813
  } else if (input === "v") {
90485
90814
  if (onPasteImage) onPasteImage();
90815
+ } else if (input === "g") {
90816
+ if (!mask) openEditor();
90486
90817
  }
90487
90818
  return;
90488
90819
  }
@@ -90494,13 +90825,13 @@ function MultilineInput({
90494
90825
  set(value2.slice(0, c2) + text + value2.slice(c2), c2 + text.length);
90495
90826
  }, { isActive: focus });
90496
90827
  if (!focus) {
90497
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: value.length > 0 ? mask ? "\u2022".repeat(value.length) : value : source_default.dim(placeholder) });
90828
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: value.length > 0 ? mask ? "\u2022".repeat(value.length) : value : dimText(placeholder) });
90498
90829
  }
90499
90830
  const c = clamp(cursor, value.length);
90500
90831
  const value_ = mask ? "\u2022".repeat(value.length) : value;
90501
90832
  let shown;
90502
90833
  if (value.length === 0) {
90503
- shown = placeholder ? source_default.inverse(placeholder.charAt(0) || " ") + source_default.dim(placeholder.slice(1)) : source_default.inverse(" ");
90834
+ shown = placeholder ? source_default.inverse(placeholder.charAt(0) || " ") + dimText(placeholder.slice(1)) : source_default.inverse(" ");
90504
90835
  } else if (c >= value.length) {
90505
90836
  shown = value_ + source_default.inverse(" ");
90506
90837
  } else if (value_[c] === "\n") {
@@ -90508,22 +90839,44 @@ function MultilineInput({
90508
90839
  } else {
90509
90840
  shown = value_.slice(0, c) + source_default.inverse(value_[c]) + value_.slice(c + 1);
90510
90841
  }
90511
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: shown });
90842
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: shown });
90512
90843
  }
90513
90844
  var input_default = MultilineInput;
90514
90845
 
90846
+ // src/attention.js
90847
+ import path6 from "node:path";
90848
+ var BEL3 = "\x07";
90849
+ var ASK_WAIT_MS = 6e3;
90850
+ var IDLE_WAIT_MS = 6e4;
90851
+ var OFF = /* @__PURE__ */ new Set(["0", "false", "off"]);
90852
+ var enabled = (env3 = process.env) => !OFF.has(env3.HUM_NOTIFY ?? "1");
90853
+ var drawsNotice = (env3 = process.env) => /^(iTerm\.app|ghostty|WezTerm|kitty)$/i.test(env3.TERM_PROGRAM || "") || /kitty|ghostty|wezterm/i.test(env3.TERM || "") || /^iTerm2$/i.test(env3.LC_TERMINAL || "");
90854
+ var passthrough = (seq, env3) => env3.TMUX ? `\x1BPtmux;${seq.replace(/\x1b/g, "\x1B\x1B")}\x1B\\` : seq;
90855
+ function ring(message, env3 = process.env) {
90856
+ if (!enabled(env3)) return "";
90857
+ return BEL3 + (drawsNotice(env3) ? passthrough(`\x1B]9;${message}\x07`, env3) : "");
90858
+ }
90859
+ var titleOf = (cwd2, waiting = false) => `hum \xB7 ${path6.basename(cwd2 || "") || "hum"}${waiting ? " \xB7 [ ! ] needs you" : ""}`;
90860
+ var title = (text, env3 = process.env) => enabled(env3) ? `\x1B]0;${text}\x07` : "";
90861
+ var toTerminal = (seq, out = process.stdout) => {
90862
+ if (seq && out.isTTY) out.write(seq);
90863
+ };
90864
+ var after = (ms, fn) => {
90865
+ const t = setTimeout(fn, ms);
90866
+ return () => clearTimeout(t);
90867
+ };
90868
+
90515
90869
  // src/app.jsx
90516
- var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
90517
- var MINE2 = true ? "0.2.24" : "";
90870
+ var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
90871
+ var MINE2 = true ? "0.2.26" : "";
90518
90872
  var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
90519
90873
  var plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
90520
- var firstResp = (e) => e.first_response_s ? ` \xB7 first response ${e.first_response_s.toFixed(1)}s` : "";
90521
90874
  var shortSession = (name) => (name || "").replace(/\.jsonl$/, "");
90522
- var HYPOTHESIS_GLYPH = { candidate: "\u25FB", testing: "\u25B8", supported: "\u25FC", refuted: "\u2717", superseded: "\u21B7", blocked: "\u23F8" };
90875
+ var HYPOTHESIS_GLYPH = { candidate: "\u25FB", testing: "\u25B8", supported: "\u25FC", refuted: "\u2717", superseded: "\u21B7", blocked: "\u2016" };
90523
90876
  var PICKER_ROWS = 8;
90524
90877
  var sessionRows = (p, here) => {
90525
90878
  const q = p.query.trim().toLowerCase();
90526
- const all = p.all.map((it) => ({ ...it, dir: it.cwd ? path5.basename(it.cwd) : "" }));
90879
+ const all = p.all.map((it) => ({ ...it, dir: it.cwd ? path7.basename(it.cwd) : "" }));
90527
90880
  const inHere = all.filter((it) => it.cwd && here && it.cwd === here);
90528
90881
  const scope = p.scope === "here" && inHere.length ? "here" : "all";
90529
90882
  let rows = all;
@@ -90545,7 +90898,7 @@ var ago = (at) => {
90545
90898
  return `${Math.floor(secs / 86400)}d ago`;
90546
90899
  };
90547
90900
  var homeRel = (p) => {
90548
- const h = os6.homedir();
90901
+ const h = os7.homedir();
90549
90902
  return p && h && p.startsWith(h) ? "~" + p.slice(h.length) : p;
90550
90903
  };
90551
90904
  var handEdit = (stat) => {
@@ -90579,23 +90932,48 @@ var costLines = (spend, meter, end, ctx = "") => {
90579
90932
  for (const [m, u] of Object.entries(end.by_model || {})) lines.push(`${m} \xB7 ${plural(u.calls || 0, "call")} \xB7 ${fmtN(u.input_tokens)}+${fmtN(u.output_tokens)} tokens \xB7 ${fmtN(u.cache_read_tokens)} cached \xB7 ${fmtCost2(u.cost_usd || 0)}`);
90580
90933
  return lines;
90581
90934
  };
90582
- var HISTORY_PATH = path5.join(os6.homedir(), ".hum", "history.json");
90935
+ var historyPath = () => path7.join(humHome2(), "history.json");
90583
90936
  var HISTORY_MAX = 300;
90584
90937
  var loadHistory = () => {
90585
90938
  try {
90586
- const a = JSON.parse(fs7.readFileSync(HISTORY_PATH, "utf8"));
90587
- return Array.isArray(a) ? a.filter((x) => typeof x === "string") : [];
90939
+ const a = JSON.parse(fs8.readFileSync(historyPath(), "utf8"));
90940
+ return Array.isArray(a) ? a.map((x) => typeof x === "string" ? { cwd: "", text: x, at: 0 } : x).filter((r) => r && typeof r.text === "string") : [];
90941
+ } catch {
90942
+ return [];
90943
+ }
90944
+ };
90945
+ var saveHistory = (rows) => {
90946
+ try {
90947
+ fs8.mkdirSync(path7.dirname(historyPath()), { recursive: true });
90948
+ fs8.writeFileSync(historyPath(), JSON.stringify(rows.slice(-HISTORY_MAX)));
90949
+ } catch {
90950
+ }
90951
+ };
90952
+ var recallOrder = (rows, cwd2) => [...rows.filter((r) => r.cwd !== cwd2), ...rows.filter((r) => r.cwd === cwd2)].map((r) => r.text);
90953
+ var PASTE_KEEP = 50;
90954
+ var pasteDir = () => path7.join(humHome2(), "paste");
90955
+ var pasteIds = () => {
90956
+ try {
90957
+ return fs8.readdirSync(pasteDir()).map((f) => Number((f.match(/^(\d+)\.txt$/) || [])[1])).filter(Number.isInteger).sort((a, b) => a - b);
90588
90958
  } catch {
90589
90959
  return [];
90590
90960
  }
90591
90961
  };
90592
- var saveHistory = (arr) => {
90962
+ var savePaste = (n, text) => {
90593
90963
  try {
90594
- fs7.mkdirSync(path5.dirname(HISTORY_PATH), { recursive: true });
90595
- fs7.writeFileSync(HISTORY_PATH, JSON.stringify(arr.slice(-HISTORY_MAX)));
90964
+ fs8.mkdirSync(pasteDir(), { recursive: true });
90965
+ fs8.writeFileSync(path7.join(pasteDir(), `${n}.txt`), text);
90966
+ for (const id of pasteIds().slice(0, -PASTE_KEEP)) fs8.rmSync(path7.join(pasteDir(), `${id}.txt`), { force: true });
90596
90967
  } catch {
90597
90968
  }
90598
90969
  };
90970
+ var readPaste = (n) => {
90971
+ try {
90972
+ return fs8.readFileSync(path7.join(pasteDir(), `${n}.txt`), "utf8");
90973
+ } catch {
90974
+ return null;
90975
+ }
90976
+ };
90599
90977
  var DRAFT_TAIL_LINES = 14;
90600
90978
  var LIVE_MIN_ROWS = 3;
90601
90979
  var DEFAULT_ROWS = 24;
@@ -90613,6 +90991,7 @@ var COMMANDS = [
90613
90991
  { name: "/accept", desc: "the work as it stands is what you wanted (/accept <why>); recorded against the state it is in" },
90614
90992
  { name: "/reject", desc: "the work as it stands is not (/reject <why>)" },
90615
90993
  { name: "/cost", desc: "tokens and cost so far" },
90994
+ { name: "/expand", desc: "the whole output of a tool result: /expand alone is the newest (ctrl+o too), /expand <n> the one numbered #n on its line" },
90616
90995
  { name: "/context", desc: "what fills the context window: system prompt, tool schemas, messages, tool results" },
90617
90996
  { name: "/usage-credits", desc: "your credits on our models, and the page that adds more (a code from Metaphi, or a purchase)" },
90618
90997
  { name: "/approve", desc: "approvals on|off \u2014 whether every change and command waits for you first (leaving the sandbox always asks)" },
@@ -90630,7 +91009,28 @@ var COMMANDS = [
90630
91009
  { name: "/quit", desc: "leave; the session keeps running (hum resume brings you back)" },
90631
91010
  { name: "/stop", desc: "end this session for good (the record is saved)" }
90632
91011
  ];
90633
- var HELP = "!cmd runs a command as you \xB7 esc interrupts the model (what it had is kept) \xB7 esc twice while it is idle opens the rewind picker \xB7 type while it works to steer \xB7 edit files in your editor any time (recorded as your turn) \xB7 ctrl+o shows the full output of the last tool result \xB7 ctrl+v pastes a screenshot from the clipboard \xB7 @path.png or /image <path> attaches an image file \xB7 commands run in a sandbox (writes in the working directory, no network); leaving it asks you first (enter approves, a typed reason rejects) \xB7 /approve makes every change and command wait for you; at the panel, a allows that shape for the session and p writes it into the project \xB7 /permissions lists the rules in force \xB7 /diff shows what has changed since the session began \xB7 /rewind takes the files or the conversation back to something you said \xB7 /mcp lists the tool servers \xB7 /resume picks a past session (a running one attaches) \xB7 /compact restarts the context from a summary \xB7 ctrl+c twice leaves and the session keeps running (`hum resume` brings you back) \xB7 /stop ends it";
91012
+ var KEYS = [
91013
+ { name: "!cmd", desc: "runs a command as you" },
91014
+ { name: "esc", desc: "interrupts the model (what it had is kept); twice while it is idle opens the rewind picker; twice with a draft clears it to history (up brings it back)" },
91015
+ { name: "ctrl+j", desc: "adds a line without sending; alt+enter and shift+enter do too where the terminal tells them from enter" },
91016
+ { name: "enter", desc: "at a proposal approves it; a typed reason rejects; a / p allow that shape for the session / the project" },
91017
+ { name: "typing", desc: "while it works steers it; editing files in your editor is recorded as your turn" },
91018
+ { name: "tab", desc: "while it works holds the line for the next turn (listed above the box); up on an empty box takes the newest back" },
91019
+ { name: "ctrl+o", desc: "shows the full output of the last tool result; /expand n shows the one numbered #n on its line" },
91020
+ { name: "ctrl+g", desc: "opens the box in $VISUAL / $EDITOR, else vi; notepad on Windows" },
91021
+ { name: "@", desc: "and a few letters lists the paths under the working directory that hold them; tab or enter takes one, esc leaves the word as typed" },
91022
+ { name: "ctrl+v", desc: "pastes a screenshot from the clipboard; @path.png in a message attaches an image file" },
91023
+ { name: "ctrl+c", desc: "twice leaves; the session keeps running (hum resume brings you back)" },
91024
+ { name: "?", desc: "on an empty line shows this" }
91025
+ ];
91026
+ var commandRows = (rows, index = -1, pad2 = 8) => rows.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
91027
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "cyan", inverse: i === index, children: c.name.padEnd(pad2) }),
91028
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91029
+ " ",
91030
+ c.desc
91031
+ ] })
91032
+ ] }, c.name));
91033
+ var HELP_PAD = Math.max(...COMMANDS.map((c) => c.name.length));
90634
91034
  var DIFF_TAIL_LINES = 20;
90635
91035
  var PATCH_LINES = 200;
90636
91036
  var NEEDS_EVERY_MS = 1e4;
@@ -90644,94 +91044,223 @@ var REWIND_CHOICES = [
90644
91044
  var ERR_TAIL_LINES = 5;
90645
91045
  var PEEK_LINES = 12;
90646
91046
  var THOUGHT_TAIL_LINES = 3;
91047
+ var FILE_DEPTH = 3;
91048
+ var FILE_CAP = 200;
91049
+ var FILE_ROWS = 8;
91050
+ var walkFiles = (root, { depth = FILE_DEPTH, cap = FILE_CAP } = {}) => {
91051
+ const out = [];
91052
+ let level = [""];
91053
+ for (let d = 0; d < depth && level.length && out.length < cap; d += 1) {
91054
+ const next = [];
91055
+ for (const rel of level) {
91056
+ let entries;
91057
+ try {
91058
+ entries = fs8.readdirSync(path7.join(root, rel), { withFileTypes: true });
91059
+ } catch {
91060
+ continue;
91061
+ }
91062
+ entries.sort((a, b) => a.name.localeCompare(b.name));
91063
+ for (const e of entries) {
91064
+ if (e.name.startsWith(".") || e.name === "node_modules") continue;
91065
+ if (out.length >= cap) return out;
91066
+ const p = rel ? `${rel}/${e.name}` : e.name;
91067
+ if (e.isDirectory()) {
91068
+ out.push(`${p}/`);
91069
+ next.push(p);
91070
+ } else out.push(p);
91071
+ }
91072
+ }
91073
+ level = next;
91074
+ }
91075
+ return out;
91076
+ };
91077
+ var AT_TAIL = /(?:^|\s)@([^\s@]+)$/;
91078
+ var OUTPUTS_KEPT = 20;
90647
91079
  var diagLine = (d) => `${d.file ? `${d.file}${d.line != null ? `:${d.line}` : ""}: ` : ""}${d.severity || "error"}: ${d.message || ""}`;
90648
91080
  var toolLine = (text) => {
90649
91081
  const s = String(text || "");
90650
91082
  const cut = s.indexOf(" ");
90651
- if (cut <= 0) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: s });
90652
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
90653
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: s.slice(0, cut) }),
90654
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: s.slice(cut) })
91083
+ if (cut <= 0) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: s });
91084
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
91085
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: s.slice(0, cut) }),
91086
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: s.slice(cut) })
90655
91087
  ] });
90656
91088
  };
90657
- var tallyLine = (tally) => Object.entries(tally).map(([name, t]) => {
90658
- const short = name.includes("__") ? name.split("__")[1] : name;
90659
- const parts = [t.ok ? `${t.ok} ok` : null, t.failed ? `${t.failed} failed` : null, t.error ? `${t.error} error` : null].filter(Boolean);
90660
- return `${short} ${parts.join(" \xB7 ")}`;
90661
- }).join(" ");
90662
- function App2({ core: core2, task, resume, images = [], peek = peekSession, update = updateNotice, watch = watchReady }) {
91089
+ var ToolRow = ({ text, tail: tail2 }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
91090
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: "\u25CB" }) }),
91091
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
91092
+ toolLine(text),
91093
+ tail2 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: tail2 }) : null
91094
+ ] })
91095
+ ] });
91096
+ var tickTail = (t0) => {
91097
+ const s = Math.floor((Date.now() - t0) / 1e3);
91098
+ return s >= 1 ? ` \xB7 ${fmtDur(s)}` : "";
91099
+ };
91100
+ var READ_ONLY = /* @__PURE__ */ new Set(["read_file", "grep", "glob"]);
91101
+ var READS_SHOWN = 6;
91102
+ var readsLabel = (reads) => {
91103
+ const files = reads.filter((r) => r.name === "read_file").length;
91104
+ const searches = reads.length - files;
91105
+ return [
91106
+ files ? `read ${plural(files, "file")}` : null,
91107
+ searches ? files ? `${searches} search${searches === 1 ? "" : "es"}` : `searched ${plural(searches, "time")}` : null
91108
+ ].filter(Boolean).join(" \xB7 ");
91109
+ };
91110
+ var foldRows = (reads) => {
91111
+ if (reads.length < 2) return reads.flatMap((r) => [r.item, r.row]);
91112
+ const more = reads.length > READS_SHOWN ? ` \xB7 +${reads.length - READS_SHOWN} more` : "";
91113
+ return [
91114
+ { kind: "tool", text: readsLabel(reads) },
91115
+ { kind: "tool_result", text: `${reads.slice(0, READS_SHOWN).map((r) => r.what).join(" \xB7 ")}${more} (ctrl+o expands \xB7 #${reads[0].n})` }
91116
+ ];
91117
+ };
91118
+ var fitStatus = (parts, width) => {
91119
+ const kept = parts.filter((p) => p && p.text);
91120
+ const line = () => kept.map((p) => p.text).join(" \xB7 ");
91121
+ for (const p of kept.filter((q) => q.drop).sort((a, b) => a.drop - b.drop)) {
91122
+ if (line().length <= width) break;
91123
+ kept.splice(kept.indexOf(p), 1);
91124
+ }
91125
+ return line();
91126
+ };
91127
+ function App2({ core: core2, task, resume, images = [], peek = peekSession, update = updateNotice, watch = watchReady, tty: tty3 = toTerminal, after: after2 = after }) {
90663
91128
  const { exit } = use_app_default();
90664
91129
  const { stdout } = use_stdout_default();
90665
91130
  const width = (stdout?.columns || 80) - 2;
90666
- const [items, setItems] = (0, import_react36.useState)([]);
90667
- const [transcriptEpoch, setTranscriptEpoch] = (0, import_react36.useState)(0);
90668
- const [phase, setPhase] = (0, import_react36.useState)("connecting");
90669
- const [status, setStatus] = (0, import_react36.useState)("");
90670
- const [hello, setHello] = (0, import_react36.useState)(null);
90671
- const [latest, setLatest] = (0, import_react36.useState)(null);
90672
- const [ready, setReady] = (0, import_react36.useState)("");
90673
- const [needYou, setNeedYou] = (0, import_react36.useState)(0);
90674
- const [goal, setGoal] = (0, import_react36.useState)(null);
90675
- const [session, setSession] = (0, import_react36.useState)(null);
90676
- const [spend, setSpend] = (0, import_react36.useState)(0);
90677
- const [agents, setAgents] = (0, import_react36.useState)([]);
90678
- const [panelIndex, setPanelIndex] = (0, import_react36.useState)(-1);
90679
- const [looking, setLooking] = (0, import_react36.useState)(null);
90680
- const lookRef = (0, import_react36.useRef)(null);
90681
- const [draft, setDraft] = (0, import_react36.useState)("");
90682
- const [thinking, setThinking] = (0, import_react36.useState)("");
90683
- const [value, setValue] = (0, import_react36.useState)("");
90684
- const [menuIndex, setMenuIndex] = (0, import_react36.useState)(0);
90685
- const [elapsed, setElapsed] = (0, import_react36.useState)(0);
90686
- const [ctrlc, setCtrlc] = (0, import_react36.useState)(0);
90687
- const [picker, setPicker] = (0, import_react36.useState)(null);
90688
- const [proposal, setProposal] = (0, import_react36.useState)(null);
90689
- const [questions, setQuestions] = (0, import_react36.useState)([]);
91131
+ const [items, setItems] = (0, import_react38.useState)([]);
91132
+ const [transcriptEpoch, setTranscriptEpoch] = (0, import_react38.useState)(0);
91133
+ const [phase, setPhase] = (0, import_react38.useState)("connecting");
91134
+ const [status, setStatus] = (0, import_react38.useState)("");
91135
+ const [hello, setHello] = (0, import_react38.useState)(null);
91136
+ const [latest, setLatest] = (0, import_react38.useState)(null);
91137
+ const [ready, setReady] = (0, import_react38.useState)("");
91138
+ const [needYou, setNeedYou] = (0, import_react38.useState)(0);
91139
+ const [goal, setGoal] = (0, import_react38.useState)(null);
91140
+ const [session, setSession] = (0, import_react38.useState)(null);
91141
+ const [spend, setSpend] = (0, import_react38.useState)(0);
91142
+ const [agents, setAgents] = (0, import_react38.useState)([]);
91143
+ const [panelIndex, setPanelIndex] = (0, import_react38.useState)(-1);
91144
+ const [looking, setLooking] = (0, import_react38.useState)(null);
91145
+ const lookRef = (0, import_react38.useRef)(null);
91146
+ const [draft, setDraft] = (0, import_react38.useState)("");
91147
+ const [thinking, setThinking] = (0, import_react38.useState)("");
91148
+ const [value, setValue] = (0, import_react38.useState)("");
91149
+ const [menuIndex, setMenuIndex] = (0, import_react38.useState)(0);
91150
+ const [atShut, setAtShut] = (0, import_react38.useState)("");
91151
+ const [elapsed, setElapsed] = (0, import_react38.useState)(0);
91152
+ const [ctrlc, setCtrlc] = (0, import_react38.useState)(0);
91153
+ const [search, setSearch] = (0, import_react38.useState)(null);
91154
+ const [picker, setPicker] = (0, import_react38.useState)(null);
91155
+ const [proposal, setProposal] = (0, import_react38.useState)(null);
91156
+ const [questions, setQuestions] = (0, import_react38.useState)([]);
90690
91157
  const question = questions.length ? questions[0] : null;
90691
- const [qStep, setQStep] = (0, import_react36.useState)(0);
90692
- const [qAnswers, setQAnswers] = (0, import_react36.useState)({});
90693
- const [qPicks, setQPicks] = (0, import_react36.useState)([]);
90694
- const [qCursor, setQCursor] = (0, import_react36.useState)(0);
90695
- const [consultTop, setConsultTop] = (0, import_react36.useState)(0);
90696
- const [sendingAsk, setSendingAsk] = (0, import_react36.useState)(null);
90697
- const pendingAsk = (0, import_react36.useRef)(null);
90698
- const [confirm, setConfirm] = (0, import_react36.useState)(null);
90699
- const [trust, setTrust] = (0, import_react36.useState)(null);
90700
- const [gate, setGate] = (0, import_react36.useState)("off");
90701
- const [paused, setPaused] = (0, import_react36.useState)(false);
90702
- const [reflections, setReflections] = (0, import_react36.useState)([]);
90703
- const [why, setWhy] = (0, import_react36.useState)(null);
90704
- const [offer, setOffer] = (0, import_react36.useState)(false);
91158
+ const [qStep, setQStep] = (0, import_react38.useState)(0);
91159
+ const [qAnswers, setQAnswers] = (0, import_react38.useState)({});
91160
+ const [qPicks, setQPicks] = (0, import_react38.useState)([]);
91161
+ const [qCursor, setQCursor] = (0, import_react38.useState)(0);
91162
+ const [qChoice, setQChoice] = (0, import_react38.useState)(null);
91163
+ const [consultTop, setConsultTop] = (0, import_react38.useState)(0);
91164
+ const [sendingAsk, setSendingAsk] = (0, import_react38.useState)(null);
91165
+ const pendingAsk = (0, import_react38.useRef)(null);
91166
+ const [confirm, setConfirm] = (0, import_react38.useState)(null);
91167
+ const [trust, setTrust] = (0, import_react38.useState)(null);
91168
+ const [gate, setGate] = (0, import_react38.useState)("off");
91169
+ const [paused, setPaused] = (0, import_react38.useState)(false);
91170
+ const [reflections, setReflections] = (0, import_react38.useState)([]);
91171
+ const [why, setWhy] = (0, import_react38.useState)(null);
91172
+ const [offer, setOffer] = (0, import_react38.useState)(false);
90705
91173
  const reflection = phase === "idle" && !proposal && !question ? reflections[0] || null : null;
90706
- const attachRef = (0, import_react36.useRef)([]);
90707
- const pasteRef = (0, import_react36.useRef)([]);
90708
- const inputRef = (0, import_react36.useRef)(null);
90709
- const nextId = (0, import_react36.useRef)(0);
90710
- const phaseRef = (0, import_react36.useRef)("connecting");
90711
- const turnT0 = (0, import_react36.useRef)(null);
90712
- const thinkT0 = (0, import_react36.useRef)(null);
90713
- const thinkChars = (0, import_react36.useRef)(0);
90714
- const draftRef = (0, import_react36.useRef)("");
90715
- const thoughtRef = (0, import_react36.useRef)(null);
90716
- const toolsRef = (0, import_react36.useRef)({});
90717
- const historyRef = (0, import_react36.useRef)(loadHistory());
90718
- const modelRef = (0, import_react36.useRef)("");
90719
- const lastOutRef = (0, import_react36.useRef)(null);
90720
- const helloRef = (0, import_react36.useRef)(false);
90721
- const asksRef = (0, import_react36.useRef)([]);
90722
- const startedRef = (0, import_react36.useRef)(false);
90723
- const escRef = (0, import_react36.useRef)(0);
90724
- const rewindRef = (0, import_react36.useRef)({ files: true, conversation: true });
90725
- const wantRow = (0, import_react36.useRef)(null);
90726
- const wroteRef = (0, import_react36.useRef)(false);
90727
- const preHello = (0, import_react36.useRef)([]);
90728
- const [meter, setMeter] = (0, import_react36.useState)({ tokens: 0, cap: 0, input: 0, output: 0 });
90729
- const lastEnd = (0, import_react36.useRef)(null);
91174
+ const attachRef = (0, import_react38.useRef)([]);
91175
+ const pasteRef = (0, import_react38.useRef)([]);
91176
+ const [queued, setQueued] = (0, import_react38.useState)([]);
91177
+ const inputRef = (0, import_react38.useRef)(null);
91178
+ const nextId = (0, import_react38.useRef)(0);
91179
+ const phaseRef = (0, import_react38.useRef)("connecting");
91180
+ const turnT0 = (0, import_react38.useRef)(null);
91181
+ const thinkT0 = (0, import_react38.useRef)(null);
91182
+ const thinkChars = (0, import_react38.useRef)(0);
91183
+ const draftRef = (0, import_react38.useRef)("");
91184
+ const thoughtRef = (0, import_react38.useRef)(null);
91185
+ const toolsRef = (0, import_react38.useRef)({});
91186
+ const historyRef = (0, import_react38.useRef)(loadHistory());
91187
+ const modelRef = (0, import_react38.useRef)("");
91188
+ const heldRef = (0, import_react38.useRef)({ reads: [], calls: [] });
91189
+ const [held, setHeld] = (0, import_react38.useState)(heldRef.current);
91190
+ const outsRef = (0, import_react38.useRef)([]);
91191
+ const outNRef = (0, import_react38.useRef)(0);
91192
+ const helloRef = (0, import_react38.useRef)(false);
91193
+ const regainRef = (0, import_react38.useRef)(null);
91194
+ const [regaining, setRegaining] = (0, import_react38.useState)(false);
91195
+ const [wentAway, setWentAway] = (0, import_react38.useState)(false);
91196
+ (0, import_react38.useEffect)(() => {
91197
+ if (wentAway) exit();
91198
+ }, [wentAway]);
91199
+ const asksRef = (0, import_react38.useRef)([]);
91200
+ const startedRef = (0, import_react38.useRef)(false);
91201
+ const escRef = (0, import_react38.useRef)(0);
91202
+ const rewindRef = (0, import_react38.useRef)({ files: true, conversation: true });
91203
+ const wantRow = (0, import_react38.useRef)(null);
91204
+ const wroteRef = (0, import_react38.useRef)(false);
91205
+ const preHello = (0, import_react38.useRef)([]);
91206
+ const [meter, setMeter] = (0, import_react38.useState)({ tokens: 0, cap: 0, input: 0, output: 0 });
91207
+ const lastEnd = (0, import_react38.useRef)(null);
90730
91208
  const setPhaseBoth = (p) => {
90731
91209
  phaseRef.current = p;
90732
91210
  setPhase(p);
90733
91211
  };
90734
- const append = (item) => setItems((prev) => [...prev, { id: nextId.current++, ...item }]);
91212
+ const idleRef = (0, import_react38.useRef)(null);
91213
+ const hereNow = () => {
91214
+ if (idleRef.current) {
91215
+ idleRef.current();
91216
+ idleRef.current = null;
91217
+ }
91218
+ };
91219
+ const push = (item) => setItems((prev) => [...prev, { id: nextId.current++, ...item }]);
91220
+ const setHeldBoth = (h) => {
91221
+ heldRef.current = h;
91222
+ setHeld(h);
91223
+ };
91224
+ const printHeld = (keep = []) => {
91225
+ const h = heldRef.current;
91226
+ if (!h.reads.length && h.calls.length === keep.length) return;
91227
+ [...foldRows(h.reads), ...h.calls.filter((c) => !keep.includes(c)).map((c) => c.item)].forEach(push);
91228
+ setHeldBoth({ reads: [], calls: keep });
91229
+ };
91230
+ const append = (item) => {
91231
+ printHeld();
91232
+ push(item);
91233
+ };
91234
+ const holdCall = (ev, item) => {
91235
+ if (!READ_ONLY.has(ev.name)) printHeld(heldRef.current.calls);
91236
+ const what = ev.args && (ev.name === "read_file" ? ev.args.path : ev.args.pattern) || item.text;
91237
+ setHeldBoth({ ...heldRef.current, calls: [...heldRef.current.calls, { id: ev.id, name: ev.name, item, what, t0: Date.now() }] });
91238
+ };
91239
+ const keepOut = (name, content) => {
91240
+ const n = ++outNRef.current;
91241
+ outsRef.current = [...outsRef.current, { n, name, content: content || "" }].slice(-OUTPUTS_KEPT);
91242
+ return n;
91243
+ };
91244
+ const showOut = (o) => append({ kind: "output", name: `${o.name} \xB7 #${o.n}`, lines: o.content.split("\n") });
91245
+ const landResult = (ev, rowOf2) => {
91246
+ const h = heldRef.current;
91247
+ const call = h.calls.find((c) => c.id === ev.id);
91248
+ const rest = h.calls.filter((c) => c !== call);
91249
+ if (call && ev.ok && READ_ONLY.has(ev.name)) {
91250
+ const n = h.reads.length ? h.reads[0].n : keepOut(ev.name, ev.content);
91251
+ const reads = [...h.reads, { ...call, row: rowOf2(n), content: ev.content || "", n }];
91252
+ setHeldBoth({ reads, calls: rest });
91253
+ if (reads.length > 1) {
91254
+ const whole = { n, name: readsLabel(reads), content: reads.map((r) => `${r.what}
91255
+ ${r.content}`).join("\n\n") };
91256
+ outsRef.current = outsRef.current.map((o) => o.n === n ? whole : o);
91257
+ }
91258
+ return true;
91259
+ }
91260
+ printHeld(rest);
91261
+ push(rowOf2(keepOut(ev.name, ev.content)));
91262
+ return false;
91263
+ };
90735
91264
  const setAsks = (next) => {
90736
91265
  asksRef.current = next;
90737
91266
  setQuestions(next);
@@ -90742,6 +91271,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90742
91271
  setQAnswers({});
90743
91272
  setQPicks([]);
90744
91273
  setQCursor(0);
91274
+ setQChoice(null);
90745
91275
  };
90746
91276
  const askOf = (ev) => ({
90747
91277
  id: ev.id,
@@ -90770,15 +91300,42 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90770
91300
  const stepLabels = stepOptions.map((o) => o.label);
90771
91301
  const listAsk = !!(question && question.kind === "constraints" && question.questions && question.questions.length);
90772
91302
  const listRows = listAsk ? question.questions.filter((q) => q.id !== "missed") : [];
90773
- const consultLines = (0, import_react36.useMemo)(
90774
- () => question && step ? consultBody(question, step, Math.max(20, width - 4), qPicks, qCursor) : [],
90775
- [question, step, width, qPicks, qCursor]
91303
+ const typedRow = /^[1-9]$/.test(value.trim()) && Number(value.trim()) <= stepLabels.length ? Number(value.trim()) - 1 : null;
91304
+ const choiceRow = step && !step.multi && !listAsk && question.kind !== "decision" ? typedRow ?? qChoice ?? stepLabels.indexOf(step.default) : -1;
91305
+ const consultLines = (0, import_react38.useMemo)(
91306
+ () => question && step ? consultBody(question, step, Math.max(20, width - 4), qPicks, step.multi ? qCursor : choiceRow) : [],
91307
+ [question, step, width, qPicks, qCursor, choiceRow]
90776
91308
  );
91309
+ const choosing = !!(step && stepLabels.length && !listAsk && question.kind !== "decision");
91310
+ const askHint = step && !listAsk ? fitStatus([
91311
+ choosing && { text: step.multi ? "a number ticks" : step.graded ? "\u2191\u2193 or a number marks" : "\u2191\u2193 or a number chooses on Enter" },
91312
+ choosing && step.multi && { text: "space ticks the one marked", drop: 3 },
91313
+ choosing && !step.multi && step.graded && { text: "words after it if you like", drop: 3 },
91314
+ !step.graded && { text: "type or paste your answer", drop: 2 },
91315
+ !step.graded && { text: "Alt+Enter adds a line", drop: 1 },
91316
+ !step.multi && qChoice !== null ? { text: "enter takes the one marked" } : step.default && { text: "enter takes the default" },
91317
+ !step.default && step.optional && (step.multi || qChoice === null) && { text: "enter says nothing" },
91318
+ step.multi && stepLabels.length && { text: "enter takes what is ticked" },
91319
+ step.secret && { text: "it is not shown and not recorded" }
91320
+ ], width - 4) : "";
90777
91321
  const consultHeight = Math.max(4, Math.min(18, Math.floor((stdout?.rows || DEFAULT_ROWS) / 2)));
90778
91322
  const consultStart = Math.min(consultTop, Math.max(0, consultLines.length - consultHeight));
90779
91323
  const menu = !question && value.trimStart().startsWith("/") && !value.includes(" ") ? COMMANDS.filter((c) => c.name.startsWith(value.trim())) : [];
91324
+ const atTyped = !question && !menu.length && !search ? (value.match(AT_TAIL) || [])[1] || "" : "";
91325
+ const atWord = atTyped === atShut ? "" : atTyped;
91326
+ const atRoot = hello?.cwd || process.cwd();
91327
+ const atFiles = (0, import_react38.useMemo)(() => atWord ? walkFiles(atRoot) : [], [!!atWord, atRoot]);
91328
+ const files = (0, import_react38.useMemo)(() => {
91329
+ const q = atWord.toLowerCase();
91330
+ return q ? atFiles.filter((f) => f.toLowerCase().includes(q) && f !== atWord).slice(0, FILE_ROWS) : [];
91331
+ }, [atWord, atFiles]);
91332
+ const acceptFile = () => {
91333
+ const pick = files[Math.min(menuIndex, files.length - 1)];
91334
+ if (!pick || !inputRef.current) return;
91335
+ inputRef.current.complete(value.length - atWord.length, pick.endsWith("/") ? pick : `${pick} `);
91336
+ };
90780
91337
  const ctxPct = meter.cap > 0 && meter.tokens > 0 ? Math.round(meter.tokens / meter.cap * 100) : 0;
90781
- (0, import_react36.useEffect)(() => {
91338
+ (0, import_react38.useEffect)(() => {
90782
91339
  if (phase !== "busy" && phase !== "connecting") return void 0;
90783
91340
  const started = Date.now();
90784
91341
  setElapsed(0);
@@ -90795,10 +91352,13 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90795
91352
  thinkT0.current = null;
90796
91353
  };
90797
91354
  const resetForSession = () => {
91355
+ regainRef.current = null;
91356
+ setRegaining(false);
90798
91357
  setAgents([]);
90799
91358
  setPanelIndex(-1);
90800
91359
  closeLook();
90801
91360
  setItems([]);
91361
+ setHeldBoth({ reads: [], calls: [] });
90802
91362
  setTranscriptEpoch((n) => n + 1);
90803
91363
  setDraft("");
90804
91364
  draftRef.current = "";
@@ -90820,10 +91380,12 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90820
91380
  setStatus("");
90821
91381
  turnT0.current = null;
90822
91382
  toolsRef.current = {};
90823
- lastOutRef.current = null;
91383
+ outsRef.current = [];
91384
+ outNRef.current = 0;
90824
91385
  attachRef.current = [];
90825
91386
  setOffer(false);
90826
91387
  wroteRef.current = false;
91388
+ setQueued([]);
90827
91389
  setMeter((m) => ({ ...m, tokens: 0, input: 0, output: 0 }));
90828
91390
  };
90829
91391
  const closeLook = () => {
@@ -90910,7 +91472,29 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90910
91472
  case "update":
90911
91473
  setLatest({ version: ev.version || "", latest_version: ev.latest_version || "", release_notes_url: ev.release_notes_url || "" });
90912
91474
  break;
91475
+ case "reconnecting":
91476
+ regainRef.current = "trying";
91477
+ setRegaining(true);
91478
+ break;
90913
91479
  case "hello": {
91480
+ if (regainRef.current) {
91481
+ regainRef.current = "greeted";
91482
+ setRegaining(false);
91483
+ setHello(ev);
91484
+ modelRef.current = ev.model;
91485
+ setGate(ev.gate === "approve" ? "approve" : "off");
91486
+ (ev.questions || []).forEach(addAsk);
91487
+ if (ev.busy) {
91488
+ setPhaseBoth("busy");
91489
+ setStatus(ev.phase || "");
91490
+ } else {
91491
+ foldThinking();
91492
+ flushDraft();
91493
+ setPhaseBoth("idle");
91494
+ setStatus("");
91495
+ }
91496
+ break;
91497
+ }
90914
91498
  if (helloRef.current) resetForSession();
90915
91499
  setHello(ev);
90916
91500
  helloRef.current = true;
@@ -90954,6 +91538,10 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90954
91538
  break;
90955
91539
  }
90956
91540
  case "replay":
91541
+ if (regainRef.current === "greeted") {
91542
+ regainRef.current = null;
91543
+ break;
91544
+ }
90957
91545
  const ordered = [];
90958
91546
  for (const it of ev.items || []) {
90959
91547
  const prev = ordered[ordered.length - 1];
@@ -90973,7 +91561,9 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90973
91561
  break;
90974
91562
  case "tool_call": {
90975
91563
  toolsRef.current[it.id] = it;
90976
- append({ kind: "tool", text: it.name === "write_file" && it.lines != null ? `${it.desc || it.name} (${it.lines} lines)` : it.desc || it.name, name: it.name, args: it.args, agent: it.agent });
91564
+ const row = { kind: "tool", text: it.name === "write_file" && it.lines != null ? `${it.desc || it.name} (${it.lines} lines)` : it.desc || it.name, name: it.name, args: it.args, agent: it.agent };
91565
+ if (it.agent || it.diff) append(row);
91566
+ else holdCall(it, row);
90977
91567
  if (it.diff) {
90978
91568
  const ls = it.diff.split("\n");
90979
91569
  append({ kind: "diff", lines: ls.slice(0, DIFF_TAIL_LINES), more: Math.max(0, ls.length - DIFF_TAIL_LINES) });
@@ -90981,9 +91571,10 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90981
91571
  break;
90982
91572
  }
90983
91573
  case "tool_result": {
90984
- if (!it.agent) lastOutRef.current = { name: it.name, content: it.content || "" };
90985
- const more = (it.lines || 0) > 1 ? ` (+${it.lines - 1} lines)` : "";
90986
- append({ kind: "tool_result", text: `${it.summary || "(no output)"}${more}`, isError: !it.ok, agent: it.agent });
91574
+ const more = (n) => (it.lines || 0) > 1 ? ` (+${it.lines - 1} lines${n ? ` \xB7 #${n}` : ""})` : "";
91575
+ const rowOf2 = (n) => ({ kind: "tool_result", text: `${it.summary || "(no output)"}${more(n)}`, isError: !it.ok, agent: it.agent });
91576
+ if (it.agent) append(rowOf2(0));
91577
+ else landResult(it, rowOf2);
90987
91578
  break;
90988
91579
  }
90989
91580
  case "plan": {
@@ -90995,7 +91586,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90995
91586
  append({ kind: "hypotheses", hypotheses: (it.hypotheses || []).map((h) => ({ ...h, glyph: HYPOTHESIS_GLYPH[h.status] || "\u25FB" })), explanation: it.explanation });
90996
91587
  break;
90997
91588
  case "turn_end":
90998
- append({ kind: "turn", text: `${fmtDur(it.elapsed_s || 0)} \xB7 ${plural(it.turns, "step")} \xB7 ${fmtCost2(it.cost_usd)} session${firstResp(it)}` });
91589
+ append({ kind: "turn", text: `${fmtDur(it.elapsed_s || 0)} \xB7 ${plural(it.turns, "step")} \xB7 ${fmtCost2(it.cost_usd)} session` });
90999
91590
  setSpend(it.cost_usd || 0);
91000
91591
  lastEnd.current = it;
91001
91592
  break;
@@ -91064,6 +91655,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91064
91655
  if (ev.model) modelRef.current = ev.model;
91065
91656
  break;
91066
91657
  case "turn_start":
91658
+ hereNow();
91067
91659
  turnT0.current = turnT0.current || Date.now();
91068
91660
  setPhaseBoth("busy");
91069
91661
  break;
@@ -91074,6 +91666,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91074
91666
  case "idle":
91075
91667
  setPhaseBoth("idle");
91076
91668
  setStatus("");
91669
+ printHeld();
91077
91670
  break;
91078
91671
  case "reasoning_delta":
91079
91672
  if (!thinkT0.current) thinkT0.current = Date.now();
@@ -91093,7 +91686,9 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91093
91686
  flushDraft();
91094
91687
  toolsRef.current[ev.id] = ev;
91095
91688
  const label = ev.name === "write_file" && ev.lines != null ? `${ev.desc || ev.name} (${ev.lines} lines)` : ev.desc || ev.name;
91096
- append({ kind: "tool", text: label, name: ev.name, args: ev.args });
91689
+ const row = { kind: "tool", text: label, name: ev.name, args: ev.args };
91690
+ if (ev.diff) append(row);
91691
+ else holdCall(ev, row);
91097
91692
  if (ev.diff) {
91098
91693
  const ls = ev.diff.split("\n");
91099
91694
  append({ kind: "diff", lines: ls.slice(0, DIFF_TAIL_LINES), more: Math.max(0, ls.length - DIFF_TAIL_LINES) });
@@ -91101,17 +91696,16 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91101
91696
  break;
91102
91697
  }
91103
91698
  case "tool_result": {
91104
- lastOutRef.current = { name: ev.name, content: ev.content || "" };
91105
91699
  if (ev.ok && (ev.name === "write_file" || ev.name === "edit_file")) wroteRef.current = true;
91106
- const more = (ev.lines || 0) > 1 ? ` (+${ev.lines - 1} lines \xB7 ctrl+o expands)` : "";
91107
- append({ kind: "tool_result", text: `${ev.summary || "(no output)"}${more}`, isError: !ev.ok });
91700
+ const more = (n) => (ev.lines || 0) > 1 ? ` (+${ev.lines - 1} lines \xB7 ctrl+o expands \xB7 #${n})` : "";
91701
+ if (landResult(ev, (n) => ({ kind: "tool_result", text: `${ev.summary || "(no output)"}${more(n)}`, isError: !ev.ok }))) break;
91108
91702
  if (!ev.ok && ev.diagnostics && ev.diagnostics.length) {
91109
- append({ kind: "errtail", lines: ev.diagnostics.map(diagLine) });
91703
+ push({ kind: "errtail", lines: ev.diagnostics.map(diagLine) });
91110
91704
  } else if (!ev.ok && ev.content) {
91111
91705
  const t = ev.content.split("\n").filter((l) => l.trim()).slice(-ERR_TAIL_LINES);
91112
- if (t.length > 1) append({ kind: "errtail", lines: t });
91706
+ if (t.length > 1) push({ kind: "errtail", lines: t });
91113
91707
  }
91114
- if (ev.spool) append({ kind: "spool", text: `${ev.spool}/` });
91708
+ if (ev.spool) push({ kind: "spool", text: `${ev.spool}/` });
91115
91709
  break;
91116
91710
  }
91117
91711
  case "plan": {
@@ -91256,17 +91850,18 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91256
91850
  case "turn_end": {
91257
91851
  foldThinking();
91258
91852
  flushDraft();
91259
- if (ev.tally && Object.keys(ev.tally).length) append({ kind: "tally", text: tallyLine(ev.tally) });
91260
91853
  setMeter((m) => ({ ...m, tokens: ev.context_tokens ?? m.tokens, input: ev.input_tokens || 0, output: ev.output_tokens || 0 }));
91261
91854
  setSpend(ev.cost_usd);
91262
91855
  lastEnd.current = ev;
91263
91856
  const dur = turnT0.current ? fmtDur((Date.now() - turnT0.current) / 1e3) : fmtDur(ev.elapsed_s);
91264
91857
  turnT0.current = null;
91265
- append({ kind: "turn", text: `${dur} \xB7 ${plural(ev.turns, "step")} \xB7 ${fmtCost2(ev.cost_usd)} session${firstResp(ev)}` + (ev.stop_reason !== "done" && !String(ev.stop_reason).startsWith("paused") ? ` \xB7 stopped: ${ev.stop_reason}` : "") });
91858
+ append({ kind: "turn", text: `${dur} \xB7 ${plural(ev.turns, "step")} \xB7 ${fmtCost2(ev.cost_usd)} session` + (ev.stop_reason !== "done" && !String(ev.stop_reason).startsWith("paused") ? ` \xB7 stopped: ${ev.stop_reason}` : "") });
91266
91859
  if (wroteRef.current) setOffer(true);
91267
91860
  wroteRef.current = false;
91268
91861
  setPhaseBoth("idle");
91269
91862
  setStatus("");
91863
+ hereNow();
91864
+ if (!asksRef.current.length && !String(ev.stop_reason).startsWith("paused")) idleRef.current = after2(IDLE_WAIT_MS, () => tty3(ring("hum finished")));
91270
91865
  break;
91271
91866
  }
91272
91867
  case "image": {
@@ -91298,7 +91893,14 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91298
91893
  setStatus("");
91299
91894
  break;
91300
91895
  case "bye":
91301
- if (ev.gone && phaseRef.current !== "dead") append({ kind: "error", text: "the session's process went away \xB7 `hum resume` brings it back" });
91896
+ regainRef.current = null;
91897
+ setRegaining(false);
91898
+ if (ev.gone && phaseRef.current !== "dead") {
91899
+ append({ kind: "error", text: "the session's process went away \xB7 `hum resume` brings it back" });
91900
+ setPhaseBoth("dead");
91901
+ setWentAway(true);
91902
+ break;
91903
+ }
91302
91904
  setPhaseBoth("dead");
91303
91905
  exit();
91304
91906
  break;
@@ -91306,18 +91908,28 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91306
91908
  break;
91307
91909
  }
91308
91910
  };
91309
- (0, import_react36.useEffect)(() => {
91911
+ (0, import_react38.useEffect)(() => {
91310
91912
  core2.on(handle);
91311
91913
  }, []);
91312
- (0, import_react36.useEffect)(() => {
91914
+ const waitingOn = question ? `ask ${question.id}` : proposal ? "proposal" : paused ? "pause" : trust ? "trust" : confirm ? "confirm" : "";
91915
+ const dir = hello && hello.cwd || process.cwd();
91916
+ (0, import_react38.useEffect)(() => {
91917
+ tty3(title(titleOf(dir, !!waitingOn)));
91918
+ }, [dir, !!waitingOn]);
91919
+ (0, import_react38.useEffect)(() => waitingOn ? after2(ASK_WAIT_MS, () => tty3(ring("hum needs you"))) : void 0, [waitingOn]);
91920
+ (0, import_react38.useEffect)(() => () => {
91921
+ hereNow();
91922
+ tty3(title(""));
91923
+ }, []);
91924
+ (0, import_react38.useEffect)(() => {
91313
91925
  const mine = hello && hello.run_id;
91314
91926
  const count = () => setNeedYou(needCount(liveRows(), mine));
91315
91927
  count();
91316
91928
  const t = setInterval(count, NEEDS_EVERY_MS);
91317
91929
  return () => clearInterval(t);
91318
91930
  }, [hello && hello.run_id]);
91319
- const noticedRef = (0, import_react36.useRef)("");
91320
- (0, import_react36.useEffect)(() => {
91931
+ const noticedRef = (0, import_react38.useRef)("");
91932
+ (0, import_react38.useEffect)(() => {
91321
91933
  if (!latest) return void 0;
91322
91934
  const mine = MINE2 || latest.version || "0.0.0";
91323
91935
  const want = latest.latest_version || "";
@@ -91349,6 +91961,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91349
91961
  }, 2500);
91350
91962
  };
91351
91963
  use_input_default((input, key) => {
91964
+ hereNow();
91352
91965
  if (key.ctrl && input === "c") {
91353
91966
  if (ctrlc > 0) {
91354
91967
  quit();
@@ -91364,10 +91977,8 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91364
91977
  return;
91365
91978
  }
91366
91979
  if (key.ctrl && input === "o") {
91367
- const last = lastOutRef.current;
91368
- if (last && last.content) {
91369
- append({ kind: "output", name: last.name, lines: last.content.split("\n") });
91370
- }
91980
+ const last = outsRef.current.at(-1);
91981
+ if (last && last.content) showOut(last);
91371
91982
  return;
91372
91983
  }
91373
91984
  if (looking) {
@@ -91505,7 +92116,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91505
92116
  if (key.escape || sendingAsk) return;
91506
92117
  if (!listAsk && question.kind !== "decision") {
91507
92118
  const n = stepLabels.length;
91508
- if (step.multi && n) {
92119
+ if (step.multi && n && !value.trim()) {
91509
92120
  if (key.upArrow) {
91510
92121
  setQCursor((c) => (c + n - 1) % n);
91511
92122
  return;
@@ -91525,7 +92136,21 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91525
92136
  togglePick(label);
91526
92137
  return;
91527
92138
  }
92139
+ if (!step.multi && n && !value.trim()) {
92140
+ if (key.upArrow) {
92141
+ setQChoice(choiceRow < 0 ? n - 1 : (choiceRow + n - 1) % n);
92142
+ return;
92143
+ }
92144
+ if (key.downArrow) {
92145
+ setQChoice((choiceRow + 1) % n);
92146
+ return;
92147
+ }
92148
+ }
91528
92149
  if (key.return && !key.meta && !key.shift && !value.trim()) {
92150
+ if (!step.multi && qChoice !== null) {
92151
+ answerStep(String(qChoice + 1));
92152
+ return;
92153
+ }
91529
92154
  if (step.multi && qPicks.length) {
91530
92155
  answerStep(qPicks.join(", "));
91531
92156
  return;
@@ -91591,13 +92216,35 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91591
92216
  else if (input.length === 1 && !key.ctrl && !key.meta && input >= " ") setPicker((p) => ({ ...p, query: p.query + input, index: 0, top: 0 }));
91592
92217
  return;
91593
92218
  }
91594
- if (menu.length > 0) {
92219
+ if (files.length > 0) {
92220
+ if (key.upArrow) setMenuIndex((i) => (Math.min(i, files.length - 1) + files.length - 1) % files.length);
92221
+ else if (key.downArrow) setMenuIndex((i) => (Math.min(i, files.length - 1) + 1) % files.length);
92222
+ else if (key.tab || key.return) acceptFile();
92223
+ else if (key.escape) setAtShut(atWord);
92224
+ return;
92225
+ }
92226
+ if (menu.length > 0 && !key.escape) {
91595
92227
  if (key.upArrow) setMenuIndex((i) => (i + menu.length - 1) % menu.length);
91596
92228
  else if (key.downArrow) setMenuIndex((i) => (i + 1) % menu.length);
91597
92229
  else if (key.tab) setValue(menu[Math.min(menuIndex, menu.length - 1)].name + " ");
91598
92230
  return;
91599
92231
  }
92232
+ const answering = !!(proposal || question || picker || confirm || trust || looking || reflection || search);
92233
+ if (key.tab && phaseRef.current === "busy" && !answering && value.trim() && !/^[/!]/.test(value.trim())) {
92234
+ const raw = value.trim();
92235
+ remember(raw);
92236
+ setQueued((q) => [...q, raw]);
92237
+ setValue("");
92238
+ return;
92239
+ }
92240
+ if (key.upArrow && !value && queued.length && !answering) {
92241
+ const last = queued[queued.length - 1];
92242
+ setQueued((q) => q.slice(0, -1));
92243
+ if (inputRef.current) inputRef.current.paste(last);
92244
+ return;
92245
+ }
91600
92246
  if (key.escape) {
92247
+ if (search) return;
91601
92248
  if (phaseRef.current === "busy") {
91602
92249
  core2.send({ cmd: "interrupt" });
91603
92250
  escRef.current = 0;
@@ -91606,13 +92253,20 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91606
92253
  const now = Date.now();
91607
92254
  if (now - escRef.current < ESC_ESC_MS) {
91608
92255
  escRef.current = 0;
91609
- core2.send({ cmd: "rewind_list" });
92256
+ const kept = value.trim();
92257
+ if (!kept) {
92258
+ core2.send({ cmd: "rewind_list" });
92259
+ return;
92260
+ }
92261
+ remember(kept);
92262
+ setValue("");
91610
92263
  return;
91611
92264
  }
91612
92265
  escRef.current = now;
91613
92266
  }
92267
+ if (input === "?" && !value.trim() && !question && !proposal && !reflection) append({ kind: "help" });
91614
92268
  });
91615
- (0, import_react36.useEffect)(() => {
92269
+ (0, import_react38.useEffect)(() => {
91616
92270
  setMenuIndex(0);
91617
92271
  }, [value]);
91618
92272
  const attachTo = (port2, runId) => {
@@ -91625,14 +92279,14 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91625
92279
  setPhaseBoth("idle");
91626
92280
  });
91627
92281
  };
91628
- const decide = (decision, note, remember) => {
92282
+ const decide = (decision, note, remember2) => {
91629
92283
  const p = proposal;
91630
92284
  setProposal(null);
91631
92285
  setValue("");
91632
92286
  const what = p && p.calls.length ? p.calls.map((c) => c.desc).join(" \xB7 ") : "the proposal";
91633
- const also = remember ? ` \xB7 ${p.remember_text || "that shape"} allowed for ${remember === "session" ? "this session" : "this project"}` : "";
92287
+ const also = remember2 ? ` \xB7 ${p.remember_text || "that shape"} allowed for ${remember2 === "session" ? "this session" : "this project"}` : "";
91634
92288
  append({ kind: "you", text: decision === "accept" ? `approved: ${what}${also}` : `rejected: ${what}${note ? ` \u2014 ${note}` : ""}` });
91635
- core2.send({ cmd: "decide", decision, note: note || "", ...remember ? { remember } : {} });
92289
+ core2.send({ cmd: "decide", decision, note: note || "", ...remember2 ? { remember: remember2 } : {} });
91636
92290
  };
91637
92291
  const togglePick = (label) => {
91638
92292
  setValue("");
@@ -91672,6 +92326,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91672
92326
  setConsultTop(0);
91673
92327
  setQPicks([]);
91674
92328
  setQCursor(0);
92329
+ setQChoice(null);
91675
92330
  return;
91676
92331
  }
91677
92332
  submitAsk({ answers }, display);
@@ -91696,7 +92351,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91696
92351
  stop();
91697
92352
  break;
91698
92353
  case "/help":
91699
- append({ kind: "info", text: HELP });
92354
+ append({ kind: "help" });
91700
92355
  break;
91701
92356
  case "/resume":
91702
92357
  core2.send({ cmd: "sessions" });
@@ -91720,6 +92375,24 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91720
92375
  case "/context":
91721
92376
  core2.send({ cmd: "context" });
91722
92377
  break;
92378
+ case "/expand": {
92379
+ const outs = outsRef.current;
92380
+ if (!outs.length) {
92381
+ append({ kind: "info", text: "no tool result to expand yet" });
92382
+ break;
92383
+ }
92384
+ const o = arg ? outs.find((x) => String(x.n) === arg) : outs.at(-1);
92385
+ if (!o) {
92386
+ append({ kind: "info", text: `no result #${arg} \xB7 the last ${OUTPUTS_KEPT} are kept: #${outs[0].n} to #${outs.at(-1).n}` });
92387
+ break;
92388
+ }
92389
+ if (!o.content) {
92390
+ append({ kind: "info", text: `#${o.n} had no output` });
92391
+ break;
92392
+ }
92393
+ showOut(o);
92394
+ break;
92395
+ }
91723
92396
  case "/rewind":
91724
92397
  wantRow.current = /^\d+$/.test(arg) ? Number(arg) : null;
91725
92398
  core2.send({ cmd: "rewind_list" });
@@ -91796,28 +92469,62 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91796
92469
  };
91797
92470
  const CHIP_CHARS = 800, CHIP_LINES = 3;
91798
92471
  const onPaste = (text) => {
92472
+ hereNow();
91799
92473
  if (!inputRef.current) return;
91800
92474
  const lines = text.split("\n").length;
91801
92475
  if (text.length <= CHIP_CHARS && lines <= CHIP_LINES) {
91802
92476
  inputRef.current.paste(text);
91803
92477
  return;
91804
92478
  }
91805
- const n = pasteRef.current.length + 1;
92479
+ const n = Math.max(0, ...pasteIds(), ...pasteRef.current.map((p) => p.n)) + 1;
91806
92480
  const chip = `[Pasted text #${n} +${lines} lines]`;
91807
92481
  pasteRef.current = [...pasteRef.current, { n, chip, text, lines }];
92482
+ savePaste(n, text);
91808
92483
  inputRef.current.paste(chip);
91809
92484
  };
91810
92485
  const expandPastes = (s) => s.replace(CHIP, (m, n) => {
91811
- const p = pasteRef.current[Number(n) - 1];
91812
- return p ? p.text : m;
92486
+ const p = pasteRef.current.find((x) => x.n === Number(n));
92487
+ return (p ? p.text : readPaste(Number(n))) ?? m;
91813
92488
  });
92489
+ const cwd2 = hello?.cwd || process.cwd();
92490
+ const remember = (text) => {
92491
+ const rows2 = historyRef.current;
92492
+ const last = rows2.findLast((r) => r.cwd === cwd2);
92493
+ if (last && last.text === text) return;
92494
+ rows2.push({ cwd: cwd2, text, at: Date.now() });
92495
+ saveHistory(rows2);
92496
+ };
92497
+ const partsOf = (raw) => {
92498
+ const text = expandPastes(raw);
92499
+ const waiting = attachRef.current;
92500
+ const attached = text ? waiting.filter((a) => text.includes(a.chip)) : waiting;
92501
+ return { text, attached, dropped: waiting.filter((a) => !attached.includes(a)) };
92502
+ };
92503
+ const sendMessage = (raw) => {
92504
+ const { text, attached, dropped } = partsOf(raw);
92505
+ if (paused) setPaused(false);
92506
+ if (dropped.length) append({ kind: "info", text: `not sent (chip removed): ${dropped.map((a) => a.label).join(", ")}` });
92507
+ append({ kind: "you", text: raw, images: attached.map((a) => `#${a.n} ${a.label}`), steering: phaseRef.current === "busy" });
92508
+ if (core2.send({ cmd: "message", text, images: attached.map((a) => a.ref) }) === false) {
92509
+ append({ kind: "warn", text: `not sent: ${raw}` });
92510
+ return;
92511
+ }
92512
+ attachRef.current = [];
92513
+ if (phaseRef.current === "idle") {
92514
+ turnT0.current = Date.now();
92515
+ setPhaseBoth("busy");
92516
+ }
92517
+ };
92518
+ (0, import_react38.useEffect)(() => {
92519
+ if (phase !== "idle" || !queued.length || question || proposal) return;
92520
+ const [raw, ...rest] = queued;
92521
+ setQueued(rest);
92522
+ sendMessage(raw);
92523
+ }, [phase, queued, question, proposal]);
91814
92524
  const onSubmit = (line) => {
91815
92525
  const raw = line.trim();
91816
- const text = expandPastes(raw);
92526
+ const { text, attached } = partsOf(raw);
91817
92527
  if (!question) setValue("");
91818
- const queued = attachRef.current;
91819
- const attached = text ? queued.filter((a) => text.includes(a.chip)) : queued;
91820
- const dropped = queued.filter((a) => !attached.includes(a));
91821
92528
  if (why && reflection && why === reflection.id) {
91822
92529
  if (raw) append({ kind: "you", text: raw });
91823
92530
  closeReflection(reflection.id, "down", text);
@@ -91834,11 +92541,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91834
92541
  }
91835
92542
  if (!text && attached.length === 0) return;
91836
92543
  if (!text && proposal) return;
91837
- const hist = historyRef.current;
91838
- if (raw && hist[hist.length - 1] !== raw) {
91839
- hist.push(raw);
91840
- saveHistory(hist);
91841
- }
92544
+ if (raw) remember(raw);
91842
92545
  if (proposal && !/^\/(approve|quit|exit|stop)\b/.test(raw)) {
91843
92546
  decide("reject", text);
91844
92547
  return;
@@ -91860,80 +92563,81 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91860
92563
  if (phaseRef.current === "idle") setPhaseBoth("busy");
91861
92564
  return;
91862
92565
  }
91863
- if (paused) setPaused(false);
91864
- if (dropped.length) append({ kind: "info", text: `not sent (chip removed): ${dropped.map((a) => a.label).join(", ")}` });
91865
- append({ kind: "you", text: raw, images: attached.map((a) => `#${a.n} ${a.label}`), steering: phaseRef.current === "busy" });
91866
- if (core2.send({ cmd: "message", text, images: attached.map((a) => a.ref) }) === false) {
91867
- append({ kind: "warn", text: `not sent: ${raw}` });
91868
- return;
91869
- }
91870
- attachRef.current = [];
91871
- if (phaseRef.current === "idle") {
91872
- turnT0.current = Date.now();
91873
- setPhaseBoth("busy");
91874
- }
92566
+ sendMessage(raw);
91875
92567
  };
91876
- const statusLine = phase === "connecting" ? "starting \u2026" : `${modelRef.current || ""} \xB7 ${fmtCost2(spend)}` + (ctxPct >= 10 ? ` \xB7 ctx ${ctxPct}%` : "") + (gate === "approve" ? " \xB7 approvals on" : "") + (hello && hello.mounting && hello.mounting.length ? ` \xB7 mounting ${hello.mounting.join(", ")}` : "") + (goal && goal.text ? ` \xB7 \u25CE goal ${goal.status || "active"}` : "") + (needYou ? ` \xB7 ${needYou} need you` : "") + (ready ? ` \xB7 restart for hum ${ready}` : "") + (offer ? " \xB7 /accept \xB7 /reject" : "") + (agents.length && panelIndex < 0 && !looking ? " \xB7 \u2193 agents" : "") + (ctrlc ? " \xB7 ctrl+c again to quit" : " \xB7 / for commands");
92568
+ const statusLine = search ? `reverse search: ${search.query}${search.hit ? "" : " \xB7 no match"} \xB7 ctrl+r older \xB7 enter keeps it \xB7 esc restores` : phase === "connecting" ? "starting \u2026" : regaining ? "reconnecting\u2026" : fitStatus([
92569
+ { text: `${modelRef.current || ""} \xB7 ${fmtCost2(spend)}` },
92570
+ { text: `ctx ${ctxPct}%`, drop: 5 },
92571
+ gate === "approve" && { text: "approvals on", drop: 6 },
92572
+ hello && hello.mounting && hello.mounting.length && { text: `mounting ${hello.mounting.join(", ")}`, drop: 4 },
92573
+ goal && goal.text && { text: `\u25CE goal ${goal.status || "active"}` },
92574
+ needYou && { text: `${needYou} need you` },
92575
+ ready && { text: `restart for hum ${ready}` },
92576
+ offer && { text: "/accept \xB7 /reject" },
92577
+ queued.length && { text: `${queued.length} queued` },
92578
+ phase === "busy" && value.trim() && !proposal && !question && { text: "tab sends later", drop: 2 },
92579
+ agents.length && panelIndex < 0 && !looking && { text: "\u2193 agents", drop: 3 },
92580
+ !ctrlc && question && step && !step.secret && { text: "ctrl+g editor", drop: 2 },
92581
+ ctrlc ? { text: "ctrl+c again to quit" } : { text: "/ for commands", drop: 1 }
92582
+ ], width);
91877
92583
  const spinnerLabel = phase === "connecting" ? " starting \u2026" : ` ${status || "working"}${elapsed >= 2 ? ` \xB7 ${fmtDur(elapsed)}` : ""}` + (thinkChars.current > 4e3 ? ` \xB7 ${(thinkChars.current / 1e3).toFixed(0)}k thinking` : "");
91878
92584
  const rows = stdout?.rows || DEFAULT_ROWS;
91879
- const chrome = 1 + 2 + 4 + (value.split("\n").length - 1) + 1 + (menu.length ? menu.length : 0) + (!menu.length && agents.length ? agents.length + 1 : 0) + (looking ? 4 + (looking.question ? (looking.question.options || []).length + 2 : Math.min(PEEK_LINES, looking.lines.length) + 1) : 0) + (question && step ? 9 + Math.min(consultHeight, consultLines.length) : 0) + (proposal ? 4 + proposal.calls.length * (1 + Math.min(DIFF_TAIL_LINES, 8)) : 0) + (reflection ? 8 + reflection.details.split("\n").length : 0) + (confirm ? 4 + Math.min(8, String(confirm.stat || "").split("\n").length) : 0) + (trust ? 4 + trust.starts.length : 0) + (picker ? 14 : 0);
92585
+ const heldRows = [...foldRows(held.reads), ...held.calls.map((c) => c.item)];
92586
+ const chrome = 1 + 2 + heldRows.length + 4 + (value.split("\n").length - 1) + 1 + (menu.length ? menu.length : 0) + files.length + (!menu.length && !files.length && agents.length ? agents.length + 1 : 0) + (looking ? 4 + (looking.question ? (looking.question.options || []).length + 2 : Math.min(PEEK_LINES, looking.lines.length) + 1) : 0) + (question && step ? 9 + Math.min(consultHeight, consultLines.length) : 0) + (proposal ? 4 + proposal.calls.length * (1 + Math.min(DIFF_TAIL_LINES, 8)) : 0) + (reflection ? 8 + reflection.details.split("\n").length : 0) + (confirm ? 4 + Math.min(8, String(confirm.stat || "").split("\n").length) : 0) + (trust ? 4 + trust.starts.length : 0) + (picker ? 14 : 0);
91880
92587
  const liveBudget = Math.max(LIVE_MIN_ROWS, Math.min(DRAFT_TAIL_LINES, rows - 1 - chrome));
91881
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
91882
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Static, { items, children: (item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", marginBottom: ["hum", "you", "banner", "turn"].includes(item.kind) ? 1 : 0, children: [
91883
- item.kind === "wordmark" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", paddingLeft: 1, children: WORDMARK.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: row }, i)) }),
91884
- item.kind === "banner" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, children: [
91885
- MASCOT.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
91886
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { width: MASCOT_WIDTH + 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: row }) }),
91887
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: i === 0, dimColor: i !== 0, children: item.lines[i] || "" })
92588
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92589
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Static, { items, children: (item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", marginBottom: ["hum", "you", "banner", "turn"].includes(item.kind) ? 1 : 0, children: [
92590
+ item.kind === "wordmark" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { flexDirection: "column", paddingLeft: 1, children: WORDMARK.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: row }, i)) }),
92591
+ item.kind === "banner" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 1, children: [
92592
+ MASCOT.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92593
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: MASCOT_WIDTH + 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: row }) }),
92594
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: i === 0, dimColor: i !== 0, children: item.lines[i] || "" })
91888
92595
  ] }, i)),
91889
- item.instruction ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
91890
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { width: MASCOT_WIDTH + 2, flexShrink: 0 }),
91891
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92596
+ item.instruction ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92597
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: MASCOT_WIDTH + 2, flexShrink: 0 }),
92598
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91892
92599
  "\u276F ",
91893
92600
  item.instruction.split("\n")[0].slice(0, width - MASCOT_WIDTH - 6)
91894
92601
  ] })
91895
92602
  ] }) : null
91896
92603
  ] }),
91897
- item.kind === "hum" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
91898
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: "\u25CF" }) }),
91899
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: renderMarkdown(item.text, width - 2) })
92604
+ item.kind === "hum" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92605
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: "\u25CF" }) }),
92606
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: renderMarkdown(item.text, width - 2) })
91900
92607
  ] }),
91901
- item.kind === "thought" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92608
+ item.kind === "thought" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91902
92609
  " \xB7 ",
91903
92610
  item.text
91904
92611
  ] }),
91905
- item.kind === "you" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
91906
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "cyan", bold: true, children: "\u276F" }) }),
91907
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
91908
- item.text ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "white", children: [
92612
+ item.kind === "you" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92613
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "cyan", bold: true, children: "\u276F" }) }),
92614
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92615
+ item.text ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "white", children: [
91909
92616
  item.text,
91910
- item.steering ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: " (steering)" }) : null
92617
+ item.steering ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: " (steering)" }) : null
91911
92618
  ] }) : null,
91912
- (item.images || []).map((im, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
91913
- "\u{1F4CE} ",
92619
+ (item.images || []).map((im, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92620
+ "\u25A3 ",
91914
92621
  im
91915
92622
  ] }, i))
91916
92623
  ] })
91917
92624
  ] }),
91918
- item.kind === "agent" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "magenta", children: [
92625
+ item.kind === "agent" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "magenta", children: [
91919
92626
  " \u25B8 ",
91920
92627
  item.text
91921
92628
  ] }),
91922
- item.kind === "agent_end" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "magenta", dimColor: true, children: [
92629
+ item.kind === "agent_end" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "magenta", dimColor: true, children: [
91923
92630
  " \u23BF ",
91924
92631
  item.text
91925
92632
  ] }),
91926
- item.kind === "tool" && (item.agent ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92633
+ item.kind === "tool" && (item.agent ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91927
92634
  " \xB7 ",
91928
92635
  item.text
91929
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
91930
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: "\u25CB" }) }),
91931
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: toolLine(item.text) })
91932
- ] })),
91933
- item.kind === "plan" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
91934
- item.explanation ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: item.explanation }) : null,
91935
- item.steps.map((st, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
91936
- Text,
92636
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ToolRow, { text: item.text })),
92637
+ item.kind === "plan" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 2, children: [
92638
+ item.explanation ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: item.explanation }) : null,
92639
+ item.steps.map((st, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
92640
+ Text2,
91937
92641
  {
91938
92642
  dimColor: st.status === "completed",
91939
92643
  bold: st.status === "in_progress",
@@ -91947,11 +92651,11 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91947
92651
  i
91948
92652
  ))
91949
92653
  ] }),
91950
- item.kind === "hypotheses" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
91951
- item.explanation ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: item.explanation }) : null,
91952
- item.hypotheses.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
91953
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
91954
- Text,
92654
+ item.kind === "hypotheses" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 2, children: [
92655
+ item.explanation ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: item.explanation }) : null,
92656
+ item.hypotheses.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92657
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
92658
+ Text2,
91955
92659
  {
91956
92660
  dimColor: ["refuted", "superseded", "blocked"].includes(h.status),
91957
92661
  bold: h.status === "testing",
@@ -91965,171 +92669,159 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91965
92669
  ]
91966
92670
  }
91967
92671
  ),
91968
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92672
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91969
92673
  " check: ",
91970
92674
  h.check
91971
92675
  ] }),
91972
- h.evidence ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92676
+ h.evidence ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91973
92677
  " evidence: ",
91974
92678
  h.evidence
91975
92679
  ] }) : null
91976
92680
  ] }, i))
91977
92681
  ] }),
91978
- item.kind === "tool_result" && (item.isError ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "red", dimColor: true, children: [
92682
+ item.kind === "tool_result" && (item.isError ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "red", dimColor: true, children: [
91979
92683
  item.agent ? " \u23BF " : " \u23BF ",
91980
92684
  item.text
91981
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92685
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91982
92686
  item.agent ? " \u23BF " : " \u23BF ",
91983
92687
  item.text
91984
92688
  ] })),
91985
- item.kind === "diff" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 4, children: [
91986
- item.lines.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
91987
- Text,
91988
- {
91989
- color: l.startsWith("+") ? "green" : l.startsWith("-") ? "red" : void 0,
91990
- dimColor: !l.startsWith("+") && !l.startsWith("-"),
91991
- children: l || " "
91992
- },
91993
- i
91994
- )),
91995
- item.more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `\u2026 +${item.more} more diff lines` }) : null
92689
+ item.kind === "diff" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 4, children: [
92690
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DiffLines, { lines: item.lines }),
92691
+ item.more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `\u2026 +${item.more} more diff lines` }) : null
91996
92692
  ] }),
91997
- item.kind === "patch" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
91998
- item.lines.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
91999
- Text,
92000
- {
92001
- color: l.startsWith("+") ? "green" : l.startsWith("-") ? "red" : l.startsWith("@@") ? "cyan" : void 0,
92002
- dimColor: !l.startsWith("+") && !l.startsWith("-"),
92003
- children: l || " "
92004
- },
92005
- i
92006
- )),
92007
- item.more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `\u2026 +${item.more} more lines \xB7 /diff <path> narrows it` }) : null,
92008
- item.stat ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: item.stat.trim() }) : null
92693
+ item.kind === "patch" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 2, children: [
92694
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DiffLines, { lines: item.lines, headColor: "cyan" }),
92695
+ item.more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `\u2026 +${item.more} more lines \xB7 /diff <path> narrows it` }) : null,
92696
+ item.stat ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DiffStat, { stat: item.stat, lines: item.lines }) : null
92009
92697
  ] }),
92010
- item.kind === "spool" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92698
+ item.kind === "spool" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92011
92699
  " \u21B3 ",
92012
92700
  item.text
92013
92701
  ] }),
92014
- item.kind === "tally" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92015
- " ",
92016
- item.text
92017
- ] }),
92018
- item.kind === "errtail" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", paddingLeft: 6, children: item.lines.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "red", dimColor: true, children: l }, i)) }),
92019
- item.kind === "output" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 4, children: [
92020
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `full output \xB7 ${item.name}` }),
92021
- item.lines.map((l, i) => item.diff ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: l.startsWith("+") ? "green" : l.startsWith("-") ? "red" : void 0, dimColor: !l.startsWith("+") && !l.startsWith("-"), children: l || " " }, i) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: l || " " }, i))
92702
+ item.kind === "errtail" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { flexDirection: "column", paddingLeft: 6, children: item.lines.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "red", dimColor: true, children: l }, i)) }),
92703
+ item.kind === "output" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 4, children: [
92704
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `full output \xB7 ${item.name}` }),
92705
+ item.lines.map((l, i) => item.diff ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: l.startsWith("+") ? "green" : l.startsWith("-") ? "red" : void 0, dimColor: !l.startsWith("+") && !l.startsWith("-"), children: l || " " }, i) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: l || " " }, i))
92022
92706
  ] }),
92023
- item.kind === "turn" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92024
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: "\u273B " }),
92025
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: item.text })
92707
+ item.kind === "turn" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92708
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: "\u273B " }),
92709
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: item.text })
92026
92710
  ] }),
92027
- item.kind === "paused" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { borderStyle: "round", borderColor: "yellow", paddingX: 1, flexDirection: "column", children: [
92028
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "yellow", bold: true, children: [
92029
- "\u23F8 paused \u2014 ",
92711
+ item.kind === "paused" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { borderStyle: "round", borderColor: "yellow", paddingX: 1, flexDirection: "column", children: [
92712
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "yellow", bold: true, children: [
92713
+ "\u2016 paused \u2014 ",
92030
92714
  item.trip === "spend" ? "spend cap" : item.trip === "repeat" ? "repeating itself" : "no progress"
92031
92715
  ] }),
92032
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: item.text }),
92033
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "say what to do next \xB7 /continue lets it carry on" })
92716
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: item.text }),
92717
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "say what to do next \xB7 /continue lets it carry on" })
92034
92718
  ] }),
92035
- item.kind === "mcp" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
92036
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92037
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, color: ACCENT, children: "MCP servers" }),
92038
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` \xB7 ${item.servers.length} in this session` })
92719
+ item.kind === "mcp" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92720
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92721
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, color: ACCENT, children: "MCP servers" }),
92722
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` \xB7 ${item.servers.length} in this session` })
92039
92723
  ] }),
92040
- item.servers.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: " none \xB7 add [[mcp]] with a name and a url or a command to ~/.hum/config.toml; the ones your deployment provides arrive when you sign in" }) : null,
92724
+ item.servers.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: " none \xB7 add [[mcp]] with a name and a url or a command to ~/.hum/config.toml; the ones your deployment provides arrive when you sign in" }) : null,
92041
92725
  [["deployment", "from your deployment"], ["config", "from your config (~/.hum/config.toml or the project's .hum/config.toml)"], ["plugin", "from a plugin"], ["agent", "from the agent file this session runs as"], ["program", "from the program that started this session"]].map(([src, label]) => {
92042
92726
  const rows2 = item.servers.filter((s) => (s.source || "config").split(":")[0] === src);
92043
92727
  if (!rows2.length) return null;
92044
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
92045
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` ${label}` }),
92046
- rows2.map((s) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, children: [
92047
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92048
- s.error ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "red", children: "\u2717 " }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "green", children: "\u2714 " }),
92049
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: s.name }),
92050
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: s.error ? ` \xB7 not mounted \xB7 ${s.error}` : ` \xB7 connected \xB7 ${s.tools.length} tool${s.tools.length === 1 ? "" : "s"}${s.instructions ? " \xB7 with instructions" : ""} \xB7 ${s.at}` })
92728
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", marginTop: 1, children: [
92729
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` ${label}` }),
92730
+ rows2.map((s) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 2, children: [
92731
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92732
+ s.error ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "red", children: "\u2717 " }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "green", children: "\u2714 " }),
92733
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: s.name }),
92734
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: s.error ? ` \xB7 not mounted \xB7 ${s.error}` : ` \xB7 connected \xB7 ${s.tools.length} tool${s.tools.length === 1 ? "" : "s"}${s.instructions ? " \xB7 with instructions" : ""} \xB7 ${s.at}` })
92051
92735
  ] }),
92052
- s.tools.length ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` ${s.tools.join(" \xB7 ")}` }) : null
92736
+ s.tools.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` ${s.tools.join(" \xB7 ")}` }) : null
92053
92737
  ] }, s.name))
92054
92738
  ] }, src);
92055
92739
  })
92056
92740
  ] }),
92057
- item.kind === "info" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: item.text }),
92058
- item.kind === "warn" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "yellow", children: item.text }),
92059
- item.kind === "error" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "red", children: item.text })
92741
+ item.kind === "info" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: item.text }),
92742
+ item.kind === "help" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 1, children: [
92743
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: "commands" }),
92744
+ commandRows(COMMANDS, -1, HELP_PAD),
92745
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: "keys" }),
92746
+ commandRows(KEYS, -1, HELP_PAD)
92747
+ ] }),
92748
+ item.kind === "warn" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92749
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "yellow", children: "\u26A0" }) }),
92750
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "yellow", children: item.text })
92751
+ ] }),
92752
+ item.kind === "error" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92753
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "red", bold: true, children: "\u26A0" }) }),
92754
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "red", children: item.text })
92755
+ ] })
92060
92756
  ] }, item.id) }, transcriptEpoch),
92061
- draft.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { marginTop: 1, children: [
92062
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, dimColor: true, children: "\u25CF" }) }),
92063
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: liveTail(renderMarkdown(draft, width - 2), width - 2, liveBudget) })
92757
+ heldRows.map((item, i) => item.kind === "tool" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ToolRow, { text: item.text, tail: i === heldRows.length - 1 && held.calls.length && phase === "busy" ? tickTail(held.calls[held.calls.length - 1].t0) : "" }, i) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92758
+ " \u23BF ",
92759
+ item.text
92760
+ ] }, i)),
92761
+ draft.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { marginTop: 1, children: [
92762
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, dimColor: true, children: "\u25CF" }) }),
92763
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: liveTail(renderMarkdown(draft, width - 2), width - 2, liveBudget) })
92064
92764
  ] }),
92065
92765
  thinking.length > 0 && // the thought as it streams: its newest lines, dim, so a long think is never a blank screen.
92066
92766
  // It folds into one line under the reply the moment the reply starts
92067
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", marginTop: 1, paddingLeft: 2, width, children: thinking.slice(-600).split("\n").filter((l) => l.trim()).slice(-Math.min(THOUGHT_TAIL_LINES, liveBudget)).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, italic: true, wrap: "truncate-start", children: l }, i)) }),
92068
- (phase === "busy" || phase === "connecting") && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { marginTop: 1, children: [
92069
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(build_default, { type: "dots" }) }),
92070
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: spinnerLabel })
92767
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { flexDirection: "column", marginTop: 1, paddingLeft: 2, width, children: thinking.slice(-600).split("\n").filter((l) => l.trim()).slice(-Math.min(THOUGHT_TAIL_LINES, liveBudget)).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, italic: true, wrap: "truncate-start", children: l }, i)) }),
92768
+ (phase === "busy" || phase === "connecting") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { marginTop: 1, children: [
92769
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(build_default, { type: "dots" }) }),
92770
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: spinnerLabel })
92071
92771
  ] }),
92072
- question && step && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
92073
- questions.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` 1 of ${questions.length} open asks \xB7 the oldest first` }) : null,
92074
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: ACCENT, bold: true, children: [
92772
+ question && step && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
92773
+ questions.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` 1 of ${questions.length} open asks \xB7 the oldest first` }) : null,
92774
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: ACCENT, bold: true, children: [
92075
92775
  listAsk ? `\u2726 Constraints Hum discovered ${listRows.length} \xB7 say what you know about each` : question.kind === "decision" ? "\u2726 Review a decision" : question.kind === "review" ? "\u2726 Hum asks for your review" : "\u2726 Clarification",
92076
92776
  !listAsk && steps.length > 1 ? ` (${qStep + 1} of ${steps.length})` : ""
92077
92777
  ] }),
92078
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: consultLines.slice(consultStart, consultStart + consultHeight).join("\n") }),
92079
- consultLines.length > consultHeight ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `lines ${consultStart + 1}\u2013${Math.min(consultLines.length, consultStart + consultHeight)} of ${consultLines.length} \xB7 PgUp/PgDn to read` }) : null,
92080
- listAsk ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "your words are the answer \xB7 add what was missed \xB7 /hold confirms all \xB7 Alt+Enter adds a line \xB7 Esc leaves unanswered" }) : null,
92081
- question.kind === "review" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Share solution insights, test inputs and expected results, constraints, or a hypothesis and how to test it." }) : null,
92082
- question.kind === "decision" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Type a choice and your reasoning, or another approach \xB7 Alt+Enter adds a line \xB7 Enter sends" }) : null,
92083
- sendingAsk === question.id ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: "Sending answer\u2026" }) : null,
92084
- !listAsk ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92085
- " ",
92086
- stepLabels.length && question.kind !== "decision" ? step.multi ? "a number ticks \xB7 space ticks the one marked \xB7 " : step.graded ? "a number marks \xB7 words after it if you like \xB7 " : "a number chooses on Enter \xB7 " : "",
92087
- step.graded ? "" : "type or paste your answer \xB7 Alt+Enter adds a line",
92088
- step.default ? " \xB7 enter takes the default" : "",
92089
- !step.default && step.optional ? " \xB7 enter says nothing" : "",
92090
- step.multi && stepLabels.length ? " \xB7 enter takes what is ticked" : "",
92091
- step.secret ? " \xB7 it is not shown and not recorded" : ""
92092
- ] }) : null
92778
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: consultLines.slice(consultStart, consultStart + consultHeight).join("\n") }),
92779
+ consultLines.length > consultHeight ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `lines ${consultStart + 1}\u2013${Math.min(consultLines.length, consultStart + consultHeight)} of ${consultLines.length} \xB7 PgUp/PgDn to read` }) : null,
92780
+ listAsk ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "your words are the answer \xB7 add what was missed \xB7 /hold confirms all \xB7 Alt+Enter adds a line \xB7 Esc leaves unanswered" }) : null,
92781
+ question.kind === "review" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Share solution insights, test inputs and expected results, constraints, or a hypothesis and how to test it." }) : null,
92782
+ question.kind === "decision" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Type a choice and your reasoning, or another approach \xB7 Alt+Enter adds a line \xB7 Enter sends" }) : null,
92783
+ sendingAsk === question.id ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: "Sending answer\u2026" }) : null,
92784
+ !listAsk ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, wrap: "truncate-end", children: " " + askHint }) : null
92093
92785
  ] }),
92094
- reflection && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
92095
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { flexDirection: "column", width: MASCOT_WIDTH + 1, flexShrink: 0, marginRight: 1, children: MASCOT.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: row }, i)) }),
92096
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", flexGrow: 1, children: [
92097
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92098
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: "\u2726 Self Reflect" }),
92099
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` \xB7 ${reflection.category.replace(/_/g, " ")}${reflection.area ? ` \xB7 ${reflection.area}` : ""}` })
92786
+ reflection && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
92787
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { flexDirection: "column", width: MASCOT_WIDTH + 1, flexShrink: 0, marginRight: 1, children: MASCOT.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: row }, i)) }),
92788
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", flexGrow: 1, children: [
92789
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92790
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: "\u2726 Self Reflect" }),
92791
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` \xB7 ${reflection.category.replace(/_/g, " ")}${reflection.area ? ` \xB7 ${reflection.area}` : ""}` })
92100
92792
  ] }),
92101
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: reflection.title }),
92102
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
92793
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: reflection.title }),
92794
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92103
92795
  reflection.details.split("\n").map((l, i) => {
92104
92796
  const m = l.match(/^\s*(What happened|What the person said|Evidence|Cause|Repro)\s*:\s*(.*)$/i);
92105
92797
  if (m) {
92106
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", marginTop: i === 0 ? 0 : 1, children: [
92107
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` ${m[1]}` }),
92108
- m[2] ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: ` ${m[2]}` }) : null
92798
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", marginTop: i === 0 ? 0 : 1, children: [
92799
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` ${m[1]}` }),
92800
+ m[2] ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: ` ${m[2]}` }) : null
92109
92801
  ] }, `d${i}`);
92110
92802
  }
92111
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: ` ${l}` }, `d${i}`);
92803
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: ` ${l}` }, `d${i}`);
92112
92804
  }),
92113
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
92114
- why === reflection.id ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92115
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: "What did it get wrong? " }),
92116
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "type a line and press enter \xB7 enter alone records the no without a reason" })
92117
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92118
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: "Is this true? " }),
92119
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `1 yes \xB7 2 no \xB7 enter skips \xB7 or just keep typing${reflections.length > 1 ? ` \xB7 ${reflections.length - 1} more` : ""}` })
92805
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92806
+ why === reflection.id ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92807
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: "What did it get wrong? " }),
92808
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "type a line and press enter \xB7 enter alone records the no without a reason" })
92809
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92810
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: "Is this true? " }),
92811
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `1 yes \xB7 2 no \xB7 enter skips \xB7 or just keep typing${reflections.length > 1 ? ` \xB7 ${reflections.length - 1} more` : ""}` })
92120
92812
  ] })
92121
92813
  ] })
92122
92814
  ] }),
92123
- proposal && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
92124
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92125
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: "? " }),
92815
+ proposal && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
92816
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92817
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: "? " }),
92126
92818
  proposal.agent ? `hum's sub-agent ${proposal.agent.agent} (${proposal.agent.description || proposal.agent.kind})` : "hum",
92127
92819
  " wants to",
92128
- proposal.calls.some((c) => c.escape) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "yellow", children: " leave the sandbox" }) : null,
92820
+ proposal.calls.some((c) => c.escape) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "yellow", children: " leave the sandbox" }) : null,
92129
92821
  " ",
92130
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "\xB7 enter approves \xB7 type a reason to reject \xB7 esc stops" })
92822
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "\xB7 enter approves \xB7 type a reason to reject \xB7 esc stops" })
92131
92823
  ] }),
92132
- (proposal.remember || []).length ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92824
+ (proposal.remember || []).length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92133
92825
  " a ",
92134
92826
  "allows ",
92135
92827
  proposal.remember_text,
@@ -92137,26 +92829,26 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92137
92829
  " \xB7 p ",
92138
92830
  "for this project"
92139
92831
  ] }) : null,
92140
- proposal.content ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92832
+ proposal.content ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92141
92833
  " ",
92142
92834
  proposal.content.split("\n")[0].slice(0, width - 4)
92143
92835
  ] }) : null,
92144
- proposal.calls.map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
92145
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92836
+ proposal.calls.map((c) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92837
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92146
92838
  " \xB7 ",
92147
92839
  c.desc,
92148
- c.lines != null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` (${c.lines} lines)` }) : null
92840
+ c.lines != null ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` (${c.lines} lines)` }) : null
92149
92841
  ] }),
92150
- (c.name === "bash" || c.name === "powershell") && c.desc !== `$ ${String(c.args?.command || "")}` ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "cyan", children: [
92842
+ (c.name === "bash" || c.name === "powershell") && c.desc !== `$ ${String(c.args?.command || "")}` ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "cyan", children: [
92151
92843
  " $ ",
92152
92844
  String(c.args?.command || "").split("\n").join(" \u23CE ")
92153
92845
  ] }) : null,
92154
- c.escape ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "yellow", children: [
92846
+ c.escape ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "yellow", children: [
92155
92847
  " outside the sandbox \u2014 ",
92156
92848
  String(c.reason || "").slice(0, Math.max(20, width - 32))
92157
92849
  ] }) : null,
92158
- c.diff ? c.diff.split("\n").slice(0, DIFF_TAIL_LINES).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
92159
- Text,
92850
+ c.diff ? c.diff.split("\n").slice(0, DIFF_TAIL_LINES).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
92851
+ Text2,
92160
92852
  {
92161
92853
  color: l.startsWith("+") ? "green" : l.startsWith("-") ? "red" : void 0,
92162
92854
  dimColor: !l.startsWith("+") && !l.startsWith("-"),
@@ -92167,159 +92859,159 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92167
92859
  },
92168
92860
  i
92169
92861
  )) : null,
92170
- c.diff && c.diff.split("\n").length > DIFF_TAIL_LINES ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` the whole change (${c.diff.split("\n").length} lines) is above` }) : null
92862
+ c.diff && c.diff.split("\n").length > DIFF_TAIL_LINES ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` the whole change (${c.diff.split("\n").length} lines) is above` }) : null
92171
92863
  ] }, c.id))
92172
92864
  ] }),
92173
- looking && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 1, marginTop: 1, children: [
92174
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92175
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "magenta", bold: true, children: looking.row.name }),
92176
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92865
+ looking && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 1, marginTop: 1, children: [
92866
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92867
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "magenta", bold: true, children: looking.row.name }),
92868
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92177
92869
  " ",
92178
92870
  looking.row.task.slice(0, width - 20)
92179
92871
  ] })
92180
92872
  ] }),
92181
- looking.waiting ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "looking \u2026" }) : null,
92182
- looking.question ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
92183
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92184
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: "? " }),
92873
+ looking.waiting ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "looking \u2026" }) : null,
92874
+ looking.question ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92875
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92876
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: "? " }),
92185
92877
  looking.question.question
92186
92878
  ] }),
92187
- (looking.question.options || []).map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92879
+ (looking.question.options || []).map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92188
92880
  " ",
92189
92881
  i + 1,
92190
92882
  ". ",
92191
92883
  typeof o === "string" ? o : o.label,
92192
92884
  o && o.description ? ` \xB7 ${o.description}` : ""
92193
92885
  ] }, i)),
92194
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92886
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92195
92887
  " ",
92196
92888
  "type the answer \xB7 enter answers and leaves",
92197
92889
  looking.question.default ? ` (empty takes the default: ${looking.question.default})` : "",
92198
92890
  " \xB7 esc leaves it open"
92199
92891
  ] })
92200
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
92201
- looking.lines.length ? looking.lines.slice(-PEEK_LINES).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: l.slice(0, width - 4) }, i)) : looking.waiting ? null : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "nothing on its transcript yet" }),
92202
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "esc goes back" })
92892
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92893
+ looking.lines.length ? looking.lines.slice(-PEEK_LINES).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: l.slice(0, width - 4) }, i)) : looking.waiting ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "nothing on its transcript yet" }),
92894
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "esc goes back" })
92203
92895
  ] })
92204
92896
  ] }),
92205
- picker && picker.kind === "model" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
92206
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: "Select model" }),
92207
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Switch models. Served via Metaphi AI." }),
92208
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
92897
+ picker && picker.kind === "model" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
92898
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: "Select model" }),
92899
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Switch models. Served via Metaphi AI." }),
92900
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92209
92901
  (() => {
92210
92902
  const nameW = Math.max(...picker.items.map((m) => m.name.length + (m.current ? 2 : 0)));
92211
92903
  return picker.items.map((m, i) => {
92212
92904
  const price = m.price_per_m && m.price_per_m.length === 2 && (m.price_per_m[0] || m.price_per_m[1]) ? `$${m.price_per_m[0]}/$${m.price_per_m[1]} per M` : "";
92213
92905
  const about = [m.note, price].filter(Boolean).join(" \xB7 ");
92214
92906
  const label = `${i + 1}. ${m.name}${m.current ? " \u2713" : ""}`.padEnd(nameW + 4);
92215
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
92216
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: i === picker.index ? "\u276F " : " " }),
92217
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: m.current ? "green" : void 0, bold: i === picker.index, children: label }),
92218
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: i !== picker.index, children: [
92907
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92908
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: i === picker.index ? "\u276F " : " " }),
92909
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: m.current ? "green" : void 0, bold: i === picker.index, children: label }),
92910
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: i !== picker.index, children: [
92219
92911
  " ",
92220
92912
  about
92221
92913
  ] })
92222
92914
  ] }, m.name);
92223
92915
  });
92224
92916
  })(),
92225
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
92226
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Enter to switch \xB7 Esc to cancel" })
92917
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92918
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Enter to switch \xB7 Esc to cancel" })
92227
92919
  ] }),
92228
- picker && picker.kind === "reasoning" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
92229
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: "Reasoning" }),
92230
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
92231
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
92232
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: " Faster" }),
92233
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " ".repeat(Math.max(1, picker.items.length * 10 - 14)) }),
92234
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Smarter" })
92920
+ picker && picker.kind === "reasoning" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
92921
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: "Reasoning" }),
92922
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92923
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92924
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: " Faster" }),
92925
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " ".repeat(Math.max(1, picker.items.length * 10 - 14)) }),
92926
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Smarter" })
92235
92927
  ] }),
92236
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
92237
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
92238
- picker.items.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: i === picker.index ? ACCENT : void 0, bold: i === picker.index, dimColor: i !== picker.index, children: `${i === picker.index ? "\u25B2 " : " "}${e.level}${e.current ? " \u2713" : ""}`.padEnd(10) }, e.level))
92928
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92929
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92930
+ picker.items.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: i === picker.index ? ACCENT : void 0, bold: i === picker.index, dimColor: i !== picker.index, children: `${i === picker.index ? "\u25B2 " : " "}${e.level}${e.current ? " \u2713" : ""}`.padEnd(10) }, e.level))
92239
92931
  ] }),
92240
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
92241
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "\u2190/\u2192 to adjust \xB7 Enter to confirm \xB7 s for this session only \xB7 Esc to cancel" })
92932
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92933
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "\u2190/\u2192 to adjust \xB7 Enter to confirm \xB7 s for this session only \xB7 Esc to cancel" })
92242
92934
  ] }),
92243
- trust && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", paddingX: 1, marginTop: 1, children: [
92244
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "yellow", bold: true, children: [
92935
+ trust && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", paddingX: 1, marginTop: 1, children: [
92936
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "yellow", bold: true, children: [
92245
92937
  "? ",
92246
- "this repository's files would start, on your word ",
92247
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "\xB7 y starts them \xB7 n leaves them off" })
92938
+ "this repository's files would start or reach, on your word ",
92939
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "\xB7 y allows them \xB7 n leaves them off" })
92248
92940
  ] }),
92249
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92941
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92250
92942
  " ",
92251
92943
  trust.path
92252
92944
  ] }),
92253
- trust.starts.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92945
+ trust.starts.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92254
92946
  " \xB7 ",
92255
92947
  l
92256
92948
  ] }, i))
92257
92949
  ] }),
92258
- confirm && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", paddingX: 1, marginTop: 1, children: [
92259
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "yellow", bold: true, children: [
92950
+ confirm && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", paddingX: 1, marginTop: 1, children: [
92951
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "yellow", bold: true, children: [
92260
92952
  "\u23EE ",
92261
92953
  confirm.why || "the workspace has changed since hum last looked"
92262
92954
  ] }),
92263
- String(confirm.stat || "").split("\n").filter((l) => l.trim()).slice(0, 8).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92955
+ String(confirm.stat || "").split("\n").filter((l) => l.trim()).slice(0, 8).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92264
92956
  " ",
92265
92957
  l
92266
92958
  ] }, i)),
92267
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "they are kept in this session's history and can be found again \xB7 enter goes back anyway \xB7 esc leaves it as it is" })
92959
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "they are kept in this session's history and can be found again \xB7 enter goes back anyway \xB7 esc leaves it as it is" })
92268
92960
  ] }),
92269
92961
  picker && picker.kind === "rewind" && (() => {
92270
92962
  const it = picker.items[picker.index];
92271
92963
  if (picker.choice !== null) {
92272
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
92273
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: ACCENT, bold: true, children: [
92964
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
92965
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: ACCENT, bold: true, children: [
92274
92966
  "Rewind to ",
92275
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "white", children: `\u201C${(it?.said || "").slice(0, width - 24)}\u201D` })
92967
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "white", children: `\u201C${(it?.said || "").slice(0, width - 24)}\u201D` })
92276
92968
  ] }),
92277
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
92278
- REWIND_CHOICES.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
92279
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: i === picker.choice ? "\u276F " : " " }),
92280
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { bold: i === picker.choice, children: [
92969
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92970
+ REWIND_CHOICES.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92971
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: i === picker.choice ? "\u276F " : " " }),
92972
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { bold: i === picker.choice, children: [
92281
92973
  i + 1,
92282
92974
  ". ",
92283
92975
  c.label.padEnd(26)
92284
92976
  ] }),
92285
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: c.desc })
92977
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: c.desc })
92286
92978
  ] }, c.key)),
92287
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
92288
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Enter to go back \xB7 Esc for the list again" })
92979
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92980
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Enter to go back \xB7 Esc for the list again" })
92289
92981
  ] });
92290
92982
  }
92291
92983
  const top = Math.min(picker.top, Math.max(0, picker.items.length - REWIND_ROWS));
92292
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
92293
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: ACCENT, bold: true, children: [
92984
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
92985
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: ACCENT, bold: true, children: [
92294
92986
  "Rewind ",
92295
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `(${picker.index + 1} of ${picker.items.length})` })
92987
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `(${picker.index + 1} of ${picker.items.length})` })
92296
92988
  ] }),
92297
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Every checkpoint is something you said. Nothing is deleted: what you go back past stays in the session." }),
92298
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
92989
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Every checkpoint is something you said. Nothing is deleted: what you go back past stays in the session." }),
92990
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92299
92991
  picker.items.slice(top, top + REWIND_ROWS).map((c, j) => {
92300
92992
  const i = top + j;
92301
92993
  const sel = i === picker.index;
92302
92994
  const meta = [`${c.steps} ${c.steps === 1 ? "step" : "steps"}`, c.files ? `${c.files} ${c.files === 1 ? "file" : "files"} changed since` : null].filter(Boolean).join(" \xB7 ");
92303
92995
  const said = (c.said || "(nothing said)").replace(/\s+/g, " ");
92304
92996
  const room = Math.max(16, width - 26);
92305
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
92306
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92307
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: sel ? "\u276F " : " " }),
92308
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92997
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92998
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92999
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: sel ? "\u276F " : " " }),
93000
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92309
93001
  String(ago(c.at)).padStart(9),
92310
93002
  " "
92311
93003
  ] }),
92312
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: sel, color: sel ? ACCENT : void 0, children: said.length > room ? said.slice(0, room - 1) + "\u2026" : said })
93004
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: sel, color: sel ? ACCENT : void 0, children: said.length > room ? said.slice(0, room - 1) + "\u2026" : said })
92313
93005
  ] }),
92314
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
93006
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92315
93007
  " ",
92316
93008
  meta
92317
93009
  ] })
92318
93010
  ] }, c.node);
92319
93011
  }),
92320
- top + REWIND_ROWS < picker.items.length ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `\u2193 ${picker.items.length - top - REWIND_ROWS} more` }) : null,
92321
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
92322
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Enter to choose what comes back \xB7 Esc to cancel" })
93012
+ top + REWIND_ROWS < picker.items.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `\u2193 ${picker.items.length - top - REWIND_ROWS} more` }) : null,
93013
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
93014
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Enter to choose what comes back \xB7 Esc to cancel" })
92323
93015
  ] });
92324
93016
  })(),
92325
93017
  picker && picker.kind === "session" && (() => {
@@ -92331,7 +93023,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92331
93023
  shown.forEach((it, j) => {
92332
93024
  const i = top + j;
92333
93025
  if (it.dir !== lastDir) {
92334
- out.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
93026
+ out.push(/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92335
93027
  " ",
92336
93028
  it.dir || "(no directory)"
92337
93029
  ] }, `dir${i}`));
@@ -92343,39 +93035,44 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92343
93035
  const room = Math.max(16, width - 6 - (state ? state.length + 4 : 0));
92344
93036
  const meta = [it.when, it.steps != null ? plural(it.steps, "step") : "on the server", it.cost_usd ? fmtCost2(it.cost_usd) : null, it.model].filter(Boolean).join(" \xB7 ");
92345
93037
  out.push(
92346
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
92347
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
92348
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: sel ? "\u276F " : " " }),
92349
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: sel, color: sel ? ACCENT : void 0, children: what.length > room ? what.slice(0, room - 1) + "\u2026" : what }),
92350
- state ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "magenta", children: [
93038
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", marginBottom: 1, children: [
93039
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
93040
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: sel ? "\u276F " : " " }),
93041
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: sel, color: sel ? ACCENT : void 0, children: what.length > room ? what.slice(0, room - 1) + "\u2026" : what }),
93042
+ state ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "magenta", children: [
92351
93043
  " \xB7 ",
92352
93044
  state
92353
93045
  ] }) : null
92354
93046
  ] }),
92355
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
93047
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92356
93048
  " ",
92357
93049
  meta
92358
93050
  ] })
92359
93051
  ] }, it.name)
92360
93052
  );
92361
93053
  });
92362
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
92363
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: ACCENT, bold: true, children: [
93054
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
93055
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: ACCENT, bold: true, children: [
92364
93056
  "Resume session ",
92365
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `(${rows2.length ? picker.index + 1 : 0} of ${rows2.length})` })
93057
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `(${rows2.length ? picker.index + 1 : 0} of ${rows2.length})` })
92366
93058
  ] }),
92367
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { borderStyle: "round", borderColor: "gray", paddingX: 1, marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
93059
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { borderStyle: "round", borderColor: "gray", paddingX: 1, marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92368
93060
  "\u2315 ",
92369
- picker.query ? picker.query : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Search\u2026" })
93061
+ picker.query ? picker.query : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Search\u2026" })
92370
93062
  ] }) }),
92371
- rows2.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: " nothing matches" }) : out,
92372
- top + PICKER_ROWS < rows2.length ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `\u2193 ${rows2.length - top - PICKER_ROWS} more` }) : null,
92373
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `Enter to continue \xB7 Ctrl+A to show ${scope === "here" ? "all directories" : "only this directory"} \xB7 Type to search \xB7 Esc to cancel` })
93063
+ rows2.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: " nothing matches" }) : out,
93064
+ top + PICKER_ROWS < rows2.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `\u2193 ${rows2.length - top - PICKER_ROWS} more` }) : null,
93065
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `Enter to continue \xB7 Ctrl+A to show ${scope === "here" ? "all directories" : "only this directory"} \xB7 Type to search \xB7 Esc to cancel` })
92374
93066
  ] });
92375
93067
  })(),
92376
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { borderStyle: "single", borderColor: "gray", borderLeft: false, borderRight: false, paddingX: 1, marginTop: 1, children: [
92377
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "cyan", children: "\u276F " }),
92378
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
93068
+ queued.length > 0 && // what waits for the next turns, oldest first, in the person's own glyph but dim: said, not yet sent
93069
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { flexDirection: "column", paddingX: 1, marginTop: 1, children: queued.map((q, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, wrap: "truncate", children: [
93070
+ "\u276F ",
93071
+ q.replace(/\s+/g, " ")
93072
+ ] }, i)) }),
93073
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { borderStyle: "single", borderColor: "gray", borderLeft: false, borderRight: false, paddingX: 1, marginTop: 1, children: [
93074
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "cyan", children: "\u276F " }),
93075
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
92379
93076
  input_default,
92380
93077
  {
92381
93078
  ref: inputRef,
@@ -92385,57 +93082,61 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92385
93082
  onSubmit,
92386
93083
  onPaste,
92387
93084
  focus: phase !== "dead" && !sendingAsk,
92388
- navActive: menu.length === 0 && panelIndex < 0 && !looking,
92389
- history: historyRef.current,
93085
+ onInfo: (text) => append({ kind: "info", text }),
93086
+ navActive: menu.length === 0 && files.length === 0 && panelIndex < 0 && !looking,
93087
+ history: recallOrder(historyRef.current, cwd2),
93088
+ onSearch: setSearch,
92390
93089
  mask: !!(step && step.secret),
92391
93090
  swallow: (input, key) => {
92392
93091
  const chunk = !!input && input.length > 1 && !key.ctrl && !key.meta;
92393
93092
  if (question && (key.pageUp || key.pageDown || sendingAsk)) return true;
92394
93093
  if (picker) return !chunk;
92395
93094
  if (confirm) return !!(key.return || key.escape);
93095
+ if (files.length && key.return && !key.meta && !key.shift && !picker && !trust) return true;
92396
93096
  if (trust) return input === "y" || input === "n" || !!(key.return || key.escape);
93097
+ if (key.upArrow && !value && queued.length && !search) return true;
92397
93098
  if (value.trim()) return false;
93099
+ if (input === "?" && !question && !proposal && !reflection && !looking) return true;
92398
93100
  if (reflection && why !== reflection.id && (input === "1" || input === "2")) return true;
92399
93101
  if (proposal && (input === "a" || input === "p") && (proposal.remember || []).length) return true;
92400
93102
  if (!question || !step) return false;
92401
93103
  if (listAsk || question.kind === "decision") return false;
92402
93104
  if (step.multi && /^[1-9]$/.test(input) && Number(input) <= stepLabels.length) return true;
93105
+ if (stepLabels.length && (key.upArrow || key.downArrow)) return true;
92403
93106
  return !!(step.multi && stepLabels.length && input === " ");
92404
93107
  },
92405
93108
  placeholder: why && reflection && why === reflection.id ? "what did it get wrong? (enter alone: just the no)" : listAsk ? "your words on the list, by number or as one reply" : question && step ? stepLabels.length ? "a number, or your answer" : "your answer" : proposal ? (proposal.remember || []).length ? "enter approves \xB7 a / p allow this shape \xB7 or type why not" : "enter to approve \xB7 or type why not" : paused ? "paused \xB7 say what to do, or /continue" : phase === "busy" ? "type to steer \xB7 esc to stop \xB7 !cmd runs a command" : session ? "what next?" : "what are we doing?"
92406
93109
  }
92407
93110
  )
92408
93111
  ] }),
92409
- menu.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, children: [
92410
- menu.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
92411
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "cyan", inverse: i === menuIndex, children: c.name.padEnd(8) }),
92412
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92413
- " ",
92414
- c.desc
92415
- ] })
92416
- ] }, c.name)),
92417
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "tab to complete \xB7 enter to run" })
93112
+ menu.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, children: [
93113
+ commandRows(menu, menuIndex),
93114
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "tab to complete \xB7 enter to run" })
92418
93115
  ] }),
92419
- !menu.length && agents.length > 0 && // one flat list: ○ a sub-agent of this process, ◇ a worker session of the team (its state, what it needs,
93116
+ files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, children: [
93117
+ commandRows(files.map((f) => ({ name: f, desc: "" })), Math.min(menuIndex, files.length - 1), 0),
93118
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "tab or enter to complete \xB7 keep typing to narrow \xB7 esc to leave it as typed" })
93119
+ ] }),
93120
+ !menu.length && !files.length && agents.length > 0 && // one flat list: ○ a sub-agent of this process, ◇ a worker session of the team (its state, what it needs,
92420
93121
  // +N sub-agents of its own); the core puts what wants a person first. ↓ moves a highlight in from the box
92421
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, children: [
92422
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
93122
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, children: [
93123
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92423
93124
  " ",
92424
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "magenta", children: "\u25CF" }),
93125
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "magenta", children: "\u25CF" }),
92425
93126
  " main"
92426
93127
  ] }),
92427
- agents.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
92428
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: i === panelIndex ? "\u276F " : " " }),
92429
- a.worker ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
92430
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "magenta", children: "\u25C7 " }),
92431
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: i === panelIndex, children: `${a.kind} worker`.padEnd(16) }),
92432
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: a.desc }),
92433
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: a.needs ? "yellow" : void 0, dimColor: !a.needs, children: [
93128
+ agents.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
93129
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: i === panelIndex ? "\u276F " : " " }),
93130
+ a.worker ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
93131
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "magenta", children: "\u25C7 " }),
93132
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: i === panelIndex, children: `${a.kind} worker`.padEnd(16) }),
93133
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: a.desc }),
93134
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: a.needs ? "yellow" : void 0, dimColor: !a.needs, children: [
92434
93135
  " \xB7 ",
92435
93136
  a.needs ? `needs ${a.needs}` : a.state
92436
93137
  ] }),
92437
- a.agents ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "magenta", children: ` +${a.agents}` }) : null,
92438
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
93138
+ a.agents ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "magenta", children: ` +${a.agents}` }) : null,
93139
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92439
93140
  " ",
92440
93141
  fmtDur(a.elapsed_s || 0),
92441
93142
  " \xB7 ",
@@ -92443,11 +93144,11 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92443
93144
  " \xB7 ",
92444
93145
  fmtCost2(a.cost_usd || 0)
92445
93146
  ] })
92446
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
92447
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "magenta", children: "\u25CB " }),
92448
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: i === panelIndex, children: String(a.kind).padEnd(10) }),
92449
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: a.desc }),
92450
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
93147
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
93148
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "magenta", children: "\u25CB " }),
93149
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: i === panelIndex, children: String(a.kind).padEnd(10) }),
93150
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: a.desc }),
93151
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92451
93152
  " ",
92452
93153
  fmtDur(a.elapsed_s || 0),
92453
93154
  " \xB7 ",
@@ -92460,7 +93161,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92460
93161
  ] })
92461
93162
  ] }, a.n))
92462
93163
  ] }),
92463
- !menu.length && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: statusLine }) })
93164
+ !menu.length && !files.length && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, wrap: "truncate-end", children: statusLine }) })
92464
93165
  ] });
92465
93166
  }
92466
93167
 
@@ -92468,9 +93169,10 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92468
93169
  init_core();
92469
93170
  init_update();
92470
93171
  init_install();
92471
- var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
92472
- import { spawnSync as spawnSync5 } from "node:child_process";
92473
- var MINE3 = true ? "0.2.24" : "0.0.0";
93172
+ await init_theme();
93173
+ var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
93174
+ import { spawnSync as spawnSync6 } from "node:child_process";
93175
+ var MINE3 = true ? "0.2.26" : "0.0.0";
92474
93176
  var layout = installLayout();
92475
93177
  function completeInstall() {
92476
93178
  if (layout.kind !== "npm" || !needsInstall(MINE3)) return;
@@ -92505,13 +93207,14 @@ if (CORE_COMMANDS.has(argv0[0]) || argv0[0] === "agents" && argv0.includes("--js
92505
93207
  process.stderr.write(startFailure([]) + "\n");
92506
93208
  process.exit(1);
92507
93209
  }
92508
- const r = spawnSync5(cmd.bin, cmd.args, { stdio: "inherit", windowsHide: true });
93210
+ const r = spawnSync6(cmd.bin, cmd.args, { stdio: "inherit", windowsHide: true });
92509
93211
  if (r.error) {
92510
93212
  process.stderr.write(startFailure([{ bin: cmd.bin, error: r.error }]) + "\n");
92511
93213
  process.exit(1);
92512
93214
  }
92513
93215
  process.exit(r.status === null ? 1 : r.status);
92514
93216
  }
93217
+ setTheme(await detectTheme());
92515
93218
  var SCREEN = { exitOnCtrlC: false, incrementalRendering: true };
92516
93219
  function leave(core2) {
92517
93220
  core2.close();
@@ -92530,7 +93233,7 @@ if (argv0[0] === "agents") {
92530
93233
  }
92531
93234
  const { default: Agents2 } = await init_agents2().then(() => agents_exports2);
92532
93235
  let chosen = null;
92533
- const screen = render_default(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Agents2, { onAttach: (r) => {
93236
+ const screen = render_default(/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Agents2, { onAttach: (r) => {
92534
93237
  chosen = r;
92535
93238
  screen.unmount();
92536
93239
  }, onQuit: () => screen.unmount() }), { incrementalRendering: true });
@@ -92543,7 +93246,7 @@ if (argv0[0] === "agents") {
92543
93246
  process.stderr.write(exc.message + "\n");
92544
93247
  process.exit(1);
92545
93248
  }
92546
- const app = render_default(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(App2, { core: core2, task: null, resume: null, images: [] }), SCREEN);
93249
+ const app = render_default(/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(App2, { core: core2, task: null, resume: null, images: [] }), SCREEN);
92547
93250
  await app.waitUntilExit();
92548
93251
  leave(core2);
92549
93252
  }
@@ -92596,7 +93299,7 @@ try {
92596
93299
  process.stderr.write(exc.message + "\n");
92597
93300
  process.exit(1);
92598
93301
  }
92599
- var { waitUntilExit } = render_default(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(App2, { core, task: startedHere ? null : args.task, resume: args.resume === "pick" || !startedHere ? args.resume : null, images: startedHere ? [] : args.images }), SCREEN);
93302
+ var { waitUntilExit } = render_default(/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(App2, { core, task: startedHere ? null : args.task, resume: args.resume === "pick" || !startedHere ? args.resume : null, images: startedHere ? [] : args.images }), SCREEN);
92600
93303
  waitUntilExit().then(() => leave(core));
92601
93304
  /*! Bundled license information:
92602
93305