@opengeni/react 0.44.3 → 0.44.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +42 -0
  2. package/dist/chunk-22KP6LR5.js +31 -0
  3. package/dist/{chunk-TK7G6XLT.js.map → chunk-22KP6LR5.js.map} +1 -1
  4. package/dist/{chunk-SXIQK54Z.js → chunk-6EDV6YFE.js} +8 -8
  5. package/dist/{chunk-SXIQK54Z.js.map → chunk-6EDV6YFE.js.map} +1 -1
  6. package/dist/{chunk-U6K24XQD.js → chunk-EHSYZ4KP.js} +37 -16
  7. package/dist/chunk-EHSYZ4KP.js.map +1 -0
  8. package/dist/chunk-JB5725BI.js +48 -0
  9. package/dist/chunk-JB5725BI.js.map +1 -0
  10. package/dist/{chunk-QQRM3DO3.js → chunk-L3EWO3UK.js} +6 -6
  11. package/dist/{chunk-QQRM3DO3.js.map → chunk-L3EWO3UK.js.map} +1 -1
  12. package/dist/{chunk-YNYIAYXQ.js → chunk-LYRJUU5V.js} +23 -23
  13. package/dist/chunk-LYRJUU5V.js.map +1 -0
  14. package/dist/{chunk-ATSTR5P3.js → chunk-U3CSCMWA.js} +5 -49
  15. package/dist/chunk-U3CSCMWA.js.map +1 -0
  16. package/dist/{chunk-YDNWMKXO.js → chunk-VCBFUSUZ.js} +4 -4
  17. package/dist/chunk-VCBFUSUZ.js.map +1 -0
  18. package/dist/components/model-policy-picker.d.ts +10 -1
  19. package/dist/composer.js +5 -4
  20. package/dist/index.js +11 -9
  21. package/dist/index.js.map +1 -1
  22. package/dist/machines.js +2 -2
  23. package/dist/{queue-surface-implementation-THPAKGMD.js → queue-surface-implementation-J4XJFKRW.js} +41 -26
  24. package/dist/queue-surface-implementation-J4XJFKRW.js.map +1 -0
  25. package/dist/realtime/dropdown-menu.d.ts +4 -4
  26. package/dist/realtime.js +58 -20
  27. package/dist/realtime.js.map +1 -1
  28. package/dist/session-ui.js +5 -4
  29. package/package.json +1 -1
  30. package/src/components/composer.tsx +3 -3
  31. package/src/components/enrollment-device-flow.tsx +2 -2
  32. package/src/components/message-timeline.tsx +15 -15
  33. package/src/components/model-policy-picker.tsx +47 -14
  34. package/src/components/queue-surface-implementation.tsx +28 -18
  35. package/src/components/queue-surface-state.tsx +3 -3
  36. package/src/components/queue-surface.tsx +2 -2
  37. package/src/components/session-status.tsx +1 -1
  38. package/src/lib/cn.ts +14 -1
  39. package/src/lib/use-portal-token-style.ts +1 -1
  40. package/src/provider.tsx +4 -4
  41. package/src/realtime/dropdown-menu.tsx +51 -8
  42. package/src/realtime/realtime-control.tsx +2 -2
  43. package/styles/index.css +91 -11
  44. package/styles/tokens.css +61 -0
  45. package/dist/chunk-ATSTR5P3.js.map +0 -1
  46. package/dist/chunk-TK7G6XLT.js +0 -18
  47. package/dist/chunk-U6K24XQD.js.map +0 -1
  48. package/dist/chunk-YDNWMKXO.js.map +0 -1
  49. package/dist/chunk-YNYIAYXQ.js.map +0 -1
  50. package/dist/queue-surface-implementation-THPAKGMD.js.map +0 -1
package/dist/machines.js CHANGED
@@ -24,11 +24,11 @@ import {
24
24
  healthPulses,
25
25
  pointsFor,
26
26
  useMachines
27
- } from "./chunk-SXIQK54Z.js";
27
+ } from "./chunk-6EDV6YFE.js";
28
28
  import "./chunk-EB67J347.js";
29
29
  import "./chunk-EKZH6IDG.js";
30
30
  import "./chunk-LAKLF4PA.js";
31
- import "./chunk-TK7G6XLT.js";
31
+ import "./chunk-22KP6LR5.js";
32
32
  export {
33
33
  CONNECTION_STATUS_META,
34
34
  ConnectionDot,
@@ -2,7 +2,10 @@ import {
2
2
  QueueErrorAlert,
3
3
  QueueStoppingStatus,
4
4
  requestQueueDraftEdit
5
- } from "./chunk-YDNWMKXO.js";
5
+ } from "./chunk-VCBFUSUZ.js";
6
+ import {
7
+ usePortalTokenStyle
8
+ } from "./chunk-JB5725BI.js";
6
9
 
7
10
  // src/components/queue-surface-implementation.tsx
