@pluginfinity/core 0.3.3 → 0.4.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 CHANGED
@@ -15,13 +15,13 @@ import { Schema } from "effect";
15
15
  *
16
16
  * @public
17
17
  */
18
- export declare const CLAUDE_HOOK_EVENTS: readonly ["SessionStart", "Setup", "UserPromptSubmit", "UserPromptExpansion", "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"];
18
+ 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"];
19
19
  /**
20
20
  * A Claude Code hook event name.
21
21
  *
22
22
  * @public
23
23
  */
24
- export declare const ClaudeHookEvent: Schema.Literals<readonly ["SessionStart", "Setup", "UserPromptSubmit", "UserPromptExpansion", "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"]>;
24
+ 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"]>;
25
25
  /**
26
26
  * The decoded `ClaudeHookEvent`.
27
27
  *
@@ -53,6 +53,10 @@ export declare const ScriptHook: Schema.Struct<{
53
53
  readonly timeout: Schema.optionalKey<Schema.Int>;
54
54
  readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
55
55
  readonly failClosed: Schema.optionalKey<Schema.Boolean>;
56
+ readonly if: Schema.optionalKey<Schema.String>;
57
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
58
+ readonly async: Schema.optionalKey<Schema.Boolean>;
59
+ readonly asyncRewake: Schema.optionalKey<Schema.Boolean>;
56
60
  readonly script: Schema.String;
57
61
  readonly args: Schema.optionalKey<Schema.$Array<Schema.String>>;
58
62
  }>;
@@ -66,11 +70,113 @@ export declare const CommandHook: Schema.Struct<{
66
70
  readonly timeout: Schema.optionalKey<Schema.Int>;
67
71
  readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
68
72
  readonly failClosed: Schema.optionalKey<Schema.Boolean>;
73
+ readonly if: Schema.optionalKey<Schema.String>;
74
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
75
+ readonly async: Schema.optionalKey<Schema.Boolean>;
76
+ readonly asyncRewake: Schema.optionalKey<Schema.Boolean>;
69
77
  readonly command: Schema.String;
78
+ /** The shell the command runs in, on a host that lets a hook choose. Defaults to the host's own. */
79
+ readonly shell: Schema.optionalKey<Schema.Literals<readonly ["bash", "powershell"]>>;
80
+ }>;
81
+ /**
82
+ * A hook that runs a prebuilt native program, one file per platform. `binary`
83
+ * is the path the files share: the build ships every `<binary>-<os>-<arch>`
84
+ * the plugin holds, named as `uname -s` and `uname -m` print there (such as
85
+ * `hooks/bin/guard-Darwin-arm64` and `hooks/bin/guard-Linux-x86_64`), and
86
+ * writes each host a command that runs the one for the machine.
87
+ *
88
+ * @public
89
+ */
90
+ export declare const BinaryHook: Schema.Struct<{
91
+ readonly matcher: Schema.optionalKey<Schema.String>;
92
+ readonly timeout: Schema.optionalKey<Schema.Int>;
93
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
94
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
95
+ readonly if: Schema.optionalKey<Schema.String>;
96
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
97
+ readonly async: Schema.optionalKey<Schema.Boolean>;
98
+ readonly asyncRewake: Schema.optionalKey<Schema.Boolean>;
99
+ readonly binary: Schema.String;
100
+ readonly args: Schema.optionalKey<Schema.$Array<Schema.String>>;
70
101
  }>;
