@posthog/agent 2.3.11 → 2.3.15

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.
Files changed (62) hide show
  1. package/dist/adapters/claude/conversion/tool-use-to-acp.js.map +1 -1
  2. package/dist/adapters/claude/permissions/permission-options.js.map +1 -1
  3. package/dist/adapters/claude/questions/utils.js.map +1 -1
  4. package/dist/adapters/claude/session/jsonl-hydration.js.map +1 -1
  5. package/dist/adapters/claude/tools.js.map +1 -1
  6. package/dist/agent.js +33 -4
  7. package/dist/agent.js.map +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/posthog-api.js +1 -1
  10. package/dist/posthog-api.js.map +1 -1
  11. package/dist/server/agent-server.js +33 -4
  12. package/dist/server/agent-server.js.map +1 -1
  13. package/dist/server/bin.cjs +33 -4
  14. package/dist/server/bin.cjs.map +1 -1
  15. package/package.json +1 -1
  16. package/src/adapters/acp-connection.ts +7 -7
  17. package/src/adapters/base-acp-agent.ts +3 -3
  18. package/src/adapters/claude/claude-agent.ts +44 -16
  19. package/src/adapters/claude/conversion/sdk-to-acp.ts +6 -6
  20. package/src/adapters/claude/conversion/tool-use-to-acp.ts +2 -2
  21. package/src/adapters/claude/hooks.ts +3 -3
  22. package/src/adapters/claude/mcp/tool-metadata.ts +1 -1
  23. package/src/adapters/claude/permissions/permission-handlers.ts +8 -8
  24. package/src/adapters/claude/permissions/permission-options.ts +1 -1
  25. package/src/adapters/claude/questions/utils.ts +1 -1
  26. package/src/adapters/claude/session/jsonl-hydration.test.ts +2 -2
  27. package/src/adapters/claude/session/jsonl-hydration.ts +2 -2
  28. package/src/adapters/claude/session/options.ts +12 -6
  29. package/src/adapters/claude/tools.ts +3 -3
  30. package/src/adapters/claude/types.ts +9 -4
  31. package/src/adapters/codex/spawn.ts +2 -2
  32. package/src/agent.ts +6 -6
  33. package/src/execution-mode.ts +1 -1
  34. package/src/index.ts +1 -1
  35. package/src/otel-log-writer.test.ts +2 -2
  36. package/src/otel-log-writer.ts +2 -2
  37. package/src/posthog-api.ts +2 -2
  38. package/src/resume.ts +4 -4
  39. package/src/sagas/apply-snapshot-saga.test.ts +2 -2
  40. package/src/sagas/apply-snapshot-saga.ts +2 -2
  41. package/src/sagas/capture-tree-saga.test.ts +3 -3
  42. package/src/sagas/capture-tree-saga.ts +2 -2
  43. package/src/sagas/resume-saga.test.ts +4 -4
  44. package/src/sagas/resume-saga.ts +5 -5
  45. package/src/sagas/test-fixtures.ts +3 -3
  46. package/src/server/agent-server.test.ts +5 -5
  47. package/src/server/agent-server.ts +14 -14
  48. package/src/server/bin.ts +2 -2
  49. package/src/server/question-relay.test.ts +5 -5
  50. package/src/server/schemas.test.ts +1 -1
  51. package/src/server/types.ts +2 -2
  52. package/src/server/utils/retry.test.ts +1 -1
  53. package/src/server/utils/sse-parser.test.ts +1 -1
  54. package/src/session-log-writer.test.ts +3 -3
  55. package/src/session-log-writer.ts +4 -4
  56. package/src/test/fixtures/api.ts +2 -2
  57. package/src/test/fixtures/config.ts +2 -2
  58. package/src/tree-tracker.ts +5 -5
  59. package/src/utils/async-mutex.test.ts +1 -1
  60. package/src/utils/common.ts +1 -1
  61. package/src/utils/logger.ts +1 -1
  62. package/src/utils/streams.ts +1 -1
@@ -9,11 +9,11 @@ import {
9
9
  expect,
10
10
  it,
11
11
  } from "vitest";
12
- import { createTestRepo, type TestRepo } from "../test/fixtures/api.js";
13
- import { createPostHogHandlers } from "../test/mocks/msw-handlers.js";
14
- import type { TaskRun } from "../types.js";
15
- import { AgentServer } from "./agent-server.js";
16
- import { type JwtPayload, SANDBOX_CONNECTION_AUDIENCE } from "./jwt.js";
12
+ import { createTestRepo, type TestRepo } from "../test/fixtures/api";
13
+ import { createPostHogHandlers } from "../test/mocks/msw-handlers";
14
+ import type { TaskRun } from "../types";
15
+ import { AgentServer } from "./agent-server";
16
+ import { type JwtPayload, SANDBOX_CONNECTION_AUDIENCE } from "./jwt";
17
17
 
