@posthog/agent 2.3.298 → 2.3.304

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.
@@ -5805,7 +5805,7 @@ var import_hono = require("hono");
5805
5805
  // package.json
5806
5806
  var package_default = {
5807
5807
  name: "@posthog/agent",
5808
- version: "2.3.298",
5808
+ version: "2.3.304",
5809
5809
  repository: "https://github.com/PostHog/code",
5810
5810
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
5811
5811
  exports: {
@@ -10334,6 +10334,16 @@ function toCodexPermissionMode(mode) {
10334
10334
  }
10335
10335
  return "auto";
10336
10336
  }
10337
+ function prependPrContext(params) {
10338
+ const prContext = params._meta?.prContext;
10339
+ if (typeof prContext !== "string" || prContext.length === 0) {
10340
+ return params;
10341
+ }
10342
+ return {
10343
+ ...params,
10344
+ prompt: [{ type: "text", text: prContext }, ...params.prompt]
10345
+ };
10346
+ }
10337
10347
  var CODEX_NATIVE_MODE = {
10338
10348
  default: "auto",
10339
10349
  acceptEdits: "auto",
@@ -10540,7 +10550,10 @@ var CodexAcpAgent = class extends BaseAcpAgent {
10540
10550
  this.session.cancelled = false;
10541
10551
  this.session.interruptReason = void 0;
10542
10552
  resetUsage(this.sessionState);
10543
- const response = await this.codexConnection.prompt(params);
10553
+ await this.broadcastUserMessage(params);
10554
+ const response = await this.codexConnection.prompt(
10555
+ prependPrContext(params)
10556
+ );
10544
10557
  if (this.sessionState.taskRunId) {
10545
10558
  const { accumulatedUsage } = this.sessionState;
10546
10559
  await this.client.extNotification(POSTHOG_NOTIFICATIONS.TURN_COMPLETE, {
@@ -10574,6 +10587,19 @@ var CodexAcpAgent = class extends BaseAcpAgent {
10574
10587
  sessionId: this.sessionId
10575
10588
  });
10576
10589
  }
10590
+ async broadcastUserMessage(params) {
10591
+ for (const chunk of params.prompt) {
10592
+ const notification = {
10593
+ sessionId: params.sessionId,
10594
+ update: {
10595
+ sessionUpdate: "user_message_chunk",
10596
+ content: chunk
10597
+ }
10598
+ };
10599
+ await this.client.sessionUpdate(notification);
10600
+ this.appendNotification(params.sessionId, notification);
10601
+ }
10602
+ }
10577
10603
  async setSessionMode(params) {
10578
10604
  const requestedMode = toCodexPermissionMode(params.modeId);
10579
10605
  const nativeMode = toCodexNativeMode(params.modeId);