71
102
  /**
72
- * One hook: exactly one of `script` or `command`. Decode strictly, or a mixed
73
- * entry decodes as whichever member matches first.
103
+ * A hook that sends the event's JSON to a URL as an HTTP POST and reads the
104
+ * response body as the hook's answer.
105
+ *
106
+ * @public
107
+ */
108
+ export declare const HttpHook: Schema.Struct<{
109
+ readonly matcher: Schema.optionalKey<Schema.String>;
110
+ readonly timeout: Schema.optionalKey<Schema.Int>;
111
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
112
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
113
+ readonly if: Schema.optionalKey<Schema.String>;
114
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
115
+ readonly http: Schema.String;
116
+ /** Extra request headers. A value may name an environment variable as `$NAME` or `${NAME}`. */
117
+ readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
118
+ /** The environment variables `headers` may interpolate. Any other reads as empty. */
119
+ readonly allowedEnvVars: Schema.optionalKey<Schema.$Array<Schema.String>>;
120
+ }>;
121
+ /**
122
+ * A hook that calls a tool on an MCP server and reads its text output as the
123
+ * hook's answer. A `server` that names one of the plugin's own servers is
124
+ * written with the plugin's scope.
125
+ *
126
+ * @public
127
+ */
128
+ export declare const McpToolHook: Schema.Struct<{
129
+ readonly matcher: Schema.optionalKey<Schema.String>;
130
+ readonly timeout: Schema.optionalKey<Schema.Int>;
131
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
132
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
133
+ readonly if: Schema.optionalKey<Schema.String>;
134
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
135
+ readonly mcpTool: Schema.Struct<{
136
+ readonly server: Schema.String;
137
+ readonly tool: Schema.String;
138
+ /** The tool's arguments. A string value may take a field of the event as `${tool_input.file_path}`. */
139
+ readonly input: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>;
140
+ }>;
141
+ }>;
142
+ /**
143
+ * A hook that asks a model one question and reads `{ok, reason}` back.
144
+ * `$ARGUMENTS` in the prompt is the event's JSON.
145
+ *
146
+ * @public
147
+ */
148
+ export declare const PromptHook: Schema.Struct<{
149
+ readonly matcher: Schema.optionalKey<Schema.String>;
150
+ readonly timeout: Schema.optionalKey<Schema.Int>;
151
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
152
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
153
+ readonly if: Schema.optionalKey<Schema.String>;
154
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
155
+ readonly prompt: Schema.String;
156
+ readonly model: Schema.optionalKey<Schema.String>;
157
+ /** Give a refusal's reason back to the agent and continue, instead of ending the turn. */
158
+ readonly continueOnBlock: Schema.optionalKey<Schema.Boolean>;
159
+ }>;
160
+ /**
161
+ * A hook that runs a subagent with tool access to verify a condition; `agent`
162
+ * is its prompt. Experimental on Claude Code.
163
+ *
164
+ * @public
165
+ */
166
+ export declare const AgentHook: Schema.Struct<{
167
+ readonly matcher: Schema.optionalKey<Schema.String>;
168
+ readonly timeout: Schema.optionalKey<Schema.Int>;
169
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
170
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
171
+ readonly if: Schema.optionalKey<Schema.String>;
172
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
173
+ readonly agent: Schema.String;
174
+ readonly model: Schema.optionalKey<Schema.String>;
175
+ }>;
176
+ /**
177
+ * One hook: exactly one of `script`, `command`, `binary`, `http`, `mcpTool`,
178
+ * `prompt` or `agent`. Decode strictly, or a mixed entry decodes as whichever
179
+ * member matches first.
74
180
  *
75
181
  * @public
76
182
  */
