@flamingo-stack/openframe-frontend-core 0.0.278 → 0.0.279

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 (72) hide show
  1. package/dist/{chunk-MVUN35FH.js → chunk-6ZMD3KBP.js} +2 -2
  2. package/dist/{chunk-DO55GWNT.cjs → chunk-776ZURDZ.cjs} +10 -10
  3. package/dist/{chunk-DO55GWNT.cjs.map → chunk-776ZURDZ.cjs.map} +1 -1
  4. package/dist/{chunk-5NL62LIF.js → chunk-7ECI5ZVO.js} +2 -2
  5. package/dist/{chunk-BBDJCXHW.cjs → chunk-7XVVRE53.cjs} +6 -6
  6. package/dist/{chunk-BBDJCXHW.cjs.map → chunk-7XVVRE53.cjs.map} +1 -1
  7. package/dist/{chunk-GO45CXT5.js → chunk-AVLSICZO.js} +49 -33
  8. package/dist/chunk-AVLSICZO.js.map +1 -0
  9. package/dist/{chunk-L4BJU5CE.cjs → chunk-QP4H2JJN.cjs} +34 -34
  10. package/dist/{chunk-L4BJU5CE.cjs.map → chunk-QP4H2JJN.cjs.map} +1 -1
  11. package/dist/{chunk-MDHNLZME.js → chunk-SZG56DA3.js} +2 -2
  12. package/dist/{chunk-WYQ5VFXA.cjs → chunk-XBTQK32O.cjs} +25 -25
  13. package/dist/{chunk-WYQ5VFXA.cjs.map → chunk-XBTQK32O.cjs.map} +1 -1
  14. package/dist/{chunk-737ZLQ2T.js → chunk-YK6FFIVG.js} +2 -2
  15. package/dist/{chunk-7LTWNUHB.cjs → chunk-Z53YSXDD.cjs} +149 -133
  16. package/dist/chunk-Z53YSXDD.cjs.map +1 -0
  17. package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
  18. package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts.map +1 -1
  19. package/dist/components/chat/index.cjs +2 -2
  20. package/dist/components/chat/index.js +1 -1
  21. package/dist/components/chat/types/api.types.d.ts +7 -2
  22. package/dist/components/chat/types/api.types.d.ts.map +1 -1
  23. package/dist/components/chat/types/message.types.d.ts +10 -0
  24. package/dist/components/chat/types/message.types.d.ts.map +1 -1
  25. package/dist/components/chat/types/network.types.d.ts +2 -0
  26. package/dist/components/chat/types/network.types.d.ts.map +1 -1
  27. package/dist/components/chat/types/processing.types.d.ts +1 -0
  28. package/dist/components/chat/types/processing.types.d.ts.map +1 -1
  29. package/dist/components/chat/utils/chunk-parser.d.ts.map +1 -1
  30. package/dist/components/chat/utils/history-merge.d.ts +8 -0
  31. package/dist/components/chat/utils/history-merge.d.ts.map +1 -1
  32. package/dist/components/chat/utils/message-segment-accumulator.d.ts +5 -3
  33. package/dist/components/chat/utils/message-segment-accumulator.d.ts.map +1 -1
  34. package/dist/components/chat/utils/process-historical-messages.d.ts.map +1 -1
  35. package/dist/components/contact/index.cjs +3 -3
  36. package/dist/components/contact/index.js +2 -2
  37. package/dist/components/faq/index.cjs +3 -3
  38. package/dist/components/faq/index.js +2 -2
  39. package/dist/components/features/index.cjs +2 -2
  40. package/dist/components/features/index.js +1 -1
  41. package/dist/components/index.cjs +53 -53
  42. package/dist/components/index.js +4 -4
  43. package/dist/components/navigation/index.cjs +2 -2
  44. package/dist/components/navigation/index.js +1 -1
  45. package/dist/components/related-content/index.cjs +3 -3
  46. package/dist/components/related-content/index.js +2 -2
  47. package/dist/components/tickets/index.cjs +52 -52
  48. package/dist/components/tickets/index.js +3 -3
  49. package/dist/components/ui/index.cjs +2 -2
  50. package/dist/components/ui/index.js +1 -1
  51. package/dist/index.cjs +2 -2
  52. package/dist/index.js +1 -1
  53. package/dist/utils/index.cjs.map +1 -1
  54. package/dist/utils/index.js.map +1 -1
  55. package/package.json +1 -1
  56. package/src/components/chat/chat-message-enhanced.tsx +1 -0
  57. package/src/components/chat/hooks/use-realtime-chunk-processor.ts +34 -21
  58. package/src/components/chat/types/api.types.ts +7 -2
  59. package/src/components/chat/types/message.types.ts +10 -0
  60. package/src/components/chat/types/network.types.ts +2 -0
  61. package/src/components/chat/types/processing.types.ts +1 -1
  62. package/src/components/chat/utils/__tests__/history-merge.test.ts +70 -0
  63. package/src/components/chat/utils/chunk-parser.ts +12 -1
  64. package/src/components/chat/utils/history-merge.ts +22 -2
  65. package/src/components/chat/utils/message-segment-accumulator.ts +10 -4
  66. package/src/components/chat/utils/process-historical-messages.ts +4 -1
  67. package/dist/chunk-7LTWNUHB.cjs.map +0 -1
  68. package/dist/chunk-GO45CXT5.js.map +0 -1
  69. /package/dist/{chunk-MVUN35FH.js.map → chunk-6ZMD3KBP.js.map} +0 -0
  70. /package/dist/{chunk-5NL62LIF.js.map → chunk-7ECI5ZVO.js.map} +0 -0
  71. /package/dist/{chunk-MDHNLZME.js.map → chunk-SZG56DA3.js.map} +0 -0
  72. /package/dist/{chunk-737ZLQ2T.js.map → chunk-YK6FFIVG.js.map} +0 -0
