@metaphi-ai/hum 0.2.25 → 0.2.27

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 +1854 -1050
  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.25" : "";
89040
+ MINE = true ? "0.2.27" : "";
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.25" : ""
89385
+ tui: true ? "0.2.27" : ""
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.25" : "" } = {}) {
89388
+ function startFailure(failures, { npm = /^(node|bun)(\.exe)?$/i.test(String(process.execPath).split(/[\\/]/).pop()), platform: platform2 = process.platform, version = true ? "0.2.27" : "" } = {}) {
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,131 @@ 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
+ const lines = [];
90494
+ let at = [0, 0];
90495
+ options2.forEach((o, i) => {
90496
+ const lead = `${i === cursor ? "\u203A " : " "}${String(i + 1).padStart(digits)}. ${step.multi && !o.own ? `[${picks.includes(o.label) ? "x" : " "}] ` : ""}`;
90497
+ const said = String(o.description || "");
90498
+ const desc = /[\x60*_]/.test(said) ? renderMarkdown(said, 1e3).trim() : said;
90499
+ const body = `${source_default.bold(o.label)}${step.default === o.label ? " (default)" : ""}${desc ? source_default.dim(` \u2014 ${desc}`) : ""}`;
90500
+ const from = lines.length;
90501
+ lines.push(...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));
90502
+ if (i === cursor) at = [from, lines.length];
90503
+ });
90504
+ return { lines, at };
90505
+ };
90506
+ var OWN_ANSWER = { label: "Something else", description: "type your own answer", own: true };
90249
90507
  var cell = (s) => String(s || "").replaceAll("\\", "\\\\").replaceAll("|", "\\|").replace(/\r?\n/g, " ");
90250
90508
  function consultBody(question, step, width, picks = [], cursor = 0) {
90251
90509
  const parts = [];
90510
+ let choices = { lines: [], at: [0, 0] };
90252
90511
  if (question.kind === "constraints") {
90253
90512
  const rows = (question.questions || []).filter((q) => q.id !== "missed");
90254
90513
  if (width >= 60) {
@@ -90267,25 +90526,37 @@ ${q.question}`).join("\n\n"));
90267
90526
  if (step.header) parts.push(`**${step.header}**`);
90268
90527
  parts.push(step.question);
90269
90528
  const options2 = (step.options || []).map((o) => typeof o === "string" ? { label: o } : o);
90270
- if (question.kind === "decision" && options2.length && width >= 60 && !options2.some((o) => /\n/.test(o.description || ""))) {
90271
- parts.push([
90272
- "| # | Choice | Consequences |",
90273
- "| --- | --- | --- |",
90274
- ...options2.map((o, i) => `| ${i + 1} | ${cell(o.label)} | ${cell(o.description)} |`)
90275
- ].join("\n"));
90276
- } 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"));
90281
- }
90282
- }
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),
90286
- width,
90287
- { hard: true, trim: false }
90288
- ).split("\n");
90529
+ if (options2.length) choices = optionRows(step, [...options2, OWN_ANSWER], width, picks, cursor);
90530
+ }
90531
+ const evidence = question.evidence?.length ? ["**Evidence**\n\n" + question.evidence.join("\n\n")] : [];
90532
+ const md = [...parts, ...evidence].filter(Boolean);
90533
+ const text = md.length ? wrapAnsi2(renderMarkdown(md.join("\n\n"), width), width, { hard: true, trim: false }).split("\n") : [];
90534
+ return { text, rows: choices.lines, at: choices.at };
90535
+ }
90536
+ function consultWindow({ text, rows, at }, height, top) {
90537
+ const rowsHeight = Math.min(rows.length, height - (text.length ? 1 : 0));
90538
+ const textHeight = Math.min(text.length, height - rowsHeight);
90539
+ const textStart = Math.max(0, Math.min(top, text.length - textHeight));
90540
+ const rowsStart = at[1] <= rowsHeight ? 0 : Math.min(at[0], rows.length - rowsHeight);
90541
+ return {
90542
+ textHeight,
90543
+ textStart,
90544
+ shownText: text.slice(textStart, textStart + textHeight),
90545
+ shownRows: rows.slice(rowsStart, rowsStart + rowsHeight)
90546
+ };
90547
+ }
90548
+ function pickOf(step, said) {
90549
+ const word = String(said ?? "").trim();
90550
+ const labels = (step.options || []).map((o) => typeof o === "string" ? o : o.label);
90551
+ const nth = (t) => /^\d+$/.test(t) && Number(t) >= 1 && Number(t) <= labels.length ? labels[Number(t) - 1] : null;
90552
+ if (!word || !labels.length) return { pick: null, why: word };
90553
+ if (step.multi && word.includes(",")) {
90554
+ const each = word.split(",").map((t) => nth(t.trim()));
90555
+ return each.every(Boolean) ? { pick: each.join(", "), why: "" } : { pick: null, why: word };
90556
+ }
90557
+ const head = step.graded ? word.split(/\s+/)[0] : word;
90558
+ const named = nth(head) || labels.find((l) => l.toLowerCase() === word.toLowerCase()) || null;
90559
+ return named ? { pick: named, why: nth(head) ? word.slice(head.length).trim() : "" } : { pick: null, why: word };
90289
90560
  }
90290
90561
 
90291
90562
  // src/wordmark.js
@@ -90319,14 +90590,25 @@ init_core();
90319
90590
  init_agents();
90320
90591
 
90321
90592
  // src/input.jsx
90322
- var import_react35 = __toESM(require_react(), 1);
90593
+ var import_react37 = __toESM(require_react(), 1);
90323
90594
  await init_build2();
90324
90595
  init_source();
90325
- var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
90596
+ await init_theme();
90597
+ var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
90598
+ import { spawnSync as spawnSync4 } from "node:child_process";
90599
+ import fs7 from "node:fs";
90600
+ import os6 from "node:os";
90601
+ import path5 from "node:path";
90326
90602
  var BURST_MS = 40;
90327
90603
  var CHIP_AT_END = /\[Pasted text #\d+ \+\d+ lines\]$/;
90328
90604
  var CHIP_AT_START = /^\[Pasted text #\d+ \+\d+ lines\]/;
90329
90605
  var CHIP = /\[Pasted text #(\d+) \+\d+ lines\]/g;
90606
+ var editorCommand = (env3 = process.env, platform2 = process.platform) => {
90607
+ const named = (env3.VISUAL || env3.EDITOR || "").trim();
90608
+ const [bin, ...args2] = (named || (platform2 === "win32" ? "notepad" : "vi")).split(/\s+/);
90609
+ return { bin, args: args2, named: !!named };
90610
+ };
90611
+ var editedText = (raw) => normalise(raw.replace(/^\uFEFF/, "")).replace(/\n$/, "");
90330
90612
  var normalise = (s) => [...s.replace(/\r\n?/g, "\n")].filter((ch) => ch === "\n" || ch === " " || ch >= " ").join("");
90331
90613
  function MultilineInput({
90332
90614
  value,
@@ -90340,13 +90622,17 @@ function MultilineInput({
90340
90622
  navActive = true,
90341
90623
  mask = false,
90342
90624
  swallow = null,
90625
+ onSearch = null,
90626
+ onInfo = null,
90343
90627
  ref = null
90344
90628
  }) {
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 });
90629
+ const { suspendTerminal } = use_app_default();
90630
+ const [cursor, setCursor] = (0, import_react37.useState)(value.length);
90631
+ const hist = (0, import_react37.useRef)({ index: null, stash: "" });
90632
+ const search = (0, import_react37.useRef)(null);
90633
+ const latest = (0, import_react37.useRef)({ value, cursor });
90348
90634
  latest.current = { value, cursor };
90349
- const burstAt = (0, import_react35.useRef)(0);
90635
+ const burstAt = (0, import_react37.useRef)(0);
90350
90636
  const clamp = (n, len) => Math.max(0, Math.min(n, len));
90351
90637
  const set = (v, c2) => {
90352
90638
  latest.current = { value: v, cursor: clamp(c2, v.length) };
@@ -90358,7 +90644,7 @@ function MultilineInput({
90358
90644
  const c2 = clamp(cu, v.length);
90359
90645
  set(v.slice(0, c2) + text + v.slice(c2), c2 + text.length);
90360
90646
  };
90361
- (0, import_react35.useImperativeHandle)(ref, () => ({
90647
+ (0, import_react37.useImperativeHandle)(ref, () => ({
90362
90648
  // text placed at the cursor as it is NOW (an image chip arrives after a round trip)
90363
90649
  insert(text) {
90364
90650
  const { value: v, cursor: cu } = latest.current;
@@ -90369,6 +90655,11 @@ function MultilineInput({
90369
90655
  // pasted text (or its chip) placed at the cursor as it is
90370
90656
  paste(text) {
90371
90657
  insertAt(text);
90658
+ },
90659
+ // a completion accepted: the value from `from` to its end becomes `text`, the caret after it
90660
+ complete(from, text) {
90661
+ const v = latest.current.value;
90662
+ set(v.slice(0, from) + text, from + text.length);
90372
90663
  }
90373
90664
  }));
90374
90665
  const lineStart = (v, c2) => v.lastIndexOf("\n", c2 - 1) + 1;
@@ -90397,6 +90688,48 @@ function MultilineInput({
90397
90688
  }
90398
90689
  }
90399
90690
  };
90691
+ const showMatch = (q, index) => {
90692
+ const seen = /* @__PURE__ */ new Set();
90693
+ const matches = [...history].reverse().filter((h) => h.toLowerCase().includes(q.toLowerCase()) && !seen.has(h) && seen.add(h));
90694
+ const i = matches.length ? index % matches.length : 0;
90695
+ search.current = { ...search.current, query: q, matches, index: i };
90696
+ if (matches.length) set(matches[i], matches[i].length);
90697
+ if (onSearch) onSearch({ query: q, hit: matches.length > 0 });
90698
+ };
90699
+ const endSearch = (restore) => {
90700
+ const { stash } = search.current;
90701
+ search.current = null;
90702
+ hist.current = { index: null, stash: "" };
90703
+ if (restore) set(stash, stash.length);
90704
+ if (onSearch) onSearch(null);
90705
+ };
90706
+ const openEditor = async () => {
90707
+ const { bin, args: args2, named } = editorCommand();
90708
+ const file = path5.join(os6.tmpdir(), `hum-edit-${process.pid}.md`);
90709
+ let text = null, why = null;
90710
+ try {
90711
+ fs7.writeFileSync(file, latest.current.value);
90712
+ await suspendTerminal(() => {
90713
+ const r = spawnSync4(bin, [...args2, file], { stdio: "inherit" });
90714
+ 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}`;
90715
+ else if (r.status !== 0) why = `${bin} exited ${r.status ?? r.signal} \xB7 the draft is as it was`;
90716
+ else text = fs7.readFileSync(file, "utf8");
90717
+ });
90718
+ } catch (e) {
90719
+ why = `editor: ${e.message}`;
90720
+ } finally {
90721
+ try {
90722
+ fs7.unlinkSync(file);
90723
+ } catch {
90724
+ }
90725
+ }
90726
+ if (why) {
90727
+ if (onInfo) onInfo(why);
90728
+ return;
90729
+ }
90730
+ const clean = editedText(text);
90731
+ set(clean, clean.length);
90732
+ };
90400
90733
  use_paste_default((text) => {
90401
90734
  const clean = normalise(text);
90402
90735
  burstAt.current = Date.now();
@@ -90407,7 +90740,22 @@ function MultilineInput({
90407
90740
  const { value: value2, cursor: cursor2 } = latest.current;
90408
90741
  const c2 = clamp(cursor2, value2.length);
90409
90742
  if (swallow && swallow(input, key)) return;
90410
- if (key.return && (key.meta || key.shift)) {
90743
+ if (search.current) {
90744
+ const { query, index } = search.current;
90745
+ if (key.ctrl && input === "r") showMatch(query, index + 1);
90746
+ else if (key.return || key.leftArrow || key.rightArrow || key.upArrow || key.downArrow) endSearch(false);
90747
+ else if (key.escape) endSearch(true);
90748
+ else if (key.backspace) showMatch(query.slice(0, -1), 0);
90749
+ else if (!key.ctrl && !key.meta && !key.tab && normalise(input)) showMatch(query + normalise(input), 0);
90750
+ return;
90751
+ }
90752
+ if (key.ctrl && input === "r") {
90753
+ if (!navActive) return;
90754
+ search.current = { query: "", matches: [], index: 0, stash: value2 };
90755
+ showMatch("", 0);
90756
+ return;
90757
+ }
90758
+ if (key.return && (key.meta || key.shift) || key.ctrl && input === "j" || !key.return && input === "\n") {
90411
90759
  insertAt("\n");
90412
90760
  return;
90413
90761
  }
@@ -90483,6 +90831,8 @@ function MultilineInput({
90483
90831
  set(head + value2.slice(c2), head.length);
90484
90832
  } else if (input === "v") {
90485
90833
  if (onPasteImage) onPasteImage();
90834
+ } else if (input === "g") {
90835
+ if (!mask) openEditor();
90486
90836
  }
90487
90837
  return;
90488
90838
  }
@@ -90494,13 +90844,13 @@ function MultilineInput({
90494
90844
  set(value2.slice(0, c2) + text + value2.slice(c2), c2 + text.length);
90495
90845
  }, { isActive: focus });
90496
90846
  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) });
90847
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: value.length > 0 ? mask ? "\u2022".repeat(value.length) : value : dimText(placeholder) });
90498
90848
  }
90499
90849
  const c = clamp(cursor, value.length);
90500
90850
  const value_ = mask ? "\u2022".repeat(value.length) : value;
90501
90851
  let shown;
90502
90852
  if (value.length === 0) {
90503
- shown = placeholder ? source_default.inverse(placeholder.charAt(0) || " ") + source_default.dim(placeholder.slice(1)) : source_default.inverse(" ");
90853
+ shown = placeholder ? source_default.inverse(placeholder.charAt(0) || " ") + dimText(placeholder.slice(1)) : source_default.inverse(" ");
90504
90854
  } else if (c >= value.length) {
90505
90855
  shown = value_ + source_default.inverse(" ");
90506
90856
  } else if (value_[c] === "\n") {
@@ -90508,22 +90858,45 @@ function MultilineInput({
90508
90858
  } else {
90509
90859
  shown = value_.slice(0, c) + source_default.inverse(value_[c]) + value_.slice(c + 1);
90510
90860
  }
90511
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: shown });
90861
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: shown });
90512
90862
  }
90513
90863
  var input_default = MultilineInput;
90514
90864
 