@@ -79,6 +185,10 @@ export declare const HookEntry: Schema.Union<readonly [Schema.Struct<{
79
185
  readonly timeout: Schema.optionalKey<Schema.Int>;
80
186
  readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
81
187
  readonly failClosed: Schema.optionalKey<Schema.Boolean>;
188
+ readonly if: Schema.optionalKey<Schema.String>;
189
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
190
+ readonly async: Schema.optionalKey<Schema.Boolean>;
191
+ readonly asyncRewake: Schema.optionalKey<Schema.Boolean>;
82
192
  readonly script: Schema.String;
83
193
  readonly args: Schema.optionalKey<Schema.$Array<Schema.String>>;
84
194
  }>, Schema.Struct<{
@@ -86,8 +196,95 @@ export declare const HookEntry: Schema.Union<readonly [Schema.Struct<{
86
196
  readonly timeout: Schema.optionalKey<Schema.Int>;
87
197
  readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
88
198
  readonly failClosed: Schema.optionalKey<Schema.Boolean>;
199
+ readonly if: Schema.optionalKey<Schema.String>;
200
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
201
+ readonly async: Schema.optionalKey<Schema.Boolean>;
202
+ readonly asyncRewake: Schema.optionalKey<Schema.Boolean>;
89
203
  readonly command: Schema.String;
204
+ /** The shell the command runs in, on a host that lets a hook choose. Defaults to the host's own. */
205
+ readonly shell: Schema.optionalKey<Schema.Literals<readonly ["bash", "powershell"]>>;
206
+ }>, Schema.Struct<{
207
+ readonly matcher: Schema.optionalKey<Schema.String>;
208
+ readonly timeout: Schema.optionalKey<Schema.Int>;
209
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
210
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
211
+ readonly if: Schema.optionalKey<Schema.String>;
212
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
213
+ readonly async: Schema.optionalKey<Schema.Boolean>;
214
+ readonly asyncRewake: Schema.optionalKey<Schema.Boolean>;
215
+ readonly binary: Schema.String;
216
+ readonly args: Schema.optionalKey<Schema.$Array<Schema.String>>;
217
+ }>, Schema.Struct<{
218
+ readonly matcher: Schema.optionalKey<Schema.String>;
219
+ readonly timeout: Schema.optionalKey<Schema.Int>;
220
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
221
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
222
+ readonly if: Schema.optionalKey<Schema.String>;
223
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
224
+ readonly http: Schema.String;
225
+ /** Extra request headers. A value may name an environment variable as `$NAME` or `${NAME}`. */
226
+ readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
227
+ /** The environment variables `headers` may interpolate. Any other reads as empty. */
228
+ readonly allowedEnvVars: Schema.optionalKey<Schema.$Array<Schema.String>>;
229
+ }>, Schema.Struct<{
230
+ readonly matcher: Schema.optionalKey<Schema.String>;
231
+ readonly timeout: Schema.optionalKey<Schema.Int>;
232
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
233
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
234
+ readonly if: Schema.optionalKey<Schema.String>;
235
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
236
+ readonly mcpTool: Schema.Struct<{
237
+ readonly server: Schema.String;
238
+ readonly tool: Schema.String;
239
+ /** The tool's arguments. A string value may take a field of the event as `${tool_input.file_path}`. */
240
+ readonly input: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>;
241
+ }>;
242
+ }>, Schema.Struct<{
243
+ readonly matcher: Schema.optionalKey<Schema.String>;
244
+ readonly timeout: Schema.optionalKey<Schema.Int>;
245
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
246
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
247
+ readonly if: Schema.optionalKey<Schema.String>;
248
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
249
+ readonly prompt: Schema.String;
250
+ readonly model: Schema.optionalKey<Schema.String>;
251
+ /** Give a refusal's reason back to the agent and continue, instead of ending the turn. */
252
+ readonly continueOnBlock: Schema.optionalKey<Schema.Boolean>;
253
+ }>, Schema.Struct<{
254
+ readonly matcher: Schema.optionalKey<Schema.String>;
255
+ readonly timeout: Schema.optionalKey<Schema.Int>;
256
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
257
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
258
+ readonly if: Schema.optionalKey<Schema.String>;
259
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
260
+ readonly agent: Schema.String;
261
+ readonly model: Schema.optionalKey<Schema.String>;
90
262
  }>]>;
263
+ /**
264
+ * The kinds of hook handler a host can run, in Claude Code's names. A
265
+ * `script`, a `command` and a `binary` are all `command` handlers.
266
+ *
267
+ * @public
268
+ */
269
+ export declare const HOOK_HANDLERS: readonly ["command", "http", "mcp_tool", "prompt", "agent"];
270
+ /**
271
+ * A hook handler kind.
272
+ *
273
+ * @public
274
+ */
275
+ type HookHandler = (typeof HOOK_HANDLERS)[number];
276
+ /**
277
+ * The handler kind an entry is.
278
+ *
279
+ * @public
280
+ */
281
+ export declare const hookHandler: (entry: typeof HookEntry.Type) => HookHandler;
282
+ /**
283
+ * The entry fields beyond the handler itself that only some hosts carry.
284
+ *
285
+ * @public
286
+ */
287
+ export declare const HOOK_ENTRY_FIELDS: readonly ["if", "statusMessage", "async", "asyncRewake", "shell"];
91
288
  /**
92
289
  * The decoded `HookEntry`.
93
290
  *
@@ -105,6 +302,10 @@ export declare const HookEntries: Schema.$Array<Schema.Union<readonly [Schema.St
105
302
  readonly timeout: Schema.optionalKey<Schema.Int>;
106
303
  readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
107
304
  readonly failClosed: Schema.optionalKey<Schema.Boolean>;
305
+ readonly if: Schema.optionalKey<Schema.String>;
306
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
307
+ readonly async: Schema.optionalKey<Schema.Boolean>;
308
+ readonly asyncRewake: Schema.optionalKey<Schema.Boolean>;
108
309
  readonly script: Schema.String;
109
310
  readonly args: Schema.optionalKey<Schema.$Array<Schema.String>>;
110
311
  }>, Schema.Struct<{
@@ -112,7 +313,69 @@ export declare const HookEntries: Schema.$Array<Schema.Union<readonly [Schema.St
112
313
  readonly timeout: Schema.optionalKey<Schema.Int>;
113
314
  readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
114
315
  readonly failClosed: Schema.optionalKey<Schema.Boolean>;
316
+ readonly if: Schema.optionalKey<Schema.String>;
317
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
318
+ readonly async: Schema.optionalKey<Schema.Boolean>;
319
+ readonly asyncRewake: Schema.optionalKey<Schema.Boolean>;
115
320
  readonly command: Schema.String;
321
+ /** The shell the command runs in, on a host that lets a hook choose. Defaults to the host's own. */
322
+ readonly shell: Schema.optionalKey<Schema.Literals<readonly ["bash", "powershell"]>>;
323
+ }>, Schema.Struct<{
324
+ readonly matcher: Schema.optionalKey<Schema.String>;
325
+ readonly timeout: Schema.optionalKey<Schema.Int>;
326
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
327
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
328
+ readonly if: Schema.optionalKey<Schema.String>;
329
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
330
+ readonly async: Schema.optionalKey<Schema.Boolean>;
331
+ readonly asyncRewake: Schema.optionalKey<Schema.Boolean>;
332
+ readonly binary: Schema.String;
333
+ readonly args: Schema.optionalKey<Schema.$Array<Schema.String>>;
334
+ }>, Schema.Struct<{
335
+ readonly matcher: Schema.optionalKey<Schema.String>;
336
+ readonly timeout: Schema.optionalKey<Schema.Int>;
337
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
338
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
339
+ readonly if: Schema.optionalKey<Schema.String>;
340
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
341
+ readonly http: Schema.String;
342
+ /** Extra request headers. A value may name an environment variable as `$NAME` or `${NAME}`. */
343
+ readonly headers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
344
+ /** The environment variables `headers` may interpolate. Any other reads as empty. */
345
+ readonly allowedEnvVars: Schema.optionalKey<Schema.$Array<Schema.String>>;
346
+ }>, Schema.Struct<{
347
+ readonly matcher: Schema.optionalKey<Schema.String>;
348
+ readonly timeout: Schema.optionalKey<Schema.Int>;
349
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
350
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
351
+ readonly if: Schema.optionalKey<Schema.String>;
352
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
353
+ readonly mcpTool: Schema.Struct<{
354
+ readonly server: Schema.String;
355
+ readonly tool: Schema.String;
356
+ /** The tool's arguments. A string value may take a field of the event as `${tool_input.file_path}`. */
357
+ readonly input: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>;
358
+ }>;
359
+ }>, Schema.Struct<{
360
+ readonly matcher: Schema.optionalKey<Schema.String>;
361
+ readonly timeout: Schema.optionalKey<Schema.Int>;
362
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
363
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
364
+ readonly if: Schema.optionalKey<Schema.String>;
365
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
366
+ readonly prompt: Schema.String;
367
+ readonly model: Schema.optionalKey<Schema.String>;
368
+ /** Give a refusal's reason back to the agent and continue, instead of ending the turn. */
369
+ readonly continueOnBlock: Schema.optionalKey<Schema.Boolean>;
370
+ }>, Schema.Struct<{
371
+ readonly matcher: Schema.optionalKey<Schema.String>;
372
+ readonly timeout: Schema.optionalKey<Schema.Int>;
373
+ readonly fallback: Schema.optionalKey<Schema.Literals<readonly ["fail", "omit"]>>;
374
+ readonly failClosed: Schema.optionalKey<Schema.Boolean>;
375
+ readonly if: Schema.optionalKey<Schema.String>;
376
+ readonly statusMessage: Schema.optionalKey<Schema.String>;
377
+ readonly agent: Schema.String;
378
+ readonly model: Schema.optionalKey<Schema.String>;
116
379
  }>]>>;
