@ccpocket/bridge 1.71.0 → 1.72.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.
@@ -284,10 +284,10 @@ export declare class CodexProcess extends EventEmitter<CodexProcessEvents> {
284
284
  path: string;
285
285
  }>;
286
286
  }): Promise<void>;
287
- approve(toolUseId?: string): void;
288
- approveAlways(toolUseId?: string): void;
289
- reject(toolUseId?: string, _message?: string): void;
290
- answer(toolUseId: string, result: string): void;
287
+ approve(toolUseId?: string): boolean;
288
+ approveAlways(toolUseId?: string): boolean;
289
+ reject(toolUseId?: string, _message?: string): boolean;
290
+ answer(toolUseId: string, result: string): boolean;
291
291
  /**
292
292
  * Install a plugin or begin connector authentication proposed by Codex.
293
293
  * The elicitation remains pending while external app authentication is
@@ -595,73 +595,78 @@ export class CodexProcess extends EventEmitter {
595
595
  if (this.pendingPlanCompletion &&
596
596
  toolUseId === this.pendingPlanCompletion.toolUseId) {
597
597
  this.handlePlanApproved();
598
- return;
598
+ return true;
599
599
  }
600
600
  const pending = this.resolvePendingApproval(toolUseId);
601
601
  if (!pending) {
602
602
  // Fallback: McpElicitation lives in pendingUserInputs
603
603
  if (this.approveUserInput(toolUseId, "Accept"))
604
- return;
604
+ return true;
605
605
  console.log("[codex-process] approve() called but no pending permission requests");
606
- return;
606
+ return false;
607
607
  }
608
608
  this.pendingApprovals.delete(pending.toolUseId);
609
609
  this.respondToServerRequest(pending.requestId, buildApprovalResponse(pending, "accept"));
610
- this.emitToolResult(pending.toolUseId, "Approved");
610
+ this.emitToolResult(pending.toolUseId, "Approved", "approved");
611
611
  if (this.pendingApprovals.size === 0) {
612
612
  this.setStatus("running");
613
613
  }
614
+ return true;
614
615
  }
615
616
  approveAlways(toolUseId) {
616
617
  const pending = this.resolvePendingApproval(toolUseId);
617
618
  if (!pending) {
618
619
  // Fallback: McpElicitation lives in pendingUserInputs
619
- if (this.approveUserInput(toolUseId, "Allow for this session"))
620
- return;
620
+ if (this.approveUserInput(toolUseId, "Allow for this session")) {
621
+ return true;
622
+ }
621
623
  console.log("[codex-process] approveAlways() called but no pending permission requests");
622
- return;
624
+ return false;
623
625
  }
624
626
  this.pendingApprovals.delete(pending.toolUseId);
625
627
  this.respondToServerRequest(pending.requestId, buildApprovalResponse(pending, "acceptForSession"));
626
- this.emitToolResult(pending.toolUseId, "Approved (always)");
628
+ this.emitToolResult(pending.toolUseId, "Approved (always)", "approved_for_session");
627
629
  if (this.pendingApprovals.size === 0) {
628
630
  this.setStatus("running");
629
631
  }
632
+ return true;
630
633
  }
631
634
  reject(toolUseId, _message) {
632
635
  // Check if this is a plan completion rejection
633
636
  if (this.pendingPlanCompletion &&
634
637
  toolUseId === this.pendingPlanCompletion.toolUseId) {
635
638
  this.handlePlanRejected(_message);
636
- return;
639
+ return true;
637
640
  }
638
641
  const pending = this.resolvePendingApproval(toolUseId);
639
642
  if (!pending) {
640
643
  // Fallback: McpElicitation lives in pendingUserInputs
641
644
  if (this.rejectUserInput(toolUseId, "Decline"))
642
- return;
645
+ return true;
643
646
  console.log("[codex-process] reject() called but no pending permission requests");
644
- return;
647
+ return false;
645
648
  }
646
649
  this.pendingApprovals.delete(pending.toolUseId);
647
650
  this.respondToServerRequest(pending.requestId, buildApprovalResponse(pending, resolveApprovalRejectDecision(pending)));
648
- this.emitToolResult(pending.toolUseId, "Rejected");
651
+ this.emitToolResult(pending.toolUseId, "Rejected", "rejected");
649
652
  if (this.pendingApprovals.size === 0) {
650
653
  this.setStatus("running");
651
654
  }
655
+ return true;
652
656
  }
653
657
  answer(toolUseId, result) {
654
658
  const pending = this.resolvePendingUserInput(toolUseId);
655
659
  if (!pending) {
656
660
  console.log("[codex-process] answer() called but no pending AskUserQuestion");
657
- return;
661
+ return false;
658
662
  }
659
663
  this.pendingUserInputs.delete(pending.toolUseId);
660
664
  this.respondToServerRequest(pending.requestId, buildUserInputResponse(pending, result));
661
- this.emitToolResult(pending.toolUseId, "Answered");
665
+ this.emitToolResult(pending.toolUseId, "Answered", "answered");
662
666
  if (this.pendingApprovals.size === 0 && this.pendingUserInputs.size === 0) {
663
667
  this.setStatus("running");
664
668
  }
669
+ return true;
665
670
  }
666
671
  /**
667
672
  * Install a plugin or begin connector authentication proposed by Codex.
@@ -780,11 +785,12 @@ export class CodexProcess extends EventEmitter {
780
785
  };
781
786
  }
782
787
  /** Emit a synthetic tool_result so history replay can match it to a permission_request. */
783
- emitToolResult(toolUseId, content) {
788
+ emitToolResult(toolUseId, content, permissionOutcome) {
784
789
  this.emitMessage({
785
790
  type: "tool_result",
786
791
  toolUseId,
787
792
  content,
793
+ ...(permissionOutcome ? { permissionOutcome } : {}),
788
794
  });
789
795
  }
790
796
  resolvePendingApproval(toolUseId) {
@@ -820,7 +826,9 @@ export class CodexProcess extends EventEmitter {
820
826
  }
821
827
  this.pendingUserInputs.delete(pending.toolUseId);
822
828
  this.respondToServerRequest(pending.requestId, buildUserInputResponse(pending, result));
823
- this.emitToolResult(pending.toolUseId, "Approved");
829
+ this.emitToolResult(pending.toolUseId, "Approved", result === "Allow for this session"
830
+ ? "approved_for_session"
831
+ : "approved");
824
832
  if (this.pendingApprovals.size === 0 && this.pendingUserInputs.size === 0) {
825
833
  this.setStatus("running");
826
834
  }
@@ -860,7 +868,7 @@ export class CodexProcess extends EventEmitter {
860
868
  return false;
861
869
  this.pendingUserInputs.delete(pending.toolUseId);
862
870
  this.respondToServerRequest(pending.requestId, buildUserInputResponse(pending, resolveUserInputRejectResult(pending, result)));
863
- this.emitToolResult(pending.toolUseId, "Rejected");
871
+ this.emitToolResult(pending.toolUseId, "Rejected", "rejected");
864
872
  if (this.pendingApprovals.size === 0 && this.pendingUserInputs.size === 0) {
865
873
  this.setStatus("running");
866
874
  }