@flamingo-stack/openframe-frontend-core 0.0.194 → 0.0.195

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.
@@ -7909,6 +7909,7 @@ var MessageSegmentAccumulator = class {
7909
7909
  return this.getSegments();
7910
7910
  }
7911
7911
  const toolKey = execId || `${toolData.integratedToolType}-${toolData.toolFunction}`;
7912
+ this.resolvePendingApprovalForExecution();
7912
7913
  if (toolData.type === "EXECUTING_TOOL") {
7913
7914
  this.executingTools.set(toolKey, {
7914
7915
  integratedToolType: toolData.integratedToolType,
@@ -7965,6 +7966,30 @@ var MessageSegmentAccumulator = class {
7965
7966
  });
7966
7967
  return matched;
7967
7968
  }
7969
+ /**
7970
+ * A tool only ever runs after its approval gate was granted. The legacy /
7971
+ * single `approval_request` segment carries no `toolExecutionRequestId` to
7972
+ * correlate with the execution, and an observer (e.g. a technician
7973
+ * mirroring the client chat) may never receive an `APPROVAL_RESULT` chunk —
7974
+ * only the tool's `EXECUTING_TOOL` / `EXECUTED_TOOL` events. Treat the
7975
+ * arrival of a tool execution as implicit approval of the most recent
7976
+ * still-pending gate so the card does not stay stuck `pending` in realtime.
7977
+ *
7978
+ * The agent stays paused while an approval is outstanding, so there is at
7979
+ * most one relevant gate; flipping only the latest pending one is safe and
7980
+ * monotonic (never downgrades, can't make a correct state wrong — an
7981
+ * unapproved tool cannot execute). `approval_batch` is handled separately by
7982
+ * `applyExecutionToBatch` and is intentionally left untouched here.
7983
+ */
7984
+ resolvePendingApprovalForExecution() {
7985
+ for (let i = this.segments.length - 1; i >= 0; i--) {
7986
+ const seg = this.segments[i];
7987
+ if (seg.type === "approval_request" && seg.status === "pending") {
7988
+ this.segments[i] = { ...seg, status: "approved" };
7989
+ return;
7990
+ }
7991
+ }
7992
+ }
7968
7993
  /**
7969
7994
  * Track a pending approval request
7970
7995
  */
@@ -8662,11 +8687,22 @@ function processMessageData(data, accumulator, approvalStatuses, options = {}, e
8662
8687
  }
8663
8688
  }
8664
8689
  } else {
8665
- accumulator.trackApprovalRequest(data.approvalRequestId, {
8666
- command: data.command || "",
8667
- explanation: data.explanation,
8668
- approvalType
8669
- });
8690
+ const resolvedStatus = approvalStatuses[data.approvalRequestId];
8691
+ if (resolvedStatus === "approved" || resolvedStatus === "rejected") {
8692
+ accumulator.addApprovalRequest(
8693
+ data.approvalRequestId,
8694
+ data.command || "",
8695
+ data.explanation,
8696
+ approvalType,
8697
+ resolvedStatus
8698
+ );
8699
+ } else {
8700
+ accumulator.trackApprovalRequest(data.approvalRequestId, {
8701
+ command: data.command || "",
8702
+ explanation: data.explanation,
8703
+ approvalType
8704
+ });
8705
+ }
8670
8706
  }
8671
8707
  } else {
8672
8708
  escalatedApprovals?.set(data.approvalRequestId, {
@@ -34083,4 +34119,4 @@ export {
34083
34119
  TMCG_SOCIAL_PLATFORMS,
34084
34120
  assets
34085
34121
  };
34086
- //# sourceMappingURL=chunk-C5VTN2SB.js.map
34122
+ //# sourceMappingURL=chunk-U6AJSRJP.js.map