117
380
  /**
118
381
  * The fields of a hooks map over the events `E`, each optional.
@@ -135,7 +398,7 @@ export declare const makeHooks: <const E extends ReadonlyArray<string>>(events:
135
398
  *
136
399
  * @public
137
400
  */
138
- export declare const Hooks: Schema.Struct<HooksFields<readonly ["SessionStart", "Setup", "UserPromptSubmit", "UserPromptExpansion", "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"]>>;
401
+ export declare const Hooks: Schema.Struct<HooksFields<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"]>>;
139
402
  /**
140
403
  * A plugin name as every host spells it: kebab-case, lowercase letters and
141
404
  * digits separated by single hyphens.
@@ -191,7 +454,7 @@ export declare const BaseConfigFields: {
191
454
  readonly invoke: Schema.optionalKey<Schema.Literals<readonly ["bash", "exec"]>>;
192
455
  }>>;
193
456
  /** Hooks keyed by Claude Code event names, generated per target. */
194
- readonly hooks: Schema.optionalKey<Schema.Struct<HooksFields<readonly ["SessionStart", "Setup", "UserPromptSubmit", "UserPromptExpansion", "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"]>>>;
457
+ readonly hooks: Schema.optionalKey<Schema.Struct<HooksFields<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"]>>>;
195
458
  /** MCP servers in Claude Code's `.mcp.json` server shape. */
