@opengeni/react 7.6.1 → 7.7.0-canary.37111190284001

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 (145) hide show
  1. package/README.md +47 -2
  2. package/dist/{browser-viewer-5X47I6T2.js → browser-viewer-63TXMINB.js} +6 -5
  3. package/dist/{chunk-5EXGU7UF.js → chunk-55DDDVKU.js} +3 -3
  4. package/dist/{chunk-UINDK6C3.js → chunk-7CYYXWHU.js} +5 -8
  5. package/dist/chunk-7CYYXWHU.js.map +1 -0
  6. package/dist/{chunk-LZ3KHA55.js → chunk-A2L5N3EI.js} +332 -339
  7. package/dist/chunk-A2L5N3EI.js.map +1 -0
  8. package/dist/{chunk-KGENSZKS.js → chunk-AAG4R3QN.js} +4 -3
  9. package/dist/chunk-AAG4R3QN.js.map +1 -0
  10. package/dist/{chunk-Z3DISEQN.js → chunk-CWWKTNKK.js} +35 -18
  11. package/dist/chunk-CWWKTNKK.js.map +1 -0
  12. package/dist/{chunk-WZ55DVGK.js → chunk-ELCE5SXV.js} +8 -4
  13. package/dist/chunk-ELCE5SXV.js.map +1 -0
  14. package/dist/{chunk-YSMMDOOE.js → chunk-GISEVGS6.js} +10 -2
  15. package/dist/chunk-GISEVGS6.js.map +1 -0
  16. package/dist/{chunk-BI57CQUV.js → chunk-I7IWRQLN.js} +2 -2
  17. package/dist/{chunk-XA6R7DJQ.js → chunk-IQUCRAT7.js} +3 -3
  18. package/dist/{chunk-CHPKSLPN.js → chunk-NBZ64YY7.js} +4 -2
  19. package/dist/chunk-NBZ64YY7.js.map +1 -0
  20. package/dist/{chunk-DV2DBNPQ.js → chunk-Q5QBEZIQ.js} +48 -29
  21. package/dist/chunk-Q5QBEZIQ.js.map +1 -0
  22. package/dist/{chunk-FGBCYQOT.js → chunk-RDKBXMWX.js} +120 -74
  23. package/dist/chunk-RDKBXMWX.js.map +1 -0
  24. package/dist/{chunk-45GE35O7.js → chunk-TKB4SB44.js} +10 -2
  25. package/dist/chunk-TKB4SB44.js.map +1 -0
  26. package/dist/{chunk-YCGBREUV.js → chunk-TOAH2BKA.js} +6 -2
  27. package/dist/{chunk-YCGBREUV.js.map → chunk-TOAH2BKA.js.map} +1 -1
  28. package/dist/chunk-UGLEYEMP.js +33 -0
  29. package/dist/chunk-UGLEYEMP.js.map +1 -0
  30. package/dist/{chunk-UJRYEWZI.js → chunk-UTRTG6LH.js} +48 -8
  31. package/dist/chunk-UTRTG6LH.js.map +1 -0
  32. package/dist/{chunk-YRYF2GLG.js → chunk-WYVLAAJA.js} +39 -31
  33. package/dist/chunk-WYVLAAJA.js.map +1 -0
  34. package/dist/{chunk-VGIKFIO2.js → chunk-XOAMRDDK.js} +6 -3
  35. package/dist/chunk-XOAMRDDK.js.map +1 -0
  36. package/dist/{chunk-6NEZPF53.js → chunk-YN7I3STW.js} +153 -32
  37. package/dist/chunk-YN7I3STW.js.map +1 -0
  38. package/dist/{chunk-KZ73RL76.js → chunk-YQEAA6LT.js} +7 -3
  39. package/dist/chunk-YQEAA6LT.js.map +1 -0
  40. package/dist/client.d.ts +4 -1
  41. package/dist/commands/types.d.ts +2 -0
  42. package/dist/components/approval-surface.d.ts +15 -0
  43. package/dist/components/session-conversation.d.ts +3 -0
  44. package/dist/composer.js +8 -7
  45. package/dist/{computer-viewer-7GF35SNY.js → computer-viewer-X2MBRZY4.js} +5 -4
  46. package/dist/connect.js +3 -3
  47. package/dist/hooks/use-browser-session.d.ts +4 -0
  48. package/dist/hooks/use-composer.d.ts +2 -0
  49. package/dist/hooks/use-computer-session.d.ts +2 -0
  50. package/dist/hooks/use-file-attachments.d.ts +2 -0
  51. package/dist/hooks/use-session-events.d.ts +1 -1
  52. package/dist/hooks/use-workspace-sessions.d.ts +15 -5
  53. package/dist/index.d.ts +2 -2
  54. package/dist/index.js +28 -21
  55. package/dist/index.js.map +1 -1
  56. package/dist/interaction.d.ts +1 -1
  57. package/dist/interaction.js +6 -5
  58. package/dist/interaction.js.map +1 -1
  59. package/dist/{latest-question-3BJGKQQ6.js → latest-question-CNEZ5KAN.js} +3 -3
  60. package/dist/lib/error-message.d.ts +7 -0
  61. package/dist/lib/format.d.ts +27 -3
  62. package/dist/lib/interaction-errors.d.ts +3 -0
  63. package/dist/machines.js +5 -4
  64. package/dist/{model-policy-picker-menu-PUTA5JOB.js → model-policy-picker-menu-GN2LTB7Z.js} +4 -4
  65. package/dist/model-policy.js +1 -1
  66. package/dist/provider.d.ts +5 -1
  67. package/dist/{queue-surface-implementation-2CAQAIHM.js → queue-surface-implementation-HENWYFWA.js} +3 -2
  68. package/dist/{queue-surface-implementation-2CAQAIHM.js.map → queue-surface-implementation-HENWYFWA.js.map} +1 -1
  69. package/dist/realtime.js +2 -2
  70. package/dist/{sandbox-files-AEJTWGT4.js → sandbox-files-BBC47SLD.js} +4 -3
  71. package/dist/session-ui.d.ts +1 -1
  72. package/dist/session-ui.js +13 -12
  73. package/dist/session-ui.js.map +1 -1
  74. package/dist/session.js +7 -6
  75. package/dist/usage.js +2 -1
  76. package/dist/usage.js.map +1 -1
  77. package/package.json +3 -3
  78. package/src/client.ts +5 -1
  79. package/src/commands/registry.ts +18 -15
  80. package/src/commands/types.ts +2 -0
  81. package/src/components/approval-surface.tsx +166 -42
  82. package/src/components/browser-viewer.tsx +38 -9
  83. package/src/components/composer.tsx +9 -2
  84. package/src/components/computer-viewer.tsx +160 -30
  85. package/src/components/generated-video-player.tsx +4 -2
  86. package/src/components/human-input-form.tsx +18 -5
  87. package/src/components/message-timeline.tsx +120 -168
  88. package/src/components/model-policy-picker.tsx +2 -15
  89. package/src/components/open-geni-chat.tsx +11 -4
  90. package/src/components/queue-surface-state.tsx +3 -1
  91. package/src/components/session-chrome.tsx +5 -2
  92. package/src/components/session-commands-panel.tsx +3 -1
  93. package/src/components/session-conversation.tsx +10 -3
  94. package/src/components/session-list.tsx +7 -5
  95. package/src/components/session-mcp-capability-card.tsx +11 -1
  96. package/src/hooks/internal.ts +3 -2
  97. package/src/hooks/use-browser-session.ts +115 -79
  98. package/src/hooks/use-composer.ts +70 -31
  99. package/src/hooks/use-computer-session.ts +57 -6
  100. package/src/hooks/use-file-attachments.ts +16 -3
  101. package/src/hooks/use-goal.ts +2 -1
  102. package/src/hooks/use-session-capabilities.ts +3 -2
  103. package/src/hooks/use-session-events.ts +15 -8
  104. package/src/hooks/use-slash-commands.ts +6 -11
  105. package/src/hooks/use-turn-queue.ts +2 -1
  106. package/src/hooks/use-workspace-sessions.ts +40 -7
  107. package/src/index.ts +7 -2
  108. package/src/interaction.ts +1 -0
  109. package/src/lib/error-message.ts +37 -0
  110. package/src/lib/format.ts +73 -9
  111. package/src/lib/interaction-errors.ts +15 -0
  112. package/src/model-policy.ts +6 -1
  113. package/src/provider.tsx +12 -4
  114. package/src/session-ui.ts +1 -1
  115. package/src/timeline/projection.ts +12 -1
  116. package/styles/compiled.css +14 -30
  117. package/dist/chunk-45GE35O7.js.map +0 -1
  118. package/dist/chunk-6NEZPF53.js.map +0 -1
  119. package/dist/chunk-CHPKSLPN.js.map +0 -1
  120. package/dist/chunk-DV2DBNPQ.js.map +0 -1
  121. package/dist/chunk-FGBCYQOT.js.map +0 -1
  122. package/dist/chunk-KGENSZKS.js.map +0 -1
  123. package/dist/chunk-KZ73RL76.js.map +0 -1
  124. package/dist/chunk-LZ3KHA55.js.map +0 -1
  125. package/dist/chunk-UINDK6C3.js.map +0 -1
  126. package/dist/chunk-UJRYEWZI.js.map +0 -1
  127. package/dist/chunk-VGIKFIO2.js.map +0 -1
  128. package/dist/chunk-WZ55DVGK.js.map +0 -1
  129. package/dist/chunk-YRYF2GLG.js.map +0 -1
  130. package/dist/chunk-YSMMDOOE.js.map +0 -1
  131. package/dist/chunk-Z3DISEQN.js.map +0 -1
  132. package/dist/components/timeline-pill-geometry.d.ts +0 -8
  133. package/dist/components/timeline-pill-placement.d.ts +0 -24
  134. package/dist/timeline-pill-geometry-Z23V243M.js +0 -110
  135. package/dist/timeline-pill-geometry-Z23V243M.js.map +0 -1
  136. package/src/components/timeline-pill-geometry.ts +0 -169
  137. package/src/components/timeline-pill-placement.ts +0 -99
  138. /package/dist/{browser-viewer-5X47I6T2.js.map → browser-viewer-63TXMINB.js.map} +0 -0
  139. /package/dist/{chunk-5EXGU7UF.js.map → chunk-55DDDVKU.js.map} +0 -0
  140. /package/dist/{chunk-BI57CQUV.js.map → chunk-I7IWRQLN.js.map} +0 -0
  141. /package/dist/{chunk-XA6R7DJQ.js.map → chunk-IQUCRAT7.js.map} +0 -0
  142. /package/dist/{computer-viewer-7GF35SNY.js.map → computer-viewer-X2MBRZY4.js.map} +0 -0
  143. /package/dist/{latest-question-3BJGKQQ6.js.map → latest-question-CNEZ5KAN.js.map} +0 -0
  144. /package/dist/{model-policy-picker-menu-PUTA5JOB.js.map → model-policy-picker-menu-GN2LTB7Z.js.map} +0 -0
  145. /package/dist/{sandbox-files-AEJTWGT4.js.map → sandbox-files-BBC47SLD.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  shouldSteerOnKey,
3
3
  shouldSubmitOnKey
4
- } from "./chunk-DV2DBNPQ.js";
4
+ } from "./chunk-Q5QBEZIQ.js";
5
5
  import {
6
6
  Tooltip,
7
7
  TooltipContent,
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-BRM6FVZA.js";
12
12
  import {
13
13
  groupPickerRowsByBillingClass
14
- } from "./chunk-CHPKSLPN.js";
14
+ } from "./chunk-NBZ64YY7.js";
15
15
  import {
16
16
  ComposerResponsiveContext
17
17
  } from "./chunk-VZTQ73XT.js";