90865
+ // src/attention.js
90866
+ import path6 from "node:path";
90867
+ var BEL3 = "\x07";
90868
+ var ASK_WAIT_MS = 6e3;
90869
+ var IDLE_WAIT_MS = 6e4;
90870
+ var OFF = /* @__PURE__ */ new Set(["0", "false", "off"]);
90871
+ var enabled = (env3 = process.env) => !OFF.has(env3.HUM_NOTIFY ?? "1");
90872
+ 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 || "");
90873
+ var passthrough = (seq, env3) => env3.TMUX ? `\x1BPtmux;${seq.replace(/\x1b/g, "\x1B\x1B")}\x1B\\` : seq;
90874
+ function ring(message, env3 = process.env) {
90875
+ if (!enabled(env3)) return "";
90876
+ return BEL3 + (drawsNotice(env3) ? passthrough(`\x1B]9;${message}\x07`, env3) : "");
90877
+ }
90878
+ var titleOf = (cwd2, waiting = false) => `hum \xB7 ${path6.basename(cwd2 || "") || "hum"}${waiting ? " \xB7 [ ! ] needs you" : ""}`;
90879
+ var title = (text, env3 = process.env) => enabled(env3) ? `\x1B]0;${text}\x07` : "";
90880
+ var toTerminal = (seq, out = process.stdout) => {
90881
+ if (seq && out.isTTY) out.write(seq);
90882
+ };
90883
+ var after = (ms, fn) => {
90884
+ const t = setTimeout(fn, ms);
90885
+ return () => clearTimeout(t);
90886
+ };
90887
+
90515
90888
  // src/app.jsx
90516
- var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
90517
- var MINE2 = true ? "0.2.25" : "";
90889
+ var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
90890
+ var MINE2 = true ? "0.2.27" : "";
90518
90891
  var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
90519
90892
  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
90893
  var shortSession = (name) => (name || "").replace(/\.jsonl$/, "");
90522
- var HYPOTHESIS_GLYPH = { candidate: "\u25FB", testing: "\u25B8", supported: "\u25FC", refuted: "\u2717", superseded: "\u21B7", blocked: "\u23F8" };
90894
+ var PLAN_GLYPH = { completed: "\u2714", in_progress: "\u25A1", pending: "\u25A1" };
90895
+ var HYPOTHESIS_GLYPH = { candidate: "\u25FB", testing: "\u25B8", supported: "\u25FC", refuted: "\u2717", superseded: "\u21B7", blocked: "\u2016" };
90523
90896
  var PICKER_ROWS = 8;
90524
90897
  var sessionRows = (p, here) => {
90525
90898
  const q = p.query.trim().toLowerCase();
90526
- const all = p.all.map((it) => ({ ...it, dir: it.cwd ? path5.basename(it.cwd) : "" }));
90899
+ const all = p.all.map((it) => ({ ...it, dir: it.cwd ? path7.basename(it.cwd) : "" }));
90527
90900
  const inHere = all.filter((it) => it.cwd && here && it.cwd === here);
90528
90901
  const scope = p.scope === "here" && inHere.length ? "here" : "all";
90529
90902
  let rows = all;
@@ -90545,7 +90918,7 @@ var ago = (at) => {
90545
90918
  return `${Math.floor(secs / 86400)}d ago`;
90546
90919
  };
90547
90920
  var homeRel = (p) => {
90548
- const h = os6.homedir();
90921
+ const h = os7.homedir();
90549
90922
  return p && h && p.startsWith(h) ? "~" + p.slice(h.length) : p;
90550
90923
  };
90551
90924
  var handEdit = (stat) => {
@@ -90579,26 +90952,52 @@ var costLines = (spend, meter, end, ctx = "") => {
90579
90952
  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
90953
  return lines;
90581
90954
  };
90582
- var HISTORY_PATH = path5.join(os6.homedir(), ".hum", "history.json");
90955
+ var historyPath = () => path7.join(humHome2(), "history.json");
90583
90956
  var HISTORY_MAX = 300;
90584
90957
  var loadHistory = () => {
90585
90958
  try {
90586
- const a = JSON.parse(fs7.readFileSync(HISTORY_PATH, "utf8"));
90587
- return Array.isArray(a) ? a.filter((x) => typeof x === "string") : [];
90959
+ const a = JSON.parse(fs8.readFileSync(historyPath(), "utf8"));
90960
+ return Array.isArray(a) ? a.map((x) => typeof x === "string" ? { cwd: "", text: x, at: 0 } : x).filter((r) => r && typeof r.text === "string") : [];
90961
+ } catch {
90962
+ return [];
90963
+ }
90964
+ };
90965
+ var saveHistory = (rows) => {
90966
+ try {
90967
+ fs8.mkdirSync(path7.dirname(historyPath()), { recursive: true });
90968
+ fs8.writeFileSync(historyPath(), JSON.stringify(rows.slice(-HISTORY_MAX)));
90969
+ } catch {
90970
+ }
90971
+ };
90972
+ var recallOrder = (rows, cwd2) => [...rows.filter((r) => r.cwd !== cwd2), ...rows.filter((r) => r.cwd === cwd2)].map((r) => r.text);
90973
+ var PASTE_KEEP = 50;
90974
+ var pasteDir = () => path7.join(humHome2(), "paste");
90975
+ var pasteIds = () => {
90976
+ try {
90977
+ return fs8.readdirSync(pasteDir()).map((f) => Number((f.match(/^(\d+)\.txt$/) || [])[1])).filter(Number.isInteger).sort((a, b) => a - b);
90588
90978
  } catch {
90589
90979
  return [];
90590
90980
  }
90591
90981
  };
90592
- var saveHistory = (arr) => {
90982
+ var savePaste = (n, text) => {
90593
90983
  try {
90594
- fs7.mkdirSync(path5.dirname(HISTORY_PATH), { recursive: true });
90595
- fs7.writeFileSync(HISTORY_PATH, JSON.stringify(arr.slice(-HISTORY_MAX)));
90984
+ fs8.mkdirSync(pasteDir(), { recursive: true });
90985
+ fs8.writeFileSync(path7.join(pasteDir(), `${n}.txt`), text);
90986
+ for (const id of pasteIds().slice(0, -PASTE_KEEP)) fs8.rmSync(path7.join(pasteDir(), `${id}.txt`), { force: true });
90596
90987
  } catch {
90597
90988
  }
90598
90989
  };
90990
+ var readPaste = (n) => {
90991
+ try {
90992
+ return fs8.readFileSync(path7.join(pasteDir(), `${n}.txt`), "utf8");
90993
+ } catch {
90994
+ return null;
90995
+ }
90996
+ };
90599
90997
  var DRAFT_TAIL_LINES = 14;
90600
90998
  var LIVE_MIN_ROWS = 3;
90601
90999
  var DEFAULT_ROWS = 24;
91000
+ var ELAPSED_TICK_MS = 1e3;
90602
91001
  var liveTail = (text, width, rows) => {
90603
91002
  const l = wrapAnsi2(text, Math.max(20, width), { hard: true, trim: false }).split("\n");
90604
91003
  return l.length <= rows ? l.join("\n") : "\u2026\n" + l.slice(-(rows - 1)).join("\n");
@@ -90613,6 +91012,7 @@ var COMMANDS = [
90613
91012
  { name: "/accept", desc: "the work as it stands is what you wanted (/accept <why>); recorded against the state it is in" },
90614
91013
  { name: "/reject", desc: "the work as it stands is not (/reject <why>)" },
90615
91014
  { name: "/cost", desc: "tokens and cost so far" },
91015
+ { 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
91016
  { name: "/context", desc: "what fills the context window: system prompt, tool schemas, messages, tool results" },
90617
91017
  { name: "/usage-credits", desc: "your credits on our models, and the page that adds more (a code from Metaphi, or a purchase)" },
90618
91018
  { name: "/approve", desc: "approvals on|off \u2014 whether every change and command waits for you first (leaving the sandbox always asks)" },
@@ -90630,7 +91030,28 @@ var COMMANDS = [
90630
91030
  { name: "/quit", desc: "leave; the session keeps running (hum resume brings you back)" },
90631
91031
  { name: "/stop", desc: "end this session for good (the record is saved)" }
90632
91032
  ];
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";
91033
+ var KEYS = [
91034
+ { name: "!cmd", desc: "runs a command as you" },
91035
+ { 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)" },
91036
+ { name: "ctrl+j", desc: "adds a line without sending; alt+enter and shift+enter do too where the terminal tells them from enter" },
91037
+ { name: "enter", desc: "at a proposal approves it; a typed reason rejects; a / p allow that shape for the session / the project" },
91038
+ { name: "typing", desc: "while it works steers it; editing files in your editor is recorded as your turn" },
91039
+ { 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" },
91040
+ { name: "ctrl+o", desc: "shows the full output of the last tool result; /expand n shows the one numbered #n on its line" },
91041
+ { name: "ctrl+g", desc: "opens the box in $VISUAL / $EDITOR, else vi; notepad on Windows" },
91042
+ { 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" },
91043
+ { name: "ctrl+v", desc: "pastes a screenshot from the clipboard; @path.png in a message attaches an image file" },
91044
+ { name: "ctrl+c", desc: "twice leaves; the session keeps running (hum resume brings you back)" },
91045
+ { name: "?", desc: "on an empty line shows this" }
91046
+ ];
91047
+ var commandRows = (rows, index = -1, pad2 = 8) => rows.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
91048
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "cyan", inverse: i === index, children: c.name.padEnd(pad2) }),
91049
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91050
+ " ",
91051
+ c.desc
91052
+ ] })
91053
+ ] }, c.name));
91054
+ var HELP_PAD = Math.max(...COMMANDS.map((c) => c.name.length));
90634
91055
  var DIFF_TAIL_LINES = 20;
90635
91056
  var PATCH_LINES = 200;
90636
91057
  var NEEDS_EVERY_MS = 1e4;
@@ -90643,95 +91064,235 @@ var REWIND_CHOICES = [
90643
91064
  ];
90644
91065
  var ERR_TAIL_LINES = 5;
90645
91066
  var PEEK_LINES = 12;
90646
- var THOUGHT_TAIL_LINES = 3;
91067
+ var FILE_DEPTH = 3;
91068
+ var FILE_CAP = 200;
91069
+ var FILE_ROWS = 8;
91070
+ var walkFiles = (root, { depth = FILE_DEPTH, cap = FILE_CAP } = {}) => {
91071
+ const out = [];
91072
+ let level = [""];
91073
+ for (let d = 0; d < depth && level.length && out.length < cap; d += 1) {
91074
+ const next = [];
91075
+ for (const rel of level) {
91076
+ let entries;
91077
+ try {
91078
+ entries = fs8.readdirSync(path7.join(root, rel), { withFileTypes: true });
91079
+ } catch {
91080
+ continue;
91081
+ }
91082
+ entries.sort((a, b) => a.name.localeCompare(b.name));
91083
+ for (const e of entries) {
91084
+ if (e.name.startsWith(".") || e.name === "node_modules") continue;
91085
+ if (out.length >= cap) return out;
91086
+ const p = rel ? `${rel}/${e.name}` : e.name;
91087
+ if (e.isDirectory()) {
91088
+ out.push(`${p}/`);
91089
+ next.push(p);
91090
+ } else out.push(p);
91091
+ }
91092
+ }
91093
+ level = next;
91094
+ }
91095
+ return out;
91096
+ };
91097
+ var AT_TAIL = /(?:^|\s)@([^\s@]+)$/;
91098
+ var OUTPUTS_KEPT = 20;
90647
91099
  var diagLine = (d) => `${d.file ? `${d.file}${d.line != null ? `:${d.line}` : ""}: ` : ""}${d.severity || "error"}: ${d.message || ""}`;
90648
91100
  var toolLine = (text) => {
90649
91101
  const s = String(text || "");
90650
91102
  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) })
91103
+ if (cut <= 0) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: s });
91104
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
91105
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: s.slice(0, cut) }),
91106
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: s.slice(cut) })
90655
91107
  ] });
90656
91108
  };
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 }) {
91109
+ var ToolRow = ({ text, tail: tail2 }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
91110
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: "\u25CB" }) }),
91111
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
91112
+ toolLine(text),
91113
+ tail2 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: tail2 }) : null
91114
+ ] })
91115
+ ] });
91116
+ var CONTINUES = /* @__PURE__ */ new Set(["tool_result", "diff", "errtail", "spool", "agent_end", "thought"]);
91117
+ var continuesBlock = (item) => !!item.agent || CONTINUES.has(item.kind);
91118
+ var blockGap = (item) => continuesBlock(item) ? 0 : 1;
91119
+ var rowStands = (call) => !!call && (call.lines != null || !!call.diff);
91120
+ var callLabel = (ev) => ev.lines != null ? `${ev.desc || ev.name} (${ev.lines} lines)` : ev.desc || ev.name;
91121
+ var Hang = ({ lead, children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
91122
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: lead.length, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: lead }) }),
91123
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children })
91124
+ ] });
91125
+ var tickTail = (t0) => {
91126
+ const s = Math.floor((Date.now() - t0) / 1e3);
91127
+ return s >= 1 ? ` \xB7 ${fmtDur(s)}` : "";
91128
+ };
91129
+ var READ_ONLY = /* @__PURE__ */ new Set(["read_file", "grep", "glob"]);
91130
+ var READS_SHOWN = 6;
91131
+ var readsLabel = (reads) => {
91132
+ const files = reads.filter((r) => r.name === "read_file").length;
91133
+ const searches = reads.length - files;
91134
+ return [
91135
+ files ? `read ${plural(files, "file")}` : null,
91136
+ searches ? files ? `${searches} search${searches === 1 ? "" : "es"}` : `searched ${plural(searches, "time")}` : null
91137
+ ].filter(Boolean).join(" \xB7 ");
91138
+ };
91139
+ var foldRows = (reads) => {
91140
+ if (reads.length < 2) return reads.flatMap((r) => [r.item, r.row]);
91141
+ const more = reads.length > READS_SHOWN ? ` \xB7 +${reads.length - READS_SHOWN} more` : "";
91142
+ return [
91143
+ { kind: "tool", text: readsLabel(reads) },
91144
+ { kind: "tool_result", text: `${reads.slice(0, READS_SHOWN).map((r) => r.what).join(" \xB7 ")}${more} (ctrl+o expands \xB7 #${reads[0].n})` }
91145
+ ];
91146
+ };
91147
+ var fitStatus = (parts, width) => {
91148
+ const kept = parts.filter((p) => p && p.text);
91149
+ const line = () => kept.map((p) => p.text).join(" \xB7 ");
91150
+ for (const p of kept.filter((q) => q.drop).sort((a, b) => a.drop - b.drop)) {
91151
+ if (line().length <= width) break;
91152
+ kept.splice(kept.indexOf(p), 1);
91153
+ }
91154
+ return line();
91155
+ };
91156
+ function App2({ core: core2, task, resume, images = [], peek = peekSession, update = updateNotice, watch = watchReady, tty: tty3 = toTerminal, after: after2 = after }) {
90663
91157
  const { exit } = use_app_default();
90664
91158
  const { stdout } = use_stdout_default();
90665
91159
  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)([]);