196
459
  readonly mcpServers: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
197
460
  readonly type: Schema.optionalKey<Schema.Literal<"stdio">>;
@@ -455,6 +718,55 @@ export declare const SKILL_FIELDS: ReadonlyArray<SkillField>;
455
718
  * @public
456
719
  */
457
720
  export declare const AGENT_FIELDS: ReadonlyArray<AgentField>;
721
+ /**
722
+ * One event's input and output schemas.
723
+ *
724
+ * @public
725
+ */
726
+ interface HookIo {
727
+ readonly input: Schema.Codec<unknown, unknown>;
728
+ readonly output: Schema.Codec<unknown, unknown>;
729
+ }
730
+ /**
731
+ * The input and output schema of every Claude Code hook event: the JSON a hook
732
+ * receives and the JSON it may answer with.
733
+ *
734
+ * @public
735
+ */
736
+ export declare const HOOK_IO: Readonly<Record<ClaudeHookEvent, HookIo>>;
737
+ /**
738
+ * The documented `tool_input` shape of each built-in tool, by tool name.
739
+ *
740
+ * @public
741
+ */
742
+ export declare const TOOL_INPUTS: Readonly<Record<string, Schema.Codec<unknown, unknown>>>;
743
+ /**
744
+ * The Zig source of `zig/src/events.zig`: a struct for each Claude Code hook
745
+ * event's input and, under `tools`, for each built-in tool's `tool_input`. The
746
+ * text is what `zig fmt` would write, so a regeneration that changes nothing
747
+ * writes the same bytes.
748
+ *
749
+ * @public
750
+ */
751
+ export declare const hookEventsZig: () => string;
752
+ /**
753
+ * A generated JSON Schema file: its name and its text.
754
+ *
755
+ * @public
756
+ */
757
+ interface HookSchemaFile {
758
+ readonly name: string;
759
+ readonly content: string;
760
+ }
761
+ /**
762
+ * The JSON Schema documents for every Claude Code hook event, one for its
763
+ * input and one for its output, and one for each built-in tool's
764
+ * `tool_input`. The text is deterministic, so a regeneration that changes
765
+ * nothing writes the same bytes.
766
+ *
767
+ * @public
768
+ */
769
+ export declare const hookSchemaFiles: () => ReadonlyArray<HookSchemaFile>;
458
770
  /**
459
771
  * One LSP server, in Claude Code's `.lsp.json` server shape. `${PLUGIN_ROOT}`
460
772
  * is the one placeholder in `command`, `args`, `env` and `workspaceFolder`.
@@ -852,6 +1164,10 @@ declare const Target_base: Schema.Class<Target, Schema.Struct<{
852
1164
  readonly format: Schema.Literals<readonly ["claude-hooks-json", "copilot-hooks-v1"]>;
853
1165
  readonly events: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, typeof Absent]>>;
854
1166
  readonly ownEvents: Schema.$Array<Schema.String>;
1167
+ /** The handler kinds the host runs. An entry of another kind is unsupported there. */
1168
+ readonly handlers: Schema.$Array<Schema.Literals<readonly ["command", "http", "mcp_tool", "prompt", "agent"]>>;
1169
+ /** The optional entry fields the host's hooks format carries; the build drops the rest with a note. */
1170
+ readonly entryFields: Schema.$Array<Schema.Literals<readonly ["if", "statusMessage", "async", "asyncRewake", "shell"]>>;
855
1171
  /**
856
1172
  * The Claude events whose matcher the host ignores. The build drops the
857
1173
  * host `matcher` key there and the hook library applies the matcher at
@@ -964,5 +1280,5 @@ export declare const unresolved: (note: string) => Unresolved;
964
1280
  * @public
965
1281
  */