@@ -19,7 +19,10 @@ import {
19
19
  composerSubmissionErrorMessage,
20
20
  formatBytes,
21
21
  formatRelativeTime
22
- } from "./chunk-UJRYEWZI.js";
22
+ } from "./chunk-UTRTG6LH.js";
23
+ import {
24
+ useErrorMessage
25
+ } from "./chunk-UGLEYEMP.js";
23
26
  import {
24
27
  cn
25
28
  } from "./chunk-22KP6LR5.js";
@@ -28,6 +31,7 @@ import {
28
31
  var OPEN_WORKSTREAM_CONTROL_EVENT = "opengeni:open-workstream-control";
29
32
 
30
33
  // src/commands/registry.ts
34
+ import { formatErrorMessage } from "@opengeni/sdk";
31
35
  function parseCommandLine(value) {
32
36
  if (value[0] !== "/") {
33
37
  return null;
@@ -146,7 +150,10 @@ var defaultCommands = [
146
150
  });
147
151
  return { status: "ok", message: action === "pause" ? "Goal paused." : "Goal resumed." };
148
152
  } catch (cause) {
149
- return { status: "error", message: goalErrorMessage(cause, action) };
153
+ return {
154
+ status: "error",
155
+ message: commandErrorMessage(ctx, cause, goalErrorMessage(cause, action))
156
+ };
150
157
  }
151
158
  }