91160
+ const [items, setItems] = (0, import_react38.useState)([]);
91161
+ const [transcriptEpoch, setTranscriptEpoch] = (0, import_react38.useState)(0);
91162
+ const [phase, setPhase] = (0, import_react38.useState)("connecting");
91163
+ const [status, setStatus] = (0, import_react38.useState)("");
91164
+ const [statusOf, setStatusOf] = (0, import_react38.useState)("");
91165
+ const [hello, setHello] = (0, import_react38.useState)(null);
91166
+ const [latest, setLatest] = (0, import_react38.useState)(null);
91167
+ const [ready, setReady] = (0, import_react38.useState)("");
91168
+ const [needYou, setNeedYou] = (0, import_react38.useState)(0);
91169
+ const [goal, setGoal] = (0, import_react38.useState)(null);
91170
+ const [session, setSession] = (0, import_react38.useState)(null);
91171
+ const [spend, setSpend] = (0, import_react38.useState)(0);
91172
+ const [agents, setAgents] = (0, import_react38.useState)([]);
91173
+ const [panelIndex, setPanelIndex] = (0, import_react38.useState)(-1);
91174
+ const [looking, setLooking] = (0, import_react38.useState)(null);
91175
+ const lookRef = (0, import_react38.useRef)(null);
91176
+ const [draft, setDraft] = (0, import_react38.useState)("");
91177
+ const [planSteps, setPlanSteps] = (0, import_react38.useState)([]);
91178
+ const [value, setValue] = (0, import_react38.useState)("");
91179
+ const [menuIndex, setMenuIndex] = (0, import_react38.useState)(0);
91180
+ const [atShut, setAtShut] = (0, import_react38.useState)("");
91181
+ const [elapsed, setElapsed] = (0, import_react38.useState)(0);
91182
+ const [ctrlc, setCtrlc] = (0, import_react38.useState)(0);
91183
+ const [search, setSearch] = (0, import_react38.useState)(null);
91184
+ const [picker, setPicker] = (0, import_react38.useState)(null);
91185
+ const [proposal, setProposal] = (0, import_react38.useState)(null);
91186
+ const [questions, setQuestions] = (0, import_react38.useState)([]);
90690
91187
  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);
91188
+ const [qStep, setQStep] = (0, import_react38.useState)(0);
91189
+ const [qAnswers, setQAnswers] = (0, import_react38.useState)({});
91190
+ const [qPicks, setQPicks] = (0, import_react38.useState)([]);
91191
+ const [qCursor, setQCursor] = (0, import_react38.useState)(0);
91192
+ const [qChoice, setQChoice] = (0, import_react38.useState)(null);
91193
+ const [consultTop, setConsultTop] = (0, import_react38.useState)(0);
91194
+ const [sendingAsk, setSendingAsk] = (0, import_react38.useState)(null);
91195
+ const pendingAsk = (0, import_react38.useRef)(null);
91196
+ const [confirm, setConfirm] = (0, import_react38.useState)(null);
91197
+ const [trust, setTrust] = (0, import_react38.useState)(null);
91198
+ const [gate, setGate] = (0, import_react38.useState)("off");
91199
+ const [paused, setPaused] = (0, import_react38.useState)(false);
91200
+ const [reflections, setReflections] = (0, import_react38.useState)([]);
91201
+ const [why, setWhy] = (0, import_react38.useState)(null);
91202
+ const [offer, setOffer] = (0, import_react38.useState)(false);
90705
91203
  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);
91204
+ const attachRef = (0, import_react38.useRef)([]);
91205
+ const pasteRef = (0, import_react38.useRef)([]);
91206
+ const [queued, setQueued] = (0, import_react38.useState)([]);
91207
+ const inputRef = (0, import_react38.useRef)(null);
91208
+ const nextId = (0, import_react38.useRef)(0);
91209
+ const phaseRef = (0, import_react38.useRef)("connecting");
91210
+ const turnT0 = (0, import_react38.useRef)(null);
91211
+ const thinkT0 = (0, import_react38.useRef)(null);
91212
+ const thinkChars = (0, import_react38.useRef)(0);
91213
+ const thinkText = (0, import_react38.useRef)("");
91214
+ const draftRef = (0, import_react38.useRef)("");
91215
+ const thoughtRef = (0, import_react38.useRef)(null);
91216
+ const ledRef = (0, import_react38.useRef)(null);
91217
+ const toolsRef = (0, import_react38.useRef)({});
91218
+ const historyRef = (0, import_react38.useRef)(loadHistory());
91219
+ const modelRef = (0, import_react38.useRef)("");
91220
+ const heldRef = (0, import_react38.useRef)({ reads: [], calls: [] });
91221
+ const [held, setHeld] = (0, import_react38.useState)(heldRef.current);
91222
+ const outsRef = (0, import_react38.useRef)([]);
91223
+ const outNRef = (0, import_react38.useRef)(0);
91224
+ const helloRef = (0, import_react38.useRef)(false);
91225
+ const regainRef = (0, import_react38.useRef)(null);
91226
+ const [regaining, setRegaining] = (0, import_react38.useState)(false);
91227
+ const [wentAway, setWentAway] = (0, import_react38.useState)(false);
91228
+ (0, import_react38.useEffect)(() => {
91229
+ if (wentAway) exit();
91230
+ }, [wentAway]);
91231
+ const asksRef = (0, import_react38.useRef)([]);
91232
+ const startedRef = (0, import_react38.useRef)(false);
91233
+ const escRef = (0, import_react38.useRef)(0);
91234
+ const rewindRef = (0, import_react38.useRef)({ files: true, conversation: true });
91235
+ const wantRow = (0, import_react38.useRef)(null);
91236
+ const wroteRef = (0, import_react38.useRef)(false);
91237
+ const preHello = (0, import_react38.useRef)([]);
91238
+ const [meter, setMeter] = (0, import_react38.useState)({ tokens: 0, cap: 0, input: 0, output: 0 });
91239
+ const lastEnd = (0, import_react38.useRef)(null);
90730
91240
  const setPhaseBoth = (p) => {
90731
91241
  phaseRef.current = p;
90732
91242
  setPhase(p);
90733
91243
  };
90734
- const append = (item) => setItems((prev) => [...prev, { id: nextId.current++, ...item }]);
91244
+ const idleRef = (0, import_react38.useRef)(null);
91245
+ const hereNow = () => {
91246
+ if (idleRef.current) {
91247
+ idleRef.current();
91248
+ idleRef.current = null;
91249
+ }
91250
+ };
91251
+ const push = (item) => setItems((prev) => [...prev, { id: nextId.current++, ...item }]);
91252
+ const setHeldBoth = (h) => {
91253
+ heldRef.current = h;
91254
+ setHeld(h);
91255
+ };
91256
+ const printHeld = (keep = []) => {
91257
+ const h = heldRef.current;
91258
+ if (!h.reads.length && h.calls.length === keep.length) return;
91259
+ [...foldRows(h.reads), ...h.calls.filter((c) => !keep.includes(c)).map((c) => c.item)].forEach(push);
91260
+ setHeldBoth({ reads: [], calls: keep });
91261
+ };
91262
+ const append = (item) => {
91263
+ printHeld();
91264
+ push(item);
91265
+ };
91266
+ const holdCall = (ev, item) => {
91267
+ if (!READ_ONLY.has(ev.name)) printHeld(heldRef.current.calls);
91268
+ const what = ev.args && (ev.name === "read_file" ? ev.args.path : ev.args.pattern) || item.text;
91269
+ setHeldBoth({ ...heldRef.current, calls: [...heldRef.current.calls, { id: ev.id, name: ev.name, item, what, t0: Date.now() }] });
91270
+ };
91271
+ const keepOut = (name, content) => {
91272
+ const n = ++outNRef.current;
91273
+ outsRef.current = [...outsRef.current, { n, name, content: content || "" }].slice(-OUTPUTS_KEPT);
91274
+ return n;
91275
+ };
91276
+ const showOut = (o) => append({ kind: "output", name: `${o.name} \xB7 #${o.n}`, lines: o.content.split("\n") });
91277
+ const landResult = (ev, rowOf2) => {
91278
+ const h = heldRef.current;
91279
+ const call = h.calls.find((c) => c.id === ev.id);
91280
+ const rest = h.calls.filter((c) => c !== call);
91281
+ if (call && ev.ok && READ_ONLY.has(ev.name)) {
91282
+ const n = h.reads.length ? h.reads[0].n : keepOut(ev.name, ev.content);
91283
+ const reads = [...h.reads, { ...call, row: rowOf2(n), content: ev.content || "", n }];
91284
+ setHeldBoth({ reads, calls: rest });
91285
+ if (reads.length > 1) {
91286
+ const whole = { n, name: readsLabel(reads), content: reads.map((r) => `${r.what}
91287
+ ${r.content}`).join("\n\n") };
91288
+ outsRef.current = outsRef.current.map((o) => o.n === n ? whole : o);
91289
+ }
91290
+ return true;
91291
+ }
91292
+ printHeld(rest);
91293
+ if (rowOf2) push(rowOf2(keepOut(ev.name, ev.content)));
91294
+ return false;
91295
+ };
90735
91296
  const setAsks = (next) => {
90736
91297
  asksRef.current = next;
90737
91298
  setQuestions(next);
@@ -90742,6 +91303,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90742
91303
  setQAnswers({});
90743
91304
  setQPicks([]);
90744
91305
  setQCursor(0);
91306
+ setQChoice(null);
90745
91307
  };
90746
91308
  const askOf = (ev) => ({
90747
91309
  id: ev.id,
@@ -90753,6 +91315,16 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90753
91315
  summary: ev.summary || "",
90754
91316
  evidence: ev.evidence || []
90755
91317
  });
91318
+ const ASK_TITLES = { decision: "Decision", review: "Review", constraints: "Constraints" };
91319
+ const answeredItem = (ask, ev) => {
91320
+ const qs = ask ? ask.questions && ask.questions.length ? ask.questions : [{ id: ask.id, question: ask.question, options: ask.options, default: ask.default }] : [];
91321
+ const given = ev.answers || {};
91322
+ const entries = qs.filter((q) => given[q.id]).map((q) => ({ question: q.question, ...pickOf(q, given[q.id]) }));
91323
+ const whole = entries.length ? [] : [{ question: "", pick: null, why: String(given.reply ?? ev.answer ?? "") }];
91324
+ const count = qs.length > 1 && entries.length ? `${entries.length}/${qs.length} ` : "";
91325
+ const via = ev.via ? ` \xB7 from ${ev.via[0].toUpperCase()}${ev.via.slice(1)}` : "";
91326
+ return { kind: "answered", title: `\u2726 ${ASK_TITLES[ask?.kind] || "Clarification"} \xB7 ${count}answered${via}`, entries: [...entries, ...whole] };
91327
+ };
90756
91328
  const addAsk = (ev) => {
90757
91329
  if (asksRef.current.some((q) => q.id === ev.id)) return;
90758
91330
  const shown = asksRef.current.length > 0;
@@ -90770,41 +91342,85 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90770
91342
  const stepLabels = stepOptions.map((o) => o.label);
90771
91343
  const listAsk = !!(question && question.kind === "constraints" && question.questions && question.questions.length);
90772
91344
  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]
91345
+ const typedHead = step && step.graded ? value.trim().split(/\s+/)[0] : value.trim();
91346
+ const typedRow = /^[1-9]$/.test(typedHead) && Number(typedHead) <= stepLabels.length ? Number(typedHead) - 1 : null;
91347
+ const choiceRow = step && !step.multi && !listAsk ? typedRow ?? qChoice ?? stepLabels.indexOf(step.default) : -1;
91348
+ const ownRow = stepLabels.length;
91349
+ const ownMarked = !!(step && ownRow && !listAsk && typedRow === null && (step.multi ? qCursor : qChoice) === ownRow);
91350
+ const markedPick = step && step.graded && !step.multi && !listAsk && qChoice !== null && qChoice < ownRow ? qChoice + 1 : 0;
91351
+ const consult = (0, import_react38.useMemo)(
91352
+ () => question && step ? consultBody(question, step, Math.max(20, width - 4), qPicks, step.multi ? qCursor : choiceRow) : { text: [], rows: [], at: [0, 0] },
91353
+ [question, step, width, qPicks, qCursor, choiceRow]
90776
91354
  );
91355
+ const choosing = !!(step && stepLabels.length && !listAsk);
91356
+ const askHint = step && !listAsk ? fitStatus([
91357
+ choosing && { text: step.multi ? "a number ticks" : step.graded ? "\u2191\u2193 or a number marks" : "\u2191\u2193 or a number chooses on Enter" },
91358
+ choosing && step.multi && { text: "space ticks the one marked", drop: 3 },
91359
+ choosing && !step.multi && step.graded && { text: "words after it if you like", drop: 3 },
91360
+ !step.graded && { text: "type or paste your answer", drop: 2 },
91361
+ !step.graded && { text: "Alt+Enter adds a line", drop: 1 },
91362
+ ownMarked ? null : !step.multi && qChoice !== null ? { text: "enter takes the one marked" } : step.default && { text: "enter takes the default" },
91363
+ !step.default && step.optional && (step.multi || qChoice === null) && { text: "enter says nothing" },
91364
+ step.multi && stepLabels.length && { text: "enter takes what is ticked" },
91365
+ step.secret && { text: "it is not shown and not recorded" }
91366
+ ], width - 4) : "";
90777
91367
  const consultHeight = Math.max(4, Math.min(18, Math.floor((stdout?.rows || DEFAULT_ROWS) / 2)));
90778
- const consultStart = Math.min(consultTop, Math.max(0, consultLines.length - consultHeight));
91368
+ const consultView = consultWindow(consult, consultHeight, consultTop);
90779
91369
  const menu = !question && value.trimStart().startsWith("/") && !value.includes(" ") ? COMMANDS.filter((c) => c.name.startsWith(value.trim())) : [];
