@opengeni/react 3.1.0 → 3.3.2-canary.1

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 (73) hide show
  1. package/dist/accounts.js +87 -11
  2. package/dist/accounts.js.map +1 -1
  3. package/dist/{browser-viewer-AEFHUYZK.js → browser-viewer-MKKFRRRV.js} +3 -3
  4. package/dist/{chunk-YFKJ7VZH.js → chunk-7EAFGICR.js} +45 -11
  5. package/dist/chunk-7EAFGICR.js.map +1 -0
  6. package/dist/{chunk-W6NFJXSA.js → chunk-7KBJLTKS.js} +52 -12
  7. package/dist/chunk-7KBJLTKS.js.map +1 -0
  8. package/dist/{chunk-YJFGAFBD.js → chunk-E5KISKFG.js} +241 -97
  9. package/dist/chunk-E5KISKFG.js.map +1 -0
  10. package/dist/{chunk-MZ2G2XBA.js → chunk-IOLVN74D.js} +31 -4
  11. package/dist/chunk-IOLVN74D.js.map +1 -0
  12. package/dist/{chunk-D3UIAJKY.js → chunk-JAQ5K7W6.js} +3 -2
  13. package/dist/{chunk-D3UIAJKY.js.map → chunk-JAQ5K7W6.js.map} +1 -1
  14. package/dist/{chunk-LAKLF4PA.js → chunk-VTOREEXF.js} +8 -7
  15. package/dist/chunk-VTOREEXF.js.map +1 -0
  16. package/dist/{chunk-X4A66EWZ.js → chunk-X5S426G2.js} +38 -44
  17. package/dist/chunk-X5S426G2.js.map +1 -0
  18. package/dist/{chunk-HQVCKCLG.js → chunk-YG4QEQF5.js} +354 -255
  19. package/dist/chunk-YG4QEQF5.js.map +1 -0
  20. package/dist/{chunk-XXWH2JLC.js → chunk-YVCHAQZY.js} +2 -2
  21. package/dist/{chunk-RGALCTWO.js → chunk-ZKNTK7IA.js} +13 -9
  22. package/dist/{chunk-RGALCTWO.js.map → chunk-ZKNTK7IA.js.map} +1 -1
  23. package/dist/{chunk-OAM4WAAM.js → chunk-ZPBTI3TE.js} +2 -2
  24. package/dist/components/fleet-tile.d.ts +2 -2
  25. package/dist/components/model-policy-picker.d.ts +9 -0
  26. package/dist/components/tip-follow.d.ts +16 -0
  27. package/dist/composer.js +6 -6
  28. package/dist/hooks/use-file-attachments.d.ts +2 -0
  29. package/dist/hooks/use-session-events.d.ts +3 -3
  30. package/dist/index.js +77 -69
  31. package/dist/index.js.map +1 -1
  32. package/dist/interaction.js +2 -2
  33. package/dist/machines.js +2 -2
  34. package/dist/model-policy.d.ts +2 -1
  35. package/dist/model-policy.js +1 -1
  36. package/dist/realtime.js +47 -8
  37. package/dist/realtime.js.map +1 -1
  38. package/dist/session-ui.js +4 -4
  39. package/dist/session.js +4 -4
  40. package/dist/timeline/entrance.d.ts +13 -1
  41. package/package.json +3 -2
  42. package/src/accounts.tsx +116 -14
  43. package/src/components/composer.tsx +15 -5
  44. package/src/components/fleet-tile.tsx +4 -15
  45. package/src/components/message-timeline.tsx +237 -101
  46. package/src/components/model-policy-picker.tsx +59 -13
  47. package/src/components/tip-follow.ts +52 -0
  48. package/src/components/tooltip.tsx +38 -5
  49. package/src/hooks/use-available-models.ts +20 -14
  50. package/src/hooks/use-composer.ts +49 -3
  51. package/src/hooks/use-file-attachments.ts +28 -2
  52. package/src/hooks/use-goal.ts +31 -7
  53. package/src/hooks/use-last-started-turn-policy.ts +11 -5
  54. package/src/hooks/use-session-events.ts +186 -61
  55. package/src/hooks/use-session-lineage.ts +20 -16
  56. package/src/hooks/use-session.ts +23 -19
  57. package/src/hooks/use-workspace-sessions.ts +31 -27
  58. package/src/lib/format.ts +8 -6
  59. package/src/model-policy.ts +45 -54
  60. package/src/realtime/realtime-control.tsx +55 -6
  61. package/src/timeline/entrance.tsx +28 -3
  62. package/src/timeline/projection.ts +4 -0
  63. package/styles/compiled.css +5 -0
  64. package/dist/chunk-HQVCKCLG.js.map +0 -1
  65. package/dist/chunk-LAKLF4PA.js.map +0 -1
  66. package/dist/chunk-MZ2G2XBA.js.map +0 -1
  67. package/dist/chunk-W6NFJXSA.js.map +0 -1
  68. package/dist/chunk-X4A66EWZ.js.map +0 -1
  69. package/dist/chunk-YFKJ7VZH.js.map +0 -1
  70. package/dist/chunk-YJFGAFBD.js.map +0 -1
  71. /package/dist/{browser-viewer-AEFHUYZK.js.map → browser-viewer-MKKFRRRV.js.map} +0 -0
  72. /package/dist/{chunk-XXWH2JLC.js.map → chunk-YVCHAQZY.js.map} +0 -0
  73. /package/dist/{chunk-OAM4WAAM.js.map → chunk-ZPBTI3TE.js.map} +0 -0
