@opengeni/react 0.6.3 → 0.9.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 CHANGED
@@ -53,12 +53,19 @@ import {
53
53
  const client = new OpenGeniClient({ baseUrl: "/api/opengeni" }); // proxy through your API
54
54
 
55
55
  function OpsChannel({ sessionId }: { sessionId: string }) {
56
- const { timeline, sessionStatus } = useSessionEvents(sessionId);
56
+ const { timeline, sessionStatus, hasOlder, loadingOlder, loadOlder } = useSessionEvents(sessionId);
57
57
  const composer = useComposer(sessionId);
58
58
  return (
59
59
  <div className="flex h-full flex-col">
60
60
  {sessionStatus ? <SessionStatus status={sessionStatus} /> : null}
61
- <MessageTimeline items={timeline} status={sessionStatus} className="min-h-0 flex-1" />
61
+ <MessageTimeline
62
+ items={timeline}
63
+ status={sessionStatus}
64
+ hasOlder={hasOlder}
65
+ loadingOlder={loadingOlder}
66
+ onLoadOlder={() => void loadOlder()}
67
+ className="min-h-0 flex-1"
68
+ />
62
69
  <ChatComposer composer={composer} status={sessionStatus} />
63
70
  </div>
64
71
  );
@@ -75,10 +82,14 @@ export function App() {
75
82
 
76
83
  ## Hooks
77
84
 
78
- - `useSessionEvents(sessionId)` — live stream + replay on the SDK's
79
- exactly-once/ordered event delivery; returns the raw `events`, the projected
80
- `timeline`, the latest `sessionStatus`, and the connection state. Updates are
81
- batched per animation-frame-ish window so long replays stay smooth.
85
+ - `useSessionEvents(sessionId)` — loads a compact, bounded tail window by
86
+ default, then live-streams on the SDK's exactly-once/ordered event delivery.
87
+ Initial replay is capped at three 5000-row raw pages and `loadOlder` at two;
88
+ timeline group density is only an early stop. It returns the raw windowed
89
+ `events`, projected `timeline`, latest `sessionStatus`, connection state, and
90
+ older-history controls (`hasOlder`, `loadingOlder`, `loadOlder`). Pass
91
+ `replay: "full"` to opt back into full replay; a nonzero `after` keeps the
92
+ previous resume semantics.
82
93
  - `useComposer(sessionId, { sendExtras, defaultMode })` — draft/send/interrupt
83
94
  state plus the compose-time **queue-vs-steer** choice (`mode`/`setMode`,
84
95
  default `"queue"`): queue stacks the message behind the running turn, steer
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ClientOverride, S as SessionClientLike } from './machines-Bv9tG7qZ.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-Bv9tG7qZ.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,20 @@ type UseSessionEventsResult = {
503
505
  connectionState: SessionEventsConnectionState;
504
506
  /** Highest sequence seen so far (0 before the first event). */
505
507
  lastSequence: number;
508
+ /** True until the initial tail window has been applied (windowed mode). */
509
+ initialLoading: boolean;
510
+ /** Whether older durable events are available before the current window. */
511
+ hasOlder: boolean;
512
+ /** True while an older window is being fetched. */
513
+ loadingOlder: boolean;
514
+ /** Prepend an older density-bounded window; resolves true when more remain. */
515
+ loadOlder: () => Promise<boolean>;
506
516
  error: Error | null;
507
517
  };
508
518
  /**
509
519
  * 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.
520
+ * batched React updates. Fresh loads default to a bounded tail window; pass
521
+ * `replay: "full"` or a nonzero `after` for the previous full replay path.
512
522
  */
513
523
  declare function useSessionEvents(sessionId: string | null | undefined, options?: UseSessionEventsOptions): UseSessionEventsResult;
514
524
 
@@ -931,8 +941,9 @@ type UseSessionCapabilitiesOptions = ClientOverride & {
931
941
  warmingPollMs?: number | undefined;
932
942
  /**
933
943
  * Give up waiting for `warm` after this long while polling (ms) and surface a
934
- * stalled error with a manual `renegotiate`. Default 30000 (must agree with
935
- * the lease warming TTL I15). 0 disables the deadline.
944
+ * stalled error with a manual `renegotiate`. Default 30000. This is a UI
945
+ * patience deadline, independent from the worker's sandbox warming timeout.
946
+ * 0 disables the deadline.
936
947
  */
937
948
  warmingDeadlineMs?: number | undefined;
938
949
  };
@@ -1599,6 +1610,12 @@ type MessageTimelineProps = {
1599
1610
  toolRegistry?: ToolRegistry | undefined;
1600
1611
  /** Follow new events when pinned to the bottom. Defaults to true. */
1601
1612
  autoFollow?: boolean | undefined;
1613
+ /** Older durable history exists above the current window (see useSessionEvents). */
1614
+ hasOlder?: boolean | undefined;
1615
+ /** An older window is being fetched; shows the quiet top shimmer. */
1616
+ loadingOlder?: boolean | undefined;
1617
+ /** Called when the reader nears the top and older history should backfill. */
1618
+ onLoadOlder?: (() => void) | undefined;
1602
1619
  emptyState?: ReactNode | undefined;
1603
1620
  className?: string | undefined;
1604
1621
  };
@@ -1608,7 +1625,7 @@ type MessageTimelineProps = {
1608
1625
  * cards, goal markers, and status transitions. Owns stick-to-bottom scrolling
1609
1626
  * with a "jump to latest" affordance when the reader scrolls back.
1610
1627
  */
1611
- declare function MessageTimeline({ events, items, status, renderMessageText, onOpenSession, toolRegistry, autoFollow, emptyState, className, }: MessageTimelineProps): react_jsx_runtime.JSX.Element;
1628
+ declare function MessageTimeline({ events, items, status, renderMessageText, onOpenSession, toolRegistry, autoFollow, hasOlder, loadingOlder, onLoadOlder, emptyState, className, }: MessageTimelineProps): react_jsx_runtime.JSX.Element;
1612
1629
  /**
1613
1630
  * Render one non-activity timeline item (chat message, status divider, goal
1614
1631
  * landmark, notice). Exported so the component demo draws the EXACT same rows as