@posthog/agent 2.3.293 → 2.3.297

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/agent",
3
- "version": "2.3.293",
3
+ "version": "2.3.297",
4
4
  "repository": "https://github.com/PostHog/code",
5
5
  "description": "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
6
6
  "exports": {
@@ -86,8 +86,8 @@
86
86
  "tsx": "^4.20.6",
87
87
  "typescript": "^5.5.0",
88
88
  "vitest": "^2.1.8",
89
- "@posthog/git": "1.0.0",
90
- "@posthog/shared": "1.0.0"
89
+ "@posthog/shared": "1.0.0",
90
+ "@posthog/git": "1.0.0"
91
91
  },
92
92
  "dependencies": {
93
93
  "@agentclientprotocol/sdk": "0.16.1",
@@ -693,6 +693,7 @@ export class AgentServer {
693
693
  // After waiting, just attach the SSE controller if needed
694
694
  if (this.session && sseController) {
695
695
  this.session.sseController = sseController;
696
+ this.session.hasDesktopConnected = true;
696
697
  this.replayPendingEvents();
697
698
  }
698
699
  return;
@@ -1592,22 +1593,27 @@ ${attributionInstructions}
1592
1593
  }
1593
1594
 
1594
1595
  // Relay permission requests to the desktop app when:
1595
- // - Questions: always relay (need human answers regardless of mode)
1596
- // - Plan approvals: always relay
1596
+ // - Plan approvals: always relay because they gate autonomy changes
1597
+ // that require human confirmation (buffered until desktop connects)
1598
+ // - Questions: relay when desktop is connected
1597
1599
  // - Edit/bash in "default" mode: relay for manual approval
1598
- // Other modes auto-approve. No client connected → auto-approve.
1600
+ // Other modes auto-approve. No client connected → auto-approve
1601
+ // (except plan approvals, which wait for a desktop).
1599
1602
  {
1600
1603
  const isQuestion = codeToolKind === "question";
1601
1604
  const sessionPermissionMode = this.getSessionPermissionMode();
1602
- const needsRelay =
1605
+ const needsDesktopApproval =
1603
1606
  isQuestion ||
1604
- isPlanApproval ||
1605
1607
  this.shouldRelayPermissionToClient(sessionPermissionMode);
1606
1608
 
1607
- if (needsRelay && this.session?.hasDesktopConnected) {
1608
- this.logger.info("Relaying permission to connected client", {
1609
+ if (
1610
+ isPlanApproval ||
1611
+ (needsDesktopApproval && this.session?.hasDesktopConnected)
1612
+ ) {
1613
+ this.logger.info("Relaying permission request", {
1609
1614
  kind: params.toolCall?.kind,
1610
1615
  isQuestion,
1616
+ hasDesktopConnected: this.session?.hasDesktopConnected ?? false,
1611
1617
  sessionPermissionMode,
1612
1618
  });
1613
1619
  return this.relayPermissionToClient(params);