@@ -26,7 +26,7 @@ import {
26
26
  } from "./chunk-JVYQRRC4.js";
27
27
  import {
28
28
  formatBytes
29
- } from "./chunk-LAKLF4PA.js";
29
+ } from "./chunk-VTOREEXF.js";
30
30
  import {
31
31
  cn
32
32
  } from "./chunk-22KP6LR5.js";
@@ -3904,4 +3904,4 @@ export {
3904
3904
  useSiteAuthConnections,
3905
3905
  BrowserViewer
3906
3906
  };
3907
- //# sourceMappingURL=chunk-OAM4WAAM.js.map
3907
+ //# sourceMappingURL=chunk-ZPBTI3TE.js.map
@@ -1,7 +1,7 @@
1
- import type { Session } from "@opengeni/sdk";
1
+ import { type Session } from "@opengeni/sdk";
2
2
  export type FleetTileProps = {
3
3
  session: Session;
4
- /** Overrides the derived title (session title, metadata title/name, or safe fallback). */
4
+ /** Overrides the derived title (durable title, metadata, prompt preview, or safe fallback). */
5
5
  title?: string | undefined;
6
6
  /** Extra line under the title — e.g. "drift check" or the worker's task. */
7
7
  subtitle?: string | undefined;
@@ -1,6 +1,7 @@
1
1
  import type { ClientModel, LatencyMode, ReasoningEffort } from "@opengeni/sdk";
2
2
  import { type CSSProperties, type ReactNode } from "react";
3
3
  import { type PickerBillingClass, type PickerModelRow } from "../model-policy.js";
4
+ type ClientPickerModelRow = PickerModelRow<ClientModel>;
4
5
  type NavLevel = "providers" | "models" | "thinking";
5
6
  type PickerNavState = {
6
7
  level: NavLevel;
@@ -85,5 +86,13 @@ export declare function ModelPolicyPickerMenu(props: ModelPolicyPickerProps & {
85
86
  nav?: PickerNavState | undefined;
86
87
  onNavChange?: ((next: NavUpdater) => void) | undefined;
87
88
  }): import("react").JSX.Element;
89
+ /** @internal Shared state seam kept outside the Radix portal for deterministic testing. */
90
+ export declare function useModelPolicyPickerState(props: ModelPolicyPickerProps): {
91
+ open: boolean;
92
+ setOpen: (next: boolean) => void;
93
+ rows: ClientPickerModelRow[];
94
+ nav: PickerNavState;
95
+ setNav: (next: NavUpdater) => void;
96
+ };
88
97
  export declare function ModelPolicyPicker(props: ModelPolicyPickerProps): import("react").JSX.Element;
89
98
  export {};
@@ -160,6 +160,22 @@ export declare function tipFollowClearSoftRise(el: HTMLElement): void;
160
160
  * on screen: scrollTop -= Δh, clamped to the new max.
161
161
  */
162
162
  export declare function tipFollowCompensateShrink(scrollTop: number, previousHeight: number, nextHeight: number, clientHeight: number, epsPx?: number): number;
163
+ export type TipFollowContentShrinkBaseline = {
164
+ scrollHeight: number;
165
+ scrollTop: number;
166
+ };
167
+ export type TipFollowContentShrinkObservation = {
168
+ baseline: TipFollowContentShrinkBaseline | null;
169
+ compensatedScrollTop: number | null;
170
+ };
171
+ /**
172
+ * Retain the geometry from the first sub-epsilon content-shrink frame until
173
+ * the cumulative collapse crosses the deadband. Browsers may clamp scrollTop
174
+ * after every tiny frame, so compensating from the latest DOM top would count
175
+ * those already-applied clamps twice and make the result animation-cadence
176
+ * dependent.
177
+ */
178
+ export declare function tipFollowObserveContentShrink(baseline: TipFollowContentShrinkBaseline | null, previousHeight: number, previousScrollTop: number, nextHeight: number, clientHeight: number, epsPx?: number): TipFollowContentShrinkObservation;
163
179
  /**
164
180
  * Viewport shrank (SessionChrome / composer / window). maxScroll rises by ≈Δc;
165
181
  * keep the same tip distance: scrollTop += Δc. Without this, pinned follow only
package/dist/composer.js CHANGED
@@ -37,8 +37,8 @@ import {
37
37
  useChatComposer,
38
38
  useChatComposerController,
39
39
  useVoiceInput
40
- } from "./chunk-RGALCTWO.js";
41
- import "./chunk-MZ2G2XBA.js";
40
+ } from "./chunk-ZKNTK7IA.js";
41
+ import "./chunk-IOLVN74D.js";
42
42
  import {
43
43
  BillingClassMark,
44
44
  ModelPolicyPicker,
@@ -47,13 +47,13 @@ import {
47
47
  PickerBackHeader,
48
48
  PickerNavRow,
49
49
  defaultModelPolicyPickerMessages
50
- } from "./chunk-W6NFJXSA.js";
51
- import "./chunk-X4A66EWZ.js";
52
- import "./chunk-YFKJ7VZH.js";
50
+ } from "./chunk-7KBJLTKS.js";
51
+ import "./chunk-X5S426G2.js";
52
+ import "./chunk-7EAFGICR.js";
53
53
  import "./chunk-VZTQ73XT.js";
54
54
  import "./chunk-KZ73RL76.js";
55
55
  import "./chunk-NEXLLTP4.js";
56
- import "./chunk-LAKLF4PA.js";
56
+ import "./chunk-VTOREEXF.js";
57
57
  import "./chunk-22KP6LR5.js";
58
58
  export {
59
59
  Actions,
@@ -20,6 +20,8 @@ export type FileAttachment = {
20
20
  file?: FileAsset | undefined;
21
21
  /** Object-URL for an inline preview; minted for `image/*` files only. */
22
22
  previewUrl?: string | undefined;
23
+ /** Stable SDK failure code for UI behavior that must not parse error copy. */
24
+ errorCode?: "secure_context_required" | undefined;
23
25
  error?: string | undefined;
24
26
  };
25
27
  export type UseFileAttachmentsResult = {
@@ -82,9 +82,9 @@ export declare function useSessionEvents(sessionId: string | null | undefined, o
82
82
  * accumulation retains the newest suffix; backward paging retains the oldest
83
83
  * prefix so newly fetched history cannot be immediately evicted. This is
84
84
  * deliberately separate from durable history and transport paging: when a
85
- * backward page evicts the live tail, the hook reconnects from the retained
86
- * high-water mark while preserving the highest-ever-observed sequence
87
- * separately. The source event remains durable in PostgreSQL throughout.
85
+ * backward page evicts the live tail, the hook enters bounded history mode and
86
+ * preserves the highest-ever-observed sequence separately for forward paging.
87
+ * The source event remains durable in PostgreSQL throughout.
88
88
  */
89
89
  export declare function boundBrowserSessionEventWindow(events: readonly SessionEvent[], options?: {
90
90
  maxBytes?: number;
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  useSessionLineage,
24
24
  useSessionMcpApprovalPolicy,
25
25
  useTurnQueue
26
- } from "./chunk-YJFGAFBD.js";
26
+ } from "./chunk-E5KISKFG.js";
27
27
  import {
28
28
  CONNECTION_STATUS_META,
29
29
  ConnectionDot,
@@ -55,7 +55,7 @@ import {
55
55
  healthPulses,
56
56
  pointsFor,
57
57
  useMachines
58
- } from "./chunk-XXWH2JLC.js";
58
+ } from "./chunk-YVCHAQZY.js";
59
59
  import {
60
60
  Actions,
61
61
  AttachButton,
@@ -108,14 +108,14 @@ import {
108
108
  useSlashCommands,
109
109
  useTranscription,
110
110
  useVoiceInput
111
- } from "./chunk-RGALCTWO.js";
111
+ } from "./chunk-ZKNTK7IA.js";
112
112
  import {
113
113
  FILE_ONLY_MESSAGE_TEXT,
114
114
  composeSendInput,
115
115
  shouldSteerOnKey,
116
116
  shouldSubmitOnKey,
117
117
  useComposer
118
- } from "./chunk-MZ2G2XBA.js";
118
+ } from "./chunk-IOLVN74D.js";
119
119
  import {
120
120
  BillingClassMark,
121
121
  ModelPolicyPicker,
@@ -124,7 +124,7 @@ import {
124
124
  PickerBackHeader,
125
125
  PickerNavRow,
126
126
  defaultModelPolicyPickerMessages
127
- } from "./chunk-W6NFJXSA.js";
127
+ } from "./chunk-7KBJLTKS.js";
128
128
  import {
129
129
  advancedSourceSummary,
130
130
  availabilityReasonLabel,
@@ -142,7 +142,7 @@ import {
142
142
  projectPickerRows,
143
143
  runnableLatencyModesForModel,
144
144
  sortPickerRows
145
- } from "./chunk-X4A66EWZ.js";
145
+ } from "./chunk-X5S426G2.js";
146
146
  import {
147
147
  ActivityDisclosure,
148
148
  ActivityRail,
@@ -201,7 +201,7 @@ import {
201
201
  useThemeType,
202
202
  userMessageLikelyNeedsDisclosure,
203
203
  v4aToGitFileDiff
204
- } from "./chunk-HQVCKCLG.js";
204
+ } from "./chunk-YG4QEQF5.js";
205
205
  import {
206
206
  buildTimeline,
207
207
  createOlderHistoryLoadReceipt,
@@ -212,7 +212,7 @@ import {
212
212
  projectPendingHumanInputRequests,
213
213
  sessionStatusFromEvents,
214
214
  toolDisplayName
215
- } from "./chunk-D3UIAJKY.js";
215
+ } from "./chunk-JAQ5K7W6.js";
216
216
  import {
217
217
  TimelineAnnotationsChip
218
218
  } from "./chunk-WSK7G5LE.js";
@@ -224,7 +224,7 @@ import {
224
224
  TooltipTrigger,
225
225
  useLightbox,
226
226
  useLightboxOptional
227
- } from "./chunk-YFKJ7VZH.js";
227
+ } from "./chunk-7EAFGICR.js";
228
228
  import {
229
229
  usePortalTokenSource,
230
230
  usePortalTokenStyle
@@ -268,7 +268,7 @@ import {
268
268
  stringifyPayload,
269
269
  truncate,
270
270
  tryParseJson
271
- } from "./chunk-LAKLF4PA.js";
271
+ } from "./chunk-VTOREEXF.js";
272
272
  import {
273
273
  cn
274
274
  } from "./chunk-22KP6LR5.js";
@@ -342,11 +342,17 @@ function policyFromTurn(turn) {
342
342
  function useLastStartedTurnPolicy(sessionId, options = {}) {
343
343
  const { client, workspaceId, workspaceControlEvent, registerSessionReconciler } = useOpenGeni(options);
344
344
  const enabled = (options.enabled ?? true) && Boolean(sessionId);
345
- const load = useCallback(async () => {
346
- if (!sessionId) return null;
347
- const turns = await client.listTurns(workspaceId, sessionId, { latestStarted: true });
348
- return policyFromTurn(turns[0]);
349
- }, [client, workspaceId, sessionId]);
345
+ const load = useCallback(
346
+ async (signal) => {
347
+ if (!sessionId) return null;
348
+ const turns = await client.listTurns(workspaceId, sessionId, {
349
+ latestStarted: true,
350
+ signal
351
+ });
352
+ return policyFromTurn(turns[0]);
353
+ },
354
+ [client, workspaceId, sessionId]
355
+ );
350
356
  const { data, loading, error, refresh } = usePolledValue(load, {
351
357
  pollIntervalMs: options.pollIntervalMs,
352
358
  enabled
@@ -426,34 +432,38 @@ function useWorkspaceSessions(options = {}) {
426
432
  useEffect2(() => {
427
433
  previousQueryKey.current = queryKey;
428
434
  }, [queryKey]);
429
- const load = useCallback3(async () => {
430
- const readGeneration = beginRead?.() ?? ++nextReadGeneration.current;
431
- const page2 = await client.listSessionPage(workspaceId, {
432
- ...limit !== void 0 ? { limit } : {},
433
- ...parentSessionId !== void 0 ? { parentSessionId } : {},
434
- ...cursor !== void 0 ? { cursor } : {},
435
- ...search !== void 0 ? { search } : {},
436
- ...pinsOnly ? { pinsOnly: true } : {},
437
- ...archivedOnly ? { archivedOnly: true } : {}
438
- });
439
- return {
440
- queryKey,
441
- page: page2,
442
- revision: ++nextReadRevision.current,
443
- readGeneration
444
- };
445
- }, [
446
- beginRead,
447
- client,
448
- workspaceId,
449
- limit,
450
- parentSessionId,
451
- cursor,
452
- search,
453
- pinsOnly,
454
- archivedOnly,
455
- queryKey
456
- ]);
435
+ const load = useCallback3(
436
+ async (signal) => {
437
+ const readGeneration = beginRead?.() ?? ++nextReadGeneration.current;
438
+ const page2 = await client.listSessionPage(workspaceId, {
439
+ ...limit !== void 0 ? { limit } : {},
440
+ ...parentSessionId !== void 0 ? { parentSessionId } : {},
441
+ ...cursor !== void 0 ? { cursor } : {},
442
+ ...search !== void 0 ? { search } : {},
443
+ ...pinsOnly ? { pinsOnly: true } : {},
444
+ ...archivedOnly ? { archivedOnly: true } : {},
445
+ signal
446
+ });
447
+ return {
448
+ queryKey,
449
+ page: page2,
450
+ revision: ++nextReadRevision.current,
451
+ readGeneration
452
+ };
453
+ },
454
+ [
455
+ beginRead,
456
+ client,
457
+ workspaceId,
458
+ limit,
459
+ parentSessionId,
460
+ cursor,
461
+ search,
462
+ pinsOnly,
463
+ archivedOnly,
464
+ queryKey
465
+ ]
466
+ );
457
467
  const state = usePolledValue(load, {
458
468
  pollIntervalMs: options.pollIntervalMs,
459
469
  enabled
@@ -1166,7 +1176,10 @@ function useBillingUsage(options = {}) {
1166
1176
  import { useCallback as useCallback11 } from "react";
1167
1177
  function useAvailableModels(options = {}) {
1168
1178
  const client = useOpenGeniClient(options);
1169
- const load = useCallback11(async () => await client.getClientConfig(), [client]);
1179
+ const load = useCallback11(
1180
+ async (signal) => await client.getClientConfig({ signal }),
1181
+ [client]
1182
+ );
1170
1183
  const state = usePolledValue(load, {
1171
1184
  pollIntervalMs: options.pollIntervalMs,
1172
1185
  enabled: options.enabled
@@ -1181,19 +1194,22 @@ function useAvailableModels(options = {}) {
1181
1194
  }
1182
1195
  function useWorkspaceModelCatalog(options) {
1183
1196
  const client = useOpenGeniClient(options);
1184
- const load = useCallback11(async () => {
1185
- if (!options.workspaceId) {
1186
- return { models: [], defaultModel: null };
1187
- }
1188
- const [catalog, config] = await Promise.all([
1189
- client.getWorkspaceModelCatalog(options.workspaceId),
1190
- client.getClientConfig()
1191
- ]);
1192
- return {
1193
- models: catalog.models,
1194
- defaultModel: config.defaultModel
1195
- };
1196
- }, [client, options.workspaceId]);
1197
+ const load = useCallback11(
1198
+ async (signal) => {
1199
+ if (!options.workspaceId) {
1200
+ return { models: [], defaultModel: null };
1201
+ }
1202
+ const [catalog, config] = await Promise.all([
1203
+ client.getWorkspaceModelCatalog(options.workspaceId, { signal }),
1204
+ client.getClientConfig({ signal })
1205
+ ]);
1206
+ return {
1207
+ models: catalog.models,
1208
+ defaultModel: config.defaultModel
1209
+ };
1210
+ },
1211
+ [client, options.workspaceId]
1212
+ );
1197
1213
  const state = usePolledValue(load, {
1198
1214
  pollIntervalMs: options.pollIntervalMs,
1199
1215
  enabled: options.enabled !== false && Boolean(options.workspaceId)
@@ -4118,19 +4134,11 @@ function ChatComposer({
4118
4134
  }
4119
4135
 
4120
4136
  // src/components/fleet-tile.tsx
4137
+ import { deriveSessionDisplayTitle } from "@opengeni/sdk";
4121
4138
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
4122
- var AUTOMATIC_SESSION_TITLE_FALLBACK = "New conversation";
4139
+ var SESSION_METADATA_TITLE_KEYS = ["title", "name"];
4123
4140
  function sessionDisplayTitle(session) {
4124
- if (typeof session.title === "string" && session.title.trim().length > 0) {
4125
- return session.title;
4126
- }
4127
- for (const key of ["title", "name"]) {
4128
- const value = session.metadata[key];
4129
- if (typeof value === "string" && value.trim().length > 0) {
4130
- return value;
4131
- }
4132
- }
4133
- return AUTOMATIC_SESSION_TITLE_FALLBACK;
4141
+ return deriveSessionDisplayTitle(session, { metadataKeys: SESSION_METADATA_TITLE_KEYS });
4134
4142
  }
4135
4143
  function FleetTile({ session, title, subtitle, onOpen, className }) {
4136
4144
  const running = session.status === "running" || session.status === "queued";
@@ -8423,7 +8431,7 @@ import {
8423
8431
  } from "lucide-react";
8424
8432
  import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
8425
8433
  var LazyBrowserViewer = lazy2(async () => {
8426
- const { BrowserViewer } = await import("./browser-viewer-AEFHUYZK.js");
8434
+ const { BrowserViewer } = await import("./browser-viewer-MKKFRRRV.js");
8427
8435
  return { default: BrowserViewer };
8428
8436
  });
8429
8437
  var LazyComputerViewer = lazy2(async () => {