@posthog/agent 2.3.278 → 2.3.281

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.278",
3
+ "version": "2.3.281",
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": {
@@ -3,6 +3,7 @@ export const DEFAULT_MODEL = "opus";
3
3
  const GATEWAY_TO_SDK_MODEL: Record<string, string> = {
4
4
  "claude-opus-4-5": "opus",
5
5
  "claude-opus-4-6": "opus",
6
+ "claude-opus-4-7": "opus",
6
7
  "claude-sonnet-4-5": "sonnet",
7
8
  "claude-sonnet-4-6": "sonnet",
8
9
  "claude-haiku-4-5": "haiku",
@@ -14,6 +15,7 @@ export function toSdkModelId(modelId: string): string {
14
15
 
15
16
  const MODELS_WITH_1M_CONTEXT = new Set([
16
17
  "claude-opus-4-6",
18
+ "claude-opus-4-7",
17
19
  "claude-sonnet-4-6",
18
20
  ]);
19
21
 
@@ -24,10 +26,11 @@ export function supports1MContext(modelId: string): boolean {
24
26
  const MODELS_WITH_EFFORT = new Set([
25
27
  "claude-opus-4-5",
26
28
  "claude-opus-4-6",
29
+ "claude-opus-4-7",
27
30
  "claude-sonnet-4-6",
28
31
  ]);
29
32
 
30
- const MODELS_WITH_MAX_EFFORT = new Set(["claude-opus-4-6"]);
33
+ const MODELS_WITH_MAX_EFFORT = new Set(["claude-opus-4-6", "claude-opus-4-7"]);
31
34
 
32
35
  export function supportsEffort(modelId: string): boolean {
33
36
  return MODELS_WITH_EFFORT.has(modelId);
@@ -0,0 +1,21 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { getAvailableCodexModes, getAvailableModes } from "./execution-mode";
3
+
4
+ describe("execution modes", () => {
5
+ it("includes auto-accept permissions for claude sessions", () => {
6
+ expect(getAvailableModes().map((mode) => mode.id)).toEqual([
7
+ "default",
8
+ "acceptEdits",
9
+ "plan",
10
+ "bypassPermissions",
11
+ ]);
12
+ });
13
+
14
+ it("includes full access for codex sessions", () => {
15
+ expect(getAvailableCodexModes().map((mode) => mode.id)).toEqual([
16
+ "read-only",
17
+ "auto",
18
+ "full-access",
19
+ ]);
20
+ });
21
+ });
@@ -35,8 +35,8 @@ const availableModes: ModeInfo[] = [
35
35
  if (ALLOW_BYPASS) {
36
36
  availableModes.push({
37
37
  id: "bypassPermissions",
38
- name: "Bypass Permissions",
39
- description: "Bypass all permission prompts",
38
+ name: "Auto-accept Permissions",
39
+ description: "Auto-accept all permission requests",
40
40
  });
41
41
  }
42
42
 
@@ -51,8 +51,11 @@ export const CODE_EXECUTION_MODES = [
51
51
 
52
52
  export type CodeExecutionMode = (typeof CODE_EXECUTION_MODES)[number];
53
53
 
54
+ export function isCodeExecutionMode(mode: string): mode is CodeExecutionMode {
55
+ return (CODE_EXECUTION_MODES as readonly string[]).includes(mode);
56
+ }
57
+
54
58
  export function getAvailableModes(): ModeInfo[] {
55
- // When IS_ROOT, do not allow bypassPermissions
56
59
  return IS_ROOT
57
60
  ? availableModes.filter((m) => m.id !== "bypassPermissions")
58
61
  : availableModes;
@@ -67,6 +70,10 @@ export type CodexNativeMode = (typeof CODEX_NATIVE_MODES)[number];
67
70
  /** Union of all permission mode IDs across adapters */
68
71
  export type PermissionMode = CodeExecutionMode | CodexNativeMode;
69
72
 
73
+ export function isCodexNativeMode(mode: string): mode is CodexNativeMode {
74
+ return (CODEX_NATIVE_MODES as readonly string[]).includes(mode);
75
+ }
76
+
70
77
  const codexModes: ModeInfo[] = [
71
78
  {
72
79
  id: "read-only",
@@ -84,7 +91,7 @@ if (ALLOW_BYPASS) {
84
91
  codexModes.push({
85
92
  id: "full-access",
86
93
  name: "Full Access",
87
- description: "Bypass all permission prompts",
94
+ description: "Auto-accept all permission requests",
88
95
  });
89
96
  }
90
97
 
@@ -15,7 +15,7 @@ export interface FetchGatewayModelsOptions {
15
15
  gatewayUrl: string;
16
16
  }
17
17
 
18
- export const DEFAULT_GATEWAY_MODEL = "claude-opus-4-6";
18
+ export const DEFAULT_GATEWAY_MODEL = "claude-opus-4-7";
19
19
 
20
20
  export const DEFAULT_CODEX_MODEL = "gpt-5.4";
21
21
 
@@ -27,7 +27,7 @@ export function createPostHogHandlers(options: PostHogHandlersOptions = {}) {
27
27
  object: "list",
28
28
  data: [
29
29
  {
30
- id: "claude-opus-4-6",
30
+ id: "claude-opus-4-7",
31
31
  owned_by: "anthropic",
32
32
  context_window: 200000,
33
33
  supports_streaming: true,