cc-hooks-ts 2.0.43 → 2.0.45
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 +33 -1
- package/dist/index.mjs +5 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -111,6 +111,16 @@ declare const HookInputSchemas: {
|
|
|
111
111
|
} & {
|
|
112
112
|
reason: v.StringSchema<undefined>;
|
|
113
113
|
}, undefined>;
|
|
114
|
+
readonly PermissionRequest: v.ObjectSchema<{
|
|
115
|
+
readonly cwd: v.StringSchema<undefined>;
|
|
116
|
+
readonly permission_mode: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
117
|
+
readonly session_id: v.StringSchema<undefined>;
|
|
118
|
+
readonly transcript_path: v.StringSchema<undefined>;
|
|
119
|
+
readonly hook_event_name: v.LiteralSchema<"PermissionRequest", undefined>;
|
|
120
|
+
} & {
|
|
121
|
+
tool_input: v.UnknownSchema;
|
|
122
|
+
tool_name: v.StringSchema<undefined>;
|
|
123
|
+
}, undefined>;
|
|
114
124
|
};
|
|
115
125
|
//#endregion
|
|
116
126
|
//#region src/hooks/event.d.ts
|
|
@@ -119,7 +129,7 @@ declare const HookInputSchemas: {
|
|
|
119
129
|
*
|
|
120
130
|
* @package
|
|
121
131
|
*/
|
|
122
|
-
type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "SubagentStop" | "PreCompact" | "
|
|
132
|
+
type SupportedHookEvent = "PreToolUse" | "PostToolUse" | "Notification" | "UserPromptSubmit" | "SessionStart" | "SessionEnd" | "Stop" | "SubagentStart" | "SubagentStop" | "PreCompact" | "PermissionRequest";
|
|
123
133
|
//#endregion
|
|
124
134
|
//#region src/hooks/input/types.d.ts
|
|
125
135
|
/**
|
|
@@ -206,6 +216,7 @@ type HookOutput = {
|
|
|
206
216
|
SubagentStart: SubagentStartHookOutput;
|
|
207
217
|
SubagentStop: SubagentStopHookOutput;
|
|
208
218
|
SessionStart: SessionStartHookOutput;
|
|
219
|
+
PermissionRequest: PermissionRequestHookOutput;
|
|
209
220
|
Notification: CommonHookOutputs;
|
|
210
221
|
PreCompact: CommonHookOutputs;
|
|
211
222
|
SessionEnd: CommonHookOutputs;
|
|
@@ -355,6 +366,27 @@ interface SessionStartHookOutput extends CommonHookOutputs {
|
|
|
355
366
|
additionalContext?: string;
|
|
356
367
|
};
|
|
357
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* @see {@link https://code.claude.com/docs/en/hooks#permissionrequest-decision-control}
|
|
371
|
+
*/
|
|
372
|
+
interface PermissionRequestHookOutput extends CommonHookOutputs {
|
|
373
|
+
hookSpecificOutput?: {
|
|
374
|
+
hookEventName: "PermissionRequest";
|
|
375
|
+
/**
|
|
376
|
+
* For `behavior: "allow"` you can also optionally pass in an `updatedInput` that modifies the tool’s input parameters before the tool executes.
|
|
377
|
+
*
|
|
378
|
+
* For `behavior: "deny"` you can also optionally pass in a `message` string that tells the model why the permission was denied, and a boolean `interrupt` which will stop Claude.
|
|
379
|
+
*/
|
|
380
|
+
decision: {
|
|
381
|
+
behavior: "allow";
|
|
382
|
+
updatedInput?: Record<string, unknown>;
|
|
383
|
+
} | {
|
|
384
|
+
behavior: "deny";
|
|
385
|
+
interrupt?: boolean;
|
|
386
|
+
message?: string;
|
|
387
|
+
};
|
|
388
|
+
};
|
|
389
|
+
}
|
|
358
390
|
//#endregion
|
|
359
391
|
//#region src/types.d.ts
|
|
360
392
|
type HookTrigger = Partial<{ [TEvent in SupportedHookEvent]: true | Partial<{ [SchemaKey in ExtractExtendedSpecificKeys<TEvent>]?: true }> }>;
|
package/dist/index.mjs
CHANGED
|
@@ -79,7 +79,11 @@ const HookInputSchemas = {
|
|
|
79
79
|
v.literal("clear"),
|
|
80
80
|
v.literal("compact")
|
|
81
81
|
]) }),
|
|
82
|
-
SessionEnd: buildHookInputSchema("SessionEnd", { reason: v.string() })
|
|
82
|
+
SessionEnd: buildHookInputSchema("SessionEnd", { reason: v.string() }),
|
|
83
|
+
PermissionRequest: buildHookInputSchema("PermissionRequest", {
|
|
84
|
+
tool_input: v.unknown(),
|
|
85
|
+
tool_name: v.string()
|
|
86
|
+
})
|
|
83
87
|
};
|
|
84
88
|
function isNonEmptyString(value) {
|
|
85
89
|
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.0.
|
|
3
|
+
"version": "2.0.45",
|
|
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.9"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@anthropic-ai/claude-agent-sdk": "0.1.
|
|
65
|
+
"@anthropic-ai/claude-agent-sdk": "0.1.45",
|
|
66
66
|
"valibot": "^1.1.0"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|