@opengeni/react 7.6.1 → 7.7.0-canary.37090756480001

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 (142) hide show
  1. package/README.md +19 -2
  2. package/dist/{browser-viewer-5X47I6T2.js → browser-viewer-63TXMINB.js} +6 -5
  3. package/dist/{chunk-UINDK6C3.js → chunk-2QUSQVF2.js} +3 -3
  4. package/dist/{chunk-CHPKSLPN.js → chunk-6ZSWSH4I.js} +3 -1
  5. package/dist/chunk-6ZSWSH4I.js.map +1 -0
  6. package/dist/{chunk-KGENSZKS.js → chunk-AAG4R3QN.js} +4 -3
  7. package/dist/chunk-AAG4R3QN.js.map +1 -0
  8. package/dist/{chunk-Z3DISEQN.js → chunk-CWWKTNKK.js} +35 -18
  9. package/dist/chunk-CWWKTNKK.js.map +1 -0
  10. package/dist/{chunk-5EXGU7UF.js → chunk-DOJWJQ3F.js} +3 -3
  11. package/dist/{chunk-WZ55DVGK.js → chunk-ELCE5SXV.js} +8 -4
  12. package/dist/chunk-ELCE5SXV.js.map +1 -0
  13. package/dist/{chunk-YSMMDOOE.js → chunk-GISEVGS6.js} +10 -2
  14. package/dist/chunk-GISEVGS6.js.map +1 -0
  15. package/dist/{chunk-YRYF2GLG.js → chunk-HNFCAQ5R.js} +39 -31
  16. package/dist/chunk-HNFCAQ5R.js.map +1 -0
  17. package/dist/{chunk-BI57CQUV.js → chunk-I7IWRQLN.js} +2 -2
  18. package/dist/{chunk-XA6R7DJQ.js → chunk-IQUCRAT7.js} +3 -3
  19. package/dist/{chunk-DV2DBNPQ.js → chunk-Q5QBEZIQ.js} +48 -29
  20. package/dist/chunk-Q5QBEZIQ.js.map +1 -0
  21. package/dist/{chunk-FGBCYQOT.js → chunk-RDKBXMWX.js} +120 -74
  22. package/dist/chunk-RDKBXMWX.js.map +1 -0
  23. package/dist/{chunk-45GE35O7.js → chunk-TKB4SB44.js} +10 -2
  24. package/dist/chunk-TKB4SB44.js.map +1 -0
  25. package/dist/{chunk-YCGBREUV.js → chunk-TOAH2BKA.js} +6 -2
  26. package/dist/{chunk-YCGBREUV.js.map → chunk-TOAH2BKA.js.map} +1 -1
  27. package/dist/chunk-UGLEYEMP.js +33 -0
  28. package/dist/chunk-UGLEYEMP.js.map +1 -0
  29. package/dist/{chunk-UJRYEWZI.js → chunk-UTRTG6LH.js} +48 -8
  30. package/dist/chunk-UTRTG6LH.js.map +1 -0
  31. package/dist/{chunk-VGIKFIO2.js → chunk-XOAMRDDK.js} +6 -3
  32. package/dist/chunk-XOAMRDDK.js.map +1 -0
  33. package/dist/{chunk-6NEZPF53.js → chunk-YN7I3STW.js} +153 -32
  34. package/dist/chunk-YN7I3STW.js.map +1 -0
  35. package/dist/{chunk-KZ73RL76.js → chunk-YQEAA6LT.js} +7 -3
  36. package/dist/chunk-YQEAA6LT.js.map +1 -0
  37. package/dist/{chunk-LZ3KHA55.js → chunk-ZYALTAEQ.js} +329 -339
  38. package/dist/chunk-ZYALTAEQ.js.map +1 -0
  39. package/dist/client.d.ts +4 -1
  40. package/dist/commands/types.d.ts +2 -0
  41. package/dist/components/approval-surface.d.ts +15 -0
  42. package/dist/composer.js +8 -7
  43. package/dist/{computer-viewer-7GF35SNY.js → computer-viewer-X2MBRZY4.js} +5 -4
  44. package/dist/connect.js +3 -3
  45. package/dist/hooks/use-browser-session.d.ts +4 -0
  46. package/dist/hooks/use-composer.d.ts +2 -0
  47. package/dist/hooks/use-computer-session.d.ts +2 -0
  48. package/dist/hooks/use-file-attachments.d.ts +2 -0
  49. package/dist/hooks/use-session-events.d.ts +1 -1
  50. package/dist/hooks/use-workspace-sessions.d.ts +15 -5
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.js +28 -21
  53. package/dist/index.js.map +1 -1
  54. package/dist/interaction.d.ts +1 -1
  55. package/dist/interaction.js +6 -5
  56. package/dist/interaction.js.map +1 -1
  57. package/dist/{latest-question-3BJGKQQ6.js → latest-question-CNEZ5KAN.js} +3 -3
  58. package/dist/lib/error-message.d.ts +7 -0
  59. package/dist/lib/format.d.ts +27 -3
  60. package/dist/lib/interaction-errors.d.ts +3 -0
  61. package/dist/machines.js +5 -4
  62. package/dist/{model-policy-picker-menu-PUTA5JOB.js → model-policy-picker-menu-JSA64TNN.js} +4 -4
  63. package/dist/model-policy.js +1 -1
  64. package/dist/provider.d.ts +5 -1
  65. package/dist/{queue-surface-implementation-2CAQAIHM.js → queue-surface-implementation-HENWYFWA.js} +3 -2
  66. package/dist/{queue-surface-implementation-2CAQAIHM.js.map → queue-surface-implementation-HENWYFWA.js.map} +1 -1
  67. package/dist/realtime.js +2 -2
  68. package/dist/{sandbox-files-AEJTWGT4.js → sandbox-files-BBC47SLD.js} +4 -3
  69. package/dist/session-ui.d.ts +1 -1
  70. package/dist/session-ui.js +13 -12
  71. package/dist/session-ui.js.map +1 -1
  72. package/dist/session.js +7 -6
  73. package/dist/usage.js +2 -1
  74. package/dist/usage.js.map +1 -1
  75. package/package.json +3 -3
  76. package/src/client.ts +5 -1
  77. package/src/commands/registry.ts +18 -15
  78. package/src/commands/types.ts +2 -0
  79. package/src/components/approval-surface.tsx +166 -42
  80. package/src/components/browser-viewer.tsx +38 -9
  81. package/src/components/composer.tsx +9 -2
  82. package/src/components/computer-viewer.tsx +160 -30
  83. package/src/components/generated-video-player.tsx +4 -2
  84. package/src/components/human-input-form.tsx +18 -5
  85. package/src/components/message-timeline.tsx +120 -168
  86. package/src/components/open-geni-chat.tsx +11 -4
  87. package/src/components/queue-surface-state.tsx +3 -1
  88. package/src/components/session-chrome.tsx +5 -2
  89. package/src/components/session-commands-panel.tsx +3 -1
  90. package/src/components/session-conversation.tsx +4 -2
  91. package/src/components/session-list.tsx +7 -5
  92. package/src/components/session-mcp-capability-card.tsx +11 -1
  93. package/src/hooks/internal.ts +3 -2
  94. package/src/hooks/use-browser-session.ts +115 -79
  95. package/src/hooks/use-composer.ts +70 -31
  96. package/src/hooks/use-computer-session.ts +57 -6
  97. package/src/hooks/use-file-attachments.ts +16 -3
  98. package/src/hooks/use-goal.ts +2 -1
  99. package/src/hooks/use-session-capabilities.ts +3 -2
  100. package/src/hooks/use-session-events.ts +15 -8
  101. package/src/hooks/use-slash-commands.ts +6 -11
  102. package/src/hooks/use-turn-queue.ts +2 -1
  103. package/src/hooks/use-workspace-sessions.ts +40 -7
  104. package/src/index.ts +7 -2
  105. package/src/interaction.ts +1 -0
  106. package/src/lib/error-message.ts +37 -0
  107. package/src/lib/format.ts +73 -9
  108. package/src/lib/interaction-errors.ts +15 -0
  109. package/src/model-policy.ts +5 -0
  110. package/src/provider.tsx +12 -4
  111. package/src/session-ui.ts +1 -1
  112. package/src/timeline/projection.ts +12 -1
  113. package/styles/compiled.css +14 -30
  114. package/dist/chunk-45GE35O7.js.map +0 -1
  115. package/dist/chunk-6NEZPF53.js.map +0 -1
  116. package/dist/chunk-CHPKSLPN.js.map +0 -1
  117. package/dist/chunk-DV2DBNPQ.js.map +0 -1
  118. package/dist/chunk-FGBCYQOT.js.map +0 -1
  119. package/dist/chunk-KGENSZKS.js.map +0 -1
  120. package/dist/chunk-KZ73RL76.js.map +0 -1
  121. package/dist/chunk-LZ3KHA55.js.map +0 -1
  122. package/dist/chunk-UJRYEWZI.js.map +0 -1
  123. package/dist/chunk-VGIKFIO2.js.map +0 -1
  124. package/dist/chunk-WZ55DVGK.js.map +0 -1
  125. package/dist/chunk-YRYF2GLG.js.map +0 -1
  126. package/dist/chunk-YSMMDOOE.js.map +0 -1
  127. package/dist/chunk-Z3DISEQN.js.map +0 -1
  128. package/dist/components/timeline-pill-geometry.d.ts +0 -8
  129. package/dist/components/timeline-pill-placement.d.ts +0 -24
  130. package/dist/timeline-pill-geometry-Z23V243M.js +0 -110
  131. package/dist/timeline-pill-geometry-Z23V243M.js.map +0 -1
  132. package/src/components/timeline-pill-geometry.ts +0 -169
  133. package/src/components/timeline-pill-placement.ts +0 -99
  134. /package/dist/{browser-viewer-5X47I6T2.js.map → browser-viewer-63TXMINB.js.map} +0 -0
  135. /package/dist/{chunk-UINDK6C3.js.map → chunk-2QUSQVF2.js.map} +0 -0
  136. /package/dist/{chunk-5EXGU7UF.js.map → chunk-DOJWJQ3F.js.map} +0 -0
  137. /package/dist/{chunk-BI57CQUV.js.map → chunk-I7IWRQLN.js.map} +0 -0
  138. /package/dist/{chunk-XA6R7DJQ.js.map → chunk-IQUCRAT7.js.map} +0 -0
  139. /package/dist/{computer-viewer-7GF35SNY.js.map → computer-viewer-X2MBRZY4.js.map} +0 -0
  140. /package/dist/{latest-question-3BJGKQQ6.js.map → latest-question-CNEZ5KAN.js.map} +0 -0
  141. /package/dist/{model-policy-picker-menu-PUTA5JOB.js.map → model-policy-picker-menu-JSA64TNN.js.map} +0 -0
  142. /package/dist/{sandbox-files-AEJTWGT4.js.map → sandbox-files-BBC47SLD.js.map} +0 -0
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-BRM6FVZA.js";
24
24
  import {
25
25
  stringifyPayload
26
- } from "./chunk-UJRYEWZI.js";
26
+ } from "./chunk-UTRTG6LH.js";
27
27
  import {
28
28
  cn
29
29
  } from "./chunk-22KP6LR5.js";