91370
+ const atTyped = !question && !menu.length && !search ? (value.match(AT_TAIL) || [])[1] || "" : "";
91371
+ const atWord = atTyped === atShut ? "" : atTyped;
91372
+ const atRoot = hello?.cwd || process.cwd();
91373
+ const atFiles = (0, import_react38.useMemo)(() => atWord ? walkFiles(atRoot) : [], [!!atWord, atRoot]);
91374
+ const files = (0, import_react38.useMemo)(() => {
91375
+ const q = atWord.toLowerCase();
91376
+ return q ? atFiles.filter((f) => f.toLowerCase().includes(q) && f !== atWord).slice(0, FILE_ROWS) : [];
91377
+ }, [atWord, atFiles]);
91378
+ const acceptFile = () => {
91379
+ const pick = files[Math.min(menuIndex, files.length - 1)];
91380
+ if (!pick || !inputRef.current) return;
91381
+ inputRef.current.complete(value.length - atWord.length, pick.endsWith("/") ? pick : `${pick} `);
91382
+ };
90780
91383
  const ctxPct = meter.cap > 0 && meter.tokens > 0 ? Math.round(meter.tokens / meter.cap * 100) : 0;
90781
- (0, import_react36.useEffect)(() => {
91384
+ (0, import_react38.useEffect)(() => {
90782
91385
  if (phase !== "busy" && phase !== "connecting") return void 0;
90783
91386
  const started = Date.now();
90784
91387
  setElapsed(0);
90785
- const t = setInterval(() => setElapsed(Math.floor((Date.now() - started) / 1e3)), 1e3);
90786
- return () => clearInterval(t);
91388
+ let ticks = 0;
91389
+ let off = () => {
91390
+ };
91391
+ const tick = () => {
91392
+ ticks += 1;
91393
+ setElapsed(Math.max(ticks, Math.floor((Date.now() - started) / ELAPSED_TICK_MS)));
91394
+ off = after2(ELAPSED_TICK_MS, tick);
91395
+ };
91396
+ off = after2(ELAPSED_TICK_MS, tick);
91397
+ return () => off();
90787
91398
  }, [phase]);
90788
91399
  const foldThinking = () => {
90789
91400
  if (thinkChars.current > 0) {
90790
91401
  const secs = thinkT0.current ? (Date.now() - thinkT0.current) / 1e3 : 0;
90791
- thoughtRef.current = { kind: "thought", text: `thought for ${fmtDur(secs)}` };
91402
+ thoughtRef.current = { kind: "thought", text: `thought for ${fmtDur(secs)}`, whole: thinkText.current };
90792
91403
  }
90793
- setThinking("");
91404
+ thinkText.current = "";
90794
91405
  thinkChars.current = 0;
90795
91406
  thinkT0.current = null;
90796
91407
  };
90797
91408
  const resetForSession = () => {
91409
+ regainRef.current = null;
91410
+ setRegaining(false);
90798
91411
  setAgents([]);
90799
91412
  setPanelIndex(-1);
90800
91413
  closeLook();
90801
91414
  setItems([]);
91415
+ setHeldBoth({ reads: [], calls: [] });
90802
91416
  setTranscriptEpoch((n) => n + 1);
90803
91417
  setDraft("");
90804
91418
  draftRef.current = "";
90805
91419
  thoughtRef.current = null;
90806
- setThinking("");
91420
+ ledRef.current = null;
91421
+ thinkText.current = "";
90807
91422
  thinkChars.current = 0;
91423
+ setPlanSteps([]);
90808
91424
  setProposal(null);
90809
91425
  setAsks([]);
90810
91426
  pendingAsk.current = null;
@@ -90820,10 +91436,12 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90820
91436
  setStatus("");
90821
91437
  turnT0.current = null;
90822
91438
  toolsRef.current = {};
90823
- lastOutRef.current = null;
91439
+ outsRef.current = [];
91440
+ outNRef.current = 0;
90824
91441
  attachRef.current = [];
90825
91442
  setOffer(false);
90826
91443
  wroteRef.current = false;
91444
+ setQueued([]);
90827
91445
  setMeter((m) => ({ ...m, tokens: 0, input: 0, output: 0 }));
90828
91446
  };
90829
91447
  const closeLook = () => {
@@ -90850,14 +91468,14 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90850
91468
  append({ kind: "warn", text: `could not look at ${row.name}: ${e.message}` });
90851
91469
  }
90852
91470
  };
91471
+ const thoughtRow = (text, whole) => ({ kind: "thought", text: whole ? `${text} (ctrl+o expands \xB7 #${keepOut("thought", whole)})` : text });
90853
91472
  const flushDraft = () => {
90854
91473
  const d = draftRef.current.trim();
90855
91474
  draftRef.current = "";
90856
91475
  if (d) append({ kind: "hum", text: d });
90857
- if (thoughtRef.current) {
90858
- append(thoughtRef.current);
90859
- thoughtRef.current = null;
90860
- }
91476
+ if (d && ledRef.current) append(thoughtRow(ledRef.current.text, ledRef.current.whole));
91477
+ ledRef.current = null;
91478
+ thoughtRef.current = null;
90861
91479
  setDraft("");
90862
91480
  };
90863
91481
  const handle = (ev) => {
@@ -90874,6 +91492,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90874
91492
  case "busy":
90875
91493
  setPhaseBoth("busy");
90876
91494
  setStatus(ev.phase || "");
91495
+ setStatusOf(ev.of || "");
90877
91496
  return;
90878
91497
  case "plan":
90879
91498
  case "hypotheses":
@@ -90910,7 +91529,30 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90910
91529
  case "update":
90911
91530
  setLatest({ version: ev.version || "", latest_version: ev.latest_version || "", release_notes_url: ev.release_notes_url || "" });
90912
91531
  break;
91532
+ case "reconnecting":
91533
+ regainRef.current = "trying";
91534
+ setRegaining(true);
91535
+ break;
90913
91536
  case "hello": {
91537
+ if (regainRef.current) {
91538
+ regainRef.current = "greeted";
91539
+ setRegaining(false);
91540
+ setHello(ev);
91541
+ modelRef.current = ev.model;
91542
+ setGate(ev.gate === "approve" ? "approve" : "off");
91543
+ (ev.questions || []).forEach(addAsk);
91544
+ if (ev.busy) {
91545
+ setPhaseBoth("busy");
91546
+ setStatus(ev.phase || "");
91547
+ setStatusOf("");
91548
+ } else {
91549
+ foldThinking();
91550
+ flushDraft();
91551
+ setPhaseBoth("idle");
91552
+ setStatus("");
91553
+ }
91554
+ break;
91555
+ }
90914
91556
  if (helloRef.current) resetForSession();
90915
91557
  setHello(ev);
90916
91558
  helloRef.current = true;
@@ -90932,6 +91574,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90932
91574
  if (ev.busy) {
90933
91575
  setPhaseBoth("busy");
90934
91576
  setStatus(ev.phase || "");
91577
+ setStatusOf("");
90935
91578
  turnT0.current = Date.now();
90936
91579
  } else setPhaseBoth("idle");
90937
91580
  }
@@ -90954,26 +91597,41 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90954
91597
  break;
90955
91598
  }
90956
91599
  case "replay":
91600
+ if (regainRef.current === "greeted") {
91601
+ regainRef.current = null;
91602
+ break;
91603
+ }
90957
91604
  const ordered = [];
91605
+ let thought = null;
90958
91606
  for (const it of ev.items || []) {
90959
- const prev = ordered[ordered.length - 1];
90960
- if (it.type === "text" && prev && prev.type === "thought") ordered.splice(ordered.length - 1, 0, it);
90961
- else ordered.push(it);
91607
+ if (it.type === "thought") {
91608
+ thought = it;
91609
+ continue;
91610
+ }
91611
+ ordered.push(it);
91612
+ if (it.type === "text" && thought) ordered.push(thought);
91613
+ thought = null;
90962
91614
  }
90963
91615
  for (const it of ordered) {
90964
91616
  switch (it.type) {
90965
91617
  case "you":
90966
91618
  append({ kind: "you", text: it.text, images: it.images || [] });
90967
91619
  break;
91620
+ case "question_closed":
91621
+ append(answeredItem(it.ask ? askOf(it.ask) : null, it));
91622
+ break;
91623
+ // the block it left live
90968
91624
  case "text":
90969
91625
  append({ kind: "hum", text: it.text });
90970
91626
  break;
90971
91627
  case "thought":
90972
- append({ kind: "thought", text: `thought for ${fmtDur(it.secs || 0)}` });
91628
+ append(thoughtRow(`thought for ${fmtDur(it.secs || 0)}`, it.text));
90973
91629
  break;
90974
91630
  case "tool_call": {
90975
91631
  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 });
91632
+ const row = { kind: "tool", text: callLabel(it), name: it.name, args: it.args, agent: it.agent };
91633
+ if (it.agent || it.diff) append(row);
91634
+ else holdCall(it, row);
90977
91635
  if (it.diff) {
90978
91636
  const ls = it.diff.split("\n");
90979
91637
  append({ kind: "diff", lines: ls.slice(0, DIFF_TAIL_LINES), more: Math.max(0, ls.length - DIFF_TAIL_LINES) });
@@ -90981,21 +91639,21 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
90981
91639
  break;
90982
91640
  }
90983
91641
  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 });
91642
+ const more = (n) => (it.lines || 0) > 1 ? ` (+${it.lines - 1} lines${n ? ` \xB7 #${n}` : ""})` : "";
91643
+ const rowOf2 = (n) => ({ kind: "tool_result", text: `${it.summary || "(no output)"}${more(n)}`, isError: !it.ok, agent: it.agent });
91644
+ if (it.agent) append(rowOf2(0));
91645
+ else landResult(it, it.ok && rowStands(toolsRef.current[it.id]) ? null : rowOf2);
90987
91646
  break;
90988
91647
  }
90989
- case "plan": {
90990
- const glyph = { completed: "\u25FC", in_progress: "\u25B8", pending: "\u25FB" };
90991
- append({ kind: "plan", steps: (it.steps || []).map((st) => ({ ...st, glyph: glyph[st.status] || "\u25FB" })), explanation: it.explanation });
91648
+ case "plan":
91649
+ if (!it.agent) setPlanSteps(it.steps || []);
91650
+ append({ kind: "plan", steps: (it.steps || []).map((st) => ({ ...st, glyph: PLAN_GLYPH[st.status] || PLAN_GLYPH.pending })), explanation: it.explanation });
90992
91651
  break;
90993
- }
90994
91652
  case "hypotheses":
90995
91653
  append({ kind: "hypotheses", hypotheses: (it.hypotheses || []).map((h) => ({ ...h, glyph: HYPOTHESIS_GLYPH[h.status] || "\u25FB" })), explanation: it.explanation });
90996
91654
  break;
90997
91655
  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)}` });
91656
+ append({ kind: "turn", text: `${fmtDur(it.elapsed_s || 0)} \xB7 ${plural(it.turns, "step")} \xB7 ${fmtCost2(it.cost_usd)} session` });
90999
91657
  setSpend(it.cost_usd || 0);
91000
91658
  lastEnd.current = it;
91001
91659
  break;
@@ -91064,36 +91722,43 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91064
91722
  if (ev.model) modelRef.current = ev.model;
91065
91723
  break;
91066
91724
  case "turn_start":
91725
+ hereNow();
91067
91726
  turnT0.current = turnT0.current || Date.now();
91068
91727
  setPhaseBoth("busy");
91069
91728
  break;
91070
91729
  case "busy":
91071
91730
  setPhaseBoth("busy");
91072
91731
  setStatus(ev.phase || "");
91732
+ setStatusOf(ev.of || "");
91073
91733
  break;
91074
91734
  case "idle":
91075
91735
  setPhaseBoth("idle");
91076
91736
  setStatus("");
91737
+ printHeld();
91077
91738
  break;
91078
91739
  case "reasoning_delta":
91079
91740
  if (!thinkT0.current) thinkT0.current = Date.now();
91080
91741
  thinkChars.current += ev.text.length;
91081
- setThinking((t) => t + ev.text);
91742
+ thinkText.current += ev.text;
91082
91743
  break;
91083
91744
  case "text_delta":
91084
- if (thinkChars.current > 0) foldThinking();
91745
+ if (thinkChars.current > 0) {
91746
+ foldThinking();
91747
+ ledRef.current = thoughtRef.current;
91748
+ }
91085
91749
  draftRef.current += ev.text;
91086
91750
  setDraft((d) => d + ev.text);
91087
91751
  break;
91088
91752
  case "tool_pending":
91089
91753
  break;
91090
- // the status line already shows it; the call itself lands as a transcript line
91754
+ // the call itself lands as a transcript line
91091
91755
  case "tool_call": {
91092
91756
  foldThinking();
91093
91757
  flushDraft();
91094
91758
  toolsRef.current[ev.id] = ev;
91095
- 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 });
91759
+ const row = { kind: "tool", text: callLabel(ev), name: ev.name, args: ev.args };
91760
+ if (ev.diff) append(row);
91761
+ else holdCall(ev, row);
91097
91762
  if (ev.diff) {
91098
91763
  const ls = ev.diff.split("\n");
91099
91764
  append({ kind: "diff", lines: ls.slice(0, DIFF_TAIL_LINES), more: Math.max(0, ls.length - DIFF_TAIL_LINES) });
@@ -91101,24 +91766,24 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91101
91766
  break;
91102
91767
  }
91103
91768
  case "tool_result": {
91104
- lastOutRef.current = { name: ev.name, content: ev.content || "" };
91105
91769
  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 });
91770
+ const more = (n) => (ev.lines || 0) > 1 ? ` (+${ev.lines - 1} lines \xB7 ctrl+o expands \xB7 #${n})` : "";
91771
+ const rowOf2 = (n) => ({ kind: "tool_result", text: `${ev.summary || "(no output)"}${more(n)}`, isError: !ev.ok });
91772
+ if (landResult(ev, ev.ok && rowStands(toolsRef.current[ev.id]) ? null : rowOf2)) break;
91108
91773
  if (!ev.ok && ev.diagnostics && ev.diagnostics.length) {
91109
- append({ kind: "errtail", lines: ev.diagnostics.map(diagLine) });
91774
+ push({ kind: "errtail", lines: ev.diagnostics.map(diagLine) });
91110
91775
  } else if (!ev.ok && ev.content) {
91111
91776
  const t = ev.content.split("\n").filter((l) => l.trim()).slice(-ERR_TAIL_LINES);
91112
- if (t.length > 1) append({ kind: "errtail", lines: t });
91777
+ if (t.length > 1) push({ kind: "errtail", lines: t });
91113
91778
  }
91114
- if (ev.spool) append({ kind: "spool", text: `${ev.spool}/` });
91779
+ if (ev.spool) push({ kind: "spool", text: `${ev.spool}/` });
91115
91780
  break;
91116
91781
  }
