@posthog/agent 2.3.159 → 2.3.167

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.
@@ -7,47 +7,17 @@ declare const OPTION_PREFIX = "option_";
7
7
  declare const QuestionOptionSchema: z.ZodObject<{
8
8
  label: z.ZodString;
9
9
  description: z.ZodOptional<z.ZodString>;
10
- }, "strip", z.ZodTypeAny, {
11
- label: string;
12
- description?: string | undefined;
13
- }, {
14
- label: string;
15
- description?: string | undefined;
16
- }>;
10
+ }, z.core.$strip>;
17
11
  declare const QuestionItemSchema: z.ZodObject<{
18
12
  question: z.ZodString;
19
13
  header: z.ZodOptional<z.ZodString>;
20
14
  options: z.ZodArray<z.ZodObject<{
21
15
  label: z.ZodString;
22
16
  description: z.ZodOptional<z.ZodString>;
23
- }, "strip", z.ZodTypeAny, {
24
- label: string;
25
- description?: string | undefined;
26
- }, {
27
- label: string;
28
- description?: string | undefined;
29
- }>, "many">;
17
+ }, z.core.$strip>>;
30
18
  multiSelect: z.ZodOptional<z.ZodBoolean>;
31
19
  completed: z.ZodOptional<z.ZodBoolean>;
32
- }, "strip", z.ZodTypeAny, {
33
- options: {
34
- label: string;
35
- description?: string | undefined;
36
- }[];
37
- question: string;
38
- completed?: boolean | undefined;
39
- header?: string | undefined;
40
- multiSelect?: boolean | undefined;
41
- }, {
42
- options: {
43
- label: string;
44
- description?: string | undefined;
45
- }[];
46
- question: string;
47
- completed?: boolean | undefined;
48
- header?: string | undefined;
49
- multiSelect?: boolean | undefined;
50
- }>;
20
+ }, z.core.$strip>;
51
21
  declare const QuestionMetaSchema: z.ZodObject<{
52
22
  questions: z.ZodArray<z.ZodObject<{
53
23
  question: z.ZodString;
@@ -55,57 +25,11 @@ declare const QuestionMetaSchema: z.ZodObject<{
55
25
  options: z.ZodArray<z.ZodObject<{
56
26
  label: z.ZodString;
57
27
  description: z.ZodOptional<z.ZodString>;
58
- }, "strip", z.ZodTypeAny, {
59
- label: string;
60
- description?: string | undefined;
61
- }, {
62
- label: string;
63
- description?: string | undefined;
64
- }>, "many">;
28
+ }, z.core.$strip>>;
65
29
  multiSelect: z.ZodOptional<z.ZodBoolean>;
66
30
  completed: z.ZodOptional<z.ZodBoolean>;
67
- }, "strip", z.ZodTypeAny, {
68
- options: {
69
- label: string;
70
- description?: string | undefined;
71
- }[];
72
- question: string;
73
- completed?: boolean | undefined;
74
- header?: string | undefined;
75
- multiSelect?: boolean | undefined;
76
- }, {
77
- options: {
78
- label: string;
79
- description?: string | undefined;
80
- }[];
81
- question: string;
82
- completed?: boolean | undefined;
83
- header?: string | undefined;
84
- multiSelect?: boolean | undefined;
85
- }>, "many">;
86
- }, "strip", z.ZodTypeAny, {
87
- questions: {
88
- options: {
89
- label: string;
90
- description?: string | undefined;
91
- }[];
92
- question: string;
93
- completed?: boolean | undefined;
94
- header?: string | undefined;
95
- multiSelect?: boolean | undefined;
96
- }[];
97
- }, {
98
- questions: {
99
- options: {
100
- label: string;
101
- description?: string | undefined;
102
- }[];
103
- question: string;
104
- completed?: boolean | undefined;
105
- header?: string | undefined;
106
- multiSelect?: boolean | undefined;
107
- }[];
108
- }>;
31
+ }, z.core.$strip>>;
32
+ }, z.core.$strip>;
109
33
  type QuestionOption = z.infer<typeof QuestionOptionSchema>;
110
34
  type QuestionItem = z.infer<typeof QuestionItemSchema>;
111
35
  type QuestionMeta = z.infer<typeof QuestionMetaSchema>;
package/dist/agent.js CHANGED
@@ -371,7 +371,7 @@ import { v7 as uuidv7 } from "uuid";
371
371
  // package.json
372
372
  var package_default = {
373
373
  name: "@posthog/agent",
374
- version: "2.3.159",
374
+ version: "2.3.167",
375
375
  repository: "https://github.com/PostHog/code",
376
376
  description: "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
377
377
  exports: {
@@ -483,7 +483,7 @@ var package_default = {
483
483
  tar: "^7.5.0",
484
484
  uuid: "13.0.0",
485
485
  "yoga-wasm-web": "^0.3.3",
486
- zod: "^3.24.1"
486
+ zod: "^4.2.0"
487
487
  },
488
488
  files: [
489
489
  "dist/**/*",
@@ -771,6 +771,36 @@ var createPostToolUseHook = ({ onModeChange, logger }) => async (input, toolUseI
771
771
  }
772
772
  return { continue: true };
773
773
  };
774
+ var SUBAGENT_REWRITES = {
775
+ Explore: "ph-explore"
776
+ };
777
+ var createSubagentRewriteHook = (logger) => async (input, _toolUseID) => {
778
+ if (input.hook_event_name !== "PreToolUse") {
779
+ return { continue: true };
780
+ }
781
+ if (input.tool_name !== "Agent") {
782
+ return { continue: true };
783
+ }
784
+ const toolInput = input.tool_input;
785
+ const subagentType = toolInput?.subagent_type;
786
+ if (typeof subagentType !== "string" || !SUBAGENT_REWRITES[subagentType]) {
787
+ return { continue: true };
788
+ }
789
+ const target = SUBAGENT_REWRITES[subagentType];
790
+ logger.info(
791
+ `[SubagentRewriteHook] Rewriting subagent_type: ${subagentType} \u2192 ${target}`
792
+ );
793
+ return {
794
+ continue: true,
795
+ hookSpecificOutput: {
796
+ hookEventName: "PreToolUse",
797
+ updatedInput: {
798
+ ...toolInput,
799
+ subagent_type: target
800
+ }
801
+ }
802
+ };
803
+ };
774
804
  var createPreToolUseHook = (settingsManager, logger) => async (input, _toolUseID) => {
775
805
  if (input.hook_event_name !== "PreToolUse") {
776
806
  return { continue: true };
@@ -2800,7 +2830,10 @@ function buildHooks(userHooks, onModeChange, settingsManager, logger) {
2800
2830
  PreToolUse: [
2801
2831
  ...userHooks?.PreToolUse || [],
2802
2832
  {
2803
- hooks: [createPreToolUseHook(settingsManager, logger)]
2833
+ hooks: [
2834
+ createPreToolUseHook(settingsManager, logger),
2835
+ createSubagentRewriteHook(logger)
2836
+ ]
2804
2837
  }
2805
2838
  ]
2806
2839
  };