@pugi/cli 0.1.0-beta.36 → 0.1.0-beta.37

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.
@@ -0,0 +1,216 @@
1
+ /**
2
+ * Pugi hooks v2 — config loader (Wave 7 Phase 1).
3
+ *
4
+ * Reads two sources and merges them with project-overrides-user
5
+ * precedence:
6
+ *
7
+ * 1. Global user config — `~/.pugi/hooks.json` (or `$PUGI_HOME/hooks.json`)
8
+ * 2. Project config — `<workspaceRoot>/.pugi/hooks.json`
9
+ *
10
+ * Merge rule: the project file's hooks are CONCATENATED after the
11
+ * global file's hooks. When the runner walks the merged list, project
12
+ * hooks therefore run AFTER global hooks for the same event. The
13
+ * `precedence` term in the docs refers to overrides via matcher /
14
+ * event-type collision, NOT order-of-evaluation: a project hook on
15
+ * `PreToolUse|bash` shadows a global hook on the same event+matcher
16
+ * because the matcher engine deduplicates within the merged config.
17
+ *
18
+ * Failure modes:
19
+ * - Missing files -> empty entries from that side. Both missing -> the
20
+ * loader returns an empty config (`isEmpty()` true).
21
+ * - Malformed JSON -> the loader throws with the file path in the
22
+ * error so the operator can find + fix it.
23
+ * - Schema violation -> the loader throws with the Zod issue list.
24
+ *
25
+ * Brand voice: ASCII only.
26
+ */
27
+ import { existsSync, readFileSync } from 'node:fs';
28
+ import { homedir } from 'node:os';
29
+ import { resolve } from 'node:path';
30
+ import { z } from 'zod';
31
+ import { DEFAULT_HOOK_TIMEOUT_MS_V2, MAX_HOOK_TIMEOUT_MS_V2, } from './types.js';
32
+ const hookEventEnum = z.enum([
33
+ 'SessionStart',
34
+ 'SessionEnd',
35
+ 'UserPromptSubmit',
36
+ 'PreToolUse',
37
+ 'PostToolUse',
38
+ 'PostToolUseFailure',
39
+ 'Stop',
40
+ 'PreCompact',
41
+ 'PostCompact',
42
+ 'Notification',
43
+ 'SubagentStart',
44
+ 'SubagentStop',
45
+ 'SubagentToolUse',
46
+ 'PermissionRequest',
47
+ 'PermissionGranted',
48
+ 'PermissionDenied',
49
+ 'PreEdit',
50
+ 'PostEdit',
51
+ 'PreWrite',
52
+ 'PostWrite',
53
+ 'PreRead',
54
+ 'PostRead',
55
+ 'PreBash',
56
+ 'PostBash',
57
+ 'McpServerConnect',
58
+ 'McpServerDisconnect',
59
+ 'McpToolCall',
60
+ 'McpToolResult',
61
+ 'AgentSpawn',
62
+ 'AgentComplete',
63
+ 'TaskCompleted',
64
+ 'PromptInjection',
65
+ ]);
66
+ const hookTypeEnum = z.enum(['command', 'http', 'mcp_tool', 'prompt', 'agent']);
67
+ const hookConfigSchema = z
68
+ .object({
69
+ event: hookEventEnum,
70
+ matcher: z.string().min(1),
71
+ type: hookTypeEnum,
72
+ command: z.string().min(1).optional(),
73
+ timeoutMs: z
74
+ .number()
75
+ .int()
76
+ .positive()
77
+ .max(MAX_HOOK_TIMEOUT_MS_V2)
78
+ .optional(),
79
+ description: z.string().min(1).max(200).optional(),
80
+ })
81
+ .strict()
82
+ .superRefine((entry, ctx) => {
83
+ if (entry.type === 'command' && !entry.command) {
84
+ ctx.addIssue({
85
+ code: z.ZodIssueCode.custom,
86
+ path: ['command'],
87
+ message: '`command` is required when `type === "command"`',
88
+ });
89
+ }
90
+ });
91
+ const hooksFileSchema = z
92
+ .object({
93
+ version: z.literal(1),
94
+ hooks: z.array(hookConfigSchema).default([]),
95
+ })
96
+ .strict();
97
+ /** Default global config location: `~/.pugi/hooks.json` (PUGI_HOME-aware). */
98
+ export function defaultGlobalHooksPath(home) {
99
+ const root = home ?? process.env.PUGI_HOME ?? resolve(homedir(), '.pugi');
100
+ return resolve(root, 'hooks.json');
101
+ }
102
+ /** Default project config location: `<workspaceRoot>/.pugi/hooks.json`. */
103
+ export function defaultProjectHooksPath(workspaceRoot) {
104
+ return resolve(workspaceRoot, '.pugi', 'hooks.json');
105
+ }
106
+ /**
107
+ * Immutable snapshot of the merged global + project config. Holds the
108
+ * source paths so audit + doctor surfaces can show "where did this come
109
+ * from".
110
+ */
111
+ export class HooksConfigV2 {
112
+ globalPath;
113
+ projectPath;
114
+ globalHooks;
115
+ projectHooks;
116
+ constructor(globalPath, projectPath, globalHooks, projectHooks) {
117
+ this.globalPath = globalPath;
118
+ this.projectPath = projectPath;
119
+ this.globalHooks = globalHooks;
120
+ this.projectHooks = projectHooks;
121
+ }
122
+ /** Path of the global config file (may not exist on disk). */
123
+ globalConfigPath() {
124
+ return this.globalPath;
125
+ }
126
+ /** Path of the project config file (may not exist on disk). */
127
+ projectConfigPath() {
128
+ return this.projectPath;
129
+ }
130
+ /** All declared hooks (global first, project second). */
131
+ all() {
132
+ return [...this.globalHooks, ...this.projectHooks];
133
+ }
134
+ /** Hooks declared in the project config only. */
135
+ projectOnly() {
136
+ return [...this.projectHooks];
137
+ }
138
+ /** Hooks declared in the global config only. */
139
+ globalOnly() {
140
+ return [...this.globalHooks];
141
+ }
142
+ /** All hooks declared for a given event, project AFTER global. */
143
+ forEvent(event) {
144
+ return this.all().filter((h) => h.event === event);
145
+ }
146
+ /** True iff no hooks are configured. */
147
+ isEmpty() {
148
+ return this.globalHooks.length === 0 && this.projectHooks.length === 0;
149
+ }
150
+ /** Empty snapshot for when both files are absent. */
151
+ static empty(globalPath, projectPath) {
152
+ return new HooksConfigV2(globalPath, projectPath, [], []);
153
+ }
154
+ }
155
+ /**
156
+ * Load + validate the merged hooks config. Returns an empty config
157
+ * when neither file exists. Throws on JSON / schema errors with the
158
+ * source path in the message.
159
+ *
160
+ * Non-null invariant: returns a `HooksConfigV2` instance in all cases.
161
+ * Callers may chain `.isEmpty()` without a guard.
162
+ */
163
+ export function loadHooksConfigV2(opts) {
164
+ const globalPath = opts.globalPathOverride ?? defaultGlobalHooksPath();
165
+ const projectPath = opts.projectPathOverride ?? defaultProjectHooksPath(opts.workspaceRoot);
166
+ const globalHooks = readOne(globalPath);
167
+ const projectHooks = readOne(projectPath);
168
+ return new HooksConfigV2(globalPath, projectPath, globalHooks, projectHooks);
169
+ }
170
+ function readOne(path) {
171
+ if (!existsSync(path)) {
172
+ return [];
173
+ }
174
+ let raw;
175
+ try {
176
+ raw = readFileSync(path, 'utf8');
177
+ }
178
+ catch (error) {
179
+ throw new Error(`pugi hooks v2: cannot read ${path}: ${error.message}`);
180
+ }
181
+ if (raw.trim() === '') {
182
+ return [];
183
+ }
184
+ let parsed;
185
+ try {
186
+ parsed = JSON.parse(raw);
187
+ }
188
+ catch (error) {
189
+ throw new Error(`pugi hooks v2: ${path} is not valid JSON: ${error.message}`);
190
+ }
191
+ const result = hooksFileSchema.safeParse(parsed);
192
+ if (!result.success) {
193
+ const issues = result.error.issues
194
+ .map((issue) => `${issue.path.join('.') || '<root>'} ${issue.message}`)
195
+ .join('; ');
196
+ throw new Error(`pugi hooks v2: ${path} failed schema validation: ${issues}`);
197
+ }
198
+ return materialize(result.data);
199
+ }
200
+ function materialize(data) {
201
+ // Apply the default timeout to every entry so downstream code can
202
+ // assume `timeoutMs` is always set.
203
+ return data.hooks.map((entry) => ({
204
+ ...entry,
205
+ timeoutMs: entry.timeoutMs ?? DEFAULT_HOOK_TIMEOUT_MS_V2,
206
+ }));
207
+ }
208
+ /** Re-exports for callers that want the literal enum values. */
209
+ export const SUPPORTED_HOOK_TYPES_V2 = [
210
+ 'command',
211
+ 'http',
212
+ 'mcp_tool',
213
+ 'prompt',
214
+ 'agent',
215
+ ];
216
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Pugi hooks v2 - matcher grammar (Wave 7 Phase 1).
3
+ *
4
+ * The matcher string is compared against the tool name for tool events
5
+ * (PreToolUse / PostToolUse / PostToolUseFailure) and against the empty
6
+ * string for non-tool events (matcher is effectively ignored unless it
7
+ * is the wildcard).
8
+ *
9
+ * Grammar (evaluated in order):
10
+ *
11
+ * 1. wildcard `*` - matches anything.
12
+ * 2. slash-regex literal - `/pattern/flags`. Flags subset of gimsuy.
13
+ * 3. prefix regex - starts with `^` (e.g. `^mcp__`).
14
+ * 4. alternation - `bash|grep|read`. Each side compiled
15
+ * recursively so `mcp__*|bash` works.
16
+ * 5. wildcard glob - any string containing `*` not handled
17
+ * by the regex branches (e.g. `mcp__*`).
18
+ * 6. exact match - case-sensitive equality.
19
+ *
20
+ * Operators in the wild write `^mcp__` expecting "starts with mcp__".
21
+ * The Claude Code docs document this behaviour.
22
+ *
23
+ * Brand voice: ASCII only.
24
+ */
25
+ // Constructed regexes used internally. We avoid `/.../` literals when
26
+ // the pattern contains `${` because some TypeScript parser
27
+ // configurations mis-treat the dollar-brace sequence inside a regex
28
+ // character class as a template-literal opener.
29
+ const REGEX_META_CHARS = new RegExp('[.*+?^${}()|[\\]\\\\]');
30
+ const ESCAPE_REGEX_META = new RegExp('[.*+?^${}()|[\\]\\\\]', 'g');
31
+ const SLASH_REGEX_LITERAL = /^\/(.+)\/([A-Za-z]*)$/;
32
+ const ALLOWED_REGEX_FLAGS = /^[gimsuy]*$/;
33
+ /**
34
+ * Compile a matcher string into a predicate over a single candidate.
35
+ * The candidate is the tool name for tool events, or `''` for
36
+ * non-tool events.
37
+ *
38
+ * Throws on a malformed regex literal so the operator sees a clear
39
+ * error at config-load time rather than at hook-fire time.
40
+ */
41
+ export function compileMatcher(matcher) {
42
+ const trimmed = matcher.trim();
43
+ if (trimmed === '' || trimmed === '*') {
44
+ return () => true;
45
+ }
46
+ // 1. Slash-delimited regex literal.
47
+ const slashMatch = SLASH_REGEX_LITERAL.exec(trimmed);
48
+ if (slashMatch) {
49
+ const body = slashMatch[1] ?? '';
50
+ const flags = slashMatch[2] ?? '';
51
+ if (!ALLOWED_REGEX_FLAGS.test(flags)) {
52
+ throw new Error(`pugi hooks v2: matcher '${matcher}' has unsupported regex flags '${flags}'`);
53
+ }
54
+ try {
55
+ const re = new RegExp(body, flags);
56
+ return (candidate) => re.test(candidate);
57
+ }
58
+ catch (error) {
59
+ throw new Error(`pugi hooks v2: matcher '${matcher}' is not a valid regex: ${error.message}`);
60
+ }
61
+ }
62
+ // 2. Prefix-rooted regex shortcut: starts with `^` OR ends with `$`
63
+ // AND no `|` (alternation handled below). Also a string
64
+ // containing regex meta but no `|` and not pure wildcard glob.
65
+ const looksLikeRegex = (trimmed.startsWith('^') || trimmed.endsWith('$')) &&
66
+ !trimmed.includes('|');
67
+ const looksLikeMetaRegex = REGEX_META_CHARS.test(trimmed) &&
68
+ !trimmed.includes('|') &&
69
+ !isPureWildcardGlob(trimmed);
70
+ if (looksLikeRegex || looksLikeMetaRegex) {
71
+ try {
72
+ const re = new RegExp(trimmed);
73
+ return (candidate) => re.test(candidate);
74
+ }
75
+ catch (error) {
76
+ throw new Error(`pugi hooks v2: matcher '${matcher}' is not a valid regex: ${error.message}`);
77
+ }
78
+ }
79
+ // 3. Pipe alternation.
80
+ if (trimmed.includes('|')) {
81
+ const alts = trimmed
82
+ .split('|')
83
+ .map((s) => s.trim())
84
+ .filter((s) => s.length > 0);
85
+ const predicates = alts.map((alt) => compileMatcher(alt));
86
+ return (candidate) => predicates.some((p) => p(candidate));
87
+ }
88
+ // 4. Wildcard glob.
89
+ if (trimmed.includes('*')) {
90
+ const pattern = trimmed
91
+ .split('*')
92
+ .map((part) => escapeRegex(part))
93
+ .join('.*');
94
+ const re = new RegExp(`^${pattern}$`);
95
+ return (candidate) => re.test(candidate);
96
+ }
97
+ // 5. Exact match.
98
+ return (candidate) => candidate === trimmed;
99
+ }
100
+ /**
101
+ * True iff the matcher uses ONLY the wildcard sub-grammar (literal
102
+ * chars + `*`) - no other regex meta. Used to disambiguate `mcp__*`
103
+ * from `mcp__\d+`.
104
+ */
105
+ function isPureWildcardGlob(matcher) {
106
+ for (const ch of matcher) {
107
+ if (ch === '*')
108
+ continue;
109
+ if (REGEX_META_CHARS.test(ch))
110
+ return false;
111
+ }
112
+ return matcher.includes('*');
113
+ }
114
+ function escapeRegex(value) {
115
+ return value.replace(ESCAPE_REGEX_META, '\\$&');
116
+ }
117
+ /**
118
+ * Quick predicate over a matcher + candidate. Compiles + executes in
119
+ * one shot. Use `compileMatcher` directly when the same matcher is
120
+ * applied to many candidates.
121
+ */
122
+ export function matches(matcher, candidate) {
123
+ return compileMatcher(matcher)(candidate);
124
+ }
125
+ //# sourceMappingURL=matcher.js.map
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Pugi hooks v2 — trust ledger (Wave 7 Phase 1).
3
+ *
4
+ * Mirrors `core/mcp/trust.ts`. First-run interactive prompt fires
5
+ * before any hook executes; the operator's decision (allow / deny /
6
+ * always-allow) is persisted to `~/.pugi/hooks-trust.json` so the
7
+ * prompt does not re-fire on every REPL boot.
8
+ *
9
+ * Why a separate ledger from MCP trust:
10
+ * - Hook commands run arbitrary shell as the operator. A trust
11
+ * decision for a hook script does not transfer to MCP servers and
12
+ * vice-versa; the surfaces should not collide.
13
+ * - The hook ledger is keyed by command STRING (with the project
14
+ * path scope) — two projects with the same `.pugi/hooks.json`
15
+ * content trust independently. This prevents a malicious upstream
16
+ * `pugi init` template from inheriting a trust decision from an
17
+ * unrelated project on the same machine.
18
+ *
19
+ * Schema:
20
+ * {
21
+ * "schema": 1,
22
+ * "entries": {
23
+ * "<workspaceRoot>::<command-hash>": {
24
+ * "state": "trusted" | "denied" | "pending",
25
+ * "decidedAt": "<iso8601>",
26
+ * "command": "<truncated command>",
27
+ * "workspaceRoot": "<absolute path>"
28
+ * }
29
+ * }
30
+ * }
31
+ *
32
+ * Brand voice: ASCII only.
33
+ */
34
+ import { createHash } from 'node:crypto';
35
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
36
+ import { homedir } from 'node:os';
37
+ import { dirname, resolve } from 'node:path';
38
+ import { z } from 'zod';
39
+ const TRUST_LEDGER_FILENAME = 'hooks-trust.json';
40
+ const ledgerEntrySchema = z.object({
41
+ state: z.enum(['pending', 'trusted', 'denied']),
42
+ decidedAt: z.string().datetime(),
43
+ command: z.string().min(1),
44
+ workspaceRoot: z.string().min(1),
45
+ });
46
+ const ledgerSchema = z.object({
47
+ schema: z.literal(1).default(1),
48
+ entries: z.record(ledgerEntrySchema).default({}),
49
+ });
50
+ /** Override-friendly path resolution. Honors `PUGI_HOME`. */
51
+ export function trustLedgerPath(homeOverride) {
52
+ const home = homeOverride ?? process.env.PUGI_HOME ?? resolve(homedir(), '.pugi');
53
+ return resolve(home, TRUST_LEDGER_FILENAME);
54
+ }
55
+ /** Stable key for a (workspace, command) pair. */
56
+ export function trustKey(workspaceRoot, command) {
57
+ const hash = createHash('sha256')
58
+ .update(`${workspaceRoot}\0${command}`)
59
+ .digest('hex')
60
+ .slice(0, 16);
61
+ return `${workspaceRoot}::${hash}`;
62
+ }
63
+ function readLedger(homeOverride) {
64
+ const path = trustLedgerPath(homeOverride);
65
+ if (!existsSync(path)) {
66
+ return { schema: 1, entries: {} };
67
+ }
68
+ const raw = readFileSync(path, 'utf8');
69
+ if (raw.trim() === '') {
70
+ return { schema: 1, entries: {} };
71
+ }
72
+ return ledgerSchema.parse(JSON.parse(raw));
73
+ }
74
+ function writeLedger(ledger, homeOverride) {
75
+ const path = trustLedgerPath(homeOverride);
76
+ mkdirSync(dirname(path), { recursive: true });
77
+ writeFileSync(path, `${JSON.stringify(ledger, null, 2)}\n`, {
78
+ encoding: 'utf8',
79
+ mode: 0o600,
80
+ });
81
+ }
82
+ /**
83
+ * Look up the trust state for (workspace, command). Returns `pending`
84
+ * when no decision has been recorded.
85
+ */
86
+ export function getHookTrust(workspaceRoot, command, homeOverride) {
87
+ const ledger = readLedger(homeOverride);
88
+ const entry = ledger.entries[trustKey(workspaceRoot, command)];
89
+ return entry ? entry.state : 'pending';
90
+ }
91
+ /** Persist a trust decision. */
92
+ export function setHookTrust(workspaceRoot, command, state, homeOverride) {
93
+ const ledger = readLedger(homeOverride);
94
+ ledger.entries[trustKey(workspaceRoot, command)] = {
95
+ state,
96
+ decidedAt: new Date().toISOString(),
97
+ command: command.slice(0, 200),
98
+ workspaceRoot,
99
+ };
100
+ writeLedger(ledger, homeOverride);
101
+ }
102
+ /** Bulk listing for `pugi hooks trust list`. */
103
+ export function listHookTrust(homeOverride) {
104
+ const ledger = readLedger(homeOverride);
105
+ return Object.values(ledger.entries)
106
+ .map((entry) => ({
107
+ workspaceRoot: entry.workspaceRoot,
108
+ command: entry.command,
109
+ state: entry.state,
110
+ decidedAt: entry.decidedAt,
111
+ }))
112
+ .sort((a, b) => a.workspaceRoot.localeCompare(b.workspaceRoot));
113
+ }
114
+ /**
115
+ * Resolve trust for a hook, prompting the operator on first encounter.
116
+ * `once` answers do NOT persist — the hook runs but the ledger stays
117
+ * pending so the next session re-prompts.
118
+ *
119
+ * The headless behaviour: when `promptFn` is undefined, the result is
120
+ * `denied`. Non-interactive sessions must NOT execute unknown hooks.
121
+ */
122
+ export async function ensureHookTrust(input, promptFn, homeOverride) {
123
+ const known = getHookTrust(input.workspaceRoot, input.command, homeOverride);
124
+ if (known !== 'pending') {
125
+ return known;
126
+ }
127
+ if (!promptFn) {
128
+ // Headless mode without prompt = refuse for safety.
129
+ return 'denied';
130
+ }
131
+ const answer = await promptFn(input);
132
+ if (answer === 'trust') {
133
+ setHookTrust(input.workspaceRoot, input.command, 'trusted', homeOverride);
134
+ return 'trusted';
135
+ }
136
+ if (answer === 'deny') {
137
+ setHookTrust(input.workspaceRoot, input.command, 'denied', homeOverride);
138
+ return 'denied';
139
+ }
140
+ // `once` -> run this time but do NOT persist.
141
+ return 'trusted';
142
+ }
143
+ //# sourceMappingURL=trust.js.map
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Pugi hooks v2 — Claude Code parity types (Wave 7 Phase 1).
3
+ *
4
+ * The v2 surface is a fresh implementation alongside the existing
5
+ * `core/hooks/` MVP module. It is NOT a replacement — both surfaces
6
+ * co-exist so the operator's legacy `~/.pugi/hooks-mvp.json` configs
7
+ * keep working while v2 grows the matcher grammar, the JSON decision
8
+ * protocol, and the per-project trust ledger.
9
+ *
10
+ * Why v2 instead of evolving v1 in-place:
11
+ * - The v1 runner spawns hooks via `/bin/sh -c` with the payload in
12
+ * env vars + stdin. v2 ships a richer stdin contract (schema_version,
13
+ * transcript_path, cwd, permission_mode, agent_id, agent_type) that
14
+ * would silently break v1 scripts if we mutated the existing surface.
15
+ * - The v1 matcher is exact/star only. v2 adds regex, |-alternation,
16
+ * and MCP wildcards. A clean module is easier to reason about than
17
+ * a backward-compat branch inside the existing matcher.
18
+ * - The v1 trust model is implicit (operator runs `pugi hooks doctor`
19
+ * to surface config errors). v2 introduces a first-run interactive
20
+ * prompt with a persisted ledger, matching MCP's trust pattern.
21
+ *
22
+ * Phase 1 wires 9 of the 31 events Claude Code exposes. The remaining
23
+ * 22 land in Phase 2 along with hook chains. The type union below
24
+ * carries ALL 31 names so chains + future events compile against the
25
+ * same surface without churn.
26
+ *
27
+ * Brand voice: ASCII only, no emoji, no em-dashes.
28
+ */
29
+ /** All 31 events the v2 surface understands. */
30
+ export const ALL_HOOK_EVENTS_V2 = [
31
+ 'SessionStart',
32
+ 'SessionEnd',
33
+ 'UserPromptSubmit',
34
+ 'PreToolUse',
35
+ 'PostToolUse',
36
+ 'PostToolUseFailure',
37
+ 'Stop',
38
+ 'PreCompact',
39
+ 'PostCompact',
40
+ 'Notification',
41
+ 'SubagentStart',
42
+ 'SubagentStop',
43
+ 'SubagentToolUse',
44
+ 'PermissionRequest',
45
+ 'PermissionGranted',
46
+ 'PermissionDenied',
47
+ 'PreEdit',
48
+ 'PostEdit',
49
+ 'PreWrite',
50
+ 'PostWrite',
51
+ 'PreRead',
52
+ 'PostRead',
53
+ 'PreBash',
54
+ 'PostBash',
55
+ 'McpServerConnect',
56
+ 'McpServerDisconnect',
57
+ 'McpToolCall',
58
+ 'McpToolResult',
59
+ 'AgentSpawn',
60
+ 'AgentComplete',
61
+ 'TaskCompleted',
62
+ 'PromptInjection',
63
+ ];
64
+ /**
65
+ * The 9 events emitted in Phase 1. A separate constant from
66
+ * `ALL_HOOK_EVENTS_V2` so callers can reason about "what fires today"
67
+ * without coupling to the entire reservation.
68
+ */
69
+ export const PHASE_1_HOOK_EVENTS = [
70
+ 'SessionStart',
71
+ 'SessionEnd',
72
+ 'UserPromptSubmit',
73
+ 'PreToolUse',
74
+ 'PostToolUse',
75
+ 'PostToolUseFailure',
76
+ 'Stop',
77
+ 'PreCompact',
78
+ 'PostCompact',
79
+ ];
80
+ /** Default per-hook timeout in ms. */
81
+ export const DEFAULT_HOOK_TIMEOUT_MS_V2 = 5_000;
82
+ /** Hard upper bound on per-hook timeout. */
83
+ export const MAX_HOOK_TIMEOUT_MS_V2 = 60_000;
84
+ /** Hook stdout/stderr cap. Hooks emitting more are killed. */
85
+ export const HOOK_OUTPUT_CAP_BYTES_V2 = 1024 * 1024;
86
+ //# sourceMappingURL=types.js.map