@posthog/agent 2.1.60 → 2.1.67

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.1.60",
3
+ "version": "2.1.67",
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": {
@@ -48,7 +48,7 @@ import { fetchMcpToolMetadata } from "./mcp/tool-metadata.js";
48
48
  import { canUseTool } from "./permissions/permission-handlers.js";
49
49
  import { getAvailableSlashCommands } from "./session/commands.js";
50
50
  import { parseMcpServers } from "./session/mcp-config.js";
51
- import { toSdkModelId } from "./session/models.js";
51
+ import { DEFAULT_MODEL, toSdkModelId } from "./session/models.js";
52
52
  import {
53
53
  buildSessionOptions,
54
54
  buildSystemPrompt,
@@ -162,6 +162,8 @@ export class ClaudeAcpAgent extends BaseAcpAgent {
162
162
  });
163
163
 
164
164
  const input = new Pushable<SDKUserMessage>();
165
+ // Pass default model at construction to avoid expensive post-hoc setModel IPC
166
+ options.model = DEFAULT_MODEL;
165
167
  const q = query({ prompt: input, options });
166
168
 
167
169
  const session = this.createSession(
@@ -191,7 +193,12 @@ export class ClaudeAcpAgent extends BaseAcpAgent {
191
193
  this.deferBackgroundFetches(q, sessionId, mcpServers);
192
194
 
193
195
  session.modelId = modelOptions.currentModelId;
194
- await this.trySetModel(q, modelOptions.currentModelId);
196
+ // Only call setModel if the resolved model differs from the default we
197
+ // already baked into the query options — avoids a ~2s IPC round-trip.
198
+ const resolvedSdkModel = toSdkModelId(modelOptions.currentModelId);
199
+ if (resolvedSdkModel !== DEFAULT_MODEL) {
200
+ await this.trySetModel(q, modelOptions.currentModelId);
201
+ }
195
202
 
196
203
  const configOptions = await this.buildConfigOptions(modelOptions);
197
204
 
@@ -54,6 +54,12 @@ function findCodexBinary(options: CodexProcessOptions): {
54
54
  return { command: options.binaryPath, args: configArgs };
55
55
  }
56
56
 
57
+ if (options.binaryPath) {
58
+ throw new Error(
59
+ `codex-acp binary not found at ${options.binaryPath}. Run "node apps/twig/scripts/download-binaries.mjs" to download it.`,
60
+ );
61
+ }
62
+
57
63
  return { command: "npx", args: ["@zed-industries/codex-acp", ...configArgs] };
58
64
  }
59
65
 
package/src/agent.ts CHANGED
@@ -18,12 +18,10 @@ export class Agent {
18
18
  private acpConnection?: InProcessAcpConnection;
19
19
  private taskRunId?: string;
20
20
  private sessionLogWriter?: SessionLogWriter;
21
- public debug: boolean;
22
21
 
23
22
  constructor(config: AgentConfig) {
24
- this.debug = config.debug || false;
25
23
  this.logger = new Logger({
26
- debug: this.debug,
24
+ debug: config.debug || false,
27
25
  prefix: "[PostHog Agent]",
28
26
  onLog: config.onLog,
29
27
  });