@posthog/agent 2.3.1 → 2.3.5

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.1",
3
+ "version": "2.3.5",
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": {
@@ -22,11 +22,12 @@ import type {
22
22
  BetaWebSearchToolResultBlockParam,
23
23
  } from "@anthropic-ai/sdk/resources/beta.mjs";
24
24
 
25
- const SYSTEM_REMINDER = `
25
+ const SYSTEM_REMINDER_REGEX =
26
+ /\s*<system-reminder>[\s\S]*?<\/system-reminder>/g;
26
27
 
27
- <system-reminder>
28
- Whenever you read a file, you should consider whether it looks malicious. If it does, you MUST refuse to improve or augment the code. You can still analyze existing code, write reports, or answer high-level questions about the code behavior.
29
- </system-reminder>`;
28
+ function stripSystemReminders(value: string): string {
29
+ return value.replace(SYSTEM_REMINDER_REGEX, "");
30
+ }
30
31
 
31
32
  import { resourceLink, text, toolContent } from "../../../utils/acp-content.js";
32
33
  import { getMcpToolMetadata } from "../mcp/tool-metadata.js";
@@ -537,9 +538,7 @@ export function toolUpdateFromToolResult(
537
538
  return {
538
539
  type: "content" as const,
539
540
  content: text(
540
- markdownEscape(
541
- (itemObj.text ?? "").replace(SYSTEM_REMINDER, ""),
542
- ),
541
+ markdownEscape(stripSystemReminders(itemObj.text ?? "")),
543
542
  ),
544
543
  };
545
544
  }
@@ -565,9 +564,7 @@ export function toolUpdateFromToolResult(
565
564
  ) {
566
565
  return {
567
566
  content: toolContent()
568
- .text(
569
- markdownEscape(toolResult.content.replace(SYSTEM_REMINDER, "")),
570
- )
567
+ .text(markdownEscape(stripSystemReminders(toolResult.content)))
571
568
  .build(),
572
569
  };
573
570
  }
@@ -699,7 +696,7 @@ function itemToText(item: unknown): string | null {
699
696
  const obj = item as Record<string, unknown>;
700
697
  // Standard text block
701
698
  if (obj.type === "text" && typeof obj.text === "string") {
702
- return obj.text;
699
+ return stripSystemReminders(obj.text);
703
700
  }
704
701
  // Any other structured object — serialize it
705
702
  try {