@opengeni/react 3.7.0-canary.0 → 3.7.0-canary.1

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 (64) hide show
  1. package/dist/artifacts.js +24 -5
  2. package/dist/artifacts.js.map +1 -1
  3. package/dist/{browser-viewer-E5DDEFQ4.js → browser-viewer-NTD6UIPR.js} +3 -3
  4. package/dist/{chunk-W2RGYBCV.js → chunk-24M4YBCL.js} +4 -4
  5. package/dist/{chunk-DOK4KZF2.js → chunk-5IXTJTK3.js} +1322 -392
  6. package/dist/chunk-5IXTJTK3.js.map +1 -0
  7. package/dist/chunk-5PQJOCX5.js +902 -0
  8. package/dist/chunk-5PQJOCX5.js.map +1 -0
  9. package/dist/{chunk-R55HFTT3.js → chunk-INGB2N5R.js} +4305 -4019
  10. package/dist/chunk-INGB2N5R.js.map +1 -0
  11. package/dist/{chunk-FJBOU2TH.js → chunk-MOWYEBCQ.js} +1728 -12
  12. package/dist/chunk-MOWYEBCQ.js.map +1 -0
  13. package/dist/chunk-PAJU5KKL.js +331 -0
  14. package/dist/chunk-PAJU5KKL.js.map +1 -0
  15. package/dist/{chunk-VTOREEXF.js → chunk-PLYRL5ER.js} +24 -2
  16. package/dist/{chunk-VTOREEXF.js.map → chunk-PLYRL5ER.js.map} +1 -1
  17. package/dist/{chunk-YVCHAQZY.js → chunk-ZFOFY5ST.js} +27 -349
  18. package/dist/chunk-ZFOFY5ST.js.map +1 -0
  19. package/dist/components/artifacts/published-html-artifact-frame.d.ts +3 -2
  20. package/dist/components/session-chrome.d.ts +37 -4
  21. package/dist/components/session-commands-panel.d.ts +6 -0
  22. package/dist/components/session-conversation.d.ts +14 -0
  23. package/dist/components/timeline-anchor.d.ts +21 -0
  24. package/dist/composer.js +2 -3
  25. package/dist/conversation-timeline.d.ts +5 -0
  26. package/dist/index.d.ts +4 -1
  27. package/dist/index.js +716 -914
  28. package/dist/index.js.map +1 -1
  29. package/dist/interaction.js +2 -2
  30. package/dist/lib/format.d.ts +5 -0
  31. package/dist/machines.js +3 -2
  32. package/dist/session-ui.d.ts +3 -0
  33. package/dist/session-ui.js +14 -4
  34. package/dist/session.js +19 -19
  35. package/dist/timeline/types.d.ts +3 -1
  36. package/package.json +2 -2
  37. package/src/components/artifacts/published-html-artifact-frame.tsx +27 -4
  38. package/src/components/machine-input-display.ts +6 -0
  39. package/src/components/message-timeline.tsx +320 -197
  40. package/src/components/session-chrome.tsx +498 -125
  41. package/src/components/session-commands-panel.tsx +113 -0
  42. package/src/components/session-conversation.tsx +141 -0
  43. package/src/components/timeline-anchor.tsx +91 -0
  44. package/src/conversation-timeline.ts +83 -0
  45. package/src/hooks/use-session-background-commands.ts +21 -10
  46. package/src/hooks/use-session-events.ts +36 -14
  47. package/src/hooks/use-session.ts +23 -2
  48. package/src/index.ts +4 -0
  49. package/src/lib/format.ts +32 -0
  50. package/src/session-ui.ts +3 -0
  51. package/src/timeline/projection.ts +6 -12
  52. package/src/timeline/types.ts +4 -0
  53. package/styles/compiled.css +495 -411
  54. package/styles/index.css +23 -0
  55. package/dist/chunk-7EAFGICR.js +0 -302
  56. package/dist/chunk-7EAFGICR.js.map +0 -1
  57. package/dist/chunk-C6WDLHBA.js +0 -2590
  58. package/dist/chunk-C6WDLHBA.js.map +0 -1
  59. package/dist/chunk-DOK4KZF2.js.map +0 -1
  60. package/dist/chunk-FJBOU2TH.js.map +0 -1
  61. package/dist/chunk-R55HFTT3.js.map +0 -1
  62. package/dist/chunk-YVCHAQZY.js.map +0 -1
  63. /package/dist/{browser-viewer-E5DDEFQ4.js.map → browser-viewer-NTD6UIPR.js.map} +0 -0
  64. /package/dist/{chunk-W2RGYBCV.js.map → chunk-24M4YBCL.js.map} +0 -0
@@ -8,21 +8,52 @@ import {
8
8
  tableElementToTsv
9
9
  } from "./chunk-JVYQRRC4.js";
10
10
  import {
11
+ Actions,
12
+ AttachButton,
13
+ Attachments,
14
+ CommandPalette2 as CommandPalette,
15
+ ComposerTranscriptionControl,
16
+ Confirmation,
17
+ Controls,
18
+ Footer,
19
+ Frame,
20
+ Help,
21
+ Hint,
22
+ Input,
11
23
  LightboxProvider,
24
+ ModelPicker2 as ModelPicker,
25
+ PauseButton,
26
+ PausedState,
27
+ RestoredResources,
28
+ Root,
29
+ SendButton,
30
+ Status,
31
+ Surface,
12
32
  Tooltip,
13
33
  TooltipContent,
14
34
  TooltipProvider,
15
35
  TooltipTrigger,
36
+ useChatComposerController,
16
37
  useLightboxOptional
17
- } from "./chunk-7EAFGICR.js";
38
+ } from "./chunk-INGB2N5R.js";
39
+ import {
40
+ ModelPolicyPicker
41
+ } from "./chunk-4JFUT22W.js";
18
42
  import {
19
43
  buildTimeline,
20
44
  groupTimeline,
21
45
  invokeOlderHistoryLoaderWithReceiptCapture,
22
46
  isActionableHumanInputRequest,
23
47
  mcpToolLeaf,
24
- toolDisplayName
25
- } from "./chunk-FJBOU2TH.js";
48
+ toolDisplayName,
49
+ useHumanInputRequests,
50
+ useSession,
51
+ useSessionEvents,
52
+ useTurnQueue
53
+ } from "./chunk-MOWYEBCQ.js";
54
+ import {
55
+ useComposer
56
+ } from "./chunk-IOLVN74D.js";
26
57
  import {
27
58
  formatBytes,
28
59
  formatClockTime,
@@ -30,7 +61,18 @@ import {
30
61
  stringifyPayload,
31
62
  truncate,
32
63
  tryParseJson
33
- } from "./chunk-VTOREEXF.js";
64
+ } from "./chunk-PLYRL5ER.js";
65
+ import {
66
+ usePolledValue
67
+ } from "./chunk-KZ73RL76.js";
68
+ import {
69
+ useOpenGeni,
70
+ useOpenGeniClient
71
+ } from "./chunk-NEXLLTP4.js";
72
+ import {
73
+ projectPickerRows,
74
+ sortPickerRows
75
+ } from "./chunk-WMGF4Z7X.js";
34
76
  import {
35
77
  cn
36
78
  } from "./chunk-22KP6LR5.js";
