@opengeni/react 0.6.2 → 0.8.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.
Files changed (45) hide show
  1. package/README.md +17 -6
  2. package/dist/{chunk-DEW2ZNF2.js → chunk-5C7RGAWA.js} +70 -37
  3. package/dist/chunk-5C7RGAWA.js.map +1 -0
  4. package/dist/index.d.ts +45 -9
  5. package/dist/index.js +1385 -732
  6. package/dist/index.js.map +1 -1
  7. package/dist/{machines-BD6h9P_s.d.ts → machines-BeZ3bD3t.d.ts} +2 -2
  8. package/dist/machines.d.ts +1 -1
  9. package/dist/machines.js +1 -1
  10. package/package.json +2 -2
  11. package/src/client.ts +1 -0
  12. package/src/components/chat-composer.tsx +127 -60
  13. package/src/components/code-editor.tsx +15 -15
  14. package/src/components/desktop-viewer.tsx +40 -36
  15. package/src/components/diff-view.tsx +22 -22
  16. package/src/components/enrollment-consent.tsx +13 -13
  17. package/src/components/file-browser.tsx +74 -67
  18. package/src/components/fleet-tile.tsx +3 -3
  19. package/src/components/machine-card.tsx +6 -6
  20. package/src/components/machine-status-pill.tsx +3 -3
  21. package/src/components/machines-dashboard.tsx +28 -14
  22. package/src/components/markdown.tsx +6 -6
  23. package/src/components/message-timeline.tsx +207 -12
  24. package/src/components/pierre-diff.tsx +9 -10
  25. package/src/components/pierre-file.tsx +8 -8
  26. package/src/components/sandbox-files.tsx +37 -40
  27. package/src/components/sandbox-terminal.tsx +9 -11
  28. package/src/components/session-status.tsx +2 -2
  29. package/src/components/workspace-dock.tsx +153 -49
  30. package/src/hooks/use-file-attachments.ts +45 -15
  31. package/src/hooks/use-session-events.ts +283 -8
  32. package/src/index.ts +2 -2
  33. package/src/lib/format.ts +32 -0
  34. package/src/lib/xterm-theme.ts +8 -11
  35. package/src/timeline/activity-rail.tsx +5 -2
  36. package/src/timeline/entrance.tsx +30 -0
  37. package/src/timeline/parsers.ts +104 -0
  38. package/src/timeline/projection.ts +22 -5
  39. package/src/timeline/screenshot-lightbox.tsx +1 -1
  40. package/src/timeline/shared.tsx +4 -1
  41. package/src/timeline/tool-diff.tsx +1 -1
  42. package/src/timeline/tool-renderers.tsx +46 -7
  43. package/src/timeline/turn-summary.tsx +24 -4
  44. package/styles/tokens.css +8 -0
  45. package/dist/chunk-DEW2ZNF2.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ClientOverride, S as SessionClientLike } from './machines-BD6h9P_s.js';