@@ -1605,4 +1605,4 @@ export {
1605
1605
  retainedImageId,
1606
1606
  Markdown
1607
1607
  };
1608
- //# sourceMappingURL=chunk-BI57CQUV.js.map
1608
+ //# sourceMappingURL=chunk-I7IWRQLN.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  formatBytes,
3
3
  formatRelativeTime
4
- } from "./chunk-UJRYEWZI.js";
4
+ } from "./chunk-UTRTG6LH.js";
5
5
  import {
6
6
  useMutationRunner,
7
7
  usePageLiveActivity
8
- } from "./chunk-KZ73RL76.js";
8
+ } from "./chunk-YQEAA6LT.js";
9
9
  import {
10
10
  useOpenGeni
11
11
  } from "./chunk-NEXLLTP4.js";
@@ -2448,4 +2448,4 @@ export {
2448
2448
  EnrollmentDeviceFlow,
2449
2449
  EnrollmentConsent
2450
2450
  };
2451
- //# sourceMappingURL=chunk-XA6R7DJQ.js.map
2451
+ //# sourceMappingURL=chunk-IQUCRAT7.js.map
@@ -1,17 +1,26 @@
1
1
  import {
2
+ COMPOSER_MODEL_UNAVAILABLE_MESSAGE,
3
+ ComposerReconciliationRequiredError,
4
+ ComposerStateError,
5
+ ComposerWorkspaceControlUnavailableError,
2
6
  composerSubmissionCanRetry,
3
7
  composerSubmissionErrorMessage
4
- } from "./chunk-UJRYEWZI.js";
8
+ } from "./chunk-UTRTG6LH.js";
5
9
  import {
6
10
  useSessionEventTrigger
7
- } from "./chunk-KZ73RL76.js";
11
+ } from "./chunk-YQEAA6LT.js";
12
+ import {
13
+ normalizeError,
14
+ useErrorMessage
15
+ } from "./chunk-UGLEYEMP.js";
8
16
  import {
9
17
  useEmbeddedSession
10
18
  } from "./chunk-NEXLLTP4.js";
