@posthog/agent 2.3.202 → 2.3.207

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.
@@ -904,7 +904,7 @@ var import_hono = require("hono");
904
904
  // package.json
905
905
  var package_default = {
906
906
  name: "@posthog/agent",
907
- version: "2.3.202",
907
+ version: "2.3.207",
908
908
  repository: "https://github.com/PostHog/code",
909
909
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
910
910
  exports: {
@@ -1066,6 +1066,10 @@ var POSTHOG_NOTIFICATIONS = {
1066
1066
  /** Token usage update for a session turn */
1067
1067
  USAGE_UPDATE: "_posthog/usage_update"
1068
1068
  };
1069
+ function isNotification(method, notification) {
1070
+ if (!method) return false;
1071
+ return method === notification || method === `_${notification}`;
1072
+ }
1069
1073
 
1070
1074
  // src/adapters/acp-connection.ts
1071
1075
  var import_sdk4 = require("@agentclientprotocol/sdk");
@@ -2689,7 +2693,7 @@ async function handleSystemMessage(message, context) {
2689
2693
  case "init":
2690
2694
  break;
2691
2695
  case "compact_boundary":
2692
- await client.extNotification("_posthog/compact_boundary", {
2696
+ await client.extNotification(POSTHOG_NOTIFICATIONS.COMPACT_BOUNDARY, {
2693
2697
  sessionId,
2694
2698
  trigger: message.compact_metadata.trigger,
2695
2699
  preTokens: message.compact_metadata.pre_tokens,
@@ -2705,7 +2709,7 @@ async function handleSystemMessage(message, context) {
2705
2709
  case "status":
2706
2710
  if (message.status === "compacting") {
2707
2711
  logger.info("Session compacting started", { sessionId });
2708
- await client.extNotification("_posthog/status", {
2712
+ await client.extNotification(POSTHOG_NOTIFICATIONS.STATUS, {
2709
2713
  sessionId,
2710
2714
  status: "compacting"
2711
2715
  });
@@ -2718,7 +2722,7 @@ async function handleSystemMessage(message, context) {
2718
2722
  status: message.status,
2719
2723
  summary: message.summary
2720
2724
  });
2721
- await client.extNotification("_posthog/task_notification", {
2725
+ await client.extNotification(POSTHOG_NOTIFICATIONS.TASK_NOTIFICATION, {
2722
2726
  sessionId,
2723
2727
  taskId: message.task_id,
2724
2728
  status: message.status,
@@ -4746,7 +4750,7 @@ var ClaudeAcpAgent = class extends BaseAcpAgent {
4746
4750
  settingsManager.getSettings().model || meta?.model || void 0
4747
4751
  ),
4748
4752
  ...meta?.taskRunId ? [
4749
- this.client.extNotification("_posthog/sdk_session", {
4753
+ this.client.extNotification(POSTHOG_NOTIFICATIONS.SDK_SESSION, {
4750
4754
  taskRunId: meta.taskRunId,
4751
4755
  sessionId,
4752
4756
  adapter: "claude"
@@ -11521,11 +11525,12 @@ var ResumeSaga = class extends Saga {
11521
11525
  };
11522
11526
  }
11523
11527
  findLatestTreeSnapshot(entries) {
11524
- const sdkPrefixedMethod = `_${POSTHOG_NOTIFICATIONS.TREE_SNAPSHOT}`;
11525
11528
  for (let i = entries.length - 1; i >= 0; i--) {
11526
11529
  const entry = entries[i];
11527
- const method = entry.notification?.method;
11528
- if (method === sdkPrefixedMethod || method === POSTHOG_NOTIFICATIONS.TREE_SNAPSHOT) {
11530
+ if (isNotification(
11531
+ entry.notification?.method,
11532
+ POSTHOG_NOTIFICATIONS.TREE_SNAPSHOT
11533
+ )) {
11529
11534
  const params = entry.notification.params;
11530
11535
  if (params?.treeHash) {
11531
11536
  return params;