@opengeni/react 3.5.1-canary.0 → 3.7.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/artifacts.d.ts +1 -1
  2. package/dist/artifacts.js +229 -6
  3. package/dist/artifacts.js.map +1 -1
  4. package/dist/{chunk-IB27C53Y.js → chunk-C6WDLHBA.js} +31 -23
  5. package/dist/chunk-C6WDLHBA.js.map +1 -0
  6. package/dist/{chunk-WY3MELVJ.js → chunk-DOK4KZF2.js} +119 -8
  7. package/dist/chunk-DOK4KZF2.js.map +1 -0
  8. package/dist/{chunk-TJFMMDQU.js → chunk-FJBOU2TH.js} +112 -6
  9. package/dist/chunk-FJBOU2TH.js.map +1 -0
  10. package/dist/{chunk-UNCXXIQR.js → chunk-R55HFTT3.js} +66 -24
  11. package/dist/chunk-R55HFTT3.js.map +1 -0
  12. package/dist/client.d.ts +1 -1
  13. package/dist/components/artifacts/index.d.ts +1 -1
  14. package/dist/components/artifacts/published-html-artifact-frame.d.ts +45 -3
  15. package/dist/components/composer.d.ts +2 -0
  16. package/dist/components/session-chrome.d.ts +1 -1
  17. package/dist/composer.js +1 -1
  18. package/dist/{fleet-decision-row-GGCAT4E4.js → fleet-decision-row-YZ3ZKWMM.js} +2 -1
  19. package/dist/fleet-decision-row-YZ3ZKWMM.js.map +1 -0
  20. package/dist/hooks/use-file-attachments.d.ts +6 -0
  21. package/dist/hooks/use-sandbox-files.d.ts +4 -1
  22. package/dist/hooks/use-workspace-edit.d.ts +4 -0
  23. package/dist/index.js +114 -58
  24. package/dist/index.js.map +1 -1
  25. package/dist/session-ui.js +2 -2
  26. package/dist/session.js +2 -2
  27. package/dist/timeline/registry.d.ts +2 -0
  28. package/dist/timeline/types.d.ts +1 -1
  29. package/package.json +2 -2
  30. package/src/artifacts.ts +3 -0
  31. package/src/client.ts +2 -1
  32. package/src/components/artifacts/index.ts +3 -0
  33. package/src/components/artifacts/published-html-artifact-frame.tsx +284 -4
  34. package/src/components/composer.tsx +89 -25
  35. package/src/components/message-timeline.tsx +32 -8
  36. package/src/components/sandbox-workspace.tsx +11 -1
  37. package/src/components/session-chrome.tsx +3 -3
  38. package/src/hooks/use-file-attachments.ts +34 -0
  39. package/src/hooks/use-sandbox-files.ts +68 -20
  40. package/src/hooks/use-session-events.ts +21 -26
  41. package/src/hooks/use-workspace-edit.ts +23 -5
  42. package/src/timeline/fleet-decision-projection.ts +2 -1
  43. package/src/timeline/fleet-decision-row.tsx +1 -0
  44. package/src/timeline/projection.ts +151 -7
  45. package/src/timeline/registry.ts +15 -3
  46. package/src/timeline/tool-renderers.tsx +117 -1
  47. package/src/timeline/types.ts +8 -1
  48. package/dist/chunk-IB27C53Y.js.map +0 -1
  49. package/dist/chunk-TJFMMDQU.js.map +0 -1
  50. package/dist/chunk-UNCXXIQR.js.map +0 -1
  51. package/dist/chunk-WY3MELVJ.js.map +0 -1
  52. package/dist/fleet-decision-row-GGCAT4E4.js.map +0 -1
@@ -112,6 +112,7 @@ var FLEET_ACTUAL_REASONS = [
112
112
  "rotation",
113
113
  "active",
114
114
  "all_capped",
115
+ "allocator_disabled",
115
116
  "none"
116
117
  ];
117
118
  var FLEET_SHADOW_OUTCOMES = ["selected", "paced", "none"];
@@ -329,7 +330,7 @@ function fleetComparisonIsConsistent(comparison, actualOutcome, actualCandidateK
329
330
  return comparableActualOutcome !== "selected" || actualCandidateKey === shadowCandidateKey;
330
331
  }