@@ -2669,6 +2669,7 @@ var ChatMessageEnhanced = forwardRef11(
2669
2669
  {
2670
2670
  data: segment.data,
2671
2671
  status: segment.status,
2672
+ resolvedByName: segment.resolvedByName,
2672
2673
  onApprove: segment.onApprove,
2673
2674
  onReject: segment.onReject
2674
2675
  },
@@ -34909,13 +34910,16 @@ function parseChunkToAction(chunk) {
34909
34910
  approvalType
34910
34911
  };
34911
34912
  }
34912
- case MESSAGE_TYPE.APPROVAL_RESULT:
34913
+ case MESSAGE_TYPE.APPROVAL_RESULT: {
34914
+ const resolvedByName = typeof data.resolvedByName === "string" ? data.resolvedByName : typeof data.displayName === "string" ? data.displayName : void 0;
34913
34915
  return {
34914
34916
  action: "approval_result",
34915
34917
  requestId: data.approvalRequestId || data.approval_request_id || "",
34916
34918
  approved: data.approved === true,
34917
- approvalType: data.approvalType || "CLIENT"
34919
+ approvalType: data.approvalType || "CLIENT",
34920
+ resolvedByName
34918
34921
  };
34922
+ }
34919
34923
  case MESSAGE_TYPE.ERROR:
34920
34924
  return {
34921
34925
  action: "error",
@@ -35220,7 +35224,7 @@ var MessageSegmentAccumulator = class {
35220
35224
  * `executions` is forwarded as-is. On upsert, a new `executions` object
35221
35225
  * overrides the existing one (so the latest replay wins).
35222
35226
  */
35223
- addApprovalBatch(approvalRequestId, approvalType, toolCalls, status = "pending", executions) {
35227
+ addApprovalBatch(approvalRequestId, approvalType, toolCalls, status = "pending", executions, resolvedByName) {
35224
35228
  const existingIndex = this.segments.findIndex(
35225
35229
  (s) => s.type === "approval_batch" && s.data.approvalRequestId === approvalRequestId
35226
35230
  );
@@ -35236,6 +35240,7 @@ var MessageSegmentAccumulator = class {
35236
35240
  ...mergedExecutions ? { executions: mergedExecutions } : {}
35237
35241
  },
35238
35242
  status,
35243
+ resolvedByName: resolvedByName ?? existing.resolvedByName,
35239
35244
  onApprove: this.callbacks.onApprove,
35240
35245
  onReject: this.callbacks.onReject
35241
35246
  };
@@ -35250,6 +35255,7 @@ var MessageSegmentAccumulator = class {
35250
35255
  ...executions ? { executions } : {}
35251
35256
  },
35252
35257
  status,
35258
+ resolvedByName,
35253
35259
  onApprove: this.callbacks.onApprove,
35254
35260
  onReject: this.callbacks.onReject
35255
35261
  };
@@ -35282,15 +35288,17 @@ var MessageSegmentAccumulator = class {
35282
35288
  return { segment, pendingData: pendingApproval || null };
35283
35289
  }
35284
35290
  /**
35285
- * Update status of an existing approval segment (single or batch)
35291
+ * Update status of an existing approval segment (single or batch).
35292
+ * `resolvedByName` (when provided) is stamped onto the matching batch segment so the
35293
+ * resolved card shows "by {name}"; omit it to leave any existing value untouched.
35286
35294
  */
35287
- updateApprovalStatus(requestId, status) {
35295
+ updateApprovalStatus(requestId, status, resolvedByName) {
35288
35296
  this.segments = this.segments.map((segment) => {
35289
35297
  if (segment.type === "approval_request" && segment.data.requestId === requestId) {
35290
35298
  return { ...segment, status };
35291
35299
  }
35292
35300
  if (segment.type === "approval_batch" && segment.data.approvalRequestId === requestId) {
35293
- return { ...segment, status };
35301
+ return { ...segment, status, resolvedByName: resolvedByName ?? segment.resolvedByName };
35294
35302
  }
35295
35303
  return segment;
35296
35304
  });
@@ -35390,13 +35398,14 @@ var MessageSegmentAccumulator = class {
35390
35398
  break;
35391
35399
  }
35392
35400
  case "approval_batch": {
35393
- const { data, status } = segment;
35401
+ const { data, status, resolvedByName } = segment;
35394
35402
  this.addApprovalBatch(
35395
35403
  data.approvalRequestId,
35396
35404
  data.approvalType,
35397
35405
  data.toolCalls,
35398
35406
  status,
35399
- data.executions
35407
+ data.executions,
35408
+ resolvedByName
35400
35409
  );
35401
35410
  break;
35402
35411
  }
@@ -35482,6 +35491,8 @@ function useRealtimeChunkProcessor(options) {
35482
35491
  const action = parseChunkToAction(chunk);
35483
35492
  if (!action) return;
35484
35493
  const accumulator = accumulatorRef.current;
35494
+ const streamSeq = chunk && typeof chunk === "object" && typeof chunk.streamSeq === "number" ? chunk.streamSeq : void 0;
35495
+ const emitSegments = (s, meta) => callbacks.onSegmentsUpdate?.(s, streamSeq != null ? { ...meta, streamSeq } : meta);
35485
35496
  if (action.action === "direct_message") sawDirectMessageRef.current = true;
35486
35497
  if ((directModeFlagRef.current || sawDirectMessageRef.current) && !DIRECT_MODE_ALLOWED.has(action.action)) {
35487
35498
  if (isInStreamRef.current) {
@@ -35509,18 +35520,18 @@ function useRealtimeChunkProcessor(options) {
35509
35520
  case "text": {
35510
35521
  const segments = accumulator.appendText(action.text);
35511
35522
  if (isInStreamRef.current || !hasEverStreamedRef.current) {
35512
- callbacks.onSegmentsUpdate?.(segments);
35523
+ emitSegments(segments);
35513
35524
  } else {
35514
- callbacks.onSegmentsUpdate?.([{ type: "text", text: action.text }], { append: true });
35525
+ emitSegments([{ type: "text", text: action.text }], { append: true });
35515
35526
  }
35516
35527
  break;
35517
35528
  }
35518
35529
  case "thinking": {
35519
35530
  const segments = accumulator.appendThinking(action.text);
35520
35531
  if (isInStreamRef.current || !hasEverStreamedRef.current) {
35521
- callbacks.onSegmentsUpdate?.(segments);
35532
+ emitSegments(segments);
35522
35533
  } else {
35523
- callbacks.onSegmentsUpdate?.([{ type: "thinking", text: action.text }], { append: true });
35534
+ emitSegments([{ type: "thinking", text: action.text }], { append: true });
35524
35535
  }
35525
35536
  break;
35526
35537
  }
@@ -35530,7 +35541,7 @@ function useRealtimeChunkProcessor(options) {
35530
35541
  break;
35531
35542
  }
35532
35543
  const segments = accumulator.addToolExecution(action.segment);
35533
- callbacks.onSegmentsUpdate?.(segments);
35544
+ emitSegments(segments);
35534
35545
  break;
35535
35546
  }
35536
35547
  case "approval_request": {
@@ -35544,7 +35555,7 @@ function useRealtimeChunkProcessor(options) {
35544
35555
  approvalType,
35545
35556
  status
35546
35557
  );
35547
- callbacks.onSegmentsUpdate?.(segments);
35558
+ emitSegments(segments);
35548
35559
  } else {
35549
35560
  pendingEscalatedRef.current.set(requestId, { command, explanation, approvalType });
35550
35561
  callbacks.onEscalatedApproval?.(requestId, { command, explanation, approvalType });
@@ -35572,7 +35583,7 @@ function useRealtimeChunkProcessor(options) {
35572
35583
  }
35573
35584
  if (batchApprovalsEnabled) {
35574
35585
  const segments2 = accumulator.addApprovalBatch(requestId, approvalType, toolCalls, status);
35575
- callbacks.onSegmentsUpdate?.(segments2);
35586
+ emitSegments(segments2);
35576
35587
  break;
35577
35588
  }
35578
35589
  let segments = accumulator.getSegments();
@@ -35586,11 +35597,11 @@ function useRealtimeChunkProcessor(options) {
35586
35597
  status
35587
35598
  );
35588
35599
  }
35589
- callbacks.onSegmentsUpdate?.(segments);
35600
+ emitSegments(segments);
35590
35601
  break;
35591
35602
  }
35592
35603
  case "approval_result": {
35593
- const { requestId, approved, approvalType } = action;
35604
+ const { requestId, approved, approvalType, resolvedByName } = action;
35594
35605
  const escalatedData = pendingEscalatedRef.current.get(requestId);
35595
35606
  const status = approved ? "approved" : "rejected";
35596
35607
  if (escalatedData) {
@@ -35606,9 +35617,11 @@ function useRealtimeChunkProcessor(options) {
35606
35617
  requestId,
35607
35618
  escalatedData.approvalType,
35608
35619
  escalatedData.toolCalls,
35609
- status
35620
+ status,
35621
+ void 0,
35622
+ resolvedByName
35610
35623
  );
35611
- callbacks.onSegmentsUpdate?.(segments);
35624
+ emitSegments(segments);
35612
35625
  } else {
35613
35626
  let segments = accumulator.getSegments();
35614
35627
  for (const call of escalatedData.toolCalls) {
@@ -35621,7 +35634,7 @@ function useRealtimeChunkProcessor(options) {
35621
35634
  status
35622
35635
  );
35623
35636
  }
35624
- callbacks.onSegmentsUpdate?.(segments);
35637
+ emitSegments(segments);
35625
35638
  }
35626
35639
  } else {
35627
35640
  const segments = accumulator.addApprovalRequest(
@@ -35631,15 +35644,15 @@ function useRealtimeChunkProcessor(options) {
35631
35644
  escalatedData.approvalType,
35632
35645
  status
35633
35646
  );
35634
- callbacks.onSegmentsUpdate?.(segments);
35647
+ emitSegments(segments);
35635
35648
  }
35636
35649
  } else {
35637
- accumulator.updateApprovalStatus(requestId, status);
35650
+ accumulator.updateApprovalStatus(requestId, status, resolvedByName);
35638
35651
  if (!callbacks.onApprovalResolved) {
35639
- callbacks.onSegmentsUpdate?.(accumulator.getSegments());
35652
+ emitSegments(accumulator.getSegments());
35640
35653
  }
35641
35654
  }
35642
- callbacks.onApprovalResolved?.(requestId, status, approvalType);
35655
+ callbacks.onApprovalResolved?.(requestId, status, approvalType, resolvedByName);
35643
35656
  break;
35644
35657
  }
35645
35658
  case "error": {
@@ -35652,7 +35665,7 @@ function useRealtimeChunkProcessor(options) {
35652
35665
  }
35653
35666
  }
35654
35667
  const segments = accumulator.addError(action.error, message2);
35655
- callbacks.onSegmentsUpdate?.(segments);
35668
+ emitSegments(segments);
35656
35669
  callbacks.onError?.(action.error, message2);
35657
35670
  break;
35658
35671
  }
@@ -35681,13 +35694,13 @@ function useRealtimeChunkProcessor(options) {
35681
35694
  case "context_compaction_start": {
35682
35695
  const standalone = !isInStreamRef.current;
35683
35696
  const segments = accumulator.addContextCompaction();
35684
- callbacks.onSegmentsUpdate?.(segments, standalone ? { append: true, isCompacting: true } : void 0);
35697
+ emitSegments(segments, standalone ? { append: true, isCompacting: true } : void 0);
35685
35698
  break;
35686
35699
  }
35687
35700
  case "context_compaction_end": {
35688
35701
  const standalone = !isInStreamRef.current;
35689
35702
  const segments = accumulator.completeContextCompaction(action.summary);
35690
- callbacks.onSegmentsUpdate?.(segments, standalone ? { append: true, isCompacting: true } : void 0);
35703
+ emitSegments(segments, standalone ? { append: true, isCompacting: true } : void 0);
35691
35704
  break;
35692
35705
  }
35693
35706
  case "dialog_closed":
@@ -35709,8 +35722,8 @@ function useRealtimeChunkProcessor(options) {
35709
35722
  sawDirectMessageRef.current = false;
35710
35723
  }, []);
35711
35724
  const updateApprovalStatus = useCallback35(
35712
- (requestId, status) => {
35713
- return accumulatorRef.current.updateApprovalStatus(requestId, status);
35725
+ (requestId, status, resolvedByName) => {
35726
+ return accumulatorRef.current.updateApprovalStatus(requestId, status, resolvedByName);
35714
35727
  },
35715
35728
  []
35716
35729
  );
@@ -37356,6 +37369,7 @@ function processMessageData(data, accumulator, approvalStatuses, options = {}, e
37356
37369
  if ("approvalRequestId" in data && data.approvalRequestId) {
37357
37370
  const existingStatus = approvalStatuses[data.approvalRequestId];
37358
37371
  const status = existingStatus || (data.approved ? "approved" : "rejected");
37372
+ const resolvedByName = "resolvedByName" in data ? data.resolvedByName : void 0;
37359
37373
  const escalatedData = escalatedApprovals?.get(data.approvalRequestId);
37360
37374
  if (escalatedData?.toolCalls && escalatedData.toolCalls.length > 0) {
37361
37375
  if (batchApprovalsEnabled) {
@@ -37363,7 +37377,9 @@ function processMessageData(data, accumulator, approvalStatuses, options = {}, e
37363
37377
  data.approvalRequestId,
37364
37378
  escalatedData.approvalType,
37365
37379
  escalatedData.toolCalls,
37366
- status
37380
+ status,
37381
+ void 0,
37382
+ resolvedByName
37367
37383
  );
37368
37384
  } else {
37369
37385
  for (const call of escalatedData.toolCalls) {
@@ -37389,7 +37405,7 @@ function processMessageData(data, accumulator, approvalStatuses, options = {}, e
37389
37405
  escalatedApprovals?.delete(data.approvalRequestId);
37390
37406
  }
37391
37407
  const before = accumulator.getSegments();
37392
- const after = accumulator.updateApprovalStatus(data.approvalRequestId, status);
37408
+ const after = accumulator.updateApprovalStatus(data.approvalRequestId, status, resolvedByName);
37393
37409
  const updatedExisting = before.some((s, i) => after[i] !== s);
37394
37410
  if (updatedExisting) break;
37395
37411
  accumulator.processApprovalResult(
@@ -38375,7 +38391,7 @@ function mergeHistoryWithRealtime(input) {
38375
38391
  if (m.role === "assistant" && trailingAssistantText && assistantAnswerText(m.content) === trailingAssistantText) {
38376
38392
  return false;
38377
38393
  }
38378
- const covered = historyCoversRealtime !== null ? historyCoversRealtime : (m.timestamp?.getTime() ?? 0) <= historyFetchedAt;
38394
+ const covered = typeof m.streamSeq === "number" && historyMaxStreamSeq > 0 ? historyMaxStreamSeq >= m.streamSeq : historyCoversRealtime !== null ? historyCoversRealtime : (m.timestamp?.getTime() ?? 0) <= historyFetchedAt;
38379
38395
  if (covered) return false;
38380
38396
  }
38381
38397
  return true;
@@ -40233,4 +40249,4 @@ export {
40233
40249
  LogsList,
40234
40250
  assets
40235
40251
  };
40236
- //# sourceMappingURL=chunk-GO45CXT5.js.map
40252
+ //# sourceMappingURL=chunk-AVLSICZO.js.map