8
11
  import {
@@ -54,6 +57,7 @@ function QueueSurface({
54
57
  const [announcement, setAnnouncement] = useState("");
55
58
  const [draggedTurnId, setDraggedTurnId] = useState(null);
56
59
  const surfaceRef = useRef(null);
60
+ const portalTokenStyle = usePortalTokenStyle(surfaceRef);
57
61
  const [keyboardDrag, setKeyboardDrag] = useState(null);
58
62
  const count = queue.queue.length;
59
63
  const pendingInputCount = queue.pendingInputs.length;
@@ -201,7 +205,7 @@ function QueueSurface({
201
205
  "div",
202
206
  {
203
207
  ref: surfaceRef,
204
- className: "mx-auto mb-2 w-full max-w-3xl shrink-0 px-4 sm:px-6",
208
+ className: "og-root mx-auto mb-2 w-full max-w-3xl shrink-0 px-4 sm:px-6",
205
209
  "data-testid": "queue-surface",
206
210
  children: [
207
211
  /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-lg border border-border bg-surface/80 shadow-sm", children: [
@@ -223,17 +227,17 @@ function QueueSurface({
223
227
  className: `size-3.5 shrink-0 text-fg-subtle transition-transform ${open ? "rotate-180" : ""}`
224
228
  }
225
229
  ),
226
- /* @__PURE__ */ jsxs("span", { className: "text-xs font-medium text-fg", children: [
230
+ /* @__PURE__ */ jsxs("span", { className: "text-og-control font-medium text-fg", children: [
227
231
  count > 0 ? `${count} queued prompt${count === 1 ? "" : "s"}` : null,
228
232
  count > 0 && pendingInputCount > 0 ? " \xB7 " : null,
229
233
  pendingInputCount > 0 ? `${pendingInputCount} incoming update${pendingInputCount === 1 ? "" : "s"}` : null
230
234
  ] }),
231
- readOnly ? /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded border border-border px-1.5 py-0.5 text-2xs text-fg-subtle", children: "Read-only" }) : null,
235
+ readOnly ? /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded border border-border px-1.5 py-0.5 text-og-xs text-fg-subtle", children: "Read-only" }) : null,
232
236
  !open && totalCount > 0 ? /* @__PURE__ */ jsx(
233
237
  "span",
234
238
  {
235
239
  "aria-hidden": "true",
236
- className: `max-w-full truncate text-fg-muted ${collapsedPreview.collapsedVisual === collapsedPreview.summary ? "min-w-0 flex-1 text-xs" : "shrink-0 text-[10px]"}`,
240
+ className: `max-w-full truncate text-fg-muted ${collapsedPreview.collapsedVisual === collapsedPreview.summary ? "min-w-0 flex-1 text-og-control" : "shrink-0 text-[10px]"}`,
237
241
  "data-testid": "queue-collapsed-preview",
238
242
  dir: "auto",
239
243
  children: collapsedPreview.collapsedVisual
@@ -293,6 +297,7 @@ function QueueSurface({
293
297
  pending: queue.mutationFor(turn.id),
294
298
  confirmingReplace: replaceDraftFor === turn.id,
295
299
  keyboardDragging: keyboardDrag?.turnId === turn.id,
300
+ portalTokenStyle,
296
301
  onHandleKeyDown: (event) => onHandleKeyDown(event, turn.id),
297
302
  onMove: (nextIndex) => void moveToIndex(turn.id, nextIndex),
298
303
  onEdit: canEditInComposer ? () => requestEdit(turn) : void 0,
@@ -329,7 +334,7 @@ function QueueSurface({
329
334
  /* @__PURE__ */ jsx(DragOverlay, { modifiers: [verticalOnly], children: draggedTurnId ? /* @__PURE__ */ jsx(
330
335
  "div",
331
336
  {
332
- className: "max-h-20 w-[min(36rem,calc(100vw-2rem))] max-w-[calc(100vw-2rem)] overflow-hidden rounded-md border border-brand/40 bg-surface px-3 py-2 text-xs text-fg shadow-lg",
337
+ className: "max-h-20 w-[min(36rem,calc(100vw-2rem))] max-w-[calc(100vw-2rem)] overflow-hidden rounded-md border border-brand/40 bg-surface px-3 py-2 text-og-control text-fg shadow-lg",
333
338
  "data-testid": "queue-drag-overlay",
334
339
  children: /* @__PURE__ */ jsx(
335
340
  "p",
@@ -360,14 +365,22 @@ function PendingMachineInputs({
360
365
  attached = false
361
366
  }) {
362
367
  return /* @__PURE__ */ jsxs("section", { className: "border-t border-border px-3 py-2", children: [
363
- /* @__PURE__ */ jsx("p", { className: "text-2xs font-medium text-fg-subtle", children: attached ? `${inputs.length} update${inputs.length === 1 ? "" : "s"} will join this prompt` : "Incoming updates waiting to run" }),
364
- /* @__PURE__ */ jsx("ol", { className: "mt-1 space-y-1", children: inputs.map((input) => /* @__PURE__ */ jsxs("li", { className: "line-clamp-3 break-words text-xs text-fg", dir: "auto", children: [
365
- /* @__PURE__ */ jsx("strong", { className: "capitalize text-fg-muted", children: input.kind.replace("_terminal", "").replaceAll("_", " ") }),
366
- " ",
367
- "\xB7 ",
368
- input.sourceId,
369
- input.summary ? ` \u2014 ${input.summary}` : ""
370
- ] }, input.id)) })
368
+ /* @__PURE__ */ jsx("p", { className: "text-og-xs font-medium text-fg-subtle", children: attached ? `${inputs.length} update${inputs.length === 1 ? "" : "s"} will join this prompt` : "Incoming updates waiting to run" }),
369
+ /* @__PURE__ */ jsx("ol", { className: "mt-1 space-y-1", children: inputs.map((input) => /* @__PURE__ */ jsxs(
370
+ "li",
371
+ {
372
+ className: "line-clamp-3 break-words text-og-control text-fg",
373
+ dir: "auto",
374
+ children: [
375
+ /* @__PURE__ */ jsx("strong", { className: "capitalize text-fg-muted", children: input.kind.replace("_terminal", "").replaceAll("_", " ") }),
376
+ " ",
377
+ "\xB7 ",
378
+ input.sourceId,
379
+ input.summary ? ` \u2014 ${input.summary}` : ""
380
+ ]
381
+ },
382
+ input.id
383
+ )) })
371
384
  ] });
372
385
  }
373
386
  var QUEUE_ROW_PREVIEW_CHARACTERS = 360;
@@ -584,7 +597,7 @@ function QueuePrompt({
584
597
  "div",
585
598
  {
586
599
  "aria-label": `Queued prompt ${index + 1} summary: ${preview.summary}`,
587
- className: "max-w-full overflow-hidden text-xs leading-5 text-fg",
600
+ className: "max-w-full overflow-hidden text-og-control leading-5 text-fg",
588
601
  "data-testid": `queue-prompt-preview-${index + 1}`,
589
602
  dir: "auto",
590
603
  role: "note",
@@ -601,7 +614,7 @@ function QueuePrompt({
601
614
  preview.visibleIdentity && preview.visibleIdentityLabel ? /* @__PURE__ */ jsxs(
602
615
  "span",
603
616
  {
604
- className: "flex min-w-0 max-w-[70%] shrink-0 items-center gap-1 text-2xs leading-4 text-fg-muted sm:mt-0.5 sm:max-w-full",
617
+ className: "flex min-w-0 max-w-[70%] shrink-0 items-center gap-1 text-og-xs leading-4 text-fg-muted sm:mt-0.5 sm:max-w-full",
605
618
  "data-testid": `queue-prompt-identity-row-${index + 1}`,
606
619
  children: [
607
620
  /* @__PURE__ */ jsx("span", { className: "shrink-0 font-medium text-fg-subtle", children: preview.visibleIdentityLabel }),
@@ -627,7 +640,7 @@ function QueuePrompt({
627
640
  "aria-controls": fullContentId,
628
641
  "aria-expanded": expanded,
629
642
  "aria-label": `${expanded ? "Hide" : "Show"} full content for queued prompt ${index + 1}`,
630
- className: "mt-1 inline-flex min-h-7 min-w-0 max-w-full items-center gap-1 whitespace-normal rounded-md text-left text-2xs font-medium text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/40 pointer-coarse:min-h-[44px]",
643
+ className: "mt-1 inline-flex min-h-7 min-w-0 max-w-full items-center gap-1 whitespace-normal rounded-md text-left text-og-xs font-medium text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/40 pointer-coarse:min-h-[44px]",
631
644
  "data-testid": `queue-prompt-disclosure-${index + 1}`,
632
645
  onClick: () => {
633
646
  const next = !expanded;
@@ -652,7 +665,7 @@ function QueuePrompt({
652
665
  id: fullContentId,
653
666
  role: "region",
654
667
  "aria-label": `Full content for queued prompt ${index + 1}`,
655
- className: "mt-1.5 max-h-64 w-full min-w-0 max-w-full overflow-auto overscroll-contain rounded-md border border-border bg-surface-2/60 p-2 whitespace-pre-wrap break-all font-mono text-xs leading-5 text-fg [unicode-bidi:plaintext]",
668
+ className: "mt-1.5 max-h-64 w-full min-w-0 max-w-full overflow-auto overscroll-contain rounded-md border border-border bg-surface-2/60 p-2 whitespace-pre-wrap break-all font-mono text-og-control leading-5 text-fg [unicode-bidi:plaintext]",
656
669
  "data-testid": `queue-prompt-full-${index + 1}`,
657
670
  dir: "auto",
658
671
  tabIndex: 0,
@@ -668,11 +681,11 @@ function ReadOnlyQueueRow({
668
681
  onDisclosureChange
669
682
  }) {
670
683
  return /* @__PURE__ */ jsxs("li", { className: "flex min-w-0 items-start gap-2 bg-surface px-3 py-2", children: [
671
- /* @__PURE__ */ jsx("span", { className: "mt-1 shrink-0 font-mono text-2xs text-fg-subtle", children: index + 1 }),
684
+ /* @__PURE__ */ jsx("span", { className: "mt-1 shrink-0 font-mono text-og-xs text-fg-subtle", children: index + 1 }),
672
685
  /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
673
686
  /* @__PURE__ */ jsx(QueuePrompt, { prompt: turn.prompt, index, onDisclosureChange }),
674
687
  attachedInputs.length > 0 ? /* @__PURE__ */ jsx(PendingMachineInputs, { inputs: attachedInputs, attached: true }) : null,
675
- /* @__PURE__ */ jsxs("div", { className: "mt-1 flex min-w-0 items-center gap-2 overflow-hidden whitespace-nowrap text-2xs text-fg-subtle", children: [
688
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 flex min-w-0 items-center gap-2 overflow-hidden whitespace-nowrap text-og-xs text-fg-subtle", children: [
676
689
  turn.resources.length > 0 ? /* @__PURE__ */ jsxs("span", { className: "shrink-0", children: [
677
690
  turn.resources.length,
678
691
  " resource",
@@ -697,6 +710,7 @@ function SortableQueueRow({
697
710
  pending,
698
711
  confirmingReplace,
699
712
  keyboardDragging,
713
+ portalTokenStyle,
700
714
  onHandleKeyDown,
701
715
  onMove,
702
716
  onEdit,
@@ -738,11 +752,11 @@ function SortableQueueRow({
738
752
  children: /* @__PURE__ */ jsx(GripVerticalIcon, { className: "size-3.5" })
739
753
  }
740
754
  ),
741
- /* @__PURE__ */ jsx("span", { className: "col-start-2 row-start-1 mt-1 shrink-0 font-mono text-2xs text-fg-subtle", children: index + 1 }),
755
+ /* @__PURE__ */ jsx("span", { className: "col-start-2 row-start-1 mt-1 shrink-0 font-mono text-og-xs text-fg-subtle", children: index + 1 }),
742
756
  /* @__PURE__ */ jsxs("div", { className: "col-span-full row-start-2 min-w-0 sm:col-span-1 sm:col-start-3 sm:row-start-1", children: [
743
757
  /* @__PURE__ */ jsx(QueuePrompt, { prompt: turn.prompt, index, onDisclosureChange }),
744
758
  attachedInputs.length > 0 ? /* @__PURE__ */ jsx(PendingMachineInputs, { inputs: attachedInputs, attached: true }) : null,
745
- /* @__PURE__ */ jsxs("div", { className: "mt-1 flex min-w-0 items-center gap-2 overflow-hidden whitespace-nowrap text-2xs text-fg-subtle", children: [
759
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 flex min-w-0 items-center gap-2 overflow-hidden whitespace-nowrap text-og-xs text-fg-subtle", children: [
746
760
  turn.resources.length > 0 ? /* @__PURE__ */ jsxs("span", { className: "shrink-0", children: [
747
761
  turn.resources.length,
748
762
  " resource",
@@ -766,7 +780,7 @@ function SortableQueueRow({
766
780
  onClick: onSteer,
767
781
  "aria-label": `Steer queued prompt ${index + 1}`,
768
782
  title: "Steer \u2014 interrupt the current turn and send this message now",
769
- className: "inline-flex h-7 shrink-0 items-center justify-center gap-1 rounded-md px-2 text-xs font-medium text-fg outline-none transition-[background-color] hover:bg-surface-2 focus-visible:ring-2 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50 pointer-coarse:min-h-[44px] pointer-coarse:min-w-[44px]",
783
+ className: "inline-flex h-7 shrink-0 items-center justify-center gap-1 rounded-md px-2 text-og-control font-medium text-fg outline-none transition-[background-color] hover:bg-surface-2 focus-visible:ring-2 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50 pointer-coarse:min-h-[44px] pointer-coarse:min-w-[44px]",
770
784
  children: [
771
785
  pending === "steer" ? /* @__PURE__ */ jsx(Loader2Icon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx(ZapIcon, { className: "size-3.5" }),
772
786
  /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: "Steer" })
@@ -801,7 +815,8 @@ function SortableQueueRow({
801
815
  {
802
816
  align: "end",
803
817
  sideOffset: 4,
804
- className: "z-50 w-48 max-w-[calc(100vw-16px)] rounded-md border border-border bg-surface p-1 text-xs text-fg shadow-lg",
818
+ className: "og-root z-50 w-48 max-w-[calc(100vw-16px)] rounded-md border border-border bg-surface p-1 text-og-control text-fg shadow-lg",
819
+ style: portalTokenStyle,
805
820
  "data-testid": `queue-actions-menu-${index + 1}`,
806
821
  children: [
807
822
  onEdit ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -866,7 +881,7 @@ function SortableQueueRow({
866
881
  ] })
867
882
  ] })
868
883
  ] }),
869
- confirmingReplace ? /* @__PURE__ */ jsxs("div", { className: "mx-3 mb-2 rounded-md border border-status-waiting/30 bg-status-waiting/10 p-2 text-xs text-fg", children: [
884
+ confirmingReplace ? /* @__PURE__ */ jsxs("div", { className: "mx-3 mb-2 rounded-md border border-status-waiting/30 bg-status-waiting/10 p-2 text-og-control text-fg", children: [
870
885
  /* @__PURE__ */ jsx("p", { children: "Your composer already has a draft. Replace it with this queued prompt?" }),
871
886
  /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-fg-muted", children: "The current draft will be permanently discarded; this queued prompt is preserved until you confirm." }),
872
887
  /* @__PURE__ */ jsxs("div", { className: "mt-2 flex justify-end gap-1.5", children: [
@@ -919,4 +934,4 @@ export {
919
934
  QueueSurface,
920
935
  queueComposerCheckoutEnabled
921
936
  };
922
- //# sourceMappingURL=queue-surface-implementation-THPAKGMD.js.map
937
+ //# sourceMappingURL=queue-surface-implementation-J4XJFKRW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/queue-surface-implementation.tsx"],"sourcesContent":["import {\n DndContext,\n DragOverlay,\n PointerSensor,\n closestCenter,\n useSensor,\n useSensors,\n type DragEndEvent,\n type DragStartEvent,\n type Modifier,\n} from \"@dnd-kit/core\";\nimport {\n SortableContext,\n arrayMove,\n useSortable,\n verticalListSortingStrategy,\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\nimport type { SessionPendingInputPreview, SessionTurn } from \"@opengeni/sdk\";\nimport {\n ArrowDownToLineIcon,\n ArrowUpToLineIcon,\n ChevronDownIcon,\n EllipsisIcon,\n GripVerticalIcon,\n Loader2Icon,\n PencilIcon,\n Trash2Icon,\n ZapIcon,\n} from \"lucide-react\";\nimport {\n useCallback,\n useId,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent as ReactKeyboardEvent,\n} from \"react\";\n\nimport { DropdownMenu } from \"radix-ui\";\nimport type { ComposerState } from \"../hooks/use-composer\";\nimport type { QueueMutationKind, UseTurnQueueResult } from \"../hooks/use-turn-queue\";\nimport { type PortalTokenStyle, usePortalTokenStyle } from \"../lib/use-portal-token-style\";\nimport { requestQueueDraftEdit } from \"./queue-draft-policy\";\nimport { QueueErrorAlert, QueueStoppingStatus } from \"./queue-surface-state\";\n\n/** The sole pending-input surface: compact above Goal, Agents, and composer. */\ntype QueueSurfaceCommonProps = {\n /** Focus the composer owned by this queue after checkout/removal. */\n onRequestComposerFocus?: (() => void) | undefined;\n};\n\nexport type QueueSurfaceProps =\n | (QueueSurfaceCommonProps & {\n queue: UseTurnQueueResult;\n composer: ComposerState;\n readOnly?: false | undefined;\n })\n | (QueueSurfaceCommonProps & {\n queue: UseTurnQueueResult;\n composer?: undefined;\n readOnly: true;\n });\n\n/** @internal Pure policy seam for queue/composer embedding tests. */\nexport function queueComposerCheckoutEnabled(\n composer: ComposerState | undefined,\n readOnly: boolean,\n): boolean {\n return !readOnly && composer !== undefined && composer.draftPersistence !== \"disabled\";\n}\n\nexport function QueueSurface({\n queue,\n composer,\n readOnly = false,\n onRequestComposerFocus,\n}: QueueSurfaceProps) {\n const [open, setOpen] = useState(false);\n const [replaceDraftFor, setReplaceDraftFor] = useState<string | null>(null);\n const [announcement, setAnnouncement] = useState(\"\");\n const [draggedTurnId, setDraggedTurnId] = useState<string | null>(null);\n const surfaceRef = useRef<HTMLDivElement | null>(null);\n const portalTokenStyle = usePortalTokenStyle(surfaceRef);\n const [keyboardDrag, setKeyboardDrag] = useState<{\n turnId: string;\n projectedIndex: number;\n } | null>(null);\n const count = queue.queue.length;\n const pendingInputCount = queue.pendingInputs.length;\n const totalCount = count + pendingInputCount;\n const attachedInputIds = queue.pendingInputAttachment?.inputIds ?? [];\n const attachedInputs = queue.pendingInputs.filter((input) => attachedInputIds.includes(input.id));\n const standaloneInputs = queue.pendingInputs.filter(\n (input) => !attachedInputIds.includes(input.id),\n );\n const canEditInComposer = queueComposerCheckoutEnabled(composer, readOnly);\n const collapsedPreview = useMemo(\n () =>\n queuePromptPreview(\n queue.queue[0]?.prompt ?? queue.pendingInputs[0]?.summary ?? \"\",\n QUEUE_COLLAPSED_PREVIEW_CHARACTERS,\n ),\n [queue.pendingInputs, queue.queue],\n );\n const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }));\n\n const displayedQueue = useMemo(() => {\n if (!keyboardDrag) return queue.queue;\n const oldIndex = queue.queue.findIndex((turn) => turn.id === keyboardDrag.turnId);\n if (oldIndex < 0) return queue.queue;\n return arrayMove(queue.queue, oldIndex, keyboardDrag.projectedIndex);\n }, [keyboardDrag, queue.queue]);\n\n const ids = useMemo(() => displayedQueue.map((turn) => turn.id), [displayedQueue]);\n const moveToIndex = useCallback(\n async (turnId: string, nextIndex: number): Promise<void> => {\n const oldIndex = queue.queue.findIndex((turn) => turn.id === turnId);\n if (oldIndex < 0) return;\n const boundedIndex = Math.max(0, Math.min(nextIndex, queue.queue.length - 1));\n if (oldIndex === boundedIndex) return;\n const ordered = arrayMove(queue.queue, oldIndex, boundedIndex);\n const beforeTurnId = ordered[boundedIndex + 1]?.id ?? null;\n const moved = await queue.moveTurn(turnId, beforeTurnId);\n setAnnouncement(\n moved\n ? `Queued prompt moved to position ${boundedIndex + 1}.`\n : \"The queue changed before that prompt could be moved. Refreshed server order.\",\n );\n if (moved) focusQueueTurn(surfaceRef.current, turnId);\n },\n [queue],\n );\n\n const onDragEnd = useCallback(\n (event: DragEndEvent) => {\n setDraggedTurnId(null);\n const activeId = String(event.active.id);\n const overId = event.over ? String(event.over.id) : null;\n if (!overId || activeId === overId) {\n setAnnouncement(\"Queued prompt returned to its original position.\");\n return;\n }\n const nextIndex = queue.queue.findIndex((turn) => turn.id === overId);\n if (nextIndex >= 0) void moveToIndex(activeId, nextIndex);\n },\n [moveToIndex, queue.queue],\n );\n\n const onDragStart = useCallback(\n (event: DragStartEvent) => {\n setKeyboardDrag(null);\n const turnId = String(event.active.id);\n const position = queue.queue.findIndex((turn) => turn.id === turnId) + 1;\n setDraggedTurnId(turnId);\n setAnnouncement(`Dragging queued prompt ${position} of ${queue.queue.length}.`);\n },\n [queue.queue],\n );\n\n const onHandleKeyDown = useCallback(\n (event: ReactKeyboardEvent<HTMLButtonElement>, turnId: string) => {\n const canonicalIndex = queue.queue.findIndex((turn) => turn.id === turnId);\n if (canonicalIndex < 0) return;\n\n if (!keyboardDrag) {\n if (event.key !== \" \") return;\n event.preventDefault();\n setKeyboardDrag({ turnId, projectedIndex: canonicalIndex });\n setAnnouncement(\n `Lifted queued prompt ${canonicalIndex + 1} of ${count}. Use arrow keys to move it, then press Space to drop.`,\n );\n return;\n }\n if (keyboardDrag.turnId !== turnId) return;\n\n if (event.key === \"Escape\") {\n event.preventDefault();\n setKeyboardDrag(null);\n setAnnouncement(\"Queue reorder cancelled.\");\n return;\n }\n if (event.key === \" \") {\n event.preventDefault();\n const targetIndex = keyboardDrag.projectedIndex;\n setAnnouncement(`Moving queued prompt to position ${targetIndex + 1}.`);\n void moveToIndex(turnId, targetIndex).finally(() => setKeyboardDrag(null));\n return;\n }\n\n const direction = event.key === \"ArrowUp\" ? -1 : event.key === \"ArrowDown\" ? 1 : 0;\n const edge = event.key === \"Home\" ? 0 : event.key === \"End\" ? count - 1 : null;\n if (direction === 0 && edge === null) return;\n event.preventDefault();\n const projectedIndex = Math.max(\n 0,\n Math.min(edge ?? keyboardDrag.projectedIndex + direction, count - 1),\n );\n setKeyboardDrag({ turnId, projectedIndex });\n setAnnouncement(`Queued prompt projected to position ${projectedIndex + 1} of ${count}.`);\n },\n [count, keyboardDrag, moveToIndex, queue.queue],\n );\n\n const edit = useCallback(\n async (turn: SessionTurn, replaceDraft: boolean) => {\n if (!composer || !canEditInComposer) return;\n const restored = await queue.editTurn(turn.id, {\n expectedDraftRevision: composer.draftRevision,\n replaceDraft,\n });\n if (!restored) return;\n composer.applyDraft(restored);\n setReplaceDraftFor(null);\n setAnnouncement(\"Queued prompt moved back to the composer for editing.\");\n window.requestAnimationFrame(() => {\n if (onRequestComposerFocus) {\n onRequestComposerFocus();\n return;\n }\n const input = document.querySelector<HTMLTextAreaElement>(\n 'textarea[aria-label=\"Message the agent\"]',\n );\n input?.scrollIntoView({ block: \"nearest\", behavior: \"smooth\" });\n input?.focus();\n });\n },\n [canEditInComposer, composer, onRequestComposerFocus, queue],\n );\n\n const requestEdit = useCallback(\n (turn: SessionTurn) => {\n if (!composer || !canEditInComposer) return;\n requestQueueDraftEdit(\n composer,\n () => setReplaceDraftFor(turn.id),\n () => void edit(turn, false),\n );\n },\n [canEditInComposer, composer, edit],\n );\n\n if (totalCount === 0 && !queue.stoppingPreviousAttempt && !queue.error && !queue.mutationError)\n return null;\n\n return (\n <div\n ref={surfaceRef}\n className=\"og-root mx-auto mb-2 w-full max-w-3xl shrink-0 px-4 sm:px-6\"\n data-testid=\"queue-surface\"\n >\n <div className=\"overflow-hidden rounded-lg border border-border bg-surface/80 shadow-sm\">\n {queue.stoppingPreviousAttempt ? <QueueStoppingStatus queue={queue} dividerAfter /> : null}\n <button\n type=\"button\"\n className=\"flex w-full min-w-0 flex-wrap items-center gap-2 px-3 py-2 text-left outline-none transition-colors hover:bg-surface-2/60 focus-visible:bg-surface-2/60 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40 pointer-coarse:min-h-[44px]\"\n onClick={() => setOpen((value) => !value)}\n aria-description={!open && totalCount > 0 ? collapsedPreview.summary : undefined}\n aria-expanded={open}\n aria-label={`${count} queued prompt${count === 1 ? \"\" : \"s\"}${\n pendingInputCount > 0\n ? ` and ${pendingInputCount} pending machine input${pendingInputCount === 1 ? \"\" : \"s\"}`\n : \"\"\n }${readOnly ? \" Read-only\" : \"\"}`}\n >\n <ChevronDownIcon\n aria-hidden=\"true\"\n className={`size-3.5 shrink-0 text-fg-subtle transition-transform ${open ? \"rotate-180\" : \"\"}`}\n />\n <span className=\"text-og-control font-medium text-fg\">\n {count > 0 ? `${count} queued prompt${count === 1 ? \"\" : \"s\"}` : null}\n {count > 0 && pendingInputCount > 0 ? \" · \" : null}\n {pendingInputCount > 0\n ? `${pendingInputCount} incoming update${pendingInputCount === 1 ? \"\" : \"s\"}`\n : null}\n </span>\n {readOnly ? (\n <span className=\"shrink-0 rounded border border-border px-1.5 py-0.5 text-og-xs text-fg-subtle\">\n Read-only\n </span>\n ) : null}\n {!open && totalCount > 0 ? (\n <span\n aria-hidden=\"true\"\n className={`max-w-full truncate text-fg-muted ${\n collapsedPreview.collapsedVisual === collapsedPreview.summary\n ? \"min-w-0 flex-1 text-og-control\"\n : \"shrink-0 text-[10px]\"\n }`}\n data-testid=\"queue-collapsed-preview\"\n dir=\"auto\"\n >\n {collapsedPreview.collapsedVisual}\n </span>\n ) : null}\n {queue.loading ? <Loader2Icon className=\"ml-auto size-3.5 animate-spin\" /> : null}\n </button>\n\n {open && standaloneInputs.length > 0 ? (\n <PendingMachineInputs inputs={standaloneInputs} />\n ) : null}\n\n {open && count > 0 && readOnly ? (\n <ol\n className=\"max-h-[min(30rem,60dvh)] divide-y divide-border overflow-y-auto overscroll-contain border-t border-border\"\n aria-label=\"Queued prompts\"\n data-testid=\"queue-list\"\n >\n {queue.queue.map((turn, index) => (\n <ReadOnlyQueueRow\n key={turn.id}\n turn={turn}\n index={index}\n attachedInputs={\n turn.id === queue.pendingInputAttachment?.turnId ? attachedInputs : []\n }\n onDisclosureChange={(expanded) =>\n setAnnouncement(\n `Full content for queued prompt ${index + 1} ${expanded ? \"shown\" : \"hidden\"}.`,\n )\n }\n />\n ))}\n </ol>\n ) : null}\n\n {open && count > 0 && !readOnly ? (\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n modifiers={[verticalOnly]}\n onDragStart={onDragStart}\n onDragCancel={() => {\n setDraggedTurnId(null);\n setAnnouncement(\"Queue reorder cancelled.\");\n }}\n onDragEnd={onDragEnd}\n >\n <SortableContext items={ids} strategy={verticalListSortingStrategy}>\n <ol\n className=\"max-h-[min(30rem,60dvh)] divide-y divide-border overflow-y-auto overscroll-contain border-t border-border\"\n aria-label=\"Queued prompts\"\n data-testid=\"queue-list\"\n >\n {displayedQueue.map((turn, index) => (\n <SortableQueueRow\n key={turn.id}\n turn={turn}\n index={index}\n count={count}\n attachedInputs={\n turn.id === queue.pendingInputAttachment?.turnId ? attachedInputs : []\n }\n pending={queue.mutationFor(turn.id)}\n confirmingReplace={replaceDraftFor === turn.id}\n keyboardDragging={keyboardDrag?.turnId === turn.id}\n portalTokenStyle={portalTokenStyle}\n onHandleKeyDown={(event) => onHandleKeyDown(event, turn.id)}\n onMove={(nextIndex) => void moveToIndex(turn.id, nextIndex)}\n onEdit={canEditInComposer ? () => requestEdit(turn) : undefined}\n onConfirmReplace={() => void edit(turn, true)}\n onCancelReplace={() => setReplaceDraftFor(null)}\n onSteer={() => {\n void queue.steerTurn(turn.id).then((steered) => {\n setAnnouncement(\n steered\n ? \"Queued prompt is now the next direction.\"\n : \"That prompt changed before it could be steered.\",\n );\n if (steered) {\n focusAfterQueueRemoval(surfaceRef.current, index, onRequestComposerFocus);\n }\n });\n }}\n onDelete={() => {\n void queue.removeTurn(turn.id).then((removed) => {\n setAnnouncement(\n removed\n ? \"Queued prompt deleted.\"\n : \"That prompt changed before it could be deleted.\",\n );\n if (removed) {\n focusAfterQueueRemoval(surfaceRef.current, index, onRequestComposerFocus);\n }\n });\n }}\n onDisclosureChange={(expanded) =>\n setAnnouncement(\n `Full content for queued prompt ${index + 1} ${expanded ? \"shown\" : \"hidden\"}.`,\n )\n }\n />\n ))}\n </ol>\n </SortableContext>\n <DragOverlay modifiers={[verticalOnly]}>\n {draggedTurnId ? (\n <div\n className=\"max-h-20 w-[min(36rem,calc(100vw-2rem))] max-w-[calc(100vw-2rem)] overflow-hidden rounded-md border border-brand/40 bg-surface px-3 py-2 text-og-control text-fg shadow-lg\"\n data-testid=\"queue-drag-overlay\"\n >\n <p\n aria-hidden=\"true\"\n className=\"line-clamp-3 break-all whitespace-pre-wrap [unicode-bidi:plaintext]\"\n dir=\"auto\"\n >\n {\n queuePromptPreview(\n queue.queue.find((turn) => turn.id === draggedTurnId)?.prompt ?? \"\",\n QUEUE_ROW_PREVIEW_CHARACTERS,\n ).summary\n }\n </p>\n </div>\n ) : null}\n </DragOverlay>\n </DndContext>\n ) : null}\n\n {queue.error || queue.mutationError ? (\n <QueueErrorAlert queue={queue} dividerBefore />\n ) : null}\n </div>\n <p className=\"sr-only\" aria-live=\"polite\" aria-atomic=\"true\">\n {announcement}\n </p>\n </div>\n );\n}\n\nfunction PendingMachineInputs({\n inputs,\n attached = false,\n}: {\n inputs: SessionPendingInputPreview[];\n attached?: boolean;\n}) {\n return (\n <section className=\"border-t border-border px-3 py-2\">\n <p className=\"text-og-xs font-medium text-fg-subtle\">\n {attached\n ? `${inputs.length} update${inputs.length === 1 ? \"\" : \"s\"} will join this prompt`\n : \"Incoming updates waiting to run\"}\n </p>\n <ol className=\"mt-1 space-y-1\">\n {inputs.map((input) => (\n <li\n key={input.id}\n className=\"line-clamp-3 break-words text-og-control text-fg\"\n dir=\"auto\"\n >\n <strong className=\"capitalize text-fg-muted\">\n {input.kind.replace(\"_terminal\", \"\").replaceAll(\"_\", \" \")}\n </strong>{\" \"}\n · {input.sourceId}\n {input.summary ? ` — ${input.summary}` : \"\"}\n </li>\n ))}\n </ol>\n </section>\n );\n}\n\nconst QUEUE_ROW_PREVIEW_CHARACTERS = 360;\nconst QUEUE_COLLAPSED_PREVIEW_CHARACTERS = 180;\nconst QUEUE_PREVIEW_GRAPHEME_CONTEXT_CHARACTERS = 32;\nconst QUEUE_PREVIEW_REFERENCE_SAMPLE_CHARACTERS = 32;\nconst QUEUE_VISIBLE_END_IDENTITY_CHARACTERS = 18;\nconst QUEUE_PREVIEW_SEPARATOR = \" … \";\nconst queuePreviewSegmenter = new Intl.Segmenter(undefined, { granularity: \"grapheme\" });\nconst queuePromptNonRenderingCodePoint =\n /[\\p{White_Space}\\p{Control}\\p{Default_Ignorable_Code_Point}]/u;\n\ntype BoundedPromptSample = {\n value: string;\n characters: number;\n truncated: boolean;\n};\n\ntype QueuePromptPreview = {\n summary: string;\n collapsedVisual: string;\n visibleStart: string;\n visibleIdentity: string | null;\n visibleIdentityLabel: \"End\" | \"Safe boundary\" | null;\n isFallback: boolean;\n};\n\n/**\n * Build a bounded head/tail summary of an arbitrary queued prompt. Sampling\n * both ends distinguishes prompts with equal long prefixes. Each sampled edge\n * has a small amount of grapheme context so ordinary emoji/combining sequences\n * can be retained whole. A cluster that exceeds that context is omitted rather\n * than fragmented, and malformed UTF-16 is replaced only in the summary. The\n * durable prompt remains exact and no operation scans or copies it in full.\n */\nfunction queuePromptPreview(prompt: string, maxCharacters: number): QueuePromptPreview {\n const wholePromptProbe = samplePromptStart(prompt, maxCharacters + 1);\n if (!wholePromptProbe.truncated && wholePromptProbe.characters <= maxCharacters) {\n const summary = replaceLoneSurrogates(wholePromptProbe.value);\n return hasVisiblePromptContent(summary)\n ? {\n summary,\n collapsedVisual: summary,\n visibleStart: summary,\n visibleIdentity: null,\n visibleIdentityLabel: null,\n isFallback: false,\n }\n : fallbackPromptPreview(prompt.length, wholePromptProbe.value, wholePromptProbe.value);\n }\n\n const suffixCharacters = Math.min(Math.floor(maxCharacters / 3), 120);\n const prefixCharacters =\n maxCharacters - codePointLength(QUEUE_PREVIEW_SEPARATOR) - suffixCharacters;\n const prefixSample = samplePromptStart(\n prompt,\n prefixCharacters + QUEUE_PREVIEW_GRAPHEME_CONTEXT_CHARACTERS,\n );\n const suffixSample = samplePromptEnd(\n prompt,\n suffixCharacters + QUEUE_PREVIEW_GRAPHEME_CONTEXT_CHARACTERS,\n );\n const prefixSegments = segmentPromptSample(prefixSample.value);\n const suffixSegments = segmentPromptSample(suffixSample.value);\n\n // A cluster at a truncated sampling edge may continue outside the sample.\n // Prefix sampling starts at the true source start, so only its last segment\n // is ambiguous. Suffix sampling ends at the true source end, so its first is.\n if (prefixSample.truncated) prefixSegments.pop();\n if (suffixSample.truncated) {\n let ambiguousSegment = suffixSegments.shift();\n // A locally segmented leading fragment ending in ZWJ can join the next\n // pictographic segment when omitted left context supplies its base. Keep\n // backing off until that uncertainty no longer propagates to the right.\n while (ambiguousSegment?.endsWith(\"\\u200d\") && suffixSegments.length > 0) {\n ambiguousSegment = suffixSegments.shift();\n }\n // Regional Indicator pairing depends on the parity of the preceding run.\n // If that run reaches the unknown sample boundary, omit all of its visible\n // leading segments rather than potentially recombining halves of flags.\n while (suffixSegments[0] && startsWithRegionalIndicator(suffixSegments[0])) {\n suffixSegments.shift();\n }\n }\n\n const prefix = takeWholeGraphemesFromStart(prefixSegments, prefixCharacters);\n const suffix = takeWholeGraphemesFromEnd(suffixSegments, suffixCharacters);\n const reference = boundedPromptSampleReference(\n prompt.length,\n prefixSample.value,\n suffixSample.value,\n );\n\n if (!hasVisiblePromptContent(prefix) && !hasVisiblePromptContent(suffix)) {\n return fallbackPromptPreview(prompt.length, prefixSample.value, suffixSample.value);\n }\n\n const safeSuffix = hasVisiblePromptContent(suffix)\n ? suffix\n : promptPreviewFallbackLabel(reference);\n const summary = `${prefix}${QUEUE_PREVIEW_SEPARATOR}${safeSuffix}`;\n if (!hasVisiblePromptContent(prefix)) {\n return {\n summary,\n collapsedVisual: summary,\n visibleStart: safeSuffix,\n visibleIdentity: null,\n visibleIdentityLabel: null,\n isFallback: false,\n };\n }\n\n const endIdentity = takeWholeGraphemesFromEnd(\n suffixSegments,\n QUEUE_VISIBLE_END_IDENTITY_CHARACTERS,\n );\n return {\n summary,\n collapsedVisual: summary,\n visibleStart: prefix,\n visibleIdentity: hasVisiblePromptContent(endIdentity) ? endIdentity : `ref ${reference}`,\n visibleIdentityLabel: hasVisiblePromptContent(endIdentity) ? \"End\" : \"Safe boundary\",\n isFallback: false,\n };\n}\n\nfunction fallbackPromptPreview(\n promptLength: number,\n startSample: string,\n endSample: string,\n): QueuePromptPreview {\n const reference = boundedPromptSampleReference(promptLength, startSample, endSample);\n const summary = promptPreviewFallbackLabel(reference);\n return {\n summary,\n collapsedVisual: `Omitted · ${reference}`,\n // The complete fallback remains the canonical accessible summary. Narrow\n // collapsed/row layouts paint the bounded reference in a compact truthful\n // form so ellipsis cannot hide the only identifying portion.\n visibleStart: `Omitted · ${reference}`,\n visibleIdentity: null,\n visibleIdentityLabel: null,\n isFallback: true,\n };\n}\n\nfunction promptPreviewFallbackLabel(reference: string): string {\n return `Content omitted at safe boundary · ref ${reference}`;\n}\n\nfunction boundedPromptSampleReference(\n promptLength: number,\n startSample: string,\n endSample: string,\n): string {\n const head = samplePromptStart(startSample, QUEUE_PREVIEW_REFERENCE_SAMPLE_CHARACTERS).value;\n const tail = samplePromptEnd(endSample, QUEUE_PREVIEW_REFERENCE_SAMPLE_CHARACTERS).value;\n let hash = 0x811c9dc5;\n for (const value of [String(promptLength), head, tail]) {\n for (let index = 0; index < value.length; index += 1) {\n hash ^= value.charCodeAt(index);\n hash = Math.imul(hash, 0x01000193);\n }\n hash ^= 0xffff;\n hash = Math.imul(hash, 0x01000193);\n }\n return (hash >>> 0).toString(16).padStart(8, \"0\").toUpperCase();\n}\n\nfunction hasVisiblePromptContent(value: string): boolean {\n // Callers pass only the already-bounded whole/head/tail preview samples.\n // Default-ignorables and controls can survive trim() while painting no row\n // identity at all (for example ZWJ, VS16, bidi controls, and tag characters).\n for (const character of value) {\n if (!queuePromptNonRenderingCodePoint.test(character)) return true;\n }\n return false;\n}\n\nfunction samplePromptStart(prompt: string, maxCharacters: number): BoundedPromptSample {\n let end = 0;\n let characters = 0;\n while (end < prompt.length && characters < maxCharacters) {\n const first = prompt.charCodeAt(end);\n end +=\n isHighSurrogate(first) &&\n end + 1 < prompt.length &&\n isLowSurrogate(prompt.charCodeAt(end + 1))\n ? 2\n : 1;\n characters += 1;\n }\n return { value: prompt.slice(0, end), characters, truncated: end < prompt.length };\n}\n\nfunction samplePromptEnd(prompt: string, maxCharacters: number): BoundedPromptSample {\n let start = prompt.length;\n let characters = 0;\n while (start > 0 && characters < maxCharacters) {\n start -= 1;\n if (\n isLowSurrogate(prompt.charCodeAt(start)) &&\n start > 0 &&\n isHighSurrogate(prompt.charCodeAt(start - 1))\n ) {\n start -= 1;\n }\n characters += 1;\n }\n return { value: prompt.slice(start), characters, truncated: start > 0 };\n}\n\nfunction segmentPromptSample(sample: string): string[] {\n return Array.from(\n queuePreviewSegmenter.segment(replaceLoneSurrogates(sample)),\n ({ segment }) => segment,\n );\n}\n\nfunction replaceLoneSurrogates(value: string): string {\n let sanitized = \"\";\n for (let index = 0; index < value.length; index += 1) {\n const current = value.charCodeAt(index);\n if (\n isHighSurrogate(current) &&\n index + 1 < value.length &&\n isLowSurrogate(value.charCodeAt(index + 1))\n ) {\n sanitized += value.slice(index, index + 2);\n index += 1;\n } else if (isHighSurrogate(current) || isLowSurrogate(current)) {\n sanitized += \"�\";\n } else {\n sanitized += value[index];\n }\n }\n return sanitized;\n}\n\nfunction takeWholeGraphemesFromStart(segments: string[], maxCharacters: number): string {\n const selected: string[] = [];\n let characters = 0;\n for (const segment of segments) {\n const segmentCharacters = codePointLength(segment);\n if (characters + segmentCharacters > maxCharacters) break;\n selected.push(segment);\n characters += segmentCharacters;\n }\n while (selected.at(-1)?.trim().length === 0) selected.pop();\n return selected.join(\"\");\n}\n\nfunction takeWholeGraphemesFromEnd(segments: string[], maxCharacters: number): string {\n const selected: string[] = [];\n let characters = 0;\n for (let index = segments.length - 1; index >= 0; index -= 1) {\n const segment = segments[index];\n if (!segment) continue;\n const segmentCharacters = codePointLength(segment);\n if (characters + segmentCharacters > maxCharacters) break;\n selected.unshift(segment);\n characters += segmentCharacters;\n }\n while (selected[0]?.trim().length === 0) selected.shift();\n while (selected.at(-1)?.trim().length === 0) selected.pop();\n return selected.join(\"\");\n}\n\nfunction codePointLength(value: string): number {\n let characters = 0;\n for (const _character of value) characters += 1;\n return characters;\n}\n\nfunction startsWithRegionalIndicator(value: string): boolean {\n const codePoint = value.codePointAt(0);\n return codePoint !== undefined && codePoint >= 0x1f1e6 && codePoint <= 0x1f1ff;\n}\n\nfunction isHighSurrogate(codeUnit: number): boolean {\n return codeUnit >= 0xd800 && codeUnit <= 0xdbff;\n}\n\nfunction isLowSurrogate(codeUnit: number): boolean {\n return codeUnit >= 0xdc00 && codeUnit <= 0xdfff;\n}\n\nfunction QueuePrompt({\n prompt,\n index,\n onDisclosureChange,\n}: {\n prompt: string;\n index: number;\n onDisclosureChange: (expanded: boolean) => void;\n}) {\n const [expanded, setExpanded] = useState(false);\n const fullContentId = useId();\n const preview = useMemo(() => queuePromptPreview(prompt, QUEUE_ROW_PREVIEW_CHARACTERS), [prompt]);\n\n return (\n <div className=\"w-full min-w-0 max-w-full\">\n <div\n aria-label={`Queued prompt ${index + 1} summary: ${preview.summary}`}\n className=\"max-w-full overflow-hidden text-og-control leading-5 text-fg\"\n data-testid={`queue-prompt-preview-${index + 1}`}\n dir=\"auto\"\n role=\"note\"\n >\n <span aria-hidden=\"true\" className=\"flex min-w-0 max-w-full items-baseline gap-2 sm:block\">\n <span\n className={`${preview.isFallback ? \"\" : \"line-clamp-1 sm:line-clamp-2\"} min-w-0 flex-1 whitespace-pre-wrap break-all [unicode-bidi:plaintext]`}\n data-testid={`queue-prompt-start-${index + 1}`}\n dir=\"auto\"\n >\n {preview.visibleStart}\n </span>\n {preview.visibleIdentity && preview.visibleIdentityLabel ? (\n <span\n className=\"flex min-w-0 max-w-[70%] shrink-0 items-center gap-1 text-og-xs leading-4 text-fg-muted sm:mt-0.5 sm:max-w-full\"\n data-testid={`queue-prompt-identity-row-${index + 1}`}\n >\n <span className=\"shrink-0 font-medium text-fg-subtle\">\n {preview.visibleIdentityLabel}\n </span>\n <span\n className=\"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-mono [unicode-bidi:plaintext]\"\n data-testid={`queue-prompt-identity-${index + 1}`}\n dir=\"auto\"\n >\n {preview.visibleIdentity}\n </span>\n </span>\n ) : null}\n </span>\n </div>\n <button\n type=\"button\"\n aria-controls={fullContentId}\n aria-expanded={expanded}\n aria-label={`${expanded ? \"Hide\" : \"Show\"} full content for queued prompt ${index + 1}`}\n className=\"mt-1 inline-flex min-h-7 min-w-0 max-w-full items-center gap-1 whitespace-normal rounded-md text-left text-og-xs font-medium text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/40 pointer-coarse:min-h-[44px]\"\n data-testid={`queue-prompt-disclosure-${index + 1}`}\n onClick={() => {\n const next = !expanded;\n setExpanded(next);\n onDisclosureChange(next);\n }}\n >\n <ChevronDownIcon\n aria-hidden=\"true\"\n className={`size-3 shrink-0 transition-transform ${expanded ? \"rotate-180\" : \"\"}`}\n />\n {expanded ? \"Hide full prompt\" : \"View full prompt\"}\n </button>\n {expanded ? (\n <pre\n id={fullContentId}\n role=\"region\"\n aria-label={`Full content for queued prompt ${index + 1}`}\n className=\"mt-1.5 max-h-64 w-full min-w-0 max-w-full overflow-auto overscroll-contain rounded-md border border-border bg-surface-2/60 p-2 whitespace-pre-wrap break-all font-mono text-og-control leading-5 text-fg [unicode-bidi:plaintext]\"\n data-testid={`queue-prompt-full-${index + 1}`}\n dir=\"auto\"\n tabIndex={0}\n >\n {prompt}\n </pre>\n ) : null}\n </div>\n );\n}\n\nfunction ReadOnlyQueueRow({\n turn,\n index,\n attachedInputs,\n onDisclosureChange,\n}: {\n turn: SessionTurn;\n index: number;\n attachedInputs: SessionPendingInputPreview[];\n onDisclosureChange: (expanded: boolean) => void;\n}) {\n return (\n <li className=\"flex min-w-0 items-start gap-2 bg-surface px-3 py-2\">\n <span className=\"mt-1 shrink-0 font-mono text-og-xs text-fg-subtle\">{index + 1}</span>\n <div className=\"min-w-0 flex-1\">\n <QueuePrompt prompt={turn.prompt} index={index} onDisclosureChange={onDisclosureChange} />\n {attachedInputs.length > 0 ? (\n <PendingMachineInputs inputs={attachedInputs} attached />\n ) : null}\n <div className=\"mt-1 flex min-w-0 items-center gap-2 overflow-hidden whitespace-nowrap text-og-xs text-fg-subtle\">\n {turn.resources.length > 0 ? (\n <span className=\"shrink-0\">\n {turn.resources.length} resource{turn.resources.length === 1 ? \"\" : \"s\"}\n </span>\n ) : null}\n {turn.tools.length > 0 ? (\n <span className=\"shrink-0\">\n {turn.tools.length} tool{turn.tools.length === 1 ? \"\" : \"s\"}\n </span>\n ) : null}\n <span className=\"min-w-0 truncate\">{turn.model}</span>\n <span className=\"shrink-0\">{turn.reasoningEffort}</span>\n </div>\n </div>\n </li>\n );\n}\n\nfunction SortableQueueRow({\n turn,\n index,\n count,\n attachedInputs,\n pending,\n confirmingReplace,\n keyboardDragging,\n portalTokenStyle,\n onHandleKeyDown,\n onMove,\n onEdit,\n onConfirmReplace,\n onCancelReplace,\n onSteer,\n onDelete,\n onDisclosureChange,\n}: {\n turn: SessionTurn;\n index: number;\n count: number;\n attachedInputs: SessionPendingInputPreview[];\n pending: QueueMutationKind | null;\n confirmingReplace: boolean;\n keyboardDragging: boolean;\n portalTokenStyle: PortalTokenStyle;\n onHandleKeyDown: (event: ReactKeyboardEvent<HTMLButtonElement>) => void;\n onMove: (index: number) => void;\n onEdit?: (() => void) | undefined;\n onConfirmReplace: () => void;\n onCancelReplace: () => void;\n onSteer: () => void;\n onDelete: () => void;\n onDisclosureChange: (expanded: boolean) => void;\n}) {\n const sortable = useSortable({\n id: turn.id,\n disabled: pending !== null || keyboardDragging,\n });\n return (\n <li\n data-queue-turn-id={turn.id}\n ref={sortable.setNodeRef}\n style={{\n transform: CSS.Transform.toString(sortable.transform),\n transition: sortable.transition,\n }}\n className={`bg-surface ${sortable.isDragging || keyboardDragging ? \"relative z-10 shadow-lg ring-1 ring-brand/40\" : \"\"}`}\n >\n <div className=\"grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-start gap-x-1.5 px-2 py-1.5 sm:grid-cols-[auto_auto_minmax(0,1fr)_auto] sm:gap-x-2 sm:px-3 sm:py-2\">\n <button\n data-queue-handle\n ref={sortable.setActivatorNodeRef}\n type=\"button\"\n {...sortable.attributes}\n {...sortable.listeners}\n onKeyDown={onHandleKeyDown}\n disabled={pending !== null}\n className=\"col-start-1 row-start-1 mt-0.5 inline-flex size-7 shrink-0 touch-none items-center justify-center rounded-md text-fg-subtle hover:bg-surface-2 hover:text-fg focus-visible:ring-2 focus-visible:ring-ring/40 pointer-coarse:size-[44px]\"\n aria-label={`Reorder queued prompt ${index + 1}`}\n title=\"Drag to reorder. Press Space, arrows, then Space to drop.\"\n >\n <GripVerticalIcon className=\"size-3.5\" />\n </button>\n <span className=\"col-start-2 row-start-1 mt-1 shrink-0 font-mono text-og-xs text-fg-subtle\">\n {index + 1}\n </span>\n <div className=\"col-span-full row-start-2 min-w-0 sm:col-span-1 sm:col-start-3 sm:row-start-1\">\n <QueuePrompt prompt={turn.prompt} index={index} onDisclosureChange={onDisclosureChange} />\n {attachedInputs.length > 0 ? (\n <PendingMachineInputs inputs={attachedInputs} attached />\n ) : null}\n <div className=\"mt-1 flex min-w-0 items-center gap-2 overflow-hidden whitespace-nowrap text-og-xs text-fg-subtle\">\n {turn.resources.length > 0 ? (\n <span className=\"shrink-0\">\n {turn.resources.length} resource{turn.resources.length === 1 ? \"\" : \"s\"}\n </span>\n ) : null}\n {turn.tools.length > 0 ? (\n <span className=\"shrink-0\">\n {turn.tools.length} tool{turn.tools.length === 1 ? \"\" : \"s\"}\n </span>\n ) : null}\n <span className=\"min-w-0 truncate\">{turn.model}</span>\n <span className=\"shrink-0\">{turn.reasoningEffort}</span>\n </div>\n </div>\n <div className=\"col-span-full row-start-3 flex min-w-0 items-start justify-end gap-1.5 sm:col-span-1 sm:col-start-4 sm:row-start-1 sm:gap-2\">\n <button\n type=\"button\"\n disabled={pending !== null}\n onClick={onSteer}\n aria-label={`Steer queued prompt ${index + 1}`}\n title=\"Steer — interrupt the current turn and send this message now\"\n className=\"inline-flex h-7 shrink-0 items-center justify-center gap-1 rounded-md px-2 text-og-control font-medium text-fg outline-none transition-[background-color] hover:bg-surface-2 focus-visible:ring-2 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50 pointer-coarse:min-h-[44px] pointer-coarse:min-w-[44px]\"\n >\n {pending === \"steer\" ? (\n <Loader2Icon className=\"size-3.5 animate-spin\" />\n ) : (\n <ZapIcon className=\"size-3.5\" />\n )}\n <span className=\"hidden sm:inline\">Steer</span>\n </button>\n <button\n type=\"button\"\n disabled={pending !== null}\n onClick={onDelete}\n aria-label={`Delete queued prompt ${index + 1}`}\n title=\"Delete this queued prompt\"\n className=\"inline-flex size-7 shrink-0 items-center justify-center rounded-md outline-none transition-colors hover:bg-surface-2 hover:text-status-failed focus-visible:ring-2 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50 pointer-coarse:size-[44px]\"\n >\n {pending === \"delete\" ? (\n <Loader2Icon className=\"size-3.5 animate-spin\" />\n ) : (\n <Trash2Icon className=\"size-3.5\" />\n )}\n </button>\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <button\n type=\"button\"\n disabled={pending !== null}\n aria-label={`More actions for queued prompt ${index + 1}`}\n className=\"inline-flex size-7 shrink-0 items-center justify-center rounded-md outline-none transition-colors hover:bg-surface-2 focus-visible:ring-2 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50 pointer-coarse:size-[44px]\"\n >\n {pending && pending !== \"steer\" && pending !== \"delete\" ? (\n <Loader2Icon className=\"size-3.5 animate-spin\" />\n ) : (\n <EllipsisIcon className=\"size-3.5\" />\n )}\n </button>\n </DropdownMenu.Trigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content\n align=\"end\"\n sideOffset={4}\n className=\"og-root z-50 w-48 max-w-[calc(100vw-16px)] rounded-md border border-border bg-surface p-1 text-og-control text-fg shadow-lg\"\n style={portalTokenStyle}\n data-testid={`queue-actions-menu-${index + 1}`}\n >\n {onEdit ? (\n <>\n <DropdownMenu.Item\n className=\"flex min-w-0 cursor-default items-center gap-2 whitespace-normal break-words rounded-sm px-2 py-1.5 outline-none focus:bg-surface-2 pointer-coarse:min-h-[44px]\"\n onSelect={onEdit}\n >\n <PencilIcon className=\"size-3.5\" /> Edit in composer\n </DropdownMenu.Item>\n <DropdownMenu.Separator className=\"my-1 h-px bg-border\" />\n </>\n ) : null}\n <DropdownMenu.Item\n className=\"flex min-w-0 cursor-default items-center gap-2 whitespace-normal break-words rounded-sm px-2 py-1.5 outline-none focus:bg-surface-2 data-[disabled]:opacity-50 pointer-coarse:min-h-[44px]\"\n disabled={index === 0}\n onSelect={() => onMove(0)}\n >\n <ArrowUpToLineIcon className=\"size-3.5\" /> Move to top\n </DropdownMenu.Item>\n <DropdownMenu.Item\n className=\"flex min-w-0 cursor-default items-center gap-2 whitespace-normal break-words rounded-sm px-2 py-1.5 outline-none focus:bg-surface-2 data-[disabled]:opacity-50 pointer-coarse:min-h-[44px]\"\n disabled={index === 0}\n onSelect={() => onMove(index - 1)}\n >\n Move up\n </DropdownMenu.Item>\n <DropdownMenu.Item\n className=\"flex min-w-0 cursor-default items-center gap-2 whitespace-normal break-words rounded-sm px-2 py-1.5 outline-none focus:bg-surface-2 data-[disabled]:opacity-50 pointer-coarse:min-h-[44px]\"\n disabled={index === count - 1}\n onSelect={() => onMove(index + 1)}\n >\n Move down\n </DropdownMenu.Item>\n <DropdownMenu.Item\n className=\"flex min-w-0 cursor-default items-center gap-2 whitespace-normal break-words rounded-sm px-2 py-1.5 outline-none focus:bg-surface-2 data-[disabled]:opacity-50 pointer-coarse:min-h-[44px]\"\n disabled={index === count - 1}\n onSelect={() => onMove(count - 1)}\n >\n <ArrowDownToLineIcon className=\"size-3.5\" /> Move to bottom\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n </div>\n </div>\n {confirmingReplace ? (\n <div className=\"mx-3 mb-2 rounded-md border border-status-waiting/30 bg-status-waiting/10 p-2 text-og-control text-fg\">\n <p>Your composer already has a draft. Replace it with this queued prompt?</p>\n <p className=\"mt-0.5 text-fg-muted\">\n The current draft will be permanently discarded; this queued prompt is preserved until\n you confirm.\n </p>\n <div className=\"mt-2 flex justify-end gap-1.5\">\n <button\n type=\"button\"\n className=\"rounded-md px-2 py-1 font-medium hover:bg-surface-2 focus-visible:ring-2 focus-visible:ring-ring/40\"\n onClick={onCancelReplace}\n >\n Keep current draft\n </button>\n <button\n type=\"button\"\n className=\"rounded-md bg-brand px-2 py-1 font-medium text-white hover:bg-brand/90 focus-visible:ring-2 focus-visible:ring-ring/40\"\n onClick={onConfirmReplace}\n >\n Replace and edit\n </button>\n </div>\n </div>\n ) : null}\n </li>\n );\n}\n\nconst verticalOnly: Modifier = ({ transform }) => ({ ...transform, x: 0 });\n\nfunction focusQueueTurn(surface: HTMLElement | null, turnId: string): void {\n window.requestAnimationFrame(() => {\n surface\n ?.querySelector<HTMLElement>(`[data-queue-turn-id=\"${turnId}\"] [data-queue-handle]`)\n ?.focus();\n });\n}\n\nfunction focusAfterQueueRemoval(\n surface: HTMLElement | null,\n previousIndex: number,\n onRequestComposerFocus?: (() => void) | undefined,\n): void {\n window.requestAnimationFrame(() => {\n const handles = surface?.querySelectorAll<HTMLElement>(\"[data-queue-handle]\") ?? [];\n const nearest = handles[Math.min(previousIndex, Math.max(0, handles.length - 1))];\n if (nearest) {\n nearest.focus();\n return;\n }\n if (onRequestComposerFocus) {\n onRequestComposerFocus();\n return;\n }\n document\n .querySelector<HTMLTextAreaElement>('textarea[aria-label=\"Message the agent\"]')\n ?.focus();\n });\n}\n"],"mappings":";;;;;;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW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CAAC;AACH;AAEA,SAAS,uBACP,SACA,eACA,wBACM;AACN,SAAO,sBAAsB,MAAM;AACjC,UAAM,UAAU,SAAS,iBAA8B,qBAAqB,KAAK,CAAC;AAClF,UAAM,UAAU,QAAQ,KAAK,IAAI,eAAe,KAAK,IAAI,GAAG,QAAQ,SAAS,CAAC,CAAC,CAAC;AAChF,QAAI,SAAS;AACX,cAAQ,MAAM;AACd;AAAA,IACF;AACA,QAAI,wBAAwB;AAC1B,6BAAuB;AACvB;AAAA,IACF;AACA,aACG,cAAmC,0CAA0C,GAC5E,MAAM;AAAA,EACZ,CAAC;AACH;","names":["summary"]}
@@ -1,8 +1,8 @@
1
1
  import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
2
- import type { ComponentProps } from "react";
2
+ import { type ComponentProps } from "react";
3
3
  declare function DropdownMenu(props: ComponentProps<typeof DropdownMenuPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
- declare function DropdownMenuTrigger(props: ComponentProps<typeof DropdownMenuPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
- declare function DropdownMenuContent({ className, sideOffset, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
4
+ declare function DropdownMenuTrigger({ ref, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
+ declare function DropdownMenuContent({ className, sideOffset, style, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
6
6
  declare function DropdownMenuItem({ className, inset, variant, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Item> & {
7
7
  inset?: boolean;
8
8
  variant?: "default" | "destructive";
@@ -12,5 +12,5 @@ declare function DropdownMenuSub(props: ComponentProps<typeof DropdownMenuPrimit
12
12
  declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
13
13
  inset?: boolean;
14
14
  }): import("react/jsx-runtime").JSX.Element;
15
- declare function DropdownMenuSubContent({ className, ...props }: ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
15
+ declare function DropdownMenuSubContent({ className, style, ...props }: ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
16
16
  export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, };
package/dist/realtime.js CHANGED
@@ -3,14 +3,17 @@ import {
3
3
  PickerAnimatedPage,
4
4
  PickerBackHeader,
5
5
  PickerNavRow
6
- } from "./chunk-U6K24XQD.js";
6
+ } from "./chunk-EHSYZ4KP.js";
7
7
  import {
8
8
  useEmbeddedRealtimeSession
9
9
  } from "./chunk-EKZH6IDG.js";
10
10
  import "./chunk-23EJ676W.js";
11
+ import {
12
+ usePortalTokenStyle
13
+ } from "./chunk-JB5725BI.js";
11
14
  import {
12
15
  cn
13
- } from "./chunk-TK7G6XLT.js";
16
+ } from "./chunk-22KP6LR5.js";
14
17
 
15
18
  // src/realtime/realtime-control.tsx
16
19
  import {
@@ -35,34 +38,64 @@ import {
35
38
  useCallback,
36
39
  useEffect,
37
40
  useMemo,
38
- useRef,
41
+ useRef as useRef2,
39
42
  useState
40
43
  } from "react";
41
44
 
42
45
  // src/realtime/dropdown-menu.tsx
43
46
  import { ChevronRightIcon } from "lucide-react";
44
47
  import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
48
+ import {
49
+ createContext,
50
+ useContext,
51
+ useRef
52
+ } from "react";
45
53
  import { jsx, jsxs } from "react/jsx-runtime";
54
+ var DropdownMenuSourceContext = createContext(null);
55
+ function assignRef(ref, value) {
56
+ if (typeof ref === "function") ref(value);
57
+ else if (ref) ref.current = value;
58
+ }
46
59
  function DropdownMenu(props) {
47
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
60
+ const sourceRef = useRef(null);
61
+ return /* @__PURE__ */ jsx(DropdownMenuSourceContext.Provider, { value: sourceRef, children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props }) });
48
62
  }
49
- function DropdownMenuTrigger(props) {
50
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
63
+ function DropdownMenuTrigger({
64
+ ref,
65
+ ...props
66
+ }) {
67
+ const sourceRef = useContext(DropdownMenuSourceContext);
68
+ return /* @__PURE__ */ jsx(
69
+ DropdownMenuPrimitive.Trigger,
70
+ {
71
+ "data-slot": "dropdown-menu-trigger",
72
+ ref: (node) => {
73
+ if (sourceRef) sourceRef.current = node;
74
+ assignRef(ref, node);
75
+ },
76
+ ...props
77
+ }
78
+ );
51
79
  }
52
80
  function DropdownMenuContent({
53
81
  className,
54
82
  sideOffset = 4,
83
+ style,
55
84
  ...props
56
85
  }) {
86
+ const sourceRef = useContext(DropdownMenuSourceContext);
87
+ const fallbackRef = useRef(null);
88
+ const portalStyle = usePortalTokenStyle(sourceRef ?? fallbackRef);
57
89
  return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
58
90
  DropdownMenuPrimitive.Content,
59
91
  {
60
92
  "data-slot": "dropdown-menu-content",
61
93
  sideOffset,
62
94
  className: cn(
63
- "z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
95
+ "og-root z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
64
96
  className
65
97
  ),
98
+ style: { ...portalStyle, ...style },
66
99
  ...props
67
100
  }
68
101
  ) });
@@ -80,7 +113,7 @@ function DropdownMenuItem({
80
113
  "data-inset": inset,
81
114
  "data-variant": variant,
82
115
  className: cn(
83
- "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
116
+ "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-og-menu outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
84
117
  className
85
118
  ),
86
119
  ...props
@@ -115,7 +148,7 @@ function DropdownMenuSubTrigger({
115
148
  "data-slot": "dropdown-menu-sub-trigger",
116
149
  "data-inset": inset,
117
150
  className: cn(
118
- "flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
151
+ "flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-og-menu outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
119
152
  className
120
153
  ),
121
154
  ...props,
@@ -128,16 +161,21 @@ function DropdownMenuSubTrigger({
128
161
  }
129
162
  function DropdownMenuSubContent({
130
163
  className,
164
+ style,
131
165
  ...props
132
166
  }) {
167
+ const sourceRef = useContext(DropdownMenuSourceContext);
168
+ const fallbackRef = useRef(null);
169
+ const portalStyle = usePortalTokenStyle(sourceRef ?? fallbackRef);
133
170
  return /* @__PURE__ */ jsx(
134
171
  DropdownMenuPrimitive.SubContent,
135
172
  {
136
173
  "data-slot": "dropdown-menu-sub-content",
137
174
  className: cn(
138
- "z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
175
+ "og-root z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
139
176
  className
140
177
  ),
178
+ style: { ...portalStyle, ...style },
141
179
  ...props
142
180
  }
143
181
  );
@@ -181,9 +219,9 @@ function useSessionRealtime(options) {
181
219
  workspaceId: options.workspaceId
182
220
  });
183
221
  const model = options.model ?? CODEX_LIVE_MODEL.id;
184
- const audioRef = useRef(null);
185
- const controllerRef = useRef(null);
186
- const controllerModelRef = useRef(null);
222
+ const audioRef = useRef2(null);
223
+ const controllerRef = useRef2(null);
224
+ const controllerModelRef = useRef2(null);
187
225
  const [snapshot, setSnapshot] = useState(() => ({
188
226
  status: hasStoredSessionRealtimeOwnerProof({ workspaceId, sessionId: options.sessionId, model }) ? "recovering" : "idle",
189
227
  realtimeId: null,
@@ -202,8 +240,8 @@ function useSessionRealtime(options) {
202
240
  () => projectSessionRealtimeLifecycle(options.events),
203
241
  [options.events]
204
242
  );
205
- const lifecycleRef = useRef(lifecycle);
206
- const eventsReadyRef = useRef(options.eventsReady);
243
+ const lifecycleRef = useRef2(lifecycle);
244
+ const eventsReadyRef = useRef2(options.eventsReady);
207
245
  lifecycleRef.current = lifecycle;
208
246
  eventsReadyRef.current = options.eventsReady;
209
247
  const lifecycleActive = lifecycle?.state === "active";
@@ -325,8 +363,8 @@ function SessionRealtimeControl(props) {
325
363
  modelAvailable: selectedModel.available,
326
364
  modelUnavailableReason: selectedModel.unavailableReason
327
365
  });
328
- const autostartModelRef = useRef(props.realtimeAutostartModel ?? null);
329
- const autostartStartedRef = useRef(false);
366
+ const autostartModelRef = useRef2(props.realtimeAutostartModel ?? null);
367
+ const autostartStartedRef = useRef2(false);
330
368
  const { models, selectedModel: selectedRealtimeModel, selectModel } = selection;
331
369
  const { canStart, start } = realtime;
332
370
  const onRealtimeAutostartConsumed = props.onRealtimeAutostartConsumed;
@@ -461,7 +499,7 @@ function NewSessionRealtimeControl(props) {
461
499
  selectedModel: props.selectedModel,
462
500
  selectModel: props.onSelectModel
463
501
  } : internalSelection;
464
- const audioRef = useRef(null);
502
+ const audioRef = useRef2(null);
465
503
  const [starting, setStarting] = useState(false);
466
504
  const [error, setError] = useState(null);
467
505
  const snapshot = useMemo(
@@ -773,8 +811,8 @@ function RealtimeVoiceModelPanel(props) {
773
811
  /* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-start gap-1 px-2 pt-1 pb-1.5", children: [
774
812
  props.leading,
775
813
  /* @__PURE__ */ jsxs2("div", { className: "min-w-0", children: [
776
- /* @__PURE__ */ jsx2("div", { className: "text-sm font-medium text-og-fg", children: "Voice model" }),
777
- /* @__PURE__ */ jsx2("p", { className: "mt-0.5 text-xs text-og-fg-subtle", children: "Used when you start a voice conversation." })
814
+ /* @__PURE__ */ jsx2("div", { className: "text-og-menu font-medium text-og-fg", children: "Voice model" }),
815
+ /* @__PURE__ */ jsx2("p", { className: "mt-0.5 text-og-control text-og-fg-subtle", children: "Used when you start a voice conversation." })
778
816
  ] })
779
817
  ] }),
780
818
  /* @__PURE__ */ jsx2("div", { className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pb-1.5", children: /* @__PURE__ */ jsx2(