@opengeni/react 6.1.0 → 7.0.0-canary.35625901699001

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 (214) hide show
  1. package/README.md +83 -2
  2. package/dist/approvals.d.ts +2 -1
  3. package/dist/artifacts-document.js +1 -1
  4. package/dist/artifacts-presentation.js +1 -1
  5. package/dist/artifacts-spreadsheet.js +1 -1
  6. package/dist/artifacts.js +3 -3
  7. package/dist/{browser-viewer-NTD6UIPR.js → browser-viewer-LGH4IP47.js} +3 -3
  8. package/dist/capability-catalog-row.d.ts +20 -0
  9. package/dist/capability-logo-fallback.d.ts +3 -0
  10. package/dist/{chunk-NOSYBS2D.js → chunk-2VHARTBL.js} +2 -1
  11. package/dist/{chunk-VRBL3F5E.js → chunk-5GAL23FF.js} +10 -2
  12. package/dist/{chunk-VRBL3F5E.js.map → chunk-5GAL23FF.js.map} +1 -1
  13. package/dist/chunk-5UONOQ3Y.js +635 -0
  14. package/dist/chunk-5UONOQ3Y.js.map +1 -0
  15. package/dist/{chunk-NYESIADM.js → chunk-AKOMC3VO.js} +3 -3
  16. package/dist/chunk-AKOMC3VO.js.map +1 -0
  17. package/dist/chunk-BRM6FVZA.js +302 -0
  18. package/dist/chunk-BRM6FVZA.js.map +1 -0
  19. package/dist/{chunk-KANFU34B.js → chunk-DBPVUGQT.js} +11 -2
  20. package/dist/chunk-DBPVUGQT.js.map +1 -0
  21. package/dist/chunk-FHIGTPME.js +1589 -0
  22. package/dist/chunk-FHIGTPME.js.map +1 -0
  23. package/dist/{chunk-5M6VTFJ5.js → chunk-GBPCZH3Y.js} +2 -2
  24. package/dist/{chunk-YBM6CQRU.js → chunk-GEN54DU5.js} +4 -4
  25. package/dist/{chunk-UMECRJRV.js → chunk-HJ5VJ4JB.js} +21 -12
  26. package/dist/chunk-HJ5VJ4JB.js.map +1 -0
  27. package/dist/{chunk-R4KRSFGA.js → chunk-IP4BUBKH.js} +3 -3
  28. package/dist/{chunk-NLTS7JHI.js → chunk-JPHDWKZE.js} +5 -5
  29. package/dist/{chunk-TDSEILUH.js → chunk-MI6ALLLD.js} +1297 -1535
  30. package/dist/chunk-MI6ALLLD.js.map +1 -0
  31. package/dist/{chunk-ICA6R6TW.js → chunk-OWHPKAOV.js} +28 -20
  32. package/dist/chunk-OWHPKAOV.js.map +1 -0
  33. package/dist/{chunk-24M4YBCL.js → chunk-PNAVEK2U.js} +4 -4
  34. package/dist/{chunk-L2NBTKRX.js → chunk-TXCBE32L.js} +203 -19
  35. package/dist/chunk-TXCBE32L.js.map +1 -0
  36. package/dist/{chunk-45XEUVTK.js → chunk-UXE5SSNN.js} +293 -463
  37. package/dist/chunk-UXE5SSNN.js.map +1 -0
  38. package/dist/{chunk-PEI6RANI.js → chunk-VR4Z73EU.js} +203 -9
  39. package/dist/chunk-VR4Z73EU.js.map +1 -0
  40. package/dist/{chunk-HUIKIDM5.js → chunk-XMXRI5JK.js} +65 -18
  41. package/dist/chunk-XMXRI5JK.js.map +1 -0
  42. package/dist/client.d.ts +1 -1
  43. package/dist/components/artifacts/spreadsheet-general-display.d.ts +24 -0
  44. package/dist/components/chat-composer.d.ts +13 -3
  45. package/dist/components/markdown.d.ts +6 -3
  46. package/dist/components/message-timeline.d.ts +7 -2
  47. package/dist/components/preview-loading.d.ts +2 -0
  48. package/dist/components/session-capability-frame.d.ts +24 -0
  49. package/dist/components/session-chrome.d.ts +1 -2
  50. package/dist/components/session-commands.d.ts +6 -0
  51. package/dist/components/session-connection-request.d.ts +8 -0
  52. package/dist/components/session-conversation.d.ts +3 -0
  53. package/dist/components/session-mcp-capability-card.d.ts +22 -0
  54. package/dist/components/timeline-search.d.ts +34 -0
  55. package/dist/composer.js +7 -7
  56. package/dist/connect-account-identity.d.ts +8 -0
  57. package/dist/connect-accounts.d.ts +5 -0
  58. package/dist/connect-chooser.d.ts +6 -0
  59. package/dist/connect-panel.d.ts +9 -2
  60. package/dist/connect-setup.d.ts +5 -1
  61. package/dist/connect.d.ts +5 -21
  62. package/dist/connect.js +1268 -584
  63. package/dist/connect.js.map +1 -1
  64. package/dist/connection-catalog.d.ts +6 -1
  65. package/dist/connection-discovery.d.ts +12 -0
  66. package/dist/connection-installed.d.ts +1 -0
  67. package/dist/connection-logo.d.ts +5 -2
  68. package/dist/connection-service-logo.d.ts +8 -0
  69. package/dist/connection-service-presentation.d.ts +13 -0
  70. package/dist/connection-skeleton.d.ts +5 -0
  71. package/dist/discovery-cache.d.ts +5 -0
  72. package/dist/hooks/use-codex-accounts.d.ts +11 -5
  73. package/dist/hooks/use-connect.d.ts +22 -0
  74. package/dist/hooks/use-session-events.d.ts +5 -0
  75. package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
  76. package/dist/hooks/use-workspace-sessions.d.ts +2 -0
  77. package/dist/index.d.ts +8 -2
  78. package/dist/index.js +771 -793
  79. package/dist/index.js.map +1 -1
  80. package/dist/interaction.js +2 -2
  81. package/dist/machines.js +2 -2
  82. package/dist/mcp-connection-status.d.ts +14 -0
  83. package/dist/{model-policy-picker-menu-3R336DP2.js → model-policy-picker-menu-RVOQ4ZZG.js} +4 -4
  84. package/dist/model-policy.d.ts +6 -2
  85. package/dist/model-policy.js +1 -1
  86. package/dist/{platform-activity-row-DUE2W74J.js → platform-activity-row-HLOH7FW4.js} +9 -4
  87. package/dist/platform-activity-row-HLOH7FW4.js.map +1 -0
  88. package/dist/plugin-discovery.d.ts +6 -0
  89. package/dist/{queue-surface-implementation-LK3S4BIW.js → queue-surface-implementation-3RIFK2BS.js} +4 -4
  90. package/dist/realtime.js +22 -22
  91. package/dist/realtime.js.map +1 -1
  92. package/dist/session-auth-recommendation.d.ts +5 -0
  93. package/dist/session-capability-policy.d.ts +12 -0
  94. package/dist/session-ui.d.ts +2 -0
  95. package/dist/session-ui.js +14 -12
  96. package/dist/session.d.ts +1 -0
  97. package/dist/session.js +6 -4
  98. package/dist/skill-discovery.d.ts +11 -0
  99. package/dist/timeline/compaction-copy.d.ts +10 -0
  100. package/dist/timeline/projection.d.ts +3 -1
  101. package/dist/timeline/tool-display-name.d.ts +2 -1
  102. package/dist/timeline/turn-summary.d.ts +2 -2
  103. package/dist/timeline/types.d.ts +24 -2
  104. package/dist/{timeline-annotation-markers-DRSTLEM6.js → timeline-annotation-markers-OY6OWR3V.js} +2 -2
  105. package/dist/{timeline-annotation-selection-IHLUGVND.js → timeline-annotation-selection-BOXA2TIN.js} +2 -2
  106. package/dist/{timeline-annotations-dialog-6Q53N5FG.js → timeline-annotations-dialog-RGY3MHL3.js} +3 -3
  107. package/package.json +3 -3
  108. package/src/approvals.ts +8 -1
  109. package/src/assets/README.md +8 -0
  110. package/src/assets/gmail.ico +0 -0
  111. package/src/assets/outlook.ico +0 -0
  112. package/src/capability-catalog-row.tsx +94 -0
  113. package/src/capability-logo-fallback.ts +22 -0
  114. package/src/client.ts +0 -9
  115. package/src/components/approval-surface.tsx +12 -2
  116. package/src/components/artifacts/document-editor.tsx +63 -6
  117. package/src/components/artifacts/presentation-editor.tsx +214 -9
  118. package/src/components/artifacts/spreadsheet-canvas.ts +3 -8
  119. package/src/components/artifacts/spreadsheet-general-display.ts +43 -0
  120. package/src/components/artifacts/spreadsheet-grid.tsx +10 -11
  121. package/src/components/chat-composer.tsx +26 -3
  122. package/src/components/composer.tsx +10 -4
  123. package/src/components/human-input-form.tsx +12 -2
  124. package/src/components/markdown.tsx +133 -9
  125. package/src/components/message-timeline.tsx +104 -36
  126. package/src/components/model-picker.tsx +11 -3
  127. package/src/components/model-policy-picker-menu.tsx +10 -3
  128. package/src/components/preview-loading.tsx +154 -0
  129. package/src/components/sandbox-workspace.tsx +20 -36
  130. package/src/components/session-capability-frame.tsx +163 -0
  131. package/src/components/session-chrome.tsx +46 -77
  132. package/src/components/session-commands.tsx +18 -0
  133. package/src/components/session-connection-request.tsx +97 -0
  134. package/src/components/session-conversation.tsx +10 -5
  135. package/src/components/session-mcp-capability-card.tsx +532 -0
  136. package/src/components/session-status.tsx +2 -2
  137. package/src/components/timeline-anchor.tsx +9 -8
  138. package/src/components/timeline-search.tsx +168 -0
  139. package/src/components/user-message-body.tsx +7 -0
  140. package/src/connect-account-identity.tsx +34 -0
  141. package/src/connect-accounts.tsx +114 -52
  142. package/src/connect-chooser.tsx +171 -39
  143. package/src/connect-panel.tsx +73 -9
  144. package/src/connect-setup.tsx +72 -25
  145. package/src/connect.ts +13 -22
  146. package/src/connection-assets.d.ts +4 -0
  147. package/src/connection-catalog.tsx +61 -39
  148. package/src/connection-discovery.tsx +235 -0
  149. package/src/connection-installed.tsx +2 -0
  150. package/src/connection-logo.tsx +18 -10
  151. package/src/connection-service-logo.tsx +55 -0
  152. package/src/connection-service-presentation.ts +46 -0
  153. package/src/connection-skeleton.tsx +16 -0
  154. package/src/conversation-timeline.ts +1 -0
  155. package/src/discovery-cache.ts +42 -0
  156. package/src/hooks/use-codex-accounts.ts +33 -14
  157. package/src/hooks/use-composer.ts +4 -5
  158. package/src/hooks/use-connect.ts +23 -0
  159. package/src/hooks/use-session-events.ts +114 -1
  160. package/src/hooks/use-session-mcp-approval-policy.ts +13 -5
  161. package/src/hooks/use-workspace-sessions.ts +10 -0
  162. package/src/index.ts +22 -2
  163. package/src/mcp-connection-status.ts +35 -0
  164. package/src/model-policy.ts +21 -0
  165. package/src/plugin-details.tsx +8 -5
  166. package/src/plugin-discovery.tsx +92 -72
  167. package/src/realtime/realtime-control.tsx +6 -8
  168. package/src/session-auth-recommendation.ts +48 -0
  169. package/src/session-capability-policy.ts +83 -0
  170. package/src/session-ui.ts +2 -0
  171. package/src/session.ts +1 -0
  172. package/src/skill-discovery.tsx +101 -56
  173. package/src/timeline/compaction-copy.ts +40 -0
  174. package/src/timeline/platform-activity-row.tsx +8 -3
  175. package/src/timeline/projection.ts +78 -2
  176. package/src/timeline/rolling-activity.tsx +4 -2
  177. package/src/timeline/shared.tsx +6 -1
  178. package/src/timeline/startup-timings.tsx +1 -1
  179. package/src/timeline/tool-display-name.ts +8 -6
  180. package/src/timeline/tool-renderers.tsx +5 -3
  181. package/src/timeline/turn-summary.tsx +17 -3
  182. package/src/timeline/types.ts +24 -2
  183. package/styles/compiled.css +325 -27
  184. package/styles/connect.css +90 -15
  185. package/styles/index.css +46 -0
  186. package/styles/session-capability.css +42 -0
  187. package/dist/chunk-45XEUVTK.js.map +0 -1
  188. package/dist/chunk-HQV2I5HV.js +0 -124
  189. package/dist/chunk-HQV2I5HV.js.map +0 -1
  190. package/dist/chunk-HUIKIDM5.js.map +0 -1
  191. package/dist/chunk-ICA6R6TW.js.map +0 -1
  192. package/dist/chunk-IHQII5WO.js +0 -886
  193. package/dist/chunk-IHQII5WO.js.map +0 -1
  194. package/dist/chunk-KANFU34B.js.map +0 -1
  195. package/dist/chunk-L2NBTKRX.js.map +0 -1
  196. package/dist/chunk-NYESIADM.js.map +0 -1
  197. package/dist/chunk-PEI6RANI.js.map +0 -1
  198. package/dist/chunk-TDSEILUH.js.map +0 -1
  199. package/dist/chunk-UMECRJRV.js.map +0 -1
  200. package/dist/hooks/use-packs.d.ts +0 -32
  201. package/dist/platform-activity-row-DUE2W74J.js.map +0 -1
  202. package/src/hooks/use-packs.ts +0 -157
  203. /package/dist/{browser-viewer-NTD6UIPR.js.map → browser-viewer-LGH4IP47.js.map} +0 -0
  204. /package/dist/{chunk-NOSYBS2D.js.map → chunk-2VHARTBL.js.map} +0 -0
  205. /package/dist/{chunk-5M6VTFJ5.js.map → chunk-GBPCZH3Y.js.map} +0 -0
  206. /package/dist/{chunk-YBM6CQRU.js.map → chunk-GEN54DU5.js.map} +0 -0
  207. /package/dist/{chunk-R4KRSFGA.js.map → chunk-IP4BUBKH.js.map} +0 -0
  208. /package/dist/{chunk-NLTS7JHI.js.map → chunk-JPHDWKZE.js.map} +0 -0
  209. /package/dist/{chunk-24M4YBCL.js.map → chunk-PNAVEK2U.js.map} +0 -0
  210. /package/dist/{model-policy-picker-menu-3R336DP2.js.map → model-policy-picker-menu-RVOQ4ZZG.js.map} +0 -0
  211. /package/dist/{queue-surface-implementation-LK3S4BIW.js.map → queue-surface-implementation-3RIFK2BS.js.map} +0 -0
  212. /package/dist/{timeline-annotation-markers-DRSTLEM6.js.map → timeline-annotation-markers-OY6OWR3V.js.map} +0 -0
  213. /package/dist/{timeline-annotation-selection-IHLUGVND.js.map → timeline-annotation-selection-BOXA2TIN.js.map} +0 -0
  214. /package/dist/{timeline-annotations-dialog-6Q53N5FG.js.map → timeline-annotations-dialog-RGY3MHL3.js.map} +0 -0