18
18
  interface TestableServer {
19
19
  getInitialPromptOverride(run: TaskRun): string | null;
@@ -6,33 +6,33 @@ import {
6
6
  import { type ServerType, serve } from "@hono/node-server";
7
7
  import { Hono } from "hono";
8
8
  import packageJson from "../../package.json" with { type: "json" };
9
- import { POSTHOG_NOTIFICATIONS } from "../acp-extensions.js";
9
+ import { POSTHOG_NOTIFICATIONS } from "../acp-extensions";
10
10
  import {
11
11
  createAcpConnection,
12
12
  type InProcessAcpConnection,
13
- } from "../adapters/acp-connection.js";
14
- import { selectRecentTurns } from "../adapters/claude/session/jsonl-hydration.js";
15
- import { PostHogAPIClient } from "../posthog-api.js";
13
+ } from "../adapters/acp-connection";
14
+ import { selectRecentTurns } from "../adapters/claude/session/jsonl-hydration";
15
+ import { PostHogAPIClient } from "../posthog-api";
16
16
  import {
17
17
  type ConversationTurn,
18
18
  type ResumeState,
19
19
  resumeFromLog,
20
- } from "../resume.js";
21
- import { SessionLogWriter } from "../session-log-writer.js";
22
- import { TreeTracker } from "../tree-tracker.js";
20
+ } from "../resume";
21
+ import { SessionLogWriter } from "../session-log-writer";
22
+ import { TreeTracker } from "../tree-tracker";
23
23
  import type {
24
24
  AgentMode,
25
25
  DeviceInfo,
26
26
  LogLevel,
27
27
  TaskRun,
28
28
  TreeSnapshotEvent,
29
- } from "../types.js";
30
- import { AsyncMutex } from "../utils/async-mutex.js";
31
- import { getLlmGatewayUrl } from "../utils/gateway.js";
32
- import { Logger } from "../utils/logger.js";
33
- import { type JwtPayload, JwtValidationError, validateJwt } from "./jwt.js";
34
- import { jsonRpcRequestSchema, validateCommandParams } from "./schemas.js";
35
- import type { AgentServerConfig } from "./types.js";
29
+ } from "../types";
30
+ import { AsyncMutex } from "../utils/async-mutex";
31
+ import { getLlmGatewayUrl } from "../utils/gateway";
32
+ import { Logger } from "../utils/logger";
33
+ import { type JwtPayload, JwtValidationError, validateJwt } from "./jwt";
34
+ import { jsonRpcRequestSchema, validateCommandParams } from "./schemas";
35
+ import type { AgentServerConfig } from "./types";
36
36
 
37
37
  type MessageCallback = (message: unknown) => void;
38
38
 
package/src/server/bin.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from "commander";
3
3
  import { z } from "zod";
4
- import { AgentServer } from "./agent-server.js";
5
- import { mcpServersSchema } from "./schemas.js";
4
+ import { AgentServer } from "./agent-server";
5
+ import { mcpServersSchema } from "./schemas";
6
6
 
