@posthog/agent 2.1.89 → 2.1.105

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/types.d.ts CHANGED
@@ -88,6 +88,7 @@ interface PostHogAPIConfig {
88
88
  apiUrl: string;
89
89
  getApiKey: () => string;
90
90
  projectId: number;
91
+ userAgent?: string;
91
92
  }
92
93
  interface OtelTransportConfig {
93
94
  /** PostHog ingest host, e.g., "https://us.i.posthog.com" */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/agent",
3
- "version": "2.1.89",
3
+ "version": "2.1.105",
4
4
  "repository": "https://github.com/PostHog/twig",
5
5
  "description": "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
6
6
  "exports": {
@@ -4,6 +4,7 @@ const GATEWAY_TO_SDK_MODEL: Record<string, string> = {
4
4
  "claude-opus-4-5": "opus",
5
5
  "claude-opus-4-6": "opus",
6
6
  "claude-sonnet-4-5": "sonnet",
7
+ "claude-sonnet-4-6": "sonnet",
7
8
  "claude-haiku-4-5": "haiku",
8
9
  };
9
10
 
@@ -1,3 +1,4 @@
1
+ import packageJson from "../package.json" with { type: "json" };
1
2
  import type {
2
3
  ArtifactType,
3
4
  PostHogAPIConfig,
@@ -10,6 +11,8 @@ import { getLlmGatewayUrl } from "./utils/gateway.js";
10
11
 
11
12
  export { getLlmGatewayUrl };
12
13
 
14
+ const DEFAULT_USER_AGENT = `posthog/agent.hog.dev; version: ${packageJson.version}`;
15
+
13
16
  export interface TaskArtifactUploadPayload {
14
17
  name: string;
15
18
  type: ArtifactType;
@@ -48,6 +51,7 @@ export class PostHogAPIClient {
48
51
  return {
49
52
  Authorization: `Bearer ${this.config.getApiKey()}`,
50
53
  "Content-Type": "application/json",
54
+ "User-Agent": this.config.userAgent ?? DEFAULT_USER_AGENT,
51
55
  };
52
56
  }
53
57
 
@@ -5,6 +5,7 @@ import {
5
5
  } from "@agentclientprotocol/sdk";
6
6
  import { type ServerType, serve } from "@hono/node-server";
7
7
  import { Hono } from "hono";
8
+ import packageJson from "../../package.json" with { type: "json" };
8
9
  import { POSTHOG_NOTIFICATIONS } from "../acp-extensions.js";
9
10
  import {
10
11
  createAcpConnection,
@@ -154,6 +155,7 @@ export class AgentServer {
154
155
  apiUrl: config.apiUrl,
155
156
  projectId: config.projectId,
156
157
  getApiKey: () => config.apiKey,
158
+ userAgent: `posthog/cloud.hog.dev; version: ${config.version ?? packageJson.version}`,
157
159
  });
158
160
  this.app = this.createApp();
159
161
  }
@@ -471,6 +473,7 @@ export class AgentServer {
471
473
  apiUrl: this.config.apiUrl,
472
474
  projectId: this.config.projectId,
473
475
  getApiKey: () => this.config.apiKey,
476
+ userAgent: `posthog/cloud.hog.dev; version: ${this.config.version ?? packageJson.version}`,
474
477
  });
475
478
 
476
479
  const logWriter = new SessionLogWriter({
@@ -10,4 +10,5 @@ export interface AgentServerConfig {
10
10
  mode: AgentMode;
11
11
  taskId: string;
12
12
  runId: string;
13
+ version?: string;
13
14
  }
package/src/types.ts CHANGED
@@ -126,6 +126,7 @@ export interface PostHogAPIConfig {
126
126
  apiUrl: string;
127
127
  getApiKey: () => string;
128
128
  projectId: number;
129
+ userAgent?: string;
129
130
  }
130
131
 
131
132
  export interface OtelTransportConfig {