@opengeni/react 0.15.0 → 0.23.0
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.
- package/README.md +110 -10
- package/dist/{chunk-TOJR776I.js → chunk-6XUS5VFM.js} +45 -369
- package/dist/chunk-6XUS5VFM.js.map +1 -0
- package/dist/chunk-CATATY77.js +2393 -0
- package/dist/chunk-CATATY77.js.map +1 -0
- package/dist/chunk-I3BJZIG5.js +439 -0
- package/dist/chunk-I3BJZIG5.js.map +1 -0
- package/dist/chunk-TK7G6XLT.js +18 -0
- package/dist/chunk-TK7G6XLT.js.map +1 -0
- package/dist/chunk-UAHPKLB6.js +2237 -0
- package/dist/chunk-UAHPKLB6.js.map +1 -0
- package/dist/chunk-UQS7OQDE.js +591 -0
- package/dist/chunk-UQS7OQDE.js.map +1 -0
- package/dist/chunk-YDNWMKXO.js +102 -0
- package/dist/chunk-YDNWMKXO.js.map +1 -0
- package/dist/composer-CVm5uoUI.d.ts +585 -0
- package/dist/composer.d.ts +6 -0
- package/dist/composer.js +56 -0
- package/dist/composer.js.map +1 -0
- package/dist/index.d.ts +1288 -1785
- package/dist/index.js +7140 -8817
- package/dist/index.js.map +1 -1
- package/dist/machines.d.ts +412 -3
- package/dist/machines.js +3 -1
- package/dist/noto-sans-arabic-loader-IA2T4X2A.js +21 -0
- package/dist/noto-sans-arabic-loader-IA2T4X2A.js.map +1 -0
- package/dist/noto-sans-jp-loader.generated-HFGLYBR3.js +292 -0
- package/dist/noto-sans-jp-loader.generated-HFGLYBR3.js.map +1 -0
- package/dist/queue-surface-implementation-3UW3MIIR.js +890 -0
- package/dist/queue-surface-implementation-3UW3MIIR.js.map +1 -0
- package/dist/session-Db00TRwl.d.ts +446 -0
- package/dist/session-context-rgrfElMl.d.ts +58 -0
- package/dist/session.d.ts +4 -0
- package/dist/session.js +54 -0
- package/dist/session.js.map +1 -0
- package/dist/use-composer-By1wn3MM.d.ts +99 -0
- package/package.json +20 -4
- package/src/approvals.ts +5 -3
- package/src/client.ts +44 -0
- package/src/components/approval-surface.tsx +198 -0
- package/src/components/chat-composer.tsx +94 -993
- package/src/components/code-editor.tsx +104 -26
- package/src/components/command-palette.tsx +8 -2
- package/src/components/composer-transcription-control.tsx +211 -0
- package/src/components/composer.tsx +1536 -0
- package/src/components/desktop-viewer.tsx +3 -3
- package/src/components/enrollment-consent.tsx +2 -2
- package/src/components/file-browser.tsx +367 -29
- package/src/components/human-input-form.tsx +417 -0
- package/src/components/machine-card.tsx +1 -1
- package/src/components/machines-dashboard.tsx +3 -3
- package/src/components/message-timeline.tsx +205 -25
- package/src/components/model-picker.tsx +12 -3
- package/src/components/pierre-diff.tsx +32 -6
- package/src/components/queue-draft-policy.ts +18 -0
- package/src/components/queue-surface-implementation.tsx +1037 -0
- package/src/components/queue-surface-state.tsx +94 -0
- package/src/components/queue-surface.tsx +42 -559
- package/src/components/sandbox-files.tsx +138 -14
- package/src/components/sandbox-terminal.tsx +8 -2
- package/src/components/sandbox-workspace.tsx +339 -119
- package/src/components/workbench-changes.tsx +84 -33
- package/src/components/workspace-dock.tsx +188 -18
- package/src/composer.ts +60 -0
- package/src/hooks/internal.ts +115 -34
- package/src/hooks/use-composer.ts +385 -104
- package/src/hooks/use-human-input.ts +131 -0
- package/src/hooks/use-machine-chip.ts +2 -2
- package/src/hooks/use-machines.ts +27 -11
- package/src/hooks/use-sandbox-files.ts +310 -62
- package/src/hooks/use-sandbox-git.ts +154 -40
- package/src/hooks/use-sandbox-terminal.ts +28 -6
- package/src/hooks/use-session-capabilities.ts +38 -9
- package/src/hooks/use-session-control.ts +37 -8
- package/src/hooks/use-session-events.ts +522 -48
- package/src/hooks/use-session-mcp-approval-policy.ts +161 -0
- package/src/hooks/use-slash-commands.ts +38 -38
- package/src/hooks/use-transcription.ts +757 -0
- package/src/hooks/use-turn-queue.ts +134 -66
- package/src/hooks/use-windowed-sections.ts +2 -2
- package/src/hooks/use-workspace-capture.ts +146 -40
- package/src/hooks/use-workspace-edit.ts +50 -14
- package/src/hooks/use-workspace-sessions.ts +3 -0
- package/src/human-input.ts +72 -0
- package/src/index.ts +85 -6
- package/src/lib/noto-sans-arabic-loader.ts +21 -0
- package/src/lib/noto-sans-jp-loader.generated.ts +295 -0
- package/src/lib/use-portal-token-style.ts +51 -0
- package/src/lib/use-unicode-fonts.ts +57 -0
- package/src/provider.tsx +4 -69
- package/src/session-context.ts +160 -0
- package/src/session.ts +89 -0
- package/src/timeline/parsers.ts +35 -0
- package/src/timeline/projection.ts +12 -4
- package/src/timeline/tool-renderers.tsx +41 -0
- package/src/timeline/turn-summary.tsx +2 -2
- package/src/timeline/types.ts +10 -9
- package/styles/index.css +56 -0
- package/styles/index.d.ts +2 -0
- package/styles/tokens.css +11 -6
- package/styles/tokens.d.ts +2 -0
- package/dist/chunk-TOJR776I.js.map +0 -1
- package/dist/machines-BpdwuQcD.d.ts +0 -449
|
@@ -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 { 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 { requestQueueDraftEdit } from \"./queue-draft-policy\";\nimport { QueueErrorAlert, QueueStoppingStatus } from \"./queue-surface-state\";\n\n/** The sole human prompt queue: 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 [keyboardDrag, setKeyboardDrag] = useState<{\n turnId: string;\n projectedIndex: number;\n } | null>(null);\n const count = queue.queue.length;\n const canEditInComposer = queueComposerCheckoutEnabled(composer, readOnly);\n const collapsedPreview = useMemo(\n () => queuePromptPreview(queue.queue[0]?.prompt ?? \"\", QUEUE_COLLAPSED_PREVIEW_CHARACTERS),\n [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 (count === 0 && !queue.stoppingPreviousAttempt && !queue.error && !queue.mutationError)\n return null;\n\n return (\n <div\n ref={surfaceRef}\n className=\"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 && count > 0 ? collapsedPreview.summary : undefined}\n aria-expanded={open}\n aria-label={`${count} queued prompt${count === 1 ? \"\" : \"s\"}${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-xs font-medium text-fg\">\n {count} queued prompt{count === 1 ? \"\" : \"s\"}\n </span>\n {readOnly ? (\n <span className=\"shrink-0 rounded border border-border px-1.5 py-0.5 text-2xs text-fg-subtle\">\n Read-only\n </span>\n ) : null}\n {!open && count > 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-xs\"\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 && 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 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 pending={queue.mutationFor(turn.id)}\n confirmingReplace={replaceDraftFor === turn.id}\n keyboardDragging={keyboardDrag?.turnId === turn.id}\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-xs 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\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-xs 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-2xs 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-2xs font-medium text-fg-muted outline-none transition-colors hover:text-fg 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-xs 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 onDisclosureChange,\n}: {\n turn: SessionTurn;\n index: number;\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-2xs text-fg-subtle\">{index + 1}</span>\n <div className=\"min-w-0 flex-1\">\n <QueuePrompt prompt={turn.prompt} index={index} onDisclosureChange={onDisclosureChange} />\n <div className=\"mt-1 flex min-w-0 items-center gap-2 overflow-hidden whitespace-nowrap text-2xs 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 pending,\n confirmingReplace,\n keyboardDragging,\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 pending: QueueMutationKind | null;\n confirmingReplace: boolean;\n keyboardDragging: boolean;\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-2xs 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 <div className=\"mt-1 flex min-w-0 items-center gap-2 overflow-hidden whitespace-nowrap text-2xs 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=\"Make this the next direction\"\n className=\"inline-flex h-7 shrink-0 items-center justify-center gap-1 rounded-md px-2 text-xs font-medium 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: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=\"z-50 w-48 max-w-[calc(100vw-16px)] rounded-md border border-border bg-surface p-1 text-xs text-fg shadow-lg\"\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-xs 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;AAEpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,oBAAoB;AAwMY,SAurBvB,UAvrBuB,KAa/B,YAb+B;AA/KlC,SAAS,6BACd,UACA,UACS;AACT,SAAO,CAAC,YAAY,aAAa,UAAa,SAAS,qBAAqB;AAC9E;AAEO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AACF,GAAsB;AACpB,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAwB,IAAI;AAC1E,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,EAAE;AACnD,QAAM,CAAC,eAAe,gBAAg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F,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;AAEA,IAAM,eAAyB,CAAC,EAAE,UAAU,OAAO,EAAE,GAAG,WAAW,GAAG,EAAE;AAExE,SAAS,eAAe,SAA6B,QAAsB;AACzE,SAAO,sBAAsB,MAAM;AACjC,aACI,cAA2B,wBAAwB,MAAM,wBAAwB,GACjF,MAAM;AAAA,EACZ,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"]}
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { E as EmbeddedSessionClientOverride, e as EmbeddedSessionMcpApprovalPolicyClientOverride, f as EmbeddedHumanInputClientOverride } from './session-context-rgrfElMl.js';
|
|
2
|
+
import { ToolAuthNeededPayload, ResourceRef, ToolRef, SessionStatus, SessionEvent, StreamConnectionState, SessionQueueSnapshot, SessionTurn, EffectiveSessionControl, ComposerDraft, SessionControlResponse, SessionMcpServerMetadata, SessionMcpApprovalPolicy, UpdateSessionMcpApprovalPolicyResponse, HumanInputQuestion, SessionHumanInputRequest, SubmitHumanInputResponseRequest } from '@opengeni/sdk';
|
|
3
|
+
import { S as SessionEventFeedOptions } from './use-composer-By1wn3MM.js';
|
|
4
|
+
|
|
5
|
+
type UserMessageItem = {
|
|
6
|
+
kind: "user-message";
|
|
7
|
+
id: string;
|
|
8
|
+
text: string;
|
|
9
|
+
/** Resources attached to this message (file uploads, repositories). */
|
|
10
|
+
resources: ResourceRef[];
|
|
11
|
+
/** Tools requested for the turn this message starts. */
|
|
12
|
+
tools: ToolRef[];
|
|
13
|
+
occurredAt: string;
|
|
14
|
+
};
|
|
15
|
+
type AgentMessageItem = {
|
|
16
|
+
kind: "agent-message";
|
|
17
|
+
id: string;
|
|
18
|
+
turnId: string | null;
|
|
19
|
+
text: string;
|
|
20
|
+
/** Still receiving deltas (no completed/turn-end seen yet). */
|
|
21
|
+
streaming: boolean;
|
|
22
|
+
occurredAt: string;
|
|
23
|
+
};
|
|
24
|
+
type ReasoningItem = {
|
|
25
|
+
kind: "reasoning";
|
|
26
|
+
id: string;
|
|
27
|
+
turnId: string | null;
|
|
28
|
+
text: string;
|
|
29
|
+
streaming: boolean;
|
|
30
|
+
occurredAt: string;
|
|
31
|
+
};
|
|
32
|
+
type ToolCallItem = {
|
|
33
|
+
kind: "tool-call";
|
|
34
|
+
id: string;
|
|
35
|
+
turnId: string | null;
|
|
36
|
+
callId: string | null;
|
|
37
|
+
name: string;
|
|
38
|
+
arguments: unknown;
|
|
39
|
+
output: unknown;
|
|
40
|
+
/**
|
|
41
|
+
* The provider-native tool item (`agent.toolCall.created.payload.raw`). Carries
|
|
42
|
+
* `type` (e.g. `apply_patch_call`, `computer_call`, `hosted_tool_call`) and the
|
|
43
|
+
* tool-specific fields the per-tool renderers read (`operation`, `action`,
|
|
44
|
+
* `providerData`, …). `undefined` for first-party MCP tools, which carry their
|
|
45
|
+
* payload in `arguments`/`output` instead.
|
|
46
|
+
*/
|
|
47
|
+
raw: unknown;
|
|
48
|
+
status: "running" | "complete" | "failed" | "cancelled";
|
|
49
|
+
occurredAt: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* An orchestration call against another session — the manager spawning or
|
|
53
|
+
* messaging a worker. Rendered as a first-class "worker" row, not a generic
|
|
54
|
+
* tool call.
|
|
55
|
+
*/
|
|
56
|
+
type WorkerItem = {
|
|
57
|
+
kind: "worker";
|
|
58
|
+
id: string;
|
|
59
|
+
turnId: string | null;
|
|
60
|
+
callId: string | null;
|
|
61
|
+
action: "spawn" | "message";
|
|
62
|
+
/** The worker's initial message / the message sent to it, when parseable. */
|
|
63
|
+
prompt: string | null;
|
|
64
|
+
/** The target/spawned worker session id, when parseable from args/output. */
|
|
65
|
+
workerSessionId: string | null;
|
|
66
|
+
status: "running" | "complete" | "failed" | "cancelled";
|
|
67
|
+
occurredAt: string;
|
|
68
|
+
};
|
|
69
|
+
type WorkerCompletionItem = {
|
|
70
|
+
kind: "worker-completion";
|
|
71
|
+
id: string;
|
|
72
|
+
turnId: string | null;
|
|
73
|
+
occurredAt: string;
|
|
74
|
+
childSessionId: string;
|
|
75
|
+
childStatus: string;
|
|
76
|
+
goalStatus: string | null;
|
|
77
|
+
goalText: string | null;
|
|
78
|
+
evidence: string | null;
|
|
79
|
+
pausedReason: string | null;
|
|
80
|
+
text: string;
|
|
81
|
+
};
|
|
82
|
+
type SandboxItem = {
|
|
83
|
+
kind: "sandbox";
|
|
84
|
+
id: string;
|
|
85
|
+
turnId: string | null;
|
|
86
|
+
name: string;
|
|
87
|
+
command: string | null;
|
|
88
|
+
output: string;
|
|
89
|
+
origin?: "created" | "restored" | "resumed" | null;
|
|
90
|
+
status: "running" | "complete" | "failed" | "cancelled";
|
|
91
|
+
occurredAt: string;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* A first-party workspace-memory write the agent made mid-turn — a `memory.saved`
|
|
95
|
+
* (it committed a new preference / fact / procedure / decision / history) or a
|
|
96
|
+
* `memory.corrected` (it updated or archived an existing one). A settled save is
|
|
97
|
+
* ordinary progress, not an exceptional state, so it renders as a calm NEUTRAL
|
|
98
|
+
* step on the rail (never accent/color). When the host app supplies an
|
|
99
|
+
* `onMemoryClick` handler the row also deep-links to the record in its memory
|
|
100
|
+
* pane; without one it is non-interactive rich content.
|
|
101
|
+
*/
|
|
102
|
+
type MemoryItem = {
|
|
103
|
+
kind: "memory";
|
|
104
|
+
id: string;
|
|
105
|
+
turnId: string | null;
|
|
106
|
+
variant: "saved" | "corrected";
|
|
107
|
+
/** The memory's kind enum (`"preference" | "semantic" | …`); mapped to a human label at render. */
|
|
108
|
+
memoryKind: string;
|
|
109
|
+
/** The memory text, ellipsized to ≤120 chars server-side. For a supersede this is the OLD text. */
|
|
110
|
+
preview: string;
|
|
111
|
+
/** The save collapsed into an existing memory (no new row was written). Saved variant only. */
|
|
112
|
+
deduped?: boolean;
|
|
113
|
+
/** The NEW text when a correction superseded the memory with a replacement; absent = updated-in-place or archived. */
|
|
114
|
+
replacementPreview?: string;
|
|
115
|
+
/**
|
|
116
|
+
* What a `memory.corrected` did: `"superseded"` (replaced by a new record, see
|
|
117
|
+
* `replacementPreview`), `"updated"` (edited in place — the record lives on), or
|
|
118
|
+
* `"archived"` (retired). Distinguishes updated-in-place from archived when there
|
|
119
|
+
* is no replacement. Corrected variant only; read defensively (may be absent).
|
|
120
|
+
*/
|
|
121
|
+
action?: string;
|
|
122
|
+
/** The saved / corrected memory's id — the deep-link target for a save. */
|
|
123
|
+
memoryId: string;
|
|
124
|
+
/** The replacement memory's id when a correction produced one — the LIVE record the deep-link targets. */
|
|
125
|
+
replacementMemoryId?: string;
|
|
126
|
+
occurredAt: string;
|
|
127
|
+
};
|
|
128
|
+
type SessionStatusItem = {
|
|
129
|
+
kind: "session-status";
|
|
130
|
+
id: string;
|
|
131
|
+
status: SessionStatus;
|
|
132
|
+
occurredAt: string;
|
|
133
|
+
};
|
|
134
|
+
type GoalItem = {
|
|
135
|
+
kind: "goal";
|
|
136
|
+
id: string;
|
|
137
|
+
action: "set" | "updated" | "completed" | "paused" | "resumed" | "cleared" | "continuation";
|
|
138
|
+
text: string | null;
|
|
139
|
+
occurredAt: string;
|
|
140
|
+
};
|
|
141
|
+
type NoticeItem = {
|
|
142
|
+
kind: "notice";
|
|
143
|
+
id: string;
|
|
144
|
+
tone: "waiting" | "cancelled" | "failed";
|
|
145
|
+
text: string;
|
|
146
|
+
/** Optional evidence kept inspectable without overwhelming the main rail. */
|
|
147
|
+
details?: {
|
|
148
|
+
label: string;
|
|
149
|
+
value: unknown;
|
|
150
|
+
};
|
|
151
|
+
action?: {
|
|
152
|
+
label: string;
|
|
153
|
+
url: string;
|
|
154
|
+
};
|
|
155
|
+
occurredAt: string;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* A tool call hit a missing or lapsed connection. The broker reports that
|
|
159
|
+
* condition as a tool error and the turn continues; reconnecting never resumes
|
|
160
|
+
* or replays the original call. Carries the structured `tool.auth_needed`
|
|
161
|
+
* payload so the renderer can draw a clean inline recovery affordance (provider
|
|
162
|
+
* logo + one human line + a Connect/Reconnect button) and the app can start the
|
|
163
|
+
* right flow (OAuth reconnect for the surviving connection, or credential
|
|
164
|
+
* re-entry for an api-key one). The `reason` shapes the human copy but is never
|
|
165
|
+
* shown raw.
|
|
166
|
+
*/
|
|
167
|
+
type AuthNeededItem = {
|
|
168
|
+
kind: "auth-needed";
|
|
169
|
+
id: string;
|
|
170
|
+
turnId: string | null;
|
|
171
|
+
/** The connection's registrable domain, e.g. "linear.app". */
|
|
172
|
+
providerDomain: string;
|
|
173
|
+
/** The lapsed connection to reconnect, when the row survived. */
|
|
174
|
+
connectionId: string | null;
|
|
175
|
+
reason: ToolAuthNeededPayload["reason"] | null;
|
|
176
|
+
/** Scopes the provider now needs; may inform the copy, never shown as a raw label. */
|
|
177
|
+
scopes: string[];
|
|
178
|
+
/** The OAuth `resource` (RFC 8707) the reconnect should target, when supplied. */
|
|
179
|
+
resource: string | null;
|
|
180
|
+
/** The tool whose call triggered the reauth, for context. */
|
|
181
|
+
toolName: string | null;
|
|
182
|
+
/** A pre-minted authorization URL, when the broker already produced one. */
|
|
183
|
+
authorizationUrl: string | null;
|
|
184
|
+
occurredAt: string;
|
|
185
|
+
};
|
|
186
|
+
type TurnOutcome = "complete" | "failed" | "cancelled";
|
|
187
|
+
type TurnEndItem = {
|
|
188
|
+
kind: "turn-end";
|
|
189
|
+
id: string;
|
|
190
|
+
turnId: string | null;
|
|
191
|
+
outcome: TurnOutcome;
|
|
192
|
+
failureText: string | null;
|
|
193
|
+
occurredAt: string;
|
|
194
|
+
};
|
|
195
|
+
type TimelineItem = UserMessageItem | AgentMessageItem | ReasoningItem | ToolCallItem | WorkerItem | WorkerCompletionItem | SandboxItem | SessionStatusItem | GoalItem | NoticeItem | AuthNeededItem | MemoryItem | TurnEndItem;
|
|
196
|
+
/** Activity items cluster between chat messages (reasoning, tools, workers, sandbox, memory). */
|
|
197
|
+
type ActivityItem = ReasoningItem | ToolCallItem | WorkerItem | SandboxItem | MemoryItem;
|
|
198
|
+
type TimelineGroup = {
|
|
199
|
+
kind: "item";
|
|
200
|
+
item: TimelineItem;
|
|
201
|
+
} | {
|
|
202
|
+
kind: "activity";
|
|
203
|
+
id: string;
|
|
204
|
+
items: ActivityItem[];
|
|
205
|
+
outcome?: TurnOutcome;
|
|
206
|
+
failureText?: string;
|
|
207
|
+
} | {
|
|
208
|
+
kind: "turn";
|
|
209
|
+
id: string;
|
|
210
|
+
outcome: TurnOutcome;
|
|
211
|
+
failureText?: string;
|
|
212
|
+
startedAt: string;
|
|
213
|
+
endedAt: string;
|
|
214
|
+
groups: TimelineGroup[];
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
type SessionEventsConnectionState = StreamConnectionState | "idle" | "ended" | "error";
|
|
218
|
+
type UseSessionEventsOptions = EmbeddedSessionClientOverride & {
|
|
219
|
+
/** Resume after this sequence (exclusive). Nonzero keeps full replay/resume semantics. */
|
|
220
|
+
after?: number | undefined;
|
|
221
|
+
/** Load a bounded tail by default, or opt back into full replay from `after`. */
|
|
222
|
+
replay?: "windowed" | "full" | undefined;
|
|
223
|
+
/** Pause the stream without unmounting (e.g. hidden tab). Defaults to true. */
|
|
224
|
+
enabled?: boolean | undefined;
|
|
225
|
+
};
|
|
226
|
+
type UseSessionEventsResult = {
|
|
227
|
+
/** Replayed + live events, ordered by sequence, no gaps, no duplicates. */
|
|
228
|
+
events: SessionEvent[];
|
|
229
|
+
/** Projected, renderable timeline (memoized over `events`). */
|
|
230
|
+
timeline: TimelineItem[];
|
|
231
|
+
/** Latest session status observed in the event log, if any. */
|
|
232
|
+
sessionStatus: SessionStatus | null;
|
|
233
|
+
connectionState: SessionEventsConnectionState;
|
|
234
|
+
/** Highest sequence seen so far (0 before the first event). */
|
|
235
|
+
lastSequence: number;
|
|
236
|
+
/** Exact serialized bytes retained in the current browser event window. */
|
|
237
|
+
windowBytes: number;
|
|
238
|
+
/** Whether older delivered events were evicted from the browser window. */
|
|
239
|
+
windowTruncated: boolean;
|
|
240
|
+
/** True until the initial tail window has been applied (windowed mode). */
|
|
241
|
+
initialLoading: boolean;
|
|
242
|
+
/** Whether older durable events are available before the current window. */
|
|
243
|
+
hasOlder: boolean;
|
|
244
|
+
/** True while an older window is being fetched. */
|
|
245
|
+
loadingOlder: boolean;
|
|
246
|
+
/** Prepend an older density-bounded window; resolves true when more remain. */
|
|
247
|
+
loadOlder: () => Promise<boolean>;
|
|
248
|
+
error: Error | null;
|
|
249
|
+
};
|
|
250
|
+
declare const SESSION_EVENT_BROWSER_MAX_BYTES: number;
|
|
251
|
+
declare const SESSION_EVENT_BROWSER_MAX_COUNT = 10000;
|
|
252
|
+
declare const SESSION_EVENT_BROWSER_SINGLE_EVENT_MAX_BYTES: number;
|
|
253
|
+
declare const SESSION_EVENT_BROWSER_PENDING_MAX_BYTES: number;
|
|
254
|
+
declare const SESSION_EVENT_BROWSER_PENDING_MAX_COUNT = 256;
|
|
255
|
+
type BrowserSessionEventWindow = {
|
|
256
|
+
events: SessionEvent[];
|
|
257
|
+
bytes: number;
|
|
258
|
+
truncated: boolean;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Live-stream a session's event log with replay-by-sequence, reconnect, and
|
|
262
|
+
* batched React updates. Fresh loads default to a bounded tail window; pass
|
|
263
|
+
* `replay: "full"` or a nonzero `after` for the previous full replay path.
|
|
264
|
+
*/
|
|
265
|
+
declare function useSessionEvents(sessionId: string | null | undefined, options?: UseSessionEventsOptions): UseSessionEventsResult;
|
|
266
|
+
/**
|
|
267
|
+
* Keep one direction-aware count+byte-bounded browser window. Live/default
|
|
268
|
+
* accumulation retains the newest suffix; backward paging retains the oldest
|
|
269
|
+
* prefix so newly fetched history cannot be immediately evicted. This is
|
|
270
|
+
* deliberately separate from durable history and transport paging: when a
|
|
271
|
+
* backward page evicts the live tail, the hook reconnects from the retained
|
|
272
|
+
* high-water mark while preserving the highest-ever-observed sequence
|
|
273
|
+
* separately. The source event remains durable in PostgreSQL throughout.
|
|
274
|
+
*/
|
|
275
|
+
declare function boundBrowserSessionEventWindow(events: readonly SessionEvent[], options?: {
|
|
276
|
+
maxBytes?: number;
|
|
277
|
+
maxCount?: number;
|
|
278
|
+
direction?: "newest" | "oldest";
|
|
279
|
+
}): BrowserSessionEventWindow;
|
|
280
|
+
|
|
281
|
+
/** Events that can change the authoritative prompt queue or effective control. */
|
|
282
|
+
declare function isTurnQueueEvent(event: Pick<SessionEvent, "type">): boolean;
|
|
283
|
+
type QueueMutationKind = "move" | "edit" | "steer" | "delete";
|
|
284
|
+
type UseTurnQueueOptions = EmbeddedSessionClientOverride & SessionEventFeedOptions & {
|
|
285
|
+
pollIntervalMs?: number | undefined;
|
|
286
|
+
};
|
|
287
|
+
type UseTurnQueueResult = {
|
|
288
|
+
snapshot: SessionQueueSnapshot | null;
|
|
289
|
+
/** Human/API prompts exactly in server execution order. Never client-sorted. */
|
|
290
|
+
queue: SessionTurn[];
|
|
291
|
+
effectiveControl: EffectiveSessionControl | null;
|
|
292
|
+
/** The latest interrupted attempt has not yet durably proved physical quiescence. */
|
|
293
|
+
stoppingPreviousAttempt: boolean;
|
|
294
|
+
loading: boolean;
|
|
295
|
+
error: Error | null;
|
|
296
|
+
refresh: () => Promise<void>;
|
|
297
|
+
moveTurn: (turnId: string, beforeTurnId: string | null) => Promise<boolean>;
|
|
298
|
+
/** Atomically withdraw a waiting prompt into the private durable composer draft. */
|
|
299
|
+
editTurn: (turnId: string, options: {
|
|
300
|
+
expectedDraftRevision: number;
|
|
301
|
+
replaceDraft: boolean;
|
|
302
|
+
}) => Promise<ComposerDraft | null>;
|
|
303
|
+
/** Advance the same durable waiting prompt; no duplicate prompt is created. */
|
|
304
|
+
steerTurn: (turnId: string) => Promise<boolean>;
|
|
305
|
+
removeTurn: (turnId: string) => Promise<boolean>;
|
|
306
|
+
pendingByTurn: Readonly<Record<string, QueueMutationKind>>;
|
|
307
|
+
mutationFor: (turnId: string) => QueueMutationKind | null;
|
|
308
|
+
mutating: boolean;
|
|
309
|
+
mutationError: Error | null;
|
|
310
|
+
clearMutationError: () => void;
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* The one authoritative human prompt queue. Every mutation carries the exact
|
|
314
|
+
* server versions the operator saw and accepts only monotonic snapshots. A
|
|
315
|
+
* conflict immediately reloads server truth; the client never invents order.
|
|
316
|
+
*/
|
|
317
|
+
declare function useTurnQueue(sessionId: string | null | undefined, options?: UseTurnQueueOptions): UseTurnQueueResult;
|
|
318
|
+
|
|
319
|
+
type UseSessionControlOptions = EmbeddedSessionClientOverride;
|
|
320
|
+
type UseSessionControlResult = {
|
|
321
|
+
pause: (reason?: string) => Promise<SessionControlResponse | null>;
|
|
322
|
+
resume: (reason?: string) => Promise<SessionControlResponse | null>;
|
|
323
|
+
controlling: boolean;
|
|
324
|
+
/** Approve a pending `requires_action` approval. */
|
|
325
|
+
approve: (approvalId: string, message?: string) => Promise<SessionEvent | null>;
|
|
326
|
+
/** Reject a pending `requires_action` approval. */
|
|
327
|
+
reject: (approvalId: string, message?: string) => Promise<SessionEvent | null>;
|
|
328
|
+
/** True while an approval decision is in flight. */
|
|
329
|
+
responding: boolean;
|
|
330
|
+
error: Error | null;
|
|
331
|
+
clearError: () => void;
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* Session pause/resume and approval decisions. Pair with
|
|
335
|
+
* `useSessionEvents` (for `session.requiresAction` payloads carrying the
|
|
336
|
+
* `approvalId`) to render an approval bar.
|
|
337
|
+
*/
|
|
338
|
+
declare function useSessionControl(sessionId: string | null | undefined, options?: UseSessionControlOptions): UseSessionControlResult;
|
|
339
|
+
|
|
340
|
+
declare function isSessionMcpApprovalPolicyEvent(event: Pick<SessionEvent, "type" | "payload">, serverId?: string): boolean;
|
|
341
|
+
type UseSessionMcpApprovalPolicyOptions = EmbeddedSessionMcpApprovalPolicyClientOverride & SessionEventFeedOptions & {
|
|
342
|
+
/** Optional safety-net polling (ms). Off by default; policy events drive refreshes. */
|
|
343
|
+
pollIntervalMs?: number | undefined;
|
|
344
|
+
};
|
|
345
|
+
type UseSessionMcpApprovalPolicyResult = {
|
|
346
|
+
server: SessionMcpServerMetadata | null;
|
|
347
|
+
policy: SessionMcpApprovalPolicy | null;
|
|
348
|
+
loading: boolean;
|
|
349
|
+
error: Error | null;
|
|
350
|
+
refresh: () => Promise<void>;
|
|
351
|
+
update: (policy: SessionMcpApprovalPolicy) => Promise<UpdateSessionMcpApprovalPolicyResponse | null>;
|
|
352
|
+
updating: boolean;
|
|
353
|
+
clearError: () => void;
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* Read and update one existing session MCP server's approval policy. Updates
|
|
357
|
+
* become effective for the next claimed attempt; current work is unchanged.
|
|
358
|
+
*/
|
|
359
|
+
declare function useSessionMcpApprovalPolicy(sessionId: string | null | undefined, serverId: string | null | undefined, options?: UseSessionMcpApprovalPolicyOptions): UseSessionMcpApprovalPolicyResult;
|
|
360
|
+
|
|
361
|
+
type PendingApproval = {
|
|
362
|
+
/** The id to send back via `user.approvalDecision` (`approvalId`). */
|
|
363
|
+
id: string;
|
|
364
|
+
/** Tool/function name awaiting the decision. */
|
|
365
|
+
name: string;
|
|
366
|
+
arguments?: unknown;
|
|
367
|
+
/** The raw approval entry from the `session.requiresAction` payload. */
|
|
368
|
+
raw?: unknown;
|
|
369
|
+
};
|
|
370
|
+
/** The approvals carried by one `session.requiresAction` payload. */
|
|
371
|
+
declare function approvalsFromRequiresAction(payload: unknown): PendingApproval[];
|
|
372
|
+
/** The approvals still awaiting a decision after replaying `events` in order. */
|
|
373
|
+
declare function projectPendingApprovals(events: SessionEvent[]): PendingApproval[];
|
|
374
|
+
|
|
375
|
+
/** Minimal actionable request shape available from the durable event log. */
|
|
376
|
+
type PendingHumanInputRequest = {
|
|
377
|
+
id: string;
|
|
378
|
+
turnId: string | null;
|
|
379
|
+
questions: HumanInputQuestion[];
|
|
380
|
+
allowSkip: boolean;
|
|
381
|
+
expiresAt: string | null;
|
|
382
|
+
};
|
|
383
|
+
/** Parse one generic `session.humanInput.requested` event defensively. */
|
|
384
|
+
declare function humanInputRequestFromEvent(event: Pick<SessionEvent, "type" | "payload" | "turnId">): PendingHumanInputRequest | null;
|
|
385
|
+
/**
|
|
386
|
+
* Fold a durable event log into the structured requests that are actionable
|
|
387
|
+
* now. Responses remove one request; a terminal owning turn clears any
|
|
388
|
+
* unresolved requests that died with it. Replaying history cannot resurrect a
|
|
389
|
+
* previously answered card.
|
|
390
|
+
*/
|
|
391
|
+
declare function projectPendingHumanInputRequests(events: SessionEvent[]): PendingHumanInputRequest[];
|
|
392
|
+
|
|
393
|
+
/** Events that can create, settle, or invalidate an actionable request. */
|
|
394
|
+
declare function isHumanInputEvent(event: Pick<SessionEvent, "type">): boolean;
|
|
395
|
+
type UseHumanInputRequestsOptions = EmbeddedHumanInputClientOverride & SessionEventFeedOptions & {
|
|
396
|
+
/** Optional safety-net polling. Durable events drive refresh by default. */
|
|
397
|
+
pollIntervalMs?: number | undefined;
|
|
398
|
+
};
|
|
399
|
+
type UseHumanInputRequestsResult = {
|
|
400
|
+
requests: SessionHumanInputRequest[];
|
|
401
|
+
loading: boolean;
|
|
402
|
+
error: Error | null;
|
|
403
|
+
refresh: () => Promise<void>;
|
|
404
|
+
respond: (requestId: string, response: SubmitHumanInputResponseRequest) => Promise<SessionEvent | null>;
|
|
405
|
+
respondingRequestId: string | null;
|
|
406
|
+
mutationError: Error | null;
|
|
407
|
+
clearMutationError: () => void;
|
|
408
|
+
};
|
|
409
|
+
/**
|
|
410
|
+
* Authoritative structured-human-input hook. The server's pending-request
|
|
411
|
+
* table is the read model; events only trigger reconciliation. This lets an
|
|
412
|
+
* embedded host use the same primitive with a shared event feed or its own SDK
|
|
413
|
+
* proxy without rebuilding request lifecycle logic.
|
|
414
|
+
*/
|
|
415
|
+
declare function useHumanInputRequests(sessionId: string | null | undefined, options?: UseHumanInputRequestsOptions): UseHumanInputRequestsResult;
|
|
416
|
+
|
|
417
|
+
declare function buildTimeline(events: SessionEvent[]): TimelineItem[];
|
|
418
|
+
/**
|
|
419
|
+
* Whether the session's most recent turn ended in credit exhaustion — the
|
|
420
|
+
* terminal credit state apps key their "add credits" affordances on. Derived
|
|
421
|
+
* from the LAST turn-end event (completed/failed/cancelled): a later turn that
|
|
422
|
+
* settles any other way (someone topped up and kept working) clears it.
|
|
423
|
+
*/
|
|
424
|
+
declare function creditExhaustedFromEvents(events: SessionEvent[]): boolean;
|
|
425
|
+
/** The latest session status carried in the event log, if any. */
|
|
426
|
+
declare function sessionStatusFromEvents(events: SessionEvent[]): SessionStatus | null;
|
|
427
|
+
declare function groupTimeline(items: TimelineItem[]): TimelineGroup[];
|
|
428
|
+
/**
|
|
429
|
+
* Find a session id in orchestration tool arguments or output. Handles raw
|
|
430
|
+
* objects, JSON strings, and MCP tool results (`{ content: [{ type: "text",
|
|
431
|
+
* text: "{...}" }], structuredContent? }`).
|
|
432
|
+
*/
|
|
433
|
+
declare function extractSessionRef(value: unknown, depth?: number): string | null;
|
|
434
|
+
/**
|
|
435
|
+
* Readable label for a tool call ("session_create" -> "session create").
|
|
436
|
+
*
|
|
437
|
+
* MCP tools are namespaced `<serverId>__<toolName>` (see prefixedMcpToolName),
|
|
438
|
+
* and for catalog-imported servers that serverId is an opaque slug+hash
|
|
439
|
+
* ("mcp-integrations-sh-supabase-com-34ed9dcf1390-0i6tcf8"). De-slugging the
|
|
440
|
+
* whole thing leaked that id into the timeline; strip the server prefix and show
|
|
441
|
+
* just the tool ("list organizations"). Names without the `__` boundary (plain
|
|
442
|
+
* built-ins like "session_create") are unaffected.
|
|
443
|
+
*/
|
|
444
|
+
declare function toolDisplayName(name: string): string;
|
|
445
|
+
|
|
446
|
+
export { useTurnQueue as $, type ActivityItem as A, type BrowserSessionEventWindow as B, buildTimeline as C, creditExhaustedFromEvents as D, extractSessionRef as E, groupTimeline as F, type GoalItem as G, humanInputRequestFromEvent as H, isHumanInputEvent as I, isSessionMcpApprovalPolicyEvent as J, isTurnQueueEvent as K, projectPendingApprovals as L, projectPendingHumanInputRequests as M, type NoticeItem as N, sessionStatusFromEvents as O, type PendingApproval as P, type QueueMutationKind as Q, type ReasoningItem as R, SESSION_EVENT_BROWSER_MAX_BYTES as S, type ToolCallItem as T, type UseTurnQueueResult as U, toolDisplayName as V, type WorkerItem as W, useHumanInputRequests as X, useSessionControl as Y, useSessionEvents as Z, useSessionMcpApprovalPolicy as _, type TurnOutcome as a, type MemoryItem as a0, type WorkerCompletionItem as a1, type TimelineItem as b, type AgentMessageItem as c, type UserMessageItem as d, type AuthNeededItem as e, type PendingHumanInputRequest as f, SESSION_EVENT_BROWSER_MAX_COUNT as g, SESSION_EVENT_BROWSER_PENDING_MAX_BYTES as h, SESSION_EVENT_BROWSER_PENDING_MAX_COUNT as i, SESSION_EVENT_BROWSER_SINGLE_EVENT_MAX_BYTES as j, type SandboxItem as k, type SessionEventsConnectionState as l, type SessionStatusItem as m, type TimelineGroup as n, type TurnEndItem as o, type UseHumanInputRequestsOptions as p, type UseHumanInputRequestsResult as q, type UseSessionControlOptions as r, type UseSessionControlResult as s, type UseSessionEventsOptions as t, type UseSessionEventsResult as u, type UseSessionMcpApprovalPolicyOptions as v, type UseSessionMcpApprovalPolicyResult as w, type UseTurnQueueOptions as x, approvalsFromRequiresAction as y, boundBrowserSessionEventWindow as z };
|