7
7
  const envSchema = z.object({
8
8
  JWT_PUBLIC_KEY: z
@@ -1,10 +1,10 @@
1
1
  import { type SetupServerApi, setupServer } from "msw/node";
2
2
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3
- import type { PostHogAPIClient } from "../posthog-api.js";
4
- import { createTestRepo, type TestRepo } from "../test/fixtures/api.js";
5
- import { createPostHogHandlers } from "../test/mocks/msw-handlers.js";
6
- import type { Task, TaskRun } from "../types.js";
7
- import { AgentServer } from "./agent-server.js";
3
+ import type { PostHogAPIClient } from "../posthog-api";
4
+ import { createTestRepo, type TestRepo } from "../test/fixtures/api";
5
+ import { createPostHogHandlers } from "../test/mocks/msw-handlers";
6
+ import type { Task, TaskRun } from "../types";
7
+ import { AgentServer } from "./agent-server";
8
8
 
9
9
  interface TestableAgentServer {
10
10
  posthogAPI: PostHogAPIClient;
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import { mcpServersSchema } from "./schemas.js";
2
+ import { mcpServersSchema } from "./schemas";
3
3
 
4
4
  describe("mcpServersSchema", () => {
5
5
  it("accepts a valid HTTP server", () => {
@@ -1,5 +1,5 @@
1
- import type { AgentMode } from "../types.js";
2
- import type { RemoteMcpServer } from "./schemas.js";
1
+ import type { AgentMode } from "../types";
2
+ import type { RemoteMcpServer } from "./schemas";
3
3
 
4
4
  export interface AgentServerConfig {
5
5
  port: number;
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it, vi } from "vitest";
2
- import { retry } from "./retry.js";
2
+ import { retry } from "./retry";
3
3
 
4
4
  describe("retry", () => {
5
5
  it("returns result on first success", async () => {
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import { SseEventParser } from "./sse-parser.js";
2
+ import { SseEventParser } from "./sse-parser";
3
3
 
4
4
  describe("SseEventParser", () => {
5
5
  it("parses complete SSE event", () => {
@@ -1,7 +1,7 @@
1
1
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
2
- import type { PostHogAPIClient } from "./posthog-api.js";
3
- import { SessionLogWriter } from "./session-log-writer.js";
4
- import type { StoredNotification } from "./types.js";
2
+ import type { PostHogAPIClient } from "./posthog-api";
3
+ import { SessionLogWriter } from "./session-log-writer";
4
+ import type { StoredNotification } from "./types";
5
5
 
6
6
  function makeSessionUpdate(
7
7
  sessionUpdate: string,
@@ -1,10 +1,10 @@
1
1
  import fs from "node:fs";
2
2
  import fsp from "node:fs/promises";
3
3
  import path from "node:path";
4
- import type { SessionContext } from "./otel-log-writer.js";
5
- import type { PostHogAPIClient } from "./posthog-api.js";
6
- import type { StoredNotification } from "./types.js";
7
- import { Logger } from "./utils/logger.js";
4
+ import type { SessionContext } from "./otel-log-writer";
5
+ import type { PostHogAPIClient } from "./posthog-api";
6
+ import type { StoredNotification } from "./types";
7
+ import { Logger } from "./utils/logger";
8
8
 
9
9
  export interface SessionLogWriterOptions {
10
10
  /** PostHog API client for log persistence */
@@ -5,8 +5,8 @@ import { tmpdir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import { promisify } from "node:util";
7
7
  import { vi } from "vitest";
8
- import type { PostHogAPIClient } from "../../posthog-api.js";
9
- import type { TaskRun, TreeSnapshot } from "../../types.js";
8
+ import type { PostHogAPIClient } from "../../posthog-api";
9
+ import type { TaskRun, TreeSnapshot } from "../../types";
10
10
 
11
11
  const execFileAsync = promisify(execFile);
12
12
 
@@ -1,5 +1,5 @@
1
- import type { AgentServerConfig } from "../../server/types.js";
2
- import type { TestRepo } from "./api.js";
1
+ import type { AgentServerConfig } from "../../server/types";
2
+ import type { TestRepo } from "./api";
3
3
 
4
4
  export type { AgentServerConfig };
5
5
 
@@ -11,11 +11,11 @@
11
11
  */
12
12
 
13
13
  import { isCommitOnRemote as gitIsCommitOnRemote } from "@posthog/git/queries";
14
- import type { PostHogAPIClient } from "./posthog-api.js";
15
- import { ApplySnapshotSaga } from "./sagas/apply-snapshot-saga.js";
16
- import { CaptureTreeSaga } from "./sagas/capture-tree-saga.js";
17
- import type { TreeSnapshot } from "./types.js";
18
- import { Logger } from "./utils/logger.js";
14
+ import type { PostHogAPIClient } from "./posthog-api";
15
+ import { ApplySnapshotSaga } from "./sagas/apply-snapshot-saga";
16
+ import { CaptureTreeSaga } from "./sagas/capture-tree-saga";
17
+ import type { TreeSnapshot } from "./types";
18
+ import { Logger } from "./utils/logger";
19
19
 
20
20
  export type { TreeSnapshot };
21
21
 
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import { AsyncMutex } from "./async-mutex.js";
2
+ import { AsyncMutex } from "./async-mutex";
3
3
 
4
4
  describe("AsyncMutex", () => {
5
5
  it("acquires lock when unlocked", async () => {
@@ -1,4 +1,4 @@
1
- import type { Logger } from "./logger.js";
1
+ import type { Logger } from "./logger";
2
2
 
3
3
  /**
4
4
  * Races an operation against a timeout.
@@ -1,4 +1,4 @@
1
- import type { LogLevel as LogLevelType, OnLogCallback } from "../types.js";
1
+ import type { LogLevel as LogLevelType, OnLogCallback } from "../types";
2
2
 
3
3
  export interface LoggerConfig {
4
4
  debug?: boolean;
@@ -1,6 +1,6 @@
1
1
  import type { Readable, Writable } from "node:stream";
2
2
  import { ReadableStream, WritableStream } from "node:stream/web";
3
- import type { Logger } from "./logger.js";
3
+ import type { Logger } from "./logger";
4
4
 
5
5
  export class Pushable<T> implements AsyncIterable<T> {
6
6
  private queue: T[] = [];