11
19
 
12
20
  // src/hooks/use-composer.ts
13
21
  import {
14
- DEFAULT_FILE_RESOURCE_MOUNT_ROOT
22
+ DEFAULT_FILE_RESOURCE_MOUNT_ROOT,
23
+ OpenGeniApiError
15
24
  } from "@opengeni/sdk";
16
25
  import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
17
26
  var PENDING_COMPOSER_STORAGE_PREFIX = "opengeni.pending-composer.v1:";
@@ -55,12 +64,23 @@ function restoreOptimisticSendOperations(key) {
55
64
  newerShadow: operation.newerShadow ?? { text: "", resources: [], annotations: [] },
56
65
  state: operation.state === "sending" || operation.state === "queued" ? "sending" : operation.state,
57
66
  outcomeUnknown: operation.state === "sending" || operation.state === "queued" ? true : operation.outcomeUnknown,
58
- error: operation.state === "sending" ? "Delivery was interrupted; retry to reconcile this message." : operation.error ? composerSubmissionErrorMessage(new Error(operation.error)) : void 0,
67
+ correlationId: restoredCorrelationId(operation.correlationId),
68
+ error: restoredErrorReference(
69
+ operation.correlationId,
70
+ hasMcpCredentialUpdates && (operation.state === "sending" || operation.outcomeUnknown) ? composerSubmissionErrorMessage(new ComposerReconciliationRequiredError()) : operation.state === "sending" ? "Delivery was interrupted; retry to reconcile this message." : operation.outcomeUnknown ? "The request could not be confirmed. Check its status before retrying." : operation.error ? composerSubmissionErrorMessage(new Error(operation.error)) : void 0
71
+ ),
59
72
  retryable: operation.state === "sending" || operation.outcomeUnknown ? true : operation.retryable ?? (operation.error ? composerSubmissionCanRetry(new Error(operation.error)) : true),
60
73
  input: operation.input,
61
74
  canRetry: !hasMcpCredentialUpdates
62
75
  }));