966
1282
  export declare const CORE_VERSION: string;
967
- export type { AgentField, DegradeForm, HooksFields, LspField, SkillField };
1283
+ export type { AgentField, DegradeForm, HookHandler, HookIo, HookSchemaFile, HooksFields, LspField, SkillField };
968
1284
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,12 +1,16 @@
1
1
  import { BASE_CONFIG_KEYS, BaseConfigFields, PluginName, ScriptInvoke, ShippedPath, makeTargetSetting } from "./config.js";
2
2
  import { EnvConfig, EnvVar, EnvVarName } from "./env.js";
3
3
  import { AGENT_FIELDS, AgentFrontmatter, ComponentName, ComponentTargets, SKILL_FIELDS, SkillFrontmatter } from "./frontmatter.js";
4
- import { CLAUDE_HOOK_EVENTS, ClaudeHookEvent, CommandHook, HookEntries, HookEntry, HookFallback, Hooks, PluginRelativePath, ScriptHook, makeHooks } from "./hooks.js";
4
+ import { hookSchemaFiles } from "./hook-io/index.js";
5
+ import { AgentHook, BinaryHook, CLAUDE_HOOK_EVENTS, ClaudeHookEvent, CommandHook, HOOK_ENTRY_FIELDS, HOOK_HANDLERS, HookEntries, HookEntry, HookFallback, Hooks, HttpHook, McpToolHook, PluginRelativePath, PromptHook, ScriptHook, hookHandler, makeHooks } from "./hooks.js";
5
6
  import { LSP_FIELDS, LspServer, LspServers } from "./lsp.js";
6
7
  import { McpServer, McpServers, RemoteMcpServer, ServerEnv, StdioMcpServer } from "./mcp.js";
7
8
  import { CommandMonitor, MonitorEntry, MonitorName, MonitorWhen, Monitors, ScriptMonitor } from "./monitors.js";
9
+ import { HOOK_IO } from "./hook-io/events.js";
10
+ import { TOOL_INPUTS } from "./hook-io/tool-inputs.js";
11
+ import { hookEventsZig } from "./hook-io/zig.js";
8
12
  import { KebabName } from "./name.js";
9
13
  import { Absent, DEGRADE_FORMS, Degrade, Drop, EventMapping, FieldMapEntry, HOOKS_FORMATS, HooksFormat, InFile, InManifest, Keep, LSP_FORMATS, LspFormat, MANIFEST_FORMATS, MCP_FORMATS, ManifestFormat, McpFormat, Rename, RootSpelling, ServerPlacement, Target, ToolMapping, Translate, TranslateTable, Unresolved, ValueMapping, absent, degrade, drop, inFile, inManifest, keep, rename, translate, unresolved } from "./target.js";
10
14
  import { CORE_VERSION } from "./version.js";
11
15
 
