@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.
package/dist/agent.js CHANGED
@@ -245,7 +245,7 @@ import { v7 as uuidv7 } from "uuid";
245
245
  // package.json
246
246
  var package_default = {
247
247
  name: "@posthog/agent",
248
- version: "2.3.298",
248
+ version: "2.3.304",
249
249
  repository: "https://github.com/PostHog/code",
250
250
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
251
251
  exports: {
@@ -4670,6 +4670,16 @@ function toCodexPermissionMode(mode) {
4670
4670
  }
4671
4671
  return "auto";
4672
4672
  }
4673
+ function prependPrContext(params) {
4674
+ const prContext = params._meta?.prContext;
4675
+ if (typeof prContext !== "string" || prContext.length === 0) {
4676
+ return params;
4677
+ }
4678
+ return {
4679
+ ...params,
4680
+ prompt: [{ type: "text", text: prContext }, ...params.prompt]
4681
+ };
4682
+ }
4673
4683
  var CODEX_NATIVE_MODE = {
4674
4684
  default: "auto",
4675
4685
  acceptEdits: "auto",
@@ -4876,7 +4886,10 @@ var CodexAcpAgent = class extends BaseAcpAgent {
4876
4886
  this.session.cancelled = false;
4877
4887
  this.session.interruptReason = void 0;
4878
4888
  resetUsage(this.sessionState);
4879
- const response = await this.codexConnection.prompt(params);
4889
+ await this.broadcastUserMessage(params);
4890
+ const response = await this.codexConnection.prompt(
4891
+ prependPrContext(params)
4892
+ );
4880
4893
  if (this.sessionState.taskRunId) {
4881
4894
  const { accumulatedUsage } = this.sessionState;
4882
4895
  await this.client.extNotification(POSTHOG_NOTIFICATIONS.TURN_COMPLETE, {
@@ -4910,6 +4923,19 @@ var CodexAcpAgent = class extends BaseAcpAgent {
4910
4923
  sessionId: this.sessionId
4911
4924
  });
4912
4925
  }
4926
+ async broadcastUserMessage(params) {
4927
+ for (const chunk of params.prompt) {
4928
+ const notification = {
4929
+ sessionId: params.sessionId,
4930
+ update: {
4931
+ sessionUpdate: "user_message_chunk",
4932
+ content: chunk
4933
+ }
4934
+ };
4935
+ await this.client.sessionUpdate(notification);
4936
+ this.appendNotification(params.sessionId, notification);
4937
+ }
4938
+ }
4913
4939
  async setSessionMode(params) {
4914
4940
  const requestedMode = toCodexPermissionMode(params.modeId);
4915
4941
  const nativeMode = toCodexNativeMode(params.modeId);