@metaphi-ai/hum 0.1.5 → 0.1.7

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 +748 -315
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -999,15 +999,15 @@ var require_react_development = __commonJS({
999
999
  }
1000
1000
  return 1;
1001
1001
  }
1002
- var child2;
1002
+ var child;
1003
1003
  var nextName;
1004
1004
  var subtreeCount = 0;
1005
1005
  var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1006
1006
  if (isArray(children)) {
1007
1007
  for (var i = 0; i < children.length; i++) {
1008
- child2 = children[i];
1009
- nextName = nextNamePrefix + getElementKey(child2, i);
1010
- subtreeCount += mapIntoArray(child2, array, escapedPrefix, nextName, callback);
1008
+ child = children[i];
1009
+ nextName = nextNamePrefix + getElementKey(child, i);
1010
+ subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1011
1011
  }
1012
1012
  } else {
1013
1013
  var iteratorFn = getIteratorFn(children);
@@ -1025,9 +1025,9 @@ var require_react_development = __commonJS({
1025
1025
  var step;
1026
1026
  var ii = 0;
1027
1027
  while (!(step = iterator.next()).done) {
1028
- child2 = step.value;
1029
- nextName = nextNamePrefix + getElementKey(child2, ii++);
1030
- subtreeCount += mapIntoArray(child2, array, escapedPrefix, nextName, callback);
1028
+ child = step.value;
1029
+ nextName = nextNamePrefix + getElementKey(child, ii++);
1030
+ subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1031
1031
  }
1032
1032
  } else if (type === "object") {
1033
1033
  var childrenString = String(children);
@@ -1042,8 +1042,8 @@ var require_react_development = __commonJS({
1042
1042
  }
1043
1043
  var result = [];
1044
1044
  var count = 0;
1045
- mapIntoArray(children, result, "", "", function(child2) {
1046
- return func.call(context, child2, count++);
1045
+ mapIntoArray(children, result, "", "", function(child) {
1046
+ return func.call(context, child, count++);
1047
1047
  });
1048
1048
  return result;
1049
1049
  }
@@ -1060,8 +1060,8 @@ var require_react_development = __commonJS({
1060
1060
  }, forEachContext);
1061
1061
  }
1062
1062
  function toArray(children) {
1063
- return mapChildren(children, function(child2) {
1064
- return child2;
1063
+ return mapChildren(children, function(child) {
1064
+ return child;
1065
1065
  }) || [];
1066
1066
  }
1067
1067
  function onlyChild(children) {
@@ -1257,7 +1257,7 @@ var require_react_development = __commonJS({
1257
1257
  }
1258
1258
  return lazyType;
1259
1259
  }
1260
- function forwardRef2(render2) {
1260
+ function forwardRef3(render2) {
1261
1261
  {
1262
1262
  if (render2 != null && render2.$$typeof === REACT_MEMO_TYPE) {
1263
1263
  error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).");
@@ -1402,7 +1402,7 @@ var require_react_development = __commonJS({
1402
1402
  var dispatcher = resolveDispatcher();
1403
1403
  return dispatcher.useMemo(create2, deps);
1404
1404
  }
1405
- function useImperativeHandle(ref, create2, deps) {
1405
+ function useImperativeHandle2(ref, create2, deps) {
1406
1406
  var dispatcher = resolveDispatcher();
1407
1407
  return dispatcher.useImperativeHandle(ref, create2, deps);
1408
1408
  }
@@ -1795,9 +1795,9 @@ var require_react_development = __commonJS({
1795
1795
  }
1796
1796
  if (isArray(node)) {
1797
1797
  for (var i = 0; i < node.length; i++) {
1798
- var child2 = node[i];
1799
- if (isValidElement(child2)) {
1800
- validateExplicitKey(child2, parentType);
1798
+ var child = node[i];
1799
+ if (isValidElement(child)) {
1800
+ validateExplicitKey(child, parentType);
1801
1801
  }
1802
1802
  }
1803
1803
  } else if (isValidElement(node)) {
@@ -2155,7 +2155,7 @@ var require_react_development = __commonJS({
2155
2155
  exports.createElement = createElement$1;
2156
2156
  exports.createFactory = createFactory;
2157
2157
  exports.createRef = createRef;
2158
- exports.forwardRef = forwardRef2;
2158
+ exports.forwardRef = forwardRef3;
2159
2159
  exports.isValidElement = isValidElement;
2160
2160
  exports.lazy = lazy;
2161
2161
  exports.memo = memo;
@@ -2167,7 +2167,7 @@ var require_react_development = __commonJS({
2167
2167
  exports.useDeferredValue = useDeferredValue;
2168
2168
  exports.useEffect = useEffect5;
2169
2169
  exports.useId = useId;
2170
- exports.useImperativeHandle = useImperativeHandle;
2170
+ exports.useImperativeHandle = useImperativeHandle2;
2171
2171
  exports.useInsertionEffect = useInsertionEffect;
2172
2172
  exports.useLayoutEffect = useLayoutEffect2;
2173
2173
  exports.useMemo = useMemo3;
@@ -8305,17 +8305,17 @@ var require_react_reconciler_development = __commonJS({
8305
8305
  break;
8306
8306
  }
8307
8307
  if (parentA.child === parentB.child) {
8308
- var child2 = parentA.child;
8309
- while (child2) {
8310
- if (child2 === a) {
8308
+ var child = parentA.child;
8309
+ while (child) {
8310
+ if (child === a) {
8311
8311
  assertIsMounted(parentA);
8312
8312
  return fiber;
8313
8313
  }
8314
- if (child2 === b) {
8314
+ if (child === b) {
8315
8315
  assertIsMounted(parentA);
8316
8316
  return alternate;
8317
8317
  }
8318
- child2 = child2.sibling;
8318
+ child = child.sibling;
8319
8319
  }
8320
8320
  throw new Error("Unable to find node on an unmounted component.");
8321
8321
  }
@@ -8382,13 +8382,13 @@ var require_react_reconciler_development = __commonJS({
8382
8382
  if (node.tag === HostComponent || node.tag === HostText) {
8383
8383
  return node;
8384
8384
  }
8385
- var child2 = node.child;
8386
- while (child2 !== null) {
8387
- var match = findCurrentHostFiberImpl(child2);
8385
+ var child = node.child;
8386
+ while (child !== null) {
8387
+ var match = findCurrentHostFiberImpl(child);
8388
8388
  if (match !== null) {
8389
8389
  return match;
8390
8390
  }
8391
- child2 = child2.sibling;
8391
+ child = child.sibling;
8392
8392
  }
8393
8393
  return null;
8394
8394
  }
@@ -8400,15 +8400,15 @@ var require_react_reconciler_development = __commonJS({
8400
8400
  if (node.tag === HostComponent || node.tag === HostText) {
8401
8401
  return node;
8402
8402
  }
8403
- var child2 = node.child;
8404
- while (child2 !== null) {
8405
- if (child2.tag !== HostPortal) {
8406
- var match = findCurrentHostFiberWithNoPortalsImpl(child2);
8403
+ var child = node.child;
8404
+ while (child !== null) {
8405
+ if (child.tag !== HostPortal) {
8406
+ var match = findCurrentHostFiberWithNoPortalsImpl(child);
8407
8407
  if (match !== null) {
8408
8408
  return match;
8409
8409
  }
8410
8410
  }
8411
- child2 = child2.sibling;
8411
+ child = child.sibling;
8412
8412
  }
8413
8413
  return null;
8414
8414
  }
@@ -10975,7 +10975,7 @@ var require_react_reconciler_development = __commonJS({
10975
10975
  var didWarnAboutStringRefs;
10976
10976
  var ownerHasKeyUseWarning;
10977
10977
  var ownerHasFunctionTypeWarning;
10978
- var warnForMissingKey = function(child2, returnFiber) {
10978
+ var warnForMissingKey = function(child, returnFiber) {
10979
10979
  };
10980
10980
  {
10981
10981
  didWarnAboutMaps = false;
@@ -10983,17 +10983,17 @@ var require_react_reconciler_development = __commonJS({
10983
10983
  didWarnAboutStringRefs = {};
10984
10984
  ownerHasKeyUseWarning = {};
10985
10985
  ownerHasFunctionTypeWarning = {};
10986
- warnForMissingKey = function(child2, returnFiber) {
10987
- if (child2 === null || typeof child2 !== "object") {
10986
+ warnForMissingKey = function(child, returnFiber) {
10987
+ if (child === null || typeof child !== "object") {
10988
10988
  return;
10989
10989
  }
10990
- if (!child2._store || child2._store.validated || child2.key != null) {
10990
+ if (!child._store || child._store.validated || child.key != null) {
10991
10991
  return;
10992
10992
  }
10993
- if (typeof child2._store !== "object") {
10993
+ if (typeof child._store !== "object") {
10994
10994
  throw new Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.");
10995
10995
  }
10996
- child2._store.validated = true;
10996
+ child._store.validated = true;
10997
10997
  var componentName = getComponentNameFromFiber(returnFiber) || "Component";
10998
10998
  if (ownerHasKeyUseWarning[componentName]) {
10999
10999
  return;
@@ -11332,16 +11332,16 @@ var require_react_reconciler_development = __commonJS({
11332
11332
  }
11333
11333
  return null;
11334
11334
  }
11335
- function warnOnInvalidKey(child2, knownKeys, returnFiber) {
11335
+ function warnOnInvalidKey(child, knownKeys, returnFiber) {
11336
11336
  {
11337
- if (typeof child2 !== "object" || child2 === null) {
11337
+ if (typeof child !== "object" || child === null) {
11338
11338
  return knownKeys;
11339
11339
  }
11340
- switch (child2.$$typeof) {
11340
+ switch (child.$$typeof) {
11341
11341
  case REACT_ELEMENT_TYPE:
11342
11342
  case REACT_PORTAL_TYPE:
11343
- warnForMissingKey(child2, returnFiber);
11344
- var key = child2.key;
11343
+ warnForMissingKey(child, returnFiber);
11344
+ var key = child.key;
11345
11345
  if (typeof key !== "string") {
11346
11346
  break;
11347
11347
  }
@@ -11357,8 +11357,8 @@ var require_react_reconciler_development = __commonJS({
11357
11357
  error("Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted \u2014 the behavior is unsupported and could change in a future version.", key);
11358
11358
  break;
11359
11359
  case REACT_LAZY_TYPE:
11360
- var payload = child2._payload;
11361
- var init = child2._init;
11360
+ var payload = child._payload;
11361
+ var init = child._init;
11362
11362
  warnOnInvalidKey(init(payload), knownKeys, returnFiber);
11363
11363
  break;
11364
11364
  }
@@ -11369,8 +11369,8 @@ var require_react_reconciler_development = __commonJS({
11369
11369
  {
11370
11370
  var knownKeys = null;
11371
11371
  for (var i = 0; i < newChildren.length; i++) {
11372
- var child2 = newChildren[i];
11373
- knownKeys = warnOnInvalidKey(child2, knownKeys, returnFiber);
11372
+ var child = newChildren[i];
11373
+ knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber);
11374
11374
  }
11375
11375
  }
11376
11376
  var resultingFirstChild = null;
@@ -11454,8 +11454,8 @@ var require_react_reconciler_development = __commonJS({
11454
11454
  }
11455
11455
  }
11456
11456
  if (shouldTrackSideEffects) {
11457
- existingChildren.forEach(function(child3) {
11458
- return deleteChild(returnFiber, child3);
11457
+ existingChildren.forEach(function(child2) {
11458
+ return deleteChild(returnFiber, child2);
11459
11459
  });
11460
11460
  }
11461
11461
  if (getIsHydrating()) {
@@ -11488,8 +11488,8 @@ var require_react_reconciler_development = __commonJS({
11488
11488
  var knownKeys = null;
11489
11489
  var _step = _newChildren.next();
11490
11490
  for (; !_step.done; _step = _newChildren.next()) {
11491
- var child2 = _step.value;
11492
- knownKeys = warnOnInvalidKey(child2, knownKeys, returnFiber);
11491
+ var child = _step.value;
11492
+ knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber);
11493
11493
  }
11494
11494
  }
11495
11495
  }
@@ -11579,8 +11579,8 @@ var require_react_reconciler_development = __commonJS({
11579
11579
  }
11580
11580
  }
11581
11581
  if (shouldTrackSideEffects) {
11582
- existingChildren.forEach(function(child3) {
11583
- return deleteChild(returnFiber, child3);
11582
+ existingChildren.forEach(function(child2) {
11583
+ return deleteChild(returnFiber, child2);
11584
11584
  });
11585
11585
  }
11586
11586
  if (getIsHydrating()) {
@@ -11603,14 +11603,14 @@ var require_react_reconciler_development = __commonJS({
11603
11603
  }
11604
11604
  function reconcileSingleElement(returnFiber, currentFirstChild, element, lanes) {
11605
11605
  var key = element.key;
11606
- var child2 = currentFirstChild;
11607
- while (child2 !== null) {
11608
- if (child2.key === key) {
11606
+ var child = currentFirstChild;
11607
+ while (child !== null) {
11608
+ if (child.key === key) {
11609
11609
  var elementType = element.type;
11610
11610
  if (elementType === REACT_FRAGMENT_TYPE) {
11611
- if (child2.tag === Fragment) {
11612
- deleteRemainingChildren(returnFiber, child2.sibling);
11613
- var existing = useFiber(child2, element.props.children);
11611
+ if (child.tag === Fragment) {
11612
+ deleteRemainingChildren(returnFiber, child.sibling);
11613
+ var existing = useFiber(child, element.props.children);
11614
11614
  existing.return = returnFiber;
11615
11615
  {
11616
11616
  existing._debugSource = element._source;
@@ -11619,15 +11619,15 @@ var require_react_reconciler_development = __commonJS({
11619
11619
  return existing;
11620
11620
  }
11621
11621
  } else {
11622
- if (child2.elementType === elementType || // Keep this check inline so it only runs on the false path:
11623
- isCompatibleFamilyForHotReloading(child2, element) || // Lazy types should reconcile their resolved type.
11622
+ if (child.elementType === elementType || // Keep this check inline so it only runs on the false path:
11623
+ isCompatibleFamilyForHotReloading(child, element) || // Lazy types should reconcile their resolved type.
11624
11624
  // We need to do this after the Hot Reloading check above,
11625
11625
  // because hot reloading has different semantics than prod because
11626
11626
  // it doesn't resuspend. So we can't let the call below suspend.
11627
- typeof elementType === "object" && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === child2.type) {
11628
- deleteRemainingChildren(returnFiber, child2.sibling);
11629
- var _existing = useFiber(child2, element.props);
11630
- _existing.ref = coerceRef(returnFiber, child2, element);
11627
+ typeof elementType === "object" && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === child.type) {
11628
+ deleteRemainingChildren(returnFiber, child.sibling);
11629
+ var _existing = useFiber(child, element.props);
11630
+ _existing.ref = coerceRef(returnFiber, child, element);
11631
11631
  _existing.return = returnFiber;
11632
11632
  {
11633
11633
  _existing._debugSource = element._source;
@@ -11636,12 +11636,12 @@ var require_react_reconciler_development = __commonJS({
11636
11636
  return _existing;
11637
11637
  }
11638
11638
  }
11639
- deleteRemainingChildren(returnFiber, child2);
11639
+ deleteRemainingChildren(returnFiber, child);
11640
11640
  break;
11641
11641
  } else {
11642
- deleteChild(returnFiber, child2);
11642
+ deleteChild(returnFiber, child);
11643
11643
  }
11644
- child2 = child2.sibling;
11644
+ child = child.sibling;
11645
11645
  }
11646
11646
  if (element.type === REACT_FRAGMENT_TYPE) {
11647
11647
  var created = createFiberFromFragment(element.props.children, returnFiber.mode, lanes, element.key);
@@ -11656,22 +11656,22 @@ var require_react_reconciler_development = __commonJS({
11656
11656
  }
11657
11657
  function reconcileSinglePortal(returnFiber, currentFirstChild, portal, lanes) {
11658
11658
  var key = portal.key;
11659
- var child2 = currentFirstChild;
11660
- while (child2 !== null) {
11661
- if (child2.key === key) {
11662
- if (child2.tag === HostPortal && child2.stateNode.containerInfo === portal.containerInfo && child2.stateNode.implementation === portal.implementation) {
11663
- deleteRemainingChildren(returnFiber, child2.sibling);
11664
- var existing = useFiber(child2, portal.children || []);
11659
+ var child = currentFirstChild;
11660
+ while (child !== null) {
11661
+ if (child.key === key) {
11662
+ if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
11663
+ deleteRemainingChildren(returnFiber, child.sibling);
11664
+ var existing = useFiber(child, portal.children || []);
11665
11665
  existing.return = returnFiber;
11666
11666
  return existing;
11667
11667
  } else {
11668
- deleteRemainingChildren(returnFiber, child2);
11668
+ deleteRemainingChildren(returnFiber, child);
11669
11669
  break;
11670
11670
  }
11671
11671
  } else {
11672
- deleteChild(returnFiber, child2);
11672
+ deleteChild(returnFiber, child);
11673
11673
  }
11674
- child2 = child2.sibling;
11674
+ child = child.sibling;
11675
11675
  }
11676
11676
  var created = createFiberFromPortal(portal, returnFiber.mode, lanes);
11677
11677
  created.return = returnFiber;
@@ -11734,10 +11734,10 @@ var require_react_reconciler_development = __commonJS({
11734
11734
  newChild.sibling = null;
11735
11735
  }
11736
11736
  function resetChildFibers(workInProgress2, lanes) {
11737
- var child2 = workInProgress2.child;
11738
- while (child2 !== null) {
11739
- resetWorkInProgress(child2, lanes);
11740
- child2 = child2.sibling;
11737
+ var child = workInProgress2.child;
11738
+ while (child !== null) {
11739
+ resetWorkInProgress(child, lanes);
11740
+ child = child.sibling;
11741
11741
  }
11742
11742
  }
11743
11743
  var valueCursor = createCursor(null);
@@ -14512,10 +14512,10 @@ var require_react_reconciler_development = __commonJS({
14512
14512
  passiveEffectStartTime = now$1();
14513
14513
  }
14514
14514
  function transferActualDuration(fiber) {
14515
- var child2 = fiber.child;
14516
- while (child2) {
14517
- fiber.actualDuration += child2.actualDuration;
14518
- child2 = child2.sibling;
14515
+ var child = fiber.child;
14516
+ while (child) {
14517
+ fiber.actualDuration += child.actualDuration;
14518
+ child = child.sibling;
14519
14519
  }
14520
14520
  }
14521
14521
  function resolveDefaultProps(Component, baseProps) {
@@ -15538,11 +15538,11 @@ var require_react_reconciler_development = __commonJS({
15538
15538
  }
15539
15539
  }
15540
15540
  }
15541
- var child2 = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress2, workInProgress2.mode, renderLanes2);
15542
- child2.ref = workInProgress2.ref;
15543
- child2.return = workInProgress2;
15544
- workInProgress2.child = child2;
15545
- return child2;
15541
+ var child = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress2, workInProgress2.mode, renderLanes2);
15542
+ child.ref = workInProgress2.ref;
15543
+ child.return = workInProgress2;
15544
+ workInProgress2.child = child;
15545
+ return child;
15546
15546
  }
15547
15547
  {
15548
15548
  var _type = Component.type;
@@ -15918,9 +15918,9 @@ var require_react_reconciler_development = __commonJS({
15918
15918
  return mountHostRootWithoutHydrating(current2, workInProgress2, nextChildren, renderLanes2, _recoverableError);
15919
15919
  } else {
15920
15920
  enterHydrationState(workInProgress2);
15921
- var child2 = mountChildFibers(workInProgress2, null, nextChildren, renderLanes2);
15922
- workInProgress2.child = child2;
15923
- var node = child2;
15921
+ var child = mountChildFibers(workInProgress2, null, nextChildren, renderLanes2);
15922
+ workInProgress2.child = child;
15923
+ var node = child;
15924
15924
  while (node) {
15925
15925
  node.flags = node.flags & ~Placement | Hydrating;
15926
15926
  node = node.sibling;
@@ -15977,29 +15977,29 @@ var require_react_reconciler_development = __commonJS({
15977
15977
  workInProgress2.type = Component;
15978
15978
  var resolvedTag = workInProgress2.tag = resolveLazyComponentTag(Component);
15979
15979
  var resolvedProps = resolveDefaultProps(Component, props);
15980
- var child2;
15980
+ var child;
15981
15981
  switch (resolvedTag) {
15982
15982
  case FunctionComponent: {
15983
15983
  {
15984
15984
  validateFunctionComponentInDev(workInProgress2, Component);
15985
15985
  workInProgress2.type = Component = resolveFunctionForHotReloading(Component);
15986
15986
  }
15987
- child2 = updateFunctionComponent(null, workInProgress2, Component, resolvedProps, renderLanes2);
15988
- return child2;
15987
+ child = updateFunctionComponent(null, workInProgress2, Component, resolvedProps, renderLanes2);
15988
+ return child;
15989
15989
  }
15990
15990
  case ClassComponent: {
15991
15991
  {
15992
15992
  workInProgress2.type = Component = resolveClassForHotReloading(Component);
15993
15993
  }
15994
- child2 = updateClassComponent(null, workInProgress2, Component, resolvedProps, renderLanes2);
15995
- return child2;
15994
+ child = updateClassComponent(null, workInProgress2, Component, resolvedProps, renderLanes2);
15995
+ return child;
15996
15996
  }
15997
15997
  case ForwardRef: {
15998
15998
  {
15999
15999
  workInProgress2.type = Component = resolveForwardRefForHotReloading(Component);
16000
16000
  }
16001
- child2 = updateForwardRef(null, workInProgress2, Component, resolvedProps, renderLanes2);
16002
- return child2;
16001
+ child = updateForwardRef(null, workInProgress2, Component, resolvedProps, renderLanes2);
16002
+ return child;
16003
16003
  }
16004
16004
  case MemoComponent: {
16005
16005
  {
@@ -16016,7 +16016,7 @@ var require_react_reconciler_development = __commonJS({
16016
16016
  }
16017
16017
  }
16018
16018
  }
16019
- child2 = updateMemoComponent(
16019
+ child = updateMemoComponent(
16020
16020
  null,
16021
16021
  workInProgress2,
16022
16022
  Component,
@@ -16024,7 +16024,7 @@ var require_react_reconciler_development = __commonJS({
16024
16024
  // The inner type can have defaults too
16025
16025
  renderLanes2
16026
16026
  );
16027
- return child2;
16027
+ return child;
16028
16028
  }
16029
16029
  }
16030
16030
  var hint = "";
@@ -16986,9 +16986,9 @@ var require_react_reconciler_development = __commonJS({
16986
16986
  return updateSuspenseComponent(current2, workInProgress2, renderLanes2);
16987
16987
  } else {
16988
16988
  pushSuspenseContext(workInProgress2, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
16989
- var child2 = bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
16990
- if (child2 !== null) {
16991
- return child2.sibling;
16989
+ var child = bailoutOnAlreadyFinishedWork(current2, workInProgress2, renderLanes2);
16990
+ if (child !== null) {
16991
+ return child.sibling;
16992
16992
  } else {
16993
16993
  return null;
16994
16994
  }
@@ -17168,12 +17168,12 @@ var require_react_reconciler_development = __commonJS({
17168
17168
  if ((completedWork.flags & ChildDeletion) !== NoFlags) {
17169
17169
  return false;
17170
17170
  }
17171
- var child2 = completedWork.child;
17172
- while (child2 !== null) {
17173
- if ((child2.flags & MutationMask) !== NoFlags || (child2.subtreeFlags & MutationMask) !== NoFlags) {
17171
+ var child = completedWork.child;
17172
+ while (child !== null) {
17173
+ if ((child.flags & MutationMask) !== NoFlags || (child.subtreeFlags & MutationMask) !== NoFlags) {
17174
17174
  return false;
17175
17175
  }
17176
- child2 = child2.sibling;
17176
+ child = child.sibling;
17177
17177
  }
17178
17178
  return true;
17179
17179
  }
@@ -17247,9 +17247,9 @@ var require_react_reconciler_development = __commonJS({
17247
17247
  appendInitialChild(parent, _instance);
17248
17248
  } else if (node.tag === HostPortal) ;
17249
17249
  else if (node.tag === OffscreenComponent && node.memoizedState !== null) {
17250
- var child2 = node.child;
17251
- if (child2 !== null) {
17252
- child2.return = node;
17250
+ var child = node.child;
17251
+ if (child !== null) {
17252
+ child.return = node;
17253
17253
  }
17254
17254
  appendAllChildren(parent, node, true, true);
17255
17255
  } else if (node.child !== null) {
@@ -17291,9 +17291,9 @@ var require_react_reconciler_development = __commonJS({
17291
17291
  appendChildToContainerChildSet(containerChildSet, _instance2);
17292
17292
  } else if (node.tag === HostPortal) ;
17293
17293
  else if (node.tag === OffscreenComponent && node.memoizedState !== null) {
17294
- var child2 = node.child;
17295
- if (child2 !== null) {
17296
- child2.return = node;
17294
+ var child = node.child;
17295
+ if (child !== null) {
17296
+ child.return = node;
17297
17297
  }
17298
17298
  appendAllChildrenToContainer(containerChildSet, node, true, true);
17299
17299
  } else if (node.child !== null) {
@@ -17426,14 +17426,14 @@ var require_react_reconciler_development = __commonJS({
17426
17426
  if ((completedWork.mode & ProfileMode) !== NoMode) {
17427
17427
  var actualDuration = completedWork.actualDuration;
17428
17428
  var treeBaseDuration = completedWork.selfBaseDuration;
17429
- var child2 = completedWork.child;
17430
- while (child2 !== null) {
17431
- newChildLanes = mergeLanes(newChildLanes, mergeLanes(child2.lanes, child2.childLanes));
17432
- subtreeFlags |= child2.subtreeFlags;
17433
- subtreeFlags |= child2.flags;
17434
- actualDuration += child2.actualDuration;
17435
- treeBaseDuration += child2.treeBaseDuration;
17436
- child2 = child2.sibling;
17429
+ var child = completedWork.child;
17430
+ while (child !== null) {
17431
+ newChildLanes = mergeLanes(newChildLanes, mergeLanes(child.lanes, child.childLanes));
17432
+ subtreeFlags |= child.subtreeFlags;
17433
+ subtreeFlags |= child.flags;
17434
+ actualDuration += child.actualDuration;
17435
+ treeBaseDuration += child.treeBaseDuration;
17436
+ child = child.sibling;
17437
17437
  }
17438
17438
  completedWork.actualDuration = actualDuration;
17439
17439
  completedWork.treeBaseDuration = treeBaseDuration;
@@ -18186,10 +18186,10 @@ var require_react_reconciler_development = __commonJS({
18186
18186
  function commitBeforeMutationEffects_begin() {
18187
18187
  while (nextEffect !== null) {
18188
18188
  var fiber = nextEffect;
18189
- var child2 = fiber.child;
18190
- if ((fiber.subtreeFlags & BeforeMutationMask) !== NoFlags && child2 !== null) {
18191
- child2.return = fiber;
18192
- nextEffect = child2;
18189
+ var child = fiber.child;
18190
+ if ((fiber.subtreeFlags & BeforeMutationMask) !== NoFlags && child !== null) {
18191
+ child.return = fiber;
18192
+ nextEffect = child;
18193
18193
  } else {
18194
18194
  commitBeforeMutationEffects_complete();
18195
18195
  }
@@ -18847,10 +18847,10 @@ var require_react_reconciler_development = __commonJS({
18847
18847
  }
18848
18848
  } else if (tag2 === HostPortal) ;
18849
18849
  else {
18850
- var child2 = node.child;
18851
- if (child2 !== null) {
18852
- insertOrAppendPlacementNodeIntoContainer(child2, before, parent);
18853
- var sibling = child2.sibling;
18850
+ var child = node.child;
18851
+ if (child !== null) {
18852
+ insertOrAppendPlacementNodeIntoContainer(child, before, parent);
18853
+ var sibling = child.sibling;
18854
18854
  while (sibling !== null) {
18855
18855
  insertOrAppendPlacementNodeIntoContainer(sibling, before, parent);
18856
18856
  sibling = sibling.sibling;
@@ -18870,10 +18870,10 @@ var require_react_reconciler_development = __commonJS({
18870
18870
  }
18871
18871
  } else if (tag2 === HostPortal) ;
18872
18872
  else {
18873
- var child2 = node.child;
18874
- if (child2 !== null) {
18875
- insertOrAppendPlacementNode(child2, before, parent);
18876
- var sibling = child2.sibling;
18873
+ var child = node.child;
18874
+ if (child !== null) {
18875
+ insertOrAppendPlacementNode(child, before, parent);
18876
+ var sibling = child.sibling;
18877
18877
  while (sibling !== null) {
18878
18878
  insertOrAppendPlacementNode(sibling, before, parent);
18879
18879
  sibling = sibling.sibling;
@@ -18918,10 +18918,10 @@ var require_react_reconciler_development = __commonJS({
18918
18918
  detachFiberMutation(deletedFiber);
18919
18919
  }
18920
18920
  function recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, parent) {
18921
- var child2 = parent.child;
18922
- while (child2 !== null) {
18923
- commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, child2);
18924
- child2 = child2.sibling;
18921
+ var child = parent.child;
18922
+ while (child !== null) {
18923
+ commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, child);
18924
+ child = child.sibling;
18925
18925
  }
18926
18926
  }
18927
18927
  function commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, deletedFiber) {
@@ -19125,11 +19125,11 @@ var require_react_reconciler_development = __commonJS({
19125
19125
  }
19126
19126
  var prevDebugFiber = getCurrentFiber();
19127
19127
  if (parentFiber.subtreeFlags & MutationMask) {
19128
- var child2 = parentFiber.child;
19129
- while (child2 !== null) {
19130
- setCurrentFiber(child2);
19131
- commitMutationEffectsOnFiber(child2, root);
19132
- child2 = child2.sibling;
19128
+ var child = parentFiber.child;
19129
+ while (child !== null) {
19130
+ setCurrentFiber(child);
19131
+ commitMutationEffectsOnFiber(child, root);
19132
+ child = child.sibling;
19133
19133
  }
19134
19134
  }
19135
19135
  setCurrentFiber(prevDebugFiber);
@@ -19411,16 +19411,16 @@ var require_react_reconciler_development = __commonJS({
19411
19411
  nextEffect = fiber;
19412
19412
  reappearLayoutEffects_begin(fiber);
19413
19413
  }
19414
- var child2 = firstChild;
19415
- while (child2 !== null) {
19416
- nextEffect = child2;
19414
+ var child = firstChild;
19415
+ while (child !== null) {
19416
+ nextEffect = child;
19417
19417
  commitLayoutEffects_begin(
19418
- child2,
19418
+ child,
19419
19419
  // New root; bubble back up to here and stop.
19420
19420
  root,
19421
19421
  committedLanes
19422
19422
  );
19423
- child2 = child2.sibling;
19423
+ child = child.sibling;
19424
19424
  }
19425
19425
  nextEffect = fiber;
19426
19426
  offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden;
@@ -19638,7 +19638,7 @@ var require_react_reconciler_development = __commonJS({
19638
19638
  function commitPassiveUnmountEffects_begin() {
19639
19639
  while (nextEffect !== null) {
19640
19640
  var fiber = nextEffect;
19641
- var child2 = fiber.child;
19641
+ var child = fiber.child;
19642
19642
  if ((nextEffect.flags & ChildDeletion) !== NoFlags) {
19643
19643
  var deletions = fiber.deletions;
19644
19644
  if (deletions !== null) {
@@ -19664,9 +19664,9 @@ var require_react_reconciler_development = __commonJS({
19664
19664
  nextEffect = fiber;
19665
19665
  }
19666
19666
  }
19667
- if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && child2 !== null) {
19668
- child2.return = fiber;
19669
- nextEffect = child2;
19667
+ if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && child !== null) {
19668
+ child.return = fiber;
19669
+ nextEffect = child;
19670
19670
  } else {
19671
19671
  commitPassiveUnmountEffects_complete();
19672
19672
  }
@@ -19711,10 +19711,10 @@ var require_react_reconciler_development = __commonJS({
19711
19711
  setCurrentFiber(fiber);
19712
19712
  commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor);
19713
19713
  resetCurrentFiber();
19714
- var child2 = fiber.child;
19715
- if (child2 !== null) {
19716
- child2.return = fiber;
19717
- nextEffect = child2;
19714
+ var child = fiber.child;
19715
+ if (child !== null) {
19716
+ child.return = fiber;
19717
+ nextEffect = child;
19718
19718
  } else {
19719
19719
  commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot);
19720
19720
  }
@@ -19967,10 +19967,10 @@ var require_react_reconciler_development = __commonJS({
19967
19967
  if (selectorIndex === selectors.length) {
19968
19968
  matchingFibers.push(fiber);
19969
19969
  } else {
19970
- var child2 = fiber.child;
19971
- while (child2 !== null) {
19972
- stack.push(child2, selectorIndex);
19973
- child2 = child2.sibling;
19970
+ var child = fiber.child;
19971
+ while (child !== null) {
19972
+ stack.push(child, selectorIndex);
19973
+ child = child.sibling;
19974
19974
  }
19975
19975
  }
19976
19976
  }
@@ -19994,10 +19994,10 @@ var require_react_reconciler_development = __commonJS({
19994
19994
  if (selectorIndex === selectors.length) {
19995
19995
  return true;
19996
19996
  } else {
19997
- var child2 = fiber.child;
19998
- while (child2 !== null) {
19999
- stack.push(child2, selectorIndex);
20000
- child2 = child2.sibling;
19997
+ var child = fiber.child;
19998
+ while (child !== null) {
19999
+ stack.push(child, selectorIndex);
20000
+ child = child.sibling;
20001
20001
  }
20002
20002
  }
20003
20003
  }
@@ -20020,10 +20020,10 @@ var require_react_reconciler_development = __commonJS({
20020
20020
  }
20021
20021
  instanceRoots.push(node.stateNode);
20022
20022
  } else {
20023
- var child2 = node.child;
20024
- while (child2 !== null) {
20025
- stack.push(child2);
20026
- child2 = child2.sibling;
20023
+ var child = node.child;
20024
+ while (child !== null) {
20025
+ stack.push(child);
20026
+ child = child.sibling;
20027
20027
  }
20028
20028
  }
20029
20029
  }
@@ -20052,10 +20052,10 @@ var require_react_reconciler_development = __commonJS({
20052
20052
  }
20053
20053
  }
20054
20054
  if (selectorIndex < selectors.length) {
20055
- var child2 = fiber.child;
20056
- while (child2 !== null) {
20057
- stack.push(child2, selectorIndex);
20058
- child2 = child2.sibling;
20055
+ var child = fiber.child;
20056
+ while (child !== null) {
20057
+ stack.push(child, selectorIndex);
20058
+ child = child.sibling;
20059
20059
  }
20060
20060
  }
20061
20061
  }
@@ -20138,10 +20138,10 @@ var require_react_reconciler_development = __commonJS({
20138
20138
  return true;
20139
20139
  }
20140
20140
  }
20141
- var child2 = fiber.child;
20142
- while (child2 !== null) {
20143
- stack.push(child2);
20144
- child2 = child2.sibling;
20141
+ var child = fiber.child;
20142
+ while (child !== null) {
20143
+ stack.push(child);
20144
+ child = child.sibling;
20145
20145
  }
20146
20146
  }
20147
20147
  return false;
@@ -20633,10 +20633,10 @@ var require_react_reconciler_development = __commonJS({
20633
20633
  }
20634
20634
  }
20635
20635
  }
20636
- var child2 = node.child;
20637
- if (node.subtreeFlags & StoreConsistency && child2 !== null) {
20638
- child2.return = node;
20639
- node = child2;
20636
+ var child = node.child;
20637
+ if (node.subtreeFlags & StoreConsistency && child !== null) {
20638
+ child.return = node;
20639
+ node = child;
20640
20640
  continue;
20641
20641
  }
20642
20642
  if (node === finishedWork) {
@@ -21070,10 +21070,10 @@ var require_react_reconciler_development = __commonJS({
21070
21070
  if ((completedWork.mode & ProfileMode) !== NoMode) {
21071
21071
  stopProfilerTimerIfRunningAndRecordDelta(completedWork, false);
21072
21072
  var actualDuration = completedWork.actualDuration;
21073
- var child2 = completedWork.child;
21074
- while (child2 !== null) {
21075
- actualDuration += child2.actualDuration;
21076
- child2 = child2.sibling;
21073
+ var child = completedWork.child;
21074
+ while (child !== null) {
21075
+ actualDuration += child.actualDuration;
21076
+ child = child.sibling;
21077
21077
  }
21078
21078
  completedWork.actualDuration = actualDuration;
21079
21079
  }
@@ -21850,7 +21850,7 @@ var require_react_reconciler_development = __commonJS({
21850
21850
  };
21851
21851
  function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) {
21852
21852
  {
21853
- var alternate = fiber.alternate, child2 = fiber.child, sibling = fiber.sibling, tag2 = fiber.tag, type = fiber.type;
21853
+ var alternate = fiber.alternate, child = fiber.child, sibling = fiber.sibling, tag2 = fiber.tag, type = fiber.type;
21854
21854
  var candidateType = null;
21855
21855
  switch (tag2) {
21856
21856
  case FunctionComponent:
@@ -21895,8 +21895,8 @@ var require_react_reconciler_development = __commonJS({
21895
21895
  scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp);
21896
21896
  }
21897
21897
  }
21898
- if (child2 !== null && !needsRemount) {
21899
- scheduleFibersWithFamiliesRecursively(child2, updatedFamilies, staleFamilies);
21898
+ if (child !== null && !needsRemount) {
21899
+ scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies);
21900
21900
  }
21901
21901
  if (sibling !== null) {
21902
21902
  scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies);
@@ -21915,7 +21915,7 @@ var require_react_reconciler_development = __commonJS({
21915
21915
  };
21916
21916
  function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) {
21917
21917
  {
21918
- var child2 = fiber.child, sibling = fiber.sibling, tag2 = fiber.tag, type = fiber.type;
21918
+ var child = fiber.child, sibling = fiber.sibling, tag2 = fiber.tag, type = fiber.type;
21919
21919
  var candidateType = null;
21920
21920
  switch (tag2) {
21921
21921
  case FunctionComponent:
@@ -21936,8 +21936,8 @@ var require_react_reconciler_development = __commonJS({
21936
21936
  if (didMatch) {
21937
21937
  findHostInstancesForFiberShallowly(fiber, hostInstances);
21938
21938
  } else {
21939
- if (child2 !== null) {
21940
- findHostInstancesForMatchingFibersRecursively(child2, types, hostInstances);
21939
+ if (child !== null) {
21940
+ findHostInstancesForMatchingFibersRecursively(child, types, hostInstances);
21941
21941
  }
21942
21942
  }
21943
21943
  if (sibling !== null) {
@@ -22744,10 +22744,10 @@ var require_react_reconciler_development = __commonJS({
22744
22744
  var setErrorHandler = null;
22745
22745
  var setSuspenseHandler = null;
22746
22746
  {
22747
- var copyWithDeleteImpl = function(obj, path2, index2) {
22748
- var key = path2[index2];
22747
+ var copyWithDeleteImpl = function(obj, path4, index2) {
22748
+ var key = path4[index2];
22749
22749
  var updated = isArray(obj) ? obj.slice() : assign({}, obj);
22750
- if (index2 + 1 === path2.length) {
22750
+ if (index2 + 1 === path4.length) {
22751
22751
  if (isArray(updated)) {
22752
22752
  updated.splice(key, 1);
22753
22753
  } else {
@@ -22755,11 +22755,11 @@ var require_react_reconciler_development = __commonJS({
22755
22755
  }
22756
22756
  return updated;
22757
22757
  }
22758
- updated[key] = copyWithDeleteImpl(obj[key], path2, index2 + 1);
22758
+ updated[key] = copyWithDeleteImpl(obj[key], path4, index2 + 1);
22759
22759
  return updated;
22760
22760
  };
22761
- var copyWithDelete = function(obj, path2) {
22762
- return copyWithDeleteImpl(obj, path2, 0);
22761
+ var copyWithDelete = function(obj, path4) {
22762
+ return copyWithDeleteImpl(obj, path4, 0);
22763
22763
  };
22764
22764
  var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
22765
22765
  var oldKey = oldPath[index2];
@@ -22797,17 +22797,17 @@ var require_react_reconciler_development = __commonJS({
22797
22797
  }
22798
22798
  return copyWithRenameImpl(obj, oldPath, newPath, 0);
22799
22799
  };
22800
- var copyWithSetImpl = function(obj, path2, index2, value) {
22801
- if (index2 >= path2.length) {
22800
+ var copyWithSetImpl = function(obj, path4, index2, value) {
22801
+ if (index2 >= path4.length) {
22802
22802
  return value;
22803
22803
  }
22804
- var key = path2[index2];
22804
+ var key = path4[index2];
22805
22805
  var updated = isArray(obj) ? obj.slice() : assign({}, obj);
22806
- updated[key] = copyWithSetImpl(obj[key], path2, index2 + 1, value);
22806
+ updated[key] = copyWithSetImpl(obj[key], path4, index2 + 1, value);
22807
22807
  return updated;
22808
22808
  };
22809
- var copyWithSet = function(obj, path2, value) {
22810
- return copyWithSetImpl(obj, path2, 0, value);
22809
+ var copyWithSet = function(obj, path4, value) {
22810
+ return copyWithSetImpl(obj, path4, 0, value);
22811
22811
  };
22812
22812
  var findHook = function(fiber, id) {
22813
22813
  var currentHook2 = fiber.memoizedState;
@@ -22817,10 +22817,10 @@ var require_react_reconciler_development = __commonJS({
22817
22817
  }
22818
22818
  return currentHook2;
22819
22819
  };
22820
- overrideHookState = function(fiber, id, path2, value) {
22820
+ overrideHookState = function(fiber, id, path4, value) {
22821
22821
  var hook = findHook(fiber, id);
22822
22822
  if (hook !== null) {
22823
- var newState = copyWithSet(hook.memoizedState, path2, value);
22823
+ var newState = copyWithSet(hook.memoizedState, path4, value);
22824
22824
  hook.memoizedState = newState;
22825
22825
  hook.baseState = newState;
22826
22826
  fiber.memoizedProps = assign({}, fiber.memoizedProps);
@@ -22830,10 +22830,10 @@ var require_react_reconciler_development = __commonJS({
22830
22830
  }
22831
22831
  }
22832
22832
  };
22833
- overrideHookStateDeletePath = function(fiber, id, path2) {
22833
+ overrideHookStateDeletePath = function(fiber, id, path4) {
22834
22834
  var hook = findHook(fiber, id);
22835
22835
  if (hook !== null) {
22836
- var newState = copyWithDelete(hook.memoizedState, path2);
22836
+ var newState = copyWithDelete(hook.memoizedState, path4);
22837
22837
  hook.memoizedState = newState;
22838
22838
  hook.baseState = newState;
22839
22839
  fiber.memoizedProps = assign({}, fiber.memoizedProps);
@@ -22856,8 +22856,8 @@ var require_react_reconciler_development = __commonJS({
22856
22856
  }
22857
22857
  }
22858
22858
  };
22859
- overrideProps = function(fiber, path2, value) {
22860
- fiber.pendingProps = copyWithSet(fiber.memoizedProps, path2, value);
22859
+ overrideProps = function(fiber, path4, value) {
22860
+ fiber.pendingProps = copyWithSet(fiber.memoizedProps, path4, value);
22861
22861
  if (fiber.alternate) {
22862
22862
  fiber.alternate.pendingProps = fiber.pendingProps;
22863
22863
  }
@@ -22866,8 +22866,8 @@ var require_react_reconciler_development = __commonJS({
22866
22866
  scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
22867
22867
  }
22868
22868
  };
22869
- overridePropsDeletePath = function(fiber, path2) {
22870
- fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path2);
22869
+ overridePropsDeletePath = function(fiber, path4) {
22870
+ fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path4);
22871
22871
  if (fiber.alternate) {
22872
22872
  fiber.alternate.pendingProps = fiber.pendingProps;
22873
22873
  }
@@ -29446,7 +29446,7 @@ var require_has_flag = __commonJS({
29446
29446
  var require_supports_colors = __commonJS({
29447
29447
  "node_modules/@colors/colors/lib/system/supports-colors.js"(exports, module) {
29448
29448
  "use strict";
29449
- var os4 = __require("os");
29449
+ var os5 = __require("os");
29450
29450
  var hasFlag2 = require_has_flag();
29451
29451
  var env3 = process.env;
29452
29452
  var forceColor = void 0;
@@ -29484,7 +29484,7 @@ var require_supports_colors = __commonJS({
29484
29484
  }
29485
29485
  var min = forceColor ? 1 : 0;
29486
29486
  if (process.platform === "win32") {
29487
- var osRelease = os4.release().split(".");
29487
+ var osRelease = os5.release().split(".");
29488
29488
  if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
29489
29489
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
29490
29490
  }
@@ -30897,7 +30897,7 @@ var require_core = __commonJS({
30897
30897
  builder.addText(node);
30898
30898
  } else if (node.children) {
30899
30899
  builder.openNode(node);
30900
- node.children.forEach((child2) => this._walk(builder, child2));
30900
+ node.children.forEach((child) => this._walk(builder, child));
30901
30901
  builder.closeNode(node);
30902
30902
  }
30903
30903
  return builder;
@@ -30911,8 +30911,8 @@ var require_core = __commonJS({
30911
30911
  if (node.children.every((el) => typeof el === "string")) {
30912
30912
  node.children = [node.children.join("")];
30913
30913
  } else {
30914
- node.children.forEach((child2) => {
30915
- _TokenTree._collapse(child2);
30914
+ node.children.forEach((child) => {
30915
+ _TokenTree._collapse(child);
30916
30916
  });
30917
30917
  }
30918
30918
  }
@@ -31542,21 +31542,21 @@ var require_core = __commonJS({
31542
31542
  function nodeStream(node) {
31543
31543
  const result = [];
31544
31544
  (function _nodeStream(node2, offset) {
31545
- for (let child2 = node2.firstChild; child2; child2 = child2.nextSibling) {
31546
- if (child2.nodeType === 3) {
31547
- offset += child2.nodeValue.length;
31548
- } else if (child2.nodeType === 1) {
31545
+ for (let child = node2.firstChild; child; child = child.nextSibling) {
31546
+ if (child.nodeType === 3) {
31547
+ offset += child.nodeValue.length;
31548
+ } else if (child.nodeType === 1) {
31549
31549
  result.push({
31550
31550
  event: "start",
31551
31551
  offset,
31552
- node: child2
31552
+ node: child
31553
31553
  });
31554
- offset = _nodeStream(child2, offset);
31555
- if (!tag2(child2).match(/br|hr|img|input/)) {
31554
+ offset = _nodeStream(child, offset);
31555
+ if (!tag2(child).match(/br|hr|img|input/)) {
31556
31556
  result.push({
31557
31557
  event: "stop",
31558
31558
  offset,
31559
- node: child2
31559
+ node: child
31560
31560
  });
31561
31561
  }
31562
31562
  }
@@ -70141,9 +70141,9 @@ var require_parser = __commonJS({
70141
70141
  }
70142
70142
  }
70143
70143
  _adoptNodes(donor, recipient) {
70144
- for (let child2 = this.treeAdapter.getFirstChild(donor); child2; child2 = this.treeAdapter.getFirstChild(donor)) {
70145
- this.treeAdapter.detachNode(child2);
70146
- this.treeAdapter.appendChild(recipient, child2);
70144
+ for (let child = this.treeAdapter.getFirstChild(donor); child; child = this.treeAdapter.getFirstChild(donor)) {
70145
+ this.treeAdapter.detachNode(child);
70146
+ this.treeAdapter.appendChild(recipient, child);
70147
70147
  }
70148
70148
  }
70149
70149
  //Token processing
@@ -73569,15 +73569,15 @@ var require_route = __commonJS({
73569
73569
  };
73570
73570
  }
73571
73571
  function wrapConversion(toModel, graph) {
73572
- const path2 = [graph[toModel].parent, toModel];
73572
+ const path4 = [graph[toModel].parent, toModel];
73573
73573
  let fn = conversions[graph[toModel].parent][toModel];
73574
73574
  let cur = graph[toModel].parent;
73575
73575
  while (graph[cur].parent) {
73576
- path2.unshift(graph[cur].parent);
73576
+ path4.unshift(graph[cur].parent);
73577
73577
  fn = link3(conversions[graph[cur].parent][cur], fn);
73578
73578
  cur = graph[cur].parent;
73579
73579
  }
73580
- fn.conversion = path2;
73580
+ fn.conversion = path4;
73581
73581
  return fn;
73582
73582
  }
73583
73583
  module.exports = function(fromModel) {
@@ -73817,7 +73817,7 @@ var require_has_flag2 = __commonJS({
73817
73817
  var require_supports_color = __commonJS({
73818
73818
  "node_modules/supports-color/index.js"(exports, module) {
73819
73819
  "use strict";
73820
- var os4 = __require("os");
73820
+ var os5 = __require("os");
73821
73821
  var tty2 = __require("tty");
73822
73822
  var hasFlag2 = require_has_flag2();
73823
73823
  var { env: env3 } = process;
@@ -73865,7 +73865,7 @@ var require_supports_color = __commonJS({
73865
73865
  return min;
73866
73866
  }
73867
73867
  if (process.platform === "win32") {
73868
- const osRelease = os4.release().split(".");
73868
+ const osRelease = os5.release().split(".");
73869
73869
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
73870
73870
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
73871
73871
  }
@@ -75327,9 +75327,9 @@ var require_react_jsx_runtime_development = __commonJS({
75327
75327
  }
75328
75328
  if (isArray(node)) {
75329
75329
  for (var i = 0; i < node.length; i++) {
75330
- var child2 = node[i];
75331
- if (isValidElement(child2)) {
75332
- validateExplicitKey(child2, parentType);
75330
+ var child = node[i];
75331
+ if (isValidElement(child)) {
75332
+ validateExplicitKey(child, parentType);
75333
75333
  }
75334
75334
  }
75335
75335
  } else if (isValidElement(node)) {
@@ -80406,8 +80406,8 @@ function Text({ color, backgroundColor, dimColor = false, bold = false, italic =
80406
80406
  }
80407
80407
 
80408
80408
  // node_modules/ink/build/components/ErrorOverview.js
80409
- var cleanupPath = (path2) => {
80410
- return path2?.replace(`file://${cwd()}/`, "");
80409
+ var cleanupPath = (path4) => {
80410
+ return path4?.replace(`file://${cwd()}/`, "");
80411
80411
  };
80412
80412
  var stackUtils = new import_stack_utils.default({
80413
80413
  cwd: cwd(),
@@ -83569,22 +83569,34 @@ function renderMarkdown(text, width) {
83569
83569
  // src/input.jsx
83570
83570
  var import_react23 = __toESM(require_react(), 1);
83571
83571
  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
83572
- function MultilineInput({
83572
+ var MultilineInput = (0, import_react23.forwardRef)(function MultilineInput2({
83573
83573
  value,
83574
83574
  onChange,
83575
83575
  onSubmit,
83576
+ onPasteImage,
83576
83577
  focus = true,
83577
83578
  placeholder = "",
83578
83579
  history = [],
83579
83580
  navActive = true
83580
- }) {
83581
+ }, ref) {
83581
83582
  const [cursor, setCursor] = (0, import_react23.useState)(value.length);
83582
83583
  const hist = (0, import_react23.useRef)({ index: null, stash: "" });
83584
+ const latest = (0, import_react23.useRef)({ value, cursor });
83585
+ latest.current = { value, cursor };
83583
83586
  const clamp = (n, len) => Math.max(0, Math.min(n, len));
83584
83587
  const set = (v, c2) => {
83585
83588
  onChange(v);
83586
83589
  setCursor(clamp(c2, v.length));
83587
83590
  };
83591
+ (0, import_react23.useImperativeHandle)(ref, () => ({
83592
+ // text placed at the cursor as it is NOW (an image chip arrives after a round trip)
83593
+ insert(text) {
83594
+ const { value: v, cursor: cu } = latest.current;
83595
+ const c2 = clamp(cu, v.length);
83596
+ const sep = c2 > 0 && !/\s$/.test(v.slice(0, c2)) ? " " : "";
83597
+ set(v.slice(0, c2) + sep + text + v.slice(c2), c2 + sep.length + text.length);
83598
+ }
83599
+ }));
83588
83600
  const lineStart = (v, c2) => v.lastIndexOf("\n", c2 - 1) + 1;
83589
83601
  const lineEnd = (v, c2) => {
83590
83602
  const i = v.indexOf("\n", c2);
@@ -83660,6 +83672,8 @@ function MultilineInput({
83660
83672
  else if (input === "w") {
83661
83673
  const head = value.slice(0, c2).replace(/\S+\s*$/, "");
83662
83674
  set(head + value.slice(c2), head.length);
83675
+ } else if (input === "v") {
83676
+ if (onPasteImage) onPasteImage();
83663
83677
  }
83664
83678
  return;
83665
83679
  }
@@ -83684,11 +83698,18 @@ function MultilineInput({
83684
83698
  shown = value.slice(0, c) + source_default.inverse(value[c]) + value.slice(c + 1);
83685
83699
  }
83686
83700
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: shown });
83687
- }
83701
+ });
83702
+ var input_default = MultilineInput;
83688
83703
 
83689
83704
  // src/app.jsx
83690
83705
  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
83691
83706
  var fmtDur = (s) => s < 60 ? `${Math.max(1, Math.round(s))}s` : `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
83707
+ var plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
83708
+ var shortSession = (name) => (name || "").replace(/\.jsonl$/, "");
83709
+ var homeRel = (p) => {
83710
+ const h = os3.homedir();
83711
+ return p && h && p.startsWith(h) ? "~" + p.slice(h.length) : p;
83712
+ };
83692
83713
  var fmtCost = (c) => c >= 0.01 ? `$${c.toFixed(2)}` : c > 0 ? `$${c.toFixed(4)}` : "$0";
83693
83714
  var HISTORY_PATH = path.join(os3.homedir(), ".hum", "history.json");
83694
83715
  var HISTORY_MAX = 300;
@@ -83717,12 +83738,20 @@ var COMMANDS = [
83717
83738
  { name: "/compact", desc: "summarise and restart the context now" },
83718
83739
  { name: "/model", desc: "switch the model for this session (/model <name>)" },
83719
83740
  { name: "/cost", desc: "tokens and cost so far" },
83741
+ { name: "/approve", desc: "approvals on|off \u2014 whether changes and commands wait for you first" },
83742
+ { name: "/continue", desc: "after a pause: let the agent carry on" },
83743
+ { name: "/image", desc: "attach an image file to your next message (/image <path>); ctrl+v pastes a screenshot" },
83720
83744
  { name: "/tools", desc: "what is mounted" },
83745
+ { name: "/hooks", desc: "the lifecycle hooks in scope (~/.hum/hooks.json, <repo>/.hum/hooks.json; Claude Code and Codex hook files too)" },
83721
83746
  { name: "/help", desc: "keys and commands" },
83722
- { name: "/quit", desc: "save and leave" }
83747
+ { name: "/quit", desc: "leave; the session keeps running (hum brings you back)" },
83748
+ { name: "/stop", desc: "end this session's engine (the record is saved)" }
83723
83749
  ];
83724
- var HELP = "!cmd runs a command as you \xB7 esc interrupts the model (what it had is kept) \xB7 type while it works to steer \xB7 edit files in your editor any time (recorded as your turn) \xB7 /resume picks a past session \xB7 /compact restarts the context from a summary \xB7 ctrl+c twice quits";
83725
- function App2({ engine: engine2, task, resume }) {
83750
+ var HELP = "!cmd runs a command as you \xB7 esc interrupts the model (what it had is kept) \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 /approve makes changes and commands wait for you (enter approves, a typed reason rejects) \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` brings you back) \xB7 /stop ends it";
83751
+ var DIFF_TAIL_LINES = 20;
83752
+ var OUTPUT_MAX_LINES = 200;
83753
+ var ERR_TAIL_LINES = 5;
83754
+ function App2({ engine: engine2, task, resume, images = [] }) {
83726
83755
  const { exit } = use_app_default();
83727
83756
  const { stdout } = use_stdout_default();
83728
83757
  const width = (stdout?.columns || 80) - 2;
@@ -83739,6 +83768,11 @@ function App2({ engine: engine2, task, resume }) {
83739
83768
  const [elapsed, setElapsed] = (0, import_react24.useState)(0);
83740
83769
  const [ctrlc, setCtrlc] = (0, import_react24.useState)(0);
83741
83770
  const [picker, setPicker] = (0, import_react24.useState)(null);
83771
+ const [proposal, setProposal] = (0, import_react24.useState)(null);
83772
+ const [gate, setGate] = (0, import_react24.useState)("off");
83773
+ const [paused, setPaused] = (0, import_react24.useState)(false);
83774
+ const attachRef = (0, import_react24.useRef)([]);
83775
+ const inputRef = (0, import_react24.useRef)(null);
83742
83776
  const nextId = (0, import_react24.useRef)(0);
83743
83777
  const phaseRef = (0, import_react24.useRef)("connecting");
83744
83778
  const turnT0 = (0, import_react24.useRef)(null);
@@ -83747,12 +83781,17 @@ function App2({ engine: engine2, task, resume }) {
83747
83781
  const toolsRef = (0, import_react24.useRef)({});
83748
83782
  const historyRef = (0, import_react24.useRef)(loadHistory());
83749
83783
  const modelRef = (0, import_react24.useRef)("");
83784
+ const lastOutRef = (0, import_react24.useRef)(null);
83785
+ const helloRef = (0, import_react24.useRef)(false);
83786
+ const preHello = (0, import_react24.useRef)([]);
83787
+ const [meter, setMeter] = (0, import_react24.useState)({ tokens: 0, cap: 0, input: 0, output: 0 });
83750
83788
  const setPhaseBoth = (p) => {
83751
83789
  phaseRef.current = p;
83752
83790
  setPhase(p);
83753
83791
  };
83754
83792
  const append = (item) => setItems((prev) => [...prev, { id: nextId.current++, ...item }]);
83755
83793
  const menu = value.trimStart().startsWith("/") && !value.includes(" ") ? COMMANDS.filter((c) => c.name.startsWith(value.trim())) : [];
83794
+ const ctxPct = meter.cap > 0 && meter.tokens > 0 ? Math.round(meter.tokens / meter.cap * 100) : 0;
83756
83795
  (0, import_react24.useEffect)(() => {
83757
83796
  if (phase !== "busy" && phase !== "connecting") return void 0;
83758
83797
  const started = Date.now();
@@ -83809,18 +83848,114 @@ function App2({ engine: engine2, task, resume }) {
83809
83848
  append({ kind: "agent", text: `agent ${ev.n} \xB7 ${ev.kind} \xB7 ${ev.desc}` });
83810
83849
  break;
83811
83850
  case "agent_end":
83812
- append({ kind: "agent_end", text: `agent ${ev.n} done \xB7 ${ev.steps} steps \xB7 ${fmtCost(ev.cost_usd)}${ev.reason !== "done" ? ` \xB7 ${ev.reason}` : ""}` });
83851
+ append({ kind: "agent_end", text: `agent ${ev.n} done \xB7 ${plural(ev.steps, "step")} \xB7 ${fmtCost(ev.cost_usd)}${ev.reason !== "done" ? ` \xB7 ${ev.reason}` : ""}` });
83813
83852
  break;
83814
- case "hello":
83853
+ case "hello": {
83815
83854
  setHello(ev);
83855
+ helloRef.current = true;
83816
83856
  modelRef.current = ev.model;
83817
- append({ kind: "banner", text: `${ev.model}${ev.user ? ` \xB7 ${ev.user}` : ""} \xB7 ${ev.cwd} \xB7 tools: ${ev.tools.join(", ")}` });
83818
- if (task) engine2.send({ cmd: "start", task });
83819
- else if (resume === "pick") {
83857
+ setMeter((m) => ({ ...m, tokens: 0, cap: ev.compact_at || 0 }));
83858
+ setGate(ev.gate === "approve" ? "approve" : "off");
83859
+ if (ev.session) setSession(ev.session);
83860
+ const state = ev.state && ev.state !== "new" && ev.state !== "idle" ? ` \xB7 ${ev.state}` : "";
83861
+ append({
83862
+ kind: "banner",
83863
+ text: `${ev.model}${ev.user ? ` \xB7 ${ev.user}` : ""} \xB7 ${homeRel(ev.cwd)} \xB7 tools: ${ev.tools.join(", ")}${state}`,
83864
+ instruction: ev.session ? ev.instruction : null
83865
+ });
83866
+ preHello.current.forEach((it) => append(it));
83867
+ preHello.current = [];
83868
+ if (ev.session) {
83869
+ if (ev.busy) {
83870
+ setPhaseBoth("busy");
83871
+ setStatus(ev.phase || "");
83872
+ turnT0.current = Date.now();
83873
+ } else setPhaseBoth("idle");
83874
+ if (resume === "pick") engine2.send({ cmd: "sessions" });
83875
+ } else if (task) {
83876
+ if (images.length && !ev.images) append({ kind: "warn", text: "this engine does not take images; update hum" });
83877
+ engine2.send({ cmd: "start", task, images: ev.images ? images : [] });
83878
+ } else if (resume === "pick") {
83820
83879
  setPhaseBoth("idle");
83821
83880
  engine2.send({ cmd: "sessions" });
83822
83881
  } else if (resume) engine2.send({ cmd: "resume", name: resume });
83823
- else setPhaseBoth("idle");
83882
+ else {
83883
+ setPhaseBoth("idle");
83884
+ if (ev.images) images.forEach((p) => engine2.send({ cmd: "attach", path: p }));
83885
+ else if (images.length) append({ kind: "warn", text: "this engine does not take images; update hum" });
83886
+ }
83887
+ break;
83888
+ }
83889
+ case "replay":
83890
+ for (const it of ev.items || []) {
83891
+ switch (it.type) {
83892
+ case "you":
83893
+ append({ kind: "you", text: it.text, images: it.images || [] });
83894
+ break;
83895
+ case "text":
83896
+ append({ kind: "hum", text: it.text });
83897
+ break;
83898
+ case "thought":
83899
+ append({ kind: "thought", text: `thought for ${fmtDur(it.secs || 0)} \xB7 ${((it.chars || 0) / 1e3).toFixed(1)}k chars` });
83900
+ break;
83901
+ case "tool_call": {
83902
+ toolsRef.current[it.id] = it;
83903
+ 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 });
83904
+ if (it.diff) {
83905
+ const ls = it.diff.split("\n");
83906
+ append({ kind: "diff", lines: ls.slice(0, DIFF_TAIL_LINES), more: Math.max(0, ls.length - DIFF_TAIL_LINES) });
83907
+ }
83908
+ break;
83909
+ }
83910
+ case "tool_result": {
83911
+ if (!it.agent) lastOutRef.current = { name: it.name, content: it.content || "" };
83912
+ const more = (it.lines || 0) > 1 ? ` (+${it.lines - 1} lines)` : "";
83913
+ append({ kind: "tool_result", text: `${it.summary || "(no output)"}${more}`, isError: !it.ok, agent: it.agent });
83914
+ break;
83915
+ }
83916
+ case "plan": {
83917
+ const glyph = { completed: "\u25FC", in_progress: "\u25B8", pending: "\u25FB" };
83918
+ append({ kind: "plan", steps: (it.steps || []).map((st) => ({ ...st, glyph: glyph[st.status] || "\u25FB" })), explanation: it.explanation });
83919
+ break;
83920
+ }
83921
+ case "turn_end":
83922
+ append({ kind: "turn", text: `${fmtDur(it.elapsed_s || 0)} \xB7 ${plural(it.turns, "step")} \xB7 ${fmtCost(it.cost_usd)} session` });
83923
+ setSpend(it.cost_usd || 0);
83924
+ break;
83925
+ case "agent_start":
83926
+ append({ kind: "agent", text: `agent ${it.n} \xB7 ${it.kind} \xB7 ${it.desc}` });
83927
+ break;
83928
+ case "agent_end":
83929
+ append({ kind: "agent_end", text: `agent ${it.n} done \xB7 ${plural(it.steps, "step")} \xB7 ${fmtCost(it.cost_usd)}` });
83930
+ break;
83931
+ case "compaction":
83932
+ append({ kind: "info", text: `context summarised and restarted${it.prompt_tokens_before ? ` at ${it.prompt_tokens_before.toLocaleString()} tokens` : ""}` });
83933
+ break;
83934
+ case "human_edit":
83935
+ append({ kind: "info", text: `you edited files: ${it.stat}` });
83936
+ break;
83937
+ case "paused":
83938
+ append({ kind: "paused", text: it.detail, trip: it.kind });
83939
+ setPaused(true);
83940
+ break;
83941
+ case "resumed":
83942
+ setPaused(false);
83943
+ break;
83944
+ case "interrupted":
83945
+ append({ kind: "info", text: it.kept ? "stopped \xB7 what it had so far is kept in the session" : "stopped" });
83946
+ break;
83947
+ case "gate":
83948
+ setGate(it.mode);
83949
+ break;
83950
+ case "info":
83951
+ case "warn":
83952
+ case "error":
83953
+ append({ kind: it.type, text: it.text });
83954
+ break;
83955
+ default:
83956
+ break;
83957
+ }
83958
+ }
83824
83959
  break;
83825
83960
  case "sessions":
83826
83961
  if (!ev.items || ev.items.length === 0) {
@@ -83832,8 +83967,9 @@ function App2({ engine: engine2, task, resume }) {
83832
83967
  case "session":
83833
83968
  setSession(ev.name);
83834
83969
  setSpend(0);
83970
+ setPaused(false);
83971
+ setProposal(null);
83835
83972
  if (ev.model) modelRef.current = ev.model;
83836
- append({ kind: "info", text: `session ${ev.name}` });
83837
83973
  break;
83838
83974
  case "turn_start":
83839
83975
  turnT0.current = turnT0.current || Date.now();
@@ -83858,15 +83994,26 @@ function App2({ engine: engine2, task, resume }) {
83858
83994
  case "tool_pending":
83859
83995
  break;
83860
83996
  // the status line already shows it; the call itself lands as a transcript line
83861
- case "tool_call":
83997
+ case "tool_call": {
83862
83998
  foldThinking();
83863
83999
  flushDraft();
83864
84000
  toolsRef.current[ev.id] = ev;
83865
- append({ kind: "tool", text: ev.desc || ev.name, name: ev.name, args: ev.args });
84001
+ const label = ev.name === "write_file" && ev.lines != null ? `${ev.desc || ev.name} (${ev.lines} lines)` : ev.desc || ev.name;
84002
+ append({ kind: "tool", text: label, name: ev.name, args: ev.args });
84003
+ if (ev.diff) {
84004
+ const ls = ev.diff.split("\n");
84005
+ append({ kind: "diff", lines: ls.slice(0, DIFF_TAIL_LINES), more: Math.max(0, ls.length - DIFF_TAIL_LINES) });
84006
+ }
83866
84007
  break;
84008
+ }
83867
84009
  case "tool_result": {
83868
- const more = (ev.lines || 0) > 1 ? ` (+${ev.lines - 1} lines)` : "";
84010
+ lastOutRef.current = { name: ev.name, content: ev.content || "" };
84011
+ const more = (ev.lines || 0) > 1 ? ` (+${ev.lines - 1} lines \xB7 ctrl+o expands)` : "";
83869
84012
  append({ kind: "tool_result", text: `${ev.summary || "(no output)"}${more}`, isError: !ev.ok });
84013
+ if (!ev.ok && ev.content) {
84014
+ const t = ev.content.split("\n").filter((l) => l.trim()).slice(-ERR_TAIL_LINES);
84015
+ if (t.length > 1) append({ kind: "errtail", lines: t });
84016
+ }
83870
84017
  break;
83871
84018
  }
83872
84019
  case "plan": {
@@ -83876,11 +84023,37 @@ function App2({ engine: engine2, task, resume }) {
83876
84023
  append({ kind: "plan", steps: (ev.steps || []).map((st) => ({ ...st, glyph: glyph[st.status] || "\u25FB" })), explanation: ev.explanation });
83877
84024
  break;
83878
84025
  }
84026
+ case "proposal":
84027
+ foldThinking();
84028
+ flushDraft();
84029
+ setProposal({ content: ev.content || "", calls: ev.calls || [] });
84030
+ setStatus("waiting for your decision");
84031
+ break;
84032
+ case "paused":
84033
+ foldThinking();
84034
+ flushDraft();
84035
+ setPaused(true);
84036
+ append({ kind: "paused", text: ev.detail, trip: ev.kind });
84037
+ break;
84038
+ case "resumed":
84039
+ setPaused(false);
84040
+ turnT0.current = Date.now();
84041
+ setPhaseBoth("busy");
84042
+ break;
84043
+ case "proposal_released":
84044
+ setProposal(null);
84045
+ append({ kind: "info", text: "approvals off: the waiting proposal ran" });
84046
+ break;
84047
+ case "gate":
84048
+ setGate(ev.mode);
84049
+ append({ kind: "info", text: ev.mode === "approve" ? "approvals on: changes and commands wait for you first" : "approvals off: the agent acts, you steer" });
84050
+ break;
83879
84051
  case "human_edit":
83880
84052
  append({ kind: "info", text: `you edited files: ${ev.stat}` });
83881
84053
  break;
83882
84054
  case "compaction":
83883
- append({ kind: "info", text: "context summarised and restarted (the session keeps everything)" });
84055
+ append({ kind: "info", text: `context summarised and restarted${ev.prompt_tokens_before ? ` at ${ev.prompt_tokens_before.toLocaleString()} tokens` : ""} (the session keeps everything)` });
84056
+ setMeter((m) => ({ ...m, tokens: 0 }));
83884
84057
  break;
83885
84058
  case "retry":
83886
84059
  append({ kind: "info", text: `model connection: ${ev.text} \u2014 retrying (${ev.attempt})` });
@@ -83888,6 +84061,8 @@ function App2({ engine: engine2, task, resume }) {
83888
84061
  case "interrupted":
83889
84062
  foldThinking();
83890
84063
  flushDraft();
84064
+ setProposal(null);
84065
+ setPaused(false);
83891
84066
  append({ kind: "info", text: ev.kept ? "stopped \xB7 what it had so far is kept in the session" : "stopped" });
83892
84067
  setPhaseBoth("idle");
83893
84068
  setStatus("");
@@ -83895,24 +84070,34 @@ function App2({ engine: engine2, task, resume }) {
83895
84070
  case "turn_end": {
83896
84071
  foldThinking();
83897
84072
  flushDraft();
84073
+ setMeter((m) => ({ ...m, tokens: ev.context_tokens ?? m.tokens, input: ev.input_tokens || 0, output: ev.output_tokens || 0 }));
83898
84074
  setSpend(ev.cost_usd);
83899
84075
  const dur = turnT0.current ? fmtDur((Date.now() - turnT0.current) / 1e3) : fmtDur(ev.elapsed_s);
83900
84076
  turnT0.current = null;
83901
- append({ kind: "turn", text: `${dur} \xB7 ${ev.turns} steps \xB7 ${fmtCost(ev.cost_usd)} session` + (ev.stop_reason !== "done" ? ` \xB7 stopped: ${ev.stop_reason}` : "") });
84077
+ append({ kind: "turn", text: `${dur} \xB7 ${plural(ev.turns, "step")} \xB7 ${fmtCost(ev.cost_usd)} session` + (ev.stop_reason !== "done" && !String(ev.stop_reason).startsWith("paused") ? ` \xB7 stopped: ${ev.stop_reason}` : "") });
83902
84078
  setPhaseBoth("idle");
83903
84079
  setStatus("");
83904
84080
  break;
83905
84081
  }
83906
- case "info":
83907
- append({ kind: "info", text: ev.text });
84082
+ case "image": {
84083
+ const n = attachRef.current.length + 1;
84084
+ const { type, label, ...ref } = ev;
84085
+ attachRef.current = [...attachRef.current, { ref, n, label: label || ref.name || "image", chip: `[Image #${n}]` }];
84086
+ if (inputRef.current) inputRef.current.insert(`[Image #${n}] `);
83908
84087
  break;
83909
- case "warn":
83910
- append({ kind: "warn", text: ev.text });
84088
+ }
84089
+ case "info":
84090
+ case "warn": {
84091
+ const it = { kind: ev.type, text: ev.text };
84092
+ if (helloRef.current) append(it);
84093
+ else preHello.current.push(it);
83911
84094
  break;
84095
+ }
83912
84096
  case "error":
83913
84097
  foldThinking();
83914
84098
  flushDraft();
83915
- append({ kind: "error", text: ev.text });
84099
+ if (helloRef.current) append({ kind: "error", text: ev.text });
84100
+ else preHello.current.push({ kind: "error", text: ev.text });
83916
84101
  setPhaseBoth("idle");
83917
84102
  setStatus("");
83918
84103
  break;
@@ -83930,12 +84115,22 @@ function App2({ engine: engine2, task, resume }) {
83930
84115
  }, []);
83931
84116
  const quit = () => {
83932
84117
  if (phaseRef.current === "dead") return;
83933
- append({ kind: "info", text: session ? `session saved: ${session}` : "bye" });
84118
+ const busy = phaseRef.current === "busy";
84119
+ append({ kind: "info", text: !session ? "bye" : busy ? "still working \xB7 `hum` brings you back" : `saved \xB7 \`hum\` brings you back` });
83934
84120
  engine2.send({ cmd: "quit" });
83935
84121
  setTimeout(() => {
83936
84122
  setPhaseBoth("dead");
83937
84123
  exit();
83938
- }, 1500);
84124
+ }, 400);
84125
+ };
84126
+ const stop = () => {
84127
+ if (phaseRef.current === "dead") return;
84128
+ append({ kind: "info", text: session ? `stopped \xB7 saved \xB7 hum resume ${shortSession(session)}` : "stopped" });
84129
+ engine2.send({ cmd: "stop" });
84130
+ setTimeout(() => {
84131
+ setPhaseBoth("dead");
84132
+ exit();
84133
+ }, 2500);
83939
84134
  };
83940
84135
  use_input_default((input, key) => {
83941
84136
  if (key.ctrl && input === "c") {
@@ -83952,13 +84147,34 @@ function App2({ engine: engine2, task, resume }) {
83952
84147
  quit();
83953
84148
  return;
83954
84149
  }
84150
+ if (key.ctrl && input === "o") {
84151
+ const last = lastOutRef.current;
84152
+ if (last && last.content) {
84153
+ const ls = last.content.split("\n");
84154
+ append({ kind: "output", name: last.name, lines: ls.slice(0, OUTPUT_MAX_LINES), more: Math.max(0, ls.length - OUTPUT_MAX_LINES) });
84155
+ }
84156
+ return;
84157
+ }
84158
+ if (proposal && !picker) {
84159
+ if (key.return && !value.trim()) {
84160
+ decide("accept");
84161
+ return;
84162
+ }
84163
+ if (key.escape) {
84164
+ setProposal(null);
84165
+ engine2.send({ cmd: "interrupt" });
84166
+ return;
84167
+ }
84168
+ }
83955
84169
  if (picker) {
83956
84170
  if (key.upArrow) setPicker((p) => ({ ...p, index: (p.index + p.items.length - 1) % p.items.length }));
83957
84171
  else if (key.downArrow || key.tab) setPicker((p) => ({ ...p, index: (p.index + 1) % p.items.length }));
83958
84172
  else if (key.return) {
83959
84173
  const it = picker.items[picker.index];
83960
84174
  setPicker(null);
83961
- engine2.send({ cmd: "resume", name: it.name });
84175
+ if (it.live && it.live.here) {
84176
+ } else if (it.live && it.live.port) attachTo(it.live.port);
84177
+ else engine2.send({ cmd: "resume", name: it.name });
83962
84178
  } else if (key.escape) setPicker(null);
83963
84179
  return;
83964
84180
  }
@@ -83973,6 +84189,29 @@ function App2({ engine: engine2, task, resume }) {
83973
84189
  (0, import_react24.useEffect)(() => {
83974
84190
  setMenuIndex(0);
83975
84191
  }, [value]);
84192
+ const attachTo = (port2) => {
84193
+ setItems([]);
84194
+ setDraft("");
84195
+ setThinking("");
84196
+ thinkChars.current = 0;
84197
+ setProposal(null);
84198
+ setPaused(false);
84199
+ setSpend(0);
84200
+ helloRef.current = false;
84201
+ setPhaseBoth("connecting");
84202
+ setStatus("");
84203
+ engine2.reconnect(port2).catch((e) => {
84204
+ append({ kind: "error", text: `could not attach: ${e.message}` });
84205
+ setPhaseBoth("idle");
84206
+ });
84207
+ };
84208
+ const decide = (decision, note) => {
84209
+ const p = proposal;
84210
+ setProposal(null);
84211
+ const what = p && p.calls.length ? p.calls.map((c) => c.desc).join(" \xB7 ") : "the proposal";
84212
+ append({ kind: "you", text: decision === "accept" ? `approved: ${what}` : `rejected: ${what}${note ? ` \u2014 ${note}` : ""}` });
84213
+ engine2.send({ cmd: "decide", decision, note: note || "" });
84214
+ };
83976
84215
  const runCommand = (line) => {
83977
84216
  const [name, ...rest] = line.split(/\s+/);
83978
84217
  const arg = rest.join(" ").trim();
@@ -83985,6 +84224,9 @@ function App2({ engine: engine2, task, resume }) {
83985
84224
  case "/quit":
83986
84225
  quit();
83987
84226
  break;
84227
+ case "/stop":
84228
+ stop();
84229
+ break;
83988
84230
  case "/help":
83989
84231
  append({ kind: "info", text: HELP });
83990
84232
  break;
@@ -84000,12 +84242,30 @@ function App2({ engine: engine2, task, resume }) {
84000
84242
  engine2.send({ cmd: "model", name: arg });
84001
84243
  } else append({ kind: "info", text: `model: ${modelRef.current}` });
84002
84244
  break;
84003
- case "/cost":
84004
- append({ kind: "info", text: `${fmtCost(spend)} this session` });
84245
+ case "/cost": {
84246
+ const ctx = ctxPct > 0 ? ` \xB7 context ${ctxPct}% of the compaction threshold` : "";
84247
+ append({ kind: "info", text: `${fmtCost(spend)} this session \xB7 ${meter.input.toLocaleString()}+${meter.output.toLocaleString()} tokens${ctx}` });
84248
+ break;
84249
+ }
84250
+ case "/image":
84251
+ if (!hello?.images) append({ kind: "warn", text: "this engine does not take images; update hum" });
84252
+ else if (!arg) append({ kind: "info", text: "/image <path> attaches the file to your next message \xB7 ctrl+v pastes a screenshot \xB7 @path.png in a message works too" });
84253
+ else engine2.send({ cmd: "attach", path: arg });
84005
84254
  break;
84006
84255
  case "/tools":
84007
84256
  append({ kind: "info", text: (hello?.tools || []).join(", ") });
84008
84257
  break;
84258
+ case "/hooks":
84259
+ engine2.send({ cmd: "hooks" });
84260
+ break;
84261
+ case "/continue":
84262
+ engine2.send({ cmd: "continue" });
84263
+ break;
84264
+ case "/approve": {
84265
+ const mode = arg === "on" ? "approve" : arg === "off" ? "off" : gate === "approve" ? "off" : "approve";
84266
+ engine2.send({ cmd: "gate", mode });
84267
+ break;
84268
+ }
84009
84269
  default:
84010
84270
  break;
84011
84271
  }
@@ -84013,12 +84273,20 @@ function App2({ engine: engine2, task, resume }) {
84013
84273
  const onSubmit = (line) => {
84014
84274
  const text = line.trim();
84015
84275
  setValue("");
84016
- if (!text) return;
84276
+ const queued = attachRef.current;
84277
+ const attached = text ? queued.filter((a) => text.includes(a.chip)) : queued;
84278
+ const dropped = queued.filter((a) => !attached.includes(a));
84279
+ if (!text && attached.length === 0) return;
84280
+ if (!text && proposal) return;
84017
84281
  const hist = historyRef.current;
84018
- if (hist[hist.length - 1] !== text) {
84282
+ if (text && hist[hist.length - 1] !== text) {
84019
84283
  hist.push(text);
84020
84284
  saveHistory(hist);
84021
84285
  }
84286
+ if (proposal && !/^\/(approve|quit|exit|stop)\b/.test(text)) {
84287
+ decide("reject", text);
84288
+ return;
84289
+ }
84022
84290
  if (text.startsWith("/")) {
84023
84291
  runCommand(text);
84024
84292
  return;
@@ -84029,14 +84297,21 @@ function App2({ engine: engine2, task, resume }) {
84029
84297
  if (phaseRef.current === "idle") setPhaseBoth("busy");
84030
84298
  return;
84031
84299
  }
84032
- append({ kind: "you", text, steering: phaseRef.current === "busy" });
84033
- engine2.send({ cmd: "message", text });
84300
+ if (paused && /^(continue|go on|carry on|keep going)\.?$/i.test(text)) {
84301
+ runCommand("/continue");
84302
+ return;
84303
+ }
84304
+ if (paused) setPaused(false);
84305
+ if (dropped.length) append({ kind: "info", text: `not sent (chip removed): ${dropped.map((a) => a.label).join(", ")}` });
84306
+ append({ kind: "you", text, images: attached.map((a) => `#${a.n} ${a.label}`), steering: phaseRef.current === "busy" });
84307
+ engine2.send({ cmd: "message", text, images: attached.map((a) => a.ref) });
84308
+ attachRef.current = [];
84034
84309
  if (phaseRef.current === "idle") {
84035
84310
  turnT0.current = Date.now();
84036
84311
  setPhaseBoth("busy");
84037
84312
  }
84038
84313
  };
84039
- const statusLine = phase === "connecting" ? "starting the engine \u2026" : `${modelRef.current || ""}${session ? ` \xB7 ${session}` : ""} \xB7 ${fmtCost(spend)}` + (ctrlc ? " \xB7 ctrl+c again to quit" : " \xB7 / for commands");
84314
+ const statusLine = phase === "connecting" ? "starting the engine \u2026" : `${modelRef.current || ""}${session ? ` \xB7 ${shortSession(session)}` : ""} \xB7 ${fmtCost(spend)}` + (ctxPct >= 10 ? ` \xB7 ctx ${ctxPct}%` : "") + (gate === "approve" ? " \xB7 approvals on" : "") + (ctrlc ? " \xB7 ctrl+c again to quit" : " \xB7 / for commands");
84040
84315
  const spinnerLabel = phase === "connecting" ? " starting \u2026" : ` ${status || "working"}${elapsed >= 2 ? ` \xB7 ${fmtDur(elapsed)}` : ""}` + (thinkChars.current > 4e3 ? ` \xB7 ${(thinkChars.current / 1e3).toFixed(0)}k thinking` : "");
84041
84316
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
84042
84317
  /* @__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: [
@@ -84045,7 +84320,8 @@ function App2({ engine: engine2, task, resume }) {
84045
84320
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: "\u2733 hum " }),
84046
84321
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "\u0939\u092E" })
84047
84322
  ] }),
84048
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: item.text })
84323
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: item.text }),
84324
+ item.instruction ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: item.instruction.split("\n")[0].slice(0, width - 8) }) : null
84049
84325
  ] }),
84050
84326
  item.kind === "hum" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
84051
84327
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { width: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: "\u25CF" }) }),
@@ -84057,9 +84333,15 @@ function App2({ engine: engine2, task, resume }) {
84057
84333
  ] }),
84058
84334
  item.kind === "you" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
84059
84335
  /* @__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" }) }),
84060
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "white", children: [
84061
- item.text,
84062
- item.steering ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: " (steering)" }) : null
84336
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
84337
+ item.text ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "white", children: [
84338
+ item.text,
84339
+ item.steering ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: " (steering)" }) : null
84340
+ ] }) : null,
84341
+ (item.images || []).map((im, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
84342
+ "\u{1F4CE} ",
84343
+ im
84344
+ ] }, i))
84063
84345
  ] })
84064
84346
  ] }),
84065
84347
  item.kind === "agent" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "magenta", children: [
@@ -84098,10 +84380,36 @@ function App2({ engine: engine2, task, resume }) {
84098
84380
  item.agent ? " \u23BF " : " \u23BF ",
84099
84381
  item.text
84100
84382
  ] })),
84383
+ item.kind === "diff" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 4, children: [
84384
+ item.lines.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
84385
+ Text,
84386
+ {
84387
+ color: l.startsWith("+") ? "green" : l.startsWith("-") ? "red" : void 0,
84388
+ dimColor: !l.startsWith("+") && !l.startsWith("-"),
84389
+ children: l || " "
84390
+ },
84391
+ i
84392
+ )),
84393
+ item.more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `\u2026 +${item.more} more diff lines` }) : null
84394
+ ] }),
84395
+ 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)) }),
84396
+ item.kind === "output" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 4, children: [
84397
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `full output \xB7 ${item.name}` }),
84398
+ item.lines.map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: l || " " }, i)),
84399
+ item.more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: `\u2026 +${item.more} more lines (the session file keeps everything)` }) : null
84400
+ ] }),
84101
84401
  item.kind === "turn" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
84102
84402
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: "\u273B " }),
84103
84403
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: item.text })
84104
84404
  ] }),
84405
+ item.kind === "paused" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { borderStyle: "round", borderColor: "yellow", paddingX: 1, flexDirection: "column", children: [
84406
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "yellow", bold: true, children: [
84407
+ "\u23F8 paused \u2014 ",
84408
+ item.trip === "spend" ? "spend cap" : item.trip === "repeat" ? "repeating itself" : "no progress"
84409
+ ] }),
84410
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { children: item.text }),
84411
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "say what to do next \xB7 /continue lets it carry on" })
84412
+ ] }),
84105
84413
  item.kind === "info" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: item.text }),
84106
84414
  item.kind === "warn" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "yellow", children: item.text }),
84107
84415
  item.kind === "error" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "red", children: item.text })
@@ -84118,34 +84426,75 @@ function App2({ engine: engine2, task, resume }) {
84118
84426
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(build_default, { type: "dots" }) }),
84119
84427
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: spinnerLabel })
84120
84428
  ] }),
84429
+ proposal && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", borderStyle: "round", borderColor: ACCENT, paddingX: 1, marginTop: 1, children: [
84430
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
84431
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: ACCENT, bold: true, children: "? " }),
84432
+ "hum wants to ",
84433
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "\xB7 enter approves \xB7 type a reason to reject \xB7 esc stops" })
84434
+ ] }),
84435
+ proposal.content ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: true, children: [
84436
+ " ",
84437
+ proposal.content.split("\n")[0].slice(0, width - 4)
84438
+ ] }) : null,
84439
+ proposal.calls.map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", children: [
84440
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
84441
+ " \xB7 ",
84442
+ c.desc,
84443
+ c.lines != null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` (${c.lines} lines)` }) : null
84444
+ ] }),
84445
+ c.name === "bash" || c.name === "powershell" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { color: "cyan", children: [
84446
+ " $ ",
84447
+ String(c.args?.command || "").split("\n").join(" \u23CE ").slice(0, 300)
84448
+ ] }) : null,
84449
+ c.diff ? c.diff.split("\n").slice(0, DIFF_TAIL_LINES).map((l, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
84450
+ Text,
84451
+ {
84452
+ color: l.startsWith("+") ? "green" : l.startsWith("-") ? "red" : void 0,
84453
+ dimColor: !l.startsWith("+") && !l.startsWith("-"),
84454
+ children: [
84455
+ " ",
84456
+ l || " "
84457
+ ]
84458
+ },
84459
+ i
84460
+ )) : null,
84461
+ c.diff && c.diff.split("\n").length > DIFF_TAIL_LINES ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: ` \u2026 +${c.diff.split("\n").length - DIFF_TAIL_LINES} more diff lines` }) : null
84462
+ ] }, c.id))
84463
+ ] }),
84121
84464
  picker && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, marginTop: 1, children: [
84122
84465
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { children: [
84123
84466
  "pick a session to continue ",
84124
84467
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "\xB7 enter continues \xB7 esc cancels" })
84125
84468
  ] }),
84126
- picker.items.map((it, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
84127
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "cyan", inverse: i === picker.index, children: (i === picker.index ? "\u276F " : " ") + (it.when || "").padEnd(9) }),
84128
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: i !== picker.index, children: [
84129
- " ",
84130
- (it.instruction || "(untitled)").slice(0, Math.max(20, width - 40)),
84131
- it.steps != null ? ` \xB7 ${it.steps} steps` : " \xB7 on the server",
84132
- it.cost_usd ? ` \xB7 ${fmtCost(it.cost_usd)}` : "",
84133
- it.cwd ? ` \xB7 ${path.basename(it.cwd)}` : ""
84134
- ] })
84135
- ] }, it.name))
84469
+ picker.items.map((it, i) => {
84470
+ const live = it.live ? it.live.here ? " \xB7 here" : ` \xB7 ${it.live.state || "running"}` : "";
84471
+ const tail2 = (it.steps != null ? ` \xB7 ${plural(it.steps, "step")}` : " \xB7 on the server") + (it.cost_usd ? ` \xB7 ${fmtCost(it.cost_usd)}` : "") + (it.cwd ? ` \xB7 ${path.basename(it.cwd)}` : "") + live;
84472
+ const room = Math.max(16, width - 13 - tail2.length - 1);
84473
+ const what = (it.instruction || "(untitled)").replace(/\s+/g, " ");
84474
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { children: [
84475
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "cyan", inverse: i === picker.index, children: (i === picker.index ? "\u276F " : " ") + (it.when || "").padEnd(9) }),
84476
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Text, { dimColor: i !== picker.index, color: it.live && !it.live.here ? "magenta" : void 0, children: [
84477
+ " ",
84478
+ what.length > room ? what.slice(0, room - 1) + "\u2026" : what,
84479
+ tail2
84480
+ ] })
84481
+ ] }, it.name);
84482
+ })
84136
84483
  ] }),
84137
84484
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Box_default, { borderStyle: "round", borderColor: "gray", paddingX: 1, marginTop: 1, children: [
84138
84485
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "cyan", children: "\u276F " }),
84139
84486
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
84140
- MultilineInput,
84487
+ input_default,
84141
84488
  {
84489
+ ref: inputRef,
84490
+ onPasteImage: () => hello?.images ? engine2.send({ cmd: "paste_image" }) : append({ kind: "warn", text: "this engine does not take images; update hum" }),
84142
84491
  value,
84143
84492
  onChange: setValue,
84144
84493
  onSubmit,
84145
84494
  focus: phase !== "dead" && !picker,
84146
84495
  navActive: menu.length === 0,
84147
84496
  history: historyRef.current,
84148
- placeholder: phase === "busy" ? "type to steer \xB7 esc to stop \xB7 !cmd runs a command" : session ? "what next?" : "what are we doing?"
84497
+ placeholder: proposal ? "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?"
84149
84498
  }
84150
84499
  )
84151
84500
  ] }),
@@ -84164,8 +84513,20 @@ function App2({ engine: engine2, task, resume }) {
84164
84513
  }
84165
84514
 
84166
84515
  // src/engine.js
84516
+ import fs3 from "node:fs";
84167
84517
  import net from "node:net";
84518
+ import os4 from "node:os";
84519
+ import path2 from "node:path";
84520
+ import crypto from "node:crypto";
84168
84521
  import { spawn } from "node:child_process";
84522
+ var runDir = () => path2.join(process.env.HUM_HOME || path2.join(os4.homedir(), ".hum"), "run");
84523
+ var readRun = (id) => {
84524
+ try {
84525
+ return JSON.parse(fs3.readFileSync(path2.join(runDir(), `${id}.json`), "utf8"));
84526
+ } catch {
84527
+ return null;
84528
+ }
84529
+ };
84169
84530
  var EngineError = class extends Error {
84170
84531
  };
84171
84532
  var ENGINE_CANDIDATES = [
@@ -84175,7 +84536,7 @@ var ENGINE_CANDIDATES = [
84175
84536
  // uv tool install hum-cli
84176
84537
  `${process.env.HOME || ""}/.local/bin/hum-engine`
84177
84538
  ];
84178
- function spawnEngine(cwd2) {
84539
+ function spawnEngine(cwd2, { task = null, images = [], resume = null } = {}) {
84179
84540
  return new Promise((resolve, reject) => {
84180
84541
  const tryNext = (i) => {
84181
84542
  const cmd = ENGINE_CANDIDATES[i];
@@ -84189,21 +84550,48 @@ function spawnEngine(cwd2) {
84189
84550
  tryNext(i + 1);
84190
84551
  return;
84191
84552
  }
84553
+ const runId = crypto.randomBytes(6).toString("hex");
84554
+ fs3.mkdirSync(runDir(), { recursive: true });
84555
+ const log = fs3.openSync(path2.join(runDir(), `${runId}.log`), "a");
84192
84556
  const [bin, ...rest] = cmd.split(" ");
84193
- const child2 = spawn(bin, [...rest, "--listen", "-C", cwd2], { stdio: ["ignore", "pipe", "inherit"] });
84194
- let buf = "";
84195
- child2.on("error", () => tryNext(i + 1));
84196
- child2.stdout.on("data", (d) => {
84197
- buf += d.toString();
84198
- const m = buf.match(/^port (\d+)/m);
84199
- if (m) {
84200
- child2.stdout.removeAllListeners("data");
84201
- resolve({ child: child2, port: Number(m[1]) });
84202
- }
84557
+ const args2 = [...rest, "-C", cwd2, "--run-id", runId];
84558
+ if (task) args2.push("--task", task);
84559
+ for (const p of images) args2.push("--image", p);
84560
+ if (resume) args2.push("--resume", resume);
84561
+ let child;
84562
+ try {
84563
+ child = spawn(bin, args2, { stdio: ["ignore", log, log], detached: true, windowsHide: true });
84564
+ } catch {
84565
+ tryNext(i + 1);
84566
+ return;
84567
+ }
84568
+ let failed = false;
84569
+ child.on("error", () => {
84570
+ failed = true;
84571
+ tryNext(i + 1);
84203
84572
  });
84204
- child2.on("exit", (code) => {
84205
- if (!buf.match(/^port /m)) reject(new EngineError(`engine exited (${code}) before listening`));
84573
+ child.on("exit", () => {
84574
+ failed = true;
84206
84575
  });
84576
+ const t0 = Date.now();
84577
+ const poll = () => {
84578
+ const rec = readRun(runId);
84579
+ if (rec && rec.port) {
84580
+ child.unref();
84581
+ resolve(rec);
84582
+ return;
84583
+ }
84584
+ if (failed && !rec) {
84585
+ reject(new EngineError(`the engine did not start (see ${path2.join(runDir(), `${runId}.log`)})`));
84586
+ return;
84587
+ }
84588
+ if (Date.now() - t0 > 25e3) {
84589
+ reject(new EngineError("the engine did not start in time"));
84590
+ return;
84591
+ }
84592
+ setTimeout(poll, 50);
84593
+ };
84594
+ poll();
84207
84595
  };
84208
84596
  tryNext(0);
84209
84597
  });
@@ -84216,12 +84604,14 @@ var Engine = class {
84216
84604
  }
84217
84605
  connect() {
84218
84606
  return new Promise((resolve, reject) => {
84219
- this.sock = net.createConnection({ host: "127.0.0.1", port: this.port }, () => resolve());
84220
- this.sock.on("error", (e) => {
84221
- if (!this.closed) reject(new EngineError(`engine: ${e.message}`));
84607
+ const sock = net.createConnection({ host: "127.0.0.1", port: this.port }, () => resolve());
84608
+ this.sock = sock;
84609
+ sock.on("error", (e) => {
84610
+ if (!this.closed && this.sock === sock) reject(new EngineError(`engine: ${e.message}`));
84222
84611
  });
84223
84612
  let buf = "";
84224
- this.sock.on("data", (d) => {
84613
+ sock.on("data", (d) => {
84614
+ if (this.sock !== sock) return;
84225
84615
  buf += d.toString();
84226
84616
  const lines = buf.split("\n");
84227
84617
  buf = lines.pop();
@@ -84236,12 +84626,26 @@ var Engine = class {
84236
84626
  for (const h of this.handlers) h(ev);
84237
84627
  }
84238
84628
  });
84239
- this.sock.on("close", () => {
84629
+ sock.on("close", () => {
84630
+ if (this.sock !== sock) return;
84240
84631
  this.closed = true;
84241
84632
  for (const h of this.handlers) h({ type: "bye", gone: true });
84242
84633
  });
84243
84634
  });
84244
84635
  }
84636
+ // Attach to another engine (a session running elsewhere on this machine): the old
84637
+ // socket is dropped quietly, the new one greets us with hello and a replay.
84638
+ async reconnect(port2) {
84639
+ const old = this.sock;
84640
+ this.sock = null;
84641
+ this.port = port2;
84642
+ this.closed = false;
84643
+ try {
84644
+ old.destroy();
84645
+ } catch {
84646
+ }
84647
+ await this.connect();
84648
+ }
84245
84649
  on(handler) {
84246
84650
  this.handlers.push(handler);
84247
84651
  }
@@ -84263,16 +84667,20 @@ var Engine = class {
84263
84667
 
84264
84668
  // src/cli.jsx
84265
84669
  var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
84670
+ import fs4 from "node:fs";
84671
+ import path3 from "node:path";
84266
84672
  function parseArgs(argv) {
84267
- const a = { task: null, resume: null, cwd: process.cwd() };
84673
+ const a = { task: null, resume: null, cwd: process.cwd(), images: [] };
84268
84674
  for (let i = 0; i < argv.length; i += 1) {
84269
84675
  const x = argv[i];
84270
84676
  if (x === "resume") {
84271
84677
  a.resume = argv[i + 1] && !argv[i + 1].startsWith("-") ? argv[++i] : "pick";
84272
84678
  } else if ((x === "-C" || x === "--cwd") && argv[i + 1]) {
84273
84679
  a.cwd = argv[++i];
84680
+ } else if (x === "--image" && argv[i + 1]) {
84681
+ a.images.push(argv[++i]);
84274
84682
  } else if (x === "-h" || x === "--help") {
84275
- process.stdout.write("usage: hum [task] | hum resume [name]\nIn a session: type to talk, !cmd runs a command, esc stops the model, / for commands.\n");
84683
+ process.stdout.write("usage: hum [task] [--image path] | hum resume [name]\nIn a session: type to talk, !cmd runs a command, esc stops the model, ctrl+v pastes a screenshot, / for commands.\n");
84276
84684
  process.exit(0);
84277
84685
  } else if (!x.startsWith("-")) {
84278
84686
  a.task = a.task ? `${a.task} ${x}` : x;
@@ -84285,10 +84693,41 @@ if (!process.stdin.isTTY) {
84285
84693
  process.stderr.write('hum needs an interactive terminal; use `hum run "task"` when piping.\n');
84286
84694
  process.exit(1);
84287
84695
  }
84288
- var child = null;
84696
+ var liveRuns = () => {
84697
+ let out = [];
84698
+ try {
84699
+ for (const f of fs4.readdirSync(runDir())) {
84700
+ if (!f.endsWith(".json")) continue;
84701
+ try {
84702
+ const r = JSON.parse(fs4.readFileSync(path3.join(runDir(), f), "utf8"));
84703
+ if (r.port && r.session) out.push(r);
84704
+ } catch {
84705
+ }
84706
+ }
84707
+ } catch {
84708
+ }
84709
+ out.sort((a, b) => (b.updated || 0) - (a.updated || 0));
84710
+ for (const r of out) {
84711
+ try {
84712
+ process.kill(r.pid, 0);
84713
+ } catch {
84714
+ r.dead = true;
84715
+ }
84716
+ }
84717
+ return out.filter((r) => !r.dead);
84718
+ };
84289
84719
  var port = Number(process.env.HUM_ENGINE_PORT || 0);
84720
+ var startedHere = false;
84290
84721
  try {
84291
- if (!port) ({ child, port } = await spawnEngine(args.cwd));
84722
+ if (!port) {
84723
+ let rec = null;
84724
+ if (!args.task && !args.resume && args.images.length === 0) rec = liveRuns()[0] || null;
84725
+ if (!rec) {
84726
+ rec = await spawnEngine(args.cwd, { task: args.task, images: args.images, resume: args.resume && args.resume !== "pick" ? args.resume : null });
84727
+ startedHere = true;
84728
+ }
84729
+ port = rec.port;
84730
+ }
84292
84731
  } catch (exc) {
84293
84732
  if (exc instanceof EngineError) {
84294
84733
  process.stderr.write(exc.message + "\n");
@@ -84303,15 +84742,9 @@ try {
84303
84742
  process.stderr.write(exc.message + "\n");
84304
84743
  process.exit(1);
84305
84744
  }
84306
- var { waitUntilExit } = render_default(/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(App2, { engine, task: args.task, resume: args.resume }), { exitOnCtrlC: false });
84745
+ var { waitUntilExit } = render_default(/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(App2, { engine, task: startedHere ? null : args.task, resume: args.resume === "pick" || !startedHere ? args.resume : null, images: startedHere ? [] : args.images }), { exitOnCtrlC: false });
84307
84746
  waitUntilExit().then(() => {
84308
84747
  engine.close();
84309
- if (child) setTimeout(() => {
84310
- try {
84311
- child.kill();
84312
- } catch {
84313
- }
84314
- }, 3e3);
84315
84748
  process.exit(0);
84316
84749
  });
84317
84750
  /*! Bundled license information: