cc-hooks-ts 2.1.47 → 2.1.49

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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as v from "valibot";
2
- import { AgentInput, BashInput, ExitPlanModeInput, FileEditInput, FileReadInput, FileWriteInput, GlobInput, GrepInput, ListMcpResourcesInput, NotebookEditInput, ReadMcpResourceInput, TaskOutputInput, TaskStopInput, TodoWriteInput, WebFetchInput, WebSearchInput } from "@anthropic-ai/claude-agent-sdk/sdk-tools";
2
+ import { AgentInput, AgentOutput, AskUserQuestionInput, AskUserQuestionOutput, BashInput, BashOutput, ExitPlanModeInput, ExitPlanModeOutput, FileEditInput, FileEditOutput, FileReadInput, FileReadOutput, FileWriteInput, FileWriteOutput, GlobInput, GlobOutput, GrepInput, GrepOutput, ListMcpResourcesInput, ListMcpResourcesOutput, NotebookEditInput, NotebookEditOutput, ReadMcpResourceInput, ReadMcpResourceOutput, TaskOutputInput, TaskStopInput, TaskStopOutput, TodoWriteInput, TodoWriteOutput, WebFetchInput, WebFetchOutput, WebSearchInput, WebSearchOutput } from "@anthropic-ai/claude-agent-sdk/sdk-tools";
3
3
 
4
4
  //#region src/utils/types.d.ts
5
5
  type Awaitable<T> = Promise<T> | T;
@@ -208,6 +208,16 @@ declare const HookInputSchemas: {
208
208
  team_name: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
209
209
  teammate_name: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
210
210
  }, undefined>;
211
+ readonly ConfigChange: v.ObjectSchema<{
212
+ readonly cwd: v.StringSchema<undefined>;
213
+ readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
214
+ readonly session_id: v.StringSchema<undefined>;
215
+ readonly transcript_path: v.StringSchema<undefined>;
216
+ readonly hook_event_name: v.LiteralSchema<"ConfigChange", undefined>;
217
+ } & {
218
+ file_path: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
219
+ source: v.PicklistSchema<["local_settings", "policy_settings", "project_settings", "skills", "user_settings"], undefined>;
220
+ }, undefined>;
211
221
  };
212
222
  //#endregion
213
223
  //#region src/hooks/event.d.ts
