@intended-inc/claude-code-hook 0.1.0 → 0.2.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/dist/bin.mjs CHANGED
@@ -1,16 +1,167 @@
1
1
  #!/usr/bin/env node
2
- import { readFileSync, mkdirSync, writeFileSync } from 'fs';
2
+ import { readFileSync, mkdirSync, writeFileSync, renameSync } from 'fs';
3
3
  import { homedir } from 'os';
4
- import { join } from 'path';
4
+ import { join, dirname } from 'path';
5
+ import { createHash } from 'crypto';
6
+
7
+ var FINAL = /* @__PURE__ */ new Set(["ALLOW", "DENY", "EXPIRED"]);
8
+ var MAX_POLL_SECONDS = 50;
9
+ var MAX_BACKOFF_MS = 1e4;
10
+ var MIN_REPOLL_MS = 1e3;
11
+ var defaultSleep = (ms) => new Promise((r) => setTimeout(r, Math.max(0, ms)));
12
+ function str(v) {
13
+ return typeof v === "string" && v.length > 0 ? v : null;
14
+ }
15
+ function base(intentId, status, reason) {
16
+ return {
17
+ intentId,
18
+ status,
19
+ reason,
20
+ token: null,
21
+ decidedBy: null,
22
+ decidedAt: null,
23
+ escalationId: null,
24
+ expiresAt: null,
25
+ receiptUrl: null
26
+ };
27
+ }
28
+ function parseBody(intentId, body, apiUrl) {
29
+ const status = body.status;
30
+ if (status !== "ALLOW" && status !== "DENY" && status !== "PENDING" && status !== "EXPIRED") return null;
31
+ const receipt = str(body.receiptUrl);
32
+ return {
33
+ intentId: str(body.intentId) ?? intentId,
34
+ status,
35
+ reason: str(body.reason) ?? `Decision: ${status}`,
36
+ token: status === "ALLOW" ? str(body.token) : null,
37
+ decidedBy: body.decidedBy && typeof body.decidedBy === "object" ? body.decidedBy : null,
38
+ decidedAt: str(body.decidedAt),
39
+ escalationId: str(body.escalationId),
40
+ expiresAt: str(body.expiresAt),
41
+ receiptUrl: receipt ? /^https?:\/\//.test(receipt) ? receipt : `${apiUrl}${receipt.startsWith("/") ? "" : "/"}${receipt}` : null
42
+ };
43
+ }
44
+ function retryAfterHeaderMs(res) {
45
+ const raw = res.headers?.get?.("retry-after");
46
+ const n = raw == null ? NaN : Number(raw);
47
+ return Number.isFinite(n) && n > 0 ? n * 1e3 : 0;
48
+ }
49
+ async function waitForDecision(intentId, opts) {
50
+ const apiUrl = (opts.apiUrl ?? "https://api.intended.so").replace(/\/$/, "");
51
+ const fetchImpl = opts.fetchImpl ?? fetch;
52
+ const now = opts.now ?? Date.now;
53
+ const sleep = opts.sleep ?? defaultSleep;
54
+ const deadline = now() + Math.max(0, opts.timeoutMs);
55
+ const headers = {
56
+ authorization: `Bearer ${opts.apiKey}`,
57
+ "x-tenant-id": opts.tenantId
58
+ };
59
+ let backoffMs = 1e3;
60
+ for (; ; ) {
61
+ const remaining = deadline - now();
62
+ const timeoutSec = remaining <= 0 ? 0 : Math.min(MAX_POLL_SECONDS, Math.ceil(remaining / 1e3));
63
+ const url = `${apiUrl}/v1/decisions/${encodeURIComponent(intentId)}/wait?timeout=${timeoutSec}&tenantId=${encodeURIComponent(opts.tenantId)}`;
64
+ const startedAt = now();
65
+ let res = null;
66
+ try {
67
+ res = await fetchImpl(url, {
68
+ headers,
69
+ // The server holds at most timeoutSec; give the network some slack beyond that.
70
+ signal: AbortSignal.timeout(timeoutSec * 1e3 + 15e3)
71
+ });
72
+ } catch {
73
+ res = null;
74
+ }
75
+ let transientWaitMs = 0;
76
+ if (res) {
77
+ if (res.status === 401) {
78
+ return { ...base(intentId, "ERROR", "The Intended API rejected the API key (401). The action is not approved."), error: "unauthorized" };
79
+ }
80
+ if (res.status === 403) {
81
+ return {
82
+ ...base(
83
+ intentId,
84
+ "ERROR",
85
+ "This API key cannot read decisions: it needs the intent:read scope. The action is not approved."
86
+ ),
87
+ error: "forbidden"
88
+ };
89
+ }
90
+ if (res.status === 404) {
91
+ return { ...base(intentId, "ERROR", `Intended has no decision for intent ${intentId}. The action is not approved.`), error: "not_found" };
92
+ }
93
+ if (res.status === 429 || res.status >= 500) {
94
+ transientWaitMs = Math.max(backoffMs, retryAfterHeaderMs(res));
95
+ } else {
96
+ const body = await res.json().catch(() => null);
97
+ const parsed = res.status === 200 && body ? parseBody(intentId, body, apiUrl) : null;
98
+ if (!parsed) {
99
+ return {
100
+ ...base(intentId, "ERROR", `Unrecognised decision response (HTTP ${res.status}). The action is not approved.`),
101
+ error: "bad_response"
102
+ };
103
+ }
104
+ if (FINAL.has(parsed.status)) return parsed;
105
+ if (now() >= deadline) return { ...parsed, timedOut: true };
106
+ const retryAfterMs = typeof body?.retryAfterMs === "number" && body.retryAfterMs > 0 ? body.retryAfterMs : 0;
107
+ const answeredFast = now() - startedAt < Math.min(timeoutSec * 1e3, MIN_REPOLL_MS) / 2;
108
+ const pause = retryAfterMs > 0 ? retryAfterMs : answeredFast ? MIN_REPOLL_MS : 0;
109
+ if (pause > 0) await sleep(Math.min(pause, Math.max(0, deadline - now())));
110
+ backoffMs = 1e3;
111
+ continue;
112
+ }
113
+ } else {
114
+ transientWaitMs = backoffMs;
115
+ }
116
+ if (now() >= deadline) {
117
+ return {
118
+ ...base(
119
+ intentId,
120
+ "PENDING",
121
+ "The Intended decision service could not be reached before the wait ended. The action is still not approved."
122
+ ),
123
+ timedOut: true
124
+ };
125
+ }
126
+ await sleep(Math.min(transientWaitMs, Math.max(0, deadline - now())));
127
+ backoffMs = Math.min(backoffMs * 2, MAX_BACKOFF_MS);
128
+ }
129
+ }
130
+ function canonicalJson(value) {
131
+ if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
132
+ if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
133
+ const obj = value;
134
+ return `{${Object.keys(obj).sort().filter((k) => obj[k] !== void 0).map((k) => `${JSON.stringify(k)}:${canonicalJson(obj[k])}`).join(",")}}`;
135
+ }
136
+ function toolCallKey(toolName, args) {
137
+ return createHash("sha256").update(`${toolName}
138
+ ${canonicalJson(args ?? {})}`).digest("hex");
139
+ }
5
140
 
6
141
  // src/evaluate.ts
7
142
  var AUTHORITY_STATUSES = /* @__PURE__ */ new Set([200, 202, 403]);
8
- function describe(name, args) {
9
- const rendered = Object.entries(args).map(([k, v]) => `${k}=${typeof v === "string" ? v : JSON.stringify(v)}`).join(", ");
10
- return rendered ? `Call tool "${name}" with ${rendered}` : `Call tool "${name}"`;
143
+ var DEFAULT_ESCALATION_WAIT_SECONDS = 45;
144
+ var MAX_DESCRIBED_KEYS = 20;
145
+ var SAFE_KEY = /^[A-Za-z_][A-Za-z0-9_.-]{0,63}$/;
146
+ function describeToolCall(name, args) {
147
+ const keys = Object.keys(args);
148
+ if (keys.length === 0) return `Call tool "${name}"`;
149
+ const named = keys.filter((k) => SAFE_KEY.test(k)).slice(0, MAX_DESCRIBED_KEYS);
150
+ const unnamed = keys.length - named.length;
151
+ const list = [...named, ...unnamed > 0 ? [`+${unnamed} more`] : []].join(", ");
152
+ return `Call tool "${name}" with args: ${list}`;
153
+ }
154
+ function escalationWaitMs(env) {
155
+ const raw = env.INTENDED_HOOK_ESCALATION_WAIT_SECONDS;
156
+ if (raw === void 0 || raw.trim() === "") return DEFAULT_ESCALATION_WAIT_SECONDS * 1e3;
157
+ const n = Number(raw);
158
+ return Number.isFinite(n) && n >= 0 ? Math.round(n * 1e3) : DEFAULT_ESCALATION_WAIT_SECONDS * 1e3;
159
+ }
160
+ function onPending(env) {
161
+ return env.INTENDED_HOOK_ON_PENDING?.trim().toLowerCase() === "ask" ? "ask" : "deny";
11
162
  }
12
163
  async function evaluateHookDecision(input) {
13
- const { event, env } = input;
164
+ const { event, env, pendingStore } = input;
14
165
  const fetchImpl = input.fetchImpl ?? globalThis.fetch;
15
166
  const toolName = event.tool_name ?? "unknown";
16
167
  const args = { ...event.tool_input ?? {} };
@@ -18,6 +169,21 @@ async function evaluateHookDecision(input) {
18
169
  const tenantId = env.INTENDED_TENANT_ID;
19
170
  const apiUrl = (env.INTENDED_API_URL ?? "https://api.intended.so").replace(/\/$/, "");
20
171
  if (!apiKey || !tenantId) return { permissionDecision: "allow" };
172
+ const key = toolCallKey(toolName, args);
173
+ const wait = (intentId) => waitForDecision(intentId, {
174
+ apiUrl,
175
+ apiKey,
176
+ tenantId,
177
+ fetchImpl,
178
+ timeoutMs: escalationWaitMs(env),
179
+ now: input.now,
180
+ sleep: input.sleep
181
+ });
182
+ const pendingIntentId = safe(() => pendingStore?.get(key));
183
+ if (pendingIntentId) {
184
+ const outcome = await wait(pendingIntentId);
185
+ return settle(outcome, pendingIntentId, toolName, key, env, pendingStore);
186
+ }
21
187
  let res;
22
188
  try {
23
189
  res = await fetchImpl(`${apiUrl}/v1/agent-intent`, {
@@ -27,7 +193,7 @@ async function evaluateHookDecision(input) {
27
193
  tenantId,
28
194
  actor: { id: `claude-code:${toolName}`, type: "agent" },
29
195
  source: { connector: "claude-code", harness: "claude-code", tool: toolName },
30
- proposedAction: describe(toolName, args),
196
+ proposedAction: describeToolCall(toolName, args),
31
197
  arguments: args
32
198
  })
33
199
  });
@@ -48,9 +214,117 @@ async function evaluateHookDecision(input) {
48
214
  tokenIssued: Boolean(data.authorityDecisionToken)
49
215
  };
50
216
  if (verdict === "APPROVED") return { permissionDecision: "allow", record };
51
- if (verdict === "ESCALATED") return { permissionDecision: "ask", reason: `Intended: requires human approval \u2014 ${reason}`, record };
217
+ if (verdict === "ESCALATED") {
218
+ if (!data.intentId) {
219
+ return { permissionDecision: "deny", reason: "Intended: escalated without an intent id to wait on \u2014 fail-closed.", record };
220
+ }
221
+ const outcome = await wait(data.intentId);
222
+ return settle(outcome, data.intentId, toolName, key, env, pendingStore, reason);
223
+ }
52
224
  return { permissionDecision: "deny", reason: `Intended: denied \u2014 ${reason || "fail-closed (unrecognized decision)"}`, record };
53
225
  }
226
+ function settle(outcome, intentId, toolName, key, env, store, escalationReason = "") {
227
+ const record = {
228
+ tool: toolName,
229
+ verdict: outcome.status === "ALLOW" ? "APPROVED_AFTER_ESCALATION" : outcome.status === "PENDING" ? "ESCALATED" : outcome.status,
230
+ reason: outcome.reason || escalationReason,
231
+ intentId,
232
+ tokenIssued: Boolean(outcome.token)
233
+ };
234
+ if (outcome.status === "ALLOW") {
235
+ safe(() => store?.delete(key));
236
+ return { permissionDecision: "allow", record };
237
+ }
238
+ if (outcome.status === "PENDING") {
239
+ safe(() => store?.set(key, intentId, outcome.expiresAt));
240
+ const message = `Intended: awaiting human approval (intent ${intentId}). Ask an approver to approve it in the Intended console, then retry the same tool call; it will be allowed then.` + (outcome.timedOut && /could not be reached/.test(outcome.reason) ? ` (${outcome.reason})` : "");
241
+ return { permissionDecision: onPending(env), reason: message, record };
242
+ }
243
+ safe(() => store?.delete(key));
244
+ if (outcome.status === "EXPIRED") {
245
+ return {
246
+ permissionDecision: "deny",
247
+ reason: `Intended: denied \u2014 no approver decided before the approval request expired (intent ${intentId}).`,
248
+ record
249
+ };
250
+ }
251
+ if (outcome.status === "ERROR") {
252
+ return { permissionDecision: "deny", reason: `Intended: could not get the approval decision \u2014 ${outcome.reason}`, record };
253
+ }
254
+ return { permissionDecision: "deny", reason: `Intended: denied \u2014 ${outcome.reason}`, record };
255
+ }
256
+ function safe(fn) {
257
+ try {
258
+ return fn();
259
+ } catch {
260
+ return void 0;
261
+ }
262
+ }
263
+ var DEFAULT_TTL_MS = 24 * 60 * 60 * 1e3;
264
+ var FilePendingStore = class {
265
+ constructor(path, maxEntries = 200, now = Date.now) {
266
+ this.path = path;
267
+ this.maxEntries = maxEntries;
268
+ this.now = now;
269
+ }
270
+ path;
271
+ maxEntries;
272
+ now;
273
+ get(key) {
274
+ const entries = this.load();
275
+ const e = entries[key];
276
+ if (!e) return void 0;
277
+ if (e.expiresAt <= this.now()) {
278
+ delete entries[key];
279
+ this.save(entries);
280
+ return void 0;
281
+ }
282
+ return e.intentId;
283
+ }
284
+ set(key, intentId, expiresAt) {
285
+ const entries = this.load();
286
+ const parsed = expiresAt ? Date.parse(expiresAt) : NaN;
287
+ entries[key] = {
288
+ intentId,
289
+ expiresAt: Number.isFinite(parsed) ? parsed : this.now() + DEFAULT_TTL_MS,
290
+ savedAt: this.now()
291
+ };
292
+ const keys = Object.keys(entries).sort((a, b) => entries[a].savedAt - entries[b].savedAt);
293
+ for (const k of keys.slice(0, Math.max(0, keys.length - this.maxEntries))) delete entries[k];
294
+ this.save(entries);
295
+ }
296
+ delete(key) {
297
+ const entries = this.load();
298
+ if (!(key in entries)) return;
299
+ delete entries[key];
300
+ this.save(entries);
301
+ }
302
+ /** Read the file and drop expired entries. */
303
+ load() {
304
+ let raw;
305
+ try {
306
+ raw = JSON.parse(readFileSync(this.path, "utf8"));
307
+ } catch {
308
+ return {};
309
+ }
310
+ const out = {};
311
+ if (!raw || typeof raw !== "object") return out;
312
+ const t = this.now();
313
+ for (const [k, v] of Object.entries(raw)) {
314
+ const e = v;
315
+ if (e && typeof e.intentId === "string" && typeof e.expiresAt === "number" && typeof e.savedAt === "number" && e.expiresAt > t) {
316
+ out[k] = { intentId: e.intentId, expiresAt: e.expiresAt, savedAt: e.savedAt };
317
+ }
318
+ }
319
+ return out;
320
+ }
321
+ save(entries) {
322
+ mkdirSync(dirname(this.path), { recursive: true });
323
+ const tmp = `${this.path}.${process.pid}.tmp`;
324
+ writeFileSync(tmp, JSON.stringify(entries, null, 2), { mode: 384 });
325
+ renameSync(tmp, this.path);
326
+ }
327
+ };
54
328
 
55
329
  // src/bin.ts
56
330
  async function main() {
@@ -61,7 +335,8 @@ async function main() {
61
335
  process.exit(0);
62
336
  return;
63
337
  }
64
- const decision = await evaluateHookDecision({ event, env: process.env });
338
+ const pendingStore = new FilePendingStore(join(homedir(), ".intended", "pending.json"));
339
+ const decision = await evaluateHookDecision({ event, env: process.env, pendingStore });
65
340
  if (decision.record) {
66
341
  try {
67
342
  const dir = join(homedir(), ".intended");
package/dist/index.d.mts CHANGED
@@ -1,15 +1,3 @@
1
- /**
2
- * Pure, testable core of the Intended Claude Code PreToolUse hook.
3
- *
4
- * Contract:
5
- * - Unconfigured (no API key / tenant) → ALLOW (fail-open; never bricks a repo).
6
- * - Configured:
7
- * 200 APPROVED → allow
8
- * 202 ESCALATED → ask (human)
9
- * 403 DENIED → deny
10
- * any other status (401/429/5xx/…), a network throw, or an unrecognized body
11
- * → DENY (fail-closed). Never falls through to allow.
12
- */
13
1
  interface HookEvent {
14
2
  tool_name?: string;
15
3
  tool_input?: Record<string, unknown>;
@@ -18,6 +6,10 @@ interface HookEnv {
18
6
  INTENDED_API_KEY?: string;
19
7
  INTENDED_TENANT_ID?: string;
20
8
  INTENDED_API_URL?: string;
9
+ /** Seconds to wait for the approver on ESCALATED (default 45). */
10
+ INTENDED_HOOK_ESCALATION_WAIT_SECONDS?: string;
11
+ /** What to do when the decision is still pending after the wait: "deny" (default) or "ask". */
12
+ INTENDED_HOOK_ON_PENDING?: string;
21
13
  }
22
14
  interface HookDecision {
23
15
  permissionDecision: "allow" | "deny" | "ask";
@@ -34,11 +26,51 @@ interface HookDecision {
34
26
  type FetchLike = (url: string, init?: unknown) => Promise<{
35
27
  status: number;
36
28
  json: () => Promise<unknown>;
29
+ headers?: {
30
+ get(name: string): string | null;
31
+ };
37
32
  }>;
33
+ /**
34
+ * Where escalations still waiting on an approver are remembered between hook
35
+ * runs (each run is a separate process). Keyed by toolCallKey(tool, args).
36
+ */
37
+ interface PendingStore {
38
+ get(key: string): string | undefined;
39
+ set(key: string, intentId: string, expiresAt?: string | null): void;
40
+ delete(key: string): void;
41
+ }
42
+ /** Claude Code hooks time out at 60s by default; leave headroom. */
43
+ declare const DEFAULT_ESCALATION_WAIT_SECONDS = 45;
44
+ /**
45
+ * The action text Intended stores (and explain_decision returns): the tool name
46
+ * and argument KEYS, never values. Values (e.g. the Bash command) travel only in
47
+ * `arguments`, which the API evaluates in memory and stores as a sha256 digest.
48
+ */
49
+ declare function describeToolCall(name: string, args: Record<string, unknown>): string;
50
+ /** INTENDED_HOOK_ESCALATION_WAIT_SECONDS → ms. Unset or invalid → 45s. */
51
+ declare function escalationWaitMs(env: HookEnv): number;
38
52
  declare function evaluateHookDecision(input: {
39
53
  event: HookEvent;
40
54
  env: HookEnv;
41
55
  fetchImpl?: FetchLike;
56
+ /** Remembers pending escalations across hook runs. Optional: without it, every call is a fresh intent. */
57
+ pendingStore?: PendingStore;
58
+ /** Clock + sleep overrides (tests). */
59
+ now?: () => number;
60
+ sleep?: (ms: number) => Promise<void>;
42
61
  }): Promise<HookDecision>;
43
62
 
44
- export { type FetchLike, type HookDecision, type HookEnv, type HookEvent, evaluateHookDecision };
63
+ declare class FilePendingStore implements PendingStore {
64
+ private readonly path;
65
+ private readonly maxEntries;
66
+ private readonly now;
67
+ constructor(path: string, maxEntries?: number, now?: () => number);
68
+ get(key: string): string | undefined;
69
+ set(key: string, intentId: string, expiresAt?: string | null): void;
70
+ delete(key: string): void;
71
+ /** Read the file and drop expired entries. */
72
+ private load;
73
+ private save;
74
+ }
75
+
76
+ export { DEFAULT_ESCALATION_WAIT_SECONDS, type FetchLike, FilePendingStore, type HookDecision, type HookEnv, type HookEvent, type PendingStore, describeToolCall, escalationWaitMs, evaluateHookDecision };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,3 @@
1
- /**
2
- * Pure, testable core of the Intended Claude Code PreToolUse hook.
3
- *
4
- * Contract:
5
- * - Unconfigured (no API key / tenant) → ALLOW (fail-open; never bricks a repo).
6
- * - Configured:
7
- * 200 APPROVED → allow
8
- * 202 ESCALATED → ask (human)
9
- * 403 DENIED → deny
10
- * any other status (401/429/5xx/…), a network throw, or an unrecognized body
11
- * → DENY (fail-closed). Never falls through to allow.
12
- */
13
1
  interface HookEvent {
14
2
  tool_name?: string;
15
3
  tool_input?: Record<string, unknown>;
@@ -18,6 +6,10 @@ interface HookEnv {
18
6
  INTENDED_API_KEY?: string;
19
7
  INTENDED_TENANT_ID?: string;
20
8
  INTENDED_API_URL?: string;
9
+ /** Seconds to wait for the approver on ESCALATED (default 45). */
10
+ INTENDED_HOOK_ESCALATION_WAIT_SECONDS?: string;
11
+ /** What to do when the decision is still pending after the wait: "deny" (default) or "ask". */
12
+ INTENDED_HOOK_ON_PENDING?: string;
21
13
  }
22
14
  interface HookDecision {
23
15
  permissionDecision: "allow" | "deny" | "ask";
@@ -34,11 +26,51 @@ interface HookDecision {
34
26
  type FetchLike = (url: string, init?: unknown) => Promise<{
35
27
  status: number;
36
28
  json: () => Promise<unknown>;
29
+ headers?: {
30
+ get(name: string): string | null;
31
+ };
37
32
  }>;
33
+ /**
34
+ * Where escalations still waiting on an approver are remembered between hook
35
+ * runs (each run is a separate process). Keyed by toolCallKey(tool, args).
36
+ */
37
+ interface PendingStore {
38
+ get(key: string): string | undefined;
39
+ set(key: string, intentId: string, expiresAt?: string | null): void;
40
+ delete(key: string): void;
41
+ }
42
+ /** Claude Code hooks time out at 60s by default; leave headroom. */
43
+ declare const DEFAULT_ESCALATION_WAIT_SECONDS = 45;
44
+ /**
45
+ * The action text Intended stores (and explain_decision returns): the tool name
46
+ * and argument KEYS, never values. Values (e.g. the Bash command) travel only in
47
+ * `arguments`, which the API evaluates in memory and stores as a sha256 digest.
48
+ */
49
+ declare function describeToolCall(name: string, args: Record<string, unknown>): string;
50
+ /** INTENDED_HOOK_ESCALATION_WAIT_SECONDS → ms. Unset or invalid → 45s. */
51
+ declare function escalationWaitMs(env: HookEnv): number;
38
52
  declare function evaluateHookDecision(input: {
39
53
  event: HookEvent;
40
54
  env: HookEnv;
41
55
  fetchImpl?: FetchLike;
56
+ /** Remembers pending escalations across hook runs. Optional: without it, every call is a fresh intent. */
57
+ pendingStore?: PendingStore;
58
+ /** Clock + sleep overrides (tests). */
59
+ now?: () => number;
60
+ sleep?: (ms: number) => Promise<void>;
42
61
  }): Promise<HookDecision>;
43
62
 
44
- export { type FetchLike, type HookDecision, type HookEnv, type HookEvent, evaluateHookDecision };
63
+ declare class FilePendingStore implements PendingStore {
64
+ private readonly path;
65
+ private readonly maxEntries;
66
+ private readonly now;
67
+ constructor(path: string, maxEntries?: number, now?: () => number);
68
+ get(key: string): string | undefined;
69
+ set(key: string, intentId: string, expiresAt?: string | null): void;
70
+ delete(key: string): void;
71
+ /** Read the file and drop expired entries. */
72
+ private load;
73
+ private save;
74
+ }
75
+
76
+ export { DEFAULT_ESCALATION_WAIT_SECONDS, type FetchLike, FilePendingStore, type HookDecision, type HookEnv, type HookEvent, type PendingStore, describeToolCall, escalationWaitMs, evaluateHookDecision };