cc-hooks-ts 2.1.19 → 2.1.34
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 +32 -6
- package/dist/index.mjs +13 -1
- package/package.json +11 -11
package/dist/index.d.mts
CHANGED
|
@@ -94,6 +94,7 @@ declare const HookInputSchemas: {
|
|
|
94
94
|
} & {
|
|
95
95
|
agent_id: v.StringSchema<undefined>;
|
|
96
96
|
agent_transcript_path: v.StringSchema<undefined>;
|
|
97
|
+
agent_type: v.StringSchema<undefined>;
|
|
97
98
|
stop_hook_active: v.BooleanSchema<undefined>;
|
|
98
99
|
}, undefined>;
|
|
99
100
|
readonly PreCompact: v.ObjectSchema<{
|
|
@@ -182,6 +183,29 @@ declare const HookInputSchemas: {
|
|
|
182
183
|
} & {
|
|
183
184
|
trigger: v.PicklistSchema<["init", "maintenance"], undefined>;
|
|
184
185
|
}, undefined>;
|
|
186
|
+
readonly TeammateIdle: v.ObjectSchema<{
|
|
187
|
+
readonly cwd: v.StringSchema<undefined>;
|
|
188
|
+
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
189
|
+
readonly session_id: v.StringSchema<undefined>;
|
|
190
|
+
readonly transcript_path: v.StringSchema<undefined>;
|
|
191
|
+
readonly hook_event_name: v.LiteralSchema<"TeammateIdle", undefined>;
|
|
192
|
+
} & {
|
|
193
|
+
team_name: v.StringSchema<undefined>;
|
|
194
|
+
teammate_name: v.StringSchema<undefined>;
|
|
195
|
+
}, undefined>;
|
|
196
|
+
readonly TaskCompleted: v.ObjectSchema<{
|
|
197
|
+
readonly cwd: v.StringSchema<undefined>;
|
|
198
|
+
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
199
|
+
readonly session_id: v.StringSchema<undefined>;
|
|
200
|
+
readonly transcript_path: v.StringSchema<undefined>;
|
|
201
|
+
readonly hook_event_name: v.LiteralSchema<"TaskCompleted", undefined>;
|
|
202
|
+
} & {
|
|
203
|
+
task_description: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
204
|
+
task_id: v.StringSchema<undefined>;
|
|
205
|
+
task_subject: v.StringSchema<undefined>;
|
|
206
|
+
team_name: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
207
|
+
teammate_name: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
208
|
+
}, undefined>;
|
|
185
209
|
};
|
|
186
210
|
//#endregion
|
|
187
211
|
//#region src/hooks/event.d.ts
|
|
@@ -190,7 +214,7 @@ declare const HookInputSchemas: {
|
|
|
190
214
|
*
|
|
191
215
|
* @package
|
|
192
216
|
*/
|
|
193
|
-
type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PermissionRequest" | "Setup";
|
|
217
|
+
type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "PostToolUseFailure" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PermissionRequest" | "Setup" | "TeammateIdle" | "TaskCompleted";
|
|
194
218
|
//#endregion
|
|
195
219
|
//#region src/hooks/input/types.d.ts
|
|
196
220
|
/**
|
|
@@ -230,7 +254,7 @@ type HookInput = { [EventKey in SupportedHookEvent]: EventKey extends "PreToolUs
|
|
|
230
254
|
* ```
|
|
231
255
|
* @package
|
|
232
256
|
*/
|
|
233
|
-
type ExtractAllHookInputsForEvent<TEvent
|
|
257
|
+
type ExtractAllHookInputsForEvent<TEvent extends SupportedHookEvent> = { [K in keyof HookInput[TEvent]]: HookInput[TEvent][K] }[keyof HookInput[TEvent]];
|
|
234
258
|
/**
|
|
235
259
|
* Extracts the hook input type for a specific tool within a given event type.
|
|
236
260
|
* This type utility is used to get strongly-typed inputs for tool-specific hook handlers.
|
|
@@ -251,11 +275,11 @@ type ExtractAllHookInputsForEvent<TEvent$1 extends SupportedHookEvent> = { [K in
|
|
|
251
275
|
* ```
|
|
252
276
|
* @package
|
|
253
277
|
*/
|
|
254
|
-
type ExtractSpecificHookInputForEvent<TEvent
|
|
278
|
+
type ExtractSpecificHookInputForEvent<TEvent extends SupportedHookEvent, TSpecificKey extends ExtractExtendedSpecificKeys<TEvent>> = TSpecificKey extends keyof HookInput[TEvent] ? HookInput[TEvent][TSpecificKey] : never;
|
|
255
279
|
/**
|
|
256
280
|
* @package
|
|
257
281
|
*/
|
|
258
|
-
type ExtractExtendedSpecificKeys<TEvent
|
|
282
|
+
type ExtractExtendedSpecificKeys<TEvent extends SupportedHookEvent> = Exclude<keyof HookInput[TEvent], "default">;
|
|
259
283
|
type BaseHookInputs = { [EventKey in SupportedHookEvent]: v.InferOutput<(typeof HookInputSchemas)[EventKey]> };
|
|
260
284
|
type ToolSpecificPreToolUseInput = { [K in keyof ToolSchema]: Omit<BaseHookInputs["PreToolUse"], "tool_input" | "tool_name"> & {
|
|
261
285
|
tool_input: ToolSchema[K]["input"];
|
|
@@ -332,15 +356,17 @@ type HookOutput = {
|
|
|
332
356
|
Notification: NotificationHookOutput;
|
|
333
357
|
PreCompact: CommonHookOutputs;
|
|
334
358
|
SessionEnd: CommonHookOutputs;
|
|
359
|
+
TaskCompleted: CommonHookOutputs;
|
|
360
|
+
TeammateIdle: CommonHookOutputs;
|
|
335
361
|
};
|
|
336
362
|
/**
|
|
337
363
|
* @package
|
|
338
364
|
*/
|
|
339
|
-
type ExtractSyncHookOutput<TEvent
|
|
365
|
+
type ExtractSyncHookOutput<TEvent extends SupportedHookEvent> = HookOutput extends Record<SupportedHookEvent, unknown> ? HookOutput[TEvent] : never;
|
|
340
366
|
/**
|
|
341
367
|
* @package
|
|
342
368
|
*/
|
|
343
|
-
type ExtractAsyncHookOutput<TEvent
|
|
369
|
+
type ExtractAsyncHookOutput<TEvent extends SupportedHookEvent> = _InternalExtractAsyncHookOutput<ExtractSyncHookOutput<TEvent>>;
|
|
344
370
|
/**
|
|
345
371
|
* Compute ExtractSyncHookOutput<TEvent> only once for better performance.
|
|
346
372
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -137,6 +137,7 @@ const HookInputSchemas = {
|
|
|
137
137
|
SubagentStop: buildHookInputSchema("SubagentStop", {
|
|
138
138
|
agent_id: v.string(),
|
|
139
139
|
agent_transcript_path: v.string(),
|
|
140
|
+
agent_type: v.string(),
|
|
140
141
|
stop_hook_active: v.boolean()
|
|
141
142
|
}),
|
|
142
143
|
PreCompact: buildHookInputSchema("PreCompact", {
|
|
@@ -165,7 +166,18 @@ const HookInputSchemas = {
|
|
|
165
166
|
tool_input: v.unknown(),
|
|
166
167
|
tool_name: v.string()
|
|
167
168
|
}),
|
|
168
|
-
Setup: buildHookInputSchema("Setup", { trigger: v.picklist(["init", "maintenance"]) })
|
|
169
|
+
Setup: buildHookInputSchema("Setup", { trigger: v.picklist(["init", "maintenance"]) }),
|
|
170
|
+
TeammateIdle: buildHookInputSchema("TeammateIdle", {
|
|
171
|
+
team_name: v.string(),
|
|
172
|
+
teammate_name: v.string()
|
|
173
|
+
}),
|
|
174
|
+
TaskCompleted: buildHookInputSchema("TaskCompleted", {
|
|
175
|
+
task_description: v.exactOptional(v.string()),
|
|
176
|
+
task_id: v.string(),
|
|
177
|
+
task_subject: v.string(),
|
|
178
|
+
team_name: v.exactOptional(v.string()),
|
|
179
|
+
teammate_name: v.exactOptional(v.string())
|
|
180
|
+
})
|
|
169
181
|
};
|
|
170
182
|
function isNonEmptyString(value) {
|
|
171
183
|
return typeof value === "string" && value.length > 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-hooks-ts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Write claude code hooks with type safety",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -43,26 +43,26 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@arethetypeswrong/core": "0.18.2",
|
|
46
|
-
"@types/node": "25.0
|
|
46
|
+
"@types/node": "25.2.0",
|
|
47
47
|
"@typescript/native-preview": "^7.0.0-dev.20251108.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
|
-
"oxfmt": "0.
|
|
53
|
-
"pkg-pr-new": "0.0.
|
|
54
|
-
"publint": "0.3.
|
|
52
|
+
"oxfmt": "0.28.0",
|
|
53
|
+
"pkg-pr-new": "0.0.63",
|
|
54
|
+
"publint": "0.3.17",
|
|
55
55
|
"release-it": "19.2.4",
|
|
56
56
|
"release-it-pnpm": "4.6.6",
|
|
57
|
-
"tsdown": "0.
|
|
58
|
-
"type-fest": "5.4.
|
|
57
|
+
"tsdown": "0.20.1",
|
|
58
|
+
"type-fest": "5.4.3",
|
|
59
59
|
"typescript": "5.9.3",
|
|
60
|
-
"typescript-eslint": "8.
|
|
61
|
-
"unplugin-unused": "0.5.
|
|
62
|
-
"vitest": "4.0.
|
|
60
|
+
"typescript-eslint": "8.54.0",
|
|
61
|
+
"unplugin-unused": "0.5.7",
|
|
62
|
+
"vitest": "4.0.18"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@anthropic-ai/claude-agent-sdk": "0.2.
|
|
65
|
+
"@anthropic-ai/claude-agent-sdk": "0.2.34",
|
|
66
66
|
"valibot": "^1.1.0"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|