@@ -18,12 +18,12 @@ import {
18
18
  import {
19
19
  copyTextToClipboard
20
20
  } from "./chunk-JVYQRRC4.js";
21
- import {
22
- formatBytes
23
- } from "./chunk-PLYRL5ER.js";
24
21
  import {
25
22
  usePageLiveActivity
26
23
  } from "./chunk-KZ73RL76.js";
24
+ import {
25
+ formatBytes
26
+ } from "./chunk-PLYRL5ER.js";
27
27
  import {
28
28
  useEmbeddedBrowserInteraction
29
29
  } from "./chunk-NEXLLTP4.js";
@@ -3904,4 +3904,4 @@ export {
3904
3904
  useSiteAuthConnections,
3905
3905
  BrowserViewer
3906
3906
  };
3907
- //# sourceMappingURL=chunk-24M4YBCL.js.map
3907
+ //# sourceMappingURL=chunk-PNAVEK2U.js.map
@@ -1,9 +1,3 @@
1
- import {
2
- CREDIT_EXHAUSTION_MESSAGE,
3
- isCreditExhaustion,
4
- presentFailure,
5
- tryParseJson
6
- } from "./chunk-PLYRL5ER.js";
7
1
  import {
8
2
  useDebouncedCallback,
9
3
  useMutationRunner,
@@ -11,6 +5,12 @@ import {
11
5
  usePolledValue,
12
6
  useSessionEventTrigger
13
7
  } from "./chunk-KZ73RL76.js";
8
+ import {
9
+ CREDIT_EXHAUSTION_MESSAGE,
10
+ isCreditExhaustion,
11
+ presentFailure,
12
+ tryParseJson
13
+ } from "./chunk-PLYRL5ER.js";
14
14
  import {
15
15
  useEmbeddedHumanInputSession,
16
16
  useEmbeddedSession,
@@ -72,12 +72,11 @@ function mcpToolLeaf(name) {
72
72
  function toolMatchesLeaf(wireName, leaf) {
73
73
  return wireName === leaf || wireName.endsWith(`__${leaf}`);
74
74
  }
75
- function toolDisplayName(name) {
76
- const phrase = mcpToolLeaf(name).replace(/[_-]+/g, " ").trim();
77
- if (!phrase) {
78
- return name;
79
- }
80
- return phrase.charAt(0).toUpperCase() + phrase.slice(1);
75
+ function toolDisplayName(name, display) {
76
+ if (!display && /^[a-f0-9]{64}$/.test(name)) return "Tool call";
77
+ const phrase = (display?.toolName ?? mcpToolLeaf(name)).replace(/[_-]+/g, " ").trim();
78
+ const title = display?.title ?? (phrase ? phrase.charAt(0).toUpperCase() + phrase.slice(1) : name);
79
+ return display?.accountLabel ? `${title} \u2014 ${display.accountLabel}` : title;
81
80
  }
82
81
 
83
82
  // src/older-history.ts
@@ -124,7 +123,8 @@ function createOlderHistoryLoadReceipt(load) {
124
123
 
125
124
  // src/timeline/projection.ts
126
125
  import {
127
- parseMediaGenerationResult
126
+ parseMediaGenerationResult,
127
+ parseToolDisplayMetadata
128
128
  } from "@opengeni/sdk";
129
129
 
130
130
  // src/timeline/fleet-decision-projection.ts
@@ -408,10 +408,13 @@ function timelineAnnotationToolOutputText(output) {
408
408
  const text = (marker >= 0 ? raw.slice(marker + "\nOutput:\n".length) : raw.startsWith("Output:\n") ? raw.slice("Output:\n".length) : raw).replace(TIMELINE_ANNOTATION_ANSI_SEQUENCE, "");
409
409
  return text.length > 0 ? text : null;
410
410
  }
411
- function buildTimeline(events) {
411
+ function buildTimeline(events, options = {}) {
412
412
  const items = [];
413
413
  const prescan = prescanTurnAnchors(events);
414
414
  const ordered = orderTimelineEvents(events, prescan);
415
+ let completeHistoryPrefix = options.partialStart !== true;
416
+ const knownMessagePrefixTurns = /* @__PURE__ */ new Set();
417
+ const incompleteMessageKeys = /* @__PURE__ */ new Set();
415
418
  const pendingWaitOutcomeByTurn = /* @__PURE__ */ new Map();
416
419
  const latestAgentResponseByTurn = /* @__PURE__ */ new Map();
417
420
  const identifiedMessages = /* @__PURE__ */ new Map();
@@ -529,6 +532,11 @@ function buildTimeline(events) {
529
532
  for (const event of ordered) {
530
533
  const payload = asRecord2(event.payload);
531
534
  const turnId = event.turnId ?? null;
535
+ if (event.type === "session.created") {
536
+ completeHistoryPrefix = true;
537
+ } else if (event.type === "turn.started" || event.type === "user.message" && payload.delivery !== "steer" && payload.routing !== "accepted_for_steering") {
538
+ knownMessagePrefixTurns.add(turnId);
539
+ }
532
540
  startupEvent = event;
533
541
  startupTurnId = turnId;
534
542
  startupAttemptId = (typeof event.turnAttemptId === "string" ? event.turnAttemptId : null) ?? stringValue(payload.attemptId);
@@ -618,6 +626,10 @@ function buildTimeline(events) {
618
626
  }
619
627
  const messageId = stringValue(payload.messageId);
620
628
  const messageKey = messageId ? JSON.stringify([turnId, messageId]) : null;
629
+ if (!completeHistoryPrefix && !knownMessagePrefixTurns.has(turnId) || messageKey && incompleteMessageKeys.has(messageKey)) {
630
+ if (messageKey) incompleteMessageKeys.add(messageKey);
631
+ break;
632
+ }
621
633
  const identified = messageKey ? identifiedMessages.get(messageKey) : void 0;
622
634
  if (identified) {
623
635
  if (identified.annotationSource?.eventType !== "agent.message.completed") {
@@ -657,6 +669,7 @@ function buildTimeline(events) {
657
669
  break;
658
670
  }
659
671
  case "agent.message.completed": {
672
+ knownMessagePrefixTurns.add(turnId);
660
673
  const text = stringValue(payload.text);
661
674
  const messageId = stringValue(payload.messageId);
662
675
  const messageKey = messageId ? JSON.stringify([turnId, messageId]) : null;
@@ -740,6 +753,7 @@ function buildTimeline(events) {
740
753
  }
741
754
  case "agent.toolCall.created": {
742
755
  const name = typeof payload.name === "string" ? payload.name : "tool";
756
+ const display = parseToolDisplayMetadata(payload.display);
743
757
  const callId = typeof payload.id === "string" ? payload.id : null;
744
758
  const args = payload.arguments ?? null;
745
759
  closeStreamingTail();
@@ -769,6 +783,7 @@ function buildTimeline(events) {
769
783
  (item) => item.kind === "tool-call" && item.callId === callId
770
784
  );
771
785
  if (existing) {
786
+ if (display) existing.display = display;
772
787
  if (args != null) {
773
788
  existing.arguments = args;
774
789
  }
@@ -785,6 +800,7 @@ function buildTimeline(events) {
785
800
  turnId,
786
801
  callId,
787
802
  name,
803
+ ...display ? { display } : {},
788
804
  arguments: args,
789
805
  output: void 0,
790
806
  truncation: null,
@@ -984,6 +1000,7 @@ ${message}` : message;
984
1000
  estimatedTokensBefore: numberOrNull(payload.estimatedTokensBefore),
985
1001
  estimatedTokensAfter: null,
986
1002
  skipReason: null,
1003
+ providerRejection: null,
987
1004
  implementation: typeof payload.implementation === "string" ? payload.implementation : null,
988
1005
  occurredAt: event.occurredAt
989
1006
  });
@@ -999,6 +1016,7 @@ ${message}` : message;
999
1016
  estimatedTokensBefore: numberOrNull(payload.estimatedTokensBefore),
1000
1017
  estimatedTokensAfter: numberOrNull(payload.estimatedTokensAfter),
1001
1018
  skipReason: null,
1019
+ providerRejection: null,
1002
1020
  implementation: typeof payload.implementation === "string" ? payload.implementation : null,
1003
1021
  occurredAt: event.occurredAt
1004
1022
  });
@@ -1014,6 +1032,7 @@ ${message}` : message;
1014
1032
  estimatedTokensBefore: numberOrNull(payload.estimatedTokensBefore),
1015
1033
  estimatedTokensAfter: null,
1016
1034
  skipReason: typeof payload.reason === "string" ? payload.reason : null,
1035
+ providerRejection: compactionProviderRejection(payload),
1017
1036
  implementation: typeof payload.implementation === "string" ? payload.implementation : null,
1018
1037
  occurredAt: event.occurredAt
1019
1038
  });
@@ -1043,6 +1062,8 @@ ${message}` : message;
1043
1062
  id: event.id,
1044
1063
  turnId,
1045
1064
  serverId: typeof payload.serverId === "string" ? payload.serverId : null,
1065
+ canonicalServerId: typeof payload.canonicalServerId === "string" ? payload.canonicalServerId : null,
1066
+ connectionSubjectScope: payload.connectionSubjectScope === "subject" || payload.connectionSubjectScope === "workspace" ? payload.connectionSubjectScope : null,
1046
1067
  source: capability ? "capability" : event.type === "tool.auth_needed" ? "tool" : "credential",
1047
1068
  providerDomain: stringValue(payload.providerDomain),
1048
1069
  connectionId: typeof payload.connectionId === "string" ? payload.connectionId : null,
@@ -1251,7 +1272,14 @@ ${message}` : message;
1251
1272
  break;
1252
1273
  }
1253
1274
  }
1275
+ const sourceEventsById = new Map(events.map((event) => [event.id, event]));
1254
1276
  for (const item of items) {
1277
+ const source = sourceEventsById.get(item.id);
1278
+ const canonical = "annotationSource" in item ? item.annotationSource : void 0;
1279
+ item.sourceEvents = [
1280
+ ...source ? [{ eventId: source.id, sequence: source.sequence }] : [],
1281
+ ...canonical && canonical.eventId !== source?.id ? [{ eventId: canonical.eventId, sequence: canonical.sequence }] : []
1282
+ ];
1255
1283
  if (item.kind === "agent-message") {
1256
1284
  item.text = stripOpaqueCitationTokens(item.text);
1257
1285
  }
@@ -1807,6 +1835,20 @@ function assistantMessagePhase(value) {
1807
1835
  function numberOrNull(value) {
1808
1836
  return typeof value === "number" && Number.isFinite(value) ? value : null;
1809
1837
  }
1838
+ function compactionProviderRejection(payload) {
1839
+ const record = asRecord2(payload.providerRejection);
1840
+ if (typeof record.httpStatus !== "number" || !Number.isFinite(record.httpStatus)) {
1841
+ return null;
1842
+ }
1843
+ const text = (value) => typeof value === "string" && value.trim() ? value : null;
1844
+ return {
1845
+ httpStatus: record.httpStatus,
1846
+ type: text(record.type),
1847
+ code: text(record.code),
1848
+ param: text(record.param),
1849
+ requestId: text(record.requestId)
1850
+ };
1851
+ }
1810
1852
  function compactionTrigger(payload) {
1811
1853
  const trigger = payload.trigger;
1812
1854
  return trigger === "auto" || trigger === "operator" || trigger === "proactive" || trigger === "overflow" ? trigger : null;
@@ -2097,7 +2139,7 @@ function capabilityAuthorizationRequest(value) {
2097
2139
  const kind = record.kind;
2098
2140
  const source = record.source;
2099
2141
  const action = record.action;
2100
- if (typeof record.id !== "string" || typeof record.name !== "string" || !["pack", "mcp", "api", "skill", "plugin"].includes(String(kind)) || !["built_in", "library", "configured", "public_registry", "registry", "manual"].includes(
2142
+ if (typeof record.id !== "string" || typeof record.name !== "string" || !["mcp", "api", "skill", "plugin"].includes(String(kind)) || !["built_in", "library", "configured", "public_registry", "registry", "manual"].includes(
2101
2143
  String(source)
2102
2144
  ) || !["connect", "add_credentials", "enable"].includes(String(action)) || typeof record.rationale !== "string") {
2103
2145
  return null;
@@ -2268,6 +2310,8 @@ function useSessionEvents(sessionId, options = {}) {
2268
2310
  const replay = options.replay ?? "windowed";
2269
2311
  const fullReplay = replay === "full" || after !== 0;
2270
2312
  const streamKey = `${workspaceId}\0${sessionId ?? ""}\0${after}\0${fullReplay ? "full" : "windowed"}`;
2313
+ const navigationIdentityRef = useRef({ client, streamKey, enabled });
2314
+ navigationIdentityRef.current = { client, streamKey, enabled };
2271
2315
  const [eventWindow, setEventWindow] = useState(EMPTY_EVENT_WINDOW);
2272
2316
  const [connectionState, setConnectionState] = useState("idle");
2273
2317
  const [error, setError] = useState(null);
@@ -2282,6 +2326,8 @@ function useSessionEvents(sessionId, options = {}) {
2282
2326
  const [loadingNewer, setLoadingNewer] = useState(false);
2283
2327
  const [loadingOldest, setLoadingOldest] = useState(false);
2284
2328
  const [loadingLatest, setLoadingLatest] = useState(false);
2329
+ const [loadingTarget, setLoadingTarget] = useState(false);
2330
+ const loadingTargetRef = useRef(false);
2285
2331
  const [streamEpoch, setStreamEpoch] = useState(0);
2286
2332
  const [viewMode, setViewMode] = useState("live");
2287
2333
  const lastSequenceRef = useRef(after);
@@ -2313,6 +2359,8 @@ function useSessionEvents(sessionId, options = {}) {
2313
2359
  loadingOlderRef.current = false;
2314
2360
  loadingNewerRef.current = false;
2315
2361
  loadingOldestRef.current = false;
2362
+ loadingTargetRef.current = false;
2363
+ setLoadingTarget(false);
2316
2364
  setLoadingOlder(false);
2317
2365
  setLoadingNewer(false);
2318
2366
  setLoadingOldest(false);
@@ -2579,7 +2627,7 @@ function useSessionEvents(sessionId, options = {}) {
2579
2627
  viewMode,
2580
2628
  reconcileSession
2581
2629
  ]);
2582
- const navigationBusy = () => loadingOlderRef.current || loadingNewerRef.current || loadingOldestRef.current || loadingLatestRef.current;
2630
+ const navigationBusy = () => loadingTargetRef.current || loadingOlderRef.current || loadingNewerRef.current || loadingOldestRef.current || loadingLatestRef.current;
2583
2631
  const loadOlder = useCallback(
2584
2632
  () => createOlderHistoryLoadReceipt(async (markCommitted, preserveTail, markTailPreserved) => {
2585
2633
  if (!sessionId || navigationBusy() || !hasOlderRef.current) {
@@ -2839,7 +2887,84 @@ function useSessionEvents(sessionId, options = {}) {
2839
2887
  }
2840
2888
  }
2841
2889
  }, [client, workspaceId, sessionId]);
2890
+ const jumpToSequence = useCallback(
2891
+ async (sequence, navigationOptions) => {
2892
+ const signal = navigationOptions?.signal;
2893
+ if (!sessionId || !Number.isSafeInteger(sequence) || sequence < 1) return false;
2894
+ if (signal?.aborted) return false;
2895
+ const generation = ++navigationGenerationRef.current;
2896
+ const current = () => generation === navigationGenerationRef.current && navigationIdentityRef.current.client === client && navigationIdentityRef.current.streamKey === streamKey && navigationIdentityRef.current.enabled === enabled;
2897
+ const previousMode = viewModeRef.current;
2898
+ streamAbortRef.current?.abort();
2899
+ generationRef.current += 1;
2900
+ viewModeRef.current = "history";
2901
+ setViewMode("history");
2902
+ loadingOlderRef.current = loadingNewerRef.current = loadingOldestRef.current = false;
2903
+ setLoadingOlder(false);
2904
+ setLoadingNewer(false);
2905
+ setLoadingOldest(false);
2906
+ loadingTargetRef.current = true;
2907
+ setLoadingTarget(true);
2908
+ let published = false;
2909
+ try {
2910
+ const [before, following] = await Promise.all([
2911
+ loadPreviousPage(client, workspaceId, sessionId, sequence + 1, { pageSize: 128 }),
2912
+ loadNextPage(client, workspaceId, sessionId, sequence, { pageSize: 128 })
2913
+ ]);
2914
+ if (signal?.aborted) return false;
2915
+ if (!current()) return false;
2916
+ if (!before.some((event) => event.sequence === sequence)) return false;
2917
+ const prefix = boundBrowserSessionEventWindow(before, {
2918
+ direction: "newest",
2919
+ maxBytes: SESSION_EVENT_BROWSER_MAX_BYTES / 2
2920
+ });
2921
+ const retained = boundBrowserSessionEventWindow([...prefix.events, ...following], {
2922
+ direction: "oldest"
2923
+ });
2924
+ if (!retained.events.some((event) => event.sequence === sequence)) return false;
2925
+ streamAbortRef.current?.abort();
2926
+ generationRef.current += 1;
2927
+ const status = observeSessionStatus(retained.events, sessionStatusRef);
2928
+ eventWindowRef.current = retained;
2929
+ oldestSequenceRef.current = retained.events[0].sequence;
2930
+ newestSequenceRef.current = maxResumeSequenceOrNull(retained.events);
2931
+ lastSequenceRef.current = Math.max(lastSequenceRef.current, newestSequenceRef.current ?? 0);
2932
+ hasOlderRef.current = !isLogStart(retained.events[0]);
2933
+ hasNewerRef.current = following.length > 0 || retained.truncated || (newestSequenceRef.current ?? 0) < lastSequenceRef.current;
2934
+ initialWindowLoadedRef.current = true;
2935
+ viewModeRef.current = "history";
2936
+ setEventWindow(retained);
2937
+ setHasOlder(hasOlderRef.current);
2938
+ setHasNewer(hasNewerRef.current);
2939
+ setInitialLoading(false);
2940
+ setViewMode("history");
2941
+ setNewerError(null);
2942
+ if (status !== void 0) setSessionStatusProjection(status);
2943
+ published = true;
2944
+ return true;
2945
+ } catch (reason) {
2946
+ if (!current() || signal?.aborted) return false;
2947
+ throw reason;
2948
+ } finally {
2949
+ if (current()) {
2950
+ loadingTargetRef.current = false;
2951
+ setLoadingTarget(false);
2952
+ if (!published && previousMode === "live") {
2953
+ viewModeRef.current = "live";
2954
+ setViewMode("live");
2955
+ setStreamEpoch((epoch) => epoch + 1);
2956
+ }
2957
+ }
2958
+ }
2959
+ },
2960
+ [client, workspaceId, sessionId, streamKey, enabled]
2961
+ );
2842
2962
  const jumpToLatest = useCallback(async () => {
2963
+ if (loadingTargetRef.current) {
2964
+ navigationGenerationRef.current += 1;
2965
+ loadingTargetRef.current = false;
2966
+ setLoadingTarget(false);
2967
+ }
2843
2968
  if (!sessionId || navigationBusy()) {
2844
2969
  return;
2845
2970
  }
@@ -2878,7 +3003,12 @@ function useSessionEvents(sessionId, options = {}) {
2878
3003
  }, [after, sessionId]);
2879
3004
  const identityMatches = stateStreamKey === streamKey;
2880
3005
  const visibleEvents = identityMatches ? eventWindow.events : EMPTY_EVENTS;
2881
- const timeline = useMemo(() => buildTimeline(visibleEvents), [visibleEvents]);
3006
+ const timeline = useMemo(
3007
+ () => buildTimeline(visibleEvents, {
3008
+ partialStart: hasOlder || eventWindow.truncated || after > 0
3009
+ }),
3010
+ [visibleEvents, hasOlder, eventWindow.truncated, after]
3011
+ );
2882
3012
  return {
2883
3013
  events: visibleEvents,
2884
3014
  timeline,
@@ -2899,6 +3029,8 @@ function useSessionEvents(sessionId, options = {}) {
2899
3029
  loadOldest,
2900
3030
  loadingLatest: !identityMatches ? false : loadingLatest,
2901
3031
  jumpToLatest,
3032
+ jumpToSequence,
3033
+ loadingTarget: identityMatches && loadingTarget,
2902
3034
  error: identityMatches ? newerError ?? error : null
2903
3035
  };
2904
3036
  }
@@ -3742,6 +3874,57 @@ function useHumanInputRequests(sessionId, options = {}) {
3742
3874
  };
3743
3875
  }
3744
3876
 
3877
+ // src/conversation-timeline.ts
3878
+ function conversationTimeline(items, queue, composer) {
3879
+ const queued = new Set(
3880
+ queue.queue.filter((turn) => turn.metadata.delivery !== "steer").map((turn) => turn.triggerEventId)
3881
+ );
3882
+ const pending = composer.optimisticMessages ?? [];
3883
+ const pendingQueue = new Set(
3884
+ pending.filter(
3885
+ (message) => message.destination === "queue" && !(message.turnId && message.appliedQueueVersion != null && queue.snapshot && queue.snapshot.version >= message.appliedQueueVersion && !queue.queue.some((turn) => turn.id === message.turnId))
3886
+ ).map((message) => `user-message:${message.clientEventId}`)
3887
+ );
3888
+ const visible = items.filter(
3889
+ (item) => item.kind !== "user-message" || !queued.has(item.id) && !pendingQueue.has(item.reconciliationKey ?? "")
3890
+ );
3891
+ const keys = new Set(
3892
+ visible.flatMap((item) => item.kind === "user-message" ? [item.reconciliationKey] : [])
3893
+ );
3894
+ const optimistic = pending.filter(
3895
+ (message) => (message.destination === "chat" || message.state === "failed") && !keys.has(`user-message:${message.clientEventId}`) && !queue.queue.some((turn) => turn.id === message.turnId)
3896
+ ).map((message) => ({
3897
+ kind: "user-message",
3898
+ id: `optimistic:${message.clientEventId}`,
3899
+ reconciliationKey: `user-message:${message.clientEventId}`,
3900
+ text: message.text,
3901
+ annotations: message.annotations.map((annotation, ordinal) => ({ ...annotation, ordinal })),
3902
+ resources: message.resources,
3903
+ tools: [],
3904
+ occurredAt: message.occurredAt,
3905
+ delivery: {
3906
+ state: message.state,
3907
+ ...message.error ? { error: message.error } : {},
3908
+ ...message.state === "failed" ? {
3909
+ onRetry: () => composer.retryOptimisticMessage?.(message.clientEventId),
3910
+ onRemove: () => composer.removeOptimisticMessage?.(message.clientEventId)
3911
+ } : {}
3912
+ }
3913
+ }));
3914
+ const ids = new Set(visible.map((item) => item.id));
3915
+ const steers = (queue.acceptedSteers ?? []).filter((steer) => !ids.has(steer.triggerEventId)).map((steer) => ({
3916
+ kind: "user-message",
3917
+ id: steer.triggerEventId,
3918
+ text: steer.text,
3919
+ annotations: steer.annotations,
3920
+ resources: steer.resources,
3921
+ tools: steer.tools,
3922
+ occurredAt: steer.occurredAt,
3923
+ delivery: { state: steer.state }
3924
+ }));
3925
+ return [...visible, ...optimistic, ...steers];
3926
+ }
3927
+
3745
3928
  export {
3746
3929
  isActionableHumanInputRequest,
3747
3930
  humanInputRequestFromEvent,
@@ -3766,6 +3949,7 @@ export {
3766
3949
  isTurnQueueEvent,
3767
3950
  useTurnQueue,
3768
3951
  isHumanInputEvent,
3769
- useHumanInputRequests
3952
+ useHumanInputRequests,
3953
+ conversationTimeline
3770
3954
  };
3771
- //# sourceMappingURL=chunk-L2NBTKRX.js.map
3955
+ //# sourceMappingURL=chunk-TXCBE32L.js.map