63
76
  }
77
+ function restoredCorrelationId(value) {
78
+ return typeof value === "string" && /^[\w.:-]{1,128}$/u.test(value) ? value : void 0;
79
+ }
80
+ function restoredErrorReference(reference, message) {
81
+ const correlationId = restoredCorrelationId(reference);
82
+ return message && correlationId && message !== COMPOSER_MODEL_UNAVAILABLE_MESSAGE ? `${message} Reference: ${correlationId}.` : message;
83
+ }
64
84
  function rememberOptimisticSendOperations(key, operations) {
65
85
  if (!key) return;
66
86
  const stored = operations.filter((operation) => operation.state !== "queued").map((operation) => {
@@ -286,6 +306,7 @@ function reconcileOptimisticSendFromEvents(operation, events) {
286
306
  }
287
307
  function useComposer(sessionId, options = {}) {
288
308
  const { client, workspaceId, registerSessionReconciler } = useEmbeddedSession(options);
309
+ const formatError = useErrorMessage();
289
310
  const durableDrafts = options.draftPersistence !== "disabled";
290
311
  if (!durableDrafts && !options.initialPolicy) {
291
312
  throw new Error("useComposer requires initialPolicy when draft persistence is disabled");
@@ -648,7 +669,7 @@ function useComposer(sessionId, options = {}) {
648
669
  const problem = asError(cause);
649
670
  const timedOut = problem.name === "TimeoutError";
650
671
  setDraftReadError(
651
- timedOut ? new Error("Draft sync timed out. Retrying\u2026", { cause }) : problem
672
+ timedOut ? new ComposerStateError("Draft sync timed out. Retrying\u2026", { cause }) : problem
652
673
  );
653
674
  if (timedOut || cause instanceof TypeError || cause && typeof cause === "object" && "retryable" in cause && cause.retryable === true) {
654
675
  retry.failures += 1;
@@ -913,18 +934,23 @@ function useComposer(sessionId, options = {}) {
913
934
  optimisticProcessorBusyRef.current = true;
914
935
  void (async () => {
915
936
  let mutationFailureObserved = false;
916
- const markFailed = (problem, outcomeUnknown) => {
937
+ const markFailed = (cause, outcomeUnknown) => {
917
938
  if (targetKeyRef.current !== ownedTargetKey || targetGeneration.current !== ownedGeneration) {
918
939
  return;
919
940
  }
941
+ const problem = asError(cause);
920
942
  replaceOptimisticSends(
921
943
  (current) => current.map(
922
944
  (candidate) => candidate.clientEventId === operation.clientEventId ? {
923
945
  ...candidate,
924
946
  state: "failed",
925
- error: outcomeUnknown ? problem.message : composerSubmissionErrorMessage(problem),
947
+ error: formatError(
948
+ cause,
949
+ outcomeUnknown && !isOutcomeUnknownError(problem) && !(problem instanceof ComposerReconciliationRequiredError) ? `The request could not be confirmed. Check its status before retrying.${problem instanceof OpenGeniApiError && problem.correlationId ? ` Reference: ${problem.correlationId}.` : ""}` : composerSubmissionErrorMessage(problem)
950
+ ),
926
951
  retryable: outcomeUnknown || composerSubmissionCanRetry(problem),
927
- outcomeUnknown
952
+ outcomeUnknown,
953
+ correlationId: problem instanceof OpenGeniApiError ? problem.correlationId : candidate.correlationId
928
954
  } : candidate
929
955
  )
930
956
  );
@@ -947,7 +973,7 @@ function useComposer(sessionId, options = {}) {
947
973
  payloadMode: "full"
948
974
  });
949
975
  } catch (cause) {
950
- markFailed(asError(cause), true);
976
+ markFailed(cause, true);
951
977
  return;
952
978
  }
953
979
  const reconciled = reconcileOptimisticSendFromEvents(operation, events);
@@ -969,15 +995,13 @@ function useComposer(sessionId, options = {}) {
969
995
  return;
970
996
  }
971
997
  if (!operation.canRetry) {
972
- throw new Error(
973
- "Opengeni cannot safely retry this uncertain request after remount; reconcile the session before sending again."
974
- );
998
+ throw new ComposerReconciliationRequiredError();
975
999
  }
976
1000
  }
977
1001
  let expectedDraftRevision;
978
1002
  if (durableDrafts && operation.draftPayload) {
979
1003
  if (!await persistPayload(operation.draftPayload)) {
980
- throw new Error("The message draft could not be saved before delivery.");
1004
+ throw new ComposerStateError("The message draft could not be saved before delivery.");
981
1005
  }
982
1006
  expectedDraftRevision = draftRef.current?.revision;
983
1007
  }
@@ -992,7 +1016,7 @@ function useComposer(sessionId, options = {}) {
992
1016
  let acceptedEvent = null;
993
1017
  if (durableDrafts) {
994
1018
  if (!operation.draftPayload || expectedDraftRevision === void 0) {
995
- throw new Error("The durable composer draft is not ready for delivery.");
1019
+ throw new ComposerStateError("The durable composer draft is not ready for delivery.");
996
1020
  }
997
1021
  const result = await client.submitComposerDraft(workspaceId, sessionId, {
998
1022
  text: operation.draftPayload.text,
@@ -1058,7 +1082,7 @@ function useComposer(sessionId, options = {}) {
1058
1082
  const problem = asError(cause);
1059
1083
  onDeliveryErrorRef.current?.(problem, operation.input, "send");
1060
1084
  const outcomeUnknown = operation.outcomeUnknown && !mutationFailureObserved ? true : isOutcomeUnknownError(cause);
1061
- markFailed(problem, outcomeUnknown);
1085
+ markFailed(cause, outcomeUnknown);
1062
1086
  } finally {
1063
1087
  optimisticProcessorBusyRef.current = false;
1064
1088
  if (targetKeyRef.current === ownedTargetKey) {
@@ -1070,6 +1094,7 @@ function useComposer(sessionId, options = {}) {
1070
1094
  adoptDraftBase,
1071
1095
  client,
1072
1096
  durableDrafts,
1097
+ formatError,
1073
1098
  markOptimisticAccepted,
1074
1099
  loadDraft,
1075
1100
  onSent,
@@ -1194,7 +1219,7 @@ function useComposer(sessionId, options = {}) {
1194
1219
  if (durableDrafts) {
1195
1220
  const input = operation.input;
1196
1221
  if (input.expectedDraftRevision === void 0 || input.clientEventId === void 0 || input.model === void 0 || input.reasoningEffort === void 0 || input.latencyMode === void 0) {
1197
- throw new Error("The durable composer draft is not ready for delivery.");
1222
+ throw new ComposerStateError("The durable composer draft is not ready for delivery.");
1198
1223
  }
1199
1224
  const result = await client.submitComposerDraft(workspaceId, sessionId, {
1200
1225
  text: input.text,
@@ -1285,11 +1310,7 @@ function useComposer(sessionId, options = {}) {
1285
1310
  return true;
1286
1311
  }
1287
1312
  if (!pending.canRetry) {
1288
- setError(
1289
- new Error(
1290
- "Opengeni cannot safely retry this uncertain request after remount; reconcile the session before sending again."
1291
- )
1292
- );
1313
+ setError(new ComposerReconciliationRequiredError());
1293
1314
  return false;
1294
1315
  }
1295
1316
  try {
@@ -1613,7 +1634,7 @@ function useComposer(sessionId, options = {}) {
1613
1634
  }
1614
1635
  } catch (cause) {
1615
1636
  if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
1616
- setError(cause instanceof Error ? cause : new Error(String(cause)));
1637
+ setError(normalizeError(cause));
1617
1638
  }
1618
1639
  } finally {
1619
1640
  if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
@@ -1645,7 +1666,7 @@ function useComposer(sessionId, options = {}) {
1645
1666
  }
1646
1667
  } catch (cause) {
1647
1668
  if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
1648
- setError(cause instanceof Error ? cause : new Error(String(cause)));
1669
+ setError(normalizeError(cause));
1649
1670
  }
1650
1671
  } finally {
1651
1672
  if (targetKeyRef.current === ownedTargetKey && targetGeneration.current === ownedGeneration) {
@@ -1668,9 +1689,7 @@ function useComposer(sessionId, options = {}) {
1668
1689
  (blocker) => blocker.kind === "workspace"
1669
1690
  );
1670
1691
  if (!client.setWorkspaceInferenceState) {
1671
- throw new Error(
1672
- "@opengeni/react: workspace-scoped resume requires setWorkspaceInferenceState."
1673
- );
1692
+ throw new ComposerWorkspaceControlUnavailableError();
1674
1693
  }
1675
1694
  const clientEventId = generateClientEventId();
1676
1695
  await replayOutcomeUnknown(
@@ -1783,7 +1802,7 @@ function useComposer(sessionId, options = {}) {
1783
1802
  const addAnnotation = useCallback(
1784
1803
  (annotation) => {
1785
1804
  if (annotationsRef.current.length >= 12) {
1786
- setError(new Error("A message can include at most 12 timeline annotations."));
1805
+ setError(new ComposerStateError("A message can include at most 12 timeline annotations."));
1787
1806
  return;
1788
1807
  }
1789
1808
  const next = [...annotationsRef.current, annotation];
@@ -2070,7 +2089,7 @@ async function replayOutcomeUnknown(command) {
2070
2089
  }
2071
2090
  }
2072
2091
  function asError(cause) {
2073
- return cause instanceof Error ? cause : new Error(String(cause));
2092
+ return normalizeError(cause);
2074
2093
  }
2075
2094
  function promptRoutingFromAcceptedEvent(event) {
2076
2095
  if (typeof event?.payload !== "object" || event.payload === null || Array.isArray(event.payload)) {
@@ -2133,4 +2152,4 @@ export {
2133
2152
  shouldSubmitOnKey,
2134
2153
  shouldSteerOnKey
2135
2154
  };
2136
- //# sourceMappingURL=chunk-DV2DBNPQ.js.map
2155
+ //# sourceMappingURL=chunk-Q5QBEZIQ.js.map