91117
91782
  case "plan": {
91118
91783
  foldThinking();
91119
91784
  flushDraft();
91120
- const glyph = { completed: "\u25FC", in_progress: "\u25B8", pending: "\u25FB" };
91121
- append({ kind: "plan", steps: (ev.steps || []).map((st) => ({ ...st, glyph: glyph[st.status] || "\u25FB" })), explanation: ev.explanation });
91785
+ setPlanSteps(ev.steps || []);
91786
+ append({ kind: "plan", steps: (ev.steps || []).map((st) => ({ ...st, glyph: PLAN_GLYPH[st.status] || PLAN_GLYPH.pending })), explanation: ev.explanation });
91122
91787
  break;
91123
91788
  }
91124
91789
  case "hypotheses": {
@@ -91135,30 +91800,34 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91135
91800
  });
91136
91801
  setProposal({ content: ev.content || "", calls: ev.calls || [], remember: ev.remember || [], remember_text: ev.remember_text || "", agent: ev.agent || null });
91137
91802
  setStatus("waiting for your decision");
91803
+ setStatusOf("");
91138
91804
  break;
91139
91805
  case "question":
91140
91806
  foldThinking();
91141
91807
  flushDraft();
91142
91808
  addAsk(ev);
91143
91809
  break;
91144
- case "question_closed":
91810
+ case "question_closed": {
91145
91811
  if (pendingAsk.current?.id === ev.id) {
91146
- append({ kind: "you", text: pendingAsk.current.display });
91147
91812
  pendingAsk.current = null;
91148
91813
  setSendingAsk(null);
91149
91814
  setValue("");
91150
91815
  }
91816
+ const closing = asksRef.current.find((q) => q.id === ev.id);
91817
+ if (closing) append(answeredItem(closing, ev));
91151
91818
  dropAsk(ev.id);
91152
- append({ kind: "info", text: `answered: ${ev.answer}` });
91153
91819
  break;
91820
+ }
91154
91821
  case "mcp":
91155
91822
  append({ kind: "mcp", servers: ev.servers || [] });
91156
91823
  break;
91157
91824
  case "memory": {
91158
91825
  const items2 = ev.items || [];
91159
- append({ kind: "info", text: `memory: ${ev.dir}${items2.some((i) => i.source === "repo") ? ` \xB7 shared: ${ev.repo_dir}` : ""}` });
91160
- if (!items2.length) append({ kind: "info", text: "nothing remembered yet; the model writes here with remember, and you may edit the files by hand" });
91161
- for (const it of items2) append({ kind: "info", text: ` ${it.name} (${it.type}${it.source === "repo" ? ", shared" : ""}): ${it.description}` });
91826
+ append({ kind: "info", text: [
91827
+ `memory: ${ev.dir}${items2.some((i) => i.source === "repo") ? ` \xB7 shared: ${ev.repo_dir}` : ""}`,
91828
+ ...items2.length ? [] : ["nothing remembered yet; the model writes here with remember, and you may edit the files by hand"],
91829
+ ...items2.map((it) => ` ${it.name} (${it.type}${it.source === "repo" ? ", shared" : ""}): ${it.description}`)
91830
+ ].join("\n") });
91162
91831
  break;
91163
91832
  }
91164
91833
  case "reflection":
@@ -91222,8 +91891,10 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91222
91891
  case "rewind": {
91223
91892
  setConfirm(null);
91224
91893
  const did = [ev.files ? "the files" : null, ev.conversation ? "the conversation" : null].filter(Boolean).join(" and ");
91225
- append({ kind: "info", text: `back to \u201C${(ev.said || "").slice(0, 60)}\u201D \xB7 ${did} restored` });
91226
- if (ev.stat) append({ kind: "info", text: ` ${String(ev.stat).split("\n").filter((l) => l.trim()).join("\n ")}` });
91894
+ append({ kind: "info", text: [
91895
+ `back to \u201C${(ev.said || "").slice(0, 60)}\u201D \xB7 ${did} restored`,
91896
+ ...String(ev.stat || "").split("\n").filter((l) => l.trim()).map((l) => ` ${l}`)
91897
+ ].join("\n") });
91227
91898
  break;
91228
91899
  }
91229
91900
  case "goal":
@@ -91256,17 +91927,18 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91256
91927
  case "turn_end": {
91257
91928
  foldThinking();
91258
91929
  flushDraft();
91259
- if (ev.tally && Object.keys(ev.tally).length) append({ kind: "tally", text: tallyLine(ev.tally) });
91260
91930
  setMeter((m) => ({ ...m, tokens: ev.context_tokens ?? m.tokens, input: ev.input_tokens || 0, output: ev.output_tokens || 0 }));
91261
91931
  setSpend(ev.cost_usd);
91262
91932
  lastEnd.current = ev;
91263
91933
  const dur = turnT0.current ? fmtDur((Date.now() - turnT0.current) / 1e3) : fmtDur(ev.elapsed_s);
91264
91934
  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}` : "") });
91935
+ 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
91936
  if (wroteRef.current) setOffer(true);
91267
91937
  wroteRef.current = false;
91268
91938
  setPhaseBoth("idle");
91269
91939
  setStatus("");
91940
+ hereNow();
91941
+ if (!asksRef.current.length && !String(ev.stop_reason).startsWith("paused")) idleRef.current = after2(IDLE_WAIT_MS, () => tty3(ring("hum finished")));
91270
91942
  break;
91271
91943
  }
91272
91944
  case "image": {
@@ -91298,7 +91970,14 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91298
91970
  setStatus("");
91299
91971
  break;
91300
91972
  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" });
91973
+ regainRef.current = null;
91974
+ setRegaining(false);
91975
+ if (ev.gone && phaseRef.current !== "dead") {
91976
+ append({ kind: "error", text: "the session's process went away \xB7 `hum resume` brings it back" });
91977
+ setPhaseBoth("dead");
91978
+ setWentAway(true);
91979
+ break;
91980
+ }
91302
91981
  setPhaseBoth("dead");
91303
91982
  exit();
91304
91983
  break;
@@ -91306,18 +91985,28 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91306
91985
  break;
91307
91986
  }
91308
91987
  };
91309
- (0, import_react36.useEffect)(() => {
91988
+ (0, import_react38.useEffect)(() => {
91310
91989
  core2.on(handle);
91311
91990
  }, []);
91312
- (0, import_react36.useEffect)(() => {
91991
+ const waitingOn = question ? `ask ${question.id}` : proposal ? "proposal" : paused ? "pause" : trust ? "trust" : confirm ? "confirm" : "";
91992
+ const dir = hello && hello.cwd || process.cwd();
91993
+ (0, import_react38.useEffect)(() => {
91994
+ tty3(title(titleOf(dir, !!waitingOn)));
91995
+ }, [dir, !!waitingOn]);
91996
+ (0, import_react38.useEffect)(() => waitingOn ? after2(ASK_WAIT_MS, () => tty3(ring("hum needs you"))) : void 0, [waitingOn]);
91997
+ (0, import_react38.useEffect)(() => () => {
91998
+ hereNow();
91999
+ tty3(title(""));
92000
+ }, []);
92001
+ (0, import_react38.useEffect)(() => {
91313
92002
  const mine = hello && hello.run_id;
91314
92003
  const count = () => setNeedYou(needCount(liveRows(), mine));
91315
92004
  count();
91316
92005
  const t = setInterval(count, NEEDS_EVERY_MS);
91317
92006
  return () => clearInterval(t);
91318
92007
  }, [hello && hello.run_id]);
91319
- const noticedRef = (0, import_react36.useRef)("");
91320
- (0, import_react36.useEffect)(() => {
92008
+ const noticedRef = (0, import_react38.useRef)("");
92009
+ (0, import_react38.useEffect)(() => {
91321
92010
  if (!latest) return void 0;
91322
92011
  const mine = MINE2 || latest.version || "0.0.0";
91323
92012
  const want = latest.latest_version || "";
@@ -91348,7 +92037,10 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91348
92037
  exit();
91349
92038
  }, 2500);
91350
92039
  };
92040
+ const answering = !!(proposal || question || picker || confirm || trust || looking || reflection || search);
92041
+ const escOwned = answering || files.length > 0 || panelIndex >= 0;
91351
92042
  use_input_default((input, key) => {
92043
+ hereNow();
91352
92044
  if (key.ctrl && input === "c") {
91353
92045
  if (ctrlc > 0) {
91354
92046
  quit();
@@ -91364,10 +92056,8 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91364
92056
  return;
91365
92057
  }
91366
92058
  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
- }
92059
+ const last = outsRef.current.at(-1);
92060
+ if (last && last.content) showOut(last);
91371
92061
  return;
91372
92062
  }
91373
92063
  if (looking) {
@@ -91497,35 +92187,56 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91497
92187
  if (question && step && !picker) {
91498
92188
  if (key.pageDown || key.pageUp) {
91499
92189
  setConsultTop(Math.max(0, Math.min(
91500
- consultLines.length - consultHeight,
91501
- consultStart + (key.pageDown ? consultHeight : -consultHeight)
92190
+ consult.text.length - consultView.textHeight,
92191
+ consultView.textStart + (key.pageDown ? consultView.textHeight : -consultView.textHeight)
91502
92192
  )));
91503
92193
  return;
91504
92194
  }
91505
92195
  if (key.escape || sendingAsk) return;
91506
- if (!listAsk && question.kind !== "decision") {
92196
+ if (!listAsk) {
91507
92197
  const n = stepLabels.length;
91508
- if (step.multi && n) {
92198
+ const rows2 = n ? n + 1 : 0;
92199
+ if (step.multi && n && !value.trim()) {
91509
92200
  if (key.upArrow) {
91510
- setQCursor((c) => (c + n - 1) % n);
92201
+ setQCursor((c) => (c + rows2 - 1) % rows2);
91511
92202
  return;
91512
92203
  }
91513
92204
  if (key.downArrow || key.tab) {
91514
- setQCursor((c) => (c + 1) % n);
92205
+ setQCursor((c) => (c + 1) % rows2);
91515
92206
  return;
91516
92207
  }
91517
92208
  if (input === " " && !value.trim()) {
91518
- togglePick(stepLabels[Math.min(qCursor, n - 1)]);
92209
+ if (qCursor < n) togglePick(stepLabels[qCursor]);
91519
92210
  return;
91520
92211
  }
91521
92212
  }
92213
+ if (n && !value.trim() && input === String(rows2)) {
92214
+ if (step.multi) setQCursor(n);
92215
+ else setQChoice(n);
92216
+ return;
92217
+ }
91522
92218
  if (step.multi && !value.trim() && /^[1-9]$/.test(input) && Number(input) <= n) {
91523
92219
  const label = stepLabels[Number(input) - 1];
91524
92220
  setQCursor(Number(input) - 1);
91525
92221
  togglePick(label);
91526
92222
  return;
91527
92223
  }
92224
+ if (!step.multi && n && !value.trim()) {
92225
+ if (key.upArrow) {
92226
+ setQChoice(choiceRow < 0 ? rows2 - 1 : (choiceRow + rows2 - 1) % rows2);
92227
+ return;
92228
+ }
92229
+ if (key.downArrow) {
92230
+ setQChoice((choiceRow + 1) % rows2);
92231
+ return;
92232
+ }
92233
+ }
91528
92234
  if (key.return && !key.meta && !key.shift && !value.trim()) {
92235
+ if (ownMarked) return;
92236
+ if (!step.multi && qChoice !== null) {
92237
+ answerStep(String(qChoice + 1));
92238
+ return;
92239
+ }
91529
92240
  if (step.multi && qPicks.length) {
91530
92241
  answerStep(qPicks.join(", "));
91531
92242
  return;
@@ -91591,13 +92302,34 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91591
92302
  else if (input.length === 1 && !key.ctrl && !key.meta && input >= " ") setPicker((p) => ({ ...p, query: p.query + input, index: 0, top: 0 }));
91592
92303
  return;
91593
92304
  }
91594
- if (menu.length > 0) {
92305
+ if (files.length > 0) {
92306
+ if (key.upArrow) setMenuIndex((i) => (Math.min(i, files.length - 1) + files.length - 1) % files.length);
92307
+ else if (key.downArrow) setMenuIndex((i) => (Math.min(i, files.length - 1) + 1) % files.length);
92308
+ else if (key.tab || key.return) acceptFile();
92309
+ else if (key.escape) setAtShut(atWord);
92310
+ return;
92311
+ }
92312
+ if (menu.length > 0 && !key.escape) {
91595
92313
  if (key.upArrow) setMenuIndex((i) => (i + menu.length - 1) % menu.length);
91596
92314
  else if (key.downArrow) setMenuIndex((i) => (i + 1) % menu.length);
91597
92315
  else if (key.tab) setValue(menu[Math.min(menuIndex, menu.length - 1)].name + " ");
91598
92316
  return;
91599
92317
  }
92318
+ if (key.tab && phaseRef.current === "busy" && !answering && value.trim() && !/^[/!]/.test(value.trim())) {
92319
+ const raw = value.trim();
92320
+ remember(raw);
92321
+ setQueued((q) => [...q, raw]);
92322
+ setValue("");
92323
+ return;
92324
+ }
92325
+ if (key.upArrow && !value && queued.length && !answering) {
92326
+ const last = queued[queued.length - 1];
92327
+ setQueued((q) => q.slice(0, -1));
92328
+ if (inputRef.current) inputRef.current.paste(last);
92329
+ return;
92330
+ }
91600
92331
  if (key.escape) {
92332
+ if (search) return;
91601
92333
  if (phaseRef.current === "busy") {
91602
92334
  core2.send({ cmd: "interrupt" });
91603
92335
  escRef.current = 0;
@@ -91606,13 +92338,20 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91606
92338
  const now = Date.now();
91607
92339
  if (now - escRef.current < ESC_ESC_MS) {
91608
92340
  escRef.current = 0;
91609
- core2.send({ cmd: "rewind_list" });
92341
+ const kept = value.trim();
92342
+ if (!kept) {
92343
+ core2.send({ cmd: "rewind_list" });
92344
+ return;
92345
+ }
92346
+ remember(kept);
92347
+ setValue("");
91610
92348
  return;
91611
92349
  }
91612
92350
  escRef.current = now;
91613
92351
  }
92352
+ if (input === "?" && !value.trim() && !question && !proposal && !reflection) append({ kind: "help" });
91614
92353
  });
91615
- (0, import_react36.useEffect)(() => {
92354
+ (0, import_react38.useEffect)(() => {
91616
92355
  setMenuIndex(0);
91617
92356
  }, [value]);
91618
92357
  const attachTo = (port2, runId) => {
@@ -91625,22 +92364,22 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91625
92364
  setPhaseBoth("idle");
91626
92365
  });
91627
92366
  };
91628
- const decide = (decision, note, remember) => {
92367
+ const decide = (decision, note, remember2) => {
91629
92368
  const p = proposal;
91630
92369
  setProposal(null);
91631
92370
  setValue("");
91632
92371
  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"}` : "";