331
332
  function fleetDecisionSemanticsAreConsistent(input) {
332
- const actualConsistent = input.actualOutcome === "selected" ? ["lease_reused", "pin", "rotation", "active"].includes(input.actualReason) : input.actualOutcome === "waiting" ? input.actualReason === "all_capped" : input.actualReason === "none";
333
+ const actualConsistent = input.actualOutcome === "selected" ? ["lease_reused", "pin", "rotation", "active"].includes(input.actualReason) : input.actualOutcome === "waiting" ? ["all_capped", "allocator_disabled"].includes(input.actualReason) : input.actualReason === "none";
333
334
  const shadowConsistent = input.shadowOutcome === "selected" ? ["fenced_in_flight", "best_score", "affinity_best", "hysteresis_hold"].includes(
334
335
  input.shadowReason
335
336
  ) : input.shadowOutcome === "paced" ? input.shadowReason === "admission_paced" : ["fenced_candidate_missing", "no_eligible_candidate", "overlay_isolated_empty"].includes(
@@ -388,6 +389,8 @@ function buildTimeline(events) {
388
389
  const items = [];
389
390
  const prescan = prescanTurnAnchors(events);
390
391
  const ordered = orderTimelineEvents(events, prescan);
392
+ const pendingWaitOutcomeByTurn = /* @__PURE__ */ new Map();
393
+ const latestAgentResponseByTurn = /* @__PURE__ */ new Map();
391
394
  const humanInputRequests = humanInputRequestsById(events);
392
395
  const humanInputToolCallIds = new Set(
393
396
  [...humanInputRequests.values()].map((request) => stringValue(request.toolCallId)).filter(Boolean)
@@ -450,6 +453,23 @@ function buildTimeline(events) {
450
453
  startupPhases.set(key, [item, startupAttemptId, startupRecoveryRevision]);
451
454
  };
452
455
  const last = () => items[items.length - 1];
456
+ const rememberAgentResponse = (turnId, item, completed) => {
457
+ latestAgentResponseByTurn.set(turnId, { item, completed });
458
+ };
459
+ const takePendingWaitOutcome = (turnId) => {
460
+ const outcome = pendingWaitOutcomeByTurn.get(turnId);
461
+ pendingWaitOutcomeByTurn.delete(turnId);
462
+ return outcome;
463
+ };
464
+ const takeAgentResponse = (turnId) => {
465
+ const response = latestAgentResponseByTurn.get(turnId);
466
+ latestAgentResponseByTurn.delete(turnId);
467
+ return response;
468
+ };
469
+ const clearUnscopedTerminalTracking = () => {
470
+ latestAgentResponseByTurn.delete(null);
471
+ pendingWaitOutcomeByTurn.delete(null);
472
+ };
453
473
  const closeStreamingTail = () => {
454
474
  const open = last();
455
475
  if ((open?.kind === "agent-message" || open?.kind === "reasoning") && open.streaming) {
@@ -500,6 +520,7 @@ function buildTimeline(events) {
500
520
  }
501
521
  switch (event.type) {
502
522
  case "user.message": {
523
+ clearUnscopedTerminalTracking();
503
524
  closeStreamingTail();
504
525
  const childCompletion = workerCompletionPayload(payload.childCompletion);
505
526
  if (childCompletion) {
@@ -571,17 +592,20 @@ function buildTimeline(events) {
571
592
  const open = last();
572
593
  if (open?.kind === "agent-message" && open.streaming && open.turnId === turnId) {
573
594
  open.text += text;
595
+ rememberAgentResponse(turnId, open, false);
574
596
  break;
575
597
  }
576
598
  closeStreamingTail();
577
- items.push({
599
+ const item = {
578
600
  kind: "agent-message",
579
601
  id: event.id,
580
602
  turnId,
581
603
  text,
582
604
  streaming: true,
583
605
  occurredAt: event.occurredAt
584
- });
606
+ };
607
+ items.push(item);
608
+ rememberAgentResponse(turnId, item, false);
585
609
  break;
586
610
  }
587
611
  case "agent.message.completed": {
@@ -616,10 +640,11 @@ function buildTimeline(events) {
616
640
  items.splice(openIndex, 1);
617
641
  items.push(open);
618
642
  }
643
+ rememberAgentResponse(turnId, open, true);
619
644
  break;
620
645
  }
621
646
  if (text) {
622
- items.push({
647
+ const item = {
623
648
  kind: "agent-message",
624
649
  id: event.id,
625
650
  turnId,
@@ -635,7 +660,9 @@ function buildTimeline(events) {
635
660
  turnId,
636
661
  text
637
662
  }
638
- });
663
+ };
664
+ items.push(item);
665
+ rememberAgentResponse(turnId, item, true);
639
666
  }
640
667
  break;
641
668
  }
@@ -758,6 +785,7 @@ function buildTimeline(events) {
758
785
  break;
759
786
  }
760
787
  case "turn.started": {
788
+ if (turnId) clearUnscopedTerminalTracking();
761
789
  if (!turnId) break;
762
790
  const queuedAt = queuedAtByTurn.get(turnId);
763
791
  if (!queuedAt) break;
@@ -864,6 +892,16 @@ ${message}` : message;
864
892
  });
865
893
  break;
866
894
  }
895
+ case "codex.capacity.waiting": {
896
+ items.push({
897
+ kind: "notice",
898
+ id: event.id,
899
+ tone: "waiting",
900
+ text: stringValue(payload.detail) ?? stringValue(payload.error) ?? "Waiting for Codex capacity.",
901
+ occurredAt: event.occurredAt
902
+ });
903
+ break;
904
+ }
867
905
  case "session.requiresAction": {
868
906
  finalizeOpen(turnId, "complete", event.occurredAt);
869
907
  items.push({
@@ -964,10 +1002,14 @@ ${message}` : message;
964
1002
  case "turn.completed": {
965
1003
  if (payload.maintenance === "context_compaction") {
966
1004
  finalizeOpen(turnId, "complete", event.occurredAt);
1005
+ takeAgentResponse(turnId);
1006
+ takePendingWaitOutcome(turnId);
967
1007
  break;
968
1008
  }
969
1009
  if (isCreditExhaustionPayload(payload)) {
970
1010
  finalizeOpen(turnId, "complete", event.occurredAt);
1011
+ takeAgentResponse(turnId);
1012
+ takePendingWaitOutcome(turnId);
971
1013
  items.push(turnEndItem(event, "failed", CREDIT_EXHAUSTION_MESSAGE));
972
1014
  items.push({
973
1015
  kind: "notice",
@@ -978,11 +1020,53 @@ ${message}` : message;
978
1020
  });
979
1021
  break;
980
1022
  }
1023
+ const latestAgentResponse = takeAgentResponse(turnId);
1024
+ const finalOutput = stringValue(payload.output);
1025
+ const visibleFinalOutput = stripOpaqueCitationTokens(finalOutput).trim();
1026
+ const visibleTrackedResponse = stripOpaqueCitationTokens(
1027
+ latestAgentResponse?.item.text ?? ""
1028
+ ).trim();
1029
+ const finalOutputMirrorsCommentary = latestAgentResponse?.item.phase === "commentary" && visibleTrackedResponse === visibleFinalOutput;
1030
+ const hasAuthoritativeFinalOutput = Boolean(visibleFinalOutput) && !finalOutputMirrorsCommentary;
1031
+ const pendingWaitOutcome = takePendingWaitOutcome(turnId);
1032
+ if (hasAuthoritativeFinalOutput) {
1033
+ if (latestAgentResponse && !latestAgentResponse.completed && finalOutput.startsWith(latestAgentResponse.item.text)) {
1034
+ latestAgentResponse.item.text = finalOutput;
1035
+ latestAgentResponse.item.streaming = false;
1036
+ latestAgentResponse.item.occurredAt = event.occurredAt;
1037
+ const responseIndex = items.indexOf(latestAgentResponse.item);
1038
+ if (responseIndex >= 0 && responseIndex < items.length - 1) {
1039
+ items.splice(responseIndex, 1);
1040
+ items.push(latestAgentResponse.item);
1041
+ }
1042
+ } else if (visibleTrackedResponse !== visibleFinalOutput) {
1043
+ items.push({
1044
+ kind: "agent-message",
1045
+ id: `${event.id}-output-message`,
1046
+ turnId,
1047
+ text: finalOutput,
1048
+ streaming: false,
1049
+ occurredAt: event.occurredAt
1050
+ });
1051
+ }
1052
+ }
981
1053
  finalizeOpen(turnId, "complete", event.occurredAt);
982
1054
  items.push(turnEndItem(event, "complete", null));
1055
+ const hasCompletedFinalResponse = latestAgentResponse?.completed === true && latestAgentResponse.item.phase !== "commentary" && Boolean(visibleTrackedResponse);
1056
+ if (!hasAuthoritativeFinalOutput && !hasCompletedFinalResponse && pendingWaitOutcome) {
1057
+ items.push({
1058
+ kind: "notice",
1059
+ id: `${pendingWaitOutcome.id}-visible-outcome`,
1060
+ tone: "waiting",
1061
+ text: waitingOutcomeText(pendingWaitOutcome.reason),
1062
+ occurredAt: pendingWaitOutcome.occurredAt
1063
+ });
1064
+ }
983
1065
  break;
984
1066
  }
985
1067
  case "turn.failed": {
1068
+ takeAgentResponse(turnId);
1069
+ takePendingWaitOutcome(turnId);
986
1070
  const hadActivity = hasTurnActivity(items, turnId);
987
1071
  const failureText = isCreditExhaustionPayload(payload) ? CREDIT_EXHAUSTION_MESSAGE : failureMessage(payload);
988
1072
  finalizeOpen(turnId, "cancelled", event.occurredAt);
@@ -1002,6 +1086,8 @@ ${message}` : message;
1002
1086
  if (turnId && !prescan.startedTurnIds.has(turnId)) {
1003
1087
  break;
1004
1088
  }
1089
+ takeAgentResponse(turnId);
1090
+ takePendingWaitOutcome(turnId);
1005
1091
  const hadActivity = hasTurnActivity(items, turnId);
1006
1092
  finalizeOpen(turnId, "cancelled", event.occurredAt);
1007
1093
  items.push(turnEndItem(event, "cancelled", null));
@@ -1041,6 +1127,9 @@ ${message}` : message;
1041
1127
  case "goal.cleared":
1042
1128
  case "goal.held":
1043
1129
  case "goal.continuation": {
1130
+ if (event.type === "goal.held" && payload.actor === "agent") {
1131
+ rememberPendingWaitOutcome(pendingWaitOutcomeByTurn, event, payload, turnId);
1132
+ }
1044
1133
  if (shouldSuppressAgentGoalLandmark(event.type, payload)) {
1045
1134
  break;
1046
1135
  }
@@ -1053,6 +1142,12 @@ ${message}` : message;
1053
1142
  });
1054
1143
  break;
1055
1144
  }
1145
+ case "session.wait.started": {
1146
+ if (payload.actor === "agent") {
1147
+ rememberPendingWaitOutcome(pendingWaitOutcomeByTurn, event, payload, turnId);
1148
+ }
1149
+ break;
1150
+ }
1056
1151
  default:
1057
1152
  break;
1058
1153
  }
@@ -1687,6 +1782,8 @@ var SESSION_STATUSES = [
1687
1782
  "running",
1688
1783
  "idle",
1689
1784
  "requires_action",
1785
+ "recovering",
1786
+ "waiting_capacity",
1690
1787
  "failed",
1691
1788
  "cancelled"
1692
1789
  ];
@@ -1839,6 +1936,15 @@ function goalText(payload) {
1839
1936
  }
1840
1937
  return null;
1841
1938
  }
1939
+ function rememberPendingWaitOutcome(pending, event, payload, eventTurnId) {
1940
+ const reason = stringValue(payload.reason).trim();
1941
+ if (!reason) return;
1942
+ const turnId = eventTurnId || stringValue(payload.waitTurnId) || stringValue(payload.turnId) || null;
1943
+ pending.set(turnId, { id: event.id, reason, occurredAt: event.occurredAt });
1944
+ }
1945
+ function waitingOutcomeText(reason) {
1946
+ return /^waiting\b/i.test(reason) ? reason : `Waiting: ${reason}`;
1947
+ }
1842
1948
  function shouldSuppressAgentGoalLandmark(type, payload) {
1843
1949
  if (type === "goal.completed") {
1844
1950
  return true;
@@ -2035,4 +2141,4 @@ export {
2035
2141
  groupTimeline,
2036
2142
  extractSessionRef
2037
2143
  };
2038
- //# sourceMappingURL=chunk-TJFMMDQU.js.map
2144
+ //# sourceMappingURL=chunk-FJBOU2TH.js.map