@opengeni/react 0.6.3 → 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.
- package/README.md +17 -6
- package/dist/index.d.ts +20 -6
- package/dist/index.js +538 -218
- package/dist/index.js.map +1 -1
- package/dist/{machines-Bv9tG7qZ.d.ts → machines-BeZ3bD3t.d.ts} +1 -1
- package/dist/machines.d.ts +1 -1
- package/package.json +2 -2
- package/src/client.ts +1 -0
- package/src/components/message-timeline.tsx +144 -17
- package/src/hooks/use-session-events.ts +283 -8
- package/src/timeline/activity-rail.tsx +4 -1
- package/src/timeline/entrance.tsx +30 -0
- package/src/timeline/projection.ts +18 -3
- package/src/timeline/turn-summary.tsx +3 -1
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
|
|
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)` —
|
|
79
|
-
exactly-once/ordered event delivery
|
|
80
|
-
|
|
81
|
-
|
|
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-
|
|
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-
|
|
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).
|
|
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.
|
|
511
|
-
*
|
|
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
|
|
|
@@ -1599,6 +1607,12 @@ type MessageTimelineProps = {
|
|
|
1599
1607
|
toolRegistry?: ToolRegistry | undefined;
|
|
1600
1608
|
/** Follow new events when pinned to the bottom. Defaults to true. */
|
|
1601
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;
|
|
1602
1616
|
emptyState?: ReactNode | undefined;
|
|
1603
1617
|
className?: string | undefined;
|
|
1604
1618
|
};
|
|
@@ -1608,7 +1622,7 @@ type MessageTimelineProps = {
|
|
|
1608
1622
|
* cards, goal markers, and status transitions. Owns stick-to-bottom scrolling
|
|
1609
1623
|
* with a "jump to latest" affordance when the reader scrolls back.
|
|
1610
1624
|
*/
|
|
1611
|
-
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;
|
|
1612
1626
|
/**
|
|
1613
1627
|
* Render one non-activity timeline item (chat message, status divider, goal
|
|
1614
1628
|
* landmark, notice). Exported so the component demo draws the EXACT same rows as
|