@@ -216,7 +226,7 @@ declare const HookInputSchemas: {
216
226
  *
217
227
  * @package
218
228
  */
219
- type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PermissionRequest" | "Setup" | "TeammateIdle" | "TaskCompleted";
229
+ type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PermissionRequest" | "Setup" | "TeammateIdle" | "TaskCompleted" | "ConfigChange";
220
230
  //#endregion
221
231
  //#region src/hooks/input/types.d.ts
222
232
  /**
@@ -356,6 +366,7 @@ type HookOutput = {
356
366
  PermissionRequest: PermissionRequestHookOutput;
357
367
  Setup: SetupHookOutput;
358
368
  Notification: NotificationHookOutput;
369
+ ConfigChange: CommonHookOutputs;
359
370
  PreCompact: CommonHookOutputs;
360
371
  SessionEnd: CommonHookOutputs;
361
372
  TaskCompleted: CommonHookOutputs;
@@ -948,122 +959,49 @@ declare function runHook<THookTrigger extends HookTrigger = HookTrigger>(def: Ho
948
959
  * ```
949
960
  */
950
961
  interface ToolSchema {
962
+ AskUserQuestion: {
963
+ input: AskUserQuestionInput;
964
+ response: AskUserQuestionOutput;
965
+ };
951
966
  Bash: {
952
967
  input: BashInput;
953
- response: {
954
- interrupted: boolean;
955
- isImage: boolean;
956
- stderr: string;
957
- stdout: string;
958
- };
968
+ response: BashOutput;
959
969
  };
960
970
  Edit: {
961
971
  input: FileEditInput;
962
- response: {
963
- filePath: string;
964
- newString: string;
965
- oldString: string;
966
- originalFile: string;
967
- replaceAll: boolean;
968
- structuredPatch: Array<{
969
- lines: string[];
970
- newLines: number;
971
- newStart: number;
972
- oldLines: number;
973
- oldStart: number;
974
- }>;
975
- userModified: boolean;
976
- };
972
+ response: FileEditOutput;
977
973
  };
978
974
  ExitPlanMode: {
979
975
  input: ExitPlanModeInput;
980
- response: unknown;
976
+ response: ExitPlanModeOutput;
981
977
  };
982
978
  Glob: {
983
979
  input: GlobInput;
984
- response: {
985
- durationMs: number;
986
- filenames: string[];
987
- numFiles: number;
988
- truncated: boolean;
989
- };
980
+ response: GlobOutput;
990
981
  };
991
982
  Grep: {
992
983
  input: GrepInput;
993
- response: {
994
- content: string;
995
- mode: "content" | "count" | "files_with_matches";
996
- numFiles: number;
997
- numLines: number;
998
- };
984
+ response: GrepOutput;
999
985
  };
1000
986
  ListMcpResources: {
1001
987
  input: ListMcpResourcesInput;
1002
- response: unknown;
988
+ response: ListMcpResourcesOutput;
1003
989
  };
1004
990
  NotebookEdit: {
1005
991
  input: NotebookEditInput;
1006
- response: {
1007
- cell_type: "code" | "markdown";
1008
- edit_mode: "delete" | "insert" | "replace";
1009
- error: string;
1010
- language: string;
1011
- new_source: string;
1012
- };
992
+ response: NotebookEditOutput;
1013
993
  };
1014
994
  Read: {
1015
995
  input: FileReadInput;
1016
- response: {
1017
- file: {
1018
- cells: Array<{
1019
- cell_id: string;
1020
- cellType: "code";
1021
- language: string;
1022
- source: string;
1023
- } | {
1024
- cell_id: string;
1025
- cellType: "markdown";
1026
- source: string;
1027
- }>;
1028
- filePath: string;
1029
- };
1030
- type: "notebook";
1031
- } | {
1032
- file: {
1033
- content: string;
1034
- filePath: string;
1035
- numLines: number;
1036
- startLine: number;
1037
- totalLines: number;
1038
- };
1039
- type: "text";
1040
- };
996
+ response: FileReadOutput;
1041
997
  };
1042
998
  ReadMcpResource: {
1043
999
  input: ReadMcpResourceInput;
1044
- response: unknown;
1000
+ response: ReadMcpResourceOutput;
1045
1001
  };
1046
1002
  Task: {
1047
1003
  input: AgentInput;
1048
- response: {
1049
- content: Array<{
1050
- text: string;
1051
- type: "text";
1052
- }>;
1053
- totalDurationMs: number;
1054
- totalTokens: number;
1055
- totalToolUseCount: number;
1056
- usage: {
1057
- cache_creation: {
1058
- ephemeral_1h_input_tokens: number;
1059
- ephemeral_5m_input_tokens: number;
1060
- };
1061
- cache_creation_input_tokens: number;
1062
- cache_read_input_tokens: number;
1063
- input_tokens: number;
1064
- output_tokens: number;
1065
- };
1066
- };
1004
+ response: AgentOutput;
1067
1005
  };
1068
1006
  TaskOutput: {
1069
1007
  input: TaskOutputInput;
@@ -1071,35 +1009,23 @@ interface ToolSchema {
1071
1009
  };
1072
1010
  TaskStop: {
1073
1011
  input: TaskStopInput;
1074
- response: unknown;
1012
+ response: TaskStopOutput;
1075
1013
  };
1076
1014
  TodoWrite: {
1077
1015
  input: TodoWriteInput;
1078
- response: unknown;
1016
+ response: TodoWriteOutput;
1079
1017
  };
1080
1018
  WebFetch: {
1081
1019
  input: WebFetchInput;
1082
- response: {
1083
- bytes: number;
1084
- code: number;
1085
- codeText: string;
1086
- durationMs: number;
1087
- result: string;
1088
- url: string;
1089
- };
1020
+ response: WebFetchOutput;
1090
1021
  };
1091
1022
  WebSearch: {
1092
1023
  input: WebSearchInput;
1093
- response: unknown;
1024
+ response: WebSearchOutput;
1094
1025
  };
1095
1026
  Write: {
1096
1027
  input: FileWriteInput;
1097
- response: {
1098
- content: string;
1099
- filePath: string;
1100
- structuredPatch: unknown[];
1101
- type: "create";
1102
- };
1028
+ response: FileWriteOutput;
1103
1029
  };
1104
1030
  }
1105
1031
  //#endregion
package/dist/index.mjs CHANGED
@@ -180,6 +180,16 @@ const HookInputSchemas = {
180
180
  task_subject: v.string(),
181
181
  team_name: v.exactOptional(v.string()),
182
182
  teammate_name: v.exactOptional(v.string())
183
+ }),
184
+ ConfigChange: buildHookInputSchema("ConfigChange", {
185
+ file_path: v.exactOptional(v.string()),
186
+ source: v.picklist([
187
+ "local_settings",
188
+ "policy_settings",
189
+ "project_settings",
190
+ "skills",
191
+ "user_settings"
192
+ ])
183
193
  })
184
194
  };
185
195
  function isNonEmptyString(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-hooks-ts",
3
- "version": "2.1.47",
3
+ "version": "2.1.49",
4
4
  "type": "module",
5
5
  "description": "Write claude code hooks with type safety",
6
6
  "sideEffects": false,
@@ -62,7 +62,7 @@
62
62
  "vitest": "4.0.18"
63
63
  },
64
64
  "dependencies": {
65
- "@anthropic-ai/claude-agent-sdk": "0.2.47",
65
+ "@anthropic-ai/claude-agent-sdk": "0.2.49",
66
66
  "valibot": "^1.1.0"
67
67
  },
68
68
  "scripts": {