2
- export { a as CONNECTION_STATUS_META, b as ConnectionDot, c as ConnectionDotProps, d as ConnectionStatus, e as ConnectionStatusMeta, f as ConnectionStatusPill, g as ConnectionStatusPillProps, D as DeviceFlowPhase, E as EnrollmentConsent, h as EnrollmentConsentMachine, i as EnrollmentConsentPhase, j as EnrollmentConsentProps, k as EnrollmentDeviceFlow, l as EnrollmentDeviceFlowProps, M as MACHINE_STATE_BADGE_META, m as MachineCard, n as MachineCardProps, o as MachineDockBar, p as MachineDockBarProps, q as MachineMetrics, r as MachineMetricsProps, s as MachineStateBadgeMeta, t as MachineStatusPill, u as MachineStatusPillProps, v as MachinesClientLike, w as MachinesDashboard, x as MachinesDashboardProps, O as OpenGeniContextValue, y as OpenGeniProvider, z as OpenGeniProviderProps, A as SharedMachineDisclosure, B as SharedMachineDisclosureProps, U as UseMachinesOptions, F as UseMachinesResult, G as connectionStatusForState, H as useMachines, I as useOpenGeni, J as useOpenGeniClient } from './machines-BD6h9P_s.js';
1
+ import { C as ClientOverride, S as SessionClientLike } from './machines-BeZ3bD3t.js';
2
+ export { a as CONNECTION_STATUS_META, b as ConnectionDot, c as ConnectionDotProps, d as ConnectionStatus, e as ConnectionStatusMeta, f as ConnectionStatusPill, g as ConnectionStatusPillProps, D as DeviceFlowPhase, E as EnrollmentConsent, h as EnrollmentConsentMachine, i as EnrollmentConsentPhase, j as EnrollmentConsentProps, k as EnrollmentDeviceFlow, l as EnrollmentDeviceFlowProps, M as MACHINE_STATE_BADGE_META, m as MachineCard, n as MachineCardProps, o as MachineDockBar, p as MachineDockBarProps, q as MachineMetrics, r as MachineMetricsProps, s as MachineStateBadgeMeta, t as MachineStatusPill, u as MachineStatusPillProps, v as MachinesClientLike, w as MachinesDashboard, x as MachinesDashboardProps, O as OpenGeniContextValue, y as OpenGeniProvider, z as OpenGeniProviderProps, A as SharedMachineDisclosure, B as SharedMachineDisclosureProps, U as UseMachinesOptions, F as UseMachinesResult, G as connectionStatusForState, H as useMachines, I as useOpenGeni, J as useOpenGeniClient } from './machines-BeZ3bD3t.js';
3
3
  import { SessionEvent, Session, ResourceRef, ToolRef, SessionStatus as SessionStatus$1, GitFileDiff, StreamConnectionState, SendMessageInput, FileAsset, FileResourceRef, SessionTurn, UpdateSessionTurnRequest, SessionGoal, ScheduledTask, WorkspaceEnvironment, CreateWorkspaceEnvironmentRequest, UpdateWorkspaceEnvironmentRequest, WorkspaceEnvironmentVariableMetadata, CapabilityPack, PackInstallation, RegisterCapabilityPackRequest, WorkspaceRegisteredPack, EnablePackRequest, Workspace, CreateWorkspaceRequest, UpdateWorkspaceRequest, BillingBalance, UsageEvent, ClientModel, SessionCapabilities, DesktopStreamCapability, DesktopConnectionState, DesktopRfbFactory, TerminalCapability, FsReadResponse, FsWriteResponse, Permission, CapabilityUnavailableReason, CodexAccountsResponse, CodexAccount, CodexRotationSettings } from '@opengeni/sdk';
4
4
  export { MachineKind, MachineMetricsSeriesResponse, MachineState, MachineView, MachinesResponse, MetricSample } from '@opengeni/sdk';
5
5
  import * as react from 'react';