92372
+ const also = remember2 ? ` \xB7 ${p.remember_text || "that shape"} allowed for ${remember2 === "session" ? "this session" : "this project"}` : "";
91634
92373
  append({ kind: "you", text: decision === "accept" ? `approved: ${what}${also}` : `rejected: ${what}${note ? ` \u2014 ${note}` : ""}` });
91635
- core2.send({ cmd: "decide", decision, note: note || "", ...remember ? { remember } : {} });
92374
+ core2.send({ cmd: "decide", decision, note: note || "", ...remember2 ? { remember: remember2 } : {} });
91636
92375
  };
91637
92376
  const togglePick = (label) => {
91638
92377
  setValue("");
91639
92378
  setQPicks((ps) => ps.includes(label) ? ps.filter((x) => x !== label) : [...ps, label]);
91640
92379
  };
91641
- const submitAsk = (payload, display) => {
92380
+ const submitAsk = (payload) => {
91642
92381
  if (!question || pendingAsk.current) return;
91643
- pendingAsk.current = { id: question.id, display };
92382
+ pendingAsk.current = { id: question.id };
91644
92383
  setSendingAsk(question.id);
91645
92384
  if (core2.send({ cmd: "answer", id: question.id, ...payload }) === false) {
91646
92385
  pendingAsk.current = null;
@@ -91651,30 +92390,29 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91651
92390
  const holdAll = () => {
91652
92391
  if (!listAsk) return;
91653
92392
  const answers = Object.fromEntries(question.questions.map((q) => [q.id, q.id === "missed" ? "" : "holds"]));
91654
- submitAsk({ answers }, `held all ${listRows.length} as stated`);
92393
+ submitAsk({ answers });
91655
92394
  };
91656
92395
  const answerWhole = (text) => {
91657
92396
  if (!text.trim() || /^\d+$/.test(text.trim())) {
91658
92397
  append({ kind: "warn", text: "say what the number means, or type /hold to confirm every constraint" });
91659
92398
  return;
91660
92399
  }
91661
- submitAsk({ text }, text);
92400
+ submitAsk({ text });
91662
92401
  };
91663
92402
  const answerStep = (text) => {
91664
92403
  if (!question || !step) return;
91665
- const display = step.secret ? "(kept to yourself)" : text || (step.default ? `(the default: ${step.default})` : "(nothing)");
91666
92404
  const answers = { ...qAnswers, [step.id]: text };
91667
92405
  if (qStep + 1 < steps.length) {
91668
92406
  setValue("");
91669
- append({ kind: "you", text: display });
91670
92407
  setQAnswers(answers);
91671
92408
  setQStep(qStep + 1);
91672
92409
  setConsultTop(0);
91673
92410
  setQPicks([]);
91674
92411
  setQCursor(0);
92412
+ setQChoice(null);
91675
92413
  return;
91676
92414
  }
91677
- submitAsk({ answers }, display);
92415
+ submitAsk({ answers });
91678
92416
  };
91679
92417
  const vote = (polarity, why2 = "") => {
91680
92418
  core2.send({ cmd: polarity > 0 ? "accept" : "reject", ...why2 ? { why: why2 } : {} });
@@ -91696,7 +92434,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91696
92434
  stop();
91697
92435
  break;
91698
92436
  case "/help":
91699
- append({ kind: "info", text: HELP });
92437
+ append({ kind: "help" });
91700
92438
  break;
91701
92439
  case "/resume":
91702
92440
  core2.send({ cmd: "sessions" });
@@ -91720,6 +92458,24 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91720
92458
  case "/context":
91721
92459
  core2.send({ cmd: "context" });
91722
92460
  break;
92461
+ case "/expand": {
92462
+ const outs = outsRef.current;
92463
+ if (!outs.length) {
92464
+ append({ kind: "info", text: "no tool result to expand yet" });
92465
+ break;
92466
+ }
92467
+ const o = arg ? outs.find((x) => String(x.n) === arg) : outs.at(-1);
92468
+ if (!o) {
92469
+ append({ kind: "info", text: `no result #${arg} \xB7 the last ${OUTPUTS_KEPT} are kept: #${outs[0].n} to #${outs.at(-1).n}` });
92470
+ break;
92471
+ }
92472
+ if (!o.content) {
92473
+ append({ kind: "info", text: `#${o.n} had no output` });
92474
+ break;
92475
+ }
92476
+ showOut(o);
92477
+ break;
92478
+ }
91723
92479
  case "/rewind":
91724
92480
  wantRow.current = /^\d+$/.test(arg) ? Number(arg) : null;
91725
92481
  core2.send({ cmd: "rewind_list" });
@@ -91796,28 +92552,62 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91796
92552
  };
91797
92553
  const CHIP_CHARS = 800, CHIP_LINES = 3;
91798
92554
  const onPaste = (text) => {
92555
+ hereNow();
91799
92556
  if (!inputRef.current) return;
91800
92557
  const lines = text.split("\n").length;
91801
92558
  if (text.length <= CHIP_CHARS && lines <= CHIP_LINES) {
91802
92559
  inputRef.current.paste(text);
91803
92560
  return;
91804
92561
  }
91805
- const n = pasteRef.current.length + 1;
92562
+ const n = Math.max(0, ...pasteIds(), ...pasteRef.current.map((p) => p.n)) + 1;
91806
92563
  const chip = `[Pasted text #${n} +${lines} lines]`;
91807
92564
  pasteRef.current = [...pasteRef.current, { n, chip, text, lines }];
92565
+ savePaste(n, text);
91808
92566
  inputRef.current.paste(chip);
91809
92567
  };
91810
92568
  const expandPastes = (s) => s.replace(CHIP, (m, n) => {
91811
- const p = pasteRef.current[Number(n) - 1];
91812
- return p ? p.text : m;
92569
+ const p = pasteRef.current.find((x) => x.n === Number(n));
92570
+ return (p ? p.text : readPaste(Number(n))) ?? m;
91813
92571
  });
92572
+ const cwd2 = hello?.cwd || process.cwd();
92573
+ const remember = (text) => {
92574
+ const rows2 = historyRef.current;
92575
+ const last = rows2.findLast((r) => r.cwd === cwd2);
92576
+ if (last && last.text === text) return;
92577
+ rows2.push({ cwd: cwd2, text, at: Date.now() });
92578
+ saveHistory(rows2);
92579
+ };
92580
+ const partsOf = (raw) => {
92581
+ const text = expandPastes(raw);
92582
+ const waiting = attachRef.current;
92583
+ const attached = text ? waiting.filter((a) => text.includes(a.chip)) : waiting;
92584
+ return { text, attached, dropped: waiting.filter((a) => !attached.includes(a)) };
92585
+ };
92586
+ const sendMessage = (raw) => {
92587
+ const { text, attached, dropped } = partsOf(raw);
92588
+ if (paused) setPaused(false);
92589
+ if (dropped.length) append({ kind: "info", text: `not sent (chip removed): ${dropped.map((a) => a.label).join(", ")}` });
92590
+ append({ kind: "you", text: raw, images: attached.map((a) => `#${a.n} ${a.label}`), steering: phaseRef.current === "busy" });
92591
+ if (core2.send({ cmd: "message", text, images: attached.map((a) => a.ref) }) === false) {
92592
+ append({ kind: "warn", text: `not sent: ${raw}` });
92593
+ return;
92594
+ }
92595
+ attachRef.current = [];
92596
+ if (phaseRef.current === "idle") {
92597
+ turnT0.current = Date.now();
92598
+ setPhaseBoth("busy");
92599
+ }
92600
+ };
92601
+ (0, import_react38.useEffect)(() => {
92602
+ if (phase !== "idle" || !queued.length || question || proposal) return;
92603
+ const [raw, ...rest] = queued;
92604
+ setQueued(rest);
92605
+ sendMessage(raw);
92606
+ }, [phase, queued, question, proposal]);
91814
92607
  const onSubmit = (line) => {
91815
92608
  const raw = line.trim();
91816
- const text = expandPastes(raw);
92609
+ const { text, attached } = partsOf(raw);
91817
92610
  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
92611
  if (why && reflection && why === reflection.id) {
91822
92612
  if (raw) append({ kind: "you", text: raw });
91823
92613
  closeReflection(reflection.id, "down", text);
@@ -91834,11 +92624,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91834
92624
  }
91835
92625
  if (!text && attached.length === 0) return;
91836
92626
  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
- }
92627
+ if (raw) remember(raw);
91842
92628
  if (proposal && !/^\/(approve|quit|exit|stop)\b/.test(raw)) {
91843
92629
  decide("reject", text);
91844
92630
  return;
@@ -91846,7 +92632,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91846
92632
  if (question && step && !/^\/(quit|exit|stop)\b/.test(raw)) {
91847
92633
  if (listAsk && text === "/hold") holdAll();
91848
92634
  else if (listAsk) answerWhole(text);
91849
- else answerStep(text);
92635
+ else answerStep(markedPick && text.trim() && typedRow === null ? `${markedPick} ${text.trim()}` : text);
91850
92636
  return;
91851
92637
  }
91852
92638
  if (reflection) closeReflection(reflection.id, "dismiss");
@@ -91860,98 +92646,116 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91860
92646
  if (phaseRef.current === "idle") setPhaseBoth("busy");
91861
92647
  return;
91862
92648
  }
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
- }
92649
+ sendMessage(raw);
91875
92650
  };
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");
91877
- const spinnerLabel = phase === "connecting" ? " starting \u2026" : ` ${status || "working"}${elapsed >= 2 ? ` \xB7 ${fmtDur(elapsed)}` : ""}` + (thinkChars.current > 4e3 ? ` \xB7 ${(thinkChars.current / 1e3).toFixed(0)}k thinking` : "");
92651
+ 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([
92652
+ { text: `${modelRef.current || ""} \xB7 ${fmtCost2(spend)}` },
92653
+ { text: `ctx ${ctxPct}%`, drop: 5 },
92654
+ gate === "approve" && { text: "approvals on", drop: 6 },
92655
+ hello && hello.mounting && hello.mounting.length && { text: `mounting ${hello.mounting.join(", ")}`, drop: 4 },
92656
+ goal && goal.text && { text: `\u25CE goal ${goal.status || "active"}` },
92657
+ needYou && { text: `${needYou} need you` },
92658
+ ready && { text: `restart for hum ${ready}` },
92659
+ offer && { text: "/accept \xB7 /reject" },
92660
+ queued.length && { text: `${queued.length} queued` },
92661
+ phase === "busy" && value.trim() && !proposal && !question && { text: "tab sends later", drop: 2 },
92662
+ agents.length && panelIndex < 0 && !looking && { text: "\u2193 agents", drop: 3 },
92663
+ !ctrlc && question && step && !step.secret && { text: "ctrl+g editor", drop: 2 },
92664
+ ctrlc ? { text: "ctrl+c again to quit" } : { text: "/ for commands", drop: 1 }
92665
+ ], width);
92666
+ const stepAt = planSteps.findIndex((st) => st.status === "in_progress");
92667
+ const phaseWord = statusOf === "tool" ? "" : status;
92668
+ const doing = [stepAt >= 0 ? `${stepAt + 1}/${planSteps.length} \xB7 ${planSteps[stepAt].step}` : "", phaseWord].filter(Boolean).join(" \xB7 ") || "working";
92669
+ const beside = [elapsed >= 1 ? fmtDur(elapsed) : "", escOwned ? "" : "esc to interrupt"].filter(Boolean).join(" \xB7 ");
92670
+ const spinnerLabel = phase === "connecting" ? " starting \u2026" : ` ${doing}${beside ? ` (${beside})` : ""}`;
92671
+ const spinnerRows = wrapAnsi2(spinnerLabel, Math.max(1, width - 1), { hard: true, trim: false }).split("\n").length;
91878
92672
  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);
92673
+ const heldRows = [...foldRows(held.reads), ...held.calls.map((c) => c.item)];
92674
+ const chrome = 1 + 1 + spinnerRows + heldRows.reduce((n, r) => n + 1 + blockGap(r), 0) + 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, consult.text.length + consult.rows.length) + (consult.rows.length ? 1 : 0) : 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
92675
  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] || "" })