12
- export { AGENT_FIELDS, Absent, AgentFrontmatter, BASE_CONFIG_KEYS, BaseConfigFields, CLAUDE_HOOK_EVENTS, CORE_VERSION, ClaudeHookEvent, CommandHook, CommandMonitor, ComponentName, ComponentTargets, DEGRADE_FORMS, Degrade, Drop, EnvConfig, EnvVar, EnvVarName, EventMapping, FieldMapEntry, HOOKS_FORMATS, HookEntries, HookEntry, HookFallback, Hooks, HooksFormat, InFile, InManifest, KebabName, Keep, LSP_FIELDS, LSP_FORMATS, LspFormat, LspServer, LspServers, MANIFEST_FORMATS, MCP_FORMATS, ManifestFormat, McpFormat, McpServer, McpServers, MonitorEntry, MonitorName, MonitorWhen, Monitors, PluginName, PluginRelativePath, RemoteMcpServer, Rename, RootSpelling, SKILL_FIELDS, ScriptHook, ScriptInvoke, ScriptMonitor, ServerEnv, ServerPlacement, ShippedPath, SkillFrontmatter, StdioMcpServer, Target, ToolMapping, Translate, TranslateTable, Unresolved, ValueMapping, absent, degrade, drop, inFile, inManifest, keep, makeHooks, makeTargetSetting, rename, translate, unresolved };
16
+ export { AGENT_FIELDS, Absent, AgentFrontmatter, AgentHook, BASE_CONFIG_KEYS, BaseConfigFields, BinaryHook, CLAUDE_HOOK_EVENTS, CORE_VERSION, ClaudeHookEvent, CommandHook, CommandMonitor, ComponentName, ComponentTargets, DEGRADE_FORMS, Degrade, Drop, EnvConfig, EnvVar, EnvVarName, EventMapping, FieldMapEntry, HOOKS_FORMATS, HOOK_ENTRY_FIELDS, HOOK_HANDLERS, HOOK_IO, HookEntries, HookEntry, HookFallback, Hooks, HooksFormat, HttpHook, InFile, InManifest, KebabName, Keep, LSP_FIELDS, LSP_FORMATS, LspFormat, LspServer, LspServers, MANIFEST_FORMATS, MCP_FORMATS, ManifestFormat, McpFormat, McpServer, McpServers, McpToolHook, MonitorEntry, MonitorName, MonitorWhen, Monitors, PluginName, PluginRelativePath, PromptHook, RemoteMcpServer, Rename, RootSpelling, SKILL_FIELDS, ScriptHook, ScriptInvoke, ScriptMonitor, ServerEnv, ServerPlacement, ShippedPath, SkillFrontmatter, StdioMcpServer, TOOL_INPUTS, Target, ToolMapping, Translate, TranslateTable, Unresolved, ValueMapping, absent, degrade, drop, hookEventsZig, hookHandler, hookSchemaFiles, inFile, inManifest, keep, makeHooks, makeTargetSetting, rename, translate, unresolved };
package/lsp.js CHANGED
@@ -1,5 +1,5 @@
1
- import { ServerEnv } from "./mcp.js";
2
1
  import { Schema } from "effect";
2
+ import { ServerEnv } from "./mcp.js";
3
3
 
4
4
  // src/lsp.ts
5
5
  const NonNegativeInt = Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0));
package/monitors.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { Schema } from "effect";
1
2
  import { PluginRelativePath } from "./hooks.js";
2
3
  import { KebabName } from "./name.js";
3
- import { Schema } from "effect";
4
4
 
5
5
  // src/monitors.ts
6
6
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluginfinity/core",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "description": "The pluginfinity domain model: the host-neutral plugin source, the Target capability schema and the pluginfinity config shape. Platform-free.",
6
6
  "keywords": [
package/target.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Schema } from "effect";
2
+ import { HOOK_ENTRY_FIELDS, HOOK_HANDLERS } from "./hooks.js";
2
3
 
3
4
  // src/target.ts
4
5
  /**
@@ -212,6 +213,10 @@ var Target = class extends Schema.Class("Target")({
212
213
  format: HooksFormat,
213
214
  events: Schema.Record(Schema.String, EventMapping),
214
215
  ownEvents: Schema.Array(Schema.String),
216
+ /** The handler kinds the host runs. An entry of another kind is unsupported there. */
217
+ handlers: Schema.Array(Schema.Literals(HOOK_HANDLERS)),
218
+ /** The optional entry fields the host's hooks format carries; the build drops the rest with a note. */
219
+ entryFields: Schema.Array(Schema.Literals(HOOK_ENTRY_FIELDS)),
215
220
  /**
216
221
  * The Claude events whose matcher the host ignores. The build drops the
217
222
  * host `matcher` key there and the hook library applies the matcher at
package/version.js CHANGED
@@ -9,6 +9,6 @@
9
9
  *
10
10
  * @public
11
11
  */
12
- const CORE_VERSION = "0.3.3";
12
+ const CORE_VERSION = "0.4.0";
13
13
 
14
14
  export { CORE_VERSION };