@pluginfinity/hooks 0.0.0-stage → 0.7.0

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/index.d.ts ADDED
@@ -0,0 +1,1526 @@
1
+ /**
2
+ * pluginfinity's hook contract and hook builder.
3
+ *
4
+ * @remarks
5
+ * The contract (each hook event's input and output schema, the built-in tool
6
+ * inputs, and the generators for their JSON Schema files and Zig types) is
7
+ * also served platform-free from `@pluginfinity/hooks/contract`.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ import { Context, Data, Effect, FileSystem, Option, Path, Result, Schema } from "effect";
12
+ import { ChildProcessSpawner } from "effect/process";
13
+ /**
14
+ * One event's input and output schemas.
15
+ *
16
+ * @public
17
+ */
18
+ interface HookIo {
19
+ readonly input: Schema.Codec<unknown, unknown>;
20
+ readonly output: Schema.Codec<unknown, unknown>;
21
+ }
22
+ /**
23
+ * The input and output schema of every Claude Code hook event: the JSON a hook
24
+ * receives and the JSON it may answer with.
25
+ *
26
+ * @public
27
+ */
28
+ export declare const HOOK_IO: {
29
+ readonly SessionStart: {
30
+ readonly input: Schema.Struct<{
31
+ readonly session_id: Schema.String;
32
+ readonly transcript_path: Schema.String;
33
+ readonly cwd: Schema.String;
34
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
35
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
36
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
37
+ readonly effort: Schema.optionalKey<Schema.Struct<{
38
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
39
+ }>>;
40
+ readonly agent_id: Schema.optionalKey<Schema.String>;
41
+ readonly agent_type: Schema.optionalKey<Schema.String>;
42
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
43
+ } & {
44
+ source: Schema.Literals<readonly ["startup", "resume", "clear", "compact", "fork"]>;
45
+ model: Schema.optionalKey<Schema.String>;
46
+ session_title: Schema.optionalKey<Schema.String>;
47
+ seconds_since_last_response: Schema.optionalKey<Schema.Finite>;
48
+ context_tokens: Schema.optionalKey<Schema.Finite>;
49
+ prompt_cache_likely_expired: Schema.optionalKey<Schema.Boolean>;
50
+ estimated_cache_write_usd: Schema.optionalKey<Schema.Finite>;
51
+ }>;
52
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
53
+ };
54
+ readonly Setup: {
55
+ readonly input: Schema.Struct<{
56
+ readonly session_id: Schema.String;
57
+ readonly transcript_path: Schema.String;
58
+ readonly cwd: Schema.String;
59
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
60
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
61
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
62
+ readonly effort: Schema.optionalKey<Schema.Struct<{
63
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
64
+ }>>;
65
+ readonly agent_id: Schema.optionalKey<Schema.String>;
66
+ readonly agent_type: Schema.optionalKey<Schema.String>;
67
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
68
+ } & {
69
+ trigger: Schema.Literals<readonly ["init", "maintenance"]>;
70
+ }>;
71
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
72
+ };
73
+ readonly UserPromptSubmit: {
74
+ readonly input: Schema.Struct<{
75
+ readonly session_id: Schema.String;
76
+ readonly transcript_path: Schema.String;
77
+ readonly cwd: Schema.String;
78
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
79
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
80
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
81
+ readonly effort: Schema.optionalKey<Schema.Struct<{
82
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
83
+ }>>;
84
+ readonly agent_id: Schema.optionalKey<Schema.String>;
85
+ readonly agent_type: Schema.optionalKey<Schema.String>;
86
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
87
+ } & {
88
+ prompt: Schema.String;
89
+ session_title: Schema.optionalKey<Schema.String>;
90
+ }>;
91
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
92
+ };
93
+ readonly UserPromptExpansion: {
94
+ readonly input: Schema.Struct<{
95
+ readonly session_id: Schema.String;
96
+ readonly transcript_path: Schema.String;
97
+ readonly cwd: Schema.String;
98
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
99
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
100
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
101
+ readonly effort: Schema.optionalKey<Schema.Struct<{
102
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
103
+ }>>;
104
+ readonly agent_id: Schema.optionalKey<Schema.String>;
105
+ readonly agent_type: Schema.optionalKey<Schema.String>;
106
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
107
+ } & {
108
+ expansion_type: Schema.Literals<readonly ["slash_command", "mcp_prompt"]>;
109
+ command_name: Schema.String;
110
+ command_args: Schema.String;
111
+ command_source: Schema.String;
112
+ prompt: Schema.String;
113
+ }>;
114
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
115
+ };
116
+ readonly PreSkillShellCommand: {
117
+ readonly input: Schema.Struct<{
118
+ readonly session_id: Schema.String;
119
+ readonly transcript_path: Schema.String;
120
+ readonly cwd: Schema.String;
121
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
122
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
123
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
124
+ readonly effort: Schema.optionalKey<Schema.Struct<{
125
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
126
+ }>>;
127
+ readonly agent_id: Schema.optionalKey<Schema.String>;
128
+ readonly agent_type: Schema.optionalKey<Schema.String>;
129
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
130
+ } & {
131
+ tool_name: Schema.Literals<readonly ["Bash", "PowerShell"]>;
132
+ tool_input: Schema.Struct<{
133
+ readonly command: Schema.String;
134
+ }>;
135
+ tool_use_id: Schema.String;
136
+ command_name: Schema.String;
137
+ command_source: Schema.String;
138
+ invoked_by: Schema.Literals<readonly ["user", "claude", "other"]>;
139
+ }>;
140
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
141
+ };
142
+ readonly PreToolUse: {
143
+ readonly input: Schema.Struct<{
144
+ readonly session_id: Schema.String;
145
+ readonly transcript_path: Schema.String;
146
+ readonly cwd: Schema.String;
147
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
148
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
149
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
150
+ readonly effort: Schema.optionalKey<Schema.Struct<{
151
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
152
+ }>>;
153
+ readonly agent_id: Schema.optionalKey<Schema.String>;
154
+ readonly agent_type: Schema.optionalKey<Schema.String>;
155
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
156
+ } & {
157
+ tool_name: Schema.String;
158
+ tool_input: Schema.$Record<Schema.String, Schema.Unknown>;
159
+ tool_use_id: Schema.String;
160
+ mcp_server: Schema.optionalKey<Schema.Struct<{
161
+ readonly name: Schema.String;
162
+ readonly source: Schema.String;
163
+ }>>;
164
+ }>;
165
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
166
+ };
167
+ readonly PermissionRequest: {
168
+ readonly input: Schema.Struct<{
169
+ readonly session_id: Schema.String;
170
+ readonly transcript_path: Schema.String;
171
+ readonly cwd: Schema.String;
172
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
173
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
174
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
175
+ readonly effort: Schema.optionalKey<Schema.Struct<{
176
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
177
+ }>>;
178
+ readonly agent_id: Schema.optionalKey<Schema.String>;
179
+ readonly agent_type: Schema.optionalKey<Schema.String>;
180
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
181
+ } & {
182
+ tool_name: Schema.String;
183
+ tool_input: Schema.$Record<Schema.String, Schema.Unknown>;
184
+ mcp_server: Schema.optionalKey<Schema.Struct<{
185
+ readonly name: Schema.String;
186
+ readonly source: Schema.String;
187
+ }>>;
188
+ permission_suggestions: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
189
+ readonly type: Schema.Literals<readonly ["addRules", "replaceRules", "removeRules"]>;
190
+ readonly rules: Schema.$Array<Schema.Struct<{
191
+ readonly toolName: Schema.String;
192
+ readonly ruleContent: Schema.optionalKey<Schema.String>;
193
+ }>>;
194
+ readonly behavior: Schema.Literals<readonly ["allow", "deny", "ask"]>;
195
+ readonly destination: Schema.Literals<readonly ["session", "localSettings", "projectSettings", "userSettings"]>;
196
+ }>, Schema.Struct<{
197
+ readonly type: Schema.Literal<"setMode">;
198
+ readonly mode: Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions", "manual"]>;
199
+ readonly destination: Schema.Literals<readonly ["session", "localSettings", "projectSettings", "userSettings"]>;
200
+ }>, Schema.Struct<{
201
+ readonly type: Schema.Literals<readonly ["addDirectories", "removeDirectories"]>;
202
+ readonly directories: Schema.$Array<Schema.String>;
203
+ readonly destination: Schema.Literals<readonly ["session", "localSettings", "projectSettings", "userSettings"]>;
204
+ }>]>>>;
205
+ }>;
206
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
207
+ };
208
+ readonly PermissionDenied: {
209
+ readonly input: Schema.Struct<{
210
+ readonly session_id: Schema.String;
211
+ readonly transcript_path: Schema.String;
212
+ readonly cwd: Schema.String;
213
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
214
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
215
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
216
+ readonly effort: Schema.optionalKey<Schema.Struct<{
217
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
218
+ }>>;
219
+ readonly agent_id: Schema.optionalKey<Schema.String>;
220
+ readonly agent_type: Schema.optionalKey<Schema.String>;
221
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
222
+ } & {
223
+ tool_name: Schema.String;
224
+ tool_input: Schema.$Record<Schema.String, Schema.Unknown>;
225
+ tool_use_id: Schema.String;
226
+ mcp_server: Schema.optionalKey<Schema.Struct<{
227
+ readonly name: Schema.String;
228
+ readonly source: Schema.String;
229
+ }>>;
230
+ reason: Schema.String;
231
+ }>;
232
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
233
+ };
234
+ readonly PostToolUse: {
235
+ readonly input: Schema.Struct<{
236
+ readonly session_id: Schema.String;
237
+ readonly transcript_path: Schema.String;
238
+ readonly cwd: Schema.String;
239
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
240
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
241
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
242
+ readonly effort: Schema.optionalKey<Schema.Struct<{
243
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
244
+ }>>;
245
+ readonly agent_id: Schema.optionalKey<Schema.String>;
246
+ readonly agent_type: Schema.optionalKey<Schema.String>;
247
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
248
+ } & {
249
+ tool_name: Schema.String;
250
+ tool_input: Schema.$Record<Schema.String, Schema.Unknown>;
251
+ tool_response: Schema.Codec<Schema.Json, Schema.Json, never, never>;
252
+ tool_use_id: Schema.String;
253
+ duration_ms: Schema.optionalKey<Schema.Finite>;
254
+ mcp_server: Schema.optionalKey<Schema.Struct<{
255
+ readonly name: Schema.String;
256
+ readonly source: Schema.String;
257
+ }>>;
258
+ }>;
259
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
260
+ };
261
+ readonly PostToolUseFailure: {
262
+ readonly input: Schema.Struct<{
263
+ readonly session_id: Schema.String;
264
+ readonly transcript_path: Schema.String;
265
+ readonly cwd: Schema.String;
266
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
267
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
268
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
269
+ readonly effort: Schema.optionalKey<Schema.Struct<{
270
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
271
+ }>>;
272
+ readonly agent_id: Schema.optionalKey<Schema.String>;
273
+ readonly agent_type: Schema.optionalKey<Schema.String>;
274
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
275
+ } & {
276
+ tool_name: Schema.String;
277
+ tool_input: Schema.$Record<Schema.String, Schema.Unknown>;
278
+ tool_use_id: Schema.String;
279
+ mcp_server: Schema.optionalKey<Schema.Struct<{
280
+ readonly name: Schema.String;
281
+ readonly source: Schema.String;
282
+ }>>;
283
+ error: Schema.String;
284
+ is_interrupt: Schema.optionalKey<Schema.Boolean>;
285
+ duration_ms: Schema.optionalKey<Schema.Finite>;
286
+ }>;
287
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
288
+ };
289
+ readonly PostToolBatch: {
290
+ readonly input: Schema.Struct<{
291
+ readonly session_id: Schema.String;
292
+ readonly transcript_path: Schema.String;
293
+ readonly cwd: Schema.String;
294
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
295
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
296
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
297
+ readonly effort: Schema.optionalKey<Schema.Struct<{
298
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
299
+ }>>;
300
+ readonly agent_id: Schema.optionalKey<Schema.String>;
301
+ readonly agent_type: Schema.optionalKey<Schema.String>;
302
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
303
+ } & {
304
+ tool_calls: Schema.$Array<Schema.Struct<{
305
+ readonly tool_name: Schema.String;
306
+ readonly tool_input: Schema.$Record<Schema.String, Schema.Unknown>;
307
+ readonly tool_use_id: Schema.String;
308
+ readonly tool_response: Schema.Codec<Schema.Json, Schema.Json, never, never>;
309
+ }>>;
310
+ }>;
311
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
312
+ };
313
+ readonly Notification: {
314
+ readonly input: Schema.Struct<{
315
+ readonly session_id: Schema.String;
316
+ readonly transcript_path: Schema.String;
317
+ readonly cwd: Schema.String;
318
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
319
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
320
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
321
+ readonly effort: Schema.optionalKey<Schema.Struct<{
322
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
323
+ }>>;
324
+ readonly agent_id: Schema.optionalKey<Schema.String>;
325
+ readonly agent_type: Schema.optionalKey<Schema.String>;
326
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
327
+ } & {
328
+ message: Schema.String;
329
+ title: Schema.optionalKey<Schema.String>;
330
+ notification_type: Schema.String;
331
+ }>;
332
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
333
+ };
334
+ readonly MessageDisplay: {
335
+ readonly input: Schema.Struct<{
336
+ readonly session_id: Schema.String;
337
+ readonly transcript_path: Schema.String;
338
+ readonly cwd: Schema.String;
339
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
340
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
341
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
342
+ readonly effort: Schema.optionalKey<Schema.Struct<{
343
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
344
+ }>>;
345
+ readonly agent_id: Schema.optionalKey<Schema.String>;
346
+ readonly agent_type: Schema.optionalKey<Schema.String>;
347
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
348
+ } & {
349
+ turn_id: Schema.String;
350
+ message_id: Schema.String;
351
+ index: Schema.Finite;
352
+ final: Schema.Boolean;
353
+ delta: Schema.String;
354
+ }>;
355
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
356
+ };
357
+ readonly SubagentStart: {
358
+ readonly input: Schema.Struct<{
359
+ readonly session_id: Schema.String;
360
+ readonly transcript_path: Schema.String;
361
+ readonly cwd: Schema.String;
362
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
363
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
364
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
365
+ readonly effort: Schema.optionalKey<Schema.Struct<{
366
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
367
+ }>>;
368
+ readonly agent_id: Schema.optionalKey<Schema.String>;
369
+ readonly agent_type: Schema.optionalKey<Schema.String>;
370
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
371
+ } & {
372
+ agent_id: Schema.String;
373
+ agent_type: Schema.String;
374
+ }>;
375
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
376
+ };
377
+ readonly SubagentStop: {
378
+ readonly input: Schema.Struct<{
379
+ readonly session_id: Schema.String;
380
+ readonly transcript_path: Schema.String;
381
+ readonly cwd: Schema.String;
382
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
383
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
384
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
385
+ readonly effort: Schema.optionalKey<Schema.Struct<{
386
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
387
+ }>>;
388
+ readonly agent_id: Schema.optionalKey<Schema.String>;
389
+ readonly agent_type: Schema.optionalKey<Schema.String>;
390
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
391
+ } & {
392
+ stop_hook_active: Schema.Boolean;
393
+ last_assistant_message: Schema.optionalKey<Schema.String>;
394
+ background_tasks: Schema.optionalKey<Schema.$Array<Schema.Struct<{
395
+ readonly id: Schema.String;
396
+ readonly type: Schema.String;
397
+ readonly status: Schema.String;
398
+ readonly description: Schema.optionalKey<Schema.String>;
399
+ readonly command: Schema.optionalKey<Schema.String>;
400
+ readonly agent_type: Schema.optionalKey<Schema.String>;
401
+ readonly server: Schema.optionalKey<Schema.String>;
402
+ readonly tool: Schema.optionalKey<Schema.String>;
403
+ readonly name: Schema.optionalKey<Schema.String>;
404
+ }>>>;
405
+ session_crons: Schema.optionalKey<Schema.$Array<Schema.Struct<{
406
+ readonly id: Schema.String;
407
+ readonly schedule: Schema.String;
408
+ readonly recurring: Schema.Boolean;
409
+ readonly prompt: Schema.String;
410
+ }>>>;
411
+ agent_id: Schema.String;
412
+ agent_type: Schema.String;
413
+ agent_transcript_path: Schema.String;
414
+ }>;
415
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
416
+ };
417
+ readonly TaskCreated: {
418
+ readonly input: Schema.Struct<{
419
+ readonly session_id: Schema.String;
420
+ readonly transcript_path: Schema.String;
421
+ readonly cwd: Schema.String;
422
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
423
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
424
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
425
+ readonly effort: Schema.optionalKey<Schema.Struct<{
426
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
427
+ }>>;
428
+ readonly agent_id: Schema.optionalKey<Schema.String>;
429
+ readonly agent_type: Schema.optionalKey<Schema.String>;
430
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
431
+ } & {
432
+ task_id: Schema.String;
433
+ task_subject: Schema.String;
434
+ task_description: Schema.optionalKey<Schema.String>;
435
+ teammate_name: Schema.optionalKey<Schema.String>;
436
+ team_name: Schema.optionalKey<Schema.String>;
437
+ }>;
438
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
439
+ };
440
+ readonly TaskCompleted: {
441
+ readonly input: Schema.Struct<{
442
+ readonly session_id: Schema.String;
443
+ readonly transcript_path: Schema.String;
444
+ readonly cwd: Schema.String;
445
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
446
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
447
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
448
+ readonly effort: Schema.optionalKey<Schema.Struct<{
449
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
450
+ }>>;
451
+ readonly agent_id: Schema.optionalKey<Schema.String>;
452
+ readonly agent_type: Schema.optionalKey<Schema.String>;
453
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
454
+ } & {
455
+ task_id: Schema.String;
456
+ task_subject: Schema.String;
457
+ task_description: Schema.optionalKey<Schema.String>;
458
+ teammate_name: Schema.optionalKey<Schema.String>;
459
+ team_name: Schema.optionalKey<Schema.String>;
460
+ }>;
461
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
462
+ };
463
+ readonly Stop: {
464
+ readonly input: Schema.Struct<{
465
+ readonly session_id: Schema.String;
466
+ readonly transcript_path: Schema.String;
467
+ readonly cwd: Schema.String;
468
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
469
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
470
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
471
+ readonly effort: Schema.optionalKey<Schema.Struct<{
472
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
473
+ }>>;
474
+ readonly agent_id: Schema.optionalKey<Schema.String>;
475
+ readonly agent_type: Schema.optionalKey<Schema.String>;
476
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
477
+ } & {
478
+ stop_hook_active: Schema.Boolean;
479
+ last_assistant_message: Schema.optionalKey<Schema.String>;
480
+ background_tasks: Schema.optionalKey<Schema.$Array<Schema.Struct<{
481
+ readonly id: Schema.String;
482
+ readonly type: Schema.String;
483
+ readonly status: Schema.String;
484
+ readonly description: Schema.optionalKey<Schema.String>;
485
+ readonly command: Schema.optionalKey<Schema.String>;
486
+ readonly agent_type: Schema.optionalKey<Schema.String>;
487
+ readonly server: Schema.optionalKey<Schema.String>;
488
+ readonly tool: Schema.optionalKey<Schema.String>;
489
+ readonly name: Schema.optionalKey<Schema.String>;
490
+ }>>>;
491
+ session_crons: Schema.optionalKey<Schema.$Array<Schema.Struct<{
492
+ readonly id: Schema.String;
493
+ readonly schedule: Schema.String;
494
+ readonly recurring: Schema.Boolean;
495
+ readonly prompt: Schema.String;
496
+ }>>>;
497
+ }>;
498
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
499
+ };
500
+ readonly StopFailure: {
501
+ readonly input: Schema.Struct<{
502
+ readonly session_id: Schema.String;
503
+ readonly transcript_path: Schema.String;
504
+ readonly cwd: Schema.String;
505
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
506
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
507
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
508
+ readonly effort: Schema.optionalKey<Schema.Struct<{
509
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
510
+ }>>;
511
+ readonly agent_id: Schema.optionalKey<Schema.String>;
512
+ readonly agent_type: Schema.optionalKey<Schema.String>;
513
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
514
+ } & {
515
+ error: Schema.String;
516
+ error_details: Schema.optionalKey<Schema.String>;
517
+ last_assistant_message: Schema.optionalKey<Schema.String>;
518
+ }>;
519
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
520
+ };
521
+ readonly TeammateIdle: {
522
+ readonly input: Schema.Struct<{
523
+ readonly session_id: Schema.String;
524
+ readonly transcript_path: Schema.String;
525
+ readonly cwd: Schema.String;
526
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
527
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
528
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
529
+ readonly effort: Schema.optionalKey<Schema.Struct<{
530
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
531
+ }>>;
532
+ readonly agent_id: Schema.optionalKey<Schema.String>;
533
+ readonly agent_type: Schema.optionalKey<Schema.String>;
534
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
535
+ } & {
536
+ teammate_name: Schema.String;
537
+ team_name: Schema.optionalKey<Schema.String>;
538
+ }>;
539
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
540
+ };
541
+ readonly InstructionsLoaded: {
542
+ readonly input: Schema.Struct<{
543
+ readonly session_id: Schema.String;
544
+ readonly transcript_path: Schema.String;
545
+ readonly cwd: Schema.String;
546
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
547
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
548
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
549
+ readonly effort: Schema.optionalKey<Schema.Struct<{
550
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
551
+ }>>;
552
+ readonly agent_id: Schema.optionalKey<Schema.String>;
553
+ readonly agent_type: Schema.optionalKey<Schema.String>;
554
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
555
+ } & {
556
+ file_path: Schema.String;
557
+ memory_type: Schema.Literals<readonly ["User", "Project", "Local", "Managed"]>;
558
+ load_reason: Schema.Literals<readonly ["session_start", "nested_traversal", "path_glob_match", "include", "compact"]>;
559
+ globs: Schema.optionalKey<Schema.$Array<Schema.String>>;
560
+ trigger_file_path: Schema.optionalKey<Schema.String>;
561
+ parent_file_path: Schema.optionalKey<Schema.String>;
562
+ }>;
563
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
564
+ };
565
+ readonly ConfigChange: {
566
+ readonly input: Schema.Struct<{
567
+ readonly session_id: Schema.String;
568
+ readonly transcript_path: Schema.String;
569
+ readonly cwd: Schema.String;
570
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
571
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
572
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
573
+ readonly effort: Schema.optionalKey<Schema.Struct<{
574
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
575
+ }>>;
576
+ readonly agent_id: Schema.optionalKey<Schema.String>;
577
+ readonly agent_type: Schema.optionalKey<Schema.String>;
578
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
579
+ } & {
580
+ source: Schema.Literals<readonly ["user_settings", "project_settings", "local_settings", "policy_settings", "skills"]>;
581
+ file_path: Schema.optionalKey<Schema.String>;
582
+ }>;
583
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
584
+ };
585
+ readonly CwdChanged: {
586
+ readonly input: Schema.Struct<{
587
+ readonly session_id: Schema.String;
588
+ readonly transcript_path: Schema.String;
589
+ readonly cwd: Schema.String;
590
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
591
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
592
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
593
+ readonly effort: Schema.optionalKey<Schema.Struct<{
594
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
595
+ }>>;
596
+ readonly agent_id: Schema.optionalKey<Schema.String>;
597
+ readonly agent_type: Schema.optionalKey<Schema.String>;
598
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
599
+ } & {
600
+ old_cwd: Schema.String;
601
+ new_cwd: Schema.String;
602
+ }>;
603
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
604
+ };
605
+ readonly DirectoryAdded: {
606
+ readonly input: Schema.Struct<{
607
+ readonly session_id: Schema.String;
608
+ readonly transcript_path: Schema.String;
609
+ readonly cwd: Schema.String;
610
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
611
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
612
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
613
+ readonly effort: Schema.optionalKey<Schema.Struct<{
614
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
615
+ }>>;
616
+ readonly agent_id: Schema.optionalKey<Schema.String>;
617
+ readonly agent_type: Schema.optionalKey<Schema.String>;
618
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
619
+ } & {
620
+ directory: Schema.String;
621
+ source: Schema.Literals<readonly ["slash_command", "register_repo_root"]>;
622
+ }>;
623
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
624
+ };
625
+ readonly FileChanged: {
626
+ readonly input: Schema.Struct<{
627
+ readonly session_id: Schema.String;
628
+ readonly transcript_path: Schema.String;
629
+ readonly cwd: Schema.String;
630
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
631
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
632
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
633
+ readonly effort: Schema.optionalKey<Schema.Struct<{
634
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
635
+ }>>;
636
+ readonly agent_id: Schema.optionalKey<Schema.String>;
637
+ readonly agent_type: Schema.optionalKey<Schema.String>;
638
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
639
+ } & {
640
+ file_path: Schema.String;
641
+ event: Schema.Literals<readonly ["change", "add", "unlink"]>;
642
+ }>;
643
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
644
+ };
645
+ readonly WorktreeCreate: {
646
+ readonly input: Schema.Struct<{
647
+ readonly session_id: Schema.String;
648
+ readonly transcript_path: Schema.String;
649
+ readonly cwd: Schema.String;
650
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
651
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
652
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
653
+ readonly effort: Schema.optionalKey<Schema.Struct<{
654
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
655
+ }>>;
656
+ readonly agent_id: Schema.optionalKey<Schema.String>;
657
+ readonly agent_type: Schema.optionalKey<Schema.String>;
658
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
659
+ } & {
660
+ name: Schema.String;
661
+ }>;
662
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
663
+ };
664
+ readonly WorktreeRemove: {
665
+ readonly input: Schema.Struct<{
666
+ readonly session_id: Schema.String;
667
+ readonly transcript_path: Schema.String;
668
+ readonly cwd: Schema.String;
669
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
670
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
671
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
672
+ readonly effort: Schema.optionalKey<Schema.Struct<{
673
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
674
+ }>>;
675
+ readonly agent_id: Schema.optionalKey<Schema.String>;
676
+ readonly agent_type: Schema.optionalKey<Schema.String>;
677
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
678
+ } & {
679
+ worktree_path: Schema.String;
680
+ }>;
681
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
682
+ };
683
+ readonly PreCompact: {
684
+ readonly input: Schema.Struct<{
685
+ readonly session_id: Schema.String;
686
+ readonly transcript_path: Schema.String;
687
+ readonly cwd: Schema.String;
688
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
689
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
690
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
691
+ readonly effort: Schema.optionalKey<Schema.Struct<{
692
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
693
+ }>>;
694
+ readonly agent_id: Schema.optionalKey<Schema.String>;
695
+ readonly agent_type: Schema.optionalKey<Schema.String>;
696
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
697
+ } & {
698
+ trigger: Schema.Literals<readonly ["manual", "auto"]>;
699
+ custom_instructions: Schema.NullOr<Schema.String>;
700
+ }>;
701
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
702
+ };
703
+ readonly PostCompact: {
704
+ readonly input: Schema.Struct<{
705
+ readonly session_id: Schema.String;
706
+ readonly transcript_path: Schema.String;
707
+ readonly cwd: Schema.String;
708
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
709
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
710
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
711
+ readonly effort: Schema.optionalKey<Schema.Struct<{
712
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
713
+ }>>;
714
+ readonly agent_id: Schema.optionalKey<Schema.String>;
715
+ readonly agent_type: Schema.optionalKey<Schema.String>;
716
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
717
+ } & {
718
+ trigger: Schema.Literals<readonly ["manual", "auto"]>;
719
+ compact_summary: Schema.String;
720
+ }>;
721
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
722
+ };
723
+ readonly PreModelSwitch: {
724
+ readonly input: Schema.Struct<{
725
+ readonly session_id: Schema.String;
726
+ readonly transcript_path: Schema.String;
727
+ readonly cwd: Schema.String;
728
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
729
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
730
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
731
+ readonly effort: Schema.optionalKey<Schema.Struct<{
732
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
733
+ }>>;
734
+ readonly agent_id: Schema.optionalKey<Schema.String>;
735
+ readonly agent_type: Schema.optionalKey<Schema.String>;
736
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
737
+ } & {
738
+ from_model: Schema.String;
739
+ to_model: Schema.String;
740
+ requested_model: Schema.NullOr<Schema.String>;
741
+ source: Schema.Literals<readonly ["command", "picker", "sdk"]>;
742
+ context_tokens: Schema.Finite;
743
+ prompt_cache_warm: Schema.Boolean;
744
+ cache_ttl: Schema.Literals<readonly ["5m", "1h"]>;
745
+ estimated_cache_write_usd: Schema.Finite;
746
+ pricing: Schema.Literals<readonly ["configured", "catalog", "default"]>;
747
+ }>;
748
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
749
+ };
750
+ readonly PostModelSwitch: {
751
+ readonly input: Schema.Struct<{
752
+ readonly session_id: Schema.String;
753
+ readonly transcript_path: Schema.String;
754
+ readonly cwd: Schema.String;
755
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
756
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
757
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
758
+ readonly effort: Schema.optionalKey<Schema.Struct<{
759
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
760
+ }>>;
761
+ readonly agent_id: Schema.optionalKey<Schema.String>;
762
+ readonly agent_type: Schema.optionalKey<Schema.String>;
763
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
764
+ } & {
765
+ from_model: Schema.String;
766
+ to_model: Schema.String;
767
+ requested_model: Schema.NullOr<Schema.String>;
768
+ source: Schema.Literals<readonly ["command", "picker", "sdk", "auto", "resume"]>;
769
+ context_tokens: Schema.Finite;
770
+ prompt_cache_warm: Schema.Boolean;
771
+ cache_ttl: Schema.Literals<readonly ["5m", "1h"]>;
772
+ estimated_cache_write_usd: Schema.Finite;
773
+ pricing: Schema.Literals<readonly ["configured", "catalog", "default"]>;
774
+ }>;
775
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
776
+ };
777
+ readonly Elicitation: {
778
+ readonly input: Schema.Struct<{
779
+ readonly session_id: Schema.String;
780
+ readonly transcript_path: Schema.String;
781
+ readonly cwd: Schema.String;
782
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
783
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
784
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
785
+ readonly effort: Schema.optionalKey<Schema.Struct<{
786
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
787
+ }>>;
788
+ readonly agent_id: Schema.optionalKey<Schema.String>;
789
+ readonly agent_type: Schema.optionalKey<Schema.String>;
790
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
791
+ } & {
792
+ mcp_server_name: Schema.String;
793
+ message: Schema.String;
794
+ mode: Schema.optionalKey<Schema.Literals<readonly ["form", "url"]>>;
795
+ url: Schema.optionalKey<Schema.String>;
796
+ elicitation_id: Schema.optionalKey<Schema.String>;
797
+ requested_schema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>;
798
+ }>;
799
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
800
+ };
801
+ readonly ElicitationResult: {
802
+ readonly input: Schema.Struct<{
803
+ readonly session_id: Schema.String;
804
+ readonly transcript_path: Schema.String;
805
+ readonly cwd: Schema.String;
806
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
807
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
808
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
809
+ readonly effort: Schema.optionalKey<Schema.Struct<{
810
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
811
+ }>>;
812
+ readonly agent_id: Schema.optionalKey<Schema.String>;
813
+ readonly agent_type: Schema.optionalKey<Schema.String>;
814
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
815
+ } & {
816
+ mcp_server_name: Schema.String;
817
+ action: Schema.Literals<readonly ["accept", "decline", "cancel"]>;
818
+ mode: Schema.optionalKey<Schema.Literals<readonly ["form", "url"]>>;
819
+ elicitation_id: Schema.optionalKey<Schema.String>;
820
+ content: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>;
821
+ }>;
822
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
823
+ };
824
+ readonly SessionEnd: {
825
+ readonly input: Schema.Struct<{
826
+ readonly session_id: Schema.String;
827
+ readonly transcript_path: Schema.String;
828
+ readonly cwd: Schema.String;
829
+ readonly prompt_id: Schema.optionalKey<Schema.String>;
830
+ readonly scratchpad_dir: Schema.optionalKey<Schema.String>;
831
+ readonly permission_mode: Schema.optionalKey<Schema.Literals<readonly ["default", "plan", "acceptEdits", "auto", "dontAsk", "bypassPermissions"]>>;
832
+ readonly effort: Schema.optionalKey<Schema.Struct<{
833
+ readonly level: Schema.Literals<readonly ["low", "medium", "high", "xhigh", "max"]>;
834
+ }>>;
835
+ readonly agent_id: Schema.optionalKey<Schema.String>;
836
+ readonly agent_type: Schema.optionalKey<Schema.String>;
837
+ readonly hook_event_name: Schema.Literal<"ConfigChange" | "CwdChanged" | "DirectoryAdded" | "Elicitation" | "ElicitationResult" | "FileChanged" | "InstructionsLoaded" | "MessageDisplay" | "Notification" | "PermissionDenied" | "PermissionRequest" | "PostCompact" | "PostModelSwitch" | "PostToolBatch" | "PostToolUse" | "PostToolUseFailure" | "PreCompact" | "PreModelSwitch" | "PreSkillShellCommand" | "PreToolUse" | "SessionEnd" | "SessionStart" | "Setup" | "Stop" | "StopFailure" | "SubagentStart" | "SubagentStop" | "TaskCompleted" | "TaskCreated" | "TeammateIdle" | "UserPromptExpansion" | "UserPromptSubmit" | "WorktreeCreate" | "WorktreeRemove">;
838
+ } & {
839
+ reason: Schema.String;
840
+ }>;
841
+ readonly output: Schema.Codec<unknown, unknown, never, never>;
842
+ };
843
+ };
844
+ /**
845
+ * Every Claude Code hook event, the vocabulary a plugin's `hooks` config is
846
+ * written in. Each target maps these to its own names.
847
+ *
848
+ * @public
849
+ */
850
+ export declare const CLAUDE_HOOK_EVENTS: readonly ["SessionStart", "Setup", "UserPromptSubmit", "UserPromptExpansion", "PreSkillShellCommand", "PreToolUse", "PermissionRequest", "PermissionDenied", "PostToolUse", "PostToolUseFailure", "PostToolBatch", "Notification", "MessageDisplay", "SubagentStart", "SubagentStop", "TaskCreated", "TaskCompleted", "Stop", "StopFailure", "TeammateIdle", "InstructionsLoaded", "ConfigChange", "CwdChanged", "DirectoryAdded", "FileChanged", "WorktreeCreate", "WorktreeRemove", "PreCompact", "PostCompact", "PreModelSwitch", "PostModelSwitch", "Elicitation", "ElicitationResult", "SessionEnd"];
851
+ /**
852
+ * A Claude Code hook event name.
853
+ *
854
+ * @public
855
+ */
856
+ export declare const ClaudeHookEvent: Schema.Literals<readonly ["SessionStart", "Setup", "UserPromptSubmit", "UserPromptExpansion", "PreSkillShellCommand", "PreToolUse", "PermissionRequest", "PermissionDenied", "PostToolUse", "PostToolUseFailure", "PostToolBatch", "Notification", "MessageDisplay", "SubagentStart", "SubagentStop", "TaskCreated", "TaskCompleted", "Stop", "StopFailure", "TeammateIdle", "InstructionsLoaded", "ConfigChange", "CwdChanged", "DirectoryAdded", "FileChanged", "WorktreeCreate", "WorktreeRemove", "PreCompact", "PostCompact", "PreModelSwitch", "PostModelSwitch", "Elicitation", "ElicitationResult", "SessionEnd"]>;
857
+ /**
858
+ * The decoded `ClaudeHookEvent`.
859
+ *
860
+ * @public
861
+ */
862
+ export type ClaudeHookEvent = typeof ClaudeHookEvent.Type;
863
+ /**
864
+ * The documented `tool_input` shape of each built-in tool, by tool name.
865
+ *
866
+ * @public
867
+ */
868
+ export declare const TOOL_INPUTS: {
869
+ readonly Bash: Schema.Struct<{
870
+ command: Schema.String;
871
+ description: Schema.optionalKey<Schema.String>;
872
+ timeout: Schema.optionalKey<Schema.Finite>;
873
+ run_in_background: Schema.optionalKey<Schema.Boolean>;
874
+ }>;
875
+ readonly PowerShell: Schema.Struct<{
876
+ command: Schema.String;
877
+ description: Schema.optionalKey<Schema.String>;
878
+ timeout: Schema.optionalKey<Schema.Finite>;
879
+ run_in_background: Schema.optionalKey<Schema.Boolean>;
880
+ }>;
881
+ readonly Write: Schema.Struct<{
882
+ file_path: Schema.String;
883
+ content: Schema.String;
884
+ }>;
885
+ readonly Edit: Schema.Struct<{
886
+ file_path: Schema.String;
887
+ old_string: Schema.String;
888
+ new_string: Schema.String;
889
+ replace_all: Schema.optionalKey<Schema.Boolean>;
890
+ }>;
891
+ readonly Read: Schema.Struct<{
892
+ file_path: Schema.String;
893
+ offset: Schema.optionalKey<Schema.Finite>;
894
+ limit: Schema.optionalKey<Schema.Finite>;
895
+ }>;
896
+ readonly Glob: Schema.Struct<{
897
+ pattern: Schema.String;
898
+ path: Schema.optionalKey<Schema.String>;
899
+ }>;
900
+ readonly Grep: Schema.Struct<{
901
+ pattern: Schema.String;
902
+ path: Schema.optionalKey<Schema.String>;
903
+ glob: Schema.optionalKey<Schema.String>;
904
+ output_mode: Schema.optionalKey<Schema.Literals<readonly ["content", "files_with_matches", "count"]>>;
905
+ "-i": Schema.optionalKey<Schema.Boolean>;
906
+ multiline: Schema.optionalKey<Schema.Boolean>;
907
+ }>;
908
+ readonly WebFetch: Schema.Struct<{
909
+ url: Schema.String;
910
+ prompt: Schema.String;
911
+ offset: Schema.optionalKey<Schema.Finite>;
912
+ }>;
913
+ readonly WebSearch: Schema.Struct<{
914
+ query: Schema.String;
915
+ allowed_domains: Schema.optionalKey<Schema.$Array<Schema.String>>;
916
+ blocked_domains: Schema.optionalKey<Schema.$Array<Schema.String>>;
917
+ mode: Schema.optionalKey<Schema.Literals<readonly ["standard", "extended"]>>;
918
+ }>;
919
+ readonly Agent: Schema.Struct<{
920
+ prompt: Schema.String;
921
+ description: Schema.optionalKey<Schema.String>;
922
+ subagent_type: Schema.optionalKey<Schema.String>;
923
+ model: Schema.optionalKey<Schema.String>;
924
+ }>;
925
+ readonly AskUserQuestion: Schema.Struct<{
926
+ questions: Schema.$Array<Schema.Struct<{
927
+ readonly question: Schema.String;
928
+ readonly header: Schema.String;
929
+ readonly options: Schema.$Array<Schema.Struct<{
930
+ readonly label: Schema.String;
931
+ readonly description: Schema.optionalKey<Schema.String>;
932
+ }>>;
933
+ readonly multiSelect: Schema.optionalKey<Schema.Boolean>;
934
+ }>>;
935
+ answers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>;
936
+ }>;
937
+ readonly ExitPlanMode: Schema.Struct<{
938
+ plan: Schema.optionalKey<Schema.String>;
939
+ planFilePath: Schema.optionalKey<Schema.String>;
940
+ allowedPrompts: Schema.optionalKey<Schema.$Array<Schema.Unknown>>;
941
+ }>;
942
+ };
943
+ /**
944
+ * The Zig source of `zig/src/events.zig`: a struct for each Claude Code hook
945
+ * event's input and, under `tools`, for each built-in tool's `tool_input`. The
946
+ * text is what `zig fmt` would write, so a regeneration that changes nothing
947
+ * writes the same bytes.
948
+ *
949
+ * @public
950
+ */
951
+ export declare const hookEventsZig: () => string;
952
+ /**
953
+ * A host pluginfinity builds hooks for.
954
+ *
955
+ * @public
956
+ */
957
+ type HookHost = "claude" | "copilot";
958
+ /**
959
+ * What a hook answers, in host-neutral terms. Each host's wire format is
960
+ * written from it by `encodeDecision`.
961
+ *
962
+ * @public
963
+ */
964
+ type Decision = Data.TaggedEnum<{
965
+ /** Change nothing. */
966
+ Noop: {};
967
+ /** Allow the action, with an optional reason and, on PreToolUse, a replacement tool input. */
968
+ Allow: {
969
+ readonly reason?: string;
970
+ readonly updatedInput?: Readonly<Record<string, unknown>>;
971
+ };
972
+ /** Refuse the action. */
973
+ Deny: {
974
+ readonly reason?: string;
975
+ };
976
+ /** Ask the user. */
977
+ Ask: {
978
+ readonly reason?: string;
979
+ };
980
+ /** Block the event's action (on Stop: keep working). */
981
+ Block: {
982
+ readonly reason?: string;
983
+ };
984
+ /** Add text to the model's context. */
985
+ Context: {
986
+ readonly text: string;
987
+ };
988
+ /** Show the user a message. */
989
+ SystemMessage: {
990
+ readonly text: string;
991
+ };
992
+ /** Wake the agent from a background hook (an `asyncRewake` entry only). */
993
+ Rewake: {
994
+ readonly message: string;
995
+ };
996
+ /** Send a host-specific JSON response verbatim, only on that host. */
997
+ Raw: {
998
+ readonly host: HookHost;
999
+ readonly json: Readonly<Record<string, unknown>>;
1000
+ };
1001
+ }>;
1002
+ /**
1003
+ * The constructors for each `Decision`.
1004
+ *
1005
+ * @public
1006
+ */
1007
+ export declare const makeDecision: Data.TaggedEnum.Constructor<{
1008
+ readonly _tag: "Allow";
1009
+ readonly reason?: string;
1010
+ readonly updatedInput?: Readonly<Record<string, unknown>>;
1011
+ } | {
1012
+ readonly _tag: "Ask";
1013
+ readonly reason?: string;
1014
+ } | {
1015
+ readonly _tag: "Block";
1016
+ readonly reason?: string;
1017
+ } | {
1018
+ readonly _tag: "Context";
1019
+ readonly text: string;
1020
+ } | {
1021
+ readonly _tag: "Deny";
1022
+ readonly reason?: string;
1023
+ } | {
1024
+ readonly _tag: "Noop";
1025
+ } | {
1026
+ readonly _tag: "Raw";
1027
+ readonly host: HookHost;
1028
+ readonly json: Readonly<Record<string, unknown>>;
1029
+ } | {
1030
+ readonly _tag: "Rewake";
1031
+ readonly message: string;
1032
+ } | {
1033
+ readonly _tag: "SystemMessage";
1034
+ readonly text: string;
1035
+ }>;
1036
+ /**
1037
+ * A `Decision` tag.
1038
+ *
1039
+ * @public
1040
+ */
1041
+ type DecisionTag = Decision["_tag"];
1042
+ /**
1043
+ * The events on which each host honours each answer, the one source `supports`,
1044
+ * `ALLOWED_DECISIONS` and `AllowedTag` read. It mirrors the bash library's
1045
+ * `hook_supports` and `okf/references/*-plugin-format.md`.
1046
+ *
1047
+ * @remarks
1048
+ * `Allow`, `Ask` and `Deny` are honoured on `PreToolUse` by both hosts and, on
1049
+ * Claude Code only, on `permission` events (and `Deny` also on `denyOnly`).
1050
+ * `SystemMessage` is honoured on Claude Code on every event but
1051
+ * `noSystemMessage`, and never on Copilot. `Noop`, `Raw` and `Rewake` work everywhere.
1052
+ *
1053
+ * @public
1054
+ */
1055
+ export declare const ANSWER_EVENTS: {
1056
+ readonly permission: readonly ["PreToolUse", "PreModelSwitch"];
1057
+ readonly denyOnly: readonly ["PreSkillShellCommand"];
1058
+ readonly noSystemMessage: readonly ["Setup", "InstructionsLoaded", "MessageDisplay", "Notification", "StopFailure", "ConfigChange", "DirectoryAdded", "WorktreeCreate", "WorktreeRemove", "PreCompact", "PostCompact", "SessionEnd", "Elicitation", "ElicitationResult"];
1059
+ readonly context: {
1060
+ readonly claude: readonly ["SessionStart", "SubagentStart", "PostModelSwitch", "UserPromptSubmit", "UserPromptExpansion", "PreToolUse", "PostToolUse", "PostToolUseFailure", "PostToolBatch", "Stop", "SubagentStop"];
1061
+ readonly copilot: readonly ["SessionStart", "SubagentStart", "PostToolUse", "Notification"];
1062
+ };
1063
+ readonly block: {
1064
+ readonly claude: readonly ["UserPromptSubmit", "UserPromptExpansion", "PreSkillShellCommand", "PostToolUse", "PostToolBatch", "Stop", "SubagentStop", "ConfigChange", "PreCompact", "TaskCreated", "TaskCompleted", "TeammateIdle", "PreModelSwitch", "Elicitation", "ElicitationResult"];
1065
+ readonly copilot: readonly ["Stop", "SubagentStop"];
1066
+ };
1067
+ };
1068
+ /**
1069
+ * Whether `host` honours a decision on `event`. It mirrors the bash library's
1070
+ * `hook_supports` (and `okf/references/*-plugin-format.md`).
1071
+ *
1072
+ * @public
1073
+ */
1074
+ export declare const supports: (host: HookHost, tag: DecisionTag, event: string) => boolean;
1075
+ /**
1076
+ * Every `Decision` tag.
1077
+ *
1078
+ * @public
1079
+ */
1080
+ export declare const DECISION_TAGS: ReadonlyArray<DecisionTag>;
1081
+ /**
1082
+ * The decisions a hook may give on each event: those either host honours
1083
+ * there, plus `Noop`, `Raw` and `Rewake`, which every event takes.
1084
+ *
1085
+ * @public
1086
+ */
1087
+ export declare const ALLOWED_DECISIONS: Readonly<Record<ClaudeHookEvent, ReadonlyArray<DecisionTag>>>;
1088
+ /**
1089
+ * The decision tags event `E` takes, as a type: the same set `ALLOWED_DECISIONS`
1090
+ * holds, read from {@link ANSWER_EVENTS}.
1091
+ *
1092
+ * @public
1093
+ */
1094
+ type AllowedTag<E extends ClaudeHookEvent> = "Noop" | "Raw" | "Rewake" | (E extends (typeof ANSWER_EVENTS)["permission"][number] ? "Allow" | "Ask" : never) | (E extends (typeof ANSWER_EVENTS)["permission"][number] | (typeof ANSWER_EVENTS)["denyOnly"][number] ? "Deny" : never) | (E extends (typeof ANSWER_EVENTS)["context"]["claude"][number] | (typeof ANSWER_EVENTS)["context"]["copilot"][number] ? "Context" : never) | (E extends (typeof ANSWER_EVENTS)["block"]["claude"][number] | (typeof ANSWER_EVENTS)["block"]["copilot"][number] ? "Block" : never) | (E extends (typeof ANSWER_EVENTS)["noSystemMessage"][number] ? never : "SystemMessage");
1095
+ /**
1096
+ * The decisions event `E` takes.
1097
+ *
1098
+ * @public
1099
+ */
1100
+ type EventDecision<E extends ClaudeHookEvent> = Extract<Decision, {
1101
+ readonly _tag: AllowedTag<E>;
1102
+ }>;
1103
+ /**
1104
+ * Claude Code's matcher rules: empty or `*` matches everything; a matcher of
1105
+ * only `[A-Za-z0-9_| ,-]` is an exact list split on `|` or `,`, spaces around an
1106
+ * item ignored; anything else is an unanchored regular expression. A pattern
1107
+ * that does not compile matches, so a hook never skips over it.
1108
+ *
1109
+ * @public
1110
+ */
1111
+ export declare const matcherApplies: (matcher: string, value: string) => boolean;
1112
+ /**
1113
+ * The version of `lib/pluginfinity/facts.json` this release writes and reads.
1114
+ * The build writes it as `schema`; a module hook bundled against another
1115
+ * release is refused at build time, so the number is a check, not a migration.
1116
+ *
1117
+ * @public
1118
+ */
1119
+ export declare const FACTS_SCHEMA_VERSION = 1;
1120
+ /**
1121
+ * What `lib/pluginfinity/facts.json` holds: what a program hook reads where a
1122
+ * script sources `tools.sh`, `host.sh` and `env.sh`. Every field is optional,
1123
+ * and a key this release does not know is ignored.
1124
+ *
1125
+ * @public
1126
+ */
1127
+ export declare const Facts: Schema.Struct<{
1128
+ readonly schema: Schema.optionalKey<Schema.Number>;
1129
+ readonly host: Schema.optionalKey<Schema.String>;
1130
+ readonly plugin: Schema.optionalKey<Schema.String>;
1131
+ readonly tools: Schema.optionalKey<Schema.Struct<{
1132
+ /** Claude Code tool name to the host's run-time name. */
1133
+ readonly names: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
1134
+ /** The plugin's name on Claude Code, which own MCP tools are written under. */
1135
+ readonly plugin: Schema.optionalKey<Schema.String>;
1136
+ /** The host's own MCP tool name, with `{plugin}`, `{server}` and `{tool}`. */
1137
+ readonly mcp: Schema.optionalKey<Schema.String>;
1138
+ readonly servers: Schema.optionalKey<Schema.$Array<Schema.String>>;
1139
+ /** `keep` a name the table does not list, or treat it as having no name here. */
1140
+ readonly unlisted: Schema.optionalKey<Schema.String>;
1141
+ }>>;
1142
+ readonly has: Schema.optionalKey<Schema.Struct<{
1143
+ readonly skills: Schema.optionalKey<Schema.$Array<Schema.String>>;
1144
+ readonly agents: Schema.optionalKey<Schema.$Array<Schema.String>>;
1145
+ readonly monitors: Schema.optionalKey<Schema.$Array<Schema.String>>;
1146
+ readonly servers: Schema.optionalKey<Schema.$Array<Schema.String>>;
1147
+ }>>;
1148
+ readonly env: Schema.optionalKey<Schema.Struct<{
1149
+ /** Declared session variable to its default. */
1150
+ readonly vars: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
1151
+ }>>;
1152
+ }>;
1153
+ /**
1154
+ * The decoded `Facts`.
1155
+ *
1156
+ * @public
1157
+ */
1158
+ export type Facts = typeof Facts.Type;
1159
+ /**
1160
+ * Read the text of a `facts.json`, or `undefined` when it is not one.
1161
+ *
1162
+ * @public
1163
+ */
1164
+ export declare const decodeFacts: (text: string) => Facts | undefined;
1165
+ /**
1166
+ * A component kind `has` answers for.
1167
+ *
1168
+ * @public
1169
+ */
1170
+ type ComponentKind = "skill" | "agent" | "monitor" | "server";
1171
+ /**
1172
+ * The host's run-time name for a Claude Code tool, or none when the host has
1173
+ * none. An own MCP tool is written `mcp__plugin_<plugin>_<server>__<tool>`, as
1174
+ * Claude Code names it. It mirrors `hook_tool_name` and the Zig `toolName`.
1175
+ *
1176
+ * @public
1177
+ */
1178
+ export declare const factsToolName: (facts: Facts, name: string) => Option.Option<string>;
1179
+ /**
1180
+ * The run-time prefix of one of the plugin's own MCP servers, or none for a
1181
+ * server the plugin does not declare.
1182
+ *
1183
+ * @public
1184
+ */
1185
+ export declare const factsToolPrefix: (facts: Facts, server: string) => Option.Option<string>;
1186
+ /**
1187
+ * Whether the build ships a component on this host.
1188
+ *
1189
+ * @public
1190
+ */
1191
+ export declare const factsHas: (facts: Facts, kind: ComponentKind, name: string) => boolean;
1192
+ /**
1193
+ * What `encodeDecision` needs to know about the call it answers.
1194
+ *
1195
+ * @public
1196
+ */
1197
+ interface WireContext {
1198
+ readonly host: HookHost;
1199
+ /** The Claude event name. */
1200
+ readonly event: string;
1201
+ /** The plugin's name on this host, used in default reasons. */
1202
+ readonly plugin?: string;
1203
+ /** Whether the entry sets `asyncRewake`, the one case a hook may exit 2. */
1204
+ readonly asyncRewake?: boolean;
1205
+ }
1206
+ /**
1207
+ * A decision as the host reads it: the stdout to print, the stderr, the exit
1208
+ * code, and a line for the debug or error log when the decision lost something.
1209
+ *
1210
+ * @public
1211
+ */
1212
+ interface Encoded {
1213
+ readonly stdout: string;
1214
+ readonly stderr: string;
1215
+ readonly exitCode: 0 | 2;
1216
+ readonly debug?: string;
1217
+ readonly log?: string;
1218
+ }
1219
+ /**
1220
+ * Write a decision in the host's wire format, the same bytes the bash hook
1221
+ * library prints for the matching helper. A decision the host does not honour
1222
+ * on the event answers `{}` with a debug line.
1223
+ *
1224
+ * @public
1225
+ */
1226
+ export declare const encodeDecision: (context: WireContext, decision: Decision) => Encoded;
1227
+ /**
1228
+ * The answer of an entry that fails closed when its hook failed before
1229
+ * answering: a deny where the event takes one, else a block, else nothing.
1230
+ * As in the bash library, a Stop or SubagentStop hook sends nothing while
1231
+ * `stop_hook_active` is true (a block would loop), and TaskCompleted and
1232
+ * TeammateIdle send nothing (a block sends a teammate back to a hook that will
1233
+ * not run).
1234
+ *
1235
+ * @public
1236
+ */
1237
+ export declare const closedResponse: (context: WireContext, input: unknown, code: number) => Encoded | undefined;
1238
+ /**
1239
+ * A generated JSON Schema file: its name and its text.
1240
+ *
1241
+ * @public
1242
+ */
1243
+ export interface HookSchemaFile {
1244
+ readonly name: string;
1245
+ readonly content: string;
1246
+ }
1247
+ /**
1248
+ * The JSON Schema documents for every Claude Code hook event, one for its
1249
+ * input and one for its output, and one for each built-in tool's
1250
+ * `tool_input`. The text is deterministic, so a regeneration that changes
1251
+ * nothing writes the same bytes.
1252
+ *
1253
+ * @public
1254
+ */
1255
+ export declare const hookSchemaFiles: () => ReadonlyArray<HookSchemaFile>;
1256
+ /**
1257
+ * What a hook knows about the call it answers, and the helpers the bash and
1258
+ * Zig libraries give a hook, over the same files and variables.
1259
+ *
1260
+ * @public
1261
+ */
1262
+ interface HookContextShape {
1263
+ /** The Claude event name. */
1264
+ readonly event: string;
1265
+ readonly host: HookHost;
1266
+ /** The plugin's name on this host. */
1267
+ readonly plugin: string;
1268
+ /** The built plugin's root, from `PLUGINFINITY_ROOT`. */
1269
+ readonly pluginRoot: string | undefined;
1270
+ /** The input's `cwd` walked up to `.git`, else the host's project, else the working directory. */
1271
+ readonly projectDir: Effect.Effect<string>;
1272
+ /** The session's project: `CLAUDE_PROJECT_DIR` on Claude when set, else `projectDir`. */
1273
+ readonly sessionDir: Effect.Effect<string>;
1274
+ /** The host's run-time name for a Claude Code tool, or none when the host has none. */
1275
+ readonly toolName: (name: string) => Option.Option<string>;
1276
+ /** The run-time prefix of one of the plugin's own MCP servers. */
1277
+ readonly toolPrefix: (server: string) => Option.Option<string>;
1278
+ /** Whether this host's build ships a component. */
1279
+ readonly has: (kind: ComponentKind, name: string) => boolean;
1280
+ /** Whether the host honours a decision on this event. */
1281
+ readonly supports: (tag: DecisionTag) => boolean;
1282
+ /** The declared session variables, resolved. Empty when the build declares none. */
1283
+ readonly env: Effect.Effect<ReadonlyMap<string, string>>;
1284
+ /** Set a declared session variable (producer events only); a refusal is logged and never fails. */
1285
+ readonly envSet: (name: string, value: string) => Effect.Effect<void>;
1286
+ /** Append a line to the plugin's `error.log`. */
1287
+ readonly log: (message: string) => Effect.Effect<void>;
1288
+ /** Append a line to `debug.log` when `PLUGINFINITY_DEBUG=1`. */
1289
+ readonly debug: (message: string) => Effect.Effect<void>;
1290
+ /** From here on, a failure denies or blocks instead of failing open. */
1291
+ readonly failClosed: Effect.Effect<void>;
1292
+ /** Whether the entry or the hook asked to fail closed. */
1293
+ readonly failsClosed: Effect.Effect<boolean>;
1294
+ }
1295
+ /**
1296
+ * What `HookContext.make` is built from.
1297
+ *
1298
+ * @public
1299
+ */
1300
+ interface HookContextOptions {
1301
+ readonly host: HookHost;
1302
+ readonly event: string;
1303
+ /** The input in Claude Code's shape. */
1304
+ readonly input: Record<string, unknown>;
1305
+ readonly env: Readonly<Record<string, string | undefined>>;
1306
+ /** The process's working directory. */
1307
+ readonly cwd: string;
1308
+ /** The hook file's name, as log lines show it. */
1309
+ readonly script: string;
1310
+ /** The built plugin's root; defaults to `PLUGINFINITY_ROOT`. */
1311
+ readonly pluginRoot?: string;
1312
+ readonly now?: () => Date;
1313
+ }
1314
+ declare const HookContext_base: Context.ServiceClass<HookContext, "@pluginfinity/hooks/HookContext", HookContextShape>;
1315
+ /**
1316
+ * The hook context service a module hook's handler reads. The runner provides
1317
+ * it; `HookContext.make` builds one from the process's facts.
1318
+ *
1319
+ * @public
1320
+ */
1321
+ export declare class HookContext extends HookContext_base {
1322
+ /** Build a hook context from the process's facts, environment and input. */
1323
+ static readonly make: (options: HookContextOptions) => Effect.Effect<HookContextShape, never, FileSystem.FileSystem | Path.Path>;
1324
+ }
1325
+ /**
1326
+ * The services a handler may require: the hook context and the Node platform's
1327
+ * filesystem, path and child processes. The runner provides all of them.
1328
+ *
1329
+ * @public
1330
+ */
1331
+ type HookServices = HookContext | FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner;
1332
+ /**
1333
+ * The decoded input of event `E`, in Claude Code's shape on every host.
1334
+ *
1335
+ * @public
1336
+ */
1337
+ type EventInput<E extends ClaudeHookEvent> = (typeof HOOK_IO)[E]["input"]["Type"];
1338
+ /**
1339
+ * The `tool_input` of one tool: a built-in tool's documented shape, or a plain
1340
+ * record for an MCP or other tool.
1341
+ *
1342
+ * @public
1343
+ */
1344
+ type ToolInput<T extends string> = T extends keyof typeof TOOL_INPUTS ? (typeof TOOL_INPUTS)[T]["Type"] : Readonly<Record<string, unknown>>;
1345
+ /**
1346
+ * Event `E`'s input with `tool_input` typed for tools `T`.
1347
+ *
1348
+ * @public
1349
+ */
1350
+ type ToolEventInput<E extends ClaudeHookEvent, T extends string> = EventInput<E> extends {
1351
+ readonly tool_input: unknown;
1352
+ } ? Omit<EventInput<E>, "tool_input"> & {
1353
+ readonly tool_input: ToolInput<T>;
1354
+ } : EventInput<E>;
1355
+ /**
1356
+ * What a handler may return: a decision, a `Result` of one, or an `Effect` of
1357
+ * one. Any failure, typed or not, falls to the entry's fail policy.
1358
+ *
1359
+ * @public
1360
+ */
1361
+ type HandlerResult<E extends ClaudeHookEvent> = EventDecision<E> | Result.Result<EventDecision<E>, unknown> | Effect.Effect<EventDecision<E>, unknown, HookServices>;
1362
+ /**
1363
+ * The brand a module hook carries.
1364
+ *
1365
+ * @public
1366
+ */
1367
+ export declare const HookModuleTypeId: "~@pluginfinity/hooks/HookModule";
1368
+ /**
1369
+ * A module hook: the default export of a hook file, the build's unit of a `module` entry.
1370
+ *
1371
+ * @public
1372
+ */
1373
+ interface HookModule<E extends ClaudeHookEvent = ClaudeHookEvent> {
1374
+ readonly [HookModuleTypeId]: typeof HookModuleTypeId;
1375
+ readonly event: E;
1376
+ /** The tools the handler's `tool_input` is typed and decoded for, when it names any. */
1377
+ readonly tools: ReadonlyArray<string> | undefined;
1378
+ readonly handler: (input: never) => HandlerResult<E>;
1379
+ }
1380
+ /**
1381
+ * Whether a value is a module hook.
1382
+ *
1383
+ * @public
1384
+ */
1385
+ export declare const isHookModule: (u: unknown) => u is HookModule;
1386
+ /**
1387
+ * The builder for one event's module hook.
1388
+ *
1389
+ * @public
1390
+ */
1391
+ interface EventBuilder<E extends ClaudeHookEvent> {
1392
+ make(handler: (input: EventInput<E>) => HandlerResult<E>): HookModule<E>;
1393
+ make<const T extends string | ReadonlyArray<string>>(options: {
1394
+ readonly tool: T;
1395
+ }, handler: (input: ToolEventInput<E, T extends ReadonlyArray<infer U extends string> ? U : T & string>) => HandlerResult<E>): HookModule<E>;
1396
+ }
1397
+ /**
1398
+ * The decision constructors a handler returns from, as `Hook` carries them.
1399
+ *
1400
+ * @public
1401
+ */
1402
+ interface HookDecisions {
1403
+ /** Change nothing. */
1404
+ readonly noop: () => Extract<Decision, {
1405
+ readonly _tag: "Noop";
1406
+ }>;
1407
+ /** Allow the action; on PreToolUse, optionally with a replacement tool input. */
1408
+ readonly allow: (reason?: string, options?: {
1409
+ readonly updatedInput?: Readonly<Record<string, unknown>>;
1410
+ }) => Extract<Decision, {
1411
+ readonly _tag: "Allow";
1412
+ }>;
1413
+ /** Refuse the action. */
1414
+ readonly deny: (reason?: string) => Extract<Decision, {
1415
+ readonly _tag: "Deny";
1416
+ }>;
1417
+ /** Ask the user. */
1418
+ readonly ask: (reason?: string) => Extract<Decision, {
1419
+ readonly _tag: "Ask";
1420
+ }>;
1421
+ /** Block the event's action (on Stop: keep working). */
1422
+ readonly block: (reason?: string) => Extract<Decision, {
1423
+ readonly _tag: "Block";
1424
+ }>;
1425
+ /** Add text to the model's context. */
1426
+ readonly context: (text: string) => Extract<Decision, {
1427
+ readonly _tag: "Context";
1428
+ }>;
1429
+ /** Show the user a message. */
1430
+ readonly systemMessage: (text: string) => Extract<Decision, {
1431
+ readonly _tag: "SystemMessage";
1432
+ }>;
1433
+ /** Wake the agent from a background hook (an `asyncRewake` entry only). */
1434
+ readonly rewake: (message: string) => Extract<Decision, {
1435
+ readonly _tag: "Rewake";
1436
+ }>;
1437
+ /** Send a host-specific JSON response verbatim, only on that host. */
1438
+ readonly raw: (host: "claude" | "copilot", json: Readonly<Record<string, unknown>>) => Extract<Decision, {
1439
+ readonly _tag: "Raw";
1440
+ }>;
1441
+ }
1442
+ /**
1443
+ * The module hook builders, one per Claude Code event, and the decision
1444
+ * constructors a handler returns.
1445
+ *
1446
+ * @example
1447
+ * ```ts
1448
+ * import { Hook } from "@pluginfinity/hooks";
1449
+ *
1450
+ * export default Hook.PreToolUse.make({ tool: "Bash" }, (event) =>
1451
+ * event.tool_input.command.includes("rm -rf /") ? Hook.deny("not here") : Hook.allow(),
1452
+ * );
1453
+ * ```
1454
+ *
1455
+ * @public
1456
+ */
1457
+ export declare const Hook: { readonly [E in ClaudeHookEvent]: EventBuilder<E>; } & HookDecisions;
1458
+ /**
1459
+ * A module hook, or a loader for one: the bundle's entry hands over a loader so
1460
+ * a module whose top level throws still fails by the entry's policy.
1461
+ *
1462
+ * @public
1463
+ */
1464
+ type HookModuleSource = HookModule | (() => Promise<unknown>);
1465
+ /**
1466
+ * What the runner reads from its process.
1467
+ *
1468
+ * @public
1469
+ */
1470
+ interface RunIo {
1471
+ readonly argv: ReadonlyArray<string>;
1472
+ readonly env: Readonly<Record<string, string | undefined>>;
1473
+ /** The whole of stdin; read only when the hook runs. */
1474
+ readonly stdin: Effect.Effect<string>;
1475
+ readonly cwd: string;
1476
+ /** The hook file's name, as log lines show it. */
1477
+ readonly script: string;
1478
+ }
1479
+ /**
1480
+ * What the runner answers: what to print, and the exit code.
1481
+ *
1482
+ * @public
1483
+ */
1484
+ interface RunResult {
1485
+ readonly stdout: string;
1486
+ readonly stderr: string;
1487
+ readonly exitCode: number;
1488
+ }
1489
+ /**
1490
+ * The flag the build runs a bundle with to read its event and tools.
1491
+ *
1492
+ * @public
1493
+ */
1494
+ export declare const DESCRIBE_FLAG = "--pluginfinity-describe";
1495
+ /**
1496
+ * The whole life of a module hook: read the input, apply a run-time matcher,
1497
+ * decode the input, run the handler with the services provided, and answer in
1498
+ * the host's wire format. Every failure is logged and fails open, unless the
1499
+ * entry or the hook asked to fail closed.
1500
+ *
1501
+ * @public
1502
+ */
1503
+ export declare const runHook: (source: HookModuleSource, io: RunIo) => Effect.Effect<RunResult, never, FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner>;
1504
+ /**
1505
+ * Run a module hook as this process: what a bundled hook's entry calls. It
1506
+ * prints the answer and sets the exit code; nothing it meets makes it exit
1507
+ * non-zero except a rewake (2) and a failed `--pluginfinity-describe` (1).
1508
+ *
1509
+ * @remarks
1510
+ * The host reads stdout as one JSON answer, so from its first line `main`
1511
+ * diverts every other write to stdout (the module's top-level code, a timer
1512
+ * that fires after the handler) to stderr, and writes the answer through the
1513
+ * stream's own writer.
1514
+ *
1515
+ * @public
1516
+ */
1517
+ export declare const main: (source: HookModuleSource) => void;
1518
+ /**
1519
+ * This package's version. A build-time literal: the build replaces
1520
+ * `process.env.__PACKAGE_VERSION__`, and unbuilt source reads `0.0.0`.
1521
+ *
1522
+ * @public
1523
+ */
1524
+ export declare const HOOKS_VERSION: string;
1525
+ export type { AllowedTag, ComponentKind, Decision, DecisionTag, Encoded, EventBuilder, EventDecision, EventInput, HandlerResult, HookContextOptions, HookContextShape, HookDecisions, HookHost, HookIo, HookModule, HookModuleSource, HookServices, RunIo, RunResult, ToolEventInput, ToolInput, WireContext };
1526
+ //# sourceMappingURL=index.d.ts.map