92676
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92677
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Static, { items, children: (item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", marginTop: blockGap(item), children: [
92678
+ 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)) }),
92679
+ item.kind === "banner" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 1, children: [
92680
+ MASCOT.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92681
+ /* @__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 }) }),
92682
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: i === 0, dimColor: i !== 0, children: item.lines[i] || "" })
91888
92683
  ] }, 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: [
92684
+ item.instruction ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92685
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: MASCOT_WIDTH + 2, flexShrink: 0 }),
92686
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91892
92687
  "\u276F ",
91893
92688
  item.instruction.split("\n")[0].slice(0, width - MASCOT_WIDTH - 6)
91894
92689
  ] })
91895
92690
  ] }) : null
91896
92691
  ] }),
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) })
92692
+ item.kind === "hum" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92693
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: "\u25CF" }) }),
92694
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: renderMarkdown(item.text, width - 2) })
91900
92695
  ] }),
91901
- item.kind === "thought" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92696
+ item.kind === "thought" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91902
92697
  " \xB7 ",
91903
92698
  item.text
91904
92699
  ] }),
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: [
92700
+ item.kind === "you" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92701
+ /* @__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" }) }),
92702
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92703
+ item.text ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "white", children: [
91909
92704
  item.text,
91910
- item.steering ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: " (steering)" }) : null
92705
+ item.steering ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: " (steering)" }) : null
91911
92706
  ] }) : null,
91912
- (item.images || []).map((im, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
91913
- "\u{1F4CE} ",
92707
+ (item.images || []).map((im, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92708
+ "\u25A3 ",
91914
92709
  im
91915
92710
  ] }, i))
91916
92711
  ] })
91917
92712
  ] }),
91918
- item.kind === "agent" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "magenta", children: [
92713
+ item.kind === "answered" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92714
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: item.title }),
92715
+ item.entries.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92716
+ e.question ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Hang, { lead: " \u2022 ", children: e.question }) : null,
92717
+ e.pick ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Hang, { lead: " pick: ", children: e.pick }) : null,
92718
+ e.pick && e.why ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Hang, { lead: " why: ", children: e.why }) : null,
92719
+ !e.pick ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Hang, { lead: " answer: ", children: e.why || "(nothing)" }) : null
92720
+ ] }, i))
92721
+ ] }),
92722
+ item.kind === "agent" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "magenta", children: [
91919
92723
  " \u25B8 ",
91920
92724
  item.text
91921
92725
  ] }),
91922
- item.kind === "agent_end" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "magenta", dimColor: true, children: [
92726
+ item.kind === "agent_end" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "magenta", dimColor: true, children: [
91923
92727
  " \u23BF ",
91924
92728
  item.text
91925
92729
  ] }),
91926
- item.kind === "tool" && (item.agent ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92730
+ item.kind === "tool" && (item.agent ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91927
92731
  " \xB7 ",
91928
92732
  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,
91937
- {
91938
- dimColor: st.status === "completed",
91939
- bold: st.status === "in_progress",
91940
- color: st.status === "in_progress" ? ACCENT : void 0,
91941
- children: [
91942
- st.glyph,
91943
- " ",
91944
- st.step
91945
- ]
91946
- },
91947
- i
91948
- ))
92733
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ToolRow, { text: item.text })),
92734
+ item.kind === "plan" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92735
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ToolRow, { text: "updated the plan" }),
92736
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 2, children: [
92737
+ item.explanation ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, italic: true, children: item.explanation }) : null,
92738
+ item.steps.map((st, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
92739
+ Text2,
92740
+ {
92741
+ dimColor: st.status !== "in_progress",
92742
+ bold: st.status === "in_progress",
92743
+ color: st.status === "in_progress" ? ACCENT : void 0,
92744
+ children: [
92745
+ st.glyph,
92746
+ " ",
92747
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { strikethrough: st.status === "completed", children: st.step })
92748
+ ]
92749
+ },
92750
+ i
92751
+ ))
92752
+ ] })
91949
92753
  ] }),
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,
92754
+ item.kind === "hypotheses" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 2, children: [
92755
+ item.explanation ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: item.explanation }) : null,
92756
+ item.hypotheses.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92757
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
92758
+ Text2,
91955
92759
  {
91956
92760
  dimColor: ["refuted", "superseded", "blocked"].includes(h.status),
91957
92761
  bold: h.status === "testing",
@@ -91965,171 +92769,159 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
91965
92769
  ]
91966
92770
  }
91967
92771
  ),
91968
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92772
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91969
92773
  " check: ",
91970
92774
  h.check
91971
92775
  ] }),
91972
- h.evidence ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92776
+ h.evidence ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91973
92777
  " evidence: ",
91974
92778
  h.evidence
91975
92779
  ] }) : null
91976
92780
  ] }, i))
91977
92781
  ] }),
91978
- item.kind === "tool_result" && (item.isError ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "red", dimColor: true, children: [
92782
+ item.kind === "tool_result" && (item.isError ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "red", dimColor: true, children: [
91979
92783
  item.agent ? " \u23BF " : " \u23BF ",
91980
92784
  item.text
91981
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92785
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
91982
92786
  item.agent ? " \u23BF " : " \u23BF ",
91983
92787
  item.text
91984
92788
  ] })),
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
92789
+ item.kind === "diff" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 4, children: [
92790
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DiffLines, { lines: item.lines }),
92791
+ item.more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `\u2026 +${item.more} more diff lines` }) : null
91996
92792
  ] }),
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
92793
+ item.kind === "patch" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 2, children: [
92794
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DiffLines, { lines: item.lines, headColor: "cyan" }),
92795
+ item.more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `\u2026 +${item.more} more lines \xB7 /diff <path> narrows it` }) : null,
92796
+ item.stat ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DiffStat, { stat: item.stat, lines: item.lines }) : null
92009
92797
  ] }),
92010
- item.kind === "spool" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92798
+ item.kind === "spool" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92011
92799
  " \u21B3 ",
92012
92800
  item.text
92013
92801
  ] }),
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))
92802
+ 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)) }),
92803
+ item.kind === "output" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 4, children: [
92804
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `full output \xB7 ${item.name}` }),
92805
+ 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
92806
  ] }),
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 })
92807
+ item.kind === "turn" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92808
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: "\u273B " }),
92809
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: item.text })
92026
92810
  ] }),
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 ",
92811
+ item.kind === "paused" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { borderStyle: "round", borderColor: "yellow", paddingX: 1, flexDirection: "column", children: [
92812
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "yellow", bold: true, children: [
92813
+ "\u2016 paused \u2014 ",
92030
92814
  item.trip === "spend" ? "spend cap" : item.trip === "repeat" ? "repeating itself" : "no progress"
92031
92815
  ] }),
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" })
92816
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: item.text }),
92817
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "say what to do next \xB7 /continue lets it carry on" })
92034
92818
  ] }),
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` })
92819
+ item.kind === "mcp" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92820
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92821
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, color: ACCENT, children: "MCP servers" }),
92822
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` \xB7 ${item.servers.length} in this session` })
92039
92823
  ] }),
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,
92824
+ 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
92825
  [["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
92826
  const rows2 = item.servers.filter((s) => (s.source || "config").split(":")[0] === src);
92043
92827
  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}` })
92828
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", marginTop: 1, children: [
92829
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` ${label}` }),
92830
+ rows2.map((s) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 2, children: [
92831
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92832
+ s.error ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "red", children: "\u2717 " }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "green", children: "\u2714 " }),
92833
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: s.name }),
92834
+ /* @__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
92835
  ] }),
92052
- s.tools.length ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` ${s.tools.join(" \xB7 ")}` }) : null
92836
+ s.tools.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` ${s.tools.join(" \xB7 ")}` }) : null
92053
92837
  ] }, s.name))
92054
92838
  ] }, src);
92055
92839
  })
92056
92840
  ] }),
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 })
92841
+ item.kind === "info" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: item.text }),
92842
+ item.kind === "help" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingLeft: 1, children: [
92843
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: "commands" }),
92844
+ commandRows(COMMANDS, -1, HELP_PAD),
92845
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: "keys" }),
92846
+ commandRows(KEYS, -1, HELP_PAD)
92847
+ ] }),
92848
+ item.kind === "warn" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92849
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "yellow", children: "\u26A0" }) }),
92850
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "yellow", children: item.text })
92851
+ ] }),
92852
+ item.kind === "error" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
92853
+ /* @__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" }) }),
92854
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "red", children: item.text })
92855
+ ] })
92060
92856
  ] }, 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) })
92857
+ heldRows.map((item, i) => (
92858
+ // a held row stands where it will print: the same gap above it here as on the transcript
92859
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box2, { flexDirection: "column", marginTop: blockGap(item), children: 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) : "" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92860
+ " \u23BF ",
92861
+ item.text
92862
+ ] }) }, i)
92863
+ )),
92864
+ draft.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { marginTop: 1, children: [
92865
+ /* @__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" }) }),
92866
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: liveTail(renderMarkdown(draft, width - 2), width - 2, liveBudget) })
92064
92867
  ] }),
92065
- thinking.length > 0 && // the thought as it streams: its newest lines, dim, so a long think is never a blank screen.
92066
- // 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 })
92868
+ (phase === "busy" || phase === "connecting") && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { marginTop: 1, children: [
92869
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(build_default, { type: "dots" }) }),
92870
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: spinnerLabel })
92071
92871
  ] }),
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: [
92872
+ question && step && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
92873
+ questions.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` 1 of ${questions.length} open asks \xB7 the oldest first` }) : null,
92874
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: ACCENT, bold: true, children: [
92075
92875
  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
92876
  !listAsk && steps.length > 1 ? ` (${qStep + 1} of ${steps.length})` : ""
92077
92877
  ] }),
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
92878
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: consultView.shownText.join("\n") }),
92879
+ consult.text.length > consultView.textHeight ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `lines ${consultView.textStart + 1}\u2013${consultView.textStart + consultView.textHeight} of ${consult.text.length} \xB7 PgUp/PgDn to read` }) : null,
92880
+ consultView.shownRows.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: ["", ...consultView.shownRows].join("\n") }) : null,
92881
+ 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,
92882
+ 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,
92883
+ sendingAsk === question.id ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: "Sending answer\u2026" }) : null,
92884
+ !listAsk ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, wrap: "truncate-end", children: " " + askHint }) : null
92093
92885
  ] }),
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}` : ""}` })
92886
+ reflection && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
92887
+ /* @__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)) }),
92888
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", flexGrow: 1, children: [
92889
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92890
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: "\u2726 Self Reflect" }),
92891
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` \xB7 ${reflection.category.replace(/_/g, " ")}${reflection.area ? ` \xB7 ${reflection.area}` : ""}` })
92100
92892
  ] }),
92101
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { bold: true, children: reflection.title }),
92102
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: " " }),
92893
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: reflection.title }),
92894
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92103
92895
  reflection.details.split("\n").map((l, i) => {
92104
92896
  const m = l.match(/^\s*(What happened|What the person said|Evidence|Cause|Repro)\s*:\s*(.*)$/i);
92105
92897
  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
92898
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", marginTop: i === 0 ? 0 : 1, children: [
92899
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` ${m[1]}` }),
92900
+ m[2] ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: ` ${m[2]}` }) : null
92109
92901
  ] }, `d${i}`);
92110
92902
  }
92111
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: ` ${l}` }, `d${i}`);
92903
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: ` ${l}` }, `d${i}`);
92112
92904
  }),
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` : ""}` })
92905
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92906
+ why === reflection.id ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92907
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: "What did it get wrong? " }),
92908
+ /* @__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" })
92909
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92910
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: true, children: "Is this true? " }),
92911
+ /* @__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
92912
  ] })
92121
92913
  ] })
92122
92914
  ] }),
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: "? " }),
92915
+ proposal && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
92916
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92917
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: "? " }),
92126
92918
  proposal.agent ? `hum's sub-agent ${proposal.agent.agent} (${proposal.agent.description || proposal.agent.kind})` : "hum",
92127
92919
  " wants to",
92128
- proposal.calls.some((c) => c.escape) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "yellow", children: " leave the sandbox" }) : null,
92920
+ proposal.calls.some((c) => c.escape) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "yellow", children: " leave the sandbox" }) : null,
92129
92921
  " ",
92130
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "\xB7 enter approves \xB7 type a reason to reject \xB7 esc stops" })
92922
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "\xB7 enter approves \xB7 type a reason to reject \xB7 esc stops" })
92131
92923
  ] }),
92132
- (proposal.remember || []).length ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92924
+ (proposal.remember || []).length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92133
92925
  " a ",
92134
92926
  "allows ",
92135
92927
  proposal.remember_text,
@@ -92137,26 +92929,26 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92137
92929
  " \xB7 p ",
92138
92930
  "for this project"
92139
92931
  ] }) : null,
92140
- proposal.content ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92932
+ proposal.content ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92141
92933
  " ",
92142
92934
  proposal.content.split("\n")[0].slice(0, width - 4)
92143
92935
  ] }) : 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: [
92936
+ proposal.calls.map((c) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92937
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92146
92938
  " \xB7 ",
92147
92939
  c.desc,
92148
- c.lines != null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` (${c.lines} lines)` }) : null
92940
+ c.lines != null ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: ` (${c.lines} lines)` }) : null
92149
92941
  ] }),
92150
- (c.name === "bash" || c.name === "powershell") && c.desc !== `$ ${String(c.args?.command || "")}` ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "cyan", children: [
92942
+ (c.name === "bash" || c.name === "powershell") && c.desc !== `$ ${String(c.args?.command || "")}` ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "cyan", children: [
92151
92943
  " $ ",
92152
92944
  String(c.args?.command || "").split("\n").join(" \u23CE ")
92153
92945
  ] }) : null,
92154
- c.escape ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "yellow", children: [
92946
+ c.escape ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "yellow", children: [
92155
92947
  " outside the sandbox \u2014 ",
92156
92948
  String(c.reason || "").slice(0, Math.max(20, width - 32))
92157
92949
  ] }) : null,
92158
- c.diff ? c.diff.split("\n").slice(0, DIFF_TAIL_LINES).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
92159
- Text,
92950
+ c.diff ? c.diff.split("\n").slice(0, DIFF_TAIL_LINES).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
92951
+ Text2,
92160
92952
  {
92161
92953
  color: l.startsWith("+") ? "green" : l.startsWith("-") ? "red" : void 0,
92162
92954
  dimColor: !l.startsWith("+") && !l.startsWith("-"),
@@ -92167,159 +92959,159 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92167
92959
  },
92168
92960
  i
92169
92961
  )) : 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
92962
+ 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
92963
  ] }, c.id))
92172
92964
  ] }),
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: [
92965
+ looking && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 1, marginTop: 1, children: [
92966
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92967
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "magenta", bold: true, children: looking.row.name }),
92968
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92177
92969
  " ",
92178
92970
  looking.row.task.slice(0, width - 20)
92179
92971
  ] })
92180
92972
  ] }),
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: "? " }),
92973
+ looking.waiting ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "looking \u2026" }) : null,
92974
+ looking.question ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92975
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92976
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: "? " }),
92185
92977
  looking.question.question
92186
92978
  ] }),
92187
- (looking.question.options || []).map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92979
+ (looking.question.options || []).map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92188
92980
  " ",
92189
92981
  i + 1,
92190
92982
  ". ",
92191
92983
  typeof o === "string" ? o : o.label,
92192
92984
  o && o.description ? ` \xB7 ${o.description}` : ""
92193
92985
  ] }, i)),
92194
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
92986
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92195
92987
  " ",
92196
92988
  "type the answer \xB7 enter answers and leaves",
92197
92989
  looking.question.default ? ` (empty takes the default: ${looking.question.default})` : "",
92198
92990
  " \xB7 esc leaves it open"
92199
92991
  ] })
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" })
92992
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
92993
+ 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" }),
92994
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "esc goes back" })
92203
92995
  ] })
92204
92996
  ] }),
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: " " }),
92997
+ picker && picker.kind === "model" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
92998
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: "Select model" }),
92999
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Switch models. Served via Metaphi AI." }),
93000
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92209
93001
  (() => {
92210
93002
  const nameW = Math.max(...picker.items.map((m) => m.name.length + (m.current ? 2 : 0)));
92211
93003
  return picker.items.map((m, i) => {
92212
93004
  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
93005
  const about = [m.note, price].filter(Boolean).join(" \xB7 ");
92214
93006
  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: [
93007
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
93008
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: i === picker.index ? "\u276F " : " " }),
93009
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: m.current ? "green" : void 0, bold: i === picker.index, children: label }),
93010
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: i !== picker.index, children: [
92219
93011
  " ",
92220
93012
  about
92221
93013
  ] })
92222
93014
  ] }, m.name);
92223
93015
  });
92224
93016
  })(),
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" })
93017
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
93018
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Enter to switch \xB7 Esc to cancel" })
92227
93019
  ] }),
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" })
93020
+ picker && picker.kind === "reasoning" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
93021
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, bold: true, children: "Reasoning" }),
93022
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
93023
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
93024
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: " Faster" }),
93025
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " ".repeat(Math.max(1, picker.items.length * 10 - 14)) }),
93026
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Smarter" })
92235
93027
  ] }),
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))
93028
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
93029
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
93030
+ 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
93031
  ] }),
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" })
93032
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
93033
+ /* @__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
93034
  ] }),
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: [
93035
+ trust && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", paddingX: 1, marginTop: 1, children: [
93036
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "yellow", bold: true, children: [
92245
93037
  "? ",
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" })
93038
+ "this repository's files would start or reach, on your word ",
93039
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "\xB7 y allows them \xB7 n leaves them off" })
92248
93040
  ] }),
92249
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
93041
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92250
93042
  " ",
92251
93043
  trust.path
92252
93044
  ] }),
92253
- trust.starts.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
93045
+ trust.starts.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92254
93046
  " \xB7 ",
92255
93047
  l
92256
93048
  ] }, i))
92257
93049
  ] }),
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: [
93050
+ confirm && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", borderStyle: "round", borderColor: "yellow", paddingX: 1, marginTop: 1, children: [
93051
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "yellow", bold: true, children: [
92260
93052
  "\u23EE ",
92261
93053
  confirm.why || "the workspace has changed since hum last looked"
92262
93054
  ] }),
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: [
93055
+ 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
93056
  " ",
92265
93057
  l
92266
93058
  ] }, 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" })
93059
+ /* @__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
93060
  ] }),
92269
93061
  picker && picker.kind === "rewind" && (() => {
92270
93062
  const it = picker.items[picker.index];
92271
93063
  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: [
93064
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
93065
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: ACCENT, bold: true, children: [
92274
93066
  "Rewind to ",
92275
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "white", children: `\u201C${(it?.said || "").slice(0, width - 24)}\u201D` })
93067
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "white", children: `\u201C${(it?.said || "").slice(0, width - 24)}\u201D` })
92276
93068
  ] }),
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: [
93069
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
93070
+ REWIND_CHOICES.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
93071
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: i === picker.choice ? "\u276F " : " " }),
93072
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { bold: i === picker.choice, children: [
92281
93073
  i + 1,
92282
93074
  ". ",
92283
93075
  c.label.padEnd(26)
92284
93076
  ] }),
92285
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: c.desc })
93077
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: c.desc })
92286
93078
  ] }, 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" })
93079
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
93080
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Enter to go back \xB7 Esc for the list again" })
92289
93081
  ] });
92290
93082
  }
92291
93083
  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: [
93084
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
93085
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: ACCENT, bold: true, children: [
92294
93086
  "Rewind ",
92295
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `(${picker.index + 1} of ${picker.items.length})` })
93087
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `(${picker.index + 1} of ${picker.items.length})` })
92296
93088
  ] }),
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: " " }),
93089
+ /* @__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." }),
93090
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
92299
93091
  picker.items.slice(top, top + REWIND_ROWS).map((c, j) => {
92300
93092
  const i = top + j;
92301
93093
  const sel = i === picker.index;
92302
93094
  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
93095
  const said = (c.said || "(nothing said)").replace(/\s+/g, " ");
92304
93096
  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: [
93097
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", children: [
93098
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
93099
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: sel ? "\u276F " : " " }),
93100
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92309
93101
  String(ago(c.at)).padStart(9),
92310
93102
  " "
92311
93103
  ] }),
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 })
93104
+ /* @__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
93105
  ] }),
92314
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
93106
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92315
93107
  " ",
92316
93108
  meta
92317
93109
  ] })
92318
93110
  ] }, c.node);
92319
93111
  }),
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" })
93112
+ 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,
93113
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { children: " " }),
93114
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Enter to choose what comes back \xB7 Esc to cancel" })
92323
93115
  ] });
92324
93116
  })(),
92325
93117
  picker && picker.kind === "session" && (() => {
@@ -92331,7 +93123,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92331
93123
  shown.forEach((it, j) => {
92332
93124
  const i = top + j;
92333
93125
  if (it.dir !== lastDir) {
92334
- out.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
93126
+ out.push(/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92335
93127
  " ",
92336
93128
  it.dir || "(no directory)"
92337
93129
  ] }, `dir${i}`));
@@ -92343,39 +93135,44 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92343
93135
  const room = Math.max(16, width - 6 - (state ? state.length + 4 : 0));
92344
93136
  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
93137
  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: [
93138
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", marginBottom: 1, children: [
93139
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
93140
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: sel ? "\u276F " : " " }),
93141
+ /* @__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 }),
93142
+ state ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: "magenta", children: [
92351
93143
  " \xB7 ",
92352
93144
  state
92353
93145
  ] }) : null
92354
93146
  ] }),
92355
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
93147
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92356
93148
  " ",
92357
93149
  meta
92358
93150
  ] })
92359
93151
  ] }, it.name)
92360
93152
  );
92361
93153
  });
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: [
93154
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
93155
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: ACCENT, bold: true, children: [
92364
93156
  "Resume session ",
92365
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `(${rows2.length ? picker.index + 1 : 0} of ${rows2.length})` })
93157
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `(${rows2.length ? picker.index + 1 : 0} of ${rows2.length})` })
92366
93158
  ] }),
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: [
93159
+ /* @__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
93160
  "\u2315 ",
92369
- picker.query ? picker.query : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "Search\u2026" })
93161
+ picker.query ? picker.query : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "Search\u2026" })
92370
93162
  ] }) }),
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` })
93163
+ rows2.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: " nothing matches" }) : out,
93164
+ top + PICKER_ROWS < rows2.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: `\u2193 ${rows2.length - top - PICKER_ROWS} more` }) : null,
93165
+ /* @__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
93166
  ] });
92375
93167
  })(),
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)(
93168
+ queued.length > 0 && // what waits for the next turns, oldest first, in the person's own glyph but dim: said, not yet sent
93169
+ /* @__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: [
93170
+ "\u276F ",
93171
+ q.replace(/\s+/g, " ")
93172
+ ] }, i)) }),
93173
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { borderStyle: "single", borderColor: "gray", borderLeft: false, borderRight: false, paddingX: 1, marginTop: 1, children: [
93174
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "cyan", children: "\u276F " }),
93175
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
92379
93176
  input_default,
92380
93177
  {
92381
93178
  ref: inputRef,
@@ -92385,57 +93182,62 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92385
93182
  onSubmit,
92386
93183
  onPaste,
92387
93184
  focus: phase !== "dead" && !sendingAsk,
92388
- navActive: menu.length === 0 && panelIndex < 0 && !looking,
92389
- history: historyRef.current,
93185
+ onInfo: (text) => append({ kind: "info", text }),
93186
+ navActive: menu.length === 0 && files.length === 0 && panelIndex < 0 && !looking,
93187
+ history: recallOrder(historyRef.current, cwd2),
93188
+ onSearch: setSearch,
92390
93189
  mask: !!(step && step.secret),
92391
93190
  swallow: (input, key) => {
92392
93191
  const chunk = !!input && input.length > 1 && !key.ctrl && !key.meta;
92393
93192
  if (question && (key.pageUp || key.pageDown || sendingAsk)) return true;
92394
93193
  if (picker) return !chunk;
92395
93194
  if (confirm) return !!(key.return || key.escape);
93195
+ if (files.length && key.return && !key.meta && !key.shift && !picker && !trust) return true;
92396
93196
  if (trust) return input === "y" || input === "n" || !!(key.return || key.escape);
93197
+ if (key.upArrow && !value && queued.length && !search) return true;
92397
93198
  if (value.trim()) return false;
93199
+ if (input === "?" && !question && !proposal && !reflection && !looking) return true;
92398
93200
  if (reflection && why !== reflection.id && (input === "1" || input === "2")) return true;
92399
93201
  if (proposal && (input === "a" || input === "p") && (proposal.remember || []).length) return true;
92400
93202
  if (!question || !step) return false;
92401
- if (listAsk || question.kind === "decision") return false;
93203
+ if (listAsk) return false;
93204
+ if (stepLabels.length && input === String(stepLabels.length + 1)) return true;
92402
93205
  if (step.multi && /^[1-9]$/.test(input) && Number(input) <= stepLabels.length) return true;
93206
+ if (stepLabels.length && (key.upArrow || key.downArrow)) return true;
92403
93207
  return !!(step.multi && stepLabels.length && input === " ");
92404
93208
  },
92405
- 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?"
93209
+ 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 ? ownMarked ? "type your own answer" : markedPick ? "why? \xB7 enter sends \xB7 enter on an empty line sends the pick alone" : 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
93210
  }
92407
93211
  )
92408
93212
  ] }),
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" })
93213
+ menu.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, children: [
93214
+ commandRows(menu, menuIndex),
93215
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: "tab to complete \xB7 enter to run" })
92418
93216
  ] }),
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,
93217
+ files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, children: [
93218
+ commandRows(files.map((f) => ({ name: f, desc: "" })), Math.min(menuIndex, files.length - 1), 0),
93219
+ /* @__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" })
93220
+ ] }),
93221
+ !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
93222
  // +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: [
93223
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { flexDirection: "column", paddingX: 1, children: [
93224
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { children: [
92423
93225
  " ",
92424
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "magenta", children: "\u25CF" }),
93226
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "magenta", children: "\u25CF" }),
92425
93227
  " main"
92426
93228
  ] }),
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: [
93229
+ agents.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box2, { children: [
93230
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: ACCENT, children: i === panelIndex ? "\u276F " : " " }),
93231
+ a.worker ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
93232
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "magenta", children: "\u25C7 " }),
93233
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: i === panelIndex, children: `${a.kind} worker`.padEnd(16) }),
93234
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: a.desc }),
93235
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { color: a.needs ? "yellow" : void 0, dimColor: !a.needs, children: [
92434
93236
  " \xB7 ",
92435
93237
  a.needs ? `needs ${a.needs}` : a.state
92436
93238
  ] }),
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: [
93239
+ a.agents ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "magenta", children: ` +${a.agents}` }) : null,
93240
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92439
93241
  " ",
92440
93242
  fmtDur(a.elapsed_s || 0),
92441
93243
  " \xB7 ",
@@ -92443,11 +93245,11 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92443
93245
  " \xB7 ",
92444
93246
  fmtCost2(a.cost_usd || 0)
92445
93247
  ] })
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: [
93248
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
93249
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { color: "magenta", children: "\u25CB " }),
93250
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { bold: i === panelIndex, children: String(a.kind).padEnd(10) }),
93251
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text2, { dimColor: true, children: a.desc }),
93252
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text2, { dimColor: true, children: [
92451
93253
  " ",
92452
93254
  fmtDur(a.elapsed_s || 0),
92453
93255
  " \xB7 ",
@@ -92460,7 +93262,7 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92460
93262
  ] })
92461
93263
  ] }, a.n))
92462
93264
  ] }),
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 }) })
93265
+ !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
93266
  ] });
92465
93267
  }
92466
93268
 
@@ -92468,9 +93270,10 @@ function App2({ core: core2, task, resume, images = [], peek = peekSession, upda
92468
93270
  init_core();
92469
93271
  init_update();
92470
93272
  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.25" : "0.0.0";
93273
+ await init_theme();
93274
+ var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
93275
+ import { spawnSync as spawnSync6 } from "node:child_process";
93276
+ var MINE3 = true ? "0.2.27" : "0.0.0";
92474
93277
  var layout = installLayout();
92475
93278
  function completeInstall() {
92476
93279
  if (layout.kind !== "npm" || !needsInstall(MINE3)) return;
@@ -92505,13 +93308,14 @@ if (CORE_COMMANDS.has(argv0[0]) || argv0[0] === "agents" && argv0.includes("--js
92505
93308
  process.stderr.write(startFailure([]) + "\n");
92506
93309
  process.exit(1);
92507
93310
  }
92508
- const r = spawnSync5(cmd.bin, cmd.args, { stdio: "inherit", windowsHide: true });
93311
+ const r = spawnSync6(cmd.bin, cmd.args, { stdio: "inherit", windowsHide: true });
92509
93312
  if (r.error) {
92510
93313
  process.stderr.write(startFailure([{ bin: cmd.bin, error: r.error }]) + "\n");
92511
93314
  process.exit(1);
92512
93315
  }
92513
93316
  process.exit(r.status === null ? 1 : r.status);
92514
93317
  }
93318
+ setTheme(await detectTheme());
92515
93319
  var SCREEN = { exitOnCtrlC: false, incrementalRendering: true };
92516
93320
  function leave(core2) {
92517
93321
  core2.close();
@@ -92530,7 +93334,7 @@ if (argv0[0] === "agents") {
92530
93334
  }
92531
93335
  const { default: Agents2 } = await init_agents2().then(() => agents_exports2);
92532
93336
  let chosen = null;
92533
- const screen = render_default(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Agents2, { onAttach: (r) => {
93337
+ const screen = render_default(/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Agents2, { onAttach: (r) => {
92534
93338
  chosen = r;
92535
93339
  screen.unmount();
92536
93340
  }, onQuit: () => screen.unmount() }), { incrementalRendering: true });
@@ -92543,7 +93347,7 @@ if (argv0[0] === "agents") {
92543
93347
  process.stderr.write(exc.message + "\n");
92544
93348
  process.exit(1);
92545
93349
  }
92546
- const app = render_default(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(App2, { core: core2, task: null, resume: null, images: [] }), SCREEN);
93350
+ const app = render_default(/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(App2, { core: core2, task: null, resume: null, images: [] }), SCREEN);
92547
93351
  await app.waitUntilExit();
92548
93352
  leave(core2);
92549
93353
  }
@@ -92596,7 +93400,7 @@ try {
92596
93400
  process.stderr.write(exc.message + "\n");
92597
93401
  process.exit(1);
92598
93402
  }
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);
93403
+ 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
93404
  waitUntilExit().then(() => leave(core));
92601
93405
  /*! Bundled license information:
92602
93406