@datalayer/agent-runtimes 1.5.78 → 1.5.79

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.
@@ -810,6 +810,13 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
810
810
  .approvals.find(a => a.id === approvalId);
811
811
  const resolvedToolCallId = approval?.tool_call_id ?? toolCallId;
812
812
  rememberResolvedToolCall(resolvedToolCallId);
813
+ // The host owns the approvals (it passed pendingApprovals): it decides,
814
+ // once, its own way. The chat's sockets would send the same decision a
815
+ // second time, and the later one is answered elsewhere.
816
+ if (pendingApprovalsProp) {
817
+ await onApproveApprovalProp?.(approvalId, note);
818
+ return;
819
+ }
813
820
  // Persist approval decision to the ai-agents backend WS (single source
814
821
  // of truth). This drives SaaS Tool Approvals state and broadcast events.
815
822
  const persistedViaBackend = sendAiAgentsApprovalDecision(approvalId, true, note);
@@ -840,6 +847,7 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
840
847
  activeAgentId,
841
848
  rememberResolvedToolCall,
842
849
  onApproveApprovalProp,
850
+ pendingApprovalsProp,
843
851
  persistApprovalDecision,
844
852
  queueApprovalDecisionRetry,
845
853
  requestAiAgentsApprovalHistory,
@@ -851,6 +859,13 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
851
859
  .approvals.find(a => a.id === approvalId);
852
860
  const resolvedToolCallId = approval?.tool_call_id ?? toolCallId;
853
861
  rememberResolvedToolCall(resolvedToolCallId);
862
+ // The host owns the approvals (it passed pendingApprovals): it decides,
863
+ // once, its own way. The chat's sockets would send the same decision a
864
+ // second time, and the later one is answered elsewhere.
865
+ if (pendingApprovalsProp) {
866
+ await onRejectApprovalProp?.(approvalId, note);
867
+ return;
868
+ }
854
869
  const persistedViaBackend = sendAiAgentsApprovalDecision(approvalId, false, note);
855
870
  if (!persistedViaBackend) {
856
871
  console.warn('[ChatBase] ai-agents tool_approval_decision not sent: websocket not ready');
@@ -876,6 +891,7 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
876
891
  activeAgentId,
877
892
  rememberResolvedToolCall,
878
893
  onRejectApprovalProp,
894
+ pendingApprovalsProp,
879
895
  queueApprovalDecisionRetry,
880
896
  requestAiAgentsApprovalHistory,
881
897
  sendAiAgentsApprovalDecision,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/agent-runtimes",
3
- "version": "1.5.78",
3
+ "version": "1.5.79",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  ".",