cc-hooks-ts 2.1.76 → 2.1.79
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/README.md +17 -6
- package/dist/index.d.mts +17 -3
- package/dist/index.mjs +16 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -277,19 +277,30 @@ pnpm typecheck
|
|
|
277
277
|
|
|
278
278
|
### How to follow the upstream changes
|
|
279
279
|
|
|
280
|
-
1.
|
|
281
|
-
- If the command passes without errors, there are no type changes.
|
|
280
|
+
1. Check installed version of `@anthropic-ai/claude-agent-sdk`:
|
|
282
281
|
|
|
283
|
-
|
|
282
|
+
```bash
|
|
283
|
+
npm list @anthropic-ai/claude-agent-sdk
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
2. Check the latest version of `@anthropic-ai/claude-agent-sdk`:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
npm view @anthropic-ai/claude-agent-sdk version
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
- If the latest version is the same as your installed version, then there is no upstream change and you are good to go!
|
|
293
|
+
|
|
294
|
+
3. Get diff of the types.
|
|
284
295
|
|
|
285
296
|
```bash
|
|
286
|
-
npm diff --diff=@anthropic-ai/claude-agent-sdk
|
|
297
|
+
npm diff --diff=@anthropic-ai/claude-agent-sdk@<old_version> --diff=@anthropic-ai/claude-agent-sdk@<new_version> '**/*.d.ts'
|
|
287
298
|
|
|
288
299
|
# Only for humans, You can use dandavison/delta for better diff visualization
|
|
289
|
-
npm diff --diff=@anthropic-ai/claude-agent-sdk
|
|
300
|
+
npm diff --diff=@anthropic-ai/claude-agent-sdk@<old_version> --diff=@anthropic-ai/claude-agent-sdk@<new_version> '**/*.d.ts' | delta --side-by-side
|
|
290
301
|
```
|
|
291
302
|
|
|
292
|
-
|
|
303
|
+
4. Reflect the changes.
|
|
293
304
|
- Edit `src/hooks/` for changed hook input / output types.
|
|
294
305
|
- No need for adding tests in most cases since we are testing the whole type definitions in these files:
|
|
295
306
|
- `src/hooks/input/schemas.test-d.ts`
|
package/dist/index.d.mts
CHANGED
|
@@ -88,6 +88,19 @@ declare const HookInputSchemas: {
|
|
|
88
88
|
last_assistant_message: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
89
89
|
stop_hook_active: v.BooleanSchema<undefined>;
|
|
90
90
|
}, undefined>;
|
|
91
|
+
readonly StopFailure: v.ObjectSchema<{
|
|
92
|
+
readonly agent_id: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
93
|
+
readonly agent_type: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
94
|
+
readonly cwd: v.StringSchema<undefined>;
|
|
95
|
+
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
96
|
+
readonly session_id: v.StringSchema<undefined>;
|
|
97
|
+
readonly transcript_path: v.StringSchema<undefined>;
|
|
98
|
+
readonly hook_event_name: v.LiteralSchema<"StopFailure", undefined>;
|
|
99
|
+
} & {
|
|
100
|
+
error: v.PicklistSchema<["authentication_failed", "billing_error", "rate_limit", "invalid_request", "server_error", "unknown", "max_output_tokens"], undefined>;
|
|
101
|
+
error_details: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
102
|
+
last_assistant_message: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
103
|
+
}, undefined>;
|
|
91
104
|
readonly SubagentStart: v.ObjectSchema<Omit<{
|
|
92
105
|
readonly agent_id: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
93
106
|
readonly agent_type: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -162,7 +175,7 @@ declare const HookInputSchemas: {
|
|
|
162
175
|
readonly transcript_path: v.StringSchema<undefined>;
|
|
163
176
|
readonly hook_event_name: v.LiteralSchema<"SessionEnd", undefined>;
|
|
164
177
|
} & {
|
|
165
|
-
reason: v.PicklistSchema<["clear", "logout", "prompt_input_exit", "other", "bypass_permissions_disabled"], undefined>;
|
|
178
|
+
reason: v.PicklistSchema<["clear", "resume", "logout", "prompt_input_exit", "other", "bypass_permissions_disabled"], undefined>;
|
|
166
179
|
}, undefined>;
|
|
167
180
|
readonly PermissionRequest: v.ObjectSchema<{
|
|
168
181
|
readonly agent_id: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -327,7 +340,7 @@ declare const HookInputSchemas: {
|
|
|
327
340
|
} & {
|
|
328
341
|
file_path: v.StringSchema<undefined>;
|
|
329
342
|
globs: v.ExactOptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
330
|
-
load_reason: v.PicklistSchema<["session_start", "nested_traversal", "path_glob_match", "include"], undefined>;
|
|
343
|
+
load_reason: v.PicklistSchema<["session_start", "nested_traversal", "path_glob_match", "include", "compact"], undefined>;
|
|
331
344
|
memory_type: v.PicklistSchema<["User", "Project", "Local", "Managed"], undefined>;
|
|
332
345
|
parent_file_path: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
333
346
|
trigger_file_path: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -340,7 +353,7 @@ declare const HookInputSchemas: {
|
|
|
340
353
|
*
|
|
341
354
|
* @package
|
|
342
355
|
*/
|
|
343
|
-
type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PostCompact" | "PermissionRequest" | "Setup" | "TeammateIdle" | "TaskCompleted" | "ConfigChange" | "WorktreeCreate" | "WorktreeRemove" | "Elicitation" | "ElicitationResult" | "InstructionsLoaded";
|
|
356
|
+
type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PostCompact" | "PermissionRequest" | "Setup" | "TeammateIdle" | "TaskCompleted" | "ConfigChange" | "WorktreeCreate" | "WorktreeRemove" | "Elicitation" | "ElicitationResult" | "InstructionsLoaded";
|
|
344
357
|
//#endregion
|
|
345
358
|
//#region src/hooks/input/types.d.ts
|
|
346
359
|
/**
|
|
@@ -474,6 +487,7 @@ type HookOutput = {
|
|
|
474
487
|
PostToolUseFailure: PostToolUseFailureHookOutput;
|
|
475
488
|
UserPromptSubmit: UserPromptSubmitHookOutput;
|
|
476
489
|
Stop: StopHookOutput;
|
|
490
|
+
StopFailure: CommonHookOutputs;
|
|
477
491
|
SubagentStart: SubagentStartHookOutput;
|
|
478
492
|
SubagentStop: SubagentStopHookOutput;
|
|
479
493
|
SessionStart: SessionStartHookOutput;
|
package/dist/index.mjs
CHANGED
|
@@ -206,6 +206,19 @@ const HookInputSchemas = {
|
|
|
206
206
|
last_assistant_message: v.exactOptional(v.string()),
|
|
207
207
|
stop_hook_active: v.boolean()
|
|
208
208
|
}),
|
|
209
|
+
StopFailure: buildHookInputSchema("StopFailure", {
|
|
210
|
+
error: v.picklist([
|
|
211
|
+
"authentication_failed",
|
|
212
|
+
"billing_error",
|
|
213
|
+
"rate_limit",
|
|
214
|
+
"invalid_request",
|
|
215
|
+
"server_error",
|
|
216
|
+
"unknown",
|
|
217
|
+
"max_output_tokens"
|
|
218
|
+
]),
|
|
219
|
+
error_details: v.exactOptional(v.string()),
|
|
220
|
+
last_assistant_message: v.exactOptional(v.string())
|
|
221
|
+
}),
|
|
209
222
|
SubagentStart: buildSubagentInputSchema("SubagentStart", {}),
|
|
210
223
|
SubagentStop: buildSubagentInputSchema("SubagentStop", {
|
|
211
224
|
agent_transcript_path: v.string(),
|
|
@@ -232,6 +245,7 @@ const HookInputSchemas = {
|
|
|
232
245
|
}),
|
|
233
246
|
SessionEnd: buildHookInputSchema("SessionEnd", { reason: v.picklist([
|
|
234
247
|
"clear",
|
|
248
|
+
"resume",
|
|
235
249
|
"logout",
|
|
236
250
|
"prompt_input_exit",
|
|
237
251
|
"other",
|
|
@@ -292,7 +306,8 @@ const HookInputSchemas = {
|
|
|
292
306
|
"session_start",
|
|
293
307
|
"nested_traversal",
|
|
294
308
|
"path_glob_match",
|
|
295
|
-
"include"
|
|
309
|
+
"include",
|
|
310
|
+
"compact"
|
|
296
311
|
]),
|
|
297
312
|
memory_type: v.picklist([
|
|
298
313
|
"User",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-hooks-ts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.79",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Write claude code hooks with type safety",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@arethetypeswrong/core": "0.18.2",
|
|
46
|
-
"@types/node": "25.
|
|
46
|
+
"@types/node": "25.5.0",
|
|
47
47
|
"@typescript/native-preview": "7.0.0-dev.20260311.1",
|
|
48
48
|
"@virtual-live-lab/eslint-config": "2.3.1",
|
|
49
49
|
"@virtual-live-lab/tsconfig": "2.1.21",
|
|
50
50
|
"eslint": "9.39.2",
|
|
51
51
|
"eslint-plugin-import-access": "3.1.0",
|
|
52
52
|
"oxfmt": "0.28.0",
|
|
53
|
-
"pkg-pr-new": "0.0.
|
|
53
|
+
"pkg-pr-new": "0.0.66",
|
|
54
54
|
"publint": "0.3.18",
|
|
55
55
|
"release-it": "19.2.4",
|
|
56
56
|
"release-it-pnpm": "4.6.6",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"typescript": "5.9.3",
|
|
60
60
|
"typescript-eslint": "8.57.0",
|
|
61
61
|
"unplugin-unused": "0.5.7",
|
|
62
|
-
"vitest": "4.0
|
|
62
|
+
"vitest": "4.1.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@anthropic-ai/claude-agent-sdk": "0.2.
|
|
65
|
+
"@anthropic-ai/claude-agent-sdk": "0.2.79",
|
|
66
66
|
"get-stdin": "10.0.0",
|
|
67
67
|
"valibot": "^1.1.0"
|
|
68
68
|
},
|