152
159
  },
@@ -161,7 +168,7 @@ var defaultCommands = [
161
168
  const result = await ctx.client.compactSessionContext(ctx.workspaceId, sessionId);
162
169
  return { status: "ok", message: result.message };
163
170
  } catch (cause) {
164
- return { status: "error", message: errorMessage(cause) ?? "Could not compact context." };
171
+ return { status: "error", message: commandErrorMessage(ctx, cause) };
165
172
  }
166
173
  }
167
174
  },
@@ -181,16 +188,16 @@ var defaultCommands = [
181
188
  await ctx.client.clearSessionContext(ctx.workspaceId, sessionId);
182
189
  return { status: "ok", message: "Context cleared." };
183
190
  } catch (cause) {
184
- return { status: "error", message: clearErrorMessage(cause) };
191
+ return {
192
+ status: "error",
193
+ message: commandErrorMessage(ctx, cause, clearErrorMessage(cause))
194
+ };
185
195
  }
186
196
  }
187
197
  }
188
198
  ];
189
- function errorMessage(cause) {
190
- if (cause && typeof cause === "object" && "message" in cause && typeof cause.message === "string") {
191
- return cause.message;
192
- }
193
- return void 0;
199
+ function commandErrorMessage(ctx, cause, message = formatErrorMessage(cause)) {
200
+ return ctx.formatError?.(cause, message) || message;
194
201
  }
195
202
  function statusCode(cause) {
196
203
  if (cause && typeof cause === "object" && "status" in cause && typeof cause.status === "number") {
@@ -206,18 +213,19 @@ function goalErrorMessage(cause, action) {
206
213
  if (code === 409) {
207
214
  return action === "resume" ? "Only a paused goal can be resumed." : "Goal is already in a terminal state.";
208
215
  }
209
- return errorMessage(cause) ?? `Could not ${action} the goal.`;
216
+ return formatErrorMessage(cause);
210
217
  }
211
218
  function clearErrorMessage(cause) {
212
219
  if (statusCode(cause) === 409) {
213
220
  return "Pause the session and wait for the current inference to settle, then clear context.";
214
221
  }
215
- return errorMessage(cause) ?? "Could not clear context.";
222
+ return formatErrorMessage(cause);
216
223
  }
217
224
 
218
225
  // src/hooks/use-slash-commands.ts
219
226
  import { useCallback, useMemo, useRef, useState } from "react";
220
227
  function useSlashCommands(options) {
228
+ const formatError = useErrorMessage();
221
229
  const { commands, context, handlers, value, setValue } = options;
222
230
  const [highlight, setHighlight] = useState(0);
223
231
  const [dismissedValue, setDismissedValue] = useState(null);
@@ -261,9 +269,9 @@ function useSlashCommands(options) {
261
269
  if (!context) {
262
270
  return null;
263
271
  }
264
- return { ...context, ...handlers, confirm: () => handlers.confirm(command) };
272
+ return { ...context, ...handlers, formatError, confirm: () => handlers.confirm(command) };
265
273
  },
266
- [context, handlers]
274
+ [context, handlers, formatError]
267
275
  );
268
276
  const execute = useCallback(
269
277
  async (command, args) => {
@@ -280,10 +288,10 @@ function useSlashCommands(options) {
280
288
  setValue("");
281
289
  }
282
290
  } catch (cause) {
283
- ctx.notice({ tone: "error", message: errorMessage2(cause) });
291
+ ctx.notice({ tone: "error", message: formatError(cause) });
284
292
  }
285
293
  },
286
- [buildContext, setValue]
294
+ [buildContext, setValue, formatError]
287
295
  );
288
296
  const autocomplete = useCallback(
289
297
  (command) => {
@@ -417,12 +425,6 @@ function useSlashCommands(options) {
417
425
  autocompleteHighlighted
418
426
  };
419
427
  }
420
- function errorMessage2(cause) {
421
- if (cause instanceof Error) {
422
- return cause.message;
423
- }
424
- return String(cause);
425
- }
426
428
 
427
429
  // src/components/command-palette.tsx
428
430
  import { AnimatePresence, motion } from "motion/react";
@@ -647,7 +649,9 @@ var defaultChatComposerMessages = {
647
649
  messagePlaceholder: "Message the agent\u2026",
648
650
  pausedPlaceholder: "Message the agent \u2014 it will wait in the queue\u2026",
649
651
  inputLabel: "Message the agent",
650
- keyboardHint: "Enter to queue \xB7 Cmd/Ctrl+Enter to steer \xB7 Shift+Enter for a new line",
652
+ // Shortcuts live in the send button's title; the footer stays quiet unless
653
+ // the host supplies its own hint.
654
+ keyboardHint: "",
651
655
  slashCommandBlocked: "That's a slash command \u2014 press Enter in the command list to run it, or edit the line to send a message.",
652
656
  controlChangedError: "This workstream was paused while you were sending. Nothing was sent, and your draft is still here.",
653
657
  sendFailedError: "Sending failed \u2014 your draft is still here. Try again.",
@@ -784,6 +788,7 @@ function useChatComposerController({
784
788
  onPaste,
785
789
  messages: messageOverrides
786
790
  }) {
791
+ const formatError = useErrorMessage();
787
792
  const messages = useMemo3(
788
793
  () => ({ ...defaultChatComposerMessages, ...messageOverrides }),
789
794
  [messageOverrides]
@@ -1027,7 +1032,10 @@ function useChatComposerController({
1027
1032
  );
1028
1033
  const activeNotice = notice ?? (delivery.error ? {
1029
1034
  tone: "error",
1030
- message: /control changed|paused while/i.test(delivery.error.message) ? messages.controlChangedError : composerSubmissionErrorMessage(delivery.error) || messages.sendFailedError
1035
+ message: /control changed|paused while/i.test(delivery.error.message) ? messages.controlChangedError : formatError(
1036
+ delivery.error,
1037
+ composerSubmissionErrorMessage(delivery.error) || messages.sendFailedError
1038
+ )
1031
1039
  } : null);
1032
1040
  useEffect(() => {
1033
1041
  if (notice?.tone !== "ok") return;
@@ -4336,8 +4344,8 @@ function ComposerTranscriptionControl({
4336
4344
  const savedTranscript = status === "transcript-ready" && transcription.savedTranscript !== null;
4337
4345
  const unavailableMessage = composer.disabled ? messages.unavailableDisabled : !capability?.available || !workspaceEnabled ? messages.unavailable : !transcription.available ? messages.errorStorageUnavailable : null;
4338
4346
  const idleLabel = unavailableMessage ?? (status === "error" ? messages.retry : messages.start);
4339
- const errorMessage3 = transcription.error ? transcriptionErrorMessage(transcription.error, messages) : null;
4340
- const announcement = status === "requesting-permission" ? messages.requestingPermission : status === "recording" ? messages.recording : status === "saving" ? messages.saving : status === "transcribing" ? messages.transcribing : retrying ? messages.retrying : status === "recovered" ? messages.recovered : status === "transcript-ready" ? messages.recoveredTranscript : status === "error" ? errorMessage3 ?? messages.errorUnknown : unavailableMessage;
4347
+ const errorMessage = transcription.error ? transcriptionErrorMessage(transcription.error, messages) : null;
4348
+ const announcement = status === "requesting-permission" ? messages.requestingPermission : status === "recording" ? messages.recording : status === "saving" ? messages.saving : status === "transcribing" ? messages.transcribing : retrying ? messages.retrying : status === "recovered" ? messages.recovered : status === "transcript-ready" ? messages.recoveredTranscript : status === "error" ? errorMessage ?? messages.errorUnknown : unavailableMessage;
4341
4349
  function start(event) {
4342
4350
  if (unavailableMessage) {
4343
4351
  event.preventDefault();
@@ -4374,7 +4382,7 @@ function ComposerTranscriptionControl({
4374
4382
  "bg-og-surface-2/70 pl-2 pr-1 pointer-coarse:h-11"
4375
4383
  ),
4376
4384
  children: [
4377
- /* @__PURE__ */ jsx4("span", { className: "og-transcription-recovered-label max-w-44 truncate text-og-xs text-og-fg-muted max-sm:max-w-28", children: savedTranscript ? errorMessage3 ?? messages.recoveredTranscript : retrying ? messages.retrying : status === "error" ? errorMessage3 ?? messages.errorRetryable : messages.recovered }),
4385
+ /* @__PURE__ */ jsx4("span", { className: "og-transcription-recovered-label max-w-44 truncate text-og-xs text-og-fg-muted max-sm:max-w-28", children: savedTranscript ? errorMessage ?? messages.recoveredTranscript : retrying ? messages.retrying : status === "error" ? errorMessage ?? messages.errorRetryable : messages.recovered }),
4378
4386
  /* @__PURE__ */ jsx4(
4379
4387
  Tip,
4380
4388
  {
@@ -4503,12 +4511,12 @@ function ComposerTranscriptionControl({
4503
4511
  children: /* @__PURE__ */ jsx4(MicIcon, { className: "size-4" })
4504
4512
  }
4505
4513
  ) }, "idle") }),
4506
- status === "error" && errorMessage3 && !recoverable ? /* @__PURE__ */ jsx4(Tip, { tip: errorMessage3, children: /* @__PURE__ */ jsx4(
4514
+ status === "error" && errorMessage && !recoverable ? /* @__PURE__ */ jsx4(Tip, { tip: errorMessage, children: /* @__PURE__ */ jsx4(
4507
4515
  "span",
4508
4516
  {
4509
4517
  "aria-hidden": "true",
4510
4518
  className: "og-transcription-error-label max-w-40 truncate text-og-xs text-og-status-failed max-sm:max-w-24",
4511
- children: errorMessage3
4519
+ children: errorMessage
4512
4520
  }
4513
4521
  ) }) : null,
4514
4522
  /* @__PURE__ */ jsx4(
@@ -4691,4 +4699,4 @@ export {
4691
4699
  useVoiceInput,
4692
4700
  ComposerTranscriptionControl
4693
4701
  };
4694
- //# sourceMappingURL=chunk-YRYF2GLG.js.map
4702
+ //# sourceMappingURL=chunk-WYVLAAJA.js.map