@@ -5735,7 +5777,7 @@ import {
5735
5777
  import { AnimatePresence, motion } from "motion/react";
5736
5778
  import { Collapsible as Collapsible2 } from "radix-ui";
5737
5779
  import {
5738
- Component as Component2,
5780
+ Component as Component3,
5739
5781
  Suspense as Suspense3,
5740
5782
  lazy as lazy3,
5741
5783
  memo as memo2,
@@ -5747,6 +5789,73 @@ import {
5747
5789
  useState as useState12
5748
5790
  } from "react";
5749
5791
 
5792
+ // src/components/timeline-anchor.tsx
5793
+ import { Component as Component2 } from "react";
5794
+ var TimelineBeforeLayout = class extends Component2 {
5795
+ getSnapshotBeforeUpdate() {
5796
+ this.props.capture();
5797
+ return null;
5798
+ }
5799
+ componentDidUpdate() {
5800
+ }
5801
+ render() {
5802
+ return this.props.children;
5803
+ }
5804
+ };
5805
+ function captureTimelineAnchor(scroller) {
5806
+ const viewport = scroller.getBoundingClientRect();
5807
+ if (viewport.height <= 0) return null;
5808
+ const groups = Array.from(scroller.querySelectorAll("[data-og-group-key]")).filter(
5809
+ (group) => group.getBoundingClientRect().height > 0
5810
+ );
5811
+ const anchors = [];
5812
+ const focused = scroller.ownerDocument.activeElement;
5813
+ if (focused instanceof HTMLElement && scroller.contains(focused) && focused.matches("button[aria-expanded]")) {
5814
+ const box = focused.getBoundingClientRect();
5815
+ if (box.bottom > viewport.top && box.top < viewport.bottom) {
5816
+ anchors.push({ element: focused, key: null, text: null, top: box.top });
5817
+ }
5818
+ }
5819
+ for (const group of groups) {
5820
+ const rect = group.getBoundingClientRect();
5821
+ if (rect.bottom <= viewport.top || rect.top >= viewport.bottom) continue;
5822
+ for (const element of group.querySelectorAll("p, li, pre, h1, h2, h3, h4")) {
5823
+ const box = element.getBoundingClientRect();
5824
+ const text = element.textContent;
5825
+ if (box.bottom > viewport.top && box.top < viewport.bottom && text && text.length >= 12) {
5826
+ anchors.push({ element, key: null, text, top: box.top });
5827
+ }
5828
+ }
5829
+ }
5830
+ const rows = groups.map((element) => ({
5831
+ element,
5832
+ key: element.getAttribute("data-og-group-key"),
5833
+ text: null,
5834
+ top: element.getBoundingClientRect().top
5835
+ }));
5836
+ anchors.push(...rows.filter((row) => row.top >= viewport.top));
5837
+ anchors.push(...rows.filter((row) => row.top < viewport.top).reverse());
5838
+ return anchors;
5839
+ }
5840
+ function timelineAnchorCorrection(scroller, anchors) {
5841
+ let blocks;
5842
+ const groups = Array.from(scroller.querySelectorAll("[data-og-group-key]"));
5843
+ for (const anchor of anchors) {
5844
+ let element;
5845
+ if (scroller.contains(anchor.element) && (!anchor.text || anchor.element.textContent === anchor.text)) {
5846
+ element = anchor.element;
5847
+ } else if (anchor.key) {
5848
+ element = groups.find((group) => group.getAttribute("data-og-group-key") === anchor.key);
5849
+ } else if (anchor.text) {
5850
+ blocks ??= Array.from(scroller.querySelectorAll("p, li, pre, h1, h2, h3, h4"));
5851
+ const matches = blocks.filter((block) => block.textContent === anchor.text);
5852
+ if (matches.length === 1) element = matches[0];
5853
+ }
5854
+ if (element) return element.getBoundingClientRect().top - anchor.top;
5855
+ }
5856
+ return null;
5857
+ }
5858
+
5750
5859
  // src/components/tip-follow.ts
5751
5860
  var _t = (ms) => ms * MOTION_INSPECT_SCALE;
5752
5861
  var _s = (pxPerSec) => pxPerSec / MOTION_INSPECT_SCALE;
@@ -6046,6 +6155,8 @@ function tipFollowStep(state, input) {
6046
6155
  var MACHINE_INPUT_META = {
6047
6156
  scheduled_occurrence: "Scheduled update",
6048
6157
  goal_continuation: "Goal continued",
6158
+ background_command_result: "Command result received",
6159
+ session_wait_timeout: "Wait ended",
6049
6160
  agent_message: "Agent update",
6050
6161
  agent_steer_instruction: "Agent direction",
6051
6162
  child_terminal_result: "Agent finished",
@@ -6066,6 +6177,10 @@ function machineInputBatchLabel(members) {
6066
6177
  const kind = members[0].kind;
6067
6178
  const n = members.length;
6068
6179
  switch (kind) {
6180
+ case "background_command_result":
6181
+ return n === 1 ? "Command result received" : `${n} command results received`;
6182
+ case "session_wait_timeout":
6183
+ return n === 1 ? "Wait ended" : `${n} waits ended`;
6069
6184
  case "child_terminal_result":
6070
6185
  return n === 1 ? "Agent finished" : `${n} agents finished`;
6071
6186
  case "goal_continuation":
@@ -6230,8 +6345,13 @@ function MessageTimeline({
6230
6345
  (item) => item.kind !== "auth-needed" || shouldRenderAuthNeeded(item)
6231
6346
  );
6232
6347
  }, [items, events, shouldRenderAuthNeeded]);
6233
- const sourceItems = items || events;
6348
+ const sourceItems = events ?? items;
6234
6349
  const olderBoundaryKey = sourceItems?.[0]?.id;
6350
+ const previousSourceIdsRef = useRef10(/* @__PURE__ */ new Set());
6351
+ const previousSourceBoundaryRef = useRef10(void 0);
6352
+ const readingAnchorRef = useRef10(null);
6353
+ const olderPageBudgetRef = useRef10(0);
6354
+ const [olderDemand, setOlderDemand] = useState12(0);
6235
6355
  const allGroups = useMemo4(() => groupTimeline(resolvedItems), [resolvedItems]);
6236
6356
  const annotationSources = useMemo4(() => {
6237
6357
  const sources = /* @__PURE__ */ new Map();
@@ -6360,28 +6480,22 @@ function MessageTimeline({
6360
6480
  followFrameRef.current = null;
6361
6481
  }
6362
6482
  }, []);
6363
- const releasePinFromReader = useCallback2(
6364
- (node) => {
6365
- if (!autoFollow || !pinnedRef.current || hasNewerRef.current) {
6366
- return;
6367
- }
6368
- if (node && maxScrollOf(node) <= 1) {
6369
- return;
6370
- }
6371
- clearReaderIntent();
6372
- clearPendingReaderLeave();
6373
- stopFollow();
6374
- applyPinned(false);
6375
- if (wantPinRef.current) {
6376
- wantPinRef.current = false;
6377
- }
6378
- if (!olderPrefetchArmedRef.current) {
6379
- olderPrefetchArmedRef.current = true;
6380
- setOlderPrefetchArmed(true);
6381
- }
6382
- },
6383
- [autoFollow, applyPinned, clearPendingReaderLeave, clearReaderIntent, stopFollow]
6384
- );
6483
+ const releasePinFromReader = useCallback2(() => {
6484
+ if (!autoFollow || !pinnedRef.current || hasNewerRef.current) {
6485
+ return;
6486
+ }
6487
+ clearReaderIntent();
6488
+ clearPendingReaderLeave();
6489
+ stopFollow();
6490
+ applyPinned(false);
6491
+ if (wantPinRef.current) {
6492
+ wantPinRef.current = false;
6493
+ }
6494
+ if (!olderPrefetchArmedRef.current) {
6495
+ olderPrefetchArmedRef.current = true;
6496
+ setOlderPrefetchArmed(true);
6497
+ }
6498
+ }, [autoFollow, applyPinned, clearPendingReaderLeave, clearReaderIntent, stopFollow]);
6385
6499
  const releasePinAfterScrollSettled = useCallback2(
6386
6500
  (node) => {
6387
6501
  if (!autoFollow || !pinnedRef.current || hasNewerRef.current) {
@@ -6397,7 +6511,7 @@ function MessageTimeline({
6397
6511
  clearPendingReaderLeave();
6398
6512
  return;
6399
6513
  }
6400
- releasePinFromReader(node);
6514
+ releasePinFromReader();
6401
6515
  rearmOlderPrefetchAfterLeavingTop(node);
6402
6516
  },
6403
6517
  [autoFollow, clearPendingReaderLeave, rearmOlderPrefetchAfterLeavingTop, releasePinFromReader]
@@ -6415,6 +6529,16 @@ function MessageTimeline({
6415
6529
  }
6416
6530
  });
6417
6531
  }, [cancelLeaveFallback, releasePinAfterScrollSettled]);
6532
+ const requestEarlierFromReader = () => {
6533
+ releasePinFromReader();
6534
+ wantPinRef.current = false;
6535
+ olderPageBudgetRef.current = 8;
6536
+ if (olderLoadAttemptRef.current?.[1] === 2) {
6537
+ olderLoadAttemptRef.current = null;
6538
+ setOlderDemand((value) => value + 1);
6539
+ }
6540
+ };
6541
+ const touchPositionRef = useRef10(null);
6418
6542
  const onWheel = (event) => {
6419
6543
  if (Math.abs(event.deltaY) <= Math.abs(event.deltaX)) {
6420
6544
  return;
@@ -6423,11 +6547,11 @@ function MessageTimeline({
6423
6547
  return;
6424
6548
  }
6425
6549
  disclosureKeepsUnpinnedRef.current = false;
6550
+ programmaticScrollRef.current = 0;
6426
6551
  if (event.deltaY >= 0) {
6427
6552
  return;
6428
6553
  }
6429
- const node = event.currentTarget instanceof HTMLElement ? event.currentTarget : scrollRef.current;
6430
- releasePinFromReader(node);
6554
+ requestEarlierFromReader();
6431
6555
  };
6432
6556
  const onPointerDown = (event) => {
6433
6557
  if (event.button && event.pointerType === "mouse") {
@@ -6448,8 +6572,8 @@ function MessageTimeline({
6448
6572
  if (event.key !== "ArrowUp" && event.key !== "PageUp" && event.key !== "Home") {
6449
6573
  return;
6450
6574
  }
6451
- const node = event.currentTarget instanceof HTMLElement ? event.currentTarget : scrollRef.current;
6452
- releasePinFromReader(node);
6575
+ programmaticScrollRef.current = 0;
6576
+ requestEarlierFromReader();
6453
6577
  };
6454
6578
  const snapToBottom = useCallback2(
6455
6579
  (node) => {
@@ -6697,10 +6821,21 @@ function MessageTimeline({
6697
6821
  const previousMaxScroll = lastMaxScrollRef.current;
6698
6822
  const wasAtLiveTailBeforeCommit = previousMaxScroll <= 1 || previousMaxScroll - previousScrollTop < Math.min(PIN_THRESHOLD_PX, previousMaxScroll);
6699
6823
  const firstItemChanged = !!previousFirstItemId && firstItemId !== previousFirstItemId;
6700
- const prepended = firstItemChanged && resolvedItems.some((item) => item.id === previousFirstItemId);
6824
+ const sourceChanged = olderBoundaryKey !== previousSourceBoundaryRef.current;
6825
+ const retainedSource = sourceItems?.some((item) => previousSourceIdsRef.current.has(item.id)) ?? false;
6826
+ const prepended = sourceChanged && retainedSource;
6827
+ previousSourceBoundaryRef.current = olderBoundaryKey;
6828
+ previousSourceIdsRef.current = new Set(sourceItems?.map((item) => item.id));
6829
+ const readingAnchor = readingAnchorRef.current;
6830
+ readingAnchorRef.current = null;
6701
6831
  const attempt = olderLoadAttemptRef.current;
6702
- const committedZeroOverlapOlderReplacement = !!(attempt?.[2]?.committed && firstItemChanged && !prepended);
6832
+ const committedZeroOverlapOlderReplacement = !!(attempt?.[2]?.committed && sourceChanged && !retainedSource);
6703
6833
  const restorePrependAnchor = () => {
6834
+ const correction = readingAnchor && timelineAnchorCorrection(node, readingAnchor);
6835
+ if (correction != null) {
6836
+ if (Math.abs(correction) > 1) writeScrollTop(node, node.scrollTop + correction);
6837
+ return;
6838
+ }
6704
6839
  let delta = null;
6705
6840
  if (previousFirstItemId && previousItemContentTop != null) {
6706
6841
  const itemEl = node.querySelector(
@@ -6806,6 +6941,11 @@ function MessageTimeline({
6806
6941
  return;
6807
6942
  }
6808
6943
  olderLoadAttemptRef.current = [olderBoundaryKey, 2];
6944
+ if (attempt[2]?.committed && !pinnedRef.current && hasOlder && node.scrollTop <= OLDER_PREFETCH_MARGIN_PX && olderPageBudgetRef.current > 0) {
6945
+ olderPageBudgetRef.current -= 1;
6946
+ olderLoadAttemptRef.current = null;
6947
+ setOlderDemand((value) => value + 1);
6948
+ }
6809
6949
  rearmOlderPrefetchAfterLeavingTop(node);
6810
6950
  requestOlderIfUnderfilled(node);
6811
6951
  });
@@ -6935,6 +7075,7 @@ function MessageTimeline({
6935
7075
  loadingOlder,
6936
7076
  olderBoundaryKey,
6937
7077
  olderPrefetchArmed,
7078
+ olderDemand,
6938
7079
  onLoadOlder,
6939
7080
  requestOlderIfUnderfilled
6940
7081
  ]);
@@ -7072,7 +7213,7 @@ function MessageTimeline({
7072
7213
  }
7073
7214
  if (readerArmed && cumulativeReaderUp > TIP_FOLLOW_READER_UP_EPS_PX && !nearBottomPinned) {
7074
7215
  clearReaderIntent();
7075
- releasePinFromReader(node);
7216
+ requestEarlierFromReader();
7076
7217
  rearmOlderPrefetchAfterLeavingTop(node);
7077
7218
  return;
7078
7219
  }
@@ -7087,10 +7228,13 @@ function MessageTimeline({
7087
7228
  return;
7088
7229
  }
7089
7230
  syncScrollBaseline(node);
7231
+ if (programmatic) {
7232
+ return;
7233
+ }
7090
7234
  const nearBottom = isNearBottom(node);
7091
7235
  const inserted = Math.max(0, nextMaxScroll - previousMaxScroll);
7092
7236
  const towardTip = nextTop - previousTop - inserted;
7093
- const nextPinned = !hasNewer && nearBottom && towardTip >= -TIP_FOLLOW_READER_UP_EPS_PX && inserted <= 1;
7237
+ const nextPinned = !hasNewer && nearBottom && towardTip > 0.5 && inserted <= 1;
7094
7238
  if (!nextPinned) {
7095
7239
  stopFollow();
7096
7240
  }
@@ -7146,118 +7290,163 @@ function MessageTimeline({
7146
7290
  onScroll,
7147
7291
  onScrollEnd,
7148
7292
  onWheel,
7293
+ onTouchStart: (event) => {
7294
+ const touch = event.touches.length === 1 ? event.touches[0] : void 0;
7295
+ touchPositionRef.current = touch ? { x: touch.clientX, y: touch.clientY } : null;
7296
+ },
7297
+ onTouchMove: (event) => {
7298
+ const touch = event.touches[0];
7299
+ const previous = touchPositionRef.current;
7300
+ if (!touch || !previous || event.touches.length !== 1) {
7301
+ touchPositionRef.current = null;
7302
+ return;
7303
+ }
7304
+ const deltaX = previous.x - touch.clientX;
7305
+ const deltaY = previous.y - touch.clientY;
7306
+ if (Math.max(Math.abs(deltaX), Math.abs(deltaY)) < 4) return;
7307
+ touchPositionRef.current = { x: touch.clientX, y: touch.clientY };
7308
+ onWheel({
7309
+ deltaX,
7310
+ deltaY,
7311
+ target: event.target,
7312
+ currentTarget: event.currentTarget
7313
+ });
7314
+ },
7315
+ onTouchEnd: () => {
7316
+ touchPositionRef.current = null;
7317
+ },
7318
+ onTouchCancel: () => {
7319
+ touchPositionRef.current = null;
7320
+ },
7321
+ onClickCapture: (event) => {
7322
+ const target = event.target instanceof Element ? event.target.closest("button[aria-expanded]") : null;
7323
+ if (target) {
7324
+ releasePinFromReader();
7325
+ disclosureKeepsUnpinnedRef.current = true;
7326
+ }
7327
+ },
7149
7328
  onPointerDown,
7150
7329
  onKeyDown,
7151
7330
  style: groups.length > 0 && !revealed ? { visibility: "hidden" } : void 0,
7152
7331
  className: cn(
7153
7332
  // tabIndex=-1 is programmatic only — never paint a focus ring on
7154
7333
  // the whole scroller (click + Shift used to flash a blue outline).
7155
- "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-6 sm:px-6 outline-hidden",
7334
+ "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pt-16 pb-6 sm:px-6 outline-hidden",
7156
7335
  autoFollow && pinned && !hasNewer ? "[overflow-anchor:none]" : "[overflow-anchor:auto]"
7157
7336
  ),
7158
- children: /* @__PURE__ */ jsxs11("div", { className: "relative mx-auto flex w-full max-w-3xl flex-col gap-5", children: [
7159
- !groups.length ? emptyState ?? /* @__PURE__ */ jsx16("p", { className: "py-10 text-center text-og-menu text-og-fg-subtle", children: "No activity yet." }) : null,
7160
- hasOlder && olderPrefetchArmed ? (
7161
- // Overlaid, not a layout row: mounting/unmounting the sentinel
7162
- // must never shift content (that shift was itself a wobble).
7163
- /* @__PURE__ */ jsx16(
7164
- "div",
7165
- {
7166
- ref: topSentinelRef,
7167
- "data-og-top-sentinel": "",
7168
- "data-og-timeline-chrome": "",
7169
- "aria-hidden": "true",
7170
- className: "pointer-events-none absolute inset-x-0 top-0 h-px"
7171
- }
7172
- )
7173
- ) : null,
7174
- groups.map(({ group, key, entranceEnabled }, index) => {
7175
- return /* @__PURE__ */ jsx16(
7176
- TimelineGroupEntry,
7177
- {
7178
- groupKey: key,
7179
- group,
7180
- nextGroup: groups[index + 1]?.group,
7181
- entranceEnabled,
7182
- liveEntranceEnabled: group.kind === "activity" ? !bulkRender : void 0,
7183
- context: timelineGroupEntryContext
7184
- },
7185
- key
7186
- );
7187
- }),
7188
- groups.length > 0 && trailingState ? /* @__PURE__ */ jsx16("div", { "data-og-timeline-trailing-state": "", children: trailingState }) : null,
7189
- hasNewer ? /* @__PURE__ */ jsx16(
7190
- "div",
7191
- {
7192
- ref: bottomSentinelRef,
7193
- "data-og-bottom-sentinel": "",
7194
- "data-og-timeline-chrome": "",
7195
- "aria-hidden": "true",
7196
- className: "h-px w-full"
7197
- }
7198
- ) : null
7199
- ] })
7337
+ children: /* @__PURE__ */ jsx16(
7338
+ TimelineBeforeLayout,
7339
+ {
7340
+ capture: () => {
7341
+ readingAnchorRef.current = !pinnedRef.current && scrollRef.current ? captureTimelineAnchor(scrollRef.current) : null;
7342
+ },
7343
+ children: /* @__PURE__ */ jsxs11("div", { className: "relative mx-auto flex w-full max-w-3xl flex-col gap-5", children: [
7344
+ /* @__PURE__ */ jsx16(AnimatePresence, { children: loadingOlder || loadingOldest || hasOlder && onJumpToStart && olderPrefetchArmed || underfillRetryReady ? (
7345
+ // Reserved top gutter: controls scroll with history and cannot
7346
+ // cover a disclosure. Visibility never changes content height.
7347
+ /* @__PURE__ */ jsxs11(
7348
+ motion.div,
7349
+ {
7350
+ initial: { opacity: 0, y: -6 },
7351
+ animate: { opacity: 1, y: 0 },
7352
+ exit: { opacity: 0, y: -6 },
7353
+ transition: { duration: 0.15, ease: "easeOut" },
7354
+ "data-og-loading-older": "",
7355
+ "aria-live": "polite",
7356
+ className: "pointer-events-none absolute inset-x-0 -top-11 z-10 flex justify-center",
7357
+ children: [
7358
+ loadingOlder || loadingOldest ? /* @__PURE__ */ jsx16("span", { className: LOADING_CHIP_CLASS, children: /* @__PURE__ */ jsx16("span", { className: "og-shimmer-text", children: loadingOldest ? "Jumping to start\u2026" : "Loading earlier activity\u2026" }) }) : null,
7359
+ hasOlder && !loadingOlder && !loadingOldest && (underfillRetryReady || onJumpToStart) ? /* @__PURE__ */ jsx16(
7360
+ "button",
7361
+ {
7362
+ type: "button",
7363
+ "data-og-retry": underfillRetryReady || void 0,
7364
+ "data-og-jump-to-start": !underfillRetryReady || void 0,
7365
+ onClick: () => {
7366
+ const node = scrollRef.current;
7367
+ if (underfillRetryReady) {
7368
+ if (node && underfillRetryReadyRef.current) {
7369
+ requestOlderIfUnderfilled(node, underfillSettledAttempt);
7370
+ }
7371
+ return;
7372
+ }
7373
+ applyPinned(false);
7374
+ pendingJumpToStartRef.current = true;
7375
+ const seq = ++jumpToStartSeqRef.current;
7376
+ void Promise.resolve(onJumpToStart()).then(
7377
+ () => {
7378
+ const scroller = scrollRef.current ?? node;
7379
+ if (scroller) {
7380
+ scroller.scrollTop = 0;
7381
+ }
7382
+ requestFrame(() => {
7383
+ if (jumpToStartSeqRef.current === seq) {
7384
+ pendingJumpToStartRef.current = false;
7385
+ }
7386
+ });
7387
+ },
7388
+ () => {
7389
+ if (jumpToStartSeqRef.current === seq) {
7390
+ pendingJumpToStartRef.current = false;
7391
+ }
7392
+ }
7393
+ );
7394
+ },
7395
+ className: "pointer-events-auto rounded-full border border-og-border px-3 py-1.5 text-og-control",
7396
+ children: underfillRetryReady ? "Retry earlier activity" : "Jump to start"
7397
+ }
7398
+ ) : null
7399
+ ]
7400
+ }
7401
+ )
7402
+ ) : null }),
7403
+ !groups.length ? emptyState ?? /* @__PURE__ */ jsx16("p", { className: "py-10 text-center text-og-menu text-og-fg-subtle", children: "No activity yet." }) : null,
7404
+ hasOlder && olderPrefetchArmed ? (
7405
+ // Overlaid, not a layout row: mounting/unmounting the sentinel
7406
+ // must never shift content (that shift was itself a wobble).
7407
+ // End at the scroll origin above the pt-16 gutter so the
7408
+ // observer and scrollTop cooldown share the same 400px band.
7409
+ /* @__PURE__ */ jsx16(
7410
+ "div",
7411
+ {
7412
+ ref: topSentinelRef,
7413
+ "data-og-top-sentinel": "",
7414
+ "data-og-timeline-chrome": "",
7415
+ "aria-hidden": "true",
7416
+ className: "pointer-events-none absolute inset-x-0 -top-16 h-px -translate-y-full"
7417
+ }
7418
+ )
7419
+ ) : null,
7420
+ groups.map(({ group, key, entranceEnabled }, index) => {
7421
+ return /* @__PURE__ */ jsx16(
7422
+ TimelineGroupEntry,
7423
+ {
7424
+ groupKey: key,
7425
+ group,
7426
+ nextGroup: groups[index + 1]?.group,
7427
+ entranceEnabled,
7428
+ liveEntranceEnabled: group.kind === "activity" ? !bulkRender : void 0,
7429
+ context: timelineGroupEntryContext
7430
+ },
7431
+ key
7432
+ );
7433
+ }),
7434
+ groups.length > 0 && trailingState ? /* @__PURE__ */ jsx16("div", { "data-og-timeline-trailing-state": "", children: trailingState }) : null,
7435
+ hasNewer ? /* @__PURE__ */ jsx16(
7436
+ "div",
7437
+ {
7438
+ ref: bottomSentinelRef,
7439
+ "data-og-bottom-sentinel": "",
7440
+ "data-og-timeline-chrome": "",
7441
+ "aria-hidden": "true",
7442
+ className: "h-px w-full"
7443
+ }
7444
+ ) : null
7445
+ ] })
7446
+ }
7447
+ )
7200
7448
  }
7201
7449
  ),
7202
- /* @__PURE__ */ jsx16(AnimatePresence, { children: loadingOlder || loadingOldest || hasOlder && onJumpToStart && olderPrefetchArmed || underfillRetryReady ? (
7203
- // Floating over the scroller (not a timeline row) so showing and
7204
- // hiding it never reflows history under the reader.
7205
- /* @__PURE__ */ jsxs11(
7206
- motion.div,
7207
- {
7208
- initial: { opacity: 0, y: -6 },
7209
- animate: { opacity: 1, y: 0 },
7210
- exit: { opacity: 0, y: -6 },
7211
- transition: { duration: 0.15, ease: "easeOut" },
7212
- "data-og-loading-older": "",
7213
- "aria-live": "polite",
7214
- className: "absolute inset-x-0 top-3 z-10 flex justify-center",
7215
- children: [
7216
- loadingOlder || loadingOldest ? /* @__PURE__ */ jsx16("span", { className: LOADING_CHIP_CLASS, children: /* @__PURE__ */ jsx16("span", { className: "og-shimmer-text", children: loadingOldest ? "Jumping to start\u2026" : "Loading earlier activity\u2026" }) }) : null,
7217
- hasOlder && !loadingOlder && !loadingOldest && (underfillRetryReady || onJumpToStart) ? /* @__PURE__ */ jsx16(
7218
- "button",
7219
- {
7220
- type: "button",
7221
- "data-og-retry": underfillRetryReady || void 0,
7222
- "data-og-jump-to-start": !underfillRetryReady || void 0,
7223
- onClick: () => {
7224
- const node = scrollRef.current;
7225
- if (underfillRetryReady) {
7226
- if (node && underfillRetryReadyRef.current) {
7227
- requestOlderIfUnderfilled(node, underfillSettledAttempt);
7228
- }
7229
- return;
7230
- }
7231
- applyPinned(false);
7232
- pendingJumpToStartRef.current = true;
7233
- const seq = ++jumpToStartSeqRef.current;
7234
- void Promise.resolve(onJumpToStart()).then(
7235
- () => {
7236
- const scroller = scrollRef.current ?? node;
7237
- if (scroller) {
7238
- scroller.scrollTop = 0;
7239
- }
7240
- requestFrame(() => {
7241
- if (jumpToStartSeqRef.current === seq) {
7242
- pendingJumpToStartRef.current = false;
7243
- }
7244
- });
7245
- },
7246
- () => {
7247
- if (jumpToStartSeqRef.current === seq) {
7248
- pendingJumpToStartRef.current = false;
7249
- }
7250
- }
7251
- );
7252
- },
7253
- className: "rounded-full border border-og-border px-3 py-1.5 text-og-control",
7254
- children: underfillRetryReady ? "Retry earlier activity" : "Jump to start"
7255
- }
7256
- ) : null
7257
- ]
7258
- }
7259
- )
7260
- ) : null }),
7261
7450
  /* @__PURE__ */ jsx16(AnimatePresence, { children: loadingNewer ? /* @__PURE__ */ jsx16(
7262
7451
  motion.div,
7263
7452
  {
@@ -7387,7 +7576,7 @@ function cancelFrame(id) {
7387
7576
  function timelineRenderResetKeysChanged(previous, next) {
7388
7577
  return previous.length !== next.length || previous.some((key, index) => !Object.is(key, next[index]));
7389
7578
  }
7390
- var TimelineGroupRenderBoundary = class extends Component2 {
7579
+ var TimelineGroupRenderBoundary = class extends Component3 {
7391
7580
  state = {
7392
7581
  failed: false,
7393
7582
  resetKeys: this.props.resetKeys
@@ -7848,7 +8037,7 @@ function CompactionRow({ item }) {
7848
8037
  const after = item.estimatedTokensAfter != null ? Math.round(item.estimatedTokensAfter).toLocaleString("en-US") : null;
7849
8038
  const title = item.phase === "started" ? "Compacting conversation history\u2026" : item.phase === "compacted" ? before && after ? `Conversation history compacted \xB7 ~${before} \u2192 ~${after} estimated history tokens` : "Conversation history compacted" : "Couldn\u2019t compact conversation history";
7850
8039
  const subtitle = item.phase === "compacted" ? "Chat history above is unchanged" : item.phase === "skipped" ? compactionSkipSubtitle(item.skipReason) : null;
7851
- const pill = item.phase === "skipped" && item.skipReason === "summarization_failed" ? "border-og-status-failed/35 bg-og-status-failed/10 text-og-status-failed" : item.phase === "started" ? WAITING_PILL_CLASS : "border-og-border bg-og-surface-1 text-og-fg-muted";
8040
+ const pill = item.phase === "skipped" && item.skipReason === "summarization_failed" ? "border-og-status-failed/35 bg-og-status-failed/10 text-og-status-failed" : item.phase === "started" ? WAITING_PILL_CLASS : NEUTRAL_PILL;
7852
8041
  return /* @__PURE__ */ jsx16("div", { className: cn(enter && "animate-og-enter", "flex justify-center"), children: /* @__PURE__ */ jsxs11(
7853
8042
  "div",
7854
8043
  {
@@ -8194,35 +8383,38 @@ function SessionStatusRow({ item }) {
8194
8383
  );
8195
8384
  }
8196
8385
  var NEUTRAL_PILL = "border-og-border bg-og-surface-1 text-og-fg-muted";
8197
- var GOAL_META = {
8198
- set: {
8199
- label: "Goal set",
8200
- pill: "border-og-accent/30 bg-og-accent/10 text-og-accent",
8201
- icon: TargetIcon2
8202
- },
8203
- updated: { label: "Goal updated", pill: NEUTRAL_PILL, icon: PencilLineIcon },
8204
- completed: {
8205
- label: "Goal completed",
8206
- pill: "border-og-status-idle/30 bg-og-status-idle/10 text-og-status-idle",
8207
- icon: CheckIcon2
8208
- },
8209
- paused: {
8210
- label: "Goal paused",
8211
- pill: WAITING_PILL_CLASS,
8212
- icon: PauseIcon
8213
- },
8214
- resumed: { label: "Goal resumed", pill: NEUTRAL_PILL, icon: PlayIcon },
8215
- cleared: { label: "Goal cleared", pill: NEUTRAL_PILL, icon: Trash2Icon },
8216
- held: {
8217
- label: "Goal held",
8218
- pill: WAITING_PILL_CLASS,
8219
- icon: PauseCircleIcon
8220
- },
8221
- continuation: { label: "Continuing toward the goal", pill: NEUTRAL_PILL, icon: ArrowRightIcon2 }
8222
- };
8386
+ function goalMeta(action) {
8387
+ const metadata = {
8388
+ set: {
8389
+ label: "Goal set",
8390
+ pill: "border-og-accent/30 bg-og-accent/10 text-og-accent",
8391
+ icon: TargetIcon2
8392
+ },
8393
+ updated: { label: "Goal updated", pill: NEUTRAL_PILL, icon: PencilLineIcon },
8394
+ completed: {
8395
+ label: "Goal completed",
8396
+ pill: "border-og-status-idle/30 bg-og-status-idle/10 text-og-status-idle",
8397
+ icon: CheckIcon2
8398
+ },
8399
+ paused: {
8400
+ label: "Goal paused",
8401
+ pill: WAITING_PILL_CLASS,
8402
+ icon: PauseIcon
8403
+ },
8404
+ resumed: { label: "Goal resumed", pill: NEUTRAL_PILL, icon: PlayIcon },
8405
+ cleared: { label: "Goal cleared", pill: NEUTRAL_PILL, icon: Trash2Icon },
8406
+ held: {
8407
+ label: "Goal held",
8408
+ pill: WAITING_PILL_CLASS,
8409
+ icon: PauseCircleIcon
8410
+ },
8411
+ continuation: { label: "Continuing toward the goal", pill: NEUTRAL_PILL, icon: ArrowRightIcon2 }
8412
+ };
8413
+ return metadata[action];
8414
+ }
8223
8415
  function GoalRow({ item }) {
8224
8416
  const enter = useEntranceAnimation();
8225
- const { label, pill, icon: Icon } = GOAL_META[item.action];
8417
+ const { label, pill, icon: Icon } = goalMeta(item.action);
8226
8418
  return /* @__PURE__ */ jsx16("div", { className: cn(enter && "animate-og-enter", "flex justify-center"), children: /* @__PURE__ */ jsxs11(
8227
8419
  "span",
8228
8420
  {
@@ -8259,35 +8451,49 @@ function MachineInputBatchRow({
8259
8451
  const singleSummary = single ? cleanMachineInputSummary(single.summary) : "";
8260
8452
  const showCollapsedSummary = single != null && machineInputSummaryIsUseful(single.kind, singleSummary);
8261
8453
  return /* @__PURE__ */ jsxs11("div", { className: cn(enter && "animate-og-enter", "flex flex-col items-center gap-1.5"), children: [
8262
- /* @__PURE__ */ jsxs11("details", { className: "group w-full max-w-full", "data-og-machine-input-batch": "", children: [
8263
- /* @__PURE__ */ jsx16("summary", { className: "flex cursor-pointer list-none justify-center [&::-webkit-details-marker]:hidden", children: /* @__PURE__ */ jsxs11(
8264
- "span",
8265
- {
8266
- className: cn(
8267
- "inline-flex max-w-full items-center gap-1.5 rounded-full border px-3 py-1 text-og-sm",
8268
- NEUTRAL_PILL
8269
- ),
8270
- children: [
8271
- /* @__PURE__ */ jsx16(
8272
- ChevronRightIcon3,
8454
+ /* @__PURE__ */ jsxs11(
8455
+ "details",
8456
+ {
8457
+ className: "group w-full max-w-full",
8458
+ "data-og-machine-input-batch": "",
8459
+ title: `Received ${formatClockTime(item.occurredAt)}`,
8460
+ children: [
8461
+ /* @__PURE__ */ jsx16("summary", { className: "flex cursor-pointer list-none justify-center [&::-webkit-details-marker]:hidden", children: /* @__PURE__ */ jsxs11(
8462
+ "span",
8463
+ {
8464
+ className: cn(
8465
+ "inline-flex max-w-full items-center gap-1.5 rounded-full border px-3 py-1 text-og-sm",
8466
+ NEUTRAL_PILL
8467
+ ),
8468
+ children: [
8469
+ /* @__PURE__ */ jsx16(
8470
+ ChevronRightIcon3,
8471
+ {
8472
+ "aria-hidden": true,
8473
+ className: "size-3.5 shrink-0 transition-transform group-open:rotate-90"
8474
+ }
8475
+ ),
8476
+ /* @__PURE__ */ jsx16("span", { className: "truncate", children: label })
8477
+ ]
8478
+ }
8479
+ ) }),
8480
+ /* @__PURE__ */ jsxs11("div", { className: "mx-auto mt-2 w-full max-w-lg space-y-2 border-t border-og-border/50 pt-2", children: [
8481
+ /* @__PURE__ */ jsxs11("p", { className: "text-og-xs text-og-fg-subtle", children: [
8482
+ "Received ",
8483
+ /* @__PURE__ */ jsx16("time", { dateTime: item.occurredAt, children: formatClockTime(item.occurredAt) })
8484
+ ] }),
8485
+ item.members.map((member) => /* @__PURE__ */ jsx16(
8486
+ MachineInputRow,
8273
8487
  {
8274
- "aria-hidden": true,
8275
- className: "size-3.5 shrink-0 transition-transform group-open:rotate-90"
8276
- }
8277
- ),
8278
- /* @__PURE__ */ jsx16("span", { className: "truncate", children: label })
8279
- ]
8280
- }
8281
- ) }),
8282
- /* @__PURE__ */ jsx16("div", { className: "mx-auto mt-2 w-full max-w-lg space-y-2 border-t border-og-border/50 pt-2", children: item.members.map((member) => /* @__PURE__ */ jsx16(
8283
- MachineInputRow,
8284
- {
8285
- member,
8286
- loadVideoArtifactPlayback
8287
- },
8288
- member.id
8289
- )) })
8290
- ] }),
8488
+ member,
8489
+ loadVideoArtifactPlayback
8490
+ },
8491
+ member.id
8492
+ ))
8493
+ ] })
8494
+ ]
8495
+ }
8496
+ ),
8291
8497
  showCollapsedSummary ? /* @__PURE__ */ jsx16("p", { className: "max-w-lg px-3 text-center text-og-xs leading-4 text-og-fg-subtle", children: truncate(singleSummary, 160) }) : null
8292
8498
  ] });
8293
8499
  }
@@ -8386,7 +8592,7 @@ function formatVideoDuration(seconds) {
8386
8592
  }
8387
8593
  function NoticeRow({ item }) {
8388
8594
  const enter = useEntranceAnimation();
8389
- const tone = item.tone === "failed" ? "border-og-status-failed/35 bg-og-status-failed/10 text-og-status-failed" : item.tone === "waiting" ? WAITING_PILL_CLASS : "border-og-border bg-og-surface-1 text-og-fg-muted";
8595
+ const tone = item.tone === "failed" ? "border-og-status-failed/35 bg-og-status-failed/10 text-og-status-failed" : item.tone === "waiting" ? WAITING_PILL_CLASS : NEUTRAL_PILL;
8390
8596
  return /* @__PURE__ */ jsxs11(
8391
8597
  "div",
8392
8598
  {
@@ -8395,7 +8601,8 @@ function NoticeRow({ item }) {
8395
8601
  "flex items-start gap-2.5 rounded-og-md border px-3.5 py-2.5 text-og-menu",
8396
8602
  tone
8397
8603
  ),
8398
- role: "status",
8604
+ role: item.recordedOutcome ? "note" : "status",
8605
+ "data-og-recorded-outcome": item.recordedOutcome ? "wait" : void 0,
8399
8606
  children: [
8400
8607
  /* @__PURE__ */ jsx16(
8401
8608
  TriangleAlertIcon2,
@@ -8404,6 +8611,14 @@ function NoticeRow({ item }) {
8404
8611
  }
8405
8612
  ),
8406
8613
  /* @__PURE__ */ jsxs11("div", { className: "min-w-0 flex-1", children: [
8614
+ item.recordedOutcome ? /* @__PURE__ */ jsxs11("p", { className: "mb-1 text-og-control font-medium", children: [
8615
+ "Wait recorded",
8616
+ " ",
8617
+ /* @__PURE__ */ jsx16("time", { dateTime: item.occurredAt, children: new Date(item.occurredAt).toLocaleString(void 0, {
8618
+ dateStyle: "medium",
8619
+ timeStyle: "short"
8620
+ }) })
8621
+ ] }) : null,
8407
8622
  /* @__PURE__ */ jsx16("span", { className: "whitespace-pre-wrap break-words", children: item.text }),
8408
8623
  item.details ? /* @__PURE__ */ jsxs11("details", { className: "mt-2 text-og-control", children: [
8409
8624
  /* @__PURE__ */ jsx16("summary", { className: "cursor-pointer font-medium", children: item.details.label }),
@@ -8636,8 +8851,377 @@ function QueueSurfaceFallback() {
8636
8851
  );
8637
8852
  }
8638
8853
 
8854
+ // src/hooks/use-available-models.ts
8855
+ import { useCallback as useCallback3 } from "react";
8856
+ function useAvailableModels(options = {}) {
8857
+ const client = useOpenGeniClient(options);
8858
+ const load = useCallback3(
8859
+ async (signal) => await client.getClientConfig({ signal }),
8860
+ [client]
8861
+ );
8862
+ const state = usePolledValue(load, {
8863
+ pollIntervalMs: options.pollIntervalMs,
8864
+ enabled: options.enabled
8865
+ });
8866
+ return {
8867
+ models: state.data?.models ?? [],
8868
+ defaultModel: state.data?.defaultModel ?? null,
8869
+ loading: state.loading,
8870
+ error: state.error,
8871
+ refresh: state.refresh
8872
+ };
8873
+ }
8874
+ function useWorkspaceModelCatalog(options) {
8875
+ const client = useOpenGeniClient(options);
8876
+ const load = useCallback3(
8877
+ async (signal) => {
8878
+ if (!options.workspaceId) {
8879
+ return { models: [], defaultModel: null };
8880
+ }
8881
+ const [catalog, config] = await Promise.all([
8882
+ client.getWorkspaceModelCatalog(options.workspaceId, { signal }),
8883
+ client.getClientConfig({ signal })
8884
+ ]);
8885
+ return {
8886
+ models: catalog.models,
8887
+ defaultModel: config.defaultModel
8888
+ };
8889
+ },
8890
+ [client, options.workspaceId]
8891
+ );
8892
+ const state = usePolledValue(load, {
8893
+ pollIntervalMs: options.pollIntervalMs,
8894
+ enabled: options.enabled !== false && Boolean(options.workspaceId)
8895
+ });
8896
+ const rows = sortPickerRows(projectPickerRows(state.data?.models ?? []));
8897
+ return {
8898
+ models: state.data?.models ?? [],
8899
+ rows,
8900
+ defaultModel: state.data?.defaultModel ?? null,
8901
+ loading: state.loading,
8902
+ error: state.error,
8903
+ refresh: state.refresh
8904
+ };
8905
+ }
8906
+
8907
+ // src/components/chat-composer.tsx
8908
+ import { LayoutGroup, motion as motion2 } from "motion/react";
8909
+ import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
8910
+ function ChatComposer({
8911
+ composer,
8912
+ responsiveBasis,
8913
+ effectiveControl,
8914
+ queuedAheadCount,
8915
+ canControlWorkspace,
8916
+ controlLinks,
8917
+ placeholder,
8918
+ disabled,
8919
+ autoFocus,
8920
+ hint,
8921
+ controlsLeading,
8922
+ controlsStart,
8923
+ actionsStart,
8924
+ attachButtonClassName,
8925
+ transcription,
8926
+ transcriptionClassName,
8927
+ transcriptionSuppressed = false,
8928
+ header,
8929
+ onPaste,
8930
+ attachments,
8931
+ models,
8932
+ selectedModel,
8933
+ onSelectModel,
8934
+ className,
8935
+ commands,
8936
+ commandContext,
8937
+ onClearView,
8938
+ messages
8939
+ }) {
8940
+ const controller = useChatComposerController({
8941
+ delivery: composer,
8942
+ draft: composer,
8943
+ control: composer,
8944
+ effectiveControl,
8945
+ queuedAheadCount,
8946
+ canControlWorkspace,
8947
+ controlLinks,
8948
+ disabled,
8949
+ attachments,
8950
+ commands,
8951
+ commandContext,
8952
+ onClearView,
8953
+ onPaste,
8954
+ messages
8955
+ });
8956
+ const hasControls = Boolean(
8957
+ attachments || models || controlsLeading || controlsStart || transcription
8958
+ );
8959
+ const stackActions = hasControls && Boolean(actionsStart);
8960
+ return /* @__PURE__ */ jsx18(Fragment6, { children: /* @__PURE__ */ jsxs13(Root, { controller, responsiveBasis, className, children: [
8961
+ /* @__PURE__ */ jsxs13(Frame, { children: [
8962
+ /* @__PURE__ */ jsx18(CommandPalette, {}),
8963
+ /* @__PURE__ */ jsxs13(Surface, { children: [
8964
+ /* @__PURE__ */ jsx18(PausedState, {}),
8965
+ /* @__PURE__ */ jsx18(RestoredResources, {}),
8966
+ /* @__PURE__ */ jsx18(Attachments, {}),
8967
+ header,
8968
+ composer.annotations && composer.annotations.length > 0 ? /* @__PURE__ */ jsx18("div", { className: "px-3 pt-2 sm:px-4", children: /* @__PURE__ */ jsx18(
8969
+ TimelineAnnotationsChip,
8970
+ {
8971
+ annotations: composer.annotations,
8972
+ editable: true,
8973
+ focusAnnotationId: composer.annotationReviewTargetId,
8974
+ onFocusConsumed: composer.clearAnnotationReviewTarget,
8975
+ onUpdate: composer.updateAnnotation,
8976
+ onRemove: composer.removeAnnotation
8977
+ }
8978
+ ) }) : null,
8979
+ /* @__PURE__ */ jsx18(Input, { placeholder, autoFocus }),
8980
+ controller.confirmState ? /* @__PURE__ */ jsx18(Confirmation, {}) : /* @__PURE__ */ jsx18(
8981
+ Footer,
8982
+ {
8983
+ "data-og-stack-actions": stackActions ? "" : void 0,
8984
+ className: stackActions ? "max-sm:flex-nowrap sm:flex-wrap" : void 0,
8985
+ children: /* @__PURE__ */ jsxs13(LayoutGroup, { id: "og-composer-footer", children: [
8986
+ hasControls ? /* @__PURE__ */ jsxs13(
8987
+ Controls,
8988
+ {
8989
+ className: stackActions ? "min-w-0 max-sm:flex-1 sm:w-auto" : void 0,
8990
+ children: [
8991
+ controlsLeading,
8992
+ /* @__PURE__ */ jsx18(AttachButton, { className: attachButtonClassName }),
8993
+ transcription ? /* @__PURE__ */ jsx18(
8994
+ ComposerTranscriptionControl,
8995
+ {
8996
+ ...transcription,
8997
+ suppressed: transcriptionSuppressed,
8998
+ className: [transcription.className, transcriptionClassName].filter(Boolean).join(" ")
8999
+ }
9000
+ ) : null,
9001
+ models ? /* @__PURE__ */ jsx18(
9002
+ motion2.span,
9003
+ {
9004
+ layout: true,
9005
+ transition: { duration: 0.36, ease: [0.22, 1, 0.36, 1] },
9006
+ className: "inline-flex min-w-0",
9007
+ children: /* @__PURE__ */ jsx18(
9008
+ ModelPicker,
9009
+ {
9010
+ models,
9011
+ value: selectedModel,
9012
+ onChange: onSelectModel
9013
+ }
9014
+ )
9015
+ }
9016
+ ) : null,
9017
+ controlsStart ? /* @__PURE__ */ jsx18(
9018
+ motion2.span,
9019
+ {
9020
+ layout: true,
9021
+ transition: { duration: 0.36, ease: [0.22, 1, 0.36, 1] },
9022
+ className: "inline-flex min-w-0 flex-1 items-center gap-1.5",
9023
+ children: controlsStart
9024
+ }
9025
+ ) : null
9026
+ ]
9027
+ }
9028
+ ) : /* @__PURE__ */ jsx18(Hint, { children: hint }),
9029
+ /* @__PURE__ */ jsxs13(
9030
+ Actions,
9031
+ {
9032
+ className: stackActions ? "max-sm:shrink-0 sm:w-auto sm:justify-end" : void 0,
9033
+ children: [
9034
+ actionsStart,
9035
+ /* @__PURE__ */ jsx18(PauseButton, {}),
9036
+ /* @__PURE__ */ jsx18(SendButton, {})
9037
+ ]
9038
+ }
9039
+ )
9040
+ ] })
9041
+ }
9042
+ )
9043
+ ] })
9044
+ ] }),
9045
+ /* @__PURE__ */ jsx18(Help, {}),
9046
+ /* @__PURE__ */ jsx18(Status, {})
9047
+ ] }) });
9048
+ }
9049
+
9050
+ // src/components/session-conversation.tsx
9051
+ import { useRef as useRef11 } from "react";
9052
+
9053
+ // src/conversation-timeline.ts
9054
+ function conversationTimeline(items, queue, composer) {
9055
+ const queued = new Set(
9056
+ queue.queue.filter((turn) => turn.metadata.delivery !== "steer").map((turn) => turn.triggerEventId)
9057
+ );
9058
+ const pending = composer.optimisticMessages ?? [];
9059
+ const pendingQueue = new Set(
9060
+ pending.filter(
9061
+ (message) => message.destination === "queue" && !(message.turnId && message.appliedQueueVersion != null && queue.snapshot && queue.snapshot.version >= message.appliedQueueVersion && !queue.queue.some((turn) => turn.id === message.turnId))
9062
+ ).map((message) => `user-message:${message.clientEventId}`)
9063
+ );
9064
+ const visible = items.filter(
9065
+ (item) => item.kind !== "user-message" || !queued.has(item.id) && !pendingQueue.has(item.reconciliationKey ?? "")
9066
+ );
9067
+ const keys = new Set(
9068
+ visible.flatMap((item) => item.kind === "user-message" ? [item.reconciliationKey] : [])
9069
+ );
9070
+ const optimistic = pending.filter(
9071
+ (message) => !keys.has(`user-message:${message.clientEventId}`) && !queue.queue.some((turn) => turn.id === message.turnId)
9072
+ ).map((message) => ({
9073
+ kind: "user-message",
9074
+ id: `optimistic:${message.clientEventId}`,
9075
+ reconciliationKey: `user-message:${message.clientEventId}`,
9076
+ text: message.text,
9077
+ annotations: message.annotations.map((annotation, ordinal) => ({ ...annotation, ordinal })),
9078
+ resources: message.resources,
9079
+ tools: [],
9080
+ occurredAt: message.occurredAt,
9081
+ delivery: {
9082
+ state: message.state,
9083
+ ...message.error ? { error: message.error } : {},
9084
+ ...message.state === "failed" ? {
9085
+ onRetry: () => composer.retryOptimisticMessage?.(message.clientEventId),
9086
+ onRemove: () => composer.removeOptimisticMessage?.(message.clientEventId)
9087
+ } : {}
9088
+ }
9089
+ }));
9090
+ const ids = new Set(visible.map((item) => item.id));
9091
+ const steers = (queue.acceptedSteers ?? []).filter((steer) => !ids.has(steer.triggerEventId)).map((steer) => ({
9092
+ kind: "user-message",
9093
+ id: steer.triggerEventId,
9094
+ text: steer.text,
9095
+ annotations: steer.annotations,
9096
+ resources: steer.resources,
9097
+ tools: steer.tools,
9098
+ occurredAt: steer.occurredAt,
9099
+ delivery: { state: steer.state }
9100
+ }));
9101
+ return [...visible, ...optimistic, ...steers];
9102
+ }
9103
+
9104
+ // src/components/session-conversation.tsx
9105
+ import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
9106
+ function SessionConversation(props) {
9107
+ return /* @__PURE__ */ jsx19(Conversation, { ...props }, `${props.workspaceId ?? ""}:${props.sessionId}`);
9108
+ }
9109
+ function Conversation({
9110
+ sessionId,
9111
+ client,
9112
+ workspaceId,
9113
+ className,
9114
+ height = "100%",
9115
+ composerProps
9116
+ }) {
9117
+ const scope = { client, workspaceId };
9118
+ const context = useOpenGeni(scope);
9119
+ const catalog = useWorkspaceModelCatalog({
9120
+ client: context.client,
9121
+ workspaceId: context.workspaceId
9122
+ });
9123
+ const feed = useSessionEvents(sessionId, scope);
9124
+ const options = { ...scope, events: feed.events };
9125
+ const detail = useSession(sessionId, options);
9126
+ const queue = useTurnQueue(sessionId, options);
9127
+ const human = useHumanInputRequests(sessionId, options);
9128
+ const status = feed.sessionStatus ?? detail.session?.status;
9129
+ const terminal = status === "cancelled";
9130
+ const composer = useComposer(sessionId, {
9131
+ ...options,
9132
+ effectiveControl: queue.effectiveControl ?? detail.session?.effectiveControl,
9133
+ sendDestination: () => queue.queue.length > 0 || status === "running" ? "queue" : "chat"
9134
+ });
9135
+ const region = useRef11(null);
9136
+ const error = detail.error ?? feed.error ?? human.error;
9137
+ return /* @__PURE__ */ jsxs14(
9138
+ "div",
9139
+ {
9140
+ className: cn("og-root flex min-h-0 min-w-0 flex-col gap-2 overflow-hidden", className),
9141
+ ref: region,
9142
+ style: { height },
9143
+ "data-og-conversation": "",
9144
+ children: [
9145
+ error && /* @__PURE__ */ jsx19("p", { role: "alert", children: error.message }),
9146
+ /* @__PURE__ */ jsx19(
9147
+ MessageTimeline,
9148
+ {
9149
+ className: "min-h-0 flex-1",
9150
+ items: conversationTimeline(feed.timeline, queue, composer),
9151
+ status,
9152
+ hasOlder: feed.hasOlder,
9153
+ loadingOlder: feed.loadingOlder,
9154
+ onLoadOlder: feed.loadOlder,
9155
+ hasNewer: feed.hasNewer,
9156
+ loadingNewer: feed.loadingNewer,
9157
+ onLoadNewer: () => {
9158
+ void feed.loadNewer();
9159
+ },
9160
+ onJumpToStart: async () => {
9161
+ await feed.loadOldest();
9162
+ },
9163
+ loadingOldest: feed.loadingOldest,
9164
+ onJumpToLatest: feed.jumpToLatest,
9165
+ onAnnotate: composer.addAnnotation
9166
+ }
9167
+ ),
9168
+ /* @__PURE__ */ jsxs14("div", { className: "min-h-0 max-h-[40%] shrink-0 overflow-y-auto", "data-og-conversation-inputs": "", children: [
9169
+ /* @__PURE__ */ jsx19(
9170
+ HumanInputSurface,
9171
+ {
9172
+ requests: human.requests,
9173
+ onSubmit: async (id, response) => {
9174
+ await human.respond(id, response);
9175
+ },
9176
+ respondingRequestId: human.respondingRequestId,
9177
+ error: human.mutationError?.message,
9178
+ autoFocus: false
9179
+ }
9180
+ ),
9181
+ terminal ? /* @__PURE__ */ jsx19(QueueSurface, { queue, readOnly: true }) : /* @__PURE__ */ jsx19(
9182
+ QueueSurface,
9183
+ {
9184
+ queue,
9185
+ composer,
9186
+ onRequestComposerFocus: () => region.current?.querySelector("textarea")?.focus()
9187
+ }
9188
+ )
9189
+ ] }),
9190
+ /* @__PURE__ */ jsx19("div", { className: "shrink-0", "data-og-conversation-composer": "", children: /* @__PURE__ */ jsx19(
9191
+ ChatComposer,
9192
+ {
9193
+ ...composerProps,
9194
+ composer,
9195
+ disabled: terminal || composerProps?.disabled,
9196
+ controlsStart: composerProps?.controlsStart ?? (composer.policy && /* @__PURE__ */ jsx19(
9197
+ ModelPolicyPicker,
9198
+ {
9199
+ rows: catalog.rows,
9200
+ model: composer.policy.model,
9201
+ effort: composer.policy.reasoningEffort,
9202
+ latencyMode: composer.policy.latencyMode,
9203
+ loading: catalog.loading,
9204
+ error: catalog.error?.message,
9205
+ disabled: terminal,
9206
+ sessionKey: sessionId,
9207
+ onModelChange: (model) => composer.setModel?.(model),
9208
+ onEffortChange: (effort) => composer.setReasoningEffort?.(effort),
9209
+ onLatencyModeChange: (mode) => composer.setLatencyMode?.(mode)
9210
+ }
9211
+ )),
9212
+ responsiveBasis: composerProps?.responsiveBasis ?? "container",
9213
+ effectiveControl: composer.effectiveControl ?? queue.effectiveControl ?? detail.session?.effectiveControl,
9214
+ queuedAheadCount: queue.queue.length
9215
+ }
9216
+ ) })
9217
+ ]
9218
+ }
9219
+ );
9220
+ }
9221
+
8639
9222
  // src/components/session-chrome.tsx
8640
9223
  import {
9224
+ ActivityIcon,
8641
9225
  AudioLinesIcon,
8642
9226
  ArrowDownIcon as ArrowDownIcon2,
8643
9227
  ArrowUpIcon,
@@ -8650,17 +9234,19 @@ import {
8650
9234
  PencilIcon,
8651
9235
  PlayIcon as PlayIcon2,
8652
9236
  Trash2Icon as Trash2Icon2,
9237
+ TerminalIcon as TerminalIcon2,
8653
9238
  TriangleAlertIcon as TriangleAlertIcon3,
8654
9239
  XIcon,
8655
- ZapIcon
9240
+ CornerDownRightIcon,
9241
+ TargetIcon as TargetIcon3
8656
9242
  } from "lucide-react";
8657
- import { AnimatePresence as AnimatePresence2, motion as motion2, useReducedMotion } from "motion/react";
8658
- import { useEffect as useEffect11, useId as useId3, useMemo as useMemo5, useRef as useRef11, useState as useState13 } from "react";
8659
- import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
9243
+ import { AnimatePresence as AnimatePresence2, motion as motion3, useReducedMotion } from "motion/react";
9244
+ import { useEffect as useEffect11, useId as useId3, useMemo as useMemo5, useRef as useRef12, useState as useState13 } from "react";
9245
+ import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
8660
9246
  var GOAL_LABEL = {
8661
9247
  pursuing: "Pursuing",
8662
9248
  waiting: "Waiting",
8663
- scheduled: "Scheduled",
9249
+ scheduled: "Waiting",
8664
9250
  blocked: "Blocked",
8665
9251
  held: "Held",
8666
9252
  paused: "Paused",
@@ -8691,8 +9277,8 @@ function sessionChromeGoalPillExplanation(state, record) {
8691
9277
  if (state === "paused") {
8692
9278
  return record?.pausedReason ? GOAL_PAUSED_REASON_EXPLANATION[record.pausedReason] ?? null : null;
8693
9279
  }
8694
- if (state === "scheduled" && continuation?.reason === "backoff_pending") {
8695
- return continuation.nextAttemptAt ? `Next goal check at ${formatClockTime(continuation.nextAttemptAt)}.` : "Next goal check is scheduled.";
9280
+ if (state === "scheduled") {
9281
+ return continuation?.nextAttemptAt ? `Continues at ${formatClockTime(continuation.nextAttemptAt)}.` : "Waiting to continue automatically.";
8696
9282
  }
8697
9283
  if (state === "held" && continuation?.reason === "held_for_input") {
8698
9284
  const reason = continuation.holdReason?.trim();
@@ -8715,6 +9301,27 @@ function queuedTurnPresentation(turn) {
8715
9301
  function isSteeringTurn(turn) {
8716
9302
  return turn.metadata.delivery === "steer";
8717
9303
  }
9304
+ function isAuthoritativeQueuedTurn(turn, mutationFor) {
9305
+ return !isSteeringTurn(turn) && mutationFor(turn.id) !== "steer";
9306
+ }
9307
+ function countAuthoritativeQueuedTurns(turns, mutationFor) {
9308
+ return turns.filter((turn) => isAuthoritativeQueuedTurn(turn, mutationFor)).length;
9309
+ }
9310
+ function isOptimisticQueuedMessage(message, queuedTurnIds, snapshot) {
9311
+ return message.delivery === "send" && message.destination === "queue" && (!message.turnId || !queuedTurnIds.has(message.turnId)) && !(message.turnId && message.appliedQueueVersion !== null && message.appliedQueueVersion !== void 0 && snapshot && snapshot.version >= message.appliedQueueVersion);
9312
+ }
9313
+ function countOptimisticQueuedMessages(messages, queuedTurnIds, snapshot) {
9314
+ return (messages ?? []).filter(
9315
+ (message) => isOptimisticQueuedMessage(message, queuedTurnIds, snapshot)
9316
+ ).length;
9317
+ }
9318
+ function sessionChromeInitialActive(input) {
9319
+ if (input.defaultActive != null) return input.defaultActive;
9320
+ return input.authoritativeQueuedCount >= 1 ? "queue" : null;
9321
+ }
9322
+ function sessionChromeShouldOfferQueue(input) {
9323
+ return !input.controlled && input.active === null && !input.activityOpen && input.authoritativeQueuedCount >= 1 && !input.suppressed;
9324
+ }
8718
9325
  function objectValue(value) {
8719
9326
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
8720
9327
  }
@@ -8727,6 +9334,7 @@ function sessionChromeGoalPillState(goalStatus, continuation) {
8727
9334
  }
8728
9335
  if (continuation.state === "scheduled") return "scheduled";
8729
9336
  if (continuation.state === "blocked") {
9337
+ if (continuation.reason === "human_turn_running") return "waiting";
8730
9338
  return continuation.reason === "workstream_paused" || continuation.reason === "held_for_input" ? "held" : "blocked";
8731
9339
  }
8732
9340
  return "invariant_broken";
@@ -8776,6 +9384,12 @@ function pendingKindLabel(kind) {
8776
9384
  return "Goal wake";
8777
9385
  case "agent_message":
8778
9386
  return "Update";
9387
+ case "background_command_result":
9388
+ return "Command result";
9389
+ case "session_wait_timeout":
9390
+ return "Wait ended";
9391
+ case "media_generation_result":
9392
+ return "Video result";
8779
9393
  default:
8780
9394
  return "Incoming";
8781
9395
  }
@@ -8793,10 +9407,13 @@ function toneClass(tone, selected) {
8793
9407
  }
8794
9408
  }
8795
9409
  function SessionChrome({
9410
+ compact = false,
8796
9411
  queue,
8797
9412
  composer,
8798
9413
  goal,
8799
9414
  agentsPanel,
9415
+ commandsPanel,
9416
+ commandsCount = 0,
8800
9417
  agentsSignal,
8801
9418
  onDismissIncoming,
8802
9419
  readOnly = false,
@@ -8805,6 +9422,9 @@ function SessionChrome({
8805
9422
  defaultActive = null,
8806
9423
  onActiveChange
8807
9424
  }) {
9425
+ const [activityRequested, setActivityOpen] = useState13(
9426
+ Boolean(compact && defaultActive && ["incoming", "agents", "commands"].includes(defaultActive))
9427
+ );
8808
9428
  const reactId = useId3();
8809
9429
  const panelId = `og-session-chrome-panel-${reactId}`;
8810
9430
  const reduceMotion = useReducedMotion();
@@ -8813,26 +9433,52 @@ function SessionChrome({
8813
9433
  const turns = queue.queue;
8814
9434
  const queueMutationFor = queue.mutationFor;
8815
9435
  const queuedTurns = useMemo5(
8816
- () => turns.filter((turn) => !isSteeringTurn(turn) && queueMutationFor(turn.id) !== "steer"),
9436
+ () => turns.filter((turn) => isAuthoritativeQueuedTurn(turn, queueMutationFor)),
8817
9437
  [queueMutationFor, turns]
8818
9438
  );
8819
9439
  const queuedTurnIds = useMemo5(() => new Set(queuedTurns.map((turn) => turn.id)), [queuedTurns]);
8820
9440
  const optimisticQueued = useMemo5(
8821
9441
  () => (composer?.optimisticMessages ?? []).filter(
8822
- (message) => message.delivery === "send" && message.destination === "queue" && (!message.turnId || !queuedTurnIds.has(message.turnId)) && !(message.turnId && message.appliedQueueVersion !== null && message.appliedQueueVersion !== void 0 && queue.snapshot && queue.snapshot.version >= message.appliedQueueVersion)
9442
+ (message) => isOptimisticQueuedMessage(message, queuedTurnIds, queue.snapshot)
8823
9443
  ),
8824
9444
  [composer?.optimisticMessages, queue.snapshot, queuedTurnIds]
8825
9445
  );
8826
9446
  const stoppingKind = composer?.stoppingAttempt ?? (queue.stoppingPreviousAttempt ? queue.effectiveControl?.state === "paused" ? "current" : "previous" : null);
8827
9447
  const stopping = stoppingKind !== null;
8828
9448
  const canMutateQueue = !readOnly && composer !== void 0;
8829
- const liveGoal = record?.status === "active";
8830
- const elapsed = useLiveElapsed(
8831
- record?.createdAt,
8832
- Boolean(liveGoal),
8833
- !liveGoal ? record?.updatedAt : null
8834
- );
9449
+ const elapsed = useLiveElapsed(record?.createdAt, Boolean(record));
8835
9450
  const goalState = record ? sessionChromeGoalPillState(record.status, record.continuation) : null;
9451
+ const initialAuthoritativeQueuedCount = countAuthoritativeQueuedTurns(
9452
+ queue.queue,
9453
+ queue.mutationFor
9454
+ );
9455
+ const [activeUncontrolled, setActiveUncontrolled] = useState13(
9456
+ () => sessionChromeInitialActive({
9457
+ defaultActive,
9458
+ authoritativeQueuedCount: initialAuthoritativeQueuedCount
9459
+ })
9460
+ );
9461
+ const active = activeControlled !== void 0 ? activeControlled : activeUncontrolled;
9462
+ const activityOpen = activityRequested || Boolean(compact && active && ["incoming", "agents", "commands"].includes(active));
9463
+ const activityVisibleRef = useRef12(activityOpen);
9464
+ activityVisibleRef.current = activityOpen;
9465
+ const queueOfferAdmissionSuppressedRef = useRef12(
9466
+ defaultActive == null && initialAuthoritativeQueuedCount === 0 && countOptimisticQueuedMessages(composer?.optimisticMessages, queuedTurnIds, queue.snapshot) > 0
9467
+ );
9468
+ const queueOfferDismissedSessionIdsRef = useRef12(/* @__PURE__ */ new Set());
9469
+ const occupancySessionId = queuedTurns[0]?.sessionId ?? null;
9470
+ const setActive = (next) => {
9471
+ if (active === "queue" && next === null) {
9472
+ if (occupancySessionId) {
9473
+ queueOfferDismissedSessionIdsRef.current.add(occupancySessionId);
9474
+ } else {
9475
+ queueOfferAdmissionSuppressedRef.current = true;
9476
+ }
9477
+ }
9478
+ if (activeControlled === void 0) setActiveUncontrolled(next);
9479
+ onActiveChange?.(next);
9480
+ };
9481
+ const hasCommandsPanel = commandsPanel != null;
8836
9482
  const signals = useMemo5(() => {
8837
9483
  const rows = [];
8838
9484
  if (incoming.length > 0) {
@@ -8844,7 +9490,7 @@ function SessionChrome({
8844
9490
  tone: incoming.some(
8845
9491
  (item) => item.classification === "action_required" || item.classification === "failure"
8846
9492
  ) ? "waiting" : "neutral",
8847
- icon: /* @__PURE__ */ jsx18(InboxIcon, { className: "size-3" })
9493
+ icon: /* @__PURE__ */ jsx20(InboxIcon, { className: "size-3" })
8848
9494
  });
8849
9495
  }
8850
9496
  const queuedCount = queuedTurns.length + optimisticQueued.length;
@@ -8861,7 +9507,7 @@ function SessionChrome({
8861
9507
  label: queueProblem ? queuedCount > 0 ? `${queuedCount} queued \xB7 needs attention` : "Queue needs attention" : allVoiceRequests ? queuedCount === 1 ? "Voice request queued" : `${queuedCount} voice requests queued` : onlyVoiceHandoff ? "Voice handoff queued" : `${queuedCount} queued prompt${queuedCount === 1 ? "" : "s"}`,
8862
9508
  ...detail ? { detail } : {},
8863
9509
  tone: queueProblem ? "waiting" : "neutral",
8864
- icon: queueProblem ? /* @__PURE__ */ jsx18(TriangleAlertIcon3, { className: "size-3" }) : voiceOnly ? /* @__PURE__ */ jsx18(AudioLinesIcon, { className: "size-3" }) : /* @__PURE__ */ jsx18(ListOrderedIcon, { className: "size-3" })
9510
+ icon: queueProblem ? /* @__PURE__ */ jsx20(TriangleAlertIcon3, { className: "size-3" }) : voiceOnly ? /* @__PURE__ */ jsx20(AudioLinesIcon, { className: "size-3" }) : /* @__PURE__ */ jsx20(ListOrderedIcon, { className: "size-3" })
8865
9511
  });
8866
9512
  }
8867
9513
  if (record && goalState) {
@@ -8873,7 +9519,7 @@ function SessionChrome({
8873
9519
  detail: elapsed ? `${elapsed} \xB7 ${record.text}` : record.text,
8874
9520
  ...explanation ? { title: explanation } : {},
8875
9521
  tone: waiting ? "waiting" : goalState === "pursuing" || goalState === "scheduled" ? "accent" : "neutral",
8876
- icon: goalState === "blocked" || goalState === "invariant_broken" ? /* @__PURE__ */ jsx18(TriangleAlertIcon3, { className: "size-3" }) : goalState === "waiting" ? /* @__PURE__ */ jsx18(Loader2Icon2, { className: "size-3 animate-og-spin" }) : goalState === "paused" || goalState === "held" ? /* @__PURE__ */ jsx18(PauseIcon2, { className: "size-3" }) : /* @__PURE__ */ jsx18(ZapIcon, { className: "size-3" })
9522
+ icon: /* @__PURE__ */ jsx20(TargetIcon3, { className: "size-3" })
8877
9523
  });
8878
9524
  }
8879
9525
  if (agentsSignal && agentsSignal.count > 0) {
@@ -8883,11 +9529,22 @@ function SessionChrome({
8883
9529
  label: `${agentsSignal.count} agent${agentsSignal.count === 1 ? "" : "s"}`,
8884
9530
  ...detail ? { detail } : {},
8885
9531
  tone: agentsSignal.tone ?? "neutral",
8886
- icon: /* @__PURE__ */ jsx18(BotIcon3, { className: "size-3" })
9532
+ icon: /* @__PURE__ */ jsx20(BotIcon3, { className: "size-3" })
9533
+ });
9534
+ }
9535
+ if (commandsCount > 0 || active === "commands" && hasCommandsPanel) {
9536
+ rows.push({
9537
+ id: "commands",
9538
+ label: commandsCount > 0 ? `${commandsCount} command${commandsCount === 1 ? "" : "s"}` : "Commands",
9539
+ tone: commandsCount > 0 ? "running" : "neutral",
9540
+ icon: /* @__PURE__ */ jsx20(TerminalIcon2, { className: "size-3" })
8887
9541
  });
8888
9542
  }
8889
9543
  return rows;
8890
9544
  }, [
9545
+ commandsCount,
9546
+ hasCommandsPanel,
9547
+ active,
8891
9548
  agentsSignal,
8892
9549
  elapsed,
8893
9550
  goalState,
@@ -8898,16 +9555,8 @@ function SessionChrome({
8898
9555
  queuedTurns,
8899
9556
  record
8900
9557
  ]);
8901
- const [activeUncontrolled, setActiveUncontrolled] = useState13(
8902
- defaultActive
8903
- );
8904
- const active = activeControlled !== void 0 ? activeControlled : activeUncontrolled;
8905
- const setActive = (next) => {
8906
- if (activeControlled === void 0) setActiveUncontrolled(next);
8907
- onActiveChange?.(next);
8908
- };
8909
9558
  const optimisticQueueKeys = optimisticQueued.map((message) => message.clientEventId).join(",");
8910
- const previousOptimisticQueueKeys = useRef11(optimisticQueueKeys);
9559
+ const previousOptimisticQueueKeys = useRef12(optimisticQueueKeys);
8911
9560
  const [queueArrivalNonce, setQueueArrivalNonce] = useState13(0);
8912
9561
  useEffect11(() => {
8913
9562
  const previous = new Set(previousOptimisticQueueKeys.current.split(",").filter(Boolean));
@@ -8915,12 +9564,47 @@ function SessionChrome({
8915
9564
  previousOptimisticQueueKeys.current = optimisticQueueKeys;
8916
9565
  if (!arrived) return;
8917
9566
  setQueueArrivalNonce((current) => current + 1);
8918
- }, [optimisticQueueKeys, optimisticQueued]);
9567
+ if (activeControlled === void 0 && active === null) {
9568
+ queueOfferAdmissionSuppressedRef.current = true;
9569
+ }
9570
+ }, [active, activeControlled, optimisticQueueKeys, optimisticQueued]);
9571
+ const queueOccupied = queuedTurns.length > 0 || optimisticQueued.length > 0;
9572
+ useEffect11(() => {
9573
+ if (queueOccupied) return;
9574
+ queueOfferAdmissionSuppressedRef.current = false;
9575
+ queueOfferDismissedSessionIdsRef.current.clear();
9576
+ }, [queueOccupied]);
9577
+ const queueOfferSuppressed = queueOfferAdmissionSuppressedRef.current || occupancySessionId != null && queueOfferDismissedSessionIdsRef.current.has(occupancySessionId);
9578
+ useEffect11(() => {
9579
+ if (!sessionChromeShouldOfferQueue({
9580
+ controlled: activeControlled !== void 0,
9581
+ active,
9582
+ activityOpen,
9583
+ authoritativeQueuedCount: queuedTurns.length,
9584
+ suppressed: queueOfferSuppressed
9585
+ })) {
9586
+ return;
9587
+ }
9588
+ if (activeControlled === void 0) setActiveUncontrolled("queue");
9589
+ onActiveChange?.("queue");
9590
+ }, [
9591
+ active,
9592
+ activeControlled,
9593
+ activityOpen,
9594
+ occupancySessionId,
9595
+ onActiveChange,
9596
+ queueOfferSuppressed,
9597
+ queuedTurns.length
9598
+ ]);
8919
9599
  const [replaceDraftFor, setReplaceDraftFor] = useState13(null);
8920
- const chipRefs = useRef11({});
8921
- const railRef = useRef11(null);
9600
+ const chipRefs = useRef12({});
9601
+ const railRef = useRef12(null);
8922
9602
  const [pill, setPill] = useState13({ left: 0, top: 0, width: 0, height: 0, opacity: 0 });
8923
9603
  const signalIds = signals.map((signal) => signal.id).join(",");
9604
+ useEffect11(() => {
9605
+ if (compact && !signals.some((signal) => ["incoming", "agents", "commands"].includes(signal.id)))
9606
+ setActivityOpen(false);
9607
+ }, [compact, signals]);
8924
9608
  useEffect11(() => {
8925
9609
  if (active && !signalIds.split(",").includes(active)) {
8926
9610
  if (activeControlled === void 0) setActiveUncontrolled(null);
@@ -8941,7 +9625,10 @@ function SessionChrome({
8941
9625
  return;
8942
9626
  }
8943
9627
  const chip = chipRefs.current[active];
8944
- if (!chip) return;
9628
+ if (!chip) {
9629
+ setPill((prev) => ({ ...prev, opacity: 0 }));
9630
+ return;
9631
+ }
8945
9632
  const railBox = rail.getBoundingClientRect();
8946
9633
  const chipBox = chip.getBoundingClientRect();
8947
9634
  setPill({
@@ -8970,7 +9657,7 @@ function SessionChrome({
8970
9657
  const shellDuration = reduceMotion ? 0 : 0.22;
8971
9658
  const crossfadeDuration = reduceMotion ? 0 : 0.18;
8972
9659
  const ease = [0.22, 1, 0.36, 1];
8973
- const panelBody = active === "incoming" ? /* @__PURE__ */ jsx18(IncomingPanel, { inputs: incoming, onDismiss: onDismissIncoming }) : active === "queue" ? /* @__PURE__ */ jsx18(
9660
+ const panelBody = active === "incoming" ? /* @__PURE__ */ jsx20(IncomingPanel, { inputs: incoming, onDismiss: onDismissIncoming }) : active === "queue" ? /* @__PURE__ */ jsx20(
8974
9661
  QueuePanel,
8975
9662
  {
8976
9663
  turns: queuedTurns,
@@ -9021,15 +9708,15 @@ function SessionChrome({
9021
9708
  void queue.moveTurn(turnId, beforeTurnId);
9022
9709
  } : void 0
9023
9710
  }
9024
- ) : active === "goal" && record && goalState && goal ? /* @__PURE__ */ jsx18(GoalPanel, { goal, state: goalState, elapsed, readOnly }) : active === "agents" ? /* @__PURE__ */ jsx18("div", { "data-og-session-chrome-panel": "agents", children: agentsPanel ?? /* @__PURE__ */ jsx18("p", { className: "text-og-xs text-og-fg-muted", children: "No agent details." }) }) : null;
9025
- return /* @__PURE__ */ jsx18(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsx18(
9711
+ ) : active === "goal" && record && goalState && goal ? /* @__PURE__ */ jsx20(GoalPanel, { goal, state: goalState, elapsed, readOnly }) : active === "commands" ? /* @__PURE__ */ jsx20("div", { "data-og-session-chrome-panel": "commands", children: commandsPanel }) : active === "agents" ? /* @__PURE__ */ jsx20("div", { "data-og-session-chrome-panel": "agents", children: agentsPanel ?? /* @__PURE__ */ jsx20("p", { className: "text-og-xs text-og-fg-muted", children: "No agent details." }) }) : null;
9712
+ return /* @__PURE__ */ jsx20(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsx20(
9026
9713
  "div",
9027
9714
  {
9028
9715
  className: cn("og-session-chrome og-root w-full", className),
9029
9716
  "data-testid": "session-chrome",
9030
9717
  "data-og-session-chrome": "",
9031
9718
  "data-og-session-chrome-open": open ? "true" : "false",
9032
- children: /* @__PURE__ */ jsxs13(
9719
+ children: /* @__PURE__ */ jsxs15(
9033
9720
  "div",
9034
9721
  {
9035
9722
  className: cn(
@@ -9038,14 +9725,14 @@ function SessionChrome({
9038
9725
  ),
9039
9726
  style: {
9040
9727
  borderRadius: "var(--_og-session-chrome-radius)",
9041
- background: open ? "var(--_og-session-chrome-surface-open)" : "var(--_og-session-chrome-surface)",
9042
- borderColor: open ? "var(--_og-session-chrome-border-open)" : "var(--_og-session-chrome-border)",
9043
- boxShadow: open ? "var(--og-session-chrome-shadow-open)" : "var(--og-session-chrome-shadow)",
9728
+ background: compact ? "transparent" : open ? "var(--_og-session-chrome-surface-open)" : "var(--_og-session-chrome-surface)",
9729
+ borderColor: compact ? "transparent" : open ? "var(--_og-session-chrome-border-open)" : "var(--_og-session-chrome-border)",
9730
+ boxShadow: compact ? "none" : open ? "var(--og-session-chrome-shadow-open)" : "var(--og-session-chrome-shadow)",
9044
9731
  transitionDuration: "var(--og-session-chrome-duration)",
9045
9732
  transitionTimingFunction: "var(--_og-session-chrome-ease)"
9046
9733
  },
9047
9734
  children: [
9048
- /* @__PURE__ */ jsx18(
9735
+ /* @__PURE__ */ jsx20(
9049
9736
  "div",
9050
9737
  {
9051
9738
  className: "relative",
@@ -9055,17 +9742,17 @@ function SessionChrome({
9055
9742
  paddingLeft: "var(--og-session-chrome-rail-pad)",
9056
9743
  paddingRight: "var(--og-session-chrome-rail-pad)"
9057
9744
  },
9058
- children: /* @__PURE__ */ jsxs13(
9745
+ children: /* @__PURE__ */ jsxs15(
9059
9746
  "div",
9060
9747
  {
9061
9748
  ref: railRef,
9062
- className: "relative flex flex-wrap items-center",
9749
+ className: cn("relative flex items-center", compact ? "flex-nowrap" : "flex-wrap"),
9063
9750
  style: {
9064
- gap: "var(--og-session-chrome-chip-gap)"
9751
+ gap: compact ? "10px" : "var(--og-session-chrome-chip-gap)"
9065
9752
  },
9066
9753
  children: [
9067
- /* @__PURE__ */ jsx18(
9068
- motion2.div,
9754
+ /* @__PURE__ */ jsx20(
9755
+ motion3.div,
9069
9756
  {
9070
9757
  "aria-hidden": true,
9071
9758
  className: "pointer-events-none absolute left-0 top-0 rounded-og-md",
@@ -9084,67 +9771,158 @@ function SessionChrome({
9084
9771
  transition: { duration: shellDuration, ease }
9085
9772
  }
9086
9773
  ),
9087
- signals.map((signal) => {
9774
+ signals.filter(
9775
+ (signal) => !compact || !["incoming", "agents", "commands"].includes(signal.id)
9776
+ ).map((signal) => {
9088
9777
  const selected = active === signal.id;
9089
- return /* @__PURE__ */ jsxs13(
9090
- "button",
9778
+ return /* @__PURE__ */ jsxs15(
9779
+ "div",
9091
9780
  {
9092
- type: "button",
9093
- ref: (node) => {
9094
- chipRefs.current[signal.id] = node;
9095
- },
9096
- "aria-expanded": selected,
9097
- "aria-controls": panelId,
9098
- "aria-label": selected ? `Close ${signal.label}` : void 0,
9099
- "data-testid": `session-chrome-${signal.id}`,
9100
- "data-og-session-chrome-signal": signal.id,
9101
- title: signal.title,
9102
- onClick: () => setActive(selected ? null : signal.id),
9781
+ role: "group",
9782
+ "aria-label": signal.id === "queue" ? "Queued messages and actions" : signal.id === "goal" ? "Goal and actions" : signal.label,
9103
9783
  className: cn(
9104
- "group relative z-[1] inline-flex min-h-[var(--og-session-chrome-chip-min-height)] max-w-full items-center gap-1 rounded-og-md py-1 text-left text-og-xs outline-hidden",
9105
- // Coarse pointers keep a 44px target (session-pins acceptance).
9106
- "pointer-coarse:min-h-11",
9107
- "transition-colors duration-150 motion-reduce:transition-none",
9108
- "hover:text-og-fg focus-visible:bg-og-surface-3/50",
9109
- selected ? "text-og-fg" : "text-og-fg-muted"
9784
+ "group/signal relative z-[1] inline-flex min-w-0 max-w-full items-center rounded-og-md",
9785
+ compact && "bg-og-surface-2/60 px-0.5",
9786
+ compact && selected && "bg-og-surface-3"
9110
9787
  ),
9111
- style: {
9112
- paddingInline: "var(--og-session-chrome-chip-pad-x)"
9113
- },
9114
9788
  children: [
9115
- signal.id === "queue" && queueArrivalNonce > 0 && !reduceMotion ? /* @__PURE__ */ jsx18(
9116
- motion2.span,
9789
+ /* @__PURE__ */ jsxs15(
9790
+ "button",
9117
9791
  {
9118
- "aria-hidden": "true",
9119
- "data-testid": "session-chrome-queue-arrival",
9120
- className: "pointer-events-none absolute inset-0 rounded-og-md bg-og-accent-soft",
9121
- initial: { opacity: 0 },
9122
- animate: { opacity: [0, 0.38, 0] },
9123
- transition: { duration: 0.72, times: [0, 0.18, 1], ease }
9124
- },
9125
- queueArrivalNonce
9126
- ) : null,
9127
- /* @__PURE__ */ jsx18("span", { className: cn("shrink-0", toneClass(signal.tone, selected)), children: signal.icon }),
9128
- /* @__PURE__ */ jsx18("span", { className: "shrink-0 font-medium text-og-fg", children: signal.label }),
9129
- signal.detail ? /* @__PURE__ */ jsxs13(Fragment6, { children: [
9130
- /* @__PURE__ */ jsx18("span", { "aria-hidden": true, className: "shrink-0 text-og-fg-subtle/60", children: "\xB7" }),
9131
- /* @__PURE__ */ jsx18("span", { className: "min-w-0 max-w-[8.5rem] truncate text-og-fg sm:max-w-[12rem]", children: signal.detail })
9132
- ] }) : null,
9133
- selected ? /* @__PURE__ */ jsx18(
9134
- "span",
9792
+ type: "button",
9793
+ ref: (node) => {
9794
+ chipRefs.current[signal.id] = node;
9795
+ },
9796
+ "aria-expanded": selected,
9797
+ "aria-controls": panelId,
9798
+ "aria-label": compact && signal.id === "goal" ? `Goal \xB7 ${goalState === "pursuing" ? "Running" : signal.label}` : selected ? `Close ${signal.label}` : void 0,
9799
+ "data-testid": `session-chrome-${signal.id}`,
9800
+ "data-og-session-chrome-signal": signal.id,
9801
+ title: signal.title ?? (compact ? signal.label : void 0),
9802
+ onClick: () => {
9803
+ if (compact) setActivityOpen(false);
9804
+ setActive(selected ? null : signal.id);
9805
+ },
9806
+ className: cn(
9807
+ "group relative z-[1] inline-flex min-w-0 min-h-[var(--og-session-chrome-chip-min-height)] max-w-full items-center gap-1 rounded-og-md py-1 text-left text-og-xs outline-hidden",
9808
+ // Coarse pointers keep a 44px target (session-pins acceptance).
9809
+ "pointer-coarse:min-h-11",
9810
+ "transition-colors duration-150 motion-reduce:transition-none",
9811
+ "hover:text-og-fg focus-visible:bg-og-surface-3/50",
9812
+ selected ? "text-og-fg" : "text-og-fg-muted"
9813
+ ),
9814
+ style: {
9815
+ paddingInline: "var(--og-session-chrome-chip-pad-x)"
9816
+ },
9817
+ children: [
9818
+ signal.id === "queue" && queueArrivalNonce > 0 && !reduceMotion ? /* @__PURE__ */ jsx20(
9819
+ motion3.span,
9820
+ {
9821
+ "aria-hidden": "true",
9822
+ "data-testid": "session-chrome-queue-arrival",
9823
+ className: "pointer-events-none absolute inset-0 rounded-og-md bg-og-accent-soft",
9824
+ initial: { opacity: 0 },
9825
+ animate: { opacity: [0, 0.38, 0] },
9826
+ transition: { duration: 0.72, times: [0, 0.18, 1], ease }
9827
+ },
9828
+ queueArrivalNonce
9829
+ ) : null,
9830
+ /* @__PURE__ */ jsx20("span", { className: cn("shrink-0", toneClass(signal.tone, selected)), children: signal.icon }),
9831
+ /* @__PURE__ */ jsxs15(
9832
+ "span",
9833
+ {
9834
+ className: cn(
9835
+ "font-medium text-og-fg",
9836
+ compact ? "min-w-0 truncate" : "shrink-0"
9837
+ ),
9838
+ children: [
9839
+ compact && signal.id === "goal" ? "Goal \xB7 " : null,
9840
+ compact && signal.id === "goal" ? goalState === "pursuing" ? "Running" : signal.label : compact && signal.id === "queue" ? `${queuedTurns.length + optimisticQueued.length} queued` : signal.label
9841
+ ]
9842
+ }
9843
+ ),
9844
+ signal.detail && !compact ? /* @__PURE__ */ jsxs15(Fragment7, { children: [
9845
+ /* @__PURE__ */ jsx20("span", { "aria-hidden": true, className: "shrink-0 text-og-fg-subtle/60", children: "\xB7" }),
9846
+ /* @__PURE__ */ jsx20("span", { className: "min-w-0 max-w-[8.5rem] truncate text-og-fg sm:max-w-[12rem]", children: signal.detail })
9847
+ ] }) : null,
9848
+ selected && !compact ? /* @__PURE__ */ jsx20(
9849
+ "span",
9850
+ {
9851
+ "data-testid": "session-chrome-close",
9852
+ className: "ml-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-og-sm text-og-fg-subtle transition-colors group-hover:text-og-fg pointer-coarse:size-5",
9853
+ "aria-hidden": true,
9854
+ children: /* @__PURE__ */ jsx20(XIcon, { className: "size-3" })
9855
+ }
9856
+ ) : null
9857
+ ]
9858
+ }
9859
+ ),
9860
+ signal.id === "goal" && goal && record && !readOnly ? /* @__PURE__ */ jsxs15("div", { className: cn("flex shrink-0 items-center pr-1", compact && "pl-0.5"), children: [
9861
+ record.status === "active" || record.status === "paused" ? /* @__PURE__ */ jsx20(
9862
+ IconAction,
9863
+ {
9864
+ label: record.status === "paused" ? "Resume goal" : "Pause goal",
9865
+ tip: record.status === "paused" ? "Resume goal" : "Pause goal",
9866
+ disabled: goal.updating,
9867
+ onClick: () => void (record.status === "paused" ? goal.resume() : goal.pause("Paused from session chrome")),
9868
+ children: goal.updating ? /* @__PURE__ */ jsx20(Loader2Icon2, { className: "size-3 animate-og-spin" }) : record.status === "paused" ? /* @__PURE__ */ jsx20(PlayIcon2, { className: "size-3" }) : /* @__PURE__ */ jsx20(PauseIcon2, { className: "size-3" })
9869
+ }
9870
+ ) : null,
9871
+ /* @__PURE__ */ jsx20(
9872
+ IconAction,
9873
+ {
9874
+ label: "Clear goal",
9875
+ tip: "Clear goal",
9876
+ danger: true,
9877
+ disabled: goal.updating,
9878
+ onClick: () => void goal.deleteGoal(),
9879
+ children: /* @__PURE__ */ jsx20(Trash2Icon2, { className: "size-3" })
9880
+ }
9881
+ )
9882
+ ] }) : signal.id === "queue" && canMutateQueue && queuedTurns[0] ? /* @__PURE__ */ jsx20("div", { className: cn("flex shrink-0 items-center pr-1", compact && "pl-0.5"), children: /* @__PURE__ */ jsx20(
9883
+ IconAction,
9135
9884
  {
9136
- "data-testid": "session-chrome-close",
9137
- className: "ml-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-og-sm text-og-fg-subtle transition-colors group-hover:text-og-fg pointer-coarse:size-5",
9138
- "aria-hidden": true,
9139
- children: /* @__PURE__ */ jsx18(XIcon, { className: "size-3" })
9885
+ label: "Steer first queued message",
9886
+ text: "Steer",
9887
+ tip: QUEUE_STEER_TIP,
9888
+ disabled: queue.mutating || Boolean(queue.mutationFor(queuedTurns[0].id)),
9889
+ onClick: () => void queue.steerTurn(queuedTurns[0].id),
9890
+ children: /* @__PURE__ */ jsx20(CornerDownRightIcon, { className: "size-3" })
9140
9891
  }
9141
- ) : null
9892
+ ) }) : null
9142
9893
  ]
9143
9894
  },
9144
9895
  signal.id
9145
9896
  );
9146
9897
  }),
9147
- stopping ? /* @__PURE__ */ jsxs13(
9898
+ compact && signals.some((signal) => ["incoming", "agents", "commands"].includes(signal.id)) ? /* @__PURE__ */ jsxs15(
9899
+ "button",
9900
+ {
9901
+ type: "button",
9902
+ "aria-label": "Session activity",
9903
+ title: activityOpen ? "Close activity" : "Inbox, agents and commands",
9904
+ "aria-controls": panelId,
9905
+ "aria-expanded": activityOpen,
9906
+ onClick: () => {
9907
+ setActivityOpen(!activityOpen);
9908
+ setActive(
9909
+ activityOpen ? null : signals.find(
9910
+ (signal) => ["incoming", "agents", "commands"].includes(signal.id)
9911
+ )?.id ?? null
9912
+ );
9913
+ },
9914
+ className: cn(
9915
+ "ml-auto inline-flex min-h-8 shrink-0 items-center justify-center gap-1.5 rounded-og-md px-2 text-og-xs transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent/40 pointer-coarse:min-h-11 pointer-coarse:min-w-11",
9916
+ activityOpen ? "bg-og-surface-3 text-og-fg" : "text-og-fg-muted hover:bg-og-surface-2 hover:text-og-fg"
9917
+ ),
9918
+ children: [
9919
+ /* @__PURE__ */ jsx20(ActivityIcon, { className: "size-3.5" }),
9920
+ /* @__PURE__ */ jsx20("span", { className: "sr-only", children: "Activity" }),
9921
+ incoming.length > 0 ? /* @__PURE__ */ jsx20("span", { className: "size-1.5 rounded-full bg-og-accent" }) : null
9922
+ ]
9923
+ }
9924
+ ) : null,
9925
+ stopping ? /* @__PURE__ */ jsxs15(
9148
9926
  "span",
9149
9927
  {
9150
9928
  role: "status",
@@ -9152,7 +9930,7 @@ function SessionChrome({
9152
9930
  className: "inline-flex min-h-[var(--og-session-chrome-chip-min-height)] items-center gap-1.5 px-1.5 text-og-xs text-og-fg-muted",
9153
9931
  "data-testid": "session-chrome-stopping",
9154
9932
  children: [
9155
- /* @__PURE__ */ jsx18(
9933
+ /* @__PURE__ */ jsx20(
9156
9934
  Loader2Icon2,
9157
9935
  {
9158
9936
  "aria-hidden": "true",
@@ -9168,7 +9946,41 @@ function SessionChrome({
9168
9946
  )
9169
9947
  }
9170
9948
  ),
9171
- /* @__PURE__ */ jsx18(
9949
+ /* @__PURE__ */ jsx20(AnimatePresence2, { initial: false, children: compact && activityOpen ? /* @__PURE__ */ jsx20(
9950
+ motion3.div,
9951
+ {
9952
+ initial: { height: 0, opacity: 0 },
9953
+ animate: { height: "auto", opacity: 1 },
9954
+ exit: { height: 0, opacity: 0 },
9955
+ transition: { duration: shellDuration, ease },
9956
+ style: { overflow: "hidden" },
9957
+ children: /* @__PURE__ */ jsx20("div", { className: "mt-1 flex items-center gap-1 rounded-t-og-lg bg-og-surface-2/50 px-2 py-1", children: signals.filter((signal) => ["incoming", "agents", "commands"].includes(signal.id)).map((signal) => /* @__PURE__ */ jsxs15(
9958
+ "button",
9959
+ {
9960
+ type: "button",
9961
+ "aria-expanded": active === signal.id,
9962
+ onClick: () => {
9963
+ if (activityVisibleRef.current) setActive(signal.id);
9964
+ },
9965
+ className: cn(
9966
+ "inline-flex min-h-9 items-center gap-1.5 rounded-og-md px-2 text-og-xs pointer-coarse:min-h-11",
9967
+ active === signal.id ? "bg-og-surface-3 text-og-fg" : "text-og-fg-muted hover:text-og-fg"
9968
+ ),
9969
+ children: [
9970
+ signal.icon,
9971
+ signal.id === "incoming" ? `${incoming.length} incoming` : signal.label
9972
+ ]
9973
+ },
9974
+ signal.id
9975
+ )) })
9976
+ },
9977
+ "activity-tabs"
9978
+ ) : null }),
9979
+ goal?.mutationError ? /* @__PURE__ */ jsxs15("p", { role: "alert", className: "px-3 pb-2 text-og-xs text-og-danger", children: [
9980
+ "Goal action not confirmed. ",
9981
+ goal.mutationError.message
9982
+ ] }) : null,
9983
+ /* @__PURE__ */ jsx20(
9172
9984
  "div",
9173
9985
  {
9174
9986
  id: panelId,
@@ -9184,33 +9996,48 @@ function SessionChrome({
9184
9996
  transitionDuration: "var(--og-session-chrome-duration)",
9185
9997
  transitionTimingFunction: "var(--_og-session-chrome-ease)"
9186
9998
  },
9187
- children: /* @__PURE__ */ jsx18("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ jsx18(
9999
+ children: /* @__PURE__ */ jsx20("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ jsxs15(
9188
10000
  "div",
9189
10001
  {
9190
- className: "relative overflow-y-auto overscroll-contain border-t border-og-border/50",
10002
+ className: cn(
10003
+ "relative overflow-y-auto overscroll-contain",
10004
+ compact ? activityOpen ? "rounded-b-og-lg bg-og-surface-2/50" : "mt-1 rounded-og-lg bg-og-surface-2/50" : "border-t border-og-border/50"
10005
+ ),
9191
10006
  style: {
9192
10007
  maxHeight: "var(--og-session-chrome-panel-max-height)",
9193
10008
  paddingInline: "var(--og-session-chrome-panel-pad-x)",
9194
10009
  paddingBlock: "var(--og-session-chrome-panel-pad-y)"
9195
10010
  },
9196
- children: /* @__PURE__ */ jsx18(AnimatePresence2, { initial: false, children: active && panelBody ? /* @__PURE__ */ jsx18(
9197
- motion2.div,
9198
- {
9199
- "data-og-session-chrome-panel-frame": active,
9200
- initial: reduceMotion ? false : { opacity: 0 },
9201
- animate: { opacity: 1, position: "relative" },
9202
- exit: reduceMotion ? { opacity: 1, position: "relative" } : {
9203
- opacity: 0,
9204
- position: "absolute",
9205
- top: 0,
9206
- left: 0,
9207
- right: 0
10011
+ children: [
10012
+ /* @__PURE__ */ jsx20(AnimatePresence2, { initial: false, children: active && active !== "commands" && panelBody ? /* @__PURE__ */ jsx20(
10013
+ motion3.div,
10014
+ {
10015
+ "data-og-session-chrome-panel-frame": active,
10016
+ initial: reduceMotion ? false : { opacity: 0 },
10017
+ animate: { opacity: 1, position: "relative" },
10018
+ exit: reduceMotion ? { opacity: 1, position: "relative" } : {
10019
+ opacity: 0,
10020
+ position: "absolute",
10021
+ top: 0,
10022
+ left: 0,
10023
+ right: 0
10024
+ },
10025
+ transition: { duration: crossfadeDuration, ease },
10026
+ children: panelBody
9208
10027
  },
9209
- transition: { duration: crossfadeDuration, ease },
9210
- children: panelBody
9211
- },
9212
- active
9213
- ) : null })
10028
+ active
10029
+ ) : null }),
10030
+ active === "commands" ? /* @__PURE__ */ jsx20(
10031
+ motion3.div,
10032
+ {
10033
+ initial: reduceMotion ? false : { opacity: 0 },
10034
+ animate: { opacity: 1 },
10035
+ transition: { duration: crossfadeDuration, ease },
10036
+ children: panelBody
10037
+ },
10038
+ "commands"
10039
+ ) : null
10040
+ ]
9214
10041
  }
9215
10042
  ) })
9216
10043
  }
@@ -9225,18 +10052,18 @@ function IncomingPanel({
9225
10052
  inputs,
9226
10053
  onDismiss
9227
10054
  }) {
9228
- return /* @__PURE__ */ jsx18(
10055
+ return /* @__PURE__ */ jsx20(
9229
10056
  "ul",
9230
10057
  {
9231
10058
  className: "flex flex-col gap-0.5",
9232
10059
  "aria-label": "Incoming updates",
9233
10060
  "data-og-session-chrome-panel": "incoming",
9234
- children: inputs.map((input) => /* @__PURE__ */ jsxs13(
10061
+ children: inputs.map((input) => /* @__PURE__ */ jsxs15(
9235
10062
  "li",
9236
10063
  {
9237
10064
  className: "group flex items-start gap-1.5 rounded-og-sm px-1.5 py-1 transition-colors hover:bg-[var(--_og-session-chrome-row-hover)]",
9238
10065
  children: [
9239
- /* @__PURE__ */ jsx18(
10066
+ /* @__PURE__ */ jsx20(
9240
10067
  "span",
9241
10068
  {
9242
10069
  className: cn(
@@ -9246,15 +10073,15 @@ function IncomingPanel({
9246
10073
  children: pendingKindLabel(input.kind)
9247
10074
  }
9248
10075
  ),
9249
- /* @__PURE__ */ jsx18("p", { className: "min-w-0 flex-1 text-og-xs leading-4 text-og-fg", children: input.summary }),
9250
- onDismiss ? /* @__PURE__ */ jsx18("div", { className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 max-sm:opacity-100", children: /* @__PURE__ */ jsx18(
10076
+ /* @__PURE__ */ jsx20("p", { className: "min-w-0 flex-1 text-og-xs leading-4 text-og-fg", children: input.summary }),
10077
+ onDismiss ? /* @__PURE__ */ jsx20("div", { className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 max-sm:opacity-100", children: /* @__PURE__ */ jsx20(
9251
10078
  IconAction,
9252
10079
  {
9253
10080
  label: `Dismiss incoming ${pendingKindLabel(input.kind)}`,
9254
10081
  tip: "Dismiss",
9255
10082
  onClick: () => onDismiss(input.id),
9256
10083
  danger: true,
9257
- children: /* @__PURE__ */ jsx18(Trash2Icon2, { className: "size-3" })
10084
+ children: /* @__PURE__ */ jsx20(Trash2Icon2, { className: "size-3" })
9258
10085
  }
9259
10086
  ) }) : null
9260
10087
  ]
@@ -9301,7 +10128,7 @@ function QueuePanel({
9301
10128
  );
9302
10129
  return () => clearTimeout(timer);
9303
10130
  }, [reduceMotion, turnIdsKey]);
9304
- return /* @__PURE__ */ jsxs13(
10131
+ return /* @__PURE__ */ jsxs15(
9305
10132
  "ol",
9306
10133
  {
9307
10134
  className: "flex flex-col gap-0.5",
@@ -9317,65 +10144,66 @@ function QueuePanel({
9317
10144
  const beforeDown = index < turns.length - 1 ? turns[index + 2]?.id ?? null : null;
9318
10145
  const showActions = !readOnly && (onEdit || onSteer || onRemove || onMove);
9319
10146
  const confirmingReplace = replaceDraftFor === turn.id;
9320
- return /* @__PURE__ */ jsxs13(
10147
+ return /* @__PURE__ */ jsxs15(
9321
10148
  "li",
9322
10149
  {
9323
10150
  "data-queue-turn-id": turn.id,
9324
10151
  className: "group flex flex-col gap-1 rounded-og-sm px-1.5 py-1 transition-colors hover:bg-[var(--_og-session-chrome-row-hover)]",
9325
10152
  children: [
9326
- /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-1.5", children: [
9327
- voice ? /* @__PURE__ */ jsx18(
10153
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-start gap-1.5", children: [
10154
+ voice ? /* @__PURE__ */ jsx20(
9328
10155
  AudioLinesIcon,
9329
10156
  {
9330
10157
  "aria-hidden": "true",
9331
10158
  className: "mt-0.5 size-3 shrink-0 text-og-accent"
9332
10159
  }
9333
- ) : /* @__PURE__ */ jsx18("span", { className: "mt-px shrink-0 font-og-mono text-[10px] leading-4 text-og-fg-subtle", children: index + 1 }),
9334
- /* @__PURE__ */ jsx18("p", { className: "min-w-0 flex-1 truncate text-og-xs leading-4 text-og-fg", children: presentation.text }),
9335
- showActions ? /* @__PURE__ */ jsxs13("div", { className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 max-sm:opacity-100", children: [
9336
- onMove && turns.length > 1 ? /* @__PURE__ */ jsxs13(Fragment6, { children: [
9337
- /* @__PURE__ */ jsx18(
10160
+ ) : /* @__PURE__ */ jsx20("span", { className: "mt-px shrink-0 font-og-mono text-[10px] leading-4 text-og-fg-subtle", children: index + 1 }),
10161
+ /* @__PURE__ */ jsx20("p", { className: "min-w-0 flex-1 truncate text-og-xs leading-4 text-og-fg", children: presentation.text }),
10162
+ showActions ? /* @__PURE__ */ jsxs15("div", { className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 max-sm:opacity-100", children: [
10163
+ onMove && turns.length > 1 ? /* @__PURE__ */ jsxs15(Fragment7, { children: [
10164
+ /* @__PURE__ */ jsx20(
9338
10165
  IconAction,
9339
10166
  {
9340
10167
  label: `Move queued prompt ${index + 1} up`,
9341
10168
  tip: "Move up",
9342
10169
  disabled: settling || pending !== null || index === 0,
9343
10170
  onClick: () => onMove(turn.id, beforeUp),
9344
- children: /* @__PURE__ */ jsx18(ArrowUpIcon, { className: "size-3" })
10171
+ children: /* @__PURE__ */ jsx20(ArrowUpIcon, { className: "size-3" })
9345
10172
  }
9346
10173
  ),
9347
- /* @__PURE__ */ jsx18(
10174
+ /* @__PURE__ */ jsx20(
9348
10175
  IconAction,
9349
10176
  {
9350
10177
  label: `Move queued prompt ${index + 1} down`,
9351
10178
  tip: "Move down",
9352
10179
  disabled: settling || pending !== null || index >= turns.length - 1,
9353
10180
  onClick: () => onMove(turn.id, beforeDown),
9354
- children: /* @__PURE__ */ jsx18(ArrowDownIcon2, { className: "size-3" })
10181
+ children: /* @__PURE__ */ jsx20(ArrowDownIcon2, { className: "size-3" })
9355
10182
  }
9356
10183
  )
9357
10184
  ] }) : null,
9358
- onSteer ? /* @__PURE__ */ jsx18(
10185
+ onSteer ? /* @__PURE__ */ jsx20(
9359
10186
  IconAction,
9360
10187
  {
9361
10188
  label: `Steer queued prompt ${index + 1}`,
10189
+ text: "Steer",
9362
10190
  tip: QUEUE_STEER_TIP,
9363
10191
  disabled: settling || pending !== null,
9364
10192
  onClick: () => onSteer(turn.id),
9365
- children: pending === "steer" ? /* @__PURE__ */ jsx18(Loader2Icon2, { className: "size-3 animate-og-spin" }) : /* @__PURE__ */ jsx18(ZapIcon, { className: "size-3" })
10193
+ children: pending === "steer" ? /* @__PURE__ */ jsx20(Loader2Icon2, { className: "size-3 animate-og-spin" }) : /* @__PURE__ */ jsx20(CornerDownRightIcon, { className: "size-3" })
9366
10194
  }
9367
10195
  ) : null,
9368
- onEdit ? /* @__PURE__ */ jsx18(
10196
+ onEdit ? /* @__PURE__ */ jsx20(
9369
10197
  IconAction,
9370
10198
  {
9371
10199
  label: `Edit queued prompt ${index + 1}`,
9372
10200
  tip: QUEUE_EDIT_TIP,
9373
10201
  disabled: settling || pending !== null,
9374
10202
  onClick: () => onEdit(turn),
9375
- children: pending === "edit" ? /* @__PURE__ */ jsx18(Loader2Icon2, { className: "size-3 animate-og-spin" }) : /* @__PURE__ */ jsx18(PencilIcon, { className: "size-3" })
10203
+ children: pending === "edit" ? /* @__PURE__ */ jsx20(Loader2Icon2, { className: "size-3 animate-og-spin" }) : /* @__PURE__ */ jsx20(PencilIcon, { className: "size-3" })
9376
10204
  }
9377
10205
  ) : null,
9378
- onRemove ? /* @__PURE__ */ jsx18(
10206
+ onRemove ? /* @__PURE__ */ jsx20(
9379
10207
  IconAction,
9380
10208
  {
9381
10209
  label: `Remove queued prompt ${index + 1}`,
@@ -9383,16 +10211,16 @@ function QueuePanel({
9383
10211
  disabled: settling || pending !== null,
9384
10212
  onClick: () => onRemove(turn.id),
9385
10213
  danger: true,
9386
- children: pending === "delete" ? /* @__PURE__ */ jsx18(Loader2Icon2, { className: "size-3 animate-og-spin" }) : /* @__PURE__ */ jsx18(Trash2Icon2, { className: "size-3" })
10214
+ children: pending === "delete" ? /* @__PURE__ */ jsx20(Loader2Icon2, { className: "size-3 animate-og-spin" }) : /* @__PURE__ */ jsx20(Trash2Icon2, { className: "size-3" })
9387
10215
  }
9388
10216
  ) : null
9389
10217
  ] }) : null
9390
10218
  ] }),
9391
- confirmingReplace ? /* @__PURE__ */ jsxs13("div", { className: "rounded-og-sm border border-og-status-waiting/30 bg-og-status-waiting/10 p-2 text-og-xs text-og-fg", children: [
9392
- /* @__PURE__ */ jsx18("p", { children: "Your composer already has a draft. Replace it with this queued prompt?" }),
9393
- /* @__PURE__ */ jsx18("p", { className: "mt-0.5 text-og-fg-muted", children: "The current draft will be permanently discarded; this queued prompt is preserved until you confirm." }),
9394
- /* @__PURE__ */ jsxs13("div", { className: "mt-2 flex justify-end gap-1.5", children: [
9395
- /* @__PURE__ */ jsx18(
10219
+ confirmingReplace ? /* @__PURE__ */ jsxs15("div", { className: "rounded-og-sm border border-og-status-waiting/30 bg-og-status-waiting/10 p-2 text-og-xs text-og-fg", children: [
10220
+ /* @__PURE__ */ jsx20("p", { children: "Your composer already has a draft. Replace it with this queued prompt?" }),
10221
+ /* @__PURE__ */ jsx20("p", { className: "mt-0.5 text-og-fg-muted", children: "The current draft will be permanently discarded; this queued prompt is preserved until you confirm." }),
10222
+ /* @__PURE__ */ jsxs15("div", { className: "mt-2 flex justify-end gap-1.5", children: [
10223
+ /* @__PURE__ */ jsx20(
9396
10224
  "button",
9397
10225
  {
9398
10226
  type: "button",
@@ -9401,7 +10229,7 @@ function QueuePanel({
9401
10229
  children: "Keep current draft"
9402
10230
  }
9403
10231
  ),
9404
- /* @__PURE__ */ jsx18(
10232
+ /* @__PURE__ */ jsx20(
9405
10233
  "button",
9406
10234
  {
9407
10235
  type: "button",
@@ -9417,8 +10245,8 @@ function QueuePanel({
9417
10245
  turn.id
9418
10246
  );
9419
10247
  }),
9420
- /* @__PURE__ */ jsx18(AnimatePresence2, { initial: false, children: optimistic.map((message, index) => /* @__PURE__ */ jsxs13(
9421
- motion2.li,
10248
+ /* @__PURE__ */ jsx20(AnimatePresence2, { initial: false, children: optimistic.map((message, index) => /* @__PURE__ */ jsxs15(
10249
+ motion3.li,
9422
10250
  {
9423
10251
  "aria-live": "polite",
9424
10252
  "data-optimistic-queue-message": message.clientEventId,
@@ -9430,11 +10258,11 @@ function QueuePanel({
9430
10258
  message.state === "failed" ? "bg-og-danger/8 text-og-danger" : "bg-og-accent-soft/45"
9431
10259
  ),
9432
10260
  children: [
9433
- /* @__PURE__ */ jsx18("span", { className: "shrink-0 font-og-mono text-[10px] leading-4 text-og-fg-subtle", children: turns.length + index + 1 }),
9434
- /* @__PURE__ */ jsx18("p", { className: "min-w-0 flex-1 truncate text-og-xs leading-4 text-og-fg", children: message.text }),
9435
- /* @__PURE__ */ jsx18("span", { className: "sr-only", children: message.state === "failed" ? "Not confirmed" : message.state === "sending" ? "Placing in queue" : "Queued" }),
9436
- message.state === "failed" ? /* @__PURE__ */ jsxs13("div", { className: "flex shrink-0 items-center gap-1 text-[10px]", children: [
9437
- onRetryOptimistic ? /* @__PURE__ */ jsx18(
10261
+ /* @__PURE__ */ jsx20("span", { className: "shrink-0 font-og-mono text-[10px] leading-4 text-og-fg-subtle", children: turns.length + index + 1 }),
10262
+ /* @__PURE__ */ jsx20("p", { className: "min-w-0 flex-1 truncate text-og-xs leading-4 text-og-fg", children: message.text }),
10263
+ /* @__PURE__ */ jsx20("span", { className: "sr-only", children: message.state === "failed" ? "Not confirmed" : message.state === "sending" ? "Placing in queue" : "Queued" }),
10264
+ message.state === "failed" ? /* @__PURE__ */ jsxs15("div", { className: "flex shrink-0 items-center gap-1 text-[10px]", children: [
10265
+ onRetryOptimistic ? /* @__PURE__ */ jsx20(
9438
10266
  "button",
9439
10267
  {
9440
10268
  type: "button",
@@ -9443,36 +10271,36 @@ function QueuePanel({
9443
10271
  children: "Retry"
9444
10272
  }
9445
10273
  ) : null,
9446
- onRemoveOptimistic ? /* @__PURE__ */ jsx18(
10274
+ onRemoveOptimistic ? /* @__PURE__ */ jsx20(
9447
10275
  "button",
9448
10276
  {
9449
10277
  type: "button",
9450
10278
  "aria-label": "Dismiss unconfirmed queued prompt",
9451
10279
  className: "rounded-og-sm p-1 text-og-fg-muted hover:bg-og-surface-2 hover:text-og-fg pointer-coarse:min-h-11 pointer-coarse:min-w-11",
9452
10280
  onClick: () => onRemoveOptimistic(message.clientEventId),
9453
- children: /* @__PURE__ */ jsx18(XIcon, { className: "size-3" })
10281
+ children: /* @__PURE__ */ jsx20(XIcon, { className: "size-3" })
9454
10282
  }
9455
10283
  ) : null
9456
- ] }) : message.state === "sending" ? /* @__PURE__ */ jsx18(
10284
+ ] }) : message.state === "sending" ? /* @__PURE__ */ jsx20(
9457
10285
  Loader2Icon2,
9458
10286
  {
9459
10287
  "aria-hidden": "true",
9460
10288
  className: "size-3 shrink-0 animate-og-spin text-og-accent motion-reduce:animate-none"
9461
10289
  }
9462
- ) : /* @__PURE__ */ jsx18(CheckIcon3, { "aria-hidden": "true", className: "size-3 shrink-0 text-og-accent" })
10290
+ ) : /* @__PURE__ */ jsx20(CheckIcon3, { "aria-hidden": "true", className: "size-3 shrink-0 text-og-accent" })
9463
10291
  ]
9464
10292
  },
9465
10293
  message.clientEventId
9466
10294
  )) }),
9467
- loadError ? /* @__PURE__ */ jsxs13(
10295
+ loadError ? /* @__PURE__ */ jsxs15(
9468
10296
  "li",
9469
10297
  {
9470
10298
  role: "alert",
9471
10299
  className: "flex items-center gap-1.5 rounded-og-sm bg-og-danger/8 px-1.5 py-1 text-og-xs text-og-danger",
9472
10300
  children: [
9473
- /* @__PURE__ */ jsx18(TriangleAlertIcon3, { className: "size-3 shrink-0" }),
9474
- /* @__PURE__ */ jsx18("span", { className: "min-w-0 flex-1", children: "Queue unavailable." }),
9475
- /* @__PURE__ */ jsx18(
10301
+ /* @__PURE__ */ jsx20(TriangleAlertIcon3, { className: "size-3 shrink-0" }),
10302
+ /* @__PURE__ */ jsx20("span", { className: "min-w-0 flex-1", children: "Queue unavailable." }),
10303
+ /* @__PURE__ */ jsx20(
9476
10304
  "button",
9477
10305
  {
9478
10306
  type: "button",
@@ -9484,15 +10312,15 @@ function QueuePanel({
9484
10312
  ]
9485
10313
  }
9486
10314
  ) : null,
9487
- mutationError ? /* @__PURE__ */ jsxs13(
10315
+ mutationError ? /* @__PURE__ */ jsxs15(
9488
10316
  "li",
9489
10317
  {
9490
10318
  role: "alert",
9491
10319
  className: "flex items-center gap-1.5 rounded-og-sm bg-og-danger/8 px-1.5 py-1 text-og-xs text-og-danger",
9492
10320
  children: [
9493
- /* @__PURE__ */ jsx18(TriangleAlertIcon3, { className: "size-3 shrink-0" }),
9494
- /* @__PURE__ */ jsx18("span", { className: "min-w-0 flex-1", children: "Not confirmed. Check the queue before retrying." }),
9495
- /* @__PURE__ */ jsx18(
10321
+ /* @__PURE__ */ jsx20(TriangleAlertIcon3, { className: "size-3 shrink-0" }),
10322
+ /* @__PURE__ */ jsx20("span", { className: "min-w-0 flex-1", children: "Not confirmed. Check the queue before retrying." }),
10323
+ /* @__PURE__ */ jsx20(
9496
10324
  "button",
9497
10325
  {
9498
10326
  type: "button",
@@ -9518,25 +10346,26 @@ function GoalPanel({
9518
10346
  if (!record) return null;
9519
10347
  const canToggle = !readOnly && (record.status === "active" || record.status === "paused");
9520
10348
  const explanation = sessionChromeGoalPillExplanation(state, record);
9521
- return /* @__PURE__ */ jsxs13("div", { className: "space-y-1.5", "data-og-session-chrome-panel": "goal", children: [
9522
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-og-fg-subtle", children: [
9523
- /* @__PURE__ */ jsx18("span", { children: sessionChromeGoalPillLabel(state, record) }),
9524
- elapsed ? /* @__PURE__ */ jsxs13("span", { className: "tabular-nums normal-case tracking-normal text-og-fg-muted", children: [
9525
- "\xB7 ",
9526
- elapsed
10349
+ return /* @__PURE__ */ jsxs15("div", { className: "space-y-1.5", "data-og-session-chrome-panel": "goal", children: [
10350
+ /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-og-fg-subtle", children: [
10351
+ /* @__PURE__ */ jsx20("span", { children: sessionChromeGoalPillLabel(state, record) }),
10352
+ elapsed ? /* @__PURE__ */ jsxs15("span", { className: "tabular-nums normal-case tracking-normal text-og-fg-muted", children: [
10353
+ "\xB7 Created ",
10354
+ elapsed,
10355
+ " ago"
9527
10356
  ] }) : null,
9528
- /* @__PURE__ */ jsxs13("span", { className: "normal-case tracking-normal text-og-fg-muted", children: [
10357
+ /* @__PURE__ */ jsxs15("span", { className: "normal-case tracking-normal text-og-fg-muted", children: [
9529
10358
  "\xB7 v",
9530
10359
  record.version
9531
10360
  ] })
9532
10361
  ] }),
9533
- /* @__PURE__ */ jsx18("p", { className: "text-og-sm leading-5 text-og-fg", children: record.text }),
9534
- record.successCriteria ? /* @__PURE__ */ jsxs13("p", { className: "text-og-xs leading-4 text-og-fg-muted", children: [
9535
- /* @__PURE__ */ jsx18("span", { className: "font-medium text-og-fg", children: "Done when" }),
10362
+ /* @__PURE__ */ jsx20("p", { className: "text-og-sm leading-5 text-og-fg", children: record.text }),
10363
+ record.successCriteria ? /* @__PURE__ */ jsxs15("p", { className: "text-og-xs leading-4 text-og-fg-muted", children: [
10364
+ /* @__PURE__ */ jsx20("span", { className: "font-medium text-og-fg", children: "Done when" }),
9536
10365
  " ",
9537
10366
  record.successCriteria
9538
10367
  ] }) : null,
9539
- explanation ? /* @__PURE__ */ jsx18(
10368
+ explanation ? /* @__PURE__ */ jsx20(
9540
10369
  "p",
9541
10370
  {
9542
10371
  "data-og-session-chrome-goal-explanation": true,
@@ -9544,20 +10373,20 @@ function GoalPanel({
9544
10373
  children: explanation
9545
10374
  }
9546
10375
  ) : null,
9547
- record.continuation?.lastError ? /* @__PURE__ */ jsx18("p", { className: "rounded-og-sm bg-og-status-waiting/10 px-1.5 py-1 text-og-xs leading-4 text-og-status-waiting", children: record.continuation.lastError }) : null,
9548
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center justify-between gap-1.5 pt-0.5", children: [
9549
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap gap-1 text-[10px] text-og-fg-muted", children: [
9550
- /* @__PURE__ */ jsxs13("span", { className: "rounded bg-og-surface-3/70 px-1 py-px", children: [
10376
+ record.continuation?.lastError ? /* @__PURE__ */ jsx20("p", { className: "rounded-og-sm bg-og-status-waiting/10 px-1.5 py-1 text-og-xs leading-4 text-og-status-waiting", children: record.continuation.lastError }) : null,
10377
+ /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center justify-between gap-1.5 pt-0.5", children: [
10378
+ /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap gap-1 text-[10px] text-og-fg-muted", children: [
10379
+ /* @__PURE__ */ jsxs15("span", { className: "rounded bg-og-surface-3/70 px-1 py-px", children: [
9551
10380
  record.autoContinuations,
9552
10381
  " consecutive unattended continues"
9553
10382
  ] }),
9554
- /* @__PURE__ */ jsxs13("span", { className: "rounded bg-og-surface-3/70 px-1 py-px", children: [
10383
+ /* @__PURE__ */ jsxs15("span", { className: "rounded bg-og-surface-3/70 px-1 py-px", children: [
9555
10384
  record.noProgressStreak,
9556
10385
  " stalled"
9557
10386
  ] })
9558
10387
  ] }),
9559
- !readOnly ? /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-0.5", children: [
9560
- canToggle ? /* @__PURE__ */ jsxs13(
10388
+ !readOnly ? /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-0.5", children: [
10389
+ canToggle ? /* @__PURE__ */ jsxs15(
9561
10390
  "button",
9562
10391
  {
9563
10392
  type: "button",
@@ -9565,12 +10394,12 @@ function GoalPanel({
9565
10394
  onClick: () => void (record.status === "paused" ? goal.resume() : goal.pause("Paused from session chrome")),
9566
10395
  className: "inline-flex h-6 items-center gap-1 rounded-og-sm px-1.5 text-og-xs font-medium text-og-fg-muted outline-hidden transition-colors hover:bg-og-surface-3/70 hover:text-og-fg focus-visible:ring-2 focus-visible:ring-og-accent/40 disabled:opacity-50",
9567
10396
  children: [
9568
- goal.updating ? /* @__PURE__ */ jsx18(Loader2Icon2, { className: "size-3 animate-og-spin" }) : record.status === "paused" ? /* @__PURE__ */ jsx18(PlayIcon2, { className: "size-3" }) : /* @__PURE__ */ jsx18(PauseIcon2, { className: "size-3" }),
10397
+ goal.updating ? /* @__PURE__ */ jsx20(Loader2Icon2, { className: "size-3 animate-og-spin" }) : record.status === "paused" ? /* @__PURE__ */ jsx20(PlayIcon2, { className: "size-3" }) : /* @__PURE__ */ jsx20(PauseIcon2, { className: "size-3" }),
9569
10398
  record.status === "paused" ? "Resume" : "Pause"
9570
10399
  ]
9571
10400
  }
9572
10401
  ) : null,
9573
- /* @__PURE__ */ jsxs13(
10402
+ /* @__PURE__ */ jsxs15(
9574
10403
  "button",
9575
10404
  {
9576
10405
  type: "button",
@@ -9578,7 +10407,7 @@ function GoalPanel({
9578
10407
  onClick: () => void goal.deleteGoal(),
9579
10408
  className: "inline-flex h-6 items-center gap-1 rounded-og-sm px-1.5 text-og-xs font-medium text-og-fg-subtle outline-hidden transition-colors hover:bg-og-surface-3/70 hover:text-og-danger focus-visible:ring-2 focus-visible:ring-og-accent/40 disabled:opacity-50",
9580
10409
  children: [
9581
- /* @__PURE__ */ jsx18(Trash2Icon2, { className: "size-3" }),
10410
+ /* @__PURE__ */ jsx20(Trash2Icon2, { className: "size-3" }),
9582
10411
  "Clear"
9583
10412
  ]
9584
10413
  }
@@ -9587,13 +10416,14 @@ function GoalPanel({
9587
10416
  ] })
9588
10417
  ] });
9589
10418
  }
9590
- var QUEUE_STEER_TIP = /* @__PURE__ */ jsxs13("span", { className: "flex flex-col gap-0.5 text-left", children: [
9591
- /* @__PURE__ */ jsx18("span", { className: "font-medium", children: "Steer" }),
9592
- /* @__PURE__ */ jsx18("span", { className: "opacity-80", children: "Interrupt the current turn and send this message now" })
10419
+ var QUEUE_STEER_TIP = /* @__PURE__ */ jsxs15("span", { className: "flex flex-col gap-0.5 text-left", children: [
10420
+ /* @__PURE__ */ jsx20("span", { className: "font-medium", children: "Steer" }),
10421
+ /* @__PURE__ */ jsx20("span", { className: "opacity-80", children: "Interrupt the current turn and send this message now" })
9593
10422
  ] });
9594
10423
  var QUEUE_EDIT_TIP = "Edit in composer";
9595
10424
  var QUEUE_DELETE_TIP = "Delete this queued prompt";
9596
10425
  function IconAction({
10426
+ text,
9597
10427
  label,
9598
10428
  tip,
9599
10429
  onClick,
@@ -9601,8 +10431,8 @@ function IconAction({
9601
10431
  danger,
9602
10432
  children
9603
10433
  }) {
9604
- return /* @__PURE__ */ jsxs13(Tooltip, { children: [
9605
- /* @__PURE__ */ jsx18(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx18(
10434
+ return /* @__PURE__ */ jsxs15(Tooltip, { children: [
10435
+ /* @__PURE__ */ jsx20(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs15(
9606
10436
  "button",
9607
10437
  {
9608
10438
  type: "button",
@@ -9610,15 +10440,110 @@ function IconAction({
9610
10440
  disabled,
9611
10441
  onClick,
9612
10442
  className: cn(
9613
- "inline-flex size-6 items-center justify-center rounded-og-sm text-og-fg-subtle outline-hidden transition-colors",
10443
+ "inline-flex size-6 items-center justify-center rounded-og-sm outline-hidden transition-colors",
9614
10444
  "hover:bg-og-surface-2 hover:text-og-fg focus-visible:ring-2 focus-visible:ring-og-accent/40",
9615
10445
  "disabled:pointer-events-none disabled:opacity-40 pointer-coarse:size-9",
10446
+ text ? "text-og-fg" : "text-og-fg-subtle",
10447
+ text && "w-auto gap-1 px-1.5 text-og-xs pointer-coarse:w-auto",
9616
10448
  danger && "hover:text-og-danger"
9617
10449
  ),
9618
- children
10450
+ children: [
10451
+ children,
10452
+ text
10453
+ ]
9619
10454
  }
9620
10455
  ) }),
9621
- /* @__PURE__ */ jsx18(TooltipContent, { side: "top", children: tip })
10456
+ /* @__PURE__ */ jsx20(TooltipContent, { side: "top", children: tip })
10457
+ ] });
10458
+ }
10459
+
10460
+ // src/components/session-commands-panel.tsx
10461
+ import { ChevronRightIcon as ChevronRightIcon4, Loader2Icon as Loader2Icon3, SquareIcon } from "lucide-react";
10462
+ import { useState as useState14 } from "react";
10463
+ import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
10464
+ function SessionCommandsPanel({
10465
+ commands: state,
10466
+ readOnly = false
10467
+ }) {
10468
+ const [pending, setPending] = useState14(null);
10469
+ const [error, setError] = useState14(null);
10470
+ const active = state.commands.filter(
10471
+ (command) => command.state === "running" || command.state === "stopping"
10472
+ );
10473
+ const stop = async (id) => {
10474
+ setPending(id);
10475
+ setError(null);
10476
+ try {
10477
+ await state.cancel(id);
10478
+ } catch (cause) {
10479
+ setError(cause instanceof Error ? cause.message : "Stop was not confirmed. Try again.");
10480
+ } finally {
10481
+ setPending(null);
10482
+ }
10483
+ };
10484
+ return /* @__PURE__ */ jsxs16("div", { className: "space-y-2 text-og-xs", "data-og-session-commands": "", children: [
10485
+ state.loading && active.length === 0 ? /* @__PURE__ */ jsx21("p", { role: "status", className: "text-og-fg-muted", children: "Loading commands\u2026" }) : null,
10486
+ state.error ? /* @__PURE__ */ jsxs16("div", { role: "alert", className: "flex items-center justify-between gap-2 text-og-danger", children: [
10487
+ /* @__PURE__ */ jsx21("span", { children: "Commands unavailable." }),
10488
+ /* @__PURE__ */ jsx21(
10489
+ "button",
10490
+ {
10491
+ type: "button",
10492
+ className: "underline outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent/40",
10493
+ onClick: () => void state.refresh(),
10494
+ children: "Retry"
10495
+ }
10496
+ )
10497
+ ] }) : null,
10498
+ !state.loading && !state.error && active.length === 0 ? /* @__PURE__ */ jsx21("p", { role: "status", className: "text-og-fg-muted", children: "No background commands running." }) : null,
10499
+ active.length > 0 ? /* @__PURE__ */ jsx21("ul", { className: "max-h-64 overflow-y-auto overscroll-contain divide-y divide-og-border/40", children: active.map((command) => /* @__PURE__ */ jsxs16("li", { className: "flex items-start gap-3 py-2 first:pt-0 last:pb-0", children: [
10500
+ /* @__PURE__ */ jsxs16("div", { className: "min-w-0 flex-1", children: [
10501
+ /* @__PURE__ */ jsxs16("details", { className: "group/command", children: [
10502
+ /* @__PURE__ */ jsxs16(
10503
+ "summary",
10504
+ {
10505
+ className: "flex cursor-pointer list-none items-center gap-1.5 rounded-og-sm font-mono text-og-fg outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent/40",
10506
+ title: "Expand command",
10507
+ children: [
10508
+ /* @__PURE__ */ jsx21(ChevronRightIcon4, { className: "size-3 shrink-0 text-og-fg-subtle transition-transform group-open/command:rotate-90" }),
10509
+ /* @__PURE__ */ jsx21("span", { className: "truncate", children: command.commandPreview || "Background command" })
10510
+ ]
10511
+ }
10512
+ ),
10513
+ /* @__PURE__ */ jsxs16("div", { className: "mt-2 space-y-1", children: [
10514
+ /* @__PURE__ */ jsx21("p", { className: "whitespace-pre-wrap break-all font-mono text-og-fg-muted", children: command.commandPreview || "Background command" }),
10515
+ /* @__PURE__ */ jsxs16(
10516
+ "time",
10517
+ {
10518
+ className: "block text-og-fg-subtle",
10519
+ dateTime: command.startedAt,
10520
+ title: new Date(command.startedAt).toLocaleString(),
10521
+ children: [
10522
+ "Started ",
10523
+ formatClockTime(command.startedAt)
10524
+ ]
10525
+ }
10526
+ )
10527
+ ] })
10528
+ ] }),
10529
+ /* @__PURE__ */ jsx21("p", { className: "mt-1 text-og-fg-subtle", children: command.state === "stopping" ? "Stopping\u2026" : "Running" })
10530
+ ] }),
10531
+ !readOnly ? /* @__PURE__ */ jsxs16(
10532
+ "button",
10533
+ {
10534
+ type: "button",
10535
+ "aria-label": `Stop ${command.commandPreview || "background command"}`,
10536
+ disabled: pending !== null || command.state === "stopping",
10537
+ onClick: () => void stop(command.id),
10538
+ className: "inline-flex min-h-7 shrink-0 items-center gap-1 rounded-og-sm px-2 text-og-fg-muted outline-hidden hover:bg-og-surface-3/70 hover:text-og-fg focus-visible:ring-2 focus-visible:ring-og-accent/40 disabled:opacity-50 pointer-coarse:min-h-11",
10539
+ children: [
10540
+ pending === command.id || command.state === "stopping" ? /* @__PURE__ */ jsx21(Loader2Icon3, { className: "size-3 animate-og-spin motion-reduce:animate-none" }) : /* @__PURE__ */ jsx21(SquareIcon, { className: "size-3" }),
10541
+ "Stop"
10542
+ ]
10543
+ }
10544
+ ) : null
10545
+ ] }, command.id)) }) : null,
10546
+ error ? /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-og-danger", children: error }) : null
9622
10547
  ] });
9623
10548
  }
9624
10549
 
@@ -9676,9 +10601,14 @@ export {
9676
10601
  MessageTimeline,
9677
10602
  TimelineRow,
9678
10603
  QueueSurface,
10604
+ useAvailableModels,
10605
+ useWorkspaceModelCatalog,
10606
+ ChatComposer,
10607
+ SessionConversation,
9679
10608
  sessionChromeGoalPillLabel,
9680
10609
  sessionChromeGoalPillExplanation,
9681
10610
  sessionChromeGoalPillState,
9682
- SessionChrome
10611
+ SessionChrome,
10612
+ SessionCommandsPanel
9683
10613
  };
9684
- //# sourceMappingURL=chunk-DOK4KZF2.js.map
10614
+ //# sourceMappingURL=chunk-5IXTJTK3.js.map