@@ -488,8 +488,10 @@ declare function unwrapMcpOutput(output: unknown): {
488
488
 
489
489
  type SessionEventsConnectionState = StreamConnectionState | "idle" | "ended" | "error";
490
490
  type UseSessionEventsOptions = ClientOverride & {
491
- /** Resume after this sequence (exclusive). Defaults to 0 = full replay. */
491
+ /** Resume after this sequence (exclusive). Nonzero keeps full replay/resume semantics. */
492
492
  after?: number | undefined;
493
+ /** Load a bounded tail by default, or opt back into full replay from `after`. */
494
+ replay?: "windowed" | "full" | undefined;
493
495
  /** Pause the stream without unmounting (e.g. hidden tab). Defaults to true. */
494
496
  enabled?: boolean | undefined;
495
497
  };
@@ -503,12 +505,18 @@ type UseSessionEventsResult = {
503
505
  connectionState: SessionEventsConnectionState;
504
506
  /** Highest sequence seen so far (0 before the first event). */
505
507
  lastSequence: number;
508
+ /** Whether older durable events are available before the current window. */
509
+ hasOlder: boolean;
510
+ /** True while an older window is being fetched. */
511
+ loadingOlder: boolean;
512
+ /** Prepend an older density-bounded window; resolves true when more remain. */
513
+ loadOlder: () => Promise<boolean>;
506
514
  error: Error | null;
507
515
  };
508
516
  /**
509
517
  * Live-stream a session's event log with replay-by-sequence, reconnect, and
510
- * batched React updates. The SDK guarantees ordered, gap-free, exactly-once
511
- * delivery; this hook accumulates the log and projects it into a timeline.
518
+ * batched React updates. Fresh loads default to a bounded tail window; pass
519
+ * `replay: "full"` or a nonzero `after` for the previous full replay path.
512
520
  */
513
521
  declare function useSessionEvents(sessionId: string | null | undefined, options?: UseSessionEventsOptions): UseSessionEventsResult;
514
522
 
@@ -554,6 +562,13 @@ type ComposerState = {
554
562
  * `clientEventId` so retries stay idempotent server-side.
555
563
  */
556
564
  declare function useComposer(sessionId: string | null | undefined, options?: UseComposerOptions): ComposerState;
565
+ /**
566
+ * Default text for a file-only message (attachment(s) present, no typed draft).
567
+ * Kept non-empty so the wire contract (`text: z.string().min(1)`) and the
568
+ * worker's non-whitespace guard accept it; the attached files still ride in
569
+ * `resources`. Exported for tests.
570
+ */
571
+ declare const FILE_ONLY_MESSAGE_TEXT = "(see attached files)";
557
572
  /**
558
573
  * Merge the draft text + idempotency key with caller-provided extras. The
559
574
  * text and clientEventId always win over extras. Exported for tests.
@@ -605,6 +620,11 @@ type UseFileAttachmentsResult = {
605
620
  addFromPaste: (event: {
606
621
  clipboardData: DataTransfer | null;
607
622
  }) => void;
623
+ /**
624
+ * Re-run the upload for a `failed` attachment, in place (same id, same
625
+ * source file). No-op for an id that isn't a known failed upload.
626
+ */
627
+ retry: (id: string) => void;
608
628
  /** Remove one attachment; revokes its object-URL. */
609
629
  remove: (id: string) => void;
610
630
  /** Remove all; revokes every object-URL. Call from `useComposer`'s `onSent`. */
@@ -1587,6 +1607,12 @@ type MessageTimelineProps = {
1587
1607
  toolRegistry?: ToolRegistry | undefined;
1588
1608
  /** Follow new events when pinned to the bottom. Defaults to true. */
1589
1609
  autoFollow?: boolean | undefined;
1610
+ /** Older durable history exists above the current window (see useSessionEvents). */
1611
+ hasOlder?: boolean | undefined;
1612
+ /** An older window is being fetched; shows the quiet top shimmer. */
1613
+ loadingOlder?: boolean | undefined;
1614
+ /** Called when the reader nears the top and older history should backfill. */
1615
+ onLoadOlder?: (() => void) | undefined;
1590
1616
  emptyState?: ReactNode | undefined;
1591
1617
  className?: string | undefined;
1592
1618
  };
@@ -1596,7 +1622,7 @@ type MessageTimelineProps = {
1596
1622
  * cards, goal markers, and status transitions. Owns stick-to-bottom scrolling
1597
1623
  * with a "jump to latest" affordance when the reader scrolls back.
1598
1624
  */
1599
- declare function MessageTimeline({ events, items, status, renderMessageText, onOpenSession, toolRegistry, autoFollow, emptyState, className, }: MessageTimelineProps): react_jsx_runtime.JSX.Element;
1625
+ declare function MessageTimeline({ events, items, status, renderMessageText, onOpenSession, toolRegistry, autoFollow, hasOlder, loadingOlder, onLoadOlder, emptyState, className, }: MessageTimelineProps): react_jsx_runtime.JSX.Element;
1600
1626
  /**
1601
1627
  * Render one non-activity timeline item (chat message, status divider, goal
1602
1628
  * landmark, notice). Exported so the component demo draws the EXACT same rows as
@@ -2106,8 +2132,8 @@ declare function useCodexAccounts(options?: UseCodexAccountsOptions): UseCodexAc
2106
2132
  declare function gitFileDiffToPatch(file: GitFileDiff): string;
2107
2133
 
2108
2134
  /**
2109
- * Derive an xterm `ITheme` subset from the live OKLCH `--og-*` token system (or
2110
- * the app's `--color-*` aliases). Reads the COMPUTED values so xterm — which
2135
+ * Derive an xterm `ITheme` subset from the live OKLCH `--og-*` token system.
2136
+ * Reads the COMPUTED values so xterm — which
2111
2137
  * paints into a canvas and can't consume CSS vars — gets concrete colors. Call
2112
2138
  * on mount and re-derive on a `data-og-theme` flip.
2113
2139
  *
@@ -2128,5 +2154,15 @@ declare function truncate(text: string, maxLength: number): string;
2128
2154
  declare function stringifyPayload(value: unknown): string;
2129
2155
  /** JSON.parse that returns `undefined` instead of throwing. */
2130
2156
  declare function tryParseJson(text: string): unknown;
2157
+ /**
2158
+ * Humanize engine/provider failure text before it reaches the timeline or a
2159
+ * failure banner. Raw provider errors leak the wrong audience's instructions —
2160
+ * "Incorrect API key … find your API key at platform.openai.com" tells a
2161
+ * managed-deployment USER to fix credentials only an OPERATOR controls (and is
2162
+ * flatly wrong for Azure or subscription-backed engines). Auth and quota
2163
+ * failures collapse to one neutral, honest sentence; every other reason passes
2164
+ * through untouched. Raw payloads stay available in the debug surfaces.
2165
+ */
2166
+ declare function humanizeFailureReason(reason: string | null): string | null;
2131
2167
 
2132
- export { ActivityDisclosure, type ActivityDisclosureProps, type ActivityItem, ActivityRail, type ActivityRailProps, type AgentMessageItem, type ApplyPatchOperation, BodyNote, ChatComposer, type ChatComposerProps, ClientOverride, CodeEditor, type CodeEditorProps, type CodexAccountsClientLike, type CommandContext, CommandPalette, type CommandPaletteProps, type CommandResult, type ComposerMode, type ComposerSendExtras, type ComposerState, type ConfirmState, type CreateToolRegistryOptions, DesktopViewer, type DesktopViewerProps, type DesktopWebSocketFactory, type DesktopWebSocketLike, type DiffTheme, DiffView, type DiffViewProps, type DisclosureChip, DisclosureDefaultsProvider, type FileAttachment, FileBrowser, type FileBrowserProps, type FileTreeNode, type FileTreeStatus, FleetTile, type FleetTileProps, type GoalItem, LightboxProvider, Markdown, type MarkdownProps, MediaEmpty, MediaSkeleton, MessageTimeline, type MessageTimelineProps, ModelPicker, type ModelPickerProps, type Notice, type NoticeItem, type ParsedCommandLine, PayloadBlock, type PendingApproval, PierreDiff, type PierreDiffProps, PierreFile, type PierreFileProps, type ReasoningItem, SESSION_STATUS_META, SandboxFiles, type SandboxFilesProps, type SandboxItem, SandboxTerminal, type SandboxTerminalProps, ScreenshotFigure, type SessionCapabilitiesState, SessionClientLike, type SessionEventsConnectionState, SessionStatus, type SessionStatusItem, type SessionStatusMeta, type SessionStatusProps, type SlashArg, type SlashCommand, type SlashCommandContext, type SlashCommandHandlers, StatusDot, type StatusDotProps, TermBlock, type TerminalChunk, type TerminalStreamStatus, Thumbnail, type TimelineGroup, type TimelineItem, TimelineRow, type ToolCallItem, type ToolRegistry, type ToolRegistryEntry, type ToolRenderer, type ToolRendererProps, type TurnEndItem, type TurnOutcome, TurnSummary, type TurnSummaryProps, type UseAvailableModelsOptions, type UseAvailableModelsResult, type UseBillingUsageOptions, type UseBillingUsageResult, type UseCodexAccountsOptions, type UseCodexAccountsResult, type UseComposerOptions, type UseDesktopStreamOptions, type UseDesktopStreamResult, type UseEnvironmentsOptions, type UseEnvironmentsResult, type UseFileAttachmentsOptions, type UseFileAttachmentsResult, type UseGoalOptions, type UseGoalResult, type UsePacksOptions, type UsePacksResult, type UseRelayFrameStreamOptions, type UseRelayFrameStreamResult, type UseSandboxFilesOptions, type UseSandboxFilesResult, type UseSandboxGitOptions, type UseSandboxGitResult, type UseSandboxTerminalOptions, type UseSandboxTerminalResult, type UseScheduledTasksOptions, type UseScheduledTasksResult, type UseSessionCapabilitiesOptions, type UseSessionCapabilitiesResult, type UseSessionControlOptions, type UseSessionControlResult, type UseSessionEventsOptions, type UseSessionEventsResult, type UseSessionOptions, type UseSessionResult, type UseSlashCommandsOptions, type UseSlashCommandsResult, type UseTerminalStreamOptions, type UseTerminalStreamResult, type UseTurnQueueOptions, type UseTurnQueueResult, type UseWorkspaceSessionsOptions, type UseWorkspaceSessionsResult, type UseWorkspacesOptions, type UseWorkspacesResult, type UserMessageItem, type WorkerItem, WorkspaceDock, type WorkspaceDockProps, type WorkspaceTab, type XtermTheme, activeTurnFromTurns, applyPatchOps, applyTurnEdit, applyTurnRemoval, applyTurnReorder, approvalsFromRequiresAction, argHint, buildTimeline, cn, composeSendInput, controlCaret, createDefaultToolRegistry, createToolRegistry, defaultCommands, defaultToolRegistry, execTruncated, extractSessionRef, filterCommands, firstMissingRequiredArg, formatBytes, formatRelativeTime, gitFileDiffToPatch, groupTimeline, hasPermission, isApplyPatch, isCodexAccountEvent, isExecSessionLostBanner, isGoalEvent, isTitleEvent, isTurnQueueEvent, languageForPath, looksBinary, matchCommand, parseCommandLine, parseExecBannerSessionId, parseToolArgs, projectPendingApprovals, queueFromTurns, rawTypeOf, redactSecrets, sandboxCommandExitCode, sessionDisplayTitle, sessionStatusFromEvents, shouldSubmitOnKey, stringifyPayload, stripExecBanner, tailPeek, toolDisplayName, truncate, tryParseJson, unwrapMcpOutput, useAvailableModels, useBillingUsage, useCodexAccounts, useComposer, useDesktopStream, useEnvironments, useFileAttachments, useGoal, useLightbox, useLightboxOptional, usePacks, useRelayFrameStream, useSandboxFiles, useSandboxGit, useSandboxTerminal, useScheduledTasks, useSession, useSessionCapabilities, useSessionControl, useSessionEvents, useSlashCommands, useTerminalStream, useTurnQueue, useWorkspaceSessions, useWorkspaces, v4aToGitFileDiff, xtermThemeFromTokens };
2168
+ export { ActivityDisclosure, type ActivityDisclosureProps, type ActivityItem, ActivityRail, type ActivityRailProps, type AgentMessageItem, type ApplyPatchOperation, BodyNote, ChatComposer, type ChatComposerProps, ClientOverride, CodeEditor, type CodeEditorProps, type CodexAccountsClientLike, type CommandContext, CommandPalette, type CommandPaletteProps, type CommandResult, type ComposerMode, type ComposerSendExtras, type ComposerState, type ConfirmState, type CreateToolRegistryOptions, DesktopViewer, type DesktopViewerProps, type DesktopWebSocketFactory, type DesktopWebSocketLike, type DiffTheme, DiffView, type DiffViewProps, type DisclosureChip, DisclosureDefaultsProvider, FILE_ONLY_MESSAGE_TEXT, type FileAttachment, FileBrowser, type FileBrowserProps, type FileTreeNode, type FileTreeStatus, FleetTile, type FleetTileProps, type GoalItem, LightboxProvider, Markdown, type MarkdownProps, MediaEmpty, MediaSkeleton, MessageTimeline, type MessageTimelineProps, ModelPicker, type ModelPickerProps, type Notice, type NoticeItem, type ParsedCommandLine, PayloadBlock, type PendingApproval, PierreDiff, type PierreDiffProps, PierreFile, type PierreFileProps, type ReasoningItem, SESSION_STATUS_META, SandboxFiles, type SandboxFilesProps, type SandboxItem, SandboxTerminal, type SandboxTerminalProps, ScreenshotFigure, type SessionCapabilitiesState, SessionClientLike, type SessionEventsConnectionState, SessionStatus, type SessionStatusItem, type SessionStatusMeta, type SessionStatusProps, type SlashArg, type SlashCommand, type SlashCommandContext, type SlashCommandHandlers, StatusDot, type StatusDotProps, TermBlock, type TerminalChunk, type TerminalStreamStatus, Thumbnail, type TimelineGroup, type TimelineItem, TimelineRow, type ToolCallItem, type ToolRegistry, type ToolRegistryEntry, type ToolRenderer, type ToolRendererProps, type TurnEndItem, type TurnOutcome, TurnSummary, type TurnSummaryProps, type UseAvailableModelsOptions, type UseAvailableModelsResult, type UseBillingUsageOptions, type UseBillingUsageResult, type UseCodexAccountsOptions, type UseCodexAccountsResult, type UseComposerOptions, type UseDesktopStreamOptions, type UseDesktopStreamResult, type UseEnvironmentsOptions, type UseEnvironmentsResult, type UseFileAttachmentsOptions, type UseFileAttachmentsResult, type UseGoalOptions, type UseGoalResult, type UsePacksOptions, type UsePacksResult, type UseRelayFrameStreamOptions, type UseRelayFrameStreamResult, type UseSandboxFilesOptions, type UseSandboxFilesResult, type UseSandboxGitOptions, type UseSandboxGitResult, type UseSandboxTerminalOptions, type UseSandboxTerminalResult, type UseScheduledTasksOptions, type UseScheduledTasksResult, type UseSessionCapabilitiesOptions, type UseSessionCapabilitiesResult, type UseSessionControlOptions, type UseSessionControlResult, type UseSessionEventsOptions, type UseSessionEventsResult, type UseSessionOptions, type UseSessionResult, type UseSlashCommandsOptions, type UseSlashCommandsResult, type UseTerminalStreamOptions, type UseTerminalStreamResult, type UseTurnQueueOptions, type UseTurnQueueResult, type UseWorkspaceSessionsOptions, type UseWorkspaceSessionsResult, type UseWorkspacesOptions, type UseWorkspacesResult, type UserMessageItem, type WorkerItem, WorkspaceDock, type WorkspaceDockProps, type WorkspaceTab, type XtermTheme, activeTurnFromTurns, applyPatchOps, applyTurnEdit, applyTurnRemoval, applyTurnReorder, approvalsFromRequiresAction, argHint, buildTimeline, cn, composeSendInput, controlCaret, createDefaultToolRegistry, createToolRegistry, defaultCommands, defaultToolRegistry, execTruncated, extractSessionRef, filterCommands, firstMissingRequiredArg, formatBytes, formatRelativeTime, gitFileDiffToPatch, groupTimeline, hasPermission, humanizeFailureReason, isApplyPatch, isCodexAccountEvent, isExecSessionLostBanner, isGoalEvent, isTitleEvent, isTurnQueueEvent, languageForPath, looksBinary, matchCommand, parseCommandLine, parseExecBannerSessionId, parseToolArgs, projectPendingApprovals, queueFromTurns, rawTypeOf, redactSecrets, sandboxCommandExitCode, sessionDisplayTitle, sessionStatusFromEvents, shouldSubmitOnKey, stringifyPayload, stripExecBanner, tailPeek, toolDisplayName, truncate, tryParseJson, unwrapMcpOutput, useAvailableModels, useBillingUsage, useCodexAccounts, useComposer, useDesktopStream, useEnvironments, useFileAttachments, useGoal, useLightbox, useLightboxOptional, usePacks, useRelayFrameStream, useSandboxFiles, useSandboxGit, useSandboxTerminal, useScheduledTasks, useSession, useSessionCapabilities, useSessionControl, useSessionEvents, useSlashCommands, useTerminalStream, useTurnQueue, useWorkspaceSessions, useWorkspaces, v4aToGitFileDiff, xtermThemeFromTokens };