cc-hooks-ts 2.0.55 → 2.0.56

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
@@ -33,6 +33,19 @@ declare const HookInputSchemas: {
33
33
  tool_response: v.UnknownSchema;
34
34
  tool_use_id: v.StringSchema<undefined>;
35
35
  }, undefined>;
36
+ readonly PostToolUseFailure: v.ObjectSchema<{
37
+ readonly cwd: v.StringSchema<undefined>;
38
+ readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
39
+ readonly session_id: v.StringSchema<undefined>;
40
+ readonly transcript_path: v.StringSchema<undefined>;
41
+ readonly hook_event_name: v.LiteralSchema<"PostToolUseFailure", undefined>;
42
+ } & {
43
+ tool_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, AutoComplete<string>>]>;
44
+ error: v.StringSchema<undefined>;
45
+ is_interrupt: v.ExactOptionalSchema<v.BooleanSchema<undefined>, undefined>;
46
+ tool_input: v.UnknownSchema;
47
+ tool_use_id: v.StringSchema<undefined>;
48
+ }, undefined>;
36
49
  readonly Notification: v.ObjectSchema<{
37
50
  readonly cwd: v.StringSchema<undefined>;
38
51
  readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -166,7 +179,7 @@ declare const HookInputSchemas: {
166
179
  *
167
180
  * @package
168
181
  */
169
- type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PermissionRequest";
182
+ type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PermissionRequest";
170
183
  //#endregion
171
184
  //#region src/hooks/input/types.d.ts
172
185
  /**
@@ -184,6 +197,8 @@ type HookInput = { [EventKey in SupportedHookEvent]: EventKey extends "PreToolUs
184
197
  default: BaseHookInputs["PreToolUse"];
185
198
  } : EventKey extends "PostToolUse" ? ToolSpecificPostToolUseInput & {
186
199
  default: BaseHookInputs["PostToolUse"];
200
+ } : EventKey extends "PostToolUseFailure" ? ToolSpecificPostToolUseFailureInput & {
201
+ default: BaseHookInputs["PostToolUseFailure"];
187
202
  } : {
188
203
  default: BaseHookInputs[EventKey];
189
204
  } };
@@ -240,6 +255,10 @@ type ToolSpecificPostToolUseInput = { [K in keyof ToolSchema]: Omit<BaseHookInpu
240
255
  tool_name: K;
241
256
  tool_response: ToolSchema[K]["response"];
242
257
  } };
258
+ type ToolSpecificPostToolUseFailureInput = { [K in keyof ToolSchema]: Omit<BaseHookInputs["PostToolUseFailure"], "tool_input" | "tool_name"> & {
259
+ tool_input: ToolSchema[K]["input"];
260
+ tool_name: K;
261
+ } };
243
262
  //#endregion
244
263
  //#region src/hooks/permission.d.ts
245
264
  /**
@@ -291,6 +310,7 @@ type PermissionUpdate = v.InferOutput<typeof permissionUpdateSchema>;
291
310
  type HookOutput = {
292
311
  PreToolUse: PreToolUseHookOutput;
293
312
  PostToolUse: PostToolUseHookOutput;
313
+ PostToolUseFailure: PostToolUseFailureHookOutput;
294
314
  UserPromptSubmit: UserPromptSubmitHookOutput;
295
315
  Stop: StopHookOutput;
296
316
  SubagentStart: SubagentStartHookOutput;
@@ -382,6 +402,15 @@ interface PostToolUseHookOutput extends CommonHookOutputs {
382
402
  };
383
403
  reason?: string;
384
404
  }
405
+ interface PostToolUseFailureHookOutput extends CommonHookOutputs {
406
+ hookSpecificOutput?: {
407
+ hookEventName: "PostToolUseFailure";
408
+ /**
409
+ * Adds context for Claude to consider.
410
+ */
411
+ additionalContext?: string;
412
+ };
413
+ }
385
414
  /**
386
415
  * @see {@link https://docs.anthropic.com/en/docs/claude-code/hooks#userpromptsubmit-decision-control}
387
416
  */
package/dist/index.mjs CHANGED
@@ -110,6 +110,13 @@ const HookInputSchemas = {
110
110
  tool_response: v.unknown(),
111
111
  tool_use_id: v.string()
112
112
  }),
113
+ PostToolUseFailure: buildHookInputSchema("PostToolUseFailure", {
114
+ tool_name: v.pipe(v.string(), v.transform((s) => s)),
115
+ error: v.string(),
116
+ is_interrupt: v.exactOptional(v.boolean()),
117
+ tool_input: v.unknown(),
118
+ tool_use_id: v.string()
119
+ }),
113
120
  Notification: buildHookInputSchema("Notification", {
114
121
  message: v.string(),
115
122
  notification_type: v.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-hooks-ts",
3
- "version": "2.0.55",
3
+ "version": "2.0.56",
4
4
  "type": "module",
5
5
  "description": "Write claude code hooks with type safety",
6
6
  "sideEffects": false,
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@arethetypeswrong/core": "0.18.2",
46
- "@biomejs/biome": "2.3.7",
46
+ "@biomejs/biome": "2.3.8",
47
47
  "@types/node": "24.10.1",
48
48
  "@typescript/native-preview": "^7.0.0-dev.20251108.1",
49
49
  "@virtual-live-lab/eslint-config": "2.3.1",
@@ -54,15 +54,15 @@
54
54
  "publint": "0.3.15",
55
55
  "release-it": "19.0.6",
56
56
  "release-it-pnpm": "4.6.6",
57
- "tsdown": "0.16.6",
57
+ "tsdown": "0.16.8",
58
58
  "type-fest": "5.2.0",
59
59
  "typescript": "5.9.3",
60
- "typescript-eslint": "8.47.0",
60
+ "typescript-eslint": "8.48.0",
61
61
  "unplugin-unused": "0.5.6",
62
- "vitest": "4.0.13"
62
+ "vitest": "4.0.14"
63
63
  },
64
64
  "dependencies": {
65
- "@anthropic-ai/claude-agent-sdk": "0.1.55",
65
+ "@anthropic-ai/claude-agent-sdk": "0.1.56",
66
66
  "valibot": "^1.1.0"
67
67